paper_id
stringlengths
9
16
version
stringclasses
26 values
yymm
stringclasses
311 values
created
timestamp[s]
title
stringlengths
6
335
secondary_subfield
sequencelengths
1
8
abstract
stringlengths
25
3.93k
primary_subfield
stringclasses
124 values
field
stringclasses
20 values
fulltext
stringlengths
0
2.84M
1109.5981
2
1109
2012-02-18T20:39:18
LSRN: A Parallel Iterative Solver for Strongly Over- or Under-Determined Systems
[ "cs.DS", "cs.MS", "math.NA" ]
We describe a parallel iterative least squares solver named \texttt{LSRN} that is based on random normal projection. \texttt{LSRN} computes the min-length solution to $\min_{x \in \mathbb{R}^n} \|A x - b\|_2$, where $A \in \mathbb{R}^{m \times n}$ with $m \gg n$ or $m \ll n$, and where $A$ may be rank-deficient. Tikhonov regularization may also be included. Since $A$ is only involved in matrix-matrix and matrix-vector multiplications, it can be a dense or sparse matrix or a linear operator, and \texttt{LSRN} automatically speeds up when $A$ is sparse or a fast linear operator. The preconditioning phase consists of a random normal projection, which is embarrassingly parallel, and a singular value decomposition of size $\lceil \gamma \min(m,n) \rceil \times \min(m,n)$, where $\gamma$ is moderately larger than 1, e.g., $\gamma = 2$. We prove that the preconditioned system is well-conditioned, with a strong concentration result on the extreme singular values, and hence that the number of iterations is fully predictable when we apply LSQR or the Chebyshev semi-iterative method. As we demonstrate, the Chebyshev method is particularly efficient for solving large problems on clusters with high communication cost. Numerical results demonstrate that on a shared-memory machine, \texttt{LSRN} outperforms LAPACK's DGELSD on large dense problems, and MATLAB's backslash (SuiteSparseQR) on sparse problems. Further experiments demonstrate that \texttt{LSRN} scales well on an Amazon Elastic Compute Cloud cluster.
cs.DS
cs
LSRN: A PARALLEL ITERATIVE SOLVER FOR STRONGLY OVER- OR UNDER-DETERMINED SYSTEMS XIANGRUI MENG∗, MICHAEL A. SAUNDERS† , AND MICHAEL W. MAHONEY‡ Abstract. We describe a parallel iterative least squares solver named LSRN that is based on random normal projection. LSRN computes the min-length solution to minx∈Rn (cid:107)Ax − b(cid:107)2, where A ∈ Rm×n with m (cid:29) n or m (cid:28) n, and where A may be rank-deficient. Tikhonov regularization may also be included. Since A is only involved in matrix-matrix and matrix-vector multiplications, it can be a dense or sparse matrix or a linear operator, and LSRN automatically speeds up when A is sparse or a fast linear operator. The preconditioning phase consists of a random normal projection, which is embarrassingly parallel, and a singular value decomposition of size (cid:100)γ min(m, n)(cid:101) × min(m, n), where γ is moderately larger than 1, e.g., γ = 2. We prove that the preconditioned system is well-conditioned, with a strong concentration result on the extreme singular values, and hence that the number of iterations is fully predictable when we apply LSQR or the Chebyshev semi-iterative method. As we demonstrate, the Chebyshev method is particularly efficient for solving large problems on clusters with high communication cost. Numerical results demonstrate that on a shared-memory machine, LSRN outperforms LAPACK's DGELSD on large dense problems, and MATLAB's backslash (SuiteSparseQR) on sparse problems. Further experiments demonstrate that LSRN scales well on an Amazon Elastic Compute Cloud cluster. Key words. linear least squares, over-determined system, under-determined system, rank- deficient, minimum-length solution, LAPACK, sparse matrix, iterative method, preconditioning, LSQR, Chebyshev semi-iterative method, Tikhonov regularization, ridge regression, parallel com- puting, random projection, random sampling, random matrix, randomized algorithm AMS subject classifications. 65F08, 65F10, 65F20, 65F22, 65F35, 65F50, 15B52 DOI. xxx/xxxxxxxxx 1. Introduction. Randomized algorithms have become indispensable in many areas of computer science, with applications ranging from complexity theory to com- binatorial optimization, cryptography, and machine learning. Randomization has also been used in numerical linear algebra (for instance, the initial vector in the power iter- ation is chosen at random so that almost surely it has a nonzero component along the direction of the dominant eigenvector), yet most well-developed matrix algorithms, e.g., matrix factorizations and linear solvers, are deterministic. In recent years, how- ever, motivated by large data problems, very nontrivial randomized algorithms for very large matrix problems have drawn considerable attention from researchers, orig- inally in theoretical computer science and subsequently in numerical linear algebra and scientific computing. By randomized algorithms, we refer in particular to ran- dom sampling and random projection algorithms [7, 22, 8, 21, 1]. For a comprehensive overview of these developments, see the review of Mahoney [17], and for an excellent overview of numerical aspects of coupling randomization with classical low-rank ma- trix factorization methods, see the review of Halko, Martinsson, and Tropp [13]. ∗ICME, Stanford University, Stanford, CA 94305 ([email protected]). Partially supported by the U.S. Army Research Laboratory, through the Army High Performance Computing Research Center, Cooperative Agreement W911NF-07-0027 and by NSF grant DMS-1009005. †Systems Optimization Laboratory, Department of Management Science and Engineering, Stan- ford University, Stanford CA 94305 ([email protected]). Partially supported by the U.S. Army Research Laboratory, through the Army High Performance Computing Research Center, Cooperative Agreement W911NF-07-0027 and by NSF grant DMS-1009005. ‡Department of Mathematics, Stanford University, CA 94305 ([email protected]). Par- tially supported by NSF grant DMS-1009005. 1 2 XIANGRUI MENG, MICHAEL SAUNDERS, AND MICHAEL MAHONEY Here, we consider high-precision solving of linear least squares (LS) problems that In particular, are strongly over- or under-determined, and possibly rank-deficient. given a matrix A ∈ Rm×n and a vector b ∈ Rm, where m (cid:29) n or m (cid:28) n and we do not assume that A has full rank, we wish to develop randomized algorithms to compute accurately the unique min-length solution to the problem (cid:107)Ax − b(cid:107)2. minimizex∈Rn (1.1) If we let r = rank(A) ≤ min(m, n), then recall that if r < n (the LS problem is under-determined or rank-deficient), then (1.1) has an infinite number of minimizers. In that case, the set of all minimizers is convex and hence has a unique element having minimum length. On the other hand, if r = n so the problem has full rank, there exists only one minimizer to (1.1) and hence it must have the minimum length. In either case, we denote this unique min-length solution to (1.1) by x∗. That is, x∗ = arg min(cid:107)x(cid:107)2 subject to x ∈ arg min z (cid:107)Az − b(cid:107)2. (1.2) LS problems of this form have a long history, tracing back to Gauss, and they arise in numerous applications. The demand for faster LS solvers will continue to grow in light of new data applications and as problem scales become larger and larger. In this paper, we describe an LS solver called LSRN for these strongly over- or under-determined, and possibly rank-deficient, systems. LSRN uses random normal projections to compute a preconditioner matrix such that the preconditioned system is provably extremely well-conditioned. Importantly for large-scale applications, the preconditioning process is embarrassingly parallel, and it automatically speeds up with sparse matrices and fast linear operators. LSQR [20] or the Chebyshev semi- iterative (CS) method [11] can be used at the iterative step to compute the min-length solution within just a few iterations. We show that the latter method is preferred on clusters with high communication cost. Because of its provably-good conditioning properties, LSRN has a fully predictable run-time performance, just like direct solvers, and it scales well in parallel environ- ments. On large dense systems, LSRN is faster than LAPACK's DGELSD for strongly over-determined problems, and is much faster for strongly under-determined prob- lems, although solvers using fast random projections, like Blendenpik [1], are still slightly faster in both cases. On sparse systems, LSRN runs significantly faster than competing solvers, for both the strongly over- or under-determined cases. In section 2 we describe existing deterministic LS solvers and recent randomized algorithms for the LS problem. In section 3 we show how to do preconditioning cor- rectly for rank-deficient LS problems, and in section 4 we introduce LSRN and discuss its properties. Section 5 describes how LSRN can handle Tikhonov regularization for both over- and under-determined systems, and in section 6 we provide a detailed empirical evaluation illustrating the behavior of LSRN. 2. Least squares solvers. In this section we discuss related work, including deterministic direct and iterative methods as well as recently developed randomized methods, for computing solutions to LS problems, and we discuss how our results fit into this broader context. 2.1. Deterministic methods. It is well known that x∗ in (1.2) can be com- puted using the singular value decomposition (SVD) of A. Let A = U ΣV T be the economy-sized SVD, where U ∈ Rm×r, Σ ∈ Rr×r, and V ∈ Rn×r. We have LSRN: A PARALLEL ITERATIVE SOLVER 3 x∗ = V Σ−1U Tb. The matrix V Σ−1U T is the Moore-Penrose pseudoinverse of A, de- noted by A†. The pseudoinverse is defined and unique for any matrix. Hence we can simply write x∗ = A†b. The SVD approach is accurate and robust to rank-deficiency. Another way to solve (1.2) is using a complete orthogonal factorization of A. If we can find orthonormal matrices Q ∈ Rm×r and Z ∈ Rn×r, and a matrix T ∈ Rr×r, such that A = QT Z T, then the min-length solution is given by x∗ = ZT −1QTb. We can treat SVD as a special case of complete orthogonal factorization. In practice, complete orthogonal factorization is usually computed via rank-revealing QR factorizations, making T a triangular matrix. The QR approach is less expensive than SVD, but it is slightly less robust at determining the rank of A. A third way to solve (1.2) is by computing the min-length solution to the normal equation ATAx = ATb, namely x∗ = (ATA)†ATb = AT(AAT)†b. (2.1) It is easy to verify the correctness of (2.1) by replacing A by its economy-sized SVD U ΣV T. If r = min(m, n), a Cholesky factorization of either ATA (if m ≥ n) or AAT (if m ≤ n) solves (2.1) nicely. If r < min(m, n), we need the eigensystem of ATA or AAT to compute x∗. The normal equation approach is the least expensive among the three direct approaches we have mentioned, especially when m (cid:29) n or m (cid:28) n, but it is also the least accurate one, especially on ill-conditioned problems. See Chapter 5 of Golub and Van Loan [10] for a detailed analysis. Instead of these direct methods, we can use iterative methods to solve (1.1). If all the iterates {x(k)} are in range(AT) and if {x(k)} converges to a minimizer, it must be the minimizer having minimum length, i.e., the solution to (1.2). This is the case when we use a Krylov subspace method starting with a zero vector. For example, the conjugate gradient (CG) method on the normal equation leads to the min-length solution (see Paige and Saunders [19]). In practice, CGLS [15], LSQR [20] are preferable because they are equivalent to applying CG to the normal equation in exact arithmetic but they are numerically more stable. Other Krylov subspace methods such as the CS method [11] and LSMR [9] can solve (1.1) as well. Importantly, however, it is in general hard to predict the number of iterations for CG-like methods. The convergence rate is affected by the condition number of ATA. A classical result [16, p.187] states that (cid:107)x(k) − x∗(cid:107)ATA (cid:107)x(0) − x∗(cid:107)ATA (cid:32)(cid:112)κ(ATA) − 1 (cid:112)κ(ATA) + 1 ≤ 2 (cid:33)k , (2.2) where (cid:107)z(cid:107)ATA = zTATAz = (cid:107)Az(cid:107)2 for any z ∈ Rn, and where κ(ATA) is the condition number of ATA under the 2-norm. Estimating κ(ATA) is generally as hard as solving the LS problem itself, and in practice the bound does not hold in any case unless reorthogonalization is used. Thus, the computational cost of CG-like methods remains unpredictable in general, except when ATA is very well-conditioned and the condition number can be well estimated. 2.2. Randomized methods. In 2007, Drineas, Mahoney, Muthukrishnan, and Sarl´os [8] introduced two randomized algorithms for the LS problem, each of which computes a relative-error approximation to the min-length solution in O(mn log n) time, when m (cid:29) n. Both of these algorithms apply a randomized Hadamard trans- form to the columns of A, thereby generating a problem of smaller size, one using 4 XIANGRUI MENG, MICHAEL SAUNDERS, AND MICHAEL MAHONEY uniformly random sampling and the other using a sparse random projection. They proved that, in both cases, the solution to the smaller problem leads to relative-error approximations of the original problem. The accuracy of the approximate solution de- pends on the sample size; and to have relative precision ε, one should sample O(n/ε) rows after the randomized Hadamard transform. This is suitable when low accuracy is acceptable, but the ε dependence quickly becomes the bottleneck otherwise. Using those algorithms as preconditioners was also mentioned in [8]. This work laid the ground for later algorithms and implementations. Later, in 2008, Rokhlin and Tygert [21] described a related randomized algorithm for over-determined systems. They used a randomized transform named SRFT that consists of m random Givens rotations, a random diagonal scaling, a discrete Fourier transform, and a random sampling. They considered using their method as a precon- ditioning method, and they showed that to get relative precision ε, only O(n log(1/ε)) samples are needed. In addition, they proved that if the sample size is greater than 4n2, the condition number of the preconditioned system is bounded above by a con- stant. Although choosing this many samples would adversely affect the running time of their solver, they also illustrated examples of input matrices for which the 4n2 sample bound was weak and for which many fewer samples sufficed. Then, in 2010, Avron, Maymounkov, and Toledo [1] implemented a high-precision LS solver, called Blendenpik, and compared it to LAPACK's DGELS and to LSQR with no preconditioning. Blendenpik uses a Walsh-Hadamard transform, a discrete cosine transform, or a discrete Hartley transform for blending the rows/columns, followed by a random sampling, to generate a problem of smaller size. The R factor from the QR factorization of the smaller matrix is used as the preconditioner for LSQR. Based on their analysis, the condition number of the preconditioned system depends on the coherence or statistical leverage scores of A, i.e., the maximal row norm of U , where U is an orthonormal basis of range(A). We note that a solver for under-determined problems is also included in the Blendenpik package. In 2011, Coakley, Rokhlin, and Tygert [2] described an algorithm that is also based on random normal projections. It computes the orthogonal projection of any vector b onto the null space of A or onto the row space of A via a preconditioned normal equation. The algorithm solves the over-determined LS problem as an intermediate step. They show that the normal equation is well-conditioned and hence the solution is reliable. For an over-determined problem of size m × n, the algorithm requires applying A or AT 3n + 6 times, while LSRN needs approximately 2n + 200 matrix- vector multiplications under the default setting. Asymptotically, LSRN will become faster as n increases beyond several hundred. See section 4.3 for further complexity analysis of LSRN. 2.3. Relationship with our contributions. All prior approaches assume that A has full rank, and for those based on iterative solvers, none provides a tight upper bound on the condition number of the preconditioned system (and hence the number of iterations). For LSRN, Theorem 3.2 ensures that the min-length solution is preserved, independent of the rank, and Theorems 4.4 and 4.5 provide bounds on the condition number and number of iterations, independent of the spectrum of A. In addition to handling rank-deficiency well, LSRN can even take advantage of it, resulting in a smaller condition number and fewer iterations. Some prior work on the LS problem has explored "fast" randomized transforms that run in roughly O(mn log m) time on a dense matrix A, while the random normal projection we use in LSRN takes O(mn2) time. Although this could be an issue for some LSRN: A PARALLEL ITERATIVE SOLVER 5 applications, the use of random normal projections comes with several advantages. First, if A is a sparse matrix or a linear operator, which is common in large-scale applications, then the Hadamard-based fast transforms are no longer "fast". Second, the random normal projection is easy to implement using threads or MPI, and it scales well in parallel environments. Third, the strong symmetry of the standard normal distribution helps give the strong high probability bounds on the condition number in terms of sample size. These bounds depend on nothing but s/r, where s is the sample size. For example, if s = 4r, Theorem 4.4 ensures that, with high probability, the condition number of the preconditioned system is less than 3. This last property about the condition number of the preconditioned system makes the number of iterations and thus the running time of LSRN fully predictable like for a direct method. It also enables use of the CS method, which needs only one level-1 and two level-2 BLAS operations per iteration, and is particularly suitable for clusters with high communication cost because it doesn't have vector inner products that require synchronization between nodes. Although the CS method has the same theoretical upper bound on the convergence rate as CG-like methods, it requires ac- curate bounds on the singular values in order to work efficiently. Such bounds are generally hard to come by, limiting the popularity of the CS method in practice, but they are provided for the preconditioned system by our Theorem 4.4, and we do achieve high efficiency in our experiments. 3. Preconditioning for linear least squares. In light of (2.2), much effort has been made to transform a linear system into an equivalent system with reduced condition number. This preconditioning, for a square linear system Bx = d of full rank, usually takes one of the following forms: left preconditioning M TBx = M Td, right preconditioning BN y = d, x = N y, left and right preconditioning M TBN y = M Td, x = N y. Clearly, the preconditioned system is consistent with the original one, i.e., has the same x∗ as the unique solution, if the preconditioners M and N are nonsingular. For the general LS problem (1.2), preconditioning needs better handling in order to produce the same min-length solution as the original problem. For example, if we apply left preconditioning to the LS problem minx (cid:107)Ax − b(cid:107)2, the preconditioned system becomes minx (cid:107)M TAx − M Tb(cid:107)2, and its min-length solution is given by x∗ left = (M TA)†M Tb. Similarly, the min-length solution to the right preconditioned system is given by x∗ right = N (AN )†b. left = x∗, respectively. The following lemma states the necessary and sufficient conditions for A† = N (AN )† or A† = (M TA)†M T to hold. Note that these conditions holding certainly imply that x∗ right = x∗ and x∗ Lemma 3.1. Given A ∈ Rm×n, N ∈ Rn×p and M ∈ Rm×q, we have 1. A† = N (AN )† if and only if range(N N TAT) = range(AT), 2. A† = (M TA)†M T if and only if range(M M TA) = range(A). Proof. Let r = rank(A) and U ΣV T be A's economy-sized SVD as in section 2.1, with A† = V Σ−1U T. Before continuing our proof, we reference the following facts about the pseudoinverse: 6 XIANGRUI MENG, MICHAEL SAUNDERS, AND MICHAEL MAHONEY 1. B† = B T(BB T)† for any matrix B, 2. For any matrices B and C such that BC is defined, (BC)† = C†B† if (i) B TB = I or (ii) CC T = I or (iii) B has full column rank and C has full row rank. Now let's prove the "if" part of the first statement. If range(N N TAT) = range(AT) = range(V ), we can write N N TAT as V Z where Z has full row rank. Then, N (AN )† = N (AN )T(AN (AN )T)† = N N TAT(AN N TAT)† = V Z(U ΣV TV Z)† = V Z(U ΣZ)† = V ZZ†Σ−1U T = V Σ−1U T = A†. (cid:18) Z (cid:19) Conversely, if N (AN )† = A†, we know that range(N (AN )†) = range(A†) = range(V ) and hence range(V ) ⊆ range(N ). Then we can decompose N as (V Vc) = V Z + VcZc, where Vc is orthonormal, V TVc = 0, and has full row rank. Then, (cid:18) Z Zc (cid:19) Zc 0 = N (AN )† − A† = (V Z + VcZc)(U ΣV T(V Z + VcZc))† − V Σ−1U T = (V Z + VcZc)(U ΣZ)† − V Σ−1U T = (V Z + VcZc)Z†Σ−1U T − V Σ−1U T = VcZcZ†Σ−1U T. Multiplying by V T equivalent to ZcZ T = 0. Therefore, c on the left and U Σ on the right, we get ZcZ† = 0, which is range(N N TAT) = range((V Z + VcZc)(V Z + VcZc)TV ΣU T) = range((V ZZ TV T + VcZcZ T = range(V ZZ TΣU T) = range(V ) = range(AT), c V T c )V ΣU T) where we used the facts that Z has full row rank and hence ZZ T is nonsingular, Σ is nonsingular, and U has full column rank. To prove the second statement, let us take B = AT. By the first statement, we know B† = M (BM )† if and only if range(M M TB T) = range(B T), which is equivalent to saying A† = (M TA)†M T if and only if range(M M TA) = range(A). Although Lemma 3.1 gives the necessary and sufficient condition, it does not serve as a practical guide for preconditioning LS problems. In this work, we are more interested in a sufficient condition that can help us build preconditioners. To that end, we provide the following theorem. Theorem 3.2. Given A ∈ Rm×n, b ∈ Rm, N ∈ Rn×p, and M ∈ Rm×q, let x∗ be the min-length solution to the LS problem minx (cid:107)Ax − b(cid:107)2, x∗ right = N y∗ where y∗ is the min-length solution to miny (cid:107)AN y − b(cid:107)2, and x∗ left be the min-length solution to minx (cid:107)M TAx − M Tb(cid:107)2. Then, right = x∗ if range(N ) = range(AT), left = x∗ if range(M ) = range(A). 1. x∗ 2. x∗ Proof. Let r = rank(A) and U ΣV T be A's economy-sized SVD. If range(N ) = range(AT) = range(V ), we can write N as V Z, where Z has full row rank. Therefore, range(N N TAT) = range(V ZZ TV TV ΣU T) = range(V ZZ TΣU T) = range(V ) = range(AT). By Lemma 3.1, A† = N (AN )† and hence x∗ proved by similar arguments. left = x∗. The second statement can be LSRN: A PARALLEL ITERATIVE SOLVER 7 4. Algorithm LSRN. In this section we present LSRN, an iterative solver for solving strongly over- or under-determined systems, based on "random normal pro- jection". To construct a preconditioner we apply a transformation matrix whose en- tries are independent random variables drawn from the standard normal distribution. We prove that the preconditioned system is almost surely consistent with the original system, i.e., both have the same min-length solution. At least as importantly, we prove that the spectrum of the preconditioned system is independent of the spectrum of the original system; and we provide a strong concentration result on the extreme singular values of the preconditioned system. This concentration result enables us to predict the number of iterations for CG-like methods, and it also enables use of the CS method, which requires an accurate bound on the singular values to work efficiently. 4.1. The algorithm. Algorithm 1 shows the detailed procedure of LSRN to com- pute the min-length solution to a strongly over-determined problem, and Algorithm 2 shows the detailed procedure for a strongly under-determined problem. We refer to these two algorithms together as LSRN. Note that they only use the input matrix A for matrix-vector and matrix-matrix multiplications, and thus A can be a dense matrix, a sparse matrix, or a linear operator. In the remainder of this section we focus on analysis of the over-determined case. We emphasize that analysis of the under-determined case is quite analogous. Algorithm 1 LSRN (computes x ≈ A†b when m (cid:29) n) 1: Choose an oversampling factor γ > 1 and set s = (cid:100)γn(cid:101). 2: Generate G = randn(s, m), i.e., an s-by-m random matrix whose entries are independent random variables following the standard normal distribution. Rr×r, V ∈ Rn×r, and only Σ and V are needed. 3: Compute A = GA. 4: Compute A's economy-sized SVD U Σ V T, where r = rank( A), U ∈ Rs×r, Σ ∈ 5: Let N = V Σ−1. 6: Compute the min-length solution to miny (cid:107)AN y − b(cid:107)2 using an iterative method. Denote the solution by y. 7: Return x = N y. Algorithm 2 LSRN (computes x ≈ A†b when m (cid:28) n) 1: Choose an oversampling γ > 1 and set s = (cid:100)γm(cid:101). 2: Generate G = randn(n, s), i.e., an n-by-s random matrix whose entries are inde- pendent random variables following the standard normal distribution. Rr×r, V ∈ Rs×r, and only U and Σ are needed. 3: Compute A = AG. 4: Compute A's economy-sized SVD U Σ V T, where r = rank( A), U ∈ Rn×r, Σ ∈ 5: Let M = U Σ−1. 6: Compute the min-length solution to minx (cid:107)M TAx − M Tb(cid:107)2 using an iterative method, denoted by x. 7: Return x. some nice theoretical properties. We start with consistency. 4.2. Theoretical properties. The use of random normal projection offers LSRN Theorem 4.1. In Algorithm 1, we have x = A†b almost surely. 8 XIANGRUI MENG, MICHAEL SAUNDERS, AND MICHAEL MAHONEY Proof. Let r = rank(A) and U ΣV T be A's economy-sized SVD. We have range(N ) = range( V Σ−1) = range( V ) = range( AT) = range(ATGT) = range(V Σ(GU )T). Define G1 = GU ∈ Rs×r. Since G's entries are independent random variables fol- lowing the standard normal distribution and U is orthonormal, G1's entries are also independent random variables following the standard normal distribution. Then given s ≥ γn > n ≥ r, we know G1 has full column rank r with probability 1. Therefore, range(N ) = range(V ΣGT 1) = range(V ) = range(AT), and hence by Theorem 3.2 we have x = A†b almost surely. Lemma 4.2. In Algorithm 1, the spectrum of AN is the same as the spectrum of A more interesting property of LSRN is that the spectrum (the set of singular values) of the preconditioned system is solely associated with a random matrix of size s × r, independent of the spectrum of the original system. † 1 = (GU )†, independent of A's spectrum. G 1 be G1's economy- sized SVD, where U1 ∈ Rs×r, Σ1 ∈ Rr×r, and V1 ∈ Rr×r. Since range( U ) = range(GA) = range(GU ) = range(U1) and both U and U1 are orthonormal matri- ces, there exists an orthonormal matrix Q1 ∈ Rr×r such that U1 = U Q1. As a result, Proof. Following the proof of Theorem 4.1, let G1 = U1Σ1V T U Σ V T = A = GU ΣV T = U1Σ1V T 1 ΣV T = U Q1Σ1V T 1 ΣV T. Multiplying by U T on the left of each side, we get Σ V T = Q1Σ1V T pseudoinverse gives N = V Σ−1 = V Σ−1V1Σ−1 AN = U ΣV TV Σ−1V1Σ−1 1. Thus, 1 = U V1Σ−1 1 QT 1 QT 1 QT 1 , 1 ΣV T. Taking the which gives AN 's SVD. Therefore, AN 's singular values are diag(Σ−1 † G 1's spectrum, but independent of A's. 1 ), the same as We know that G1 = GU is a random matrix whose entries are independent random variables following the standard normal distribution. The spectrum of G1 is a well-studied problem in Random Matrix Theory, and in particular the properties of extreme singular values have been studied. Thus, the following lemma is important for us. We use P(·) to refer to the probability that a given event occurs. Lemma 4.3. (Davidson and Szarek [3]) Consider an s×r random matrix G1 with s ≥ r, whose entries are independent random variables following the standard normal distribution. Let the singular values be σ1 ≥ ··· ≥ σr. Then for any t > 0, r + t),P(σr ≤ √ max(cid:8)P(σ1 ≥ √ r − t)(cid:9) < e−t2/2. Theorem 4.4. In Algorithm 1, for any α ∈ (0, 1 −(cid:112)r/s), we have (cid:110)P(cid:16) s − √ σ1(AN ) ≥ (cid:17)(cid:111) (cid:17) result of σ1(AN ), σr(AN ), and κ(AN ) as follows. With the aid of Lemma 4.3, it is straightforward to obtain the concentration < e−α2s/2 (4.1) max (1−α) √ 1 s−√ r √ 1 √ (1+α) s+ r √ s + σr(AN ) ≤ ,P(cid:16) ≤ 1 + α +(cid:112)r/s 1 − α −(cid:112)r/s (cid:33) (cid:32) and P κ(AN ) = σ1(AN ) σr(AN ) ≥ 1 − 2e−α2s/2. (4.2) (4.3) LSRN: A PARALLEL ITERATIVE SOLVER 9 √ Proof. Set t = α In order to estimate the number of iterations for CG-like methods, we can now s in Lemma 4.3. combine (2.2) and (4.3). Theorem 4.5. In exact arithmetic, given a tolerance ε > 0, a CG-like method applied to the preconditioned system miny (cid:107)AN y − b(cid:107)2 with y(0) = 0 converges within (log ε − log 2)/ log(α +(cid:112)r/s) iterations in the sense that holds with probability at least 1 − 2e−α2s/2 for any α ∈ (0, 1 −(cid:112)s/r), where yCG (cid:107)yCG − y∗(cid:107)(AN )T(AN ) ≤ ε(cid:107)y∗(cid:107)(AN )T(AN ) is the approximate solution returned by the CG-like solver and y∗ = (AN )†b. Let xCG = N yCG be the approximate solution to the original problem. Since x∗ = N y∗, (4.4) is equivalent to (4.4) or in terms of residuals, (cid:107)xCG − x∗(cid:107)ATA ≤ ε(cid:107)x∗(cid:107)ATA, (cid:107)rCG − r∗(cid:107)2 ≤ ε(cid:107)b − r∗(cid:107)2, (4.5) (4.6) where rCG = b − AxCG and r∗ = b − Ax∗. In addition to allowing us to bound the number of iterations for CG-like methods, the result given by (4.2) also allows us to use the CS method. This method needs only one level-1 and two level-2 BLAS operations per iteration; and, importantly, because it doesn't have vector inner products that require synchronization between nodes, this method is suitable for clusters with high communication cost. It does need an explicit bound on the singular values, but once that bound is tight, the CS method has the same theoretical upper bound on the convergence rate as other CG-like methods. Unfortunately, in many cases, it is hard to obtain such an accurate bound, which prevents the CS method becoming popular in practice. In our case, however, (4.2) provides a probabilistic bound with very high confidence. Hence, we can employ the CS method without difficulty. For completeness, Algorithm 3 describes the CS method we implemented for solving LS problems. For discussion of its variations, see Gutknecht and Rollin [12]. 4.3. Running time complexity. In this section, we discuss the running time complexity of LSRN. Let's first calculate the computational cost of LSRN (Algorithm 1) in terms of floating-point operations (flops). Note that we need only Σ and V but not U or a full SVD of A in step 4 of Algorithm 1. In step 6, we assume that the dominant cost per iteration is the cost of applying AN and (AN )T. Then the total cost is given by sm × flops(randn) s × flops(ATu) 2sn2 + 11n3 + + + Niter × (flops(Av) + flops(ATu) + 4nr) for generating G for computing A for computing Σ and V [10, p. 254] for solving min (cid:107)AN y − b(cid:107)2, y where lower-order terms are ignored. Here, flops(randn) is the average flop count to generate a sample from the standard normal distribution, while flops(Av) and XIANGRUI MENG, MICHAEL SAUNDERS, AND MICHAEL MAHONEY 10 Algorithm 3 Chebyshev semi-iterative (CS) method (computes x ≈ A†b) 1: Given A ∈ Rm×n, b ∈ Rm, and a tolerance ε > 0, choose 0 < σL ≤ σU such L)/2 and that all non-zero singular values of A are in [σL, σU ] and let d = (σ2 c = (σ2 U + σ2 U − σ2 L)/2. 0 1 (log ε − log 2) / log σU−σL if k = 0, if k = 1, otherwise, 1/d α ← σU +σL d − c2/(2d) 1/(d − αc2/4) if k = 0, if k = 1, otherwise. 2: Let x = 0, v = 0, and r = b. 3: for k = 0, 1, . . . , (cid:108) (cid:109) do 4: β ← 2 (c/d)2 (αc/2)2 v ← βv + ATr x ← x + αv r ← r − αAv 5: 6: 7: 8: end for flops(ATu) are the flop counts for the respective matrix-vector products. If A is a dense matrix, then we have flops(Av) = flops(ATu) = 2mn. Hence, the total cost becomes flops(LSRNdense) = sm flops(randn) + 2smn + 2sn2 + 11n3 + Niter × (4mn + 4nr). Comparing this with the SVD approach, which uses 2mn2 + 11n3 flops, we find LSRN requires more flops, even if we only consider computing A and its SVD. However, the actual running time is not fully characterized by the number of flops. A matrix- matrix multiplication is much faster than an SVD with the same number of flops. We empirically compare the running time in Section 6. If A is a sparse matrix, we generally have flops(Av) and flops(ATu) of order O(m). In this case, LSRN should run considerably faster than the SVD approach. Finally, if A is an operator, it is hard to apply SVD, while LSRN still works without any modification. If we set γ = 2 and ε = 10−14, we know Niter ≈ 100 by Theorem 4.5 and hence LSRN needs approximately 2n + 200 matrix-vector multiplications. One advantage of LSRN is that the stages of generating G and computing A = GA are embarrassingly parallel. Thus, it is easy to implement LSRN in parallel. For exam- ple, on a shared-memory machine using p cores, the total running time decreases to T mt,p LSRN = Trandn/p + Tmult/p + T mt,p svd + Titer/p, (4.7) where Trandn, Tmult, and Titer are the running times for the respective stages if LSRN runs on a single core, T mt,p is the running time of SVD using p cores, and commu- svd nication cost among threads is ignored. Hence, multi-threaded LSRN has very good scalability with near-linear speedup. Alternatively, let us consider a cluster of size p using MPI, where each node stores a portion of rows of A (with m (cid:29) n). Each node can generate random samples and do the multiplication independently, and then an MPI Reduce operation is needed to obtain A. Since n is small, the SVD of A and the preconditioner N are computed on a single node and distributed to all the other nodes via an MPI Bcast operation. If the CS method is chosen as the iterative solver, we need one MPI Allreduce operation per iteration in order to apply AT. Note that all the MPI operations that LSRN uses are collective. If we assume the cluster is homogeneous and has perfect load balancing, LSRN: A PARALLEL ITERATIVE SOLVER 11 the time complexity to perform a collective operation should be O(log p). Hence the total running time becomes LSRN = Trandn/p + Tmult/p + Tsvd + Titer/p + (C1 + C2Niter)O(log p), T mpi,p (4.8) where C1 corresponds to the cost of computing A and broadcasting N , and C2 cor- responds to the cost of applying AT at each iteration. Therefore, the MPI implemen- tation of LSRN still has good scalability as long as Tsvd is not dominant, i.e., as long as A is not too big. Typical values of n (or m for under-determined problems) in our empirical evaluations are around 1000, and thus this is the case. 5. Tikhonov regularization. We point out that it is easy to extend LSRN to handle certain types of Tikhonov regularization, also known as ridge regression. Recall that Tikhonov regularization involves solving the problem minimize (cid:107)Ax − b(cid:107)2 2 + 1 2 (cid:107)W x(cid:107)2 2, 1 2 (5.1) where W ∈ Rn×n controls the regularization term. In many cases, W is chosen as λIn for some value of a regularization parameter λ > 0. It is easy to see that (5.1) is equivalent to the following LS problem, without any regularization: (cid:19) (cid:13)(cid:13)(cid:13)(cid:13)(cid:18) A W x − (cid:18)b 0 (cid:19)(cid:13)(cid:13)(cid:13)(cid:13)2 2 minimize 1 2 . (5.2) This is an over-determined problem of size (m + n) × n. If m (cid:29) n, then we certainly have m + n (cid:29) n. Therefore, if m (cid:29) n, we can directly apply LSRN to (5.2) in order to solve (5.1). On the other hand, if m (cid:28) n, then although (5.2) is still over-determined, it is "nearly square," in the sense that m + n is only slightly larger than n. In this regime, random sampling methods and random projection methods like LSRN do not perform well. In order to deal with this regime, note that (5.1) is equivalent to minimize (cid:107)r(cid:107)2 2 + 1 2 1 2 (cid:107)W x(cid:107)2 2 subject to Ax + r = b, where r = b − Ax is the residual vector. (Note that we use r to denote the matrix rank in a scalar context and the residual vector in a vector context.) By introducing z = W x and assuming that W is non-singular, we can re-write the above problem as r 1 2 minimize (cid:13)(cid:13)(cid:13)(cid:13)(cid:18)z (cid:19)(cid:13)(cid:13)(cid:13)(cid:13)2 subject to (cid:0)AW −1 (cid:1)(cid:18)z (cid:0)AW −1 Im 2 r Im (cid:1)(cid:18)z (cid:19) r (cid:19) = b, i.e., as computing the min-length solution to Note that (5.3) is an under-determined problem of size m × (m + n). Hence, if m (cid:28) n, we have m (cid:28) m + n and we can use LSRN to compute the min-length solution = b. (5.3) 12 XIANGRUI MENG, MICHAEL SAUNDERS, AND MICHAEL MAHONEY Table 6.1 LS solvers and their properties. solver min-len solution to taking advantage of under-det? rank-def? sparse A operator A LAPACK's DGELSD MATLAB's backslash Blendenpik LSRN yes no yes yes yes no no yes no yes no yes no no no yes (cid:18)z∗ (cid:19) r∗ to (5.3), denoted by . The solution to the original problem (5.1) is then given by x∗ = W −1z∗. Here, we assume that W −1 is easy to apply, as is the case when W = λIn, so that AW −1 can be treated as an operator. The equivalence between (5.1) and (5.3) was first established by Herman, Lent, and Hurwitz [14]. In most applications of regression analysis, the amount of regularization, e.g., the optimal regularization parameter, is unknown and thus determined by cross- validation. This requires solving a sequence of LS problems where only W differs. For over-determined problems, we only need to perform a random normal projection on A once. The marginal cost to solve for each W is the following: a random normal projection on W , an SVD of size (cid:100)γn(cid:101) × n, and a predictable number of iterations. Similar results hold for under-determined problems when each W is a multiple of the identity matrix. 6. Numerical experiments. We implemented our LS solver LSRN and com- pared it with competing solvers: LAPACK's DGELSD, MATLAB's backslash, and Blendenpik by Avron, Maymounkov, and Toledo [1]. MATLAB's backslash uses differ- ent algorithms for different problem types. For sparse rectangular systems, as stated by Tim Davis1, "SuiteSparseQR [4, 5] is now QR in MATLAB 7.9 and x = A\b when A is sparse and rectangular." Table 6.1 summarizes the properties of those solvers. We report our empirical results in this section. 6.1. Implementation and system setup. The experiments were performed on either a local shared-memory machine or a virtual cluster hosted on Amazon's Elastic Compute Cloud (EC2). The shared-memory machine has 12 Intel Xeon CPU cores at clock rate 2GHz with 128GB RAM. The virtual cluster consists of 20 m1.large instances configured by a third-party tool called StarCluster2. An m1.large instance has 2 virtual cores with 2 EC2 Compute Units3 each. To attain top performance on the shared-memory machine, we implemented a multi-threaded version of LSRN in C, and to make our solver general enough to handle large problems on clusters, we also implemented an MPI version of LSRN in Python with NumPy, SciPy, and mpi4py. Both packages are available for download4. We use the multi-threaded implementation to compare LSRN with other LS solvers and use the MPI implementation to explore scalability and to compare iterative solvers under a cluster environment. To generate values from the standard normal distribution, we adopted the code from Marsaglia and Tsang [18] and modified it to use threads; this can generate a billion samples in 1http://www.cise.ufl.edu/research/sparse/SPQR/ 2http://web.mit.edu/stardev/cluster/ 3"One EC2 Compute Unit provides the equivalent CPU capacity of a 1.0-1.2 GHz 2007 Opteron or 2007 Xeon processor." from http://aws.amazon.com/ec2/faqs/ 4http://www.stanford.edu/group/SOL/software/lsrn.html LSRN: A PARALLEL ITERATIVE SOLVER 13 Fig. 6.1. Left: κ+(A) vs. κ(AN ) for different choices of r and s. A ∈ R104×103 is randomly generated with rank r. For each (r, s) pair, we take the largest value of κ(AN ) in 10 independent runs for each κ+(A) and connect them using a solid line. The estimate (1 +(cid:112)r/s)/(1 −(cid:112)r/s) is drawn in a dotted line for each (r, s) pair, if not overlapped with the corresponding solid line. Right: number of LSQR iterations vs. r/s. The number of LSQR iterations is merely a function of r/s, independent of the condition number of the original system. less than two seconds on the shared-memory machine. We also modified Blendenpik to call multi-threaded FFTW routines. Blendenpik's default settings were used, i.e., using randomized discrete Fourier transform and sampling 4 min(m, n) rows/columns. All LAPACK's LS solvers, Blendenpik, and LSRN are linked against MATLAB's own multi-threaded BLAS and LAPACK libraries. So, in general, this is a fair setup because all the solvers can use multi-threading automatically and are linked against the same BLAS and LAPACK libraries. The running times were measured in wall- clock times. 6.2. κ(AN ) and number of iterations. Recall that Theorem 4.4 states that κ(AN ), the condition number of the preconditioned system, is roughly bounded by To verify this statement, we generate random matrices of size 104×103 with condition numbers ranged from 102 to 108. The left figure in Figure 6.1 compares κ(AN ) with κ+(A), the effective condition number of A, under different choices of s and r. We take the largest value of κ(AN ) in 10 independent runs as the κ(AN ) in the plot. For each (1 +(cid:112)r/s)/(1−(cid:112)r/s) when s is large enough such that we can ignore α in practice. pair of s and r, the corresponding estimate (1+(cid:112)r/s)/(1−(cid:112)r/s) is drawn in a dotted (1 +(cid:112)r/s)/(1−(cid:112)r/s) is indeed an accurate estimate of the upper bound on κ(AN ). example, we have (1+(cid:112)r/s)/(1−(cid:112)r/s) < 6 if s > 2r, and hence we can expect super should be less than (log ε − log 2)/ log(cid:112)r/s, where ε is a given tolerance. In order to r/s and κ+(A). We also draw the theoretical upper bound (log ε − log 2)/ log(cid:112)r/s fast convergence of CG-like methods. Based on Theorem 4.5, the number of iterations match the accuracy of direct solvers, we set ε = 10−14. The right figure in Figure 6.1 shows the number of LSQR iterations for different combinations of r/s and κ+(A). Again, we take the largest iteration number in 10 independent runs for each pair of line of the same color, if not overlapped with the solid line of κ(AN ). We see that Moreover, κ(AN ) is not only independent of κ+(A), but it is also quite small. For in a dotted line. We see that the number of iterations is basically a function of r/s, independent of κ+(A), and the theoretical upper bound is very good in practice. This confirms that the number of iterations is fully predictable given γ. 14 XIANGRUI MENG, MICHAEL SAUNDERS, AND MICHAEL MAHONEY Fig. 6.2. The overall running time of LSRN and the running time of each LSRN stage with different oversampling factor γ for a randomly generated problem of size 105×103. For this particular problem, the optimal γ that minimizes the overall running time lies in [1.8, 2.2]. 6.3. Tuning the oversampling factor γ. Once we set the tolerance and max- imum number of iterations, there is only one parameter left: the oversampling factor γ. To demonstrate the impact of γ, we fix problem size to 105 × 103 and condition number to 106, set the tolerance to 10−14, and then solve the problem with γ ranged from 1.2 to 3. Figure 6.2 illustrates how γ affects the running times of LSRN's stages: randn for generating random numbers, mult for computing A = GA, svd for comput- ing Σ and V from A, and iter for LSQR. We see that, the running times of randn, mult, and svd increase linearly as γ increases, while iter time decreases. Therefore there exists an optimal choice of γ. For this particular problem, we should choose γ between 1.8 and 2.2. We experimented with various LS problems. The best choice of γ ranges from 1.6 to 2.5, depending on the type and the size of the problem. We also note that, when γ is given, the running time of the iteration stage is fully predictable. Thus we can initialize LSRN by measuring randn/sec and flops/sec for matrix-vector multiplication, matrix-matrix multiplication, and SVD, and then determine the best value of γ by minimizing the total running time (4.8). For simplicity, we set γ = 2.0 in all later experiments; although this is not the optimal setting for all cases, it is always a reasonable choice. 6.4. Dense least squares. As the state-of-the-art dense linear algebra library, LAPACK provides several routines for solving LS problems, e.g., DGELS, DGELSY, and DGELSD. DGELS uses QR factorization without pivoting, which cannot handle rank-deficient problems. DGELSY uses QR factorization with pivoting, which is more reliable than DGELS on rank-deficient problems. DGELSD uses SVD. It is the most reliable routine, and should be the most expensive as well. However, we find that DGELSD actually runs much faster than DGELSY on strongly over- or under- determined systems on the shared-memory machine. It may be because of better use of multi-threaded BLAS, but we don't have a definitive explanation. Figure 6.3 compares the running times of LSRN and competing solvers on ran- domly generated full-rank dense strongly over- or under-determined problems. We set the condition numbers to 106 for all problems. Note that DGELS and DGELSD almost overlapped. The results show that Blendenpik is the winner. For small-sized problems (m ≤ 3e4), the follow-ups are DGELS and DGELSD. When the problem size goes larger, LSRN becomes faster than DGELS/DGELSD. DGELSY is always slower than DGELS/DGELSD, but still faster than MATLAB's backslash. The performance LSRN: A PARALLEL ITERATIVE SOLVER 15 Fig. 6.3. Running times on m × 1000 dense over-determined problems with full rank (left) and on 1000 × n dense under-determined problems with full rank (right). Note that DGELS and DGELSD almost overlap. When m > 3e4, we have Blendenpik > LSRN > DGELS/DGELSD > DGELSY > A\b in terms of speed. On under-determined problems, LAPACK's performance de- creases significantly compared with the over-determined cases. Blendenpik's performance decreases as well. LSRN doesn't change much. Fig. 6.4. Running times on m × 1000 dense over-determined problems with rank 800 (left) and on 1000 × n dense under-determined problems with rank 800 (right). LSRN takes advantage of rank deficiency. We have LSRN > DGSLS/DGELSD > DGELSY in terms of speed. of LAPACK's solvers decreases significantly for under-determined problems. We mon- itored CPU usage and found that they couldn't fully use all the CPU cores, i.e., they couldn't effectively call multi-threaded BLAS. Though still the best, the performance of Blendenpik also decreases. LSRN's performance does not change much. LSRN is also capable of solving rank-deficient problems, and in fact it takes advan- tage of any rank-deficiency (in that it finds a solution in fewer iterations). Figure 6.4 shows the results on over- and under-determined rank-deficient problems generated the same way as in previous experiments, except that we set r = 800. DGELSY and DGELSD remain the same speed on over-determined problems as in full-rank cases, respectively, and run slightly faster on under-determined problems. LSRN's running times reduce to 93 seconds on the problem of size 106 × 103, from 100 seconds on its full-rank counterpart. We see that, for strongly over- or under-determined problems, DGELSD is the fastest and most reliable routine among the LS solvers provided by LAPACK. How- ever, it (or any other LAPACK solver) runs much slower on under-determined prob- 16 XIANGRUI MENG, MICHAEL SAUNDERS, AND MICHAEL MAHONEY Fig. 6.5. Running times on m× 1000 sparse over-determined problems with full rank (left) and on 1000× n sparse under-determined problems with full rank (right). DGELS and DGELSD overlap with each other. LAPACK's solvers and Blendenpik perform almost the same as in the dense case. Matlab's backslash speeds up on sparse problems, and performs a little better than Blendenpik, but it is still slower than LSRN. LSRN leads by a huge margin on under-determined problems as well. lems than on over-determined problems, while LSRN works symmetrically on both cases. Blendenpik is the fastest dense least squares solver in our tests. Though it is not designed for solving rank-deficient problems, Blendenpik should be modifiable to handle such problems following Theorem 3.2. We also note that Blendenpik's perfor- mance depends on the distribution of the row norms of U . We generate test problems randomly so that the row norms of U are homogeneous, which is ideal for Blendenpik. When the row norms of U are heterogeneous, Blendenpik's performance may drop. See Avron, Maymounkov, and Toledo [1] for a more detailed analysis. 6.5. Sparse least squares. In LSRN, A is only involved in the computation of matrix-vector and matrix-matrix multiplications. Therefore LSRN accelerates auto- matically when A is sparse, without exploring A's sparsity pattern. LAPACK does not have any direct sparse LS solver. MATLAB's backslash uses SuiteSparseQR by Tim Davis [5] when A is sparse and rectangular; this requires explicit knowledge of A's sparsity pattern to obtain a sparse QR factorization. We generated sparse LS problems using MATLAB's "sprandn" function with density 0.01 and condition number 106. All problems have full rank. Figure 6.5 shows the results on over-determined problems. LAPACK's solvers and Blendenpik basically perform the same as in the dense case. DGELSY is the slowest among the three. DGELS and DGELSD still overlap with each other, faster than DGELSY but slower than Blendenpik. We see that MATLAB's backslash handles sparse problems very well. On the 106 × 103 problem, backslash's running time reduces to 55 seconds, from 273 seconds on the dense counterpart. The overall performance of MATLAB's backslash is better than Blendenpik's. LSRN's curve is very flat. For small problems (m ≤ 105), LSRN is slow. When m > 105, LSRN becomes the fastest solver among the six. LSRN takes only 23 seconds on the over-determined problem of size 106 × 103. On large under-determined problems, LSRN still leads by a huge margin. LSRN makes no distinction between dense and sparse problems. The speedup on sparse problems is due to faster matrix-vector and matrix-matrix multiplications. Hence, although no test was performed, we expect a similar speedup on fast linear operators as well. Also note that, in the multi-threaded implementation of LSRN, we use a naive multi-threaded routine for sparse matrix-vector and matrix-matrix LSRN: A PARALLEL ITERATIVE SOLVER 17 Table 6.2 Real-world problems and corresponding running times in seconds. DGELSD doesn't take ad- vantage of sparsity. Though MATLAB's backslash (SuiteSparseQR) may not give the min-length solutions to rank-deficient or under-determined problems, we still report its running times. Blenden- pik either doesn't apply to rank-deficient problems or runs out of memory (OOM). LSRN's running time is mainly determined by the problem size and the sparsity. matrix landmark rail4284 tnimg 1 tnimg 2 tnimg 3 tnimg 4 tnimg 5 m 71952 4284 951 1000 1018 1019 1023 n 2704 1.1e6 1e6 2e6 3e6 4e6 5e6 nnz 1.15e6 1.1e7 2.1e7 4.2e7 6.3e7 8.4e7 1.1e8 rank 2671 full 925 981 1016 1018 full cond 1.0e8 400.0 - - - - - DGELSD 29.54 > 3600 630.6 1291 2084 2945 > 3600 A\b 0.6498∗ 1.203∗ 1067∗ > 3600∗ > 3600∗ > 3600∗ > 3600∗ Blendenpik - OOM - - - - OOM LSRN 17.55 136.0 36.02 72.05 111.1 147.1 188.5 multiplications, which is far from optimized and thus leaves room for improvement. 6.6. Real-world problems. In this section, we report results on some real- world large data problems. The problems are summarized in Table 6.2, along with running times. landmark and rail4284 are from the University of Florida Sparse Matrix Col- lection [6]. landmark originated from a rank-deficient LS problem. rail4284 has full rank and originated from a linear programming problem on Italian railways. Both matrices are very sparse and have structured patterns. MATLAB's backslash (SuiteS- parseQR) runs extremely fast on these two problems, though it doesn't guarantee to return the min-length solution. Blendenpik is not designed to handle the rank- deficient landmark, and it unfortunately runs out of memory (OOM) on rail4284. LSRN takes 17.55 seconds on landmark and 136.0 seconds on rail4284. DGELSD is slightly slower than LSRN on landmark and much slower on rail4284. tnimg is generated from the TinyImages collection [23], which provides 80 million color images of size 32× 32. For each image, we first convert it to grayscale, compute its two-dimensional DCT, and then only keep the top 2% largest coefficients in mag- nitude. This gives a sparse matrix of size 1024 × 8e7 where each column has 20 or 21 nonzero elements. Note that tnimg doesn't have apparent structured pattern. Since the whole matrix is too big, we work on submatrices of different sizes. tnimg i is the submatrix consisting of the first 106 × i columns of the whole matrix for i = 1, . . . , 80, where empty rows are removed. The running times of LSRN are approximately linear in n. Both DGELSD and MATLAB's backslash are very slow on the tnimg problems. Blendenpik either doesn't apply to the rank-deficient cases or runs OOM. We see that, though both methods taking advantage of sparsity, MATLAB's backslash relies heavily on the sparsity pattern, and its performance is unpredictable until the sparsity pattern is analyzed, while LSRN doesn't rely on the sparsity pattern and always delivers predictable performance and, moreover, the min-length solution. 6.7. Scalability and choice of iterative solvers on clusters. In this section, we move to the Amazon EC2 cluster. The goals are to demonstrate that (1) LSRN scales well on clusters, and (2) the CS method is preferred to LSQR on clusters with high communication cost. The test problems are submatrices of the tnimg matrix in the previous section: tnimg 4, tnimg 10, tnimg 20, and tnimg 40, solved with 4, 10, 20, and 40 cores respectively. Each process stores a submatrix of size 1024×1e6. Table 6.3 shows the results, averaged over 5 runs. Ideally, from the complexity analysis (4.8), when we double n and double the number of cores, the increase in running time should be a constant if the cluster is homogeneous and has perfect load balancing (which we 18 XIANGRUI MENG, MICHAEL SAUNDERS, AND MICHAEL MAHONEY Test problems on the Amazon EC2 cluster and corresponding running times in seconds. When we enlarge the problem scale by a factor of 10 and increase the number of cores accordingly, the running time only increases by a factor of 50%. It shows LSRN's good scalability. Though the CS method takes more iterations, it is faster than LSQR by saving communication cost. Table 6.3 solver Nnodes np matrix m n nnz LSRN w/ CS LSRN w/ LSQR LSRN w/ CS LSRN w/ LSQR LSRN w/ CS LSRN w/ LSQR LSRN w/ CS LSRN w/ LSQR 2 5 10 20 4 tnimg 4 1024 4e6 8.4e7 10 tnimg 10 1024 1e7 2.1e8 20 tnimg 20 1024 2e7 4.2e8 40 tnimg 40 1024 4e7 8.4e8 Niter 106 84 106 84 106 84 106 84 Titer 34.03 41.14 50.37 68.72 73.73 102.3 102.5 137.2 Ttotal 170.4 178.6 193.3 211.6 220.9 249.0 255.6 290.2 have observed is not true on Amazon EC2). For LSRN with CS, from tnimg 10 to tnimg 20 the running time increases 27.6 seconds, and from tnimg 20 to tnimg 40 the running time increases 34.7 seconds. We believe the difference between the time increases is caused by the heterogeneity of the cluster, because Amazon EC2 doesn't guarantee the connection speed among nodes. From tnimg 4 to tnimg 40, the problem scale is enlarged by a factor of 10 while the running time only increases by a factor of 50%. The result still demonstrates LSRN's good scalability. We also compare the performance of LSQR and CS as the iterative solvers in LSRN. For all problems LSQR converges in 84 iterations and CS converges in 106 iterations. However, LSQR is slower than CS. The communication cost saved by CS is significant on those tests. As a result, we recommend CS as the default LSRN iterative solver for cluster environments. Note that to reduce the communication cost on a cluster, we could also consider increasing γ to reduce the number of iterations. 7. Conclusion. We developed LSRN, a parallel solver for strongly over- or under- determined, and possibly rank-deficient, systems. LSRN uses random normal projec- tion to compute a preconditioner matrix for an iterative solver such as LSQR and the Chebyshev semi-iterative (CS) method. The preconditioning process is embar- rassingly parallel and automatically speeds up on sparse matrices and fast linear operators, and on rank-deficient data. We proved that the preconditioned system is consistent and extremely well-conditioned, and derived strong bounds on the number of iterations of LSQR or the CS method, and hence on the total running time. On large dense systems, LSRN is competitive with the best existing solvers, and it runs sig- nificantly faster than competing solvers on strongly over- or under-determined sparse systems. LSRN is easy to implement using threads or MPI, and it scales well in parallel environments. Acknowledgements. After completing the initial version of this manuscript, we learned of the LS algorithm of Coakley et al. [2]. We thank Mark Tygert for pointing us to this reference. We are also grateful to Lisandro Dalcin, the author of mpi4py, for his own version of the MPI Barrier function to prevent idle processes from interrupting the multi-threaded SVD process too frequently. LSRN: A PARALLEL ITERATIVE SOLVER 19 REFERENCES [1] H. Avron, P. Maymounkov, and S. Toledo, Blendenpik: Supercharging LAPACK's least- squares solver, SIAM J. Sci. Comput., 32 (2010), pp. 1217 -- 1236. [2] E. S. Coakley, V. Rokhlin, and M. Tygert, A fast randomized algorithm for orthogonal projection, SIAM J. Sci. Comput., 33 (2011), pp. 849 -- 868. [3] K. R. Davidson and S. J. Szarek, Local operator theory, random matrices and Banach spaces, in Handbook of the Geometry of Banach Spaces, vol. 1, North Holland, 2001, pp. 317 -- 366. [4] T. A. Davis, Direct Methods for Sparse Linear Systems, SIAM, Philadelphia, 2006. [5] , Algorithm 915, SuiteSparseQR: Multifrontal multithreaded rank-revealing sparse QR factorization, ACM Trans. Math. Softw., 38 (2011). [6] T. A. Davis and Y. Hu, The University of Florida sparse matrix collection, ACM Trans. Math. Softw., 38 (2011). [7] P. Drineas, M. W. Mahoney, and S. Muthukrishnan, Sampling algorithms for (cid:96)2 regression and applications, in Proceedings of the 17th Annual ACM-SIAM Symposium on Discrete Algorithms, ACM, 2006, pp. 1127 -- 1136. [8] P. Drineas, M. W. Mahoney, S. Muthukrishnan, and T. Sarl´os, Faster least squares approximation, Numer. Math., 117 (2011), pp. 219 -- 249. [9] D. C.-L. Fong and M. Saunders, LSMR: An iterative algorithm for sparse least-squares problems, SIAM J. Sci. Comput., 33 (2011), p. 2950. [10] G. H. Golub and C. F. Van Loan, Matrix Computations, Johns Hopkins Univ Press, third ed., 1996. [11] G. H. Golub and R. S. Varga, Chebyshev semi-iterative methods, successive over-relaxation methods, and second-order Richardson iterative methods, parts I and II, Numer. Math., 3 (1961), pp. 147 -- 168. [12] M. H. Gutknecht and S. Rollin, The Chebyshev iteration revisited, Parallel Comput., 28 (2002), pp. 263 -- 283. [13] N. Halko, P. G. Martinsson, and J. A. Tropp, Finding structure with randomness: Proba- bilistic algorithms for constructing approximate matrix decompositions, SIAM Review, 53 (2011), pp. 217 -- 288. [14] G. T. Herman, A. Lent, and H. Hurwitz, A storage-efficient algorithm for finding the reg- ularized solution of a large, inconsistent system of equations, IMA J. Appl. Math., 25 (1980), pp. 361 -- 366. [15] M. R. Hestenes and E. Stiefel, Methods of conjugate gradients for solving linear systems, J. Res. Nat. Bur. Stand., 49 (1952), pp. 409 -- 436. [16] D. G. Luenberger, Introduction to Linear and Nonlinear Programming, Addison-Wesley, 1973. [17] M. W. Mahoney, Randomized Algorithms for Matrices and Data, Foundations and Trends in Machine Learning, NOW Publishers, Boston, 2011. Also available at arXiv:1104.5557v2. [18] G. Marsaglia and W. W. Tsang, The ziggurat method for generating random variables, J. Stat. Softw., 5 (2000), pp. 1 -- 7. [19] C. C. Paige and M. A. Saunders, Solution of sparse indefinite systems of linear equations, SIAM J. Numer. Anal., 12 (1975), pp. 617 -- 629. [20] , LSQR: An algorithm for sparse linear equations and sparse least squares, ACM Trans. Math. Softw., 8 (1982), pp. 43 -- 71. [21] V. Rokhlin and M. Tygert, A fast randomized algorithm for overdetermined linear least- squares regression, Proc. Natl. Acad. Sci. USA, 105 (2008), pp. 13212 -- 13217. [22] T. Sarl´os, Improved approximation algorithms for large matrices via random projections, in Proceedings of the 47th Annual IEEE Symposium on Foundations of Computer Science, IEEE, 2006, pp. 143 -- 152. [23] A. Torralba, R. Fergus, and W. T. Freeman, 80 million tiny images: A large data set for nonparametric object and scene recognition, IEEE Trans. Pattern Anal. Mach. Intell., 30 (2008), pp. 1958 -- 1970.
1303.0270
1
1303
2013-03-01T20:34:41
Computable Compressed Matrices
[ "cs.DS" ]
The biggest cost of computing with large matrices in any modern computer is related to memory latency and bandwidth. The average latency of modern RAM reads is 150 times greater than a clock step of the processor. Throughput is a little better but still 25 times slower than the CPU can consume. The application of bitstring compression allows for larger matrices to be moved entirely to the cache memory of the computer, which has much better latency and bandwidth (average latency of L1 cache is 3 to 4 clock steps). This allows for massive performance gains as well as the ability to simulate much larger models efficiently. In this work, we propose a methodology to compress matrices in such a way that they retain their mathematical properties. Considerable compression of the data is also achieved in the process Thus allowing for the computation of much larger linear problems within the same memory constraints when compared with the traditional representation of matrices.
cs.DS
cs
1 Computable Compressed Matrices Crysttian Arantes Paixao1∗, Fl´avio Code¸co Coelho2, 1 Crysttian Arantes Paixao Applied Mathematics School, Getulio Vargas Foundation, Rio de Janeiro, RJ, Brazil 2 Fl´avio Code¸co Coelho Applied Mathematics School, Getulio Vargas Foundation, Rio de Janeiro, RJ, Brazil ∗ E-mail: Corresponding [email protected] Abstract The biggest cost of computing with large matrices in any modern computer is related to memory latency and bandwidth. The average latency of modern RAM reads is 150 times greater than a clock step of the processor [1]. Throughput is a little better but still 25 times slower than the CPU can consume. The application of bitstring compression allows for larger matrices to be moved entirely to the cache memory of the computer, which has much better latency and bandwidth (average latency of L1 cache is 3 to 4 clock steps). This allows for massive performance gains as well as the ability to simulate much larger models efficiently. In this work, we propose a methodology to compress matrices in such a way that they retain their mathematical properties. Considerable compression of the data is also achieved in the process Thus allowing for the computation of much larger linear problems within the same memory constraints when compared with the traditional representation of matrices. Author Summary Introduction Data compression is traditionally used to reduce storage resources usage and/or transmission costs [2]. Compression techniques can be classified into lossy and lossless. Examples of lossy data compression are MP3 (audio), JPEG (image) and MPEG (video). In this paper we discuss the use of lossless compres- sion for numerical data structures such as numerical arrays to achieve compression without losing the mathematical properties of the original data. Lossless compression methods usually exploit redundancies present in the data in order to find a shorter form of describing the same information content. For example, a dictionary-based compression, only stores the positions in which a given word occurs in a document, thus saving the space required to store all its repetitions [3]. Any kind of compression incurs some computational cost. Such costs often have to be paid twice since the data needs to be decompressed to be used for its original purpose. Sometimes computational costs are irrelevant, but the need to decompress for usage, can signify that the space saved with compression must be available when data is decompressed for usage, thus partially negating the advantages of compression. Most if not all existing lossless compression methods were developed under the following usage paradigm: produce → compress → store → uncompress → use. The focus of the present work is to allow a slightly different usage: produce → compress → perform mathematical manipulations and decom- press (only for human reading). With the growth of data volumes and analytical demands, creative solutions are needed to efficiently store as well as consume it on demand. This issue is present in many areas of application, ranging from business to science [4], and is being called the Big Data phenomenon. In the world of Big Data, the need to analyze data immediately after its coming into existence became the norm. And this analysis must take place, efficiently, within the confines of (RAM) memory. This kind of analyses are what is now known as streaming data analysis [5]. Given a sufficiently dense stream of data, compression an decompression 2 costs may become prohibitive. So having a way to compress data and keeping it compressed for the entire course of the analytical pipeline, is very desirable. This paper will focus solely on numerical data which for the purpose of the applications is organized as matrices. This is a most common data structure found in computational data analysis environments. The matrices compressed according to the methodologies proposed here should be able to undergo the same mathematical operations as the original uncompressed matrices, e.g. linear algebra manipulations. This way, the cost of compression is reduced to a single event of compression and no need of decompression except when displaying the results for human reading. The idea of operating with compressed arrays is relatively new [6], and it has yet to find mainstream applications to the field of numerical computations. One application which employs a form of compression is the sparse matrix linear algebra algorithms [7], in this case there is no alteration in the standard encoding of the data, but only the non-zero elements of the matrices are stored and operated upon. Larger than RAM data structures can render traditional analytical algorithms impracticable. Cur- rently, the technique most commonly used when dealing with large matrices for numerical computations, is memory mapping [8, 9]. In memory mapping the matrix is allocated in a virtual contiguous address space which extends from memory into disk. Thus, larger than memory data structures can be manipu- lated as if they were in memory. This technique has a big performance penalty due to lower access speeds of disk when compared to RAM. In this paper we present two methods for the lossless compression of (numerical) arrays. The methods involve the encoding of the numbers as strings of bits of variable length. The methods resemble the arithmetic coding [10] algorithm, but is cheaper to compute. We describe the process of compression and decompression, and study their efficiency under different applications. We also discuss the efficiency of the compression as a function of the distribution of the elements of the matrix. Methods Matrix compression To maintain mathematical equivalence with the original data for any arithmetic operations, we need to maintain the structure of the matrix, i.e., the ability to acess any element given its row i and column j and also the numeric nature of its elements. In order to achieve compression we decided to exploit inefficiencies in the conventional way matrices are allocated in memory. The examples in this paper will be restricted to matrices with positive integer elements. The compression method is as follows. Let Mr×c be a matrix, in which r is the number of rows and c the number of columns. Each element of this matrix, called mij, is a positive integer. In digital computers, all information is stored as binary code (base 2 numbers). However the conventional way to store arrays of integers is on a memory block sequence of fixed size (power of 2 numbers of bit), one for each element. The maximum size of a block is equal to the word size of the processor, which for most current CPUs is 64 bits. Some special number such as complex number may be encoded as two blocks instead of one. The size of the chunk of memory allocated to each number will determine their maximum size (for integers) or their precision (for floating-point numbes). So for matrix M , the total memory allocated, assuming chunks of 64 bits, is given by B = r × c × 64. The number of bits allocated B, is larger than the absolute minimum number of bits required to represent all the elements of M , since smaller integers, when converted to base 2, require less digits. From now on, when the numerical base will be explicitly notated when necessary to avoid confusion between binary and decimal integers. Let's consider an extreme example: a matrix composed exclusively of 0s and 1s (base 10). If the matrix type is set to 64-bit integers, 63 bits will be wasted per element of the matrix, since the minimum number of bits needed to store such a matrix is b = r × c × 1. The potential economy of bits ξ can be 3 represented by ξ = B − b = r × c × 63. So it is evident that for any matrix whose greatest element requires less than 64 bits (or the fixed type of the matrix) to be represented, potential memory savings will grow linearly with the size of the matrix. Method 1: The Supreme Minimum (SM) The SM method consists in determining the value of the greatest element of matrix M , which coincides with its supremum, maxM == sup M and determine the minimum number of bits, b(sup M )(Equation 1), required to store it. We will use capital roman letters to denote uncompressed matrices and the corresponding lower case letter for the compressed version. b(sup M ) ≈(1, ⌊log2(sup M )⌋ + 1, if sup M ∈ {0, 1} if sup M > 1 (1) The allocation of memory still happens in the usual way, i.e., in fixed size 64-bit chunks, only that now, in the space required for a single 64 bit integer, we can store for example, an entire 8 × 8 matrix of 010 and 110. Let's look at a concrete example: suppose that the greatest value to be stored in a matrix M is max M = 1023. Therefore, the number of bits required to represent it is 10 (1111111111). Let the first 8 elements of M be: M ="900 1023 721 256 1 ... ... ... ... ... 10 700 20 ... ... ... . . . . . .# (2) These elements of M , in binary, are shown in Table 1. It is evident that the number of bits required to represent any other element must be lower or equal to 10. From now on the minimum number of bits required to represent a base 10 integer will be refered to as its bit-length. Table 1. Some elements of M represented in binary base. Element Value 900 1023 721 256 1 10 700 20 M1,1 M1,2 M1,3 M1,4 M1,5 M1,6 M1,7 M1,8 Binary Bit length 1110000100 1111111111 1011010001 100000000 1 1010 1010111100 10100 10 10 10 9 1 4 10 5 To store matrix M it first has to be converted to base 2 (M2). Then it will be unraveled by column (column major, e.g. in Fortran) or by row (row major, e.g. in C) and its elements will be written as fixed size adjacent chunks of memory. The size of each chunk is determined by the type associated with the matrix (typically 64 bits, but always a power of 2). According to the SM method, having determined that each element will require at most 10 bits, we can divide the memory block corresponding to a single 64 bit integer into six 10-bit chunks which can each hold a single element of M . These 64-bit blocks will be called a bitstring. The remaining 4 bits will be used later. The number of bitstrings needed will be ⌊ dim(M)∗b(sup M) ⌋ + 1, where dim(M ) is the dimension of the matrix or its number of elements. 64 The final layout of the first 6 elements of m in the first bitstring can be seen in 3. bitstring1 = 0000 0000001010 0000000001 0100000000 1011010001 1111111111 1110000100 Here is a step-by-step description of the application of the SM method to matrix M : 10 {z } 1 {z } 256 {z } 721 {z } 1023 {z } 900 {z } 4 (3) 1. Element M1,1 = 900 = m1,1 = 1110000100 is stored in the first 10-bit chunk of the element strip bitstring[1] , which corresponds to bits 0 to 9 (read from right to left). bitstring1 = 000000000000000000000000000000000000000000000000000000 1110000100 } 900 {z 900 {z } } 1023 {z 2. Element M1,2 = 1023 is allocated in the second chunk, from bit 10 to bit 19. bitstring1 = 00000000000000000000000000000000000000000000 1111111111 1110000100 3. Repeat for elements M1,i with i = 1, . . . , 6 which are stored on the remaining chunks. bitstring1 = 0000 0000001010 0000000001 0100000000 1011010001 1111111111 1110000100 10 {z } 1 {z } 256 {z } 721 {z } 1023 {z } 900 {z } 4. Element M1,7 = 700 = 1010111100 does not fit on the remaining 4 bits of the first bitstring. So it will straddle two bitstrings, i.e., it is divided in two segments a and b, a is written on the first bitstring and b on the second. 0000010100 1100 0000001010 0000000001 b a 101011 z } { } } {z z}{ 20 {z 10 {z } {z 1 {z } . . . } bitstring2 bitstring1 Please notice that bitstrings are written from right to left. 0000010100 0000001010 . . . a b 101011 z } { {z 700 1100 z}{ } } 20 {z 10 {z } Thus the compressed matrix m = M2 requires less memory than the conventional storage of M as a 64-bit integer array. Method 2: Variable Length Blocks (VLB) In the SM method, there is still waste of space since for elements smaller than the supremum, a number of bits remain unused. In the VBL method, the absolute minimal number of bits are used to store each value. However, if we are going to divide the biststrings into variable length chunks, we also need to reserve some extra bits to represent the size of each chunk, otherwise the elements cannot be recovered once they are stored. Lets use again the matrix described in Equation 2, where the largest element is number 1023. Now instead of assigning one chunk of the bitstring to each element of m, we will assign two chunks: the first will store the number of bits required to store the element and the second will store the actual element. The first chunk will have a fixed size, in this case, 4 bits. These 4 bits are the required space to store the bit-length of sup M , in this case, 10. Lets go through VLB compression step-by-step. The largest element of M is 1023. Its bit-length is 10 which in turn is 4 bits long in base 2 (1010). Thus the fixed size chunk is 4 bits long for every element. 1. The first element M1,1 = 900 requires 10 bits to store, so we write 10 in the first chunk and 900 in the second. 5 bitstring1 = 00000000000000000000000000000000000000000000000000 1110000100 element=900 bit-length=10 2. Do the same for the next element, M1,2 = 1023. bitstring1 = . . . 00000000000000000000000000 1111111111 element=1023 1110000100 bit-length=10 element=900 bit-length=10 {z {z } 1010 {z} 1010 {z} } {z M1,1 } {z M1,1 } } 1010 {z} {z } {z M1,2 3. Element M1,3 = 721 is also added taking the bitstring to the state. bitstring1 = 0000000000000000000000 1011010001 1111111111 1110000100 721 {z 1010 {z}10 } 1023 {z 1010 {z}10 } 900 {z 1010 {z}10 } So far the VLB method is more wasteful than the SM, but when we add M1,4 = 256 we start to save some space. 4. Element M1,4 = 256 is added. 5. Elements M1,5 = 1 and M1,6 = 10 are added requiring a total of 13 bits instead of 20 with the SM method. With the addition of these elements we require a second bitstring. bitstring1 = 0100 1 100000000 1011010001 1111111111 1110000100 {z}4 {z}1 0001 {z}1 256 {z 1001 {z}9 } 721 {z 1010 {z}10 } 1023 {z 1010 {z}10 } bitstring2 = 000000000000000000000000000000000000000000000000000000000000 1010 1010 {z}10 } 900 {z {z}10 6. The remaining two elements are added M1,7 = 700 and M1,8 = 20 in the second bit strip. bitstring2 = 00000000000000000000000000000000000 10100 1010111100 {z }20 0101 {z}5 700 {z 1010 {z}10 1010 {z}10 } We used a total of 87 bits to store matrix m with the VLB method instead of 80 bits using the SM method. However, as shall be seen later, the VLB method will be the most efficient for most matrices. Compression Efficiency Compression efficiency depends of the data being compressed. Below, a formula for calculating compres- sion efficiency is derived for both methods. They will be based on the following ratio: η = bits alocated − bits used bits alocated (4) Where bits alocated above mean total bits required for standard storage of the matrix, without com- pression, while bits used mean total bits requires to store the matrix after compression. From now on the efficiencies are denoted by η1 for the SM method and by η2 for the VLB method. 6 SM Method Let Mr×c be the matrix we wish to compress. integers), we can apply Equation 4 to caluculate the efficiency of the SM method: In comparison with a conventional allocation (64-bit η1 = = 64 × rc − b(maxM ) × rc 64 × rc 64 − b(maxM ) 64 (5) As we see in 5, η1 does not depend on size of the matrix, only on the bit-length of max M . If b(max M ) = 64, η1 is 0, i.e., no compression is possible. On the other extreme, if the matrix is composed exclusively of 0s and 1s, maximal compression is achievable, η1 = 1. VLB Method For the VLB method, compression depends on the value of each element of the matrix. In this method bit-lentgh variability affects the compression ratio, so the formula will have to include this information. Let the rc elements of the matrix Mr×c be divided into g groups, each with fi numbers of bit-length bi = b(mi). Thus fi is the frequency of each bit-length present in M . Let k = b(b(max M )), i.e., the bit length of the bit-length of max M . The efficiency η2 is shown below. We can further simplify Equation 6 to get at shorter expression for the compression ratio. η2 = 64 × rc −Pg 64 × rc i=1(bi + k) × fi (6) (7) η2 = = = Knowing that 64 × rc −Pg 64 × rc −Pg 64 × rc −Pg i=1(bi × fi + k × fi) 64 × rc 64 × rc i=1 bi × fi −Pg i=1 bi × fi − k ×Pg 64 × rc i=1 k × fi i=1 fi we can simplify the equation above, obtaining (7). fi = rc, g Xi=1 i=1 bi × fi − k × rc 64 × rc η2 = 64 × rc −Pg = 1 − Pg i=1 bi × fi 64 × rc − k 64 Results In both methods, compression efficiency depends on the distribution Random Matrix Generation. of the bit-lengths b(mi,j). Thus, in this section, a method to generate a variety of random bit-length distributions is proposed. 7 For simplicity we will model the distribution of as a mixture X of two Beta distributions, B1 ∼ Beta(α1, β1) and B2 ∼ Beta(α2, β2), whose probability function is shown in Equation 8. Since the Beta distribution is defined only in the interval [0, 1] ⊂ R , we applied a simple transformation (⌊64 × x⌋ + 1) to the mixture in order to map it to the interval of [1, 64] ⊂ Z. F (x) = w Beta(α1, β1) + (1 − w) Beta(α2, β2) (8) The intention of using this mixture was to find a simple way to represent a large variety of bit length distributions. The first two central moments of this mixture are given in 9 and will be used later to summarize our numerical results. E(X) = wE(B1) + (1 − w)E(B2) α2 α1 = w + (1 − w) α1 + β1 α2 + β2 V ar(X) = wV ar(B1) + (1 − w)V ar(B2) + w(1 − w)(E(B1)2 − E(B2)2) (9) In order to explore the compression efficiency of both methods, we generated samples from the mixture defined above, varying its parameters. From now on, when we mention Beta distribution we will mean the transformed version defined above. From now on we will apply Equations 5 and 7, to determine the compression efficiency of SM and VLB methods for random matrices generated as describe above. With w = 0, a single Beta distribution is used. In Figure 1, we show some distributions of bit-lengths for some combinations of α1 and β1. From the figure it can be seen that a large variety of unimodal distributions can be generated in the interval [1, 64]. As we are sampling from a large set distributions of bit-length, represented by the mixture of betas presented above, in order to make our results more general, we will base our analysis on the expected bit-length of a sample, since the efficiency of both methods depends on it. So, from Equations 5 and 7, the expected efficiencies become: E(η1) = 1 − k 64 E(η2) = 1 − E(b) 64 − k 64 (10) (11) where k, in (11), is set to 7 (the bit-length required to represent the largest possible bit-length: 64). In (10), k is the bit-length of the greatest element, or in the worst case, 64. We will use the difference D = E(η1) − E(η2) to compare the efficiency of the two methods. Thus a positive D will favor SM method while a negative D favors VLB method. The expected compression efficiency in the following numeric experiments, will be calculated from 3 matrices of dimension 10000, generated as described, and presented in tables and figures below. In Figure 2, we can see the distribution of efficiencies and their difference for a sample generated from a single Beta distribution of bit-lengths. Note that both methods can achieve efficiencies greater than 80% for matrices with very small numbers. Also note that the VLB method is more efficient in the majority of cases. Now let w = 0.5, i.e., matrices will have elements with bit-lengths comming from a mixture of beta distributions, B1 ∼ Beta(α1, β1) and B2 ∼ Beta(α2, β2). The expected value for this mixture is shown in Equation 12. E(B) = 0.5E(B1) + 0.5E(B2) (12) 8 0 0 0 4 0 0 0 3 0 0 0 2 0 0 0 1 0 y c n e u q e r F 1 8 16 24 32 40 48 56 64 1 8 16 24 32 40 48 56 64 Bit number (a) α = 1, β1 = 1 Bit number (b) α = 1, β = 32 0 0 4 1 0 0 2 1 0 0 0 1 0 0 8 0 0 6 0 0 4 0 0 2 0 y c n e u q e r F y c n e u q e r F y c n e u q e r F 0 5 2 0 0 2 0 5 1 0 0 1 0 5 0 0 0 0 4 0 0 0 3 0 0 0 2 0 0 0 1 0 1 8 16 24 32 40 48 56 64 1 8 16 24 32 40 48 56 64 Bit number (c) α = 32, β = 1 Bit number (d) α = 64, β = 64 Figure 1. Histograms constructed from samples with 10,000 elements, generated from a Beta distribution. Below each histogram is possible to verify the parameters used. For bit-lengths coming from a mixture (w > 0), let the expected efficiencies for the SM and VLB methods be as given by Equations 13 and 14. So now, instead of having the efficiency be a function of greatest bit-length in the sample (denoted as k in 5 and 7), it will be a function of max{E(B1), E(B2)}. E(η1) = 1 − max{E(B1), E(B2)} 64 E(η2) = 1 − 0.5 E(B1) 64 − 0.5 E(B2) 64 − max{E(B1), E(B2)} 64 (13) (14) As before, we generate 3 matrices of dimension 10, 000 for each parameterization, calculate the average efficiencies (Equations 13 and 14) and their diference D. Before moving on to efficiency results and analyses, let's first inspect samples from the mixture of transformed Beta distributions. Figures 3 and 4, show a few parameterizations and their resulting sample distributions. It is important to note that from the mixture we can now generate bimodal distributions as well as the unimodal types tested before. Since we are making statements about efficiency as a function of the expected bit-length, it is important to verify if these statements hold for bimodal distributions as well. After sampling uniformly ([1, 5, 9, . . . , 64], n = 65, 536) the bit-length space and comparing efficiencies, we summarized the results on Table 3. In it we see how many parameterizations (from our sample) favor 0.0 −0.1 −0.2 −0.3 −0.4 −0.5 2 η − 1 η 10 20 α 30 40 50 60 10 20 40 30 β 50 60 (a) SM-VLB Difference (D = η1 − η2) 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 1 η 10 20 α 30 40 50 60 10 20 40 30 β 50 60 56 48 40 32 24 16 8 56 48 40 32 24 16 8 10 20 α 30 40 50 60 10 20 40 30 β 50 60 (b) SM Efficiency (η1) 10 20 α 30 40 50 60 10 20 40 30 β 50 60 9 56 48 40 32 24 16 8 56 48 40 32 24 16 8 0.8 0.6 0.4 2 η 0.2 0.0 0.030 0.025 0.020 0.015 0.010 0.005 0.000 2 η ≥ 1 η (c) VBL Efficiency (η2) (d) SM≥VLB Efficiency (η1 ≥ η2) Figure 2. Comparing compression efficiency of methods 1 and 2. Color scale in (a), (b) and (c) represent average bit-length. In (a) we can see the difference D = η1 − η2. It can be seen that for most combination of α and β, D < 0, meaning the second method is more efficent to compress a sample of numbers with bit-lengths coming from a Beta(α, β) distribution. However, there is a small region in parameter space, which is shown in white on (d), where the SM method is more efficient. This region corresponds to the dots in red in (a), where the average bit-length is higher. In panels (b) and (c), we can see the efficiencies of SM and VLB methods, respectively. each method. We can also look at the distribution of efficiencies on our samples for each method (Figure 5), which clearly demonstrate the greater expected efficiency of method VLB (Figure 5(b)). As we have shown, the VLB method is more effective compressing most integer datasets up to 64 bits in size. This is due to its ability to exploit the variance in the data set and reduce the waste of bits in the representation of some numbers. In specific cases where the variance in the data null or too small, method I will be more efficient. As a matter of fact, for matrices where all elements have the same bit-length, SM method will always be better, regardless of bit-length (Figures 6(a) and 6(b)), The only exception if for bit-length 64 where neither method is able to compress the data. Discussion Calculating Efficiencies To determine the best compression method to apply, it's necessary to inspect the distribution of bit- lengths of matrix elements. When matrix elements are small or have nearly-constant bit-length, the SM Method is best, otherwise, the VLB method should be chosen. As an example, let Mr×c be a integer matrix such that the half of its elements have bit-length 1 and 10 0 0 0 0 4 0 0 0 0 3 0 0 0 0 2 0 0 0 0 1 0 y c n e u q e r F 1 8 16 24 32 40 48 56 64 1 8 16 24 32 40 48 56 64 Bit number Bit number (a) α1 = 1, β1 = 1, α2 = 1, β2 = 1 (b) α1 = 1, β1 = 32, α2 = 32, β2 = 1 y c n e u q e r F 0 0 0 2 1 0 0 0 0 1 0 0 0 8 0 0 0 6 0 0 0 4 0 0 0 2 0 y c n e u q e r F y c n e u q e r F 0 0 5 1 0 0 0 1 0 0 5 0 0 0 0 0 1 0 0 0 8 0 0 0 6 0 0 0 4 0 0 0 2 0 1 8 16 24 32 40 48 56 64 1 8 16 24 32 40 48 56 64 Bit number Bit number (c) α1 = 32, β1 = 32, α2 = 32, β2 = 32 (d) α1 = 64, β1 = 32, α2 = 32, β2 = 64 Figure 3. Histograms constructed from samples with 10,000 elements, generated from the mixture of two Beta distributions with w = 0.5. Below each histogram are the parameters of the mixture. the other half 64. Recalling Equation 7, now we have two groups of elements (by bit-length), b1 = 1, b2 = 64 and fi = rc 2 for i = 1 and 2. As the greatest bit-length is 64, then k = 7. Compression efficiency η2 can be calculated using Equation 7. After plugging in our numbers, we obtain a compression of 38.29%. η2 = 1 − P2 i=1 bi × fi 64 × rc − 7 64 η2 = 1 − 1 × rc 2 + 64 × rc 64 × rc 2 − 7 64 η2 = 1 − 32.5 × rc 64 × rc − 7 64 η2 ≈ 1 − 0.5078 − 0.1093 η2 ≈ 38.29% 11 y c n e u q e r F 0 0 0 6 0 0 0 5 0 0 0 4 0 0 0 3 0 0 0 2 0 0 0 1 0 1 8 16 24 32 40 48 56 64 1 8 16 24 32 40 48 56 64 Bit number Bit number (a) α1 = 64, β1 = 48, α2 = 1, β2 = 48 (b) α1 = 16, β1 = 46, α2 = 49, β2 = 64 y c n e u q e r F 0 0 0 5 2 0 0 0 0 2 0 0 0 5 1 0 0 0 0 1 0 0 0 5 0 y c n e u q e r F y c n e u q e r F 0 0 0 5 2 0 0 0 0 2 0 0 0 5 1 0 0 0 0 1 0 0 0 5 0 0 0 0 6 0 0 0 5 0 0 0 4 0 0 0 3 0 0 0 2 0 0 0 1 0 1 8 16 24 32 40 48 56 64 1 8 16 24 32 40 48 56 64 Bit number Bit number (c) α1 = 16, β1 = 16, α2 = 16, β2 = 49 (d) α1 = 1, β1 = 16, α2 = 1, β2 = 49 Figure 4. Histograms constructed from samples with 10,000 elements, generated from the mixture of two Beta distributions with w = 0.5. Below each histogram are the parameters of the mixture. The efficiency of the VLB method is influenced by the relative size of the bit-length groups. In this first example we considered only two groups, each comprised of half the matrix elements. Let's now vary the relative frequency of the groups, fi rc , while sticking to two groups. Let's also assume that fi rc is a good approximation to the probability of a given bit-length in a matrix, which we will denote by pi. With this definition we can rewrite the Equation 7, which becomes 15. In Equation 15, the fi rc is replaced by pi, representing the probability of elements from group i in matrix M. with η2 = 1 − Pg i=1 bi × pi 64 pi = fi rc − k 64 (15) (16) With the Equation 15 can analyze the influence of bit-length probability in compression efficiency. In this example, p1 and p2 represent the probability of elements of bit-lengths 1 and 64, respectively. Thus, efficiency is defined in Equation 17. Table 2. Efficiency comparison of SM and VLB methods for parameters covering uniformly the support of B. Column n shows the number of parameter combinations with which each method has superior compression. 12 Methods SM VLB Total n 592 64944 65536 Percentage 0.9034% 99.0966% 100% y c n e u q e r F 0 0 0 6 0 0 0 4 0 0 0 2 0 y c n e u q e r F 0 0 0 5 1 0 0 0 0 1 0 0 0 5 0 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 Efficiency Efficiency (a) Efficiency histogram of the SM method (b) Efficiency histogram of the VLB method Figure 5. Efficiency histograms of the SM and VLB methods. Note that the VLB method has a greater average efficiency than SM method . η2 = 1 − 1 × p1 + 64 × p2 64 − 7 64 (17) Now, we can determine which probabilities give us the best and worst compression levels. When η2 = 1, then the efficiency is maximal and if η2 = 0, a efficiency is minimal. To calculate the values of p1 and p2 for both extreme values of η2, we must solve the linear systems shown in Equations 18 and 19. The first equation on both systems come from the law of total probability. The second comes from 17 after setting η2 to 1 and 0, respectively. η2 = 1 :(cid:26) p1 + p2 = 1 p1 + 64p2 = 7 (18) Solving the system above, we find that when p1 = 0.9047 and p2 = 0.0953, efficiency is maximal, and in this particular case is equal to 87.5%. η2 = 0 :(cid:26) p1 + p2 = 1 p1 + 64p2 = 57 (19) Thus, when p1 = 0.1111 and p2 = 0.8889 the efficiency is minimal for the VLB method. For other combinations see Table 3. Looking at this table, one can see two negative efficiencies, when (p1,p2) assume the values (0,1) and (0.1,0.9). This correspond th cases when the method increases the memory requirements instead of decreasing it. So far, we have examined only two groups (hence two probabilities) of bit-length for the sake of simplicity. Before we generalize to probability distributions let's take a quick look at the efficiencies for more groups, with uniform probability: 13 SM Method VLB Method 1 0.8 0.6 0.4 0.2 t n e i c i f f E 0 0 10 20 30 40 50 60 70 bit (a) Efficiencies of the SM and VLB methods, for con- stant bit-length matrices. t n e i c i f f E 0.1 0.08 0.06 0.04 0.02 0 8 16 24 32 Bit 40 48 56 64 (b) η1 − η2 for matrices of constant bit-length. Figure 6. Compression efficiency of the SM and VLB methods for matrices of constant bit-length. Table 3. Combinations p1 and p2 to calculate the efficiency. p1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 p2 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 η2 -0.109 -0.010 0.087 0.185 0.284 0.382 0.481 0.579 0.678 0.776 0.875 • 3 groups with bit-lengths 1, 32 and 64 bits, efficiency η2 = 0.3854, • 5 groups with bit-lengths 1, 16, 32, 48 and 64 bits, efficiency η2 = 0.3875, • 8 groups with bit-lengths 1, 8, 16, 24, 32, 40, 48, 56 and 64 bits, efficiency η2 = 0.3888 When the distribution of the group probabilities is uniform, i.e., the groups have approximately the same size, efficiency is basically the same, regardless of the number of groups. Now we can leverage the notion of bit-length probabilities, and study efficiency when bit-lengths follow some commonly used discrete probability distributions: Discrete Uniform, Binomial and Poisson. For all the experiments, we assume k = 7, that is, the maximum possible bit-length is 64 bits. Thus, efficiency obtained will not be the best possible, since for that we would need assume small values of k (Equation 15). Discrete Uniform Let the bit-lengths of the matrices be distribute according to the Uniform distribution U (a = 1, b = 64), which means bit-lengths may take values in the set {1, 2, 3,. . . , 64} with equal probability, i.e., 1 64 . 14 Theoretical Efficiency: Let the random variable B ∼ U (a = 1, b = 64) represent the bit-length of 2 . Applying this result to the expected the elements of matrix M . Then E(bi) = Pi bi × p(bi) = a+b compression efficiency of VLB method (Equation 15), we have assuming all bit-lengths are possible, i.e., a = 1 and b = 64, and hence k = 7, we can calculate η2: E(η2) = 1 − E(B) 64 − k 64 (20) This result agrees with the numerical estimates presented in Table 4. E(η2) = 1 − 1+64 2 64 − 7 64 ≈ 38.28% (21) Numerical Estimates: To calculate the VLB efficiency, we generated a matrices with 100 (M10×10), 10,000 (M100×100) and 1,000,000 (M1,000×1,000) elements with 1, 8, 16, 32 and 64 number of bitss. The average efficiency (Table 4) is calculated from a 1,000 replicates of each matrix size. As expected the compression effiency gets better with lower expected bit-length. Table 4. Compression efficiency of VLB method of samples with bit-lengths coming from a Discrete Uniform distribution U (a = 1, b = 64). Average efficiency (η2 ± SD) were calculated over a 1,000 replicates. Expected bit-length 100 1 8 16 32 64 0.8750±0.0000 0.8202±0.0031 0.7580±0.0066 0.6330±0.0142 0.3826±0.0288 Matrix sizes Sample size 10,000 0.8750±0.0000 0.8203±0.0003 0.7578±0.0007 0.6329±0.0014 0.3828±0.0028 1,000,000 0.8750±0.0000 0.8203±0.0000 0.7578±0.0001 0.6328±0.0001 0.3828±0.0003 Binomial Distribution For the binomial distribution, we will use Bin(n, p), with the number of trials n representing the greatest possible bit-length in the matrix, and np giving us the expected bit-length. Theoretical Efficiency: Let bit-length (B) be a random variable with Binomial distribution, B ∼ B(n = 64, p = 0.5), E(bi) =Pi bi × p(bi) = n × p and the eficiency becomes (with k = 7): E(η2) = 1 − (22) 64 × p 64 − k 64 Which again agrees with estimates in Table 5. = 1 − 64 × 0.5 64 − 7 64 ≈ 39.05% Numerical Estimates: For these experiments, the parameter n represents the maximum bit-length of matrix elements and takes values in {1, 8, 16, 32, 64}. In this case, we evaluate the efficiency as a function of the parameter n, and matrix size. Even though efficiency does not depend on matrix size, we tried different sizes to test the stability of the compression algorithm. Results are shown in Table 5. As expected, smaller bit-lengths lead to higher compression efficiencies. 15 Table 5. Compression efficiency with bit-lengths distributed according to a binomial distribution B(n, 0.5). Parameter n ∈ {1, 8, 16, 32, 64} represents the maximum bit-length. Since p = 0.5 the expected bit-length is n/2 (first column) Expected bit-length (np) 100 1 8 16 32 64 0.8828±0.0004 0.8283±0.0022 0.7656±0.0032 0.6406±0.0045 0.3910±0.0065 Efficiency Sample size 1,000 0.8828±0.0004 0.8281±0.0002 0.7656±0.0003 0.6406±0.0004 0.3906±0.0006 1,000,000 0.8828±0.0000 0.8281±0.0000 0.7656±0.0000 0.6406±0.0000 0.3906±0.0001 Poisson Distribution With bit-length derived from a Poisson(λ), the parameter λ corresponds to the expected bit-length. For the purpose of this analysis this Poisson distribution is truncated at 64. Theoretical Efficiency: Let bit-length B ∼ P oisson(λ = 32). In this case, E(bi) = λ, with k = 7, the efficiency becomes: E(η2) = 1 − = 1 − λ 64 32 64 − − k 64 7 64 ≈ 39.06% (23) (24) This result is in accordance to Table 6. Numerical Estimates: The results for this simulation can be seen in 6. Note that increasing the number of bits to represent numbers increases, there is a loss of efficiency in the compression process. In this case we did not simulate for λ = 64 since a large portion of the samples would fall above the maximum bit-length we are considering for this analysis. Table 6. Compression efficiency with bit-lengths distributed according to a Poisson distribution (λ), where λ represents the expected bit-length. Expected bit-length (λ) 100 1 8 16 32 0.8751±0.0015 0.7654±0.0046 0.6405±0.0064 0.3908±0.0087 Efficiency η2 Matrix Size 1,000 0.8750±0.0004 0.7656±0.0005 0.6406±0.0006 0.3906±0.0009 1,000,000 0.8750±0.0000 0.7656±0.0000 0.6406±0.0001 0.3906±0.0001 These results show that a good compression is guaranteed when bit-lengths are distributed according to the tested distributions regardless of sample size. 16 1 Conclusion In this paper, we have focused in the compression of matrix data, since this is one of the most important application the authors foresee. However, the compression methodology presented can be applied to any numerical data structure, with gains to performance and memory footprint[citar tese Crysttian e possveis artigos derivados]. Further discussions about doing computation with such compressed data-structures will be the subject of another manuscript (in preparation) in which we will present details about the implementation of the compression algorithm, and benchmarks on classical linear algebra tasks such as those in Linpack[ref]. For the compression calculations presented in this paper we limited bit-lenght of integers to 64 bits. However the compression would work in the same way as discussed for computer architectures with larger word sizes. Representation of floating point numbers is also possible within the proposed compression framework, but at the expense of precision in their representation. Although this may sound like a limitation, when we take into consideration that most experimental data have fewer "significant" digits than the maximal precision available in modern computers, fairly good compression may still be achievable for floats. Acknowledgments We would like to thank Claudia Torres Code¸co, Paulo Cezar Carvalho and Moacyr Silva for fruitful discussions and key ideas which helped improve the manuscript. References 1. Alted F (2010) Why modern cpus are starving and what can be done about it. Computing in Science & Engineering 12: 68 -- 71. 2. Salomon D, Motta G, Bryant D (2009) Handbook of Data Compression. London: Springer, 1359 pp. 3. Salomon D (2007) Data Compression: The Complete Reference. Number v. 10 in Data compression: the complete reference. London: Springer-Verlag New York Incorporated. 4. Lynch C (2008) Big data: How do your data grow? Nature 455: 28 -- 29. 5. Gaber M, Zaslavsky A, Krishnaswamy S (2005) Mining data streams: a review. ACM Sigmod Record 34: 18 -- 26. 6. Yemliha T, Chen G, Ozturk O, Kandemir M, Degalahal V (2007) Compiler-directed code restruc- turing for operating with compressed arrays. In: Proceedings of the 20th International Conference on VLSI Design held jointly with 6th International Conference: Embedded Systems. Citeseer, pp. 221 -- 226. 7. Dodson D, Grimes R, Lewis J (1991) Sparse extensions to the fortran basic linear algebra subpro- grams. ACM Transactions on Mathematical Software (TOMS) 17: 253 -- 263. 8. Van Der Walt S, Colbert S, Varoquaux G (2011) The numpy array: a structure for efficient numerical computation. Computing in Science & Engineering 13: 22 -- 30. 9. Kane MJ, Emerson JW (2012) bigmemory: Manage massive matrices with shared memory and memory-mapped files. URL http://CRAN.R-project.org/package=bigmemory. R package ver- sion 4.3.0. 10. Bodden E, Clasen M, Kneis J (2007) Arithmetic coding revealed. In: Sable Technical Report 2007-5, Sable Research Group, School of Computer Science, (McGill University, Montr´eal. 17
1702.04536
2
1702
2018-11-05T20:36:45
A $(2+\epsilon)$-Approximation for Maximum Weight Matching in the Semi-Streaming Model
[ "cs.DS" ]
We present a simple deterministic single-pass $(2+\epsilon)$-approximation algorithm for the maximum weight matching problem in the semi-streaming model. This improves upon the currently best known approximation ratio of $(4+\epsilon)$. Our algorithm uses $O(n\log^2 n)$ bits of space for constant values of $\epsilon$. It relies on a variation of the local-ratio theorem, which may be of use for other algorithms in the semi-streaming model as well.
cs.DS
cs
A (2 + ǫ)-Approximation for Maximum Weight Matching in the Semi-Streaming Model∗ Ami Paz‡ Gregory Schwartzman§ Abstract We present a simple deterministic single-pass (2 + ǫ)-approximation algorithm for the maxi- mum weight matching problem in the semi-streaming model. This improves upon the currently best known approximation ratio of (4 + ǫ). Our algorithm uses O(n log2 n) bits of space for constant values of ǫ. It relies on a variation of the local-ratio theorem, which may be of use for other algorithms in the semi-streaming model as well. 1 Introduction We present a simple (2 + ǫ)-approximation algorithm for the maximum weight matching (MWM) problem in the semi-streaming model. Our algorithm is deterministic, single-pass, requires only O(1) processing time per incoming edge, and uses O(n log2 n) bits of space for any constant ǫ > 0. This improves upon the previously best known approximation algorithm of Crouch and Stubbs [CS14], which achieves an approximation ratio of (4 + ǫ) and takes O(log n) time to process an edge. Our main result is as follows. Theorem 1. There exists an algorithm in the semi-streaming model computing a (2+ǫ)-approximation for MWM, using O(ǫ−1n log n · (log n + log(1/ǫ))) bits and having an O(1) processing time. The MWM problem is a classical problem in graph theory. Its first efficient solution is due to Edmonds [Edm65], which was later improved by Micali and Vazirani [MV80]. The MWM problem was one of the first to be considered in the semi-streaming model when this model was first presented [FKM+05], and apparently the most studied problem in this model since (see "Related Work"). In the first algorithms for the MWM problem in the semi-streaming model, a matching is maintained at all times, and is being updated according to the incoming edges. More recent algorithms sort the edges into weight classes, keep a subset of each class, and then find a matching in the union of these subsets. Like previous algorithms, our algorithm maintains a set of edges from which the final matching is constructed; however, unlike some of the previous algorithms, we do not maintain a matching ∗An extended abstract of this work was presented in SODA 2017 [PS17]. ‡IRIF, CNRS and University Paris Diderot, France [email protected]. Supported by the Fondation Sciences Math´ematiques de Paris (FSMP) §National Institute of Informatics, Japan [email protected]. Supported by JSPS KAKENHI Grant Number JP18H05291. 1 at all times, but only construct it in a post-processing stage. Our main technical contribution is the adaptation of the local-ratio technique for maximization problems [BYE85, BBF+01] to the semi-streaming model, in a novel and simple manner. Our work presents a significantly better approximation ratio for the MWM problem, along with a new approximation technique for opti- mization problems in the semi-streaming model. For the maximum unweighted matching problem, a simple greedy algorithm yields a 2-approximation. This was observed in the very first paper on the semi-streaming model [FKM+05], and not improved since. Any future improvement of the approximation factor to a constant smaller than 2 will also solve this long-standing problem. Our Contribution When developing an algorithmic framework for a new model, it is natural to first address the most fundamental algorithmic problems. Finding a large matching in a graph is indeed a fundamental problem, which has been extensively studied in the model of semi-streaming graph algorithms. Our algorithm uses an extension of a well studied approximation framework, the local-ratio technique, while previous algorithm used clever ideas which were specifically crafted for the problem and model. As noted, a simple greedy algorithm gives a 2-approximation for MWM in the unweighted case. In the weighted case, a 2-approximation can be achieved by first sorting the edges from the heaviest to the lightest, and then adding them greedily to form a matching. However, in the semi-streaming model it is impossible to keep a list of all the edges in the memory in order to sort them. Instead, the local-ratio technique allows us to ignore some of the edges, and run a greedy algorithm on the remaining edges, in an arbitrary order. In this work, we extend the local-ratio technique, in a way that allows us to discard all but O(n log n) of the edges, complying with the memory restrictions of the model. A simple local-ratio algorithm for the MWM problem in the sequential model of computation goes roughly as follows: repeatedly select an edge with positive weight; reduce its weight from the edge itself and from all its neighboring edges; push the edge into a stack and continue to the next edge, as long as there is an edge with positive weight; finally, unwind the stack and add the edges greedily to the matching. This procedure results in a 2-approximation for the MWM problem. It can be extended to a (2α)-approximation, for α > 1, if at each step we reduce the weight of the processed edge multiplied by α from its adjacent edges. The challenge in translating this technique to the semi-streaming model is twofold. First, we have to reduce edge weights from edges that are yet to arrive. This is solved by saving, for each node, the total amount that should be reduced from each arriving edge containing this node, and reducing weight retroactively from incoming stream edges. The second, more substantial challenge, is limiting the size of the stack, so it can comply with the O(n polylog n) space bound. It is not hard to come up with an execution of the above algorithm where all edges are eventually stored in the stack, which may take Ω(n2 polylog n) bits of space. To overcome this problem, we remove edges from within the stack, during the execution of the algorithm. The traditional local-ratio technique was not designed to work under space limitations, and thus does not guarantee any approximation ratio if edges are removed from the stack. The crux of our approach is a variation of the local-ratio technique, which provides conditions under which an edge may be removed from the stack while incurring only a small loss in the approximation ratio. Specifically, we show that if an edge in the stack is significantly lighter than its neighboring 2 edge, and this neighboring edge is added to the stack, then removing the light edge has only a small effect on the total weight of the solution. In order to use this conclusion, we must first assure a steady increase in the edge weights around each node. This, in turn, requires another adaptation to the classical local-ratio approach for the problem. To assure the constant growth of the edge weights, we increase the weight an edge reduces from its neighborhood by a multiplicative factor. This results in another deterioration in the approximation ratio, but has the benefit of forcing the weights of edges in the stack to exhibit a geometrical growth pattern. This, in turn, creates the conditions for our modified local-ratio theorem to show its strength, allowing us to keep the size of the stack within the model's limits. Carefully choosing parameters that manage the trade-off between space and approximation ratio, we achieve a (2 + ǫ)-approximation using O(n log2 n) bits. Finally, we note that the basic structure of the local-ratio technique, namely processing the edges one by one in an arbitrary order and then performing some postprocessing, suits very naturally to the streaming environment. Combined with the machinery we develop here in order to follow the semi-streaming space constraints, we believe this technique can be applied to additional problems in the semi-streaming model and in similar computational models. Related Work The study of graph algorithms in the semi-streaming model was initiated by Feigenbaum et al. [FKM+05], in order to tackle the problem of processing massive graphs whose edge set cannot be stored in memory. The need for algorithms for such massive graphs is evident, as they become increasingly common: graphs representing social networks, graphs for metabolic interactions used in computational biology and even the communication graph of the Internet, are only a few examples. Feigenbaum et al. were also the first to study the MWM problem in the semi-streaming model, and presented a 6-approximation algorithm for it. Their algorithm maintains a matching at all times: when an edge arrives, it checks if the new edge's weight is more than double the sum of weights of its adjacent edges currently in the matching, and if so, the edge is added to the matching instead of its adjacent edges. This idea was later adapted by McGregor [McG05] to achieve an approximation ratio of 5.828, by changing the threshold for inserting an edge to the matching (McGregor also presents a (2 + ǫ)-approximation algorithm for the problem, but using O(ǫ−3) passes on the input). By using similar ideas, while keeping deleted edges and reviving them later, Zelke [Zel12] achieves a 5.585-approximation algorithm. A different approach was taken by Epstein et al. [ELMS11], who achieve a (4.911+ǫ)-approximation algorithm. They use bucketing, i.e., separate the edges into O(log n) weight classes, find a match- ing in each bucket, and then find the final matching in the union of these matching. Crouch and Stubbs [CS14] achieve an approximation ratio of (4 + ǫ) using related ideas, but their algo- rithm uses weight classes which are unbounded from above, and thus are not disjoint. Grigorescu et al. [GMZ16] have presented an improved analysis of the last algorithm, claiming to achieve a (3.5 + ǫ)-approximation; unfortunately, this analysis currently seems to contain an error. The bucketing technique takes a heavy toll on the approximation factor, and Crouch and Stubbs [CS14] prove this technique cannot give an approximation ratio better than 3.5. To cir- cumvent this bound, we use a different approximation framework, the local-ratio technique. To the best of our knowledge, this is the first application of this technique in a streaming model. Recently, Ghaffari and Wajc [GW18] have shown a slight modification to our algorithm, that achieves the optimal O(n log n)-bits bound, assuming that the edge weights are integers of size 3 polynomial in n. One related problem is estimating size of the maximum matching in a graph [AKL17, Kap13, KKS14, GKK12] which is known to be related to matrix rank approximation. More general submodular-function matching problems in the semi-streaming model have been considered by Varadaraja [Var11] and by Chakrabarti and Kale [CK14]. The MWM problem was also considered in other streaming models, such as the MapReduce model [CS14, LMSV11], the sliding-window model [CS14, CMS13] and the turnstile stream model (allowing deletions as well as insertions) [Kon15,AKLY16,BS15,CCE+16]. Extending our technique to other computational models is a challenge yet to be addressed. Structure of this Paper We formally define the MWM problem and the semi-streaming model of computation in Section 2. In Section 3 we introduce the local-ratio theorem, present a sequential 2-approximation local-ratio algorithm for MWM, and discuss our variations to the theorem. In Section 4 we extend the 2-approximation algorithm to a more involved (2 + ǫ)-approximation algorithm for MWM, analyze its performance, and finally adapt it to the semi-streaming model. 2 Preliminaries Let G = (V, E, w) be a simple graph with non-negative edge weights, w ∈ RE + (we use vector nota- tion for edge weights). Denote n = V and m = E; for an edge e denote N (e) = {e′ e ∩ e′ = 1} called the neighboring edges of e, and N +(e) = N (e) ∪ {e}. We usually assume edge weights and their sums can be represented by O(log n) bits, and discuss other weight functions at the end of the paper. Maximum Weight Matching A matching in G is a set M ⊆ E of edges such that no two edges share a node. A maximum weight matching (MWM) in G is a matching M of maximum weight: for every matching M ′ in G, we have Pe∈M w[e] ≥Pe∈M ′ w[e]. A matching M is identified with its indicator vector x, defined by x[e] = 1 if e ∈ M , and x[e] = 0 otherwise. Thus, the weight of a matching x is the value of the inner product of x and w, denoted xw. A set of feasibility constrains on x is induced by the graph in a straightforward manner: ∀e, e′ ∈ E : e ∩ e′ = 1 =⇒ x[e] · x[e′] = 0. Approximation Algorithms A feasible matching x is said to be a p-approximation of a MWM in G, for a constant p ≥ 1, if every matching x∗ satisfies x∗w ≤ p · xw. An algorithm returning a p-approximation on every input graph is said to be a p-approximation algorithm for the MWM problem, and p is called the approximation ratio of the algorithm. Note that if p′ > p than a p-approximation algorithm is also a p′-approximation algorithm. The definition naturally extends to other optimization problems. In the semi-streaming model of computation, as in sequential The Semi-Streaming Model models, the goal is to compute parameters in some given graph. An algorithm in this model proceeds in iterations, where in each iteration it receives an edge from the stream and processes it. Since the number of edges in the graph might be too large to fit in memory, we limit the algorithm to use only O(n polylog n) bits. In addition, we try to keep the processing times of the edges as short as possible, since a long processing time might result in a queue of later incoming 4 edges, exceeding the space limitations. The algorithm is also allowed to perform pre-processing and post-processing, but minimizing their times is of less importance. 3 Approximating Maximum Weight Matching In this section we present the local-ratio theorem for maximization problems [BBFR04], and use it to present a sequential 2-approximation algorithm for MWM. We then present extensions of this technique and use them in order to adjust the sequential local-ratio algorithm to the semi-streaming model, incurring only a small loss in the approximation ratio. 3.1 A Simple Local-Ratio Approximation Algorithm for MWM The basic building blocks of a local-ratio algorithm are iterative weight reduction steps. Weight reduction step number i starts with a graph G = (V, E, wi), and defines two new graphs, composed of (V, E) and new edge-weight functions: the reduced graph, which has weight function wi+1, and the residual graph, which has weight function ¯wi+1, such that wi = wi+1 + ¯wi+1. We start with the local-ratio theorem for maximization problems [BBFR04, Theorem 9], which we restate here for completeness. Note that this theorem applies even if wi+1 takes negative values. Theorem 2. Let wi ∈ Rm be a vector, and consider the problem of maximizing the product xwi under a set of feasibility constraints. Let wi+1, ¯wi+1 ∈ Rm be vectors such that wi = wi+1 + ¯wi+1. If xi ∈ Rm is a feasible solution that is a p-approximation with respect to wi+1 and with respect to ¯wi+1, then xi is a p-approximation with respect to wi as well. Proof. Let x∗ Then i+1 be maximum feasible solutions with respect to wi, wi+1 and ¯wi+1. i , x∗ i+1 and ¯x∗ i ¯wi+1 i wi+1 + x∗ i+1wi+1 + ¯x∗ x∗ i wi = x∗ ≤ x∗ i+1 ¯wi+1 ≤ p · xiwi+1 + p · xi ¯wi+1 = p · xiwi, where the first inequality follows from the maximality of x∗ assumption that xi is a p-approximation with respect to wi+1 and ¯wi+1. i+1 and ¯x∗ i+1, and the second from the We apply weight reduction steps iteratively, while ensuring that any p-approximate solution to wi+1 can be easily extended into a p-approximate solution to ¯wi+1. For the specific problem of MWM, a weight reduction step is done by picking an arbitrary edge e ∈ E of positive weight and reducing this weight from every e′ ∈ N +(e). This splits the weight vector wi into two vectors, wi+1 and ¯wi+1, by setting ¯wi+1[e′] =(wi[e] 0 e′ ∈ N +(e); otherwise, and wi+1 = wi − ¯wi+1. Any 2-approximate solution xi+1 for the reduced graph can be easily extended into a 2-approximate solution for the residual graph by making sure that at least one edge e′ ∈ N +(e) is in the solution: if this is not the case, we can add e to the solution without 5 Algorithm 1: MWM-simple(V, E, w). A simple 2-approximation algorithm for MWM 1 S ← empty stack 2 w1 ← w; i ← 1 3 foreach ei ∈ E s.t. wi[ei] ≥ 0 do 4 5 6 7 S.push(ei) wi+1 ← wi foreach e′ ∈ N +(ei) do wi+1[e′] ← wi[e′] − wi[ei] i ← i + 1 8 k ← S 9 xk+1 ← ~0 10 for i ← k down to 1 do 11 12 13 xi ← xi+1 ei ← S[i] if ∀e ∈ N +(ei) : xi[e] = 0 then xi[ei] ← 1 14 return x1 // Implicit: ¯wi+1[e′] ← wi[ei] violating the constraints. As wi+1[e] = 0, adding e to the solution does not reduce the solution's value with respect to wi+1. Thus, we get a 2-approximate solution for both wi+1 and ¯wi+1. This simple technique is realized by Algorithm 1. First, it applies weight reduction steps iteratively using edges of positive reduced weight, splitting a weight function wi into wi+1 (reduced) and ¯wi+1 (residual) and keeping the edge in a stack. When no edge with a positive reduced weight remains, the algorithm unwinds the stack and adds the edges greedily to the matching. While unwinding the stack, it maintains a set of interim solutions {xi}; the local-ratio theorem guarantees that every xi is a 2-approximate solution for wi. Finally, the algorithm returns x1, which is a 2- approximate solution for the original problem. We note that this algorithm does not work in the semi-streaming model, as the stack can easily grow to contain Ω(n2) edges. 3.2 Extending the Local-Ratio Technique We now extend the approximation techniques used in Algorithm 1. This allows us to present another sequential approximation algorithm for MWM in the following section, with a worse approximation ratio of 2 + ǫ. However, from the new algorithm we derive the desired approximation algorithm for the semi-streaming model, with no further increase in the approximation ratio. If instead of reducing exactly wi[e] from the neighboring edges of e, we reduce either wi[e] or αwi[e] from each such edge, for some α ≥ 1, we get a (2α)-approximation, as formalized by the next lemma. Lemma 3. Let wi, wi+1 and ¯wi+1 be weight functions and e ∈ E an edge such that wi[e] αw[e] or w[e] 0 e′ = e; e′ ∈ N (e); otherwise, ¯wi+1[e′] =  6 (1) and wi+1 = w − ¯wi+1; the choice between wi[e] and αwi[e] can be arbitrary. Let xi ∈ {0, 1}m be a matching. If xi[e′] 6= 0 for some e′ ∈ N +(e), then xi is a (2α)-approximate solution for ¯wi+1. i be any matching. The definition of ¯wi+1 guarantees that x∗ Proof. Let x∗ i contains at most two edges of non-zero weight in ¯wi+1, each of weight at most αwi[e], so x∗ ¯wi+1 ≤ 2αwi[e]. On the other hand, xi[e′] 6= 0 for some e′ ∈ N +(e), so wi[e] ≤ xi ¯wi+1. Using the last two inequalities, we get x∗ ¯wi+1 ≤ 2α · xi ¯wi+1, as desired. Next, we note that if the optimal solution for the reduced graph is greater than the optimal solution for the residual graph by some multiplicative factor p ≥ 1, then it is also a (1 + 1/p)- approximation for the original graph. For large values of p, an approximate solution for the reduced graph gives roughly the same approximation ratio for the original graph, which allows us to ignore the residual graph. We formalize this in the next lemma. Lemma 4. Let wi, wi+1 and ¯wi+1 be weight functions satisfying wi = wi+1 + ¯wi+1 and wi+1[e] ≤ wi[e] for all e ∈ E. Let xi+1 be a β-approximate solution for wi+1. If xi+1wi+1 is at least p times larger than any matching in ¯wi+1, then xi+1 is a (β + 1/p)- approximate solution for wi. Proof. Let x∗ i , x∗ i+1 and ¯x∗ The assumptions imply x∗ i+1 be matchings of maximum weights in wi, wi+1 and ¯wi+1 respectively. i+1wi+1 ≤ βxi+1wi+1 and p¯x∗ i+1 ¯wi+1 ≤ xi+1wi+1, so i ¯wi+1 i wi+1 + x∗ i+1wi+1 + ¯x∗ x∗ i wi = x∗ ≤ x∗ ≤ βxi+1wi+1 + (1/p)xi+1wi+1 = (β + 1/p)xi+1wi+1 ≤ (β + 1/p)xi+1wi, i+1 ¯wi+1 where the last inequality follows from the fact that wi+1[e] ≤ wi[e] for all e ∈ E. Let w1 be a weight vector for the MWM problem, and consider an iterative splitting of wi into wi+1 and ¯wi+1 for k times. The last lemma allowed us to ignore the residual graph once; we now extend it to allow the iterative omission of the residual graph. Denote α =p1 + ǫ/2, γ = n2/ ln(α), and βi = 2α(1 + 1/γ)k+1−i for all i. Lemma 5. Let G = (V, E, w1) a graph, and w2, . . . , wk+1 and ¯w2, . . . ¯wk+1 sequences of reduced and residual weight functions for (V, E), respectively. Assume that we generate a sequence of solutions xk+1, . . . , x1, such that xk+1 is an optimal solution for wk+1, and that for 1 ≤ i ≤ k, if xi+1 is a βi+1-approximate solution for wi+1 then xi has the following properties: 1. xi is a βi+1-approximate solution for wi+1. 2. At least one of the following holds: (a) xi is a βi+1-approximate solution for ¯wi+1; or (b) xiwi+1 ≥ (γ/βi+1)x∗ ¯wi+1 for every solution x∗. 7 Then x1 is a β1-approximate solution for w1. Proof. We prove, by induction on i ranging from k + 1 down to 1, that xi is a βi-approximate solution for wi. The base, i = k + 1, is trivial by the assumption on xk+1. Assume the claim is true for xi+1, then condition 1 holds for xi. If condition 2(a) holds, then by condition 1 and the local-ratio theorem (Theorem 2), xi is a βi+1-approximate solution for wi. Because βi > βi+1, xi is also a βi-approximate solution for wi. If condition 2(b) holds, then from condition 1 and Lemma 4 we deduce that xi is a (βi+1 + βi+1/γ)-approximate solution for wi. The definition of βi yields: βi+1 + βi+1/γ = (1 + 1/γ) · 2α(1 + 1/γ)k+1−(i+1) = 2α(1 + 1/γ)k+1−i = βi. Specifically, x1 is a β1-approximate solution for w1, and the proof is complete. 4 A Semi-Streaming Algorithm We present a (2+ǫ)-approximation algorithm for the MWM problem using our extension of the local- ratio technique. This algorithm is suitable for a streaming model which has no space constraints, but not for the semi-streaming model. We then present a lightweight variant of the algorithm, which obeys the space constraints of the semi-streaming model. The new algorithm is similar to Algorithm 1: it performs a series of weight reduction steps defining a series of reduced weight functions {wi}, and then constructs a series of approximate solutions {xi}. To prove the desired approximation ratio is achieved, we use Lemma 5 as a substitute for the local-ratio theorem. We start by presenting the challenges posed by the semi-streaming model, and the ways in which the new algorithm deals with them. Let ei be the edge considered in iteration i. Retroactive weight reduction The sequential algorithm constructs wi+1 from wi using an edge ei, by reducing wi(ei) form the weight of every e′ ∈ N +(ei). This cannot be done directly in the semi-streaming model, as some edges of N +(ei) might only arrive after ei is processed. Instead, the j=1 wj[ej] for every node v ∈ V . When a new edge e = (u, u′) arrives, its reduced weight is first computed, by reducing φi−1(u) and φi−1(u′) from its original weight. algorithm keeps a variable φi(v) =Pi Removing edges from the stack In the sequential algorithm, the stack may grow to hold all of the graph edges. Lemma 5 presents conditions under which an approximate solution for wi+1 is also an approximate solution for wi. When these conditions are met, we may remove the edge ei from the stack, which we use in order to make sure that the stack's size does not exceed O(n log n) edges. Assuring edge-weight growth In order to make sure edges are removed from the stack, we force a small but consistent growth in the edge weights around each node. Roughly speaking, the edge weights grow geometrically by a multiplicative α factor; after a logarithmic number of new edges considered, the weights grow large enough to allow the algorithm to neglect the older edges and remove them from the stack. 8 4.1 Algorithm MWM-seq Algorithm MWM-seq (Algorithm 2) has two phases: in the first phase, it iterates over the edges and pushes chosen edges into a stack. In the second phase, the edges are popped out of the stack and added greedily to the matching. The algorithm begins with an edge-weight function w1, given as input. For each node v, the algorithm explicitly maintains a non-negative weight function φi(v), which is used to filter edges (Line 6): an edge e = (u, u′) processed at iteration i is light if w1[e] ≤ α(φi−1(u) + φi−1(u′)), and heavy otherwise. In iteration i, the algorithm processes the incoming edges, ignoring light edges until a heavy edge is encountered. This edge, denoted by ei, is used to update wi and φi(v). Eventually, all heavy edges are denoted with sub-indexes (ei), while the light edges are left un-tagged (e). When an edge e = (u, u′) is processed in iteration i, the algorithm performs all weight reduction steps on e retroactively using φi−1(u) and φi−1(u′), to set the value of wi[e]. It decides between reducing φi−1(u) + φi−1(u′) or α(φi−1(u) + φi−1(u′)) from the weight of e, in a way that guarantees a geometric growth of φ, implying a bound on the size of the stack. For every node v, we hold a queue Ei(v). This is a list of the heavy edges containing the node v currently present in the stack. Upon the arrival of a heavy edge ei = (u, u′), we perform a weight reduction step: φi−1(u) and φi−1(u′) are increased by wi[ei], and ei is pushed into the stack. We also enqueue ei in Ei(u) and Ei(u′). If the size of Ei(u) or Ei(u′) exceeds a certain bound, we dequeue an edge from the exceeding queue, and remove it from the stack. For the sake of analysis, we do not remove edges from the stack in Algorithm 2, but only replace them by a ⊥ sign. In the second phase, the algorithm unwinds the stack, adding edges greedily to the matching while ignoring ⊥ symbols. The usage of the ⊥ symbol is replaced by deletion of the relevant edge in the semi-streaming algorithm, presented in the next subsection. We start the analysis of Algorithm MWM-seq by proving that the node-weight functions φi(v) grow geometrically with i. In the algorithm, the variable ci(v) counts the heavy edges containing v that arrive until iteration i. Its value is not used in the algorithm itself; we only use it in the proof, to bound from below the growth φ(v). In various places in the analysis we consider the expression cj(v) − ci(v), which is the number of heavy edges added to v from iteration i until iteration j. We eventually show that the reduced weights of heavy edges exhibit a growth pattern exponential in cj(v) − ci(v). Lemma 6. For every v ∈ V and j ≥ i, φj(v) ≥ αcj (v)−ci(v)φi(v). Proof. We fix i and prove the lemma by induction on j, where j ≥ i. The base case, j = i, is trivial. For j > i, we consider two cases: if v /∈ ej then cj(v) = cj−1(v), so φj(v) = φj−1(v) ≥ αcj−1(v)−ci(v) = αcj (v)−ci(v) by the induction hypothesis. 9 Algorithm 2: MWM-seq(V, E, w). A sequential approximation algorithm for MWM 1 S ← empty stack 2 w1 ← w; φ0 ← ~0; c0 ← ~0 3 ∀v ∈ V : E0(v) ← empty queue 4 i ← 1 5 foreach e = (u, u′) ∈ E do if w1[e] ≤ α(φi−1(u) + φi−1(u′)) then continue every ej ∈ N (e) ei ← e S.push(ei) wi[ei] ← w1[ei] − (φi−1(u) + φi−1(u′)) ej ∈ N +(ei) φi ← φi−1; Ei ← Ei−1; ci ← ci−1 foreach v ∈ ei do // Implicit: 6 7 8 9 10 11 12 13 14 15 16 17 18 ci(v) ← ci(v) + 1 Ei(v).enqueue(ei) φi(v) ← φi−1(v) + wi[ei] if (α − 1)αEi(v)−2 > 2αγ then ej ← Ei(v).dequeue() S[j] ← ⊥ i ← i + 1 19 k ← S 20 xk+1 ← ~0 21 for i ← k down to 1 do 22 23 24 25 xi ← xi+1 ei ← S[i] if ei = ⊥ then continue if ∀e ∈ N (ei) : xi[e] = 0 then xi[ei] ← 1 26 return x1 Otherwise, ej = (v, u) for some u ∈ V , and φj(v) = φj−1(v) + wj[ej] // ci is only used for the proof // Implicit: ¯wj+1[e] ← αwj[ej] for ¯wj+1[ei] ← wj[ej ] for every (Line 14) (Line 6) (Line 9) (induction hypothesis) (v ∈ ej implies cj(v) = cj−1(v) + 1) ≥ φj−1(v) + (α − 1)(φj−1(v) + φj−1(u)) ≥ φj−1(v) + (α − 1)φj−1(v) = αφj−1(v) ≥ α · αcj−1(v)−ci(v)φi(v) = αcj (v)−ci(v)φi(v), as desired. Consider the sequences of reduced and residual edge-weight functions, w2, . . . , wk+1 and ¯w2, . . . , ¯wk+1, 10 induced by the algorithm. Note that these weight functions are defined on the fly: when an edge e arrives, it implicitly sets wj+1(e) and ¯wj+1(e) of each of its adjacent heavy edges ej, where ej may arrive before or after e. Thus, the values of wi and ¯wi are completely determined only when the first phase ends, and so does the length k of the sequences. The weight functions are defined inductively as follows. We formally define w1 = w, where w is the function given as input. The edge ei is used to split the weight function wi into wi+1 and ¯wi+1, the latter defined by ¯wi+1[e′] = wi[ei] wi[ei] αwi[ei] 0 e′ = ei; e′ ∈ N (ei) and e′ is heavy; e′ ∈ N (ei) and e′ is light; otherwise. (2)   and the former by wi+1 = wi − ¯wi+1. The length k is the number of heavy edges encountered in the first phase. Note that ¯w is non-negative, so wi[e] is a non-increasing function of i, for any fixed edge e. The next lemma focuses on a node v and two heavy edges adjacent to it, ei and ej. It asserts that for j > i, the reduced weight at iteration i + 1 of a heavy edge ej grows geometrically with respect to wi[ei]. Lemma 7. Let ei, ej ∈ E such that j > i and ei∩ej = {v}. Then wi+1[ej] > (α−1)αcj (v)−ci(v)−1wi[ei]. Proof. The lemma follows by a simple computation. As wj[e] is a non-increasing wi+1[ej] ≥ wj[ej] ≥ (α − 1)φj−1(v) ≥ (α − 1)αcj−1(v)−ci(v)φi(v) ≥ (α − 1)αcj−1(v)−ci(v)wi[ei] = (α − 1)αcj (v)−ci(v)−1wi[ei] (Lines 6 and 9) (Lemma 6) (Line 14) (v ∈ ej implies cj−1(v) = cj(v) − 1) as desired. In the second loop of the algorithm, the edges are taken out of the stack and a solution is greedily constructed. The algorithm's approximation ratio is the approximation ratio of the solution x1 on the original weight function w1. To bound this quantity, we prove by induction that every xi is a βi-approximate solution for wi. We break our analysis into cases, for which we need the next three lemmas. First, we consider an edge ei which is evicted from the stack. Lemma 8. If xi+1 is a βi+1-approximate solution for wi+1 and the condition in Line 24 holds for ei, then xi is a βi-approximate solution for wi. Proof. Since the condition in Line 24 holds, we have xi = xi+1. This immediately guarantees that xi is a feasible solution and that condition 1 of Lemma 5 holds. We show that condition 2(b) of Lemma 5 holds as well. As the condition in Line 24 holds, we know that in some iteration j of the first phase, j > i, the condition in Line 15 held. That is, for some endpoint v of ei, an edge ej with ei ∩ ej = {v} was 11 enqueued into Ej(v), the condition (α − 1)αEj(v)−2 > 2αγ held, and ei was then dequeued from Ej(v). Every enqueue operation to Ei(v) is accompanied by an increases of ci(v) by 1, so when the con- dition in Line 15 was checked, ei and ej were the oldest and newest elements in Ej(v), respectively, and the size of Ej(v) was exactly cj(v) − ci(v) + 1. Thus, (α − 1)αcj (v)−ci(v)−1 ≥ 2αγ. Using this inequality and Lemma 7, we have wi+1[ej] ≥ (α − 1)αcj (v)−ci(v)−1wi[ei] ≥ 2αγwi[ei]. Hence, the single edge ej is a matching of weight at least 2αγwi[ei] in wi+1. As xi+1 is a βi+1- approximate solution for wi+1, we have βi+1xi+1wi+1 ≥ 2αγwi[ei]. The definition of ¯wi+1 guarantees it has the following structure: wi[ei] αwi[ei] or wi[ei] 0 e′ = ei; e′ ∈ N (ei); otherwise. (3) ¯wi+1[e′] =  Thus, any solution x∗ for ¯wi+1 contains at most two edges, of weight at most αwi[ei], i.e. 2αwi[ei] ≥ x∗ ¯wi+1. The last two inequalities guarantee any solution x∗ satisfies (βi+1/γ)xi+1wi+1 ≥ 2αwi[ei] ≥ x∗ ¯wi+1 so xiwi+1 = xi+1wi+1 ≥ (γ/βi+1)x∗ ¯wi+1, and condition 2(b) of Lemma 5 holds. We now turn to the case of an edge ei that is not evicted from the stack. Lemma 9. If xi+1 is a βi+1-approximation for wi+1 and the condition on Line 24 does not hold for ei, then xi is a βi-approximation for wi. Proof. If the condition on Line 25 holds, then xi is derived from xi+1 by adding ei to xi+1. The condition in this line, together with the assumption that xi+1 is a matching, guarantee that xi is a matching. Since ¯wi+1[ei] = wi[ei] and wi+1 = wi − ¯wi+1, we have wi+1[ei] = 0. Hence, xiwi+1 = xi+1wi+1, so xi is also a βi+1-approximate solution for wi+1 and condition 1 of Lemma 5 holds. By Lemma 3, xi is a (2α)-approximate solution for ¯wi+1, and because 2α ≤ βi+1 it is also a βi+1-approximate solution to ¯wi+1 and condition 2(a) of Lemma 5 holds. Finally, if the condition in Line 25 does not hold, we set xi = xi+1. Then xi is a feasible matching satisfying condition 1 of Lemma 5. The condition in Line 25 does not hold, so xi+1[e′] 6= 0 for some e′ ∈ N +[ei], and Lemma 3 promises xi is a (2α)-approximation for ¯wi+1. As before, 2α ≤ βi+1 proves that condition 2(a) of Lemma 5 holds. Finally, we show that when the first phase ends, none of the reduced edge weights is positive. Lemma 10. At the end of the first phase, wk+1[e] ≤ 0 for all e ∈ E. Proof. Consider an edge e. If e = ei is heavy then ¯wi+1[ei] = wi[ei] and wi+1 = wi − ¯wi+1 imply wi+1[ei] = 0. The monotonicity of wi[e] completes the proof. If e = (u, u′) is a light edge considered in iteration i, then w1[e] ≤ α(φi−1(u)+φi−1(u′)). Line 14 guarantees φi−1(u) = Xnej(cid:12)(cid:12)(cid:12) u∈ej j≤i−1o wj[ej ], 12 and a similar claim holds for u′. On the other hand, wj+1 = wj − ¯wj+1 and ¯wj+1[e] = αwj[ej] for all ej ∈ N (e). Hence wj+1[e] = wj[e] − αwj [ej], and a simple induction implies wi[e] = w1[e] − α X(cid:26)ej(cid:12)(cid:12)(cid:12)(cid:12) ej∈N (e) j≤i−1 (cid:27) wj[ej]. The last two equalities, together with the definition of N (e), imply wi[e] = w1[e] − α(φi−1(u) + φi−1(u′)). The inequality w1[e] ≤ α(φi−1(u) + φi−1(u′)) implies wi[e] ≤ 0 for all e ∈ E, and the monotonicity of wi[e] completes the proof. We are now ready to prove the main theorem of this section. Theorem 11. Algorithm MWM-seq returns a (2 + ǫ)-approximation for the MWM problem. Proof. By Lemma 10, the first loop ends when wk+1 ≤ ~0, so xk+1 = ~0 is indeed an optimal solution for wk+1. Assume xi+1 is a βi+1-approximate solution for wi+1. From Lemmas 8 and 9 we conclude that in all cases the conditions of Lemma 5 hold, so x1 is a β1-approximate solution for w = w1. Substitute β1 = 2α(1 + 1/γ)k, α =p1 + ǫ/2 and γ = n2/ ln(α), and note k ≤ m ≤ n2, to get β1 ≤ 2α(1 + 1/γ)n2 = 2α(cid:0)1 + (ln α)/n2(cid:1)n2 ≤ 2αeln α = 2 + ǫ. The desired approximation ratio is achieved. 4.2 Implementing Algorithm MWM-seq in the Semi-Streaming Model In the previous section we showed that Algorithm MWM-seq computes a (2 + ǫ)-approximation for MWM. In the semi-streaming model, we must obey space constraints in addition to maintaining a good approximation ratio. In the presentation of the sequential algorithm we ignored the space constrains: we did not remove edges from the stack, and we represented the temporary solutions as the vectors xi of size Θ(n2). In order to follow the space constraints, we replace any insertion of ⊥ into the stack by a removal of the relevant edge, and the vectors xi by a single set containing the current matching. For the sake of completeness, we present Algorithm MWM-semi (Algorithm 3), an implementation of Algorithm MWM-seq in the semi-streaming model. The correctness of Algorithm MWM-semi is derived directly from the correctness of Algorithm MWM-seq, so we only need to prove it obeys the space constraints. After omitting notations and auxiliary variables from Algorithm MWM-seq, we are left only with three types of data structures in Algorithm MWM-semi: M is the matching constructed, S is the stack and E(v) is a queue of edges from S that contain node v. Every edge (u, u′) that is added to S is also added to E(u) and E(u′). When (u, u′) is removed from E(u) or from E(u′), it is also removed from S, implying S ≤Pv E(v). The next lemma bounds the size of E(v) for every v. (cid:17) for each Lemma 12. During the execution of Algorithm MWM-semi, E(v) = O(cid:16) log n+log(1/ǫ) v ∈ V . ǫ 13 Algorithm 3: MWM-semi(V, E, w). A Semi-Streaming approximation algorithm for MWM 1 S ← empty stack 2 φ ← ~0 3 ∀v ∈ V : E(v) ← empty queue 4 foreach e = (u, u′) ∈ E do 5 6 7 8 9 10 11 12 13 if w[e] ≤ α(φ(u) + φ(u′)) then continue S.push(e) w′[e] ← w[e] − (φ(u) + φ(u′)) foreach v ∈ e do E(v).enqueue(e) φ(v) ← φ(v) + w′[e] if (α − 1)αE(v)−2 > 2αγ then e′ ← E(v).dequeue() remove e′ from S 14 M ← ∅ 15 while S 6= ∅ do e ← S.pop() if M ∩ N (e) = ∅ then M ← M ∪ {e} 16 17 18 return M Proof. After each iteration of the loop in Lines 4 -- 13, we have (α − 1)αE(v)−2 ≤ 2αγ for each v ∈ V : this is true at the beginning; E(v) can grow only by 1 at each iteration; and whenever the inequality does not hold, an edge is removed from E(v). From the above inequality, α = p1 + ǫ/2, and γ = n2/ ln(α), we derive an asymptotic bound on E(v). + 2 log 2αγ α−1 log α log 2n2α2 (α−1)2 log α + 2 (ln α > α−1 α for α > 1) E(v) ≤ ≤ = log(2n2) + 2 log α − 2 log(α − 1) + 2 log α log(2n2) − 2 log(ǫ/6) ǫ ≤ 6 + 4 (α − 1 > ǫ/6 and log α > ǫ/6 for 0 < ǫ < 6) = O(cid:18) log n + log(1/ǫ) ǫ (cid:19) as desired. From Lemma 12 we conclude that, for a constant ǫ, Algorithm MWM-semi maintains at most O(n log n) edges, each represented by O(log n) bits, giving a total space of O(n log2 n) bits. Our algorithm requires O(1) time to process a new edge arriving from the stream, and O(n log n) time 14 for the post-processing step. A similar analysis, without assuming ǫ is constant, implies the main theorem of this paper. Theorem 1 There exists an algorithm in the semi-streaming model computing a (2+ǫ)-approximation for MWM, using O(ǫ−1n log n · (log n + log(1/ǫ))) bits and having an O(1) processing time. In our analysis we assume that the edge weights can be represented using O(log n) bits, which is the case, e.g., for integer edge weights bounded by a polynomial in n. If this is not the case, and the weights are integers bounded by some W , our algorithm requires O(n(log2 n + log W )) bits, as it keeps a sum of weights for every node, and does not keep edge weights at all. Acknowledgments We thank Keren Censor-Hillel and Seri Khoury for helpful discussions, Seffi Naor for useful comments on the presentation, and the anonymous referees of SODA 2017 and ACM TALG for their comments. References [AKL17] Sepehr Assadi, Sanjeev Khanna, and Yang Li. On estimating maximum matching size in graph streams. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1723 -- 1742, 2017. [AKLY16] Sepehr Assadi, Sanjeev Khanna, Yang Li, and Grigory Yaroslavtsev. Maximum match- ings in dynamic graph streams and the simultaneous communication model. In ACM- SIAM Symposium on Discrete Algorithms (SODA), pages 1345 -- 1364, 2016. [BBF+01] Amotz Bar-Noy, Reuven Bar-Yehuda, Ari Freund, Joseph Naor, and Baruch Schieber. A unified approach to approximating resource allocation and scheduling. J. ACM, 48(5):1069 -- 1090, 2001. [BBFR04] Reuven Bar-Yehuda, Keren Bendel, Ari Freund, and Dror Rawitz. Local ratio: A unified framework for approxmation algrithms. In memoriam: Shimon Even 1935-2004. ACM Comput. Surv., 36(4):422 -- 463, 2004. Marc Bury and Chris Schwiegelshohn. Sublinear estimation of weighted matchings in dynamic data streams. In Algorithms - ESA 2015 - 23rd Annual European Symposium, pages 263 -- 274, 2015. [BS15] [BYE85] Reuven Bar-Yehuda and Shimon Even. A local-ratio theorem for approximating the weighted vertex cover problem. North-Holland Mathematics Studies, 109:27 -- 45, 1985. [CCE+16] Rajesh Chitnis, Graham Cormode, Hossein Esfandiari, MohammadTaghi Hajiaghayi, Andrew McGregor, Morteza Monemizadeh, and Sofya Vorotnikova. Kernelization via sampling with applications to finding matchings and related problems in dynamic graph streams. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1326 -- 1344, 2016. Amit Chakrabarti and Sagar Kale. Submodular maximization meets streaming: Match- ings, matroids, and more. In Integer Programming and Combinatorial Optimization - 17th International Conference, (IPCO), pages 210 -- 221, 2014. [CK14] [CMS13] Michael S. Crouch, Andrew McGregor, and Daniel Stubbs. Dynamic graphs in the sliding-window model. In Algorithms - ESA 2013 - 21st Annual European Symposium, pages 337 -- 348, 2013. 15 [CS14] Improved streaming algorithms for weighted Michael Crouch and Daniel S. Stubbs. matching, via unweighted matching. In Approximation, Randomization, and Combina- torial Optimization. Algorithms and Techniques (APPROX/RANDOM), pages 96 -- 104, 2014. Jack Edmonds. Paths, trees, and flowers. Canad. J. Math., 17:449 -- 467, 1965. [Edm65] [ELMS11] Leah Epstein, Asaf Levin, Juli´an Mestre, and Danny Segev. Improved approximation guarantees for weighted matching in the semi-streaming model. SIAM J. Discrete Math., 25(3):1251 -- 1265, 2011. [FKM+05] Joan Feigenbaum, Sampath Kannan, Andrew McGregor, Siddharth Suri, and Jian Zhang. On graph problems in a semi-streaming model. Theor. Comput. Sci., 348(2- 3):207 -- 216, 2005. [GKK12] Ashish Goel, Michael Kapralov, and Sanjeev Khanna. On the communication and streaming complexity of maximum bipartite matching. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 468 -- 485, 2012. [GMZ16] Elena Grigorescu, Morteza Monemizadeh, and Samson Zhou. Streaming weighted matchings: Optimal meets greedy. CoRR, abs/1608.01487, 2016. [GW18] Mohsen Ghaffari and David Wajc. Simplified and space-optimal semi-streaming for (2 + ǫ)-approximate matching. CoRR, abs/1701.03730, 2018. [Kap13] Michael Kapralov. Better bounds for matchings in the streaming model. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1679 -- 1697, 2013. [KKS14] Michael Kapralov, Sanjeev Khanna, and Madhu Sudan. Approximating matching size In ACM-SIAM Symposium on Discrete Algorithms (SODA), from random streams. pages 734 -- 751, 2014. Christian Konrad. Maximum matching in turnstile streams. In Algorithms - ESA 2015 - 23rd Annual European Symposium, pages 840 -- 852, 2015. [Kon15] [LMSV11] Silvio Lattanzi, Benjamin Moseley, Siddharth Suri, and Sergei Vassilvitskii. Filtering: a method for solving graph problems in mapreduce. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pages 85 -- 94, 2011. [McG05] Andrew McGregor. Finding graph matchings in data streams. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (AP- PROX/RANDOM), pages 170 -- 181, 2005. [MV80] [PS17] [Var11] [Zel12] S. Micali and V. V. Vazirani. An O(pV ·E) algoithm for finding maximum matching in general graphs. In Foundations of Computer Science, 1980, pages 17 -- 27, Oct 1980. Ami Paz and Gregory Schwartzman. A (2 + ǫ)-approximation for maximum weight matching in the semi-streaming model. In ACM-SIAM Symposium on Discrete Algo- rithms (SODA), pages 2153 -- 2161, 2017. Ashwinkumar Badanidiyuru Varadaraja. Buyback problem - approximate matroid in- tersection with cancellation costs. In Automata, Languages and Programming - 38th International Colloquium (ICALP), pages 379 -- 390, 2011. Mariano Zelke. Weighted matching in the semi-streaming model. Algorithmica, 62(1- 2):1 -- 20, 2012. 16
1211.2664
2
1211
2015-01-16T18:23:16
Testing probability distributions using conditional samples
[ "cs.DS", "cs.CC", "math.PR", "math.ST", "math.ST" ]
We study a new framework for property testing of probability distributions, by considering distribution testing algorithms that have access to a conditional sampling oracle.* This is an oracle that takes as input a subset $S \subseteq [N]$ of the domain $[N]$ of the unknown probability distribution $D$ and returns a draw from the conditional probability distribution $D$ restricted to $S$. This new model allows considerable flexibility in the design of distribution testing algorithms; in particular, testing algorithms in this model can be adaptive. We study a wide range of natural distribution testing problems in this new framework and some of its variants, giving both upper and lower bounds on query complexity. These problems include testing whether $D$ is the uniform distribution $\mathcal{U}$; testing whether $D = D^\ast$ for an explicitly provided $D^\ast$; testing whether two unknown distributions $D_1$ and $D_2$ are equivalent; and estimating the variation distance between $D$ and the uniform distribution. At a high level our main finding is that the new "conditional sampling" framework we consider is a powerful one: while all the problems mentioned above have $\Omega(\sqrt{N})$ sample complexity in the standard model (and in some cases the complexity must be almost linear in $N$), we give $\mathrm{poly}(\log N, 1/\varepsilon)$-query algorithms (and in some cases $\mathrm{poly}(1/\varepsilon)$-query algorithms independent of $N$) for all these problems in our conditional sampling setting. *Independently from our work, Chakraborty et al. also considered this framework. We discuss their work in Subsection [1.4].
cs.DS
cs
Testing probability distributions using conditional samples Cl´ement L. Canonne∗ Dana Ron† Rocco A. Servedio‡ January 19, 2015 Abstract We study a new framework for property testing of probability distributions, by considering distribution testing algorithms that have access to a conditional sampling oracle. This is an oracle that takes as input a subset S ⊆ [N ] of the domain [N ] of the unknown probability distribution D and returns a draw from the conditional probability distribution D restricted to S. This new model allows considerable flexibility in the design of distribution testing algorithms; in particular, testing algorithms in this model can be adaptive. We study a wide range of natural distribution testing problems in this new framework and some of its variants, giving both upper and lower bounds on query complexity. These prob- lems include testing whether D is the uniform distribution U; testing whether D = D∗ for an explicitly provided D∗; testing whether two unknown distributions D1 and D2 are equivalent; and estimating the variation distance between D and the uniform distribution. At a high level our main finding is that the new conditional sampling framework we consider is a powerful one: while all the problems mentioned above have Ω(√N ) sample complexity in the standard model (and in some cases the complexity must be almost linear in N ), we give poly(log N, 1/ǫ)- query algorithms (and in some cases poly(1/ǫ)-query algorithms independent of N ) for all these problems in our conditional sampling setting. 5 1 0 2 n a J 6 1 ] S D . s c [ 2 v 4 6 6 2 . 1 1 2 1 : v i X r a ∗[email protected], Columbia University. Supported by NSF grants CCF-1115703 and CCF-1319788. †[email protected], Tel Aviv University. Supported by ISF grants 246/08 and 671/13. ‡[email protected], Columbia University. Supported by NSF grants CCF-0915929 and CCF-1115703. 0 Contents 1 Introduction 1.1 Background: Distribution testing in the standard model . . . . . . . . . . . . . . . . 1.2 The conditional sampling model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Our results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 The work of Chakraborty et al. [CFGM13] . . . . . . . . . . . . . . . . . . . . . . . . 2 Preliminaries 2 2 3 4 8 10 2.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2 Useful tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3 Some useful procedures 12 3.1 The procedure Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2 The procedure Estimate-Neighborhood . . . . . . . . . . . . . . . . . . . . . . . 14 3.3 The procedure Approx-Eval-Simulator . . . . . . . . . . . . . . . . . . . . . . . . 16 4 Algorithms and lower bounds for testing uniformity 27 4.1 A O(1/ǫ2)-query PCOND algorithm for testing uniformity . . . . . . . . . . . . . . . 27 4.2 An Ω(1/ǫ2) lower bound for CONDD algorithms that test uniformity . . . . . . . . . 31 5 Testing equivalence to a known distribution D∗ 33 5.1 A poly(log n, 1/ǫ)-query PCONDD algorithm . . . . . . . . . . . . . . . . . . . . . . . 33 5.2 A (log N )Ω(1) lower bound for PCONDD . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.3 A poly(1/ǫ)-query CONDD algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6 Testing equality between two unknown distributions 51 6.1 An approach based on PCOND queries . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.2 An approach based on simulating EVAL . . . . . . . . . . . . . . . . . . . . . . . . . 57 7 An algorithm for estimating the distance to uniformity 59 7.1 Finding a reference point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 8 A O(cid:16) log3 N ǫ3 (cid:17)-query ICONDD algorithm for testing uniformity 9 An Ω(log N/ log log N ) lower bound for ICONDD algorithms that test uniformity 65 68 9.1 A lower bound against non-adaptive algorithms . . . . . . . . . . . . . . . . . . . . 70 9.2 A lower bound against adaptive algorithms: Outline of the proof of Theorem 16 . . . 75 9.3 Extended transcripts and drawing D ∼ PNo on the fly. . . . . . . . . . . . . . . . . . 76 (cid:17) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 9.4 Bounding dTV(cid:16)A (k),N otf , A (k+1),N otf 10 Conclusion 1 84 1 Introduction 1.1 Background: Distribution testing in the standard model One of the most fundamental problem paradigms in statistics is that of inferring some information about an unknown probability distribution D given access to independent samples drawn from it. More than a decade ago, Batu et al. [BFR+00]1 initiated the study of problems of this type from within the framework of property testing [RS96, GGR98]. In a property testing problem there is an unknown “massive object” that an algorithm can access only by making a small number of local inspections of the object, and the goal is to determine whether the object has a particular property. The algorithm must output ACCEPT if the object has the desired property and output REJECT if the object is far from every object with the property. (See [Fis01, Ron08, Ron10, Gol10] for detailed surveys and overviews of the broad field of property testing; we give precise definitions tailored to our setting in Section 2.) In distribution property testing the “massive object” is an unknown probability distribution D over an N -element set, and the algorithm accesses the distribution by drawing independent samples from it. A wide range of different properties of probability distributions have been investigated in this setting, and upper and lower bounds on the number of samples required have by now been obtained for many problems. These include testing whether D is uniform [GR00, BFR+10, Pan08], testing whether D is identical to a given known distribution D∗ [BFF+01], testing whether two distributions D1, D2 (both available via sample access) are identical [BFR+00, Val11], and testing whether D has a monotonically increasing probability mass function [BFRV11], as well as related problems such as estimating the entropy of D [BDKR05, VV11], and estimating its support size [RRSS09, Val11, VV11]. Similar problems have also been studied by researchers in other communities, see e.g., [Ma81, Pan04, Pan08]. One broad insight that has emerged from this past decade of work is that while sublinear-sample algorithms do exist for many distribution testing problems, the number of samples required is in general quite large. Even the basic problem of testing whether D is the uniform distribution U over [N ] = {1, . . . , N} versus ǫ-far from uniform requires Ω(√N ) samples2 for constant ǫ, and the other problems mentioned above have sample complexities at least this high, and in some cases almost linear in N [RRSS09, Val11, VV11]. Since such sample complexities could be prohibitively high in real-world settings where N can be extremely large, it is natural to explore problem variants where it may be possible for algorithms to succeed using fewer samples. Indeed, researchers have studied distribution testing in settings where the unknown distribution is guaranteed to have some special structure, such as being monotone, k-modal or a “k-histogram” over [N ] [BKR04, DDS+13, ILR12], or being monotone over {0, 1}n [RS09] or over other posets [BFRV11], and have obtained significantly more sample-efficient algorithms using these additional assumptions. 1There is a more recent full version of this work [BFR+10] and we henceforth reference this recent version. 2To verify this, consider the family of all distributions that are uniform over half of the domain, and 0 elsewhere. Each distribution in this family is Θ(1)-far from the uniform distribution. However, it is not possible to distinguish with sufficiently high probability between the uniform distribution and a distribution selected randomly from this family, given a sample of size √N /c (for a sufficiently large constant c > 1). This is the case because for the uniform distribution as well as each distribution in this family, the probability of observing the same element more than once is very small. Conditioned on such a collision event not occurring, the samples are distributed identically. 2 1.2 The conditional sampling model In this work we pursue a different line of investigation: rather than restricting the class of probability distributions under consideration, we consider testing algorithms that may use a more powerful form of access to the unknown distribution D. This is a conditional sampling oracle, which allows the algorithm to obtain a draw from DS, the conditional distribution of D restricted to a subset S of the domain (where S is specified by the algorithm). More precisely, we have: Definition 1 Fix a distribution D over [N ]. A COND oracle for D, denoted CONDD, is defined as follows: The oracle is given as input a query set S ⊆ [N ] , chosen by the algorithm, that has D(S) > 0. The oracle returns an element i ∈ S, where the probability that element i is returned is DS(i) = D(i)/D(S), independently of all previous calls to the oracle.3 As mentioned earlier, a recent work of Chakraborty et al. [CFGM13] introduced a very similar conditional model; we discuss their results and how they relate to our results in Subsection 1.4. For compatibility with our CONDD notation we will write SAMPD to denote an oracle that takes no input and, each time it is invoked, returns an element from [N ] drawn according to D independently from all previous draws. This is the sample access to D that is used in the standard model of testing distributions, and this is of course the same as a call to CONDD([N ]). Motivation and Discussion. One purely theoretical motivation for the study of the COND model is that it may further our understanding regarding what forms of information (beyond standard sampling) can be helpful for testing properties of distributions. In both learning and property testing it is generally interesting to understand how much power algorithms can gain by making queries, and COND queries are a natural type of query to investigate in the context of distributions. As we discuss in more detail below, in several of our results we actually consider restricted versions of COND queries that do not require the full power of obtaining conditional samples from arbitrary sets. A second attractive feature of the COND model is that it enables a new level of richness for algorithms that deal with probability distributions. In the standard model where only access to SAMPD is provided, all algorithms must necessarily be non-adaptive, with the same initial step of simply drawing a sample of points from SAMPD, and the difference between two algorithms comes only from how they process their samples. In contrast, the essence of the COND model is to allow algorithms to adaptively determine later query sets S based on the outcomes of earlier queries. A natural question about the COND model is its plausibility: are there settings in which an investigator could actually make conditional samples from a distribution of interest? We feel that the COND framework provides a reasonable first approximation for scenarios that arise in application areas (e.g., in biology or chemistry) where the parameters of an experiment can be 3Note that as described above the behavior of CONDD(S) is undefined if D(S) = 0, i.e., the set S has zero probability under D. While various definitional choices could be made to deal with this, we shall assume that in such a case, the oracle (and hence the algorithm) outputs “failure” and terminates. This will not be a problem for us throughout this paper, as (a) our lower bounds deal only with distributions that have D(i) > 0 for all i ∈ [N ], and (b) in our algorithms CONDD(S) will only ever be called on sets S which are “guaranteed” to have D(S) > 0. (More precisely, each time an algorithm calls CONDD(S) it will either be on the set S = [N ], or will be on a set S which contains an element i which has been returned as the output of an earlier call to CONDD.) 3 adjusted so as to restrict the range of possible outcomes. For example, a scientist growing bacteria or yeast cells in a controlled environment may be able to deliberately introduce environmental factors that allow only cells with certain desired characteristics to survive, thus restricting the distribution of all experimental outcomes to a pre-specified subset. We further note that techniques which are broadly reminiscent of COND sampling have long been employed in statistics and polling [Wik13, Ney34]). We thus feel that the design under the name of “stratified sampling” (see e.g. study of distribution testing in the COND model is well motivated both by theoretical and practical considerations. Given the above motivations, the central question is whether the COND model enables signif- icantly more efficient algorithms than are possible in the weaker SAMP model. Our results (see Subsection 1.3) show that this is indeed the case. Before detailing our results, we note that several of them will in fact deal with a weaker variant of the COND model, which we now describe. In designing COND-model algorithms it is obviously desirable to have algorithms that only invoke the COND oracle on query sets S which are “simple” in some sense. Of course there are many possible notions of simplicity; in this work we consider the size of a set as a measure of its simplicity, and consider algorithms which only query small sets. More precisely, we consider the following restriction of the general COND model: PCOND oracle: We define a PCOND (short for “pair-cond”) oracle for D is a restricted version of CONDD that only accepts input sets S which are either S = [N ] (thus providing the power of a SAMPD oracle) or S = {i, j} for some i, j ∈ [N ], i.e. sets of size two. The PCOND oracle may be viewed as a minimalist variant of COND that essentially permits an algorithm to compare the relative weights of two items under D (and to draw random samples from D, by setting S = [N ]). ICOND oracle: We define an ICOND (short for “interval-cond”) oracle for D as a restricted version of CONDD that only accepts input sets S which are intervals S = [a, b] = {a, a + 1, . . . , b} for some a ≤ b ∈ [N ] (note that taking a = 1, b = N this provides the power of a SAMPD oracle). This is a natural restriction on COND queries in settings where the N points are endowed with a total order. To motivate the PCOND model (which essentially gives the ability to compare two elements), one may consider a setting in which a human domain expert can provide an estimate of the relative likelihood of two distinct outcomes in a limited-information prediction scenario. 1.3 Our results We give a detailed study of a range of natural distribution testing problems in the COND model and its variants described above, establishing both upper and lower bounds on their query complexity. Our results show that the ability to do conditional sampling provides a significant amount of power to property testers, enabling polylog(N )-query, or even constant-query, algorithms for problems whose sample complexities in the standard model are N Ω(1); see Table 1. While we have considered a variety of distribution testing problems in the COND model, our results are certainly not exhaustive, and many directions remain to be explored; we discuss some of these in Section 10. 4 Is D uniform? Is D = D∗ for a known D∗? CONDD PCONDD ICONDD CONDD PCONDD Are D1, D2 (both unknown) equivalent? CONDD1,D2 PCONDD1,D2 How far is D from uniform? PCONDD ǫ2(cid:1) Ω(cid:0) 1 ǫ2(cid:1) O(cid:0) 1 ǫ3 (cid:17) O(cid:16) log3 N Ω(cid:16) log N log log N(cid:17) ǫ4(cid:1) O(cid:0) 1 ǫ4 (cid:17) O(cid:16) log4 N Ω(cid:16)q log N log log N(cid:17) ǫ4 (cid:17) O(cid:16) log5 N ǫ21 (cid:17) O(cid:16) log6 N O(cid:0) 1 ǫ20(cid:1) ǫ2 (cid:17) [BFF+01, Pan08, VV14] Θ(cid:16)√N Θ(cid:16)max(cid:16) N 2/3 log N(cid:17) [VV11, VV10b] O(cid:16) 1 Ω(cid:16) N log N(cid:17) [VV11, VV10a] [BFR+10, Val11, CDVV14] ǫ4/3 , √N ǫ2 (cid:17)(cid:17) N ǫ2 Problem Our results Standard model Θ(cid:16)√N ǫ2 (cid:17) [GR00, BFR+10, Pan08] Table 1: Comparison between the COND model and the standard model on a variety of distribution testing problems over [N ]. The upper bounds for the first three problems are for testing whether the property holds (i.e. dTV = 0) versus dTV ≥ ǫ, and for the last problem the upper bound is for estimating the distance to uniformity to within an additive ±ǫ. 1.3.1 Testing distributions over unstructured domains In this early work on the COND model our main focus has been on the simplest (and, we think, most fundamental) problems in distribution testing, such as testing whether D is the uniform distribution U ; testing whether D = D∗ for an explicitly provided D∗; testing whether D1 = D2 given CONDD1 and CONDD2 oracles; and estimating the variation distance between D and the uniform distribution. In what follows dTV denotes the variation distance. Testing uniformity. We give a PCONDD algorithm that tests whether D = U versus dTV(D,U ) ≥ ǫ using O(1/ǫ2) calls to PCONDD, independent of N . We show that this PCONDD algorithm is nearly optimal by proving that any CONDD tester (which may use arbitrary subsets S ⊆ [N ] as its query sets) requires Ω(1/ǫ2) queries for this testing problem. Testing equivalence to a known distribution. As described above, for the simple problem of testing uniformity we have an essentially optimal PCOND testing algorithm and a matching lower bound. A more general and challenging problem is that of testing whether D (accessible via a PCOND or COND oracle) is equivalent to D∗, where D∗ is an arbitrary “known” distribution over [N ] that is explicitly provided to the testing algorithm at no cost (say as a vector (D∗(1), . . . , D∗(N )) of probability values). For this “known D∗” problem, we give a PCONDD algorithm testing whether D = D∗ versus dTV(D, D∗) ≥ ǫ using O((log N )4/ǫ4) queries. We further show that the (log N )Ω(1) query complexity of our PCONDD algorithm is inherent in the problem, by proving that any PCONDD algorithm for this problem must useplog(N )/ log log(N ) queries for constant ǫ. 5 Given these (log N )Θ(1) upper and lower bounds on the query complexity of PCONDD-testing equivalence to a known distribution, it is natural to ask whether the full CONDD oracle provides more power for this problem. We show that this is indeed the case, by giving a O(1/ǫ4)-query algorithm (independent of N ) that uses unrestricted CONDD queries. Testing equivalence between two unknown distributions. We next consider the more challenging problem of testing whether two unknown distributions D1, D2 over [N ] (available via CONDD1 and CONDD2 oracles) are identical versus ǫ-far. We give two very different algorithms for this problem. The first uses PCOND oracles and has query complexity O((log N )6/ǫ21), while the second uses COND oracles and has query complexity O((log N )5/ǫ4). We believe that the proof technique of the second algorithm is of independent interest, since it shows how a CONDD oracle can efficiently simulate an “approximate EVALD oracle.” (An EVALD oracle takes as input a point i ∈ [N ] and outputs the probability mass D(i) that D puts on i; we briefly explain our notion of approximating such an oracle in Subsection 1.3.3.) Estimating the distance to uniformity. We also consider the problem of estimating the varia- tion distance between D and the uniform distribution U over [N ], to within an additive error of ±ǫ. In the standard SAMPD model this is known to be a very difficult problem, with an Ω(N/ log N ) lower bound established in [VV11, VV10a]. In contrast, we give a PCONDD algorithm that makes only O(1/ǫ20) queries, independent of N . 1.3.2 Testing distributions over structured domains In the final portion of the paper we view the domain [N ] as an ordered set 1 ≤ ··· ≤ N . (Note that in all the testing problems and results described previously, the domain could just as well have been viewed as an unstructured set of abstract points x1, . . . , xN .) With this perspective it is natural to consider an additional oracle. We define an ICOND (short for “interval-cond”) oracle for D as a restricted version of CONDD, which only accepts input sets S that are intervals S = [a, b] = {a, a + 1, . . . , b} for some a ≤ b ∈ [N ] (note that taking a = 1, b = N this provides the power of a SAMPD oracle). We give an O((log N )3/ǫ3)-query ICONDD algorithm for testing whether D is uniform versus ǫ-far from uniform. We show that a (log N )Ω(1) query complexity is inherent for uniformity testing using ICONDD, by proving an Ω (log N/ log log N )-query ICONDD lower bound. Along the way to establishing our main testing results described above, we develop several powerful tools for analyzing distributions in the COND and PCOND models, which we believe may be of independent interest and utility in subsequent work on the COND and PCOND models. These include as mentioned above a procedure for approximately simulating an “evaluation oracle”, as well as a procedure for estimating the weight of the “neighborhood” of a given point in the domain of the distribution. (See further discussion of these tools in Subsection 1.3.3.) 1.3.3 A high-level discussion of our algorithms To maintain focus here we describe only the ideas behind our algorithms; intuition for each of our lower bounds can be found in an informal discussion preceding the formal proof, see the beginnings 6 of Sections 4.2, 5.2, and 9. As can be seen in the following discussion, our algorithms share some common themes, though each has its own unique idea/technique, which we emphasize below. Our simplest testing algorithm is the algorithm for testing whether D is uniform over [N ] (using PCONDD queries). The algorithm is based on the observation that if a distribution is ǫ-far from uniform, then the total weight (according to D) of points y ∈ [N ] for which D(y) ≥ (1+Ω(ǫ))/N is Ω(ǫ), and the fraction of points x ∈ [N ] for which D(x) ≤ (1−Ω(ǫ))/N is Ω(ǫ). If we obtain such a pair of points (x, y), then we can detect this deviation from uniformity by performing Θ(1/ǫ2) PCONDD queries on the pair. Such a pair can be obtained with high probability by making Θ(1/ǫ) SAMPD queries (so as to obtain y) as well as selecting Θ(1/ǫ) points uniformly (so as to obtain x). This approach yields an algorithm whose complexity grows like 1/ǫ4. To actually get an algorithm with query complexity O(1/ǫ2) (which, as our lower bound shows, is tight), a slightly more refined approach is applied. When we take the next step to testing equality to an arbitrary (but fully specified) distribution D∗, the abovementioned observation generalizes so as to imply that if we sample Θ(1/ǫ) points from D and Θ(1/ǫ) from D∗, then with high probability we shall obtain a pair of points (x, y) such that D(x)/D(y) differs by at least (1 ± Ω(ǫ)) from D∗(x)/D∗(y). Unfortunately, this cannot necessarily be detected by a small number of PCONDD queries since (as opposed to the uniform case), D∗(x)/D∗(y) may be very large or very small. However, we show that by sampling from both D and D∗ and allowing the number of samples to grow with log N , with high probability we either obtain a pair of points as described above for which D∗(x)/D∗(y) is a constant, or we detect that for some set of points B we have that D(B) − D∗(B) is relatively large.4 As noted previously, we prove a lower bound showing that a polynomial dependence on log N is unavoidable if only PCONDD queries (in addition to standard sampling) are allowed. To obtain our more efficient poly(1/ǫ)-queries algorithm, which uses more general CONDD queries, we extend the observation from the uniform case in a different way. Specifically, rather than comparing the relative weight of pairs of points, we compare the relative weight of pairs in which one element is a point and the other is a subset of points. Roughly speaking, we show how points can be paired with subsets of points of comparable weight (according to D∗) such that the following holds. If D is far from D∗, then by taking O(1/ǫ) samples from D and selecting subsets of points in an appropriate manner (depending on D∗), we can obtain (with high probability) a point x and a subset Y such that D(x)/D(Y ) differs significantly from D∗(x)/D∗(Y ) and D∗(x)/D∗(Y ) is a constant. In our next step, to testing equality between two unknown distributions D1 and D2, we need to cope with the fact that we no longer “have a hold” on a known distribution. Our PCOND algorithm can be viewed as creating such a hold in the following sense. By sampling from D1 we obtain (with high probability) a (relatively small) set of points R that cover the distribution D1. By “covering” we mean that except for a subset having small weight according to D1, all points y in [N ] have a representative r ∈ R, i.e. a point r such that D1(y) is close to D1(r). We then show that if D2 is far from D1, then one of the following must hold: (1) There is relatively large weight, either according to D1 or according to D2, on points y such that for some r ∈ R we have that D1(y) is close to D1(r) but D2(y) is not sufficiently close to D2(r); (2) There exists a point 4Here we use B for “Bucket”, as we consider a bucketing of the points in [N ] based on their weight according to D∗. We note that bucketing has been used extensively in the context of testing properties of distributions, see e.g. [BFR+10, BFF+01]. 7 r ∈ R such that the set of points y for which D1(y) is close to D1(r) has significantly different weight according to D2 as compared to D1. We note that this algorithm can be viewed as a variant of the PCOND algorithm for the case when one of the distributions is known (where the “buckets” B, which were defined by D∗ in that algorithm (and were disjoint), are now defined by the points in R (and are not necessarily disjoint)). As noted previously, our (general) COND algorithm for testing the equality of two (unknown) distributions is based on a subroutine that estimates D(x) (to within (1 ± O(ǫ))) for a given point x given access to CONDD. Obtaining such an estimate for every x ∈ [N ] cannot be done efficiently for some distributions.5 However, we show that if we allow the algorithm to output UNKNOWN on some subset of points with total weight O(ǫ), then the relaxed task can be performed using poly(log N, 1/ǫ) queries, by performing a kind of randomized binary search “with exceptions”. This relaxed version, which we refer to as an approximate EVAL oracle, suffices for our needs in distinguishing between the case that D1 and D2 are the same distribution and the case in which they are far from each other. It is possible that this procedure will be useful for other tasks as well. The algorithm for estimating the distance to uniformity (which uses poly(1/ǫ) PCONDD of D(x). A reference point should be such that D(x) is relatively close to 1/N (if such a point cannot be found then it is evidence that D is very far from uniform). Given a reference point queries) is based on a subroutine for finding a reference point x together with an estimate bD(x) x (together with bD(x)) it is possible to estimate the distance to uniformity by obtaining (using points y. The procedure for finding a reference point x together with bD(x) is based on estimating PCOND queries) estimates of the ratio between D(x) and D(y) for poly(1/ǫ) uniformly selected both the weight and the size of a subset of points y such that D(y) is close to D(x). The procedure shares a common subroutine, Estimate-Neighborhood, with the PCOND algorithm for testing equivalence between two unknown distributions. Finally, the ICONDD algorithm for testing uniformity is based on a version of the approximate EVAL oracle mentioned previously, which on one hand uses only ICONDD (rather than general CONDD) queries, and on the other hand exploits the fact that we are dealing with the uniform distribution rather than an arbitrary distribution. 1.4 The work of Chakraborty et al. [CFGM13] Chakraborty et al. [CFGM13] proposed essentially the same COND model that we study, differing only in what happens on query sets S such that D(S) = 0. In our model such a query causes the COND oracle and algorithm to return FAIL, while in their model such a query returns a uniform random i ∈ S. Related to testing equality of distributions, [CFGM13] provides an (adaptive) algorithm for testing whether D is equivalent to a specified distribution D∗ using poly(log∗ N, 1/ǫ) COND queries. Recall that we give an algorithm for this problem that performs O(1/ǫ4) COND queries. [CFGM13] also gives a non-adaptive algorithm for this problem that performs poly(log N, 1/ǫ) COND queries.6 5As an extreme case consider a distribution D for which D(1) = 1 − φ and D(2) = · · · = D(N ) = φ/(N − 1) for some very small φ (which in particular may depend on N ), and for which we are interested in estimating D(2). This requires Ω(1/φ) queries. 6We note that it is only possible for them to give a non-adaptive algorithm because their model is more permissive 8 Testing equivalence between two unknown distributions is not considered in [CFGM13], and the same is true for testing in the PCOND model. [CFGM13] also presents additional results for a range of other problems, which we discuss below: • An (adaptive) algorithm for testing uniformity that performs poly(1/ǫ) queries.7 The sets on which the algorithms performs COND queries are of size linear in 1/ǫ. Recall that our algorithm for this problem performs O(1/ǫ2) PCOND queries and that we show that every algorithm must perform Ω(1/ǫ2) queries (when there is no restriction on the types of queries). We note that their analysis uses the same observation that ours does regarding distributions that are far from uniform (see the discussion in Subsection 1.3.3), but exploits it in a different manner. They also give a non-adaptive algorithm for this problem that performs poly(log N, 1/ǫ) COND queries and show that Ω(log log N ) is a lower bound on the necessary number of queries for non-adaptive algorithms. • An (adaptive) algorithm for testing whether D is equivalent to a specified distribution D∗ using poly(log∗ N, 1/ǫ) COND queries. Recall that we give an algorithm for this problem that performs O(1/ǫ4) COND queries. They also give a non-adaptive algorithm for this problem that performs poly(log N, 1/ǫ) COND queries. • An (adaptive) algorithm for testing any label-invariant (i.e., invariant under permutations of the domain) property that performs poly(log N, 1/ǫ) COND queries. As noted in [CFGM13], this in particular implies an algorithm with this complexity for estimating the distance to uniformity. Recall that we give an algorithm for this estimation problem that performs poly(1/ǫ) PCOND queries. The algorithm for testing any label-invariant property is based on learning a certain approx- imation of the distribution D and in this process defining some sort of approximate EVAL oracle. To the best of our understanding, our notion of an approximate EVAL oracle (which is used to obtain one or our results for testing equivalence between two unknown distributions) is quite different. They also show that there exists a label-invariant property for which any adaptive algorithm must perform Ω(√log log N ) COND queries. • Finally they show that there exist general properties that require Ω(N ) COND queries. than ours (if a query set S is proposed for which D(S) = 0, their model returns a uniform random element of S while our model returns FAIL). In our stricter model, any non-adaptive algorithm which queries a proper subset S ( N would output FAIL on some distribution D. 7The precise polynomial is not specified – we believe it is roughly 1/ǫ4 as it follows from an application of the identity tester of [BFF+01] with distance Θ(ǫ2) on a domain of size O(1/ǫ). 9 2 Preliminaries 2.1 Definitions Throughout the paper we shall work with discrete distributions over an N -element set whose elements are denoted {1, . . . , N}; we write [N ] to denote {1, . . . , N} and [a, b] to denote {a, . . . , b}. For a distribution D over [N ] we write D(i) to denote the probability of i under D, and for S ⊆ [N ] conditional distribution of D restricted to S, so DS(i) = D(i) we write D(S) to denotePi∈S D(i). For S ⊆ [N ] such that D(S) > 0 we write DS to denote the D(S) for i ∈ S and DS(i) = 0 for i /∈ S. As is standard in property testing of distributions, throughout this work we measure the distance between two distributions D1 and D2 using the total variation distance: dTV (D1, D2) def = 1 2kD1 − D2k1 = 1 2 Xi∈[N ] D1(i) − D2(i) = max S⊆[N ]D1(S) − D2(S). We may view a property P of distributions over [N ] as a subset of all distributions over [N ] (consisting of all distributions that have the property). The distance from D to a property P, denoted dTV(D,P), is defined as inf D′∈P{dTV(D, D′)}. We define testing algorithms for properties of distributions over [N ] as follows: Definition 2 Let P be a property of distributions over [N ]. Let ORACLED be some type of oracle which provides access to D. A q(ǫ, N )-query ORACLE testing algorithm for P is an algorithm T which is given ǫ, N as input parameters and oracle access to an ORACLED oracle. For any distribution D over [N ] algorithm T makes at most q(ǫ, N ) calls to ORACLED, and: • if D ∈ P then with probability at least 2/3 algorithm T outputs ACCEPT; • if dTV(D,P) ≥ ǫ then with probability at least 2/3 algorithm T outputs REJECT. This definition can easily be extended to cover situations in which there are two “unknown” distributions D1, D2 that are accessible via ORACLED1 and ORACLED2 oracles. In particular we shall consider algorithms for testing whether D1 = D2 versus dTV(D1, D2) in such a setting. We sometimes write T ORACLED to indicate that T has access to ORACLED. 2.2 Useful tools On several occasions we will use the data processing inequality for variation distance. This fun- damental result says that for any two distributions D, D′, applying any (possibly randomized) function to D and D′ can never increase their statistical distance; see e.g. part (iv) of Lemma 2 of [Rey11] for a proof of this lemma. 10 Lemma 1 (Data Processing Inequality for Total Variation Distance) Let D, D′ be two dis- tributions over a domain Ω. Fix any randomized function8 F on Ω, and let F (D) be the distribution such that a draw from F (D) is obtained by drawing independently x from D and f from F and then outputting f (x) (likewise for F (D′)). Then we have dTV(F (D), F (D′)) ≤ dTV(D, D′). We next give several variants of Chernoff bounds (see e.g. Chapter 4 of [MR95]). Theorem 1 Let Y1, . . . , Ym be m independent random variables that take on values in [0, 1], where i=1 pi = P . For any γ ∈ (0, 1] we have E[Yi] = pi, andPm (additive bound) (multiplicative bound) and (multiplicative bound) Pr" mXi=1 Pr" mXi=1 Yi > P + γm# , Pr" mXi=1 Pr" mXi=1 Pr" mXi=1 Yi > (1 + γ)P# ≤(cid:18) Pr" mXi=1 Yi > B# ≤ 2−B . Yi < P − γm# ≤ exp(−2γ2m) Yi > (1 + γ)P# < exp(−γ2P/3) Yi < (1 − γ)P# < exp(−γ2P/2). (1) (2) (3) eγ (1 + γ)1+γ(cid:19)P , (4) (5) The bound in Equation (2) is derived from the following more general bound, which holds from any γ > 0: and which also implies that for any B > 2eP , The following extension of the multiplicative bound is useful when we only have upper and/or lower bounds on P (see Exercise 1.1 of [DP09]): Corollary 2 In the setting of Theorem 1 suppose that PL ≤ P ≤ PH . Then for any γ ∈ (0, 1], we have Pr" mXi=1 Pr" mXi=1 Yi > (1 + γ)PH# < exp(−γ2PH/3) Yi < (1 − γ)PL# < exp(−γ2PL/2) (6) (7) 8Which can be seen as a distribution over functions over Ω. 11 We will also use the following corollary of Theorem 1: Corollary 3 Let 0 ≤ w1, . . . , wm ∈ R be such that wi ≤ κ for all i ∈ [m] where κ ∈ (0, 1]. Let X1, . . . , Xm be i.i.d. Bernoulli random variables with Pr[Xi = 1] = 1/2 for all i, and let X =Pm i=1 wiXi and W =Pm Pr(cid:20)X > (1 + γ) W i=1 wi. For any γ ∈ (0, 1], 2 (cid:21) < exp(cid:18)−γ2 W 6κ(cid:19) and Pr(cid:20)X < (1 − γ) W 2 (cid:21) < exp(cid:18)−γ2 W 4κ(cid:19) , and for any B > e · W , Pr[X > B] < 2−B/κ . Proof: Let w′i = wi/κ (so that w′i ∈ [0, 1]), let W ′ =Pm i=1 w′iXi =Pm Yi = w′iXi, so that Yi takes on values in [0, 1] and E[Yi] = w′i/2. Let X′ =Pm so that E[X′] = W ′/2. By the definitions of W ′ and X′ and by Equation (2), for any γ ∈ (0, 1], 6 (cid:19) = exp(cid:18)−γ2 W 6κ(cid:19) , 2 (cid:21) = Pr(cid:20)X′ > (1 + γ) i=1 w′i = W/κ, and for each i ∈ [m] let i=1 Yi, 2 (cid:21) < exp(cid:18)−γ2 W ′ Pr(cid:20)X > (1 + γ) W ′ W and similarly by Equation (3) Pr(cid:20)X < (1 − γ) W 2 (cid:21) < exp(cid:18)−γ2 W 4κ(cid:19) . For B > e · W = 2e · W/2 we apply Equation (5) and get Pr [X > B] = Pr(cid:2)X′ > B/κ(cid:3) < 2−B/κ, as claimed. (8) (9) (10) 3 Some useful procedures In this section we describe some procedures that will be used by our algorithms. On a first pass the reader may wish to focus on the explanatory prose and performance guarantees of these pro- cedures (i.e., the statements of Lemma 2 and Lemma 3, as well as Definition 3 and Theorem 4) and otherwise skip to p.27; the internal details of the proofs are not necessary for the subsequent sections that use these procedures. 3.1 The procedure Compare We start by describing a procedure that estimates the ratio between the weights of two disjoint sets of points by performing COND queries on the union of the sets. More precisely, it estimates the ratio (to within 1 ± η) if the ratio is not too high and not too low. Otherwise, it may output high or low, accordingly. In the special case when each set is of size one, the queries performed are PCOND queries. 12 Algorithm 1: Compare Input: COND query access to a distribution D over [N ], disjoint subsets X, Y ⊂ [N ], parameters η ∈ (0, 1], K ≥ 1, and δ ∈ (0, 1/2]. 1. Perform Θ(cid:16) K log(1/δ) η2 (cid:17) CONDD queries on the set S = X ∪ Y , and let µ be the fraction of times that a point y ∈ Y is returned. 2. If µ < 2 3 · 1 K+1, then return Low. 3. Else, if 1 − µ < 2 3 · 4. Else return ρ = µ 1−µ . 1 K+1, then return High. Lemma 2 Given as input two disjoint subsets of points X, Y together with parameters η ∈ (0, 1], K ≥ 1, and δ ∈ (0, 1/2], as well as COND query access to a distribution D, the procedure Compare (Algorithm 1) either outputs a value ρ > 0 or outputs High or Low, and satisfies the following: 1. If D(X)/K ≤ D(Y ) ≤ K · D(X) then with probability at least 1 − δ the procedure outputs a value ρ ∈ [1 − η, 1 + η]D(Y )/D(X); 2. If D(Y ) > K · D(X) then with probability at least 1 − δ the procedure outputs either High or a value ρ ∈ [1 − η, 1 + η]D(Y )/D(X); 3. If D(Y ) < D(X)/K then with probability at least 1 − δ the procedure outputs either Low or a value ρ ∈ [1 − η, 1 + η]D(Y )/D(X). The procedure performs O(cid:16) K log(1/δ) η2 (cid:17) COND queries on the set X ∪ Y . Proof: The bound on the number of queries performed by the algorithm follows directly from the description of the algorithm, and hence we turn to establish its correctness. D(X)+D(Y ) . Observe that w(Y ) D(X) and that for µ as defined in Line 1 of the algorithm, E[µ] = w(Y ) and E[1− µ] = w(X). Also observe that for any B ≥ 1, if D(Y ) ≥ D(X)/B, then w(Y ) ≥ 1 B+1 and if D(Y ) ≤ B · D(X), then w(X) ≥ 1 D(X)+D(Y ) and let w(Y ) = w(X) = D(Y ) Let w(X) = B+1 . D(X) D(Y ) Let E1 be the event that µ ∈ [1 − η/3, 1 + η/3]w(Y ) and let E2 be the event that (1 − µ) ∈ [1 − η/3, 1 + η/3]w(X). Given the number of COND queries performed on the set X ∪ Y , by applying a multiplicative Chernoff bound (see Theorem 1), if w(Y ) ≥ 1 4K then with probability at least 1− δ/2 the event E1 holds, and if w(X) ≥ 1 4K , then with probability at least 1− δ/2 the event E2 holds. We next consider the three cases in the lemma statement. 1. If D(X)/K ≤ D(Y ) ≤ KD(X), then by the discussion above, w(Y ) ≥ 1 K+1 , and with probability at least 1 − δ we have that µ ∈ [1 − η/3, 1 + η/3]w(Y ) and (1 − µ) ∈ [1 − η/3, 1 + η/3]w(X). Conditioned on these bounds holding, 2 3 · K+1, w(X) ≥ 1 1 − η/3 K + 1 ≥ and 1 − µ ≥ µ ≥ K + 1 2 3 · K + 1 1 1 . 13 It follows that the procedure outputs a value ρ = µ Item 1. 1−µ ∈ [1 − η, 1 + η] w(Y ) w(X) as required by 2. If D(Y ) > K · D(X), then we consider two subcases. (a) If D(Y ) > 3K · D(X), then w(X) < 1 (stated in Corollary 2), with probability at least 1 − δ we have that 3K+1 , so that by a multiplicative Chernoff bound 1 − µ < 1 + η/3 3K + 1 ≤ 4 3 · 1 3K + 1 ≤ 2 3 · 1 K + 1 , causing the algorithm to output High. Thus Item 2 is established for this subcase. (b) If K · D(X) < D(Y ) ≤ 3K · D(X), then w(X) ≥ 1 2 , so that the events E1 and E2 both hold with probability at least 1 − δ. Assume that these events in fact hold. This implies that µ ≥ 1−η/3 K+1, and the algorithm either outputs High or outputs ρ = µ 2 ≥ 2 3 · 1−µ ∈ [1 − η, 1 + η] w(Y ) w(X) , so Item 2 is established for this subcase as well. 3K+1 and w(Y ) ≥ 1 1 3. If D(Y ) < D(X)/K, so that D(X) > K · D(Y ), then the exact same arguments are applied as in the previous case, just switching the roles of Y and X and the roles of µ and 1 − µ so as to establish Item 3. We have thus established all items in the lemma. 3.2 The procedure Estimate-Neighborhood In this subsection we describe a procedure that, given a point x, provides an estimate of the weight of a set of points y such that D(y) is similar to D(x). In order to specify the behavior of the procedure more precisely, we introduce the following notation. For a distribution D over [N ], a point x ∈ [N ] and a parameter γ ∈ [0, 1], let U D γ (x) def = ny ∈ [N ] : 1 1 + γ D(x) ≤ D(y) ≤ (1 + γ)D(x)o (11) γ (x)). γ (x), then we could obtain a good estimate of D(U D denote the set of points whose weight is “γ-close” to the weight of x. If we take a sample of points distributed according to D, then the expected fraction of these points that belong to U D γ (x) is D(U D If this value is not too small, then the actual fraction in the sample is close to the expected value. Hence, if we could efficiently determine for any given point y whether or not it belongs to U D γ (x)). The difficulty is that it is not possible to perform this task efficiently for “boundary” points y such that D(y) is very close to (1 + γ)D(x) or to 1 1+γ D(x). However, for our purposes, it is not important that we obtain the weight and size of U D γ (x) for a specific γ, but rather it suffices to do so for γ in a given range, as stated in the next lemma. The parameter β in the lemma is the threshold above which we expect the algorithm to provide an estimate of the weight, while [κ, 2κ) is the range in which γ is permitted to lie; finally, η is the desired (multiplicative) accuracy of the estimate, while δ is a bound on the probability of error allowed to the subroutine. 14 Lemma 3 Given as input a point x together with parameters κ, β, η, δ ∈ (0, 1/2] as well as PCOND query access to a distribution D, the procedure Estimate-Neighborhood (Algorithm 2) outputs a pair ( w, α) ∈ [0, 1] × (κ, 2κ) such that α is uniformly distributed in {κ + iθ}κ/θ−1 for θ = κηβδ 64 , i=0 and such that the following holds: 1. If D(U D and D(U D α (x)) ≥ β, then with probability at least 1 − δ we have w ∈ [1 − η, 1 + η] · D(U D α+θ(x) \ U D α (x)) ≤ ηβ/16; α (x)), 2. If D(U D U D α (x)) ≤ ηβ/16. α (x)) < β, then with probability at least 1− δ we have w ≤ (1 + η)· β, and D(U D The number of PCOND queries performed by the procedure is O(cid:16) log(1/δ)·log(log(1/δ)/(δβη2 )) (cid:17). κ2η4β3δ2 α+θ(x)\ 64 and r = κ κ, β, η, δ ∈ (0, 1/2] Algorithm 2: Estimate-Neighborhood Input: PCOND query access to a distribution D over [N ], a point x ∈ [N ] and parameters 1: Set θ = κηβδ θ = 64 ηβδ . 2: Select a value α ∈ {κ + iθ}r−1 i=0 uniformly at random. 3: Call the SAMPD oracle Θ(log(1/δ)/(βη2)) times and let S be the set of points obtained. 4: For each point y in S call CompareD({x},{y}, θ/4, 4, δ/(4S)) (if a point y appears more 5: Let w be the fraction of occurrences of points y in S for which Compare returned a value than once in S, then Compare is called only once on y). ρ(y) ∈ [1/(1 + α + θ/2), (1 + α + θ/2)]. (That is, S is viewed as a multiset.) 6: Return ( w, α). Proof of Lemma 3: The number of PCOND queries performed by Estimate-Neighborhood is the size of S times the number of PCOND queries performed in each call to Compare. By the setting of the parameters in the calls to Compare, the total number of PCOND queries is (cid:17) = O(cid:16) log(1/δ)·log(log(1/δ)/(δβη2 )) κ2η4β3δ2 (cid:17). We now turn to establishing the correctness of O(cid:16) (S)·log S/δ) the procedure. θ2 Since D and x are fixed, in what follows we shall use the shorthand Uγ for U D α ∈ {κ + iθ}r−1 follows we view S as a multiset. i=0 , let ∆α def= Uα+θ \ Uα. We next define several “desirable” events. γ (x). For In all that 1. Let E1 be the event that D(∆α) ≤ 4/(δr). Since there are r disjoint sets ∆α for α ∈ {κ + iθ}r−1 i=0 , the probability that E1 occurs (taken over the uniform choice of α) is at least 1 − δ/4. From this point on we fix α and assume E1 holds. 2. The event E2 is that S ∩ ∆α/S ≤ 8/(δr) (that is, at most twice the upper bound on the expected value). By applying the multiplicative Chernoff bound using the fact that S = Θ(log(1/δ)/(βη2)) = Ω(log(1/δ) · (δr)), we have that PrS[E2] ≥ 1 − δ/4. 15 3. The event E3 is defined as follows: If D(Uα) ≥ β, then S∩Uα/S ∈ [1−η/2, 1+η/2]·D(Uα), and if D(Uα) < β, then S ∩ Uα/S < (1 + η/2) · β. Once again applying the multiplicative Chernoff bound (for both cases) and using that fact that S = Θ(log(1/δ)/(βη2)), we have that PrS[E3] ≥ 1 − δ/4. 4. Let E4 be the event that all calls to Compare return an output as specified in Lemma 2. Given the setting of the confidence parameter in the calls to Compare we have that Pr[E4] ≥ 1 − δ/4 as well. Assume from this point on that events E1 through E4 all hold where this occurs with probability at least 1−δ. By the definition of ∆α and E1 we have that D(Uα+θ\Uα) ≤ 4/(δr) = ηβ/16, as required (in both items of the lemma). Let T be the (multi-)subset of points y in S for which Compare returned a value ρ(y) ∈ [1/(1+α+θ/2), (1+α+θ/2)] (so that w, as defined in the algorithm, equals T/S). Note first that conditioned on E4 we have that for every y ∈ U2κ it holds that the output of Compare when called on {x} and {y}, denoted ρ(y), satisfies ρ(y) ∈ [1− θ/4, 1 + θ/4](D(y)/D(x)), while for y /∈ U2κ either Compare outputs High or Low or it outputs a value ρ(y) ∈ [1 − θ/4, 1 + θ/4](D(y)/D(x)). This implies that if y ∈ Uα, then ρ(y) ≤ (1 + α) · (1 + θ/4) ≤ 1 + α + θ/2 and ρ(y) ≥ (1 + α)−1 · (1 − θ/4) ≥ (1 + α + θ/2)−1, so that S ∩ Uα ⊆ T . On the other hand, if y /∈ Uα+θ then either ρ(y) > (1+α+θ)·(1−θ/4) ≥ 1+α+θ/2 or ρ(y) < (1+α+θ)−1·(1+θ/4) ≤ (1+α+θ/2)−1 so that T ⊆ S ∩ Uα+θ. Combining the two we have: Recalling that w = T S , the left-hand side of Equation (12) implies that S ∩ Uα ⊆ T ⊆ S ∩ Uα+θ . w ≥ S ∩ Uα S , and by E1 and E2, the right-hand-side of Equation (12) implies that w ≤ S ∩ Uα) S + 8 δr ≤ S ∩ Uα S + βη 8 . We consider the two cases stated in the lemma: (12) (13) (14) 1. If D(Uα) ≥ β, then by Equation (13), Equation (14) and (the first part of) E3, we have that w ∈ [1 − η, 1 + η] · D(Uα). 2. If D(Uα) < β, then by Equation (14) and (the second part of) E3, we have that w ≤ (1 + η)β. The lemma is thus established. 3.3 The procedure Approx-Eval-Simulator 3.3.1 Approximate EVAL oracles. We begin by defining the notion of an “approximate EVAL oracle” that we will use. Intuitively this is an oracle which gives a multiplicatively (1 ± ǫ)-accurate estimate of the value of D(i) for all i 16 in a fixed set of probability weight at least 1 − ǫ under D. More precisely, we have the following definition: Definition 3 Let D be a distribution over [N ]. An (ǫ, δ)-approximate EVALD simulator is a ran- domized procedure ORACLE with the following property: For each 0 < ǫ < 1, there is a fixed set S(ǫ,D) ( [N ] with D(S(ǫ,D)) < ǫ for which the following holds. Given as input an element i∗ ∈ [N ], the procedure ORACLE either outputs a value α ∈ [0, 1] or outputs UNKNOWN or FAIL. The following holds for all i∗ ∈ [N ]: (i) If i∗ /∈ S(ǫ,D) then with probability at least 1 − δ the output of ORACLE on input i∗ is a value α ∈ [0, 1] such that α ∈ [1 − ǫ, 1 + ǫ]D(i∗); (i) If i∗ ∈ S(ǫ,D) then with probability at least 1 − δ the procedure either outputs UNKNOWN or outputs a value α ∈ [0, 1] such that α ∈ [1 − ǫ, 1 + ǫ]D(i∗). We note that according to the above definition, it may be the case that different calls to ORACLE on the same input element i∗ ∈ [N ] may return different values. However, the “low-weight” set S(ǫ,D) is an a priori fixed set that does not depend in any way on the input point i∗ given to the algorithm. The key property of an (ǫ, δ)-approximate EVAL D oracle is that it reliably gives a multiplicatively (1±ǫ)-accurate estimate of the value of D(i) for all i in some fixed set of probability weight at least 1 − ǫ under D. 3.3.2 Constructing an approximate EVALD simulator using CONDD In this subsection we show that a CONDD oracle can be used to obtain an approximate EVAL simulator: Theorem 4 Let D be any distribution over [N ] and let 0 < ǫ, δ < 1. The algorithm Approx- Eval-Simulator has the following properties: It uses O(cid:18) (log N )5 · (log(1/δ))2 ǫ3 (cid:19) calls to CONDD and it is an (ǫ, δ)-approximate EVALD simulator. A few notes: First, in the proof we give below of Theorem 4 we assume throughout that 0 < ǫ ≤ 1/40. This incurs no loss of generality because if the desired ǫ parameter is in (1/40, 1) then the parameter can simply be set to 1/40. We further note that in keeping with our requirement on a CONDD algorithm, the algorithm Approx-Eval-Simulator only ever calls the CONDD oracle on sets S which are either S = [N ] or else contain at least one element i that has been returned as the output of an earlier call to CONDD. To see this, note that Line 6 is the only line when CONDD queries are performed. In the first execution of the outer “For” loop clearly all COND queries are on set S0 = [N ]. In subsequent stages the only way a set Sj is formed is if either (i) Sj is set to {i∗} in Line 10, in which case clearly i∗ was previously received as the response of a CONDD(Sj−1) 17 query, or else (ii) a nonzero fraction of elements i1, . . . , im received as responses to CONDD(Sj−1) queries belong to Sj (see Line 19). A preliminary simplification. Fix a distribution D over [N ]. Let Z denote supp(D), i.e. Z = {i ∈ [N ] : D(i) > 0}. We first claim that in proving Theorem 4 we may assume without loss of generality that no two distinct elements i, j ∈ Z have D(i) = D(j) – in other words, we shall prove the theorem under this assumption on D, and we claim that this implies the general result. To see this, observe that if Z contains elements i 6= j with D(i) = D(j), then for any arbitrarily small ξ > 0 and any arbitrarily large M we can perturb the weights of elements in Z to obtain a distribution D′ supported on Z such that (i) no two elements of Z have the same probability under D′, and (ii) for every S ⊆ [N ], S ∩ Z 6= ∅ we have dTV(DS , D′S) ≤ ξ/M. Since the variation distance between D′S and DS is at most ξ/M for an arbitrarily small ξ, the variation distance between (the execution of any M -query COND algorithm run on D) and (the execution of any M -query COND algorithm run on D′) will be at most ξ. Since ξ can be made arbitrarily small this means that indeed without loss of generality we may work with D′ in what follows. Thus, we henceforth assume that the distribution D has no two elements in supp(D) with the same weight. For such a distribution we can explicitly describe the set S(ǫ,D) from Definition 3 that our analysis will deal with. Let π : {1, . . . ,Z} → Z be the bijection such that D(π(1)) > ··· > D(π(Z)) (note that the bijection π is uniquely defined by the assumption that D(i) 6= D(j) for all distinct i, j ∈ Z). Given a value 0 < τ < 1 we define the set Lτ,D to be ([N ]\Z)∪{π(s), . . . , π(Z)} where s is the smallest index in {1, . . . ,Z} such thatPZj=s D(π(j)) < τ (if D(π(Z)) itself is at least τ then we define Lτ,D = [N ] \ Z). Thus intuitively Lτ,D contains the τ fraction (w.r.t. D) of [N ] consisting of the lightest elements. The desired set S(ǫ,D) is precisely Lǫ,D. Intuition for the algorithm. The high-level idea of the EVALD simulation is the following: Let i∗ ∈ [N ] be the input element given to the EVALD simulator. The algorithm works in a sequence of stages. Before performing the j-th stage it maintains a set Sj−1 that contains i∗, and it has a high-accuracy estimate D(Sj−1) of the value of D(Sj−1). (The initial set S0 is simply [N ] and the initial estimate D(S0) is of course 1.) In the j-th stage the algorithm attempts to construct a subset Sj of Sj−1 in such a way that (i) i∗ ∈ Sj, and (ii) it is possible to obtain a high-accuracy estimate of D(Sj)/D(Sj−1) (and thus a high-accuracy estimate of D(Sj)). If the algorithm cannot construct such a set Sj then it outputs UNKNOWN; otherwise, after at most (essentially) O(log N ) stages, it reaches a situation where Sj = {i∗} and so the high-accuracy estimate of D(Sj) = D(i∗) is the desired value. A natural first idea towards implementing this high-level plan is simply to split Sj−1 randomly into two pieces and use one of them as Sj. However this simple approach may not work; for example, if Sj−1 has one or more elements which are very heavy compared to i∗, then with a random split it may not be possible to efficiently estimate D(Sj)/D(Sj−1) as required in (ii) above. Thus we follow a more careful approach which first identifies and removes “heavy” elements from Sj−1 in each stage. In more detail, during the j-th stage, the algorithm first performs CONDD queries on the set Sj−1 to identify a set Hj ⊆ Sj−1 of “heavy” elements; this set essentially consists of all ele- ments which individually each contribute at least a κ fraction of the total mass D(Sj−1). (Here κ is a “not-too-small” quantity but it is significantly less than ǫ.) Next, the algorithm performs 18 additional CONDD queries to estimate D(i∗)/D(Sj−1). If this fraction exceeds κ/20 then it is straightforward to estimate D(i∗)/D(Sj−1) to high accuracy, so using D(Sj−1) it is possible to obtain a high-quality estimate of D(i∗) and the algorithm can conclude. However, the typical case is that D(i∗)/D(Sj−1) < κ/20. In this case, the algorithm next estimates D(Hj)/D(Sj−1). If this is larger than 1 − ǫ/10 then the algorithm outputs UNKNOWN (see below for more discus- sion of this). If D(Hj)/D(Sj−1) is less than 1 − ǫ/10 then D(Sj−1 \ Hj)/D(Sj−1) ≥ ǫ/10 (and so D(Sj−1 \ Hj)/D(Sj−1) can be efficiently estimated to high accuracy), but each element k of Sj−1 \ Hj has D(k)/D(Sj−1) ≤ κ ≪ ǫ/10 ≤ D(Sj−1 \ Hj)/D(Sj−1). Thus it must be the case that the weight under D of Sj−1 \ Hj is “spread out” over many “light” elements. Given that this is the situation, the algorithm next chooses S′j to be a random subset of Sj−1 \ (Hj ∪ {i∗}), and sets Sj to be S′j ∪ {i∗}. It can be shown that with high probability (over the random choice of Sj) it will be the case that D(Sj) ≥ 1 3 D(Sj−1 \ Hj) (this relies crucially on the fact that the weight under D of Sj−1 \ Hj is “spread out” over many “light” elements). This makes it possible to efficiently estimate D(Sj)/D(Sj−1 \ Hj); together with the high-accuracy estimate of D(Sj−1 \ Hj)/D(Sj−1) noted above, and the high-accuracy estimate D(Sj−1) of D(Sj−1), this means it is possible to efficiently estimate D(Sj) to high accuracy as required for the next stage. (We note that after defining Sj but before proceeding to the next stage, the algorithm actually checks to be sure that Sj contains at least one point that was returned from the CONDD(Sj−1) calls made in the past stage. This check ensures that whenever the algorithm calls CONDD(S) on a set S, it is guaranteed that D(S) > 0 as required by our CONDD model. Our analysis shows that doing this check does not affect correctness of the algorithm since with high probability the check always passes.) Intuition for the analysis. We require some definitions to give the intuition for the analysis establishing correctness. Fix a nonempty subset S ⊆ [N ]. Let πS be the bijection mapping {1, . . . ,S} to S in such a way that DS(πS(1)) > ··· > DS(πS(S)), i.e. πS(1), . . . , πS(S) is a listing of the elements of S in order from heaviest under DS to lightest under DS. Given j ∈ S, we define the S-rank of j, denoted rankS(j), to be the valuePi:DS(π(i))≤DS (j) DS(π(i)), i.e. rankS(j) is the sum of the weights (under DS) of all the elements in S that are no heavier than j under DS. Note that having i∗ /∈ Lǫ,N implies that rank[N ](i∗) ≥ ǫ. We first sketch the argument for correctness. (It is easy to show that the algorithm only outputs FAIL with very small probability so we ignore this possibility below.) Suppose first that i∗ /∈ Lǫ,D. A key lemma shows that if i∗ /∈ Lǫ,D (and hence rank[N ](i∗) ≥ ǫ), then with high probability every set Sj−1 constructed by the algorithm is such that rankSj−1(i∗) ≥ ǫ/2. (In other words, if i∗ is not initially among the ǫ-fraction (under D) of lightest elements, then it never “falls too far” to become part of the ǫ/2-fraction (under DSj−1) of lightest elements for Sj−1, for any j.). Given that ( with high probability) i∗ always has rankSj−1(i∗) ≥ ǫ/2, though, then it must be the case that ( with high probability) the procedure does not output UNKNOWN (and hence it must with high probability output a numerical value). This is because there are only two places where the procedure can output UNKNOWN, in Lines 14 and 19; we consider both cases below. 1. In order for the procedure to output UNKNOWN in Line 14, it must be the case that the elements of Hj – each of which individually has weight at least κ/2 under DSj−1 – collectively have weight at least 1−3ǫ/20 under DSj−1 by Line 13. But i∗ has weight at most 3κ/40 under 19 DSj−1 (because the procedure did not go to Line 2 in Line 10), and thus i∗ would need to be in the bottom 3ǫ/20 of the lightest elements, i.e. it would need to have rankSj−1(i∗) ≤ 3ǫ/20; but this contradicts rankSj−1(i∗) ≥ ǫ/2. 2. In order for the procedure to output UNKNOWN in Line 19, it must be the case that all elements i1, . . . , im drawn in Line 6 are not chosen for inclusion in Sj. In order for the algorithm to reach Line 19, though, it must be the case that at least (ǫ/10 − κ/20)m of these draws do not belong to Hj ∪ {i∗}; since these draws do not belong to Hj each one occurs only a small number of times among the m draws, so there must be many distinct values, and hence the probability that none of these distinct values is chosen for inclusion in S′j is very low. Thus we have seen that if i∗ /∈ Lǫ,D, then with high probability the procedure outputs a numerical value; it remains to show that with high probability this value is a high-accuracy estimate of D(i∗). However, this follows easily from the fact that we inductively maintain a high- quality estimate of D(Sj−1) and the fact that the algorithm ultimately constructs its estimate of D(i∗) only when it additionally has a high-quality estimate of D(i∗)/D(Sj−1). This fact also handles the case in which i∗ ∈ Lǫ,D – in such a case it is allowable for the algorithm to output UNKNOWN, so since the algorithm with high probability outputs a high-accuracy estimate when it outputs a numerical value, this means the algorithm performs as required in Case (ii) of Definition 3. We now sketch the argument for query complexity. We will show that the heavy elements can be identified in each stage using poly(log N, 1/ǫ) queries. Since the algorithm constructs Sj by taking a random subset of Sj−1 (together with i∗) at each stage, the number of stages is easily bounded by (essentially) O(log N ). Since the final probability estimate for D(i∗) is a product of O(log N ) conditional probabilities, it suffices to estimate each of these conditional probabilities to within a multiplicative factor of (1± O(cid:16) ǫ log N(cid:17)). We show that each conditional probability estimate can be carried out to this required precision using only poly(log N, 1/ǫ) calls to CONDD; given this, the overall poly(log N, 1/ǫ) query bound follows straightforwardly. Now we enter into the actual proof. We begin our analysis with a simple but useful lemma about the “heavy” elements identified in Line 7. Lemma 4 With probability at least 1− δ/9, every set Hj that is ever constructed in Line 7 satisfies the following for all ℓ ∈ Sj−1: (i) If D(ℓ)/D(Sj−1) > κ, then ℓ ∈ H j; (ii) If D(ℓ)/D(Sj−1) < κ/2 then ℓ /∈ H j. Proof: Fix an iteration j. By Line 7 in the algorithm, a point ℓ is included in Hj if it appears at least 3 4 κm times among i1, . . . , im (which are the output of CONDD queries on Sj−1). For the first item, fix an element ℓ such that D(ℓ)/D(Sj−1) > κ. Recall that m = Ω(M 2 log(M/δ)/(ǫ2κ)) = Ω(log(M N/δ)/κ) (since M = Ω(log(N ))). By a multiplicative Chernoff bound, the probability (over the choice of i1, . . . , im in Sj−1) that ℓ appears less than 3 4 κm times among i1, . . . , im (that is, less than 3/4 times the lower bound on the expected value) is at most δ/(9M N ) (for an appropriate constant in the setting of m). On the other hand, for each fixed ℓ such that D(ℓ)/D(Sj−1) < κ/2, 20 4: 5: 6: 7: 8: 9: return D(Sj−1) (and exit) Algorithm 3: Approx-Eval-Simulator Input: access to CONDD; parameters 0 < ǫ, δ < 1; input element i∗ ∈ [N ] 1: Set S0 = [N ] and D(S0) = 1.Set M = log N + log(9/δ) + 1. Set κ = Θ(ǫ/(M 2 log(M/δ))). 2: for j = 1 to M do if Sj−1 = 1 then 3: end if Perform m = Θ(max{M 2 log(M/δ)/(ǫ2κ), log(M/(δκ))/κ2}) CONDD queries on Sj−1 to obtain points i1, . . . , im ∈ Sj−1. Let Hj = {k ∈ [N ] : k appears at least 3 4 κm times in the list i1, . . . , im} Let DSj−1 (i∗) denote the fraction of times that i∗ appears in i1, . . . , im if DSj−1(i∗) ≥ κ Set Sj = {i∗}, set D(Sj) = DSj−1(i∗) · D(Sj−1), increment j, and go to Line 2. end if Let DSj−1 (Hj) denote the fraction of elements among i1, . . . , im that belong to Hj. if DSj−1(Hj) > 1 − ǫ/10 then return UNKNOWN (and exit) end if Set S′j to be a uniform random subset of Sj−1 \ (Hj ∪ {i∗}) and set Sj to be S′j ∪ {i∗}. Let DSj−1 (Sj) denote the fraction of elements among i1, . . . , im that belong to Sj if DSj−1(Sj) = 0 then 20 then 10: 11: 14: 15: 16: return UNKNOWN (and exit) end if Set D(Sj) = DSj−1(Sj) · D(Sj−1) 12: 13: 17: 18: 19: 20: 21: 22: end for 23: Output FAIL. 21 the probability that ℓ appears at least 3 4 κm times (that is, at least 3/2 times the upper bound on the expected value) is at most δ/(9M N ) as well. The lemma follows by taking a union bound over all (at most N ) points considered above and over all M settings of j. Next we show that with high probability Algorithm Approx-Eval-Simulator returns either UNKNOWN or a numerical value (as opposed to outputting FAIL in Line 23): Lemma 5 For any D, ǫ, δ and i∗, Algorithm Approx-Eval-Simulator outputs FAIL with prob- ability at most δ/9. Proof: Fix any element i 6= i∗. The probability (taken only over the choice of the random subset in each execution of Line 16) that i is placed in S′j in each of the first log N + log(9/δ) executions 9N . Taking a union bound over all N − 1 points i 6= i∗, the probability that of Line 16 is at most any point other than i∗ remains in Sj−1 through all of the first log N + log(9/δ) executions of the outer “for” loop is at most δ 9 . Assuming that this holds, then in the execution of the outer “for” loop when j = log N + log(9/δ) + 1, the algorithm will return D(Sj−1) = D(i∗) in Line 4. δ For the rest of the analysis it will be helpful for us to define several “desirable” events and show that they all hold with high probability: 1. Let E1 denote the event that every set Hj that is ever constructed in Line 7 satisfies both properties (i) and (ii) stated in Lemma 4. By Lemma 4 the event E1 holds with probability at least 1 − δ/9. 2. Let E2 denote the event that in every execution of Line 9, the estimate DSj−1(i∗) is within an additive ± κ 40 of the true value of D(i∗)/D(Sj−1). By the choice of m in Line 6 (i.e., using m = Ω(log(M/δ)/κ2)), an additive Chernoff bound, and a union bound over all iterations, the event E2 holds with probability at least 1 − δ/9. 2M , 1 + ǫ 3. Let E3 denote the event that if Line 10 is executed, the resulting value DSj−1(i∗) lies in [1 − ǫ 2M ]D(i∗)/D(Sj−1). Assuming that event E2 holds, if Line 10 is reached then the true value of D(i∗)/D(Sj−1) must be at least κ/40, and consequently a multiplicative Chernoff bound and the choice of m (i.e. using m = Ω(M 2 log(M/δ)/(ǫ2κ))) together imply that DSj−1(i∗) lies in [1 − ǫ 2M ]D(i∗)/D(Sj−1) except with failure probability at most δ/9. 2M , 1 + ǫ 4. Let E4 denote the event that in every execution of Line 12, the estimate DSj−1(Hj) is within an additive error of ± ǫ 20 from the true value of D(Hj)/D(Sj−1). By the choice of m in Line 6 (i.e., using m = Ω(log(M/δ)/ǫ2)) and an additive Chernoff bound, the event E4 holds with probability at least 1 − δ/9. The above arguments show that E1, E2, E3 and E4 all hold with probability at least 1 − 4δ/9. Let E5 denote the event that in every execution of Line 16, the set S′j which is drawn satisfies D(S′j)/D(Sj−1 \ (Hj ∪ {i∗})) ≥ 1/3. The following lemma says that conditioned on E1 through E4 all holding, event E5 holds with high probability: 22 Lemma 6 Conditioned on E1 through E4 the probability that E5 holds is at least 1 − δ/9. Proof: Fix a value of j and consider the j-th iteration of Line 16. Since events E2 and E4 hold, it must be the case that D(Sj−1 \ (Hj ∪ {i∗}))/D(Sj−1) ≥ ǫ/40. Since event E1 holds, it must be the case that every i ∈ (Sj−1 \ (Hj ∪ {i∗})) has D(i)/D(Sj−1) ≤ κ. Now since S′j is chosen by independently including each element of Sj−1 \ (Hj ∪ {i∗}) with probability 1/2, we can apply the first part of Corollary 3 and get Pr(cid:20)D(S′j) < 1 3 D(Sj−1 \ (Hj ∪ {i∗}))(cid:21) ≤ ǫ−4ǫ/(40·9·4κ) < δ 9M , where the last inequality follows by the setting of κ = Ω(ǫ/(M 2 log(1/δ))). Thus we have established that E1 through E5 all hold with probability at least 1 − 5δ/9. Next, let E6 denote the event that the algorithm never returns UNKNOWN and exits in Line 19. Our next lemma shows that conditioned on events E1 through E5, the probability of E6 is at least 1 − δ/9: Lemma 7 Conditioned on E1 through E5 the probability that E6 holds is at least 1 − δ/9. Proof: Fix any iteration j of the outer “For” loop. In order for the algorithm to reach Line 18 in this iteration, it must be the case (by Lines 9 and 13) that at least (ǫ/10 − κ/20)m > (ǫ/20)m points in i1, . . . , im do not belong to Hj ∪ {i∗}. Since each point not in Hj appears at most 3 4 κm ǫ 15κ distinct such values. Hence the probability times in the list i1, . . . , im, there must be at least that none of these values is selected to belong to S′j is at most 1/2ǫ/(15κ) < δ/(9M ). A union bound over all (at most M ) values of j gives that the probability the algorithm ever returns UNKNOWN and exits in Line 19 is at most δ/9, so the lemma is proved. Now let E7 denote the event that in every execution of Line 17, the estimate DSj−1 (Sj) lies in 2M , 1 + ǫ 2M ]D(Sj)/D(Sj−1). The following lemma says that conditioned on E1 through E5, [1 − ǫ event E7 holds with probability at least 1 − δ/9: Lemma 8 Conditioned on E1 through E5, the probability that E7 holds is at least 1 − δ/9. Proof: Fix a value of j and consider the j-th iteration of Line 17.The expected value of DSj−1(Sj) is precisely D(Sj) D(Sj−1) D(Sj) = D(Sj−1 \ (Hj ∪ {i∗})) · D(Sj−1 \ (Hj ∪ {i∗})) . (15) D(Sj−1) Since events E2 and E4 hold we have that D(Sj−1\(Hj∪{i∗})) ≥ ǫ/40, and since event E5 holds we D(Sj−1\(Hj∪{i∗})) ≥ 1/3 (note that D(Sj) ≥ D(S′j)). Thus we have that (15) is at least have that ǫ/120. Recalling the value of m (i.e., using m = Ω(M 2 log(M/δ)/ǫ2κ) = Ω(M 2 log(M/δ)/ǫ3)) a multiplicative Chernoff bound gives that indeed DSj−1 (Sj) ∈ [1 − ǫ 2M ]D(Sj)/D(Sj−1) with failure probability at most δ/(9M ). A union bound over all M possible values of j finishes the proof. 2M , 1 + ǫ D(Sj−1) D(Sj) 23 At this point we have established that events E1 through E7 all hold with probability at least 1 − 7δ/9. We can now argue that each estimate D(Sj) is indeed a high-accuracy estimate of the true value D(Sj): Lemma 9 With probability at least 1 − 7δ/9 each estimate D(Sj) constructed by Approx-Eval- Simulator lies in [(1 − ǫ 2M )j, (1 + ǫ 2M )j]D(Sj). Proof: We prove the lemma by showing that if all events E1 through E7 hold, then the following claim (denoted (*)) holds: each estimate D(Sj) constructed by Approx-Eval-Simulator lies in [(1 − ǫ 2M )j, (1 + ǫ 2M )j]D(Sj). Thus for the rest of the proof we assume that indeed all events E1 through E7 hold. The claim (*) is clearly true for j = 0. We prove (*) by induction on j assuming it holds for j − 1. The only places in the algorithm where D(Sj) may be set are Lines 10 and 21. If D(Sj) is set in Line 21 then (*) follows from the inductive claim for j − 1 and Lemma 8. If D(Sj) is set in Line 10, then (*) follows from the inductive claim for j − 1 and the fact that event E3 holds. This concludes the proof of the lemma. Finally, we require the following crucial lemma which establishes that if i∗ /∈ Lǫ,N (and hence the initial rank rank[N ] of i∗ is at least ǫ), then with very high probability the rank of i∗ never becomes too low during the execution of the algorithm: Lemma 10 Suppose i∗ /∈ Lǫ,N . Then with probability at least 1 − δ/9, every set Sj−1 constructed by the algorithm has rankSj−1(i∗) ≥ ǫ/2. We prove Lemma 10 in Section 3.3.3 below. With these pieces in place we are ready to prove Theorem 4. Proof of Theorem 4: It is straightforward to verify that algorithm Approx-Eval-Simulator has the claimed query complexity. We now argue that Approx-Eval-Simulator meets the two requirements (i) and (ii) of Definition 3. Throughout the discussion below we assume that all the “favorable events” in the above analysis (i.e. events E1 through E7, Lemma 5, and Lemma 10) indeed hold as desired (incurring an overall failure probability of at most δ). Suppose first that i∗ /∈ Lǫ,D. We claim that by Lemma 10 it must be the case that the algorithm does not return UNKNOWN in Line 14. To verify this, observe that in order to reach Line 14 it would need to be the case that D(i∗)/D(Sj−1) ≤ 3κ/40 (so the algorithm does not instead go to Line 22 in Line 10). Since by Lemma 4 every element k in Hj satisfies D(k)/D(Sj−1) ≥ κ/2, this means that i∗ does not belong to Hj. In order to reach Line 14, by event E4 we must have D(Hj)/D(Sj−1) ≥ 1− 3ǫ/20. Since every element of Hj has more mass under D (at least κ/2) than i∗ (which has at most 3κ/40), this would imply that rankSj−1(i∗)≤3ǫ/20, contradicting Lemma 10. Furthermore, by Lemma 7 it must be the case that the algorithm does not return UNKNOWN in Line 19. Thus the algorithm terminates by returning an estimate D(Sj) = D(i∗) which, by Lemma 9, lies in [(1 − ǫ 2M )j]D(i∗). Since j ≤ M this estimate lies in [1 − ǫ, 1 + ǫ]D(i∗) as required. 2M )j, (1 + ǫ 24 Now suppose that i∗ ∈ Lǫ,D. By Lemma 5 we may assume that the algorithm either outputs UNKNOWN or a numerical value. As above, Lemma 9 implies that if the algorithm outputs a numerical value then the value lies in [1 − ǫ, 1 + ǫ]D(i∗) as desired. This concludes the proof of Theorem 4. 3.3.3 Proof of Lemma 10. The key to proving Lemma 10 will be proving the next lemma. (In the following, for S a set of real numbers we write sum(S) to denotePα∈S α.) Lemma 11 Fix 0 < ǫ ≤ 1/40. Set κ = Ω(ǫ/(M 2 log(1/δ))). Let T = {α1, . . . , αn} be a set of values α1 < ··· < αn such that sum(T ) = 1. Fix ℓ ∈ [N ] and let TL = {α1, . . . , αℓ} and let TR = {αℓ+1, . . . , αn}, so TL ∪ TR = T. Assume that sum(TL) ≥ ǫ/2 and that αℓ ≤ κ/10. Fix H to be any subset of T satisfying the following two properties: (i) H includes every αj such that αj ≥ κ; and (ii) H includes no αj such that αj < κ/2. (Note that consequently H does not intersect TL.) Let T ′ be a subset of (T \ (H ∪ {αℓ}) selected uniformly at random. Let T ′L = T ′ ∩ TL and let T ′R = T ′ ∩ TR. Then we have the following: 1. If sum(TL) > 20ǫ, then with probability at least 1 − δ/M (over the random choice of T ′) it holds that sum(T ′L ∪ {αℓ}) sum(T ′ ∪ {αℓ}) ≥ 9ǫ; 2. If ǫ/2 ≤ sum(TL) < 20ǫ, then with probability at least 1 − δ/M (over the random choice of T ′) it holds that sum(T ′L ∪ {αℓ}) sum(T ′ ∪ {αℓ}) ≥ sum(TL) (1 − ρ) , where ρ = ln 2 M . Proof of Lemma 10 using Lemma 11: We apply Lemma 11 repeatedly at each iteration j of the outer “For” loop. The set H of Lemma 11 corresponds to the set Hj of “heavy” elements that are removed at a given iteration, the set of values T corresponds to the values D(i)/D(Sj−1) for i ∈ Sj−1, and the element αℓ of Lemma 11 corresponds to D(i∗)/D(Sj−1). The value sum(TL) corresponds to rankSj−1(i∗) and the value sum(T ′L ∪ {αℓ}) sum(T ′ ∪ {αℓ}) corresponds to rankSj (i∗). Observe that since i∗ /∈ Lǫ,N we know that initially rank[N ](i∗) ≥ ǫ, which means that the first time we apply Lemma 11 (with T = {D(i) : i ∈ [N ]}) we have sum(TL) ≥ ǫ. 25 By Lemma 11 the probability of failure in any of the (at most M ) iterations is at most δ/9, so we assume that there is never a failure. Consequently for all j we have that if rankSj−1(i∗) ≥ 20ǫ then rankSj (i∗) ≥ 9ǫ, and if ǫ/2 ≤ rankSj−1(i∗) < 20ǫ then rankSj (i∗) ≥ rankSj (i∗) · (1 − ρ) . Since rankS0(i∗) ≥ ǫ, it follows that for all j ≤ M we have rankSj (i∗) ≥ ǫ · (1 − ρ)M > ǫ/2. Proof of Lemma 11. We begin with the following claim: Claim 12 With probability at least 1 − δ/(2M ) (over the random choice of T ′) it holds that sum(T ′L) ≥ 1 2 · sum(TL) · (1 − ρ/2). Proof: Recall from the setup that every element αi ∈ TL satisfies αi ≤ κ/10, and sum(TL) ≥ ǫ/2. Also recall that κ = Ω(ǫ/(M 2 log(1/δ))) and that ρ = ln 2 M , so that ρ2ǫ/(6κ) ≥ ln(2M/δ). The claim follows by applying the first part of Corollary 3 (with γ = ρ/2). Part (1) of Lemma 11 is an immediate consequence of Claim 12, since in part (1) we have sum(T ′L ∪ {αℓ}) sum(T ′ ∪ {αℓ}) ≥ sum(T ′L) ≥ 1 2 · sum(TL) ·(cid:16)1 − ρ 2(cid:17) ≥ 1 2 · 20ǫ ·(cid:16)1 − ρ 2(cid:17) ≥ 9ǫ. It remains to prove Part (2) of the lemma. We will do this using the following claim: Claim 13 Suppose ǫ/2 ≤ sum(TL) ≤ 20ǫ. Then with probability at least 1 − δ/(2M ) (over the random choice of T ′) it holds that sum(T ′R) ≤ 1 2 sum(TR) · (1 + ρ/2). Proof: Observe first that αi < κ for each αi ∈ TR \ H. We consider two cases. If sum(TR \ H) ≥ 4ǫ, then we apply the first part of Corollary 3 to the αi’s in TR \ H and get that Pr(cid:20)sum(T ′R) > 1 2 sum(TR) · (1 + ρ/2)(cid:21) ≤ Pr(cid:20)sum(T ′R) > < exp(−ρ2sum(TR \ H)/24κ) ≤ exp(−ρ2ǫ/(6κ)) ≤ δ 2M 1 2 sum(TR \ H) · (1 + ρ/2)(cid:21) (16) (17) (recall from the proof of Claim 12 that ρ2ǫ/(6κ) ≥ ln(2M/δ)). If sum(TR \ H) < 4ǫ, (so that the expected value of sum(T ′R) is less than 2ǫ) then we can apply the second part of Corollary 3 as we explain next. Observe that by the premise of the lemma, sum(TR) ≥ 1− 20ǫ which is at least 1/2 (recalling that ǫ is at most 1/40). Consequently, the event “sum(T ′R) ≥ 1 4 ”, and by applying the second part of Corollary 3 we get 2 · sum(TR) · (1 + ρ/2)” implies the event “sum(T ′R) ≥ 1 sum(TR) · (1 + ρ/2)(cid:21) ≤ Pr(cid:20)sum(T ′R) > Pr(cid:20)sum(T ′R) > 1 2 1 4(cid:21) < 2−1/4κ < δ 2M , (18) as required. 26 Now we can prove Lemma 11. Using Claims 12 and 13 we have that with probability at least 1 − δ/M , sum(T ′L) ≥ 1 2 · sum(TL) · (1 − ρ/2) and sum(T ′R) ≤ 1 2 sum(TR) · (1 + ρ/2); we assume that both these inequalities hold going forth. Since it is sufficient to show that sum(T ′ L) = sum(T ′L) + αℓ sum(T ′) + αℓ sum(T ′L ∪ {αℓ}) sum(T ′ ∪ {αℓ}) sum(T ′) ≥ sum(TL)(1−ρ); we now show this. As sum(T ′) = sum(T ′L) + sum(T ′R), > sum(T ′L) sum(T ′) , sum(T ′L) sum(T ′) = ≥ = ≥ sum(T ′L) sum(T ′L) + sum(T ′R) = 1 1 + sum(T ′ R) sum(T ′ L) 1 1 + (1/2)·sum(TR)·(1+ρ/2) (1/2)·sum(TL)·(1−ρ/2) sum(TL) · (1 − ρ/2) + sum(TR) · (1 + ρ/2) sum(TL) · (1 − ρ/2) sum(TL) · (1 − ρ/2) = sum(TL) · This concludes the proof of Lemma 11. sum(TL) · (1 + ρ/2) + sum(TR) · (1 + ρ/2) 1 − ρ/2 1 + ρ/2 > sum(TL) · (1 − ρ). 4 Algorithms and lower bounds for testing uniformity 4.1 A O(1/ǫ2)-query PCOND algorithm for testing uniformity In this subsection we present an algorithm PCONDD-Test-Uniform and prove the following the- orem: Theorem 5 PCONDD-Test-Uniform is a O(1/ǫ2)-query PCONDD testing algorithm for unifor- it outputs ACCEPT with probability at least 2/3 if D = U and outputs REJECT with mity, i.e. probability at least 2/3 if dTV(D,U ) ≥ ǫ. Intuition. For the sake of intuition we first describe a simpler approach that yields a O(1/ǫ4)-query algorithm, and then build on those ideas to obtain our real algorithm with its improved O(1/ǫ2) bound. Fix D to be a distribution over [N ] that is ǫ-far from uniform. Let H =(cid:26) h ∈ [N ](cid:12)(cid:12)(cid:12)(cid:12) D(h) ≥ 1 N (cid:27) and L =(cid:26) ℓ ∈ [N ](cid:12)(cid:12)(cid:12)(cid:12) D(ℓ) < 1 N (cid:27) . 27 It is easy to see that since D is ǫ-far from uniform, we have Xh∈H(cid:18)D(h) − From this it is not hard to show that 1 N(cid:19) =Xℓ∈L(cid:18) 1 N − D(ℓ)(cid:19) ≥ ǫ 2 . (19) (i) many elements of [N ] must be “significantly light” in the following sense: Define L′ ⊆ L to 4N (cid:9). Then it must be the case that L′ ≥ (ǫ/4)N. (ii) D places significant weight on elements that are “significantly heavy” in the following sense: N − ǫ be L′ =(cid:8) ℓ ∈ [N ](cid:12)(cid:12) D(ℓ) < 1 Define H′ ⊆ H to be H′ = (cid:8) h ∈ [N ](cid:12)(cid:12) D(h) ≥ 1 D(H′) ≥ (ǫ/4). N + ǫ 4N (cid:9). Then it must be the case that Using (i) and (ii) it is fairly straightforward to give a O(1/ǫ4)-query PCONDD testing algorithm as follows: we can get a point in L′ with high probability by randomly sampling O(1/ǫ) points uniformly at random from [N ], and we can get a point in H′ with high probability by drawing O(1/ǫ) points from SAMPD. Then at least one of the O(1/ǫ2) pairs that have one point from the first sample and one point from the second will have a multiplicative factor difference of 1 + Ω(ǫ) between the weight under D of the two points, and this can be detected by calling the procedure Compare (see Subsection 3.1). Since there are O(1/ǫ2) pairs and for each one the invocation of Compare uses O(1/ǫ2) queries, the overall sample complexity of this simple approach is O(1/ǫ4). Our actual algorithm PCONDD-Test-Uniform for testing uniformity extends the above ideas to get a O(1/ǫ2)-query algorithm. More precisely, the algorithm works as follows: it first draws a “reference sample” of O(1) points uniformly from [N ]. Next, repeatedly for O(cid:0)log 1 algorithm draws two other samples, one uniformly from [N ] and the other from SAMPD. (These samples have different sizes at different iterations; intuitively, each iteration is meant to deal with a different “scale” of probability mass that points could have under D.) At each iteration it then uses Compare to do comparisons between pairs of elements, one from the reference sample and the other from one of the two other samples. If D is ǫ-far from uniform, then with high probability at some iteration the algorithm will either draw a point from SAMPD that has “very big” mass under D, or draw a point from the uniform distribution over [N ] that has “very small” mass under D, and this will be detected by the comparisons to the reference points. Choosing the sample sizes and parameters for the Compare calls carefully at each iteration yields the improved query bound. ǫ(cid:1) iterations, the Let mj denote the number of PCONDD queries used to run CompareD in a given execution of Line 7 during the j-th iteration of the outer loop. By the setting of the parameters in each such call and Lemma 2, mj = O(cid:0) t ǫ222j(cid:1). It is easy to see that the algorithm only performs PCONDD queries and that the total number of queries that the algorithm performs is O tXj=1 q · sj · mj = O tXj=1 ǫ(cid:19) · 2j log(cid:18) 1 log( 1 ǫ ) ǫ222j  = O (log( 1 ǫ ))2 ǫ2 ! . We prove Theorem 5 by arguing completeness and soundness below. Completeness: Suppose that D is the uniform distribution. Then for any fixed pair of points (x, y), Lemma 2 implies that the call to Compare on {x},{y} in Line 7 causes the algorithm to 28 Algorithm 4: PCONDD-Test-Uniform ǫ ) + 1. Input: error parameter ǫ > 0; query access to PCONDD oracle 1: Set t = log( 4 2: Select q = Θ(1) points i1, . . . , iq independently and uniformly from [N ]. 3: for j = 1 to t do 4: Call the SAMPD oracle sj = Θ(cid:0)2j · t(cid:1) times to obtain points h1, . . . , hsj distributed according to D. Select sj points ℓ1, . . . , ℓsj independently and uniformly from [N ]. for all pairs (x, y) = (ir, hr′) and (x, y) = (ir, ℓr′) (where 1 ≤ r ≤ q, 1 ≤ r′ ≤ sj) do Call CompareD({x},{y}, Θ(ǫ2j ), 2, exp(−Θ(t))). if the Compare call does not return a value in [1 − 2j−5 ǫ end if end for output REJECT (and exit). 4 , 1 + 2j−5 ǫ 4 ] then 5: 6: 7: 8: 9: 10: 11: 12: end for 13: Output ACCEPT output REJECT in Line 9 with probability at most e−Θ(t) = poly(ǫ). By taking a union bound over all poly(1/ǫ) pairs of points considered by the algorithm, the algorithm will accept with probability at least 2/3, as required. Soundness: Now suppose that D is ǫ-far from uniform (we assume throughout the analysis that ǫ = 1/2k for some integer k, which is clearly without loss of generality). We define H, L as above and further partition H and L into “buckets” as follows: for j = 1, . . . , t − 1 = log( 4 N (cid:27) , N (cid:27) . and for j = 1, . . . , t − 2 let ǫ ), let 1 N Hj Lj def 1 1 1 ǫ ǫ ǫ ǫ 1 = (cid:26) h(cid:12)(cid:12)(cid:12)(cid:12)(cid:16)1 + 2j−1 · 4(cid:17) · def= (cid:26) ℓ(cid:12)(cid:12)(cid:12)(cid:12)(cid:16)1 − 2j · 4(cid:17) · N (cid:27) , L0 4(cid:17) · N ≤ D(h) <(cid:16)1 + def= (cid:26) h(cid:12)(cid:12)(cid:12)(cid:12) D(h) ≥ N (cid:27) , Lt−1 Xh∈H0(cid:18)D(h) − N(cid:19) ≤ 4(cid:17) · N ≤ D(h) <(cid:16)1 + 2j · 4(cid:17) · < D(ℓ) ≤(cid:16)1 − 2j−1 · = (cid:26) ℓ(cid:12)(cid:12)(cid:12)(cid:12)(cid:16)1 − 4(cid:17) · def= (cid:26) ℓ(cid:12)(cid:12)(cid:12)(cid:12) D(ℓ) ≤ 2N (cid:27) . N − D(ℓ)(cid:19) ≤ and Xℓ∈L0(cid:18) 1 1 N Ht ǫ 4 ǫ 4 def 1 2 1 1 ǫ ǫ . Also define H0 def = (cid:26) h(cid:12)(cid:12)(cid:12)(cid:12) and First observe that by the definition of H0 and L0, we have < D(ℓ) < 1 N (cid:27) , 29 Therefore (by Equation (19)) we have tXj=1 Xh∈Hj(cid:18)D(h) − Xh∈Hj(H)(cid:18)D(h) − 1 N(cid:19) ≥ ǫ 4 N − D(ℓ)(cid:19) ≥ ǫ 4 . and t−1Xj=1Xℓ∈Lj(cid:18) 1 and Xℓ∈Lj(L)(cid:18) 1 This implies that for some 1 ≤ j(H) ≤ t, and some 1 ≤ j(L) ≤ t − 1, we have ǫ 4t ǫ 4t N − D(ℓ)(cid:19) ≥ N(cid:19) ≥ 1 . (20) The rest of the analysis is divided into two cases depending on whether L ≥ N 2 or H > N 2 . 2 . In this case, with probability at least 99/100, in Line 2 the algorithm will select Case 1: L ≥ N at least one point ir ∈ L. We consider two subcases: j(H) = t, and j(H) ≤ t − 1. • j(H) = t: In this subcase, by Equation (20) we have thatPh∈Hj(H) D(h) ≥ ǫ ǫ ) + 1, so that sj = st = Θ(cid:0) t that when j = j(H) = t = log( 4 99/100 the algorithm selects a point hr′ ∈ Ht in Line 4. Assume that indeed such a point hr′ is selected. Since D(hr′) ≥ 2 N , Lemma 2 implies that with probability at least 1 − poly(ǫ) the Compare call in Line 7 outputs either High or a value that is at least 12 = 1 ǫ(cid:1), with probability at least 4 for j = t, the algorithm will output REJECT in Line 9. N , while D(ir) < 1 4t . This implies 12 . Since 7 2 + 2j−5 ǫ 12 > 1 2 + 1 7 • j(H) < t: By Equation (20) and the definition of the buckets, we have Xh∈Hj(H)(cid:18)(cid:16)1 + 2j(H) ǫ 4(cid:17) 1 so that D(Hj(H)) ≥ 1 N − 1 N(cid:19) ≥ ǫ 4t , implying that(cid:12)(cid:12)Hj(H)(cid:12)(cid:12) ≥ N sj = Θ(cid:0)2j(H)t(cid:1), with probability at least 99/100 the algorithm will get a point hr′ ∈ Hj(H) in Line 4. Assume that indeed such a point hr′ is selected. Since D(hr′) ≥(cid:0)1 + 2j(H)−1 ǫ 4(cid:1) 1 while D(ir) ≤ 1 . Therefore, when j = j(H) so that N , for αj(H) = 2j(H)−1 ǫ 4 , we have N , 2j(H)t 2j(H)t D(hr′) D(ir) ≥ 1 + αj(H) . Since Compare is called in Line 7 on the pair {ir},{hr′} with the “δ” parameter set to Θ(ǫ2j), with probability 1− poly(ǫ) the algorithm outputs REJECT as a result of this Compare call. H > N 2 . This proceeds similarly to Case 1. Case 2: In this case we have that with high constant probability the algorithm selects a point ir ∈ H in Line 2. Here we consider the subcases 4t )N , . The analysis j(L) = t − 1 and j(L) ≤ t − 2. In the first subcase we have thatPℓ∈Lt and in the second case we have thatPℓ∈Lj(L) of each subcase is similar to Case 1. This concludes the proof of Theorem 5. 4t , so that(cid:12)(cid:12)Lj(L)(cid:12)(cid:12) ≥ N 4t , so that Lt ≥ ( ǫ N ≥ ǫ N ≥ ǫ (2j(L) ǫ 4 ) 1 2j(L)t 1 30 4.2 An Ω(1/ǫ2) lower bound for CONDD algorithms that test uniformity In this subsection we give a lower bound showing that the query complexity of the PCONDD algorithm of the previous subsection is essentially optimal, even for algorithms that may make general CONDD queries: Theorem 6 Any CONDD algorithm for testing whether D = U versus dTV(D,U ) ≥ ǫ must make Ω(1/ǫ2) queries. The high-level idea behind Theorem 6 is to reduce it to the well-known fact that distinguishing a fair coin from a ( 1 algorithm CONDD testing algorithm A can be transformed into an algorithm A′ that successfully distinguishes q tosses of a fair coin from q tosses of a ( 1 ǫ2(cid:1) coin tosses. We show that any q-query 2 + 4ǫ)-biased coin requires Ω(cid:0) 1 2 + 4ǫ)-biased coin. Proof of Theorem 6: First note that we may assume without loss of generality that 0 < ǫ ≤ 1/8. Let A be any q-query algorithm that makes CONDD queries and tests whether D = U versus dTV(D,U ) ≥ ǫ. We may assume without loss of generality that in every possible execution algorithm A makes precisely q queries (this will be convenient later). for each i ∈(cid:2) N Let DNo be the distribution that has DNo(i) = 1+2ǫ distance from the uniform distribution U .) By Definition 2, it must be the case that 2(cid:3) and has DNo(i) = 1−2ǫ 2 + 1, N(cid:3) . (This is the “no”-distribution for our lower bound; it is ǫ-far in variation Z :=(cid:12)(cid:12)(cid:12)PrhACONDDNo outputs ACCEPTi − PrhACONDU outputs ACCEPTi(cid:12)(cid:12)(cid:12) ≥ 1/3. N for each i ∈(cid:2)1, N The proof works by showing that given A as described above, there must exist an algorithm A′ with the following properties: A′ is given as input a q-bit string (b1, . . . , bq) ∈ {0, 1}q . Let D0 denote the uniform distribution over {0, 1}q and let D4ǫ denote the distribution over {0, 1}q in which each coordinate is independently set to 1 with probability 1/2 + 4ǫ. Then algorithm A′ has N (cid:12)(cid:12)Prb∼D0[A′(b) outputs ACCEPT] − Prb∼D4ǫ[A′(b) outputs ACCEPT](cid:12)(cid:12) = Z. Given (21), by the data processing inequality for total variation distance (Lemma 1) we have that Z ≤ dTV(D0, D4ǫ). It is easy to see that dTV(D0, D4ǫ) is precisely equal to the variation distance dTV(Bin(q, 1/2), Bin(q, 1/2 + 4ǫ)). However, in order for the variation distance between these two binomial distributions to be as large as 1/3 it must be the case that q ≥ Ω(1/ǫ2): Fact 14 (Distinguishing Fair from Biased Coin) Suppose m ≤ c constant and ǫ ≤ 1/8. Then, + 4ǫ(cid:19)(cid:19) ≤ dTV(cid:18)Bin(cid:18)m, 2(cid:19) , Bin(cid:18)m, ǫ2 , with c a sufficiently small (21) 1 1 2 1 3 . (Fact 14 is well known; it follows, for example, as an immediate consequence of Equations (2.15) and (2.16) of [AJ06].) Thus to prove Theorem 6 it remains only to describe algorithm A′ and prove Equation (21). 31 As suggested above, algorithm A′ uses algorithm A; in order to do this, it must perfectly simulate the CONDD oracle that A requires, both in the case when D = U and in the case when D = DNo. We show below that when its input b is drawn from D0 then A′ can perfectly simulate the execution of A when it is run on the CONDU oracle, and when b is drawn from D4ǫ then A′ can perfectly simulate the execution of A when it is run on the CONDDNo oracle. Fix any step 1 ≤ t ≤ q. We now describe how A′ perfectly simulates the t-th step of the execution of A (i.e. the t-th call to CONDD that A makes, and the response of CONDD). We may inductively assume that A′ has perfectly simulated the first t − 1 steps of the execution of A. For each possible prefix of t − 1 query-response pairs to CONDD PREFIX = ((S1, s1), ..., (St−1, st−1)) (where each Si ⊆ [N ] and each si ∈ Si), there is some distribution PA,PREFIX over possible t-th query sets St that A would make given that its first t − 1 query-response pairs were PREFIX . So for a set St ⊆ [N ] and a possible prefix PREFIX , the value PA,PREFIX (St) is the probability that algorithm A, having had the transcript of its execution thus far be PREFIX , generates set St as its t-th query set. For any query set S ⊆ [N ], let us write S as a disjoint union S = S0 ∐ S1, 2 + 1, N ]. We may assume that every query S ever used by A has S0 ,S1 ≥ 1 (for otherwise A could perfectly simulate the response of CONDD(S) whether D were U or DNo by simply choosing a uniform point from S, so there would be no need to call CONDD on such an S). Thus we may assume that PA,PREFIX (S) is nonzero only for sets S that have S0,S1 ≥ 1. where S0 = S ∩(cid:2)1, N 2(cid:3) and S1 = S ∩ [ N Consider the bit bt ∈ {0, 1}. As noted above, we inductively have that (whether D is U or DNo) the algorithm A′ has perfectly simulated the execution of A for its first t − 1 query-response pairs; in this simulation some prefix PREFIX = ((S1, s1), . . . , (St−1, st−1)) of query-response pairs has been constructed. If b = (b1, . . . , bq) is distributed according to D0 then PREFIX is distributed exactly according to the distribution of A’s prefixes of length t − 1 when A is run with CONDU , and if b = (b1, . . . , bq) is distributed according to D4ǫ then the distribution of PREFIX is exactly the distribution of A’s prefixes of length t − 1 when A is run with CONDDNo. Algorithm A′ simulates the t-th stage of the execution of A as follows: 1. Randomly choose a set S ⊆ [N ] according to the distribution PA,PREFIX ; let S = S0 ∐ S1 be the set that is selected. Let us write α(S) to denote S1/S0 (so α(S) ∈ [2/N, N/2]). 2. If bt = 1 then set the bit σ ∈ {0, 1} to be 1 with probability ut and to be 0 with probability 1 − ut. If bt = 0 then set σ to be 1 with probability vt and to be 0 with probability 1 − vt. (We specify the exact values of ut, vt below.) 3. Set s to be a uniform random element of Sσ. Output the query-response pair (St, st) = (S, s). It is clear that Step 1 above perfectly simulates the t-th query that algorithm A would make (no matter what is the distribution D). To show that the t-th response is simulated perfectly, we must show that 32 (i) if bt is uniform random over {0, 1} then s is distributed exactly as it would be distributed if A were being run on CONDU and had just proposed S as a query to CONDU ; i.e. we must α+1 and is a uniform show that s is a uniform random element of S1 with probability p(α) random element of S0 with probability 1 − p(α). def = α (ii) if bt ∈ {0, 1} has Pr[bt = 1] = 1/2 + 4ǫ, then s is distributed exactly as it would be distributed if A were being run on CONDDNo and had just proposed S as a query to CONDU ; i.e. we must show that s is a uniform random element of S1 with probability q(α) α+(1+2ǫ)/(1−2ǫ) and is a uniform random element of S0 with probability 1 − q(α). def = α By (i), we require that and by (ii) we require that ut 2 + vt 2 = p(α) = α α + 1 , (cid:18) 1 2 + 4ǫ(cid:19) ut +(cid:18) 1 2 − 4ǫ(cid:19) vt = q(α) = α α + 1+2ǫ 1−2ǫ (22) (23) It is straightforward to check that ut = α α + 1(cid:18)1 − 2((1 − 2ǫ)α + 1 + 2ǫ)(cid:19) , 1 vt = α α + 1(cid:18)1 + 2((1 − 2ǫ)α + 1 + 2ǫ)(cid:19) 1 satisfy the above equations, and that for 0 < α, 0 < ǫ ≤ 1/8 we have 0 ≤ ut, vt ≤ 1. So indeed A′ perfectly simulates the execution of A in all stages t = 1, . . . , q. Finally, after simulating the t-th stage algorithm A′ outputs whatever is output by its simulation of A, so Equation (21) indeed holds. This concludes the proof of Theorem 6. 5 Testing equivalence to a known distribution D∗ 5.1 A poly(log n, 1/ǫ)-query PCONDD algorithm In this subsection we present an algorithm PCOND-Test-Known and prove the following theorem: Theorem 7 PCOND-Test-Known is a O((log N )4/ǫ4)-query PCONDD testing algorithm for test- ing equivalence to a known distribution D∗. That is, for every pair of distributions D, D∗ over [N ] (such that D∗ is fully specified and there is PCOND query access to D) the algorithm outputs AC- CEPT with probability at least 2/3 if D = D∗ and outputs REJECT with probability at least 2/3 if dTV(D, D∗) ≥ ǫ. Intuition. Let D∗ be a fully specified distribution, and let D be a distribution that may be accessed via a PCONDD oracle. The high-level idea of the PCOND-Test-Known algorithm is the following: As in the case of testing uniformity, we shall try to “catch” a pair of points x, y such that D(x) D∗(y) (so that calling CompareD on {x},{y} will reveal this D(y) differs significantly from D∗(x) 33 difference). In the uniformity case, where D∗(z) = 1/N for every z (so that D∗(x)+D∗(y) = 1/2), to get a poly(1/ǫ)-query algorithm it was sufficient to show that sampling Θ(1/ǫ) points uniformly (i.e., according to D∗) with high probability yields a point x for which D(x) < D∗(x) − Ω(ǫ/N ), and that sampling Θ(1/ǫ) points from SAMPD with high probability yields a point y for which D(x) > D∗(y) + Ω(ǫ/N ). However, for general D∗ it is not sufficient to get such a pair because it is possible that D∗(y) could be much larger than D∗(x). If this were the case then it might happen that both D∗(x) D(y) are very small, so calling CompareD on {x},{y} cannot efficiently demonstrate that D∗(x) D∗(y) and D(x) D∗(y) differs from D(x) D(y) . D∗(x) To address this issue we partition the points into O(log N/ǫ) “buckets” so that within each bucket all points have similar probability according to D∗. We show that if D is ǫ-far from D∗, then either the probability weight of one of these buckets according to D differs significantly from what it is according to D∗ (which can be observed by sampling from D), or we can get a pair {x, y} that belong to the same bucket and for which D(x) is sufficiently smaller than D∗(x) and D(y) is sufficiently larger than D∗(y). For such a pair Compare will efficiently give evidence that D differs from D∗. The algorithm and its analysis. We define some quantities that are used in the algorithm and def = ǫ/c for some sufficiently large constant c that will be determined later. As its analysis. Let η described above we partition the domain elements [N ] into “buckets” according to their probability weight in D∗. Specifically, for j = 1, . . . ,⌈log(N/η) + 1⌉, we let Bj def = {x ∈ [N ] : 2j−1 · η/N ≤ D∗(x) < 2j · η/N} (24) and we let B0 buckets. = {x ∈ [N ] : D∗(x) < η/N}. Let b = ⌈log(N/η) + 1⌉ + 1 denote the number of We further define J h def= {j : D∗(Bj) ≥ η/b} to denote the set of indices of “heavy” buckets, = {j : D∗(Bj) < η/b} denote the set of indices of “light” buckets. Note that we have (25) D∗(Bj) < 2η. and let J ℓ def def def Xj∈J ℓ∪{0} The query complexity of the algorithm is dominated by the number of PCONDD queries per- formed in the executions of Compare, which by Lemma 2 is upper bounded by O(s2 · b2 · (log s)/η2) = O (log N ǫ )4 · log(cid:0)(log N ǫ )/ǫ(cid:1) ǫ4 ! . We argue completeness and soundness below. Completeness: Suppose that D = D∗. Since the expected value of bD(Bj) (defined in Line 3) is precisely D∗(Bj), for any fixed value of j ∈ {0, . . . ,⌈log(N/η) + 1⌉} an additive Chernoff bound implies that (cid:12)(cid:12)(cid:12)D∗(Bj) − bD(Bj)(cid:12)(cid:12)(cid:12) >η/b with failure probability at most 1/(10b). By a union bound over all b values of j, the algorithm outputs REJECT in Line 5 with probability at most 1/10. 34 Algorithm 5: PCONDD-Test-Known Input: error parameter ǫ > 0; query access to PCONDD oracle; explicit description (D∗(1), . . . , D∗(N )) of distribution D∗ 1: Call the SAMPD oracle m = Θ(b2(log b)/η2) times to obtain points h1, . . . , hm distributed according to D. 2: for j = 0 to b do 3: output REJECT and exit defined in Equation (24)). Let bD(Bj) be the fraction of points h1, . . . , hm that lie in Bj (where the buckets Bj are as if some j has D∗(Bj) − bD(Bj) > η/b then end if 6: 7: end for 8: Select s = Θ(b/ǫ) points x1, . . . , xs independently from D∗. 9: Call the SAMPD oracle s = Θ(b/ǫ) times to obtain points y1, . . . , ys distributed according to 10: for all pairs (xi, yj) (where 1 ≤ i, j ≤ s) such that D∗(x) D∗(y) ∈ [1/2, 2] do Call Compare({x},{y}, η/(4b), 2, 1/(10s2 )) if Compare returns Low or a value smaller than (1 − η/(2b)) · D∗(x) D∗(y) then 4: 5: 11: 12: 13: D. output REJECT (and exit) end if 14: 15: end for 16: output ACCEPT 35 Later in the algorithm, since D = D∗, no matter what points xi, yj are sampled from D∗ and D respectively, the following holds for each pair (xi, yj) such that D∗(x)/D∗(y) ∈ [1/2, 2]. By Lemma 2 (and the setting of the parameters in the calls to Compare), the probability that Compare returns Low or a value smaller than (1 − δ/(2b)) · (D∗(x)/D∗(y)), is at most 1/(10s2). A union bound over all (at most s2) pairs (xi, yj) for which D∗(x)/D∗(y) ∈ [1/2, 2], gives that the probability of outputting REJECT in Line 13 is at most 1/10. Thus with overall probability at least 8/10 the algorithm outputs ACCEPT. Soundness: Now suppose that dTV(D, D∗) ≥ ǫ; our goal is to show that the algorithm rejects with probability at least 2/3. Since the algorithm rejects if any estimate bD(Bj) obtained in Line 3 deviates from D∗(Bj) by more than ±η/b, we may assume that all these estimates are indeed ±η/b-close to the values D∗(Bj) as required. Moreover, by an additive Chernoff bound (as in the completeness analysis), we have that with overall failure probability at most 1/10, each j has bD(Bj) − D(Bj) ≤ η/b; we condition on this event going forth. Thus, for every 0 ≤ j ≤ b, D∗(Bj) − 2η/b ≤ D(Bj) ≤ D∗(Bj) + 2η/b . (26) Recalling the definition of J ℓ and Equation (25), we see that Let D∗(x) − D(x) , so that kD∗ − Dk1 =Pj dj. By Equations (25) and (27), we have Xj∈J ℓ∪{0} (D∗(Bj) + D(Bj)) ≤ 6η . Since we have (by assumption) that kD∗ − Dk1 = 2dTV(D∗, D) ≥ 2ǫ, we get that dj > 2ǫ − 6η . D(Bj) < 4η . def dj Xj∈J ℓ∪{0} = Xx∈Bj dj ≤ Xj∈J ℓ∪{0} Xj∈J h\{0} (27) (28) (29) (30) Let Nj def= Bj and observe that Nj ≤ D∗(Bj)/pj ≤ 1/pj , where pj def= 2j−1 · η/N is the lower bound on the probability (under D∗) of all elements in Bj. For each Bj such that j ∈ J h \ {0}, let = {x ∈ Bj : D(x) < D∗(x)}. Similarly to the “testing Hj uniformity” analysis, we have that = {x ∈ Bj : D(x) > D∗(x)} and Lj def def Xx∈Lj (D∗(x) − D(x)) + Xx∈Hj (D(x) − D∗(x)) = dj . Equation (26) may be rewritten as (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xx∈Lj (D∗(x) − D(x)) − Xx∈Hj 36 (D(x) − D∗(x))(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ 2η/b , (31) (32) and so we have both Xx∈Lj (D∗(x) − D(x)) ≥ dj/2 − η/b and Xx∈Hj (D(x) − D∗(x)) ≥ dj/2 − η/b . (33) : D(x) > D∗(x) + η/(bNj)}, and = {x ∈ Bj : D(x) < D∗(x) − η/(bNj )} (recall that Nj = Bj); these are the elements of Bj Also similarly to what we had before, let H′j L′j that are “significantly heavier” (lighter, respectively) under D than under D∗. We have def= {x ∈ Bj def Xx∈Lj\L′ j (D∗(x) − D(x)) ≤ η/b and Xx∈Hj\H ′ j (D(x) − D∗(x)) ≤ η/b . (34) By Equation (30), there exists j∗ ∈ J h\{0} for which dj∗ ≥ (2ǫ−6η)/b. For this index, applying Equations (33) and (34), we get that and similarly, j∗ Xx∈L′ Xx∈H ′ j∗ D∗(x) ≥ Xx∈L′ D(x) ≥ Xx∈H ′ j∗ (D∗(x) − D(x)) ≥ (ǫ − 5η)/b , j∗ (D(x) − D∗(x)) ≥ (ǫ − 5η)/b . (35) (36) Recalling that η = ǫ/c and setting the constant c to 6, we have that (ǫ − 5η)/b = ǫ/6b. Since s = Θ(b/ǫ), with probability at least 9/10 it is the case both that some xi drawn in Line 8 belongs to L′j∗ and that some yi′ drawn in Line 9 belongs to H′j∗. By the definitions of L′j∗ and H′j∗ and the fact for each j > 0 it holds that Nj ≤ 1/pj and pj ≤ D∗(x) < 2pj for each xi ∈ Bj, we have that (37) D(xi) < D∗(xi) − η/(bNj∗ ) ≤ D∗(xi) − (η/b)pj∗ ≤ (1 − η/(2b))D∗(xi) and Therefore, D(yi′) > D∗(yi′) + η/(bNj∗ ) ≥ D∗(yi′) + (η/b)pj ≥ (1 + η/(2b))D∗(yi′) . D(xi) D(yi′) < 1 − η/(2b) 1 + η/(2b) · D∗(xi) D∗(yi′) <(cid:18)1 − 3η 4b(cid:19) · D∗(xi) D∗(yi′) . (38) (39) By Lemma 2, with probability at least 1 − 1/(10s2), the output of Compare is either Low or is at most(cid:16)1 − 3η 2b(cid:1), causing the algorithm to reject. Thus the overall probability that the algorithm outputs REJECT is at least 8/10 − 1/(10s2) > 2/3, and the theorem is proved. 4b(cid:1) <(cid:0)1 − η 4b(cid:17) ·(cid:0)1 + η 5.2 A (log N)Ω(1) lower bound for PCONDD In this subsection we prove that any PCONDD algorithm for testing equivalence to a known distri- bution must have query complexity at least (log N )Ω(1): 37 log log N(cid:17) queries. Theorem 8 Fix ǫ = 1/2. There is a distribution D∗ over [N ] (described below), which is such that any PCONDD algorithm for testing whether D = D∗ versus dTV(D, D∗) ≥ ǫ must make Ω(cid:16)q log N The distribution D∗. Fix parameters r = Θ(cid:16) log N log log N(cid:17) and K = Θ(log N ). We partition [N ] from left (1) to right (N ) into 2r consecutive intervals B1, . . . , B2r, which we henceforth refer to as “buckets.” The i-th bucket has Bi = K i (we may assume without loss of generality that N is of the formP2r i=1 K i). The distribution D∗ assigns equal probability weight to each bucket, so D∗(Bi) = 1/(2r) for all 1 ≤ i ≤ 2r. Moreover D∗ is uniform within each bucket, so for all j ∈ Bi we have D∗(j) = 1/(2rK i). This completes the specification of D∗. To prove the lower bound we construct a probability distribution PNo over possible “No”- distributions. To define the distribution PNo it will be useful to have the notion of a “bucket-pair.” A bucket-pair Ui is Ui = B2i−1 ∪ B2i, i.e. the union of the i-th pair of consecutive buckets. A distribution D drawn from PNo is obtained by selecting a string π = (π1, . . . , πr) uniformly at random from {↓↑,↑↓}r and setting D to be Dπ, which we now define. The distribution Dπ is obtained by perturbing D∗ in the following way: for each bucket-pair Ui = (B2i−1, B2i), • If πi =↑↓ then the weight of B2i−1 is uniformly “scaled up” from 1/(2r) to 3/(4r) (keeping the distribution uniform within B2i−1) and the weight of B2i is uniformly “scaled down” from 1/(2r) to 1/(4r) (likewise keeping the distribution uniform within B2i). • If πi =↓↑ then the weight of B2i−1 is uniformly “scaled down” from 1/(2r) to 1/(4r) and the weight of B2i is uniformly “scaled up” from 1/(2r) to 3/(4r). Note that for any distribution D in the support of PNo and any 1 ≤ i ≤ r we have that D(Ui) = D∗(Ui) = 1/r. Every distribution D in the support of PNo has dTV(D∗, D) = 1/2. Thus Theorem 8 follows immediately from the following: Theorem 9 Let A be any (possibly adaptive) algorithm. which makes at most q ≤ 1 PCONDD. Then 3 · √r calls to (cid:12)(cid:12)(cid:12)PrD←PNohAPCONDD outputs ACCEPTi − PrhAPCONDD∗ outputs ACCEPTi(cid:12)(cid:12)(cid:12) ≤ 1/5. Note that in the first probability of Equation (40) the randomness is over the draw of D from PNo, the internal randomness of A in selecting its query sets, and the randomness of the responses to the PCONDD queries. In the second probability the randomness is just over the internal coin tosses of A and the randomness of the responses to the PCONDD queries. (40) Intuition for Theorem 9. A very high-level intuition for the lower bound is that PCONDD queries are only useful for “comparing” points whose probabilities are within a reasonable multiplicative ratio of each other. But D∗ and every distribution D in the support of P No are such that every 38 two points either have the same probability mass under all of these distributions (so a PCONDD query is not informative), or else the ratio of their probabilities is so skewed that a small number of PCONDD queries is not useful for comparing them. In more detail, we may suppose without loss of generality that in every possible execution, algorithm A first makes q calls to SAMPD and then makes q (possibly adaptive) calls to PCONDD. The more detailed intuition for the lower bound is as follows: First consider the SAMPD calls. Since every possible D (whether D∗ or a distribution drawn from PNo) puts weight 1/r on each bucket- pair U1, . . . , Ur, a birthday paradox argument implies that in both scenarios, with probability at 3√r least 9/10 (over the randomness in the responses to the SAMPD queries) no two of the q ≤ 1 calls to SAMPD return points from the same bucket-pair. Conditioned on this, the distribution of responses to the SAMPD queries is exactly the same under D∗ and under D where D is drawn randomly from PNo. For the pair queries, the intuition is that in either setting (whether the distribution D is D∗ or a randomly chosen distribution from PNo), making q pair queries will with 1 − o(1) probability provide no information that the tester could not simulate for itself. This is because any pair query PCONDD({x, y}) either has x, y in the same bucket Bi or in different buckets Bi 6= Bj with i < j. If x, y are both in the same bucket Bi then in either setting PCONDD({x, y}) is equally likely to return x or y. If they belong to buckets Bi, Bj with i < j then in either setting PCONDD({x, y}) will return the one that belongs to Pi with probability 1 − 1/Θ(K j−i) ≥ 1 − 1/Ω(K). Proof of Theorem 9: As described above, we may fix A to be any PCONDD algorithm that makes exactly q calls to SAMPD followed by exactly q adaptive calls to PCONDD. A transcript for A is a full specification of the sequence of interactions that A has with the PCONDD oracle in a given execution. More precisely, it is a pair (Y, Z) where Y = (s1, . . . , sq) ∈ [N ]q and Z = (({x1, y1}, p1), . . . , ({xq, yq}, pq)), where pi ∈ {xi, yi} and xi, yi ∈ [N ]. The idea is that Y is a possible sequence of responses that A might receive to the initial q SAMPD queries, {xi, yi} is a possible pair that could be the input to an i-th PCONDD query, and pi is a possible response that could be received from that query. We say that a length-i transcript prefix is a pair (Y, Z i) where Y is as above and Z i = (({x1, y1}, p1), . . . , ({xi, yi}, pi)). A PCOND algorithm A may be viewed as a collection of distribu- tions over pairs {x, y} in the following way: for each length-i transcript-prefix (Y, Z i) (0 ≤ i ≤ q−1), there is a distribution over pairs {xi+1, yi+1} that A would use to select the (i + 1)-st query pair for PCONDD given that the length-i transcript prefix of A’s execution thus far was (Y, Z i). We write T(Y,Z i) to denote this distribution over pairs. Let P∗ denote the distribution over transcripts induced by running A with oracle PCONDD∗. Let PNo denote the distribution over transcripts induced by first (i) drawing D from PNo, and then (ii) running A with oracle PCONDD. To prove Theorem 9 it is sufficient to prove that the distribution over transcripts of A is statistically close whether the oracle is D∗ or is a random D drawn from P No, i.e. it is sufficient to prove that dTV(P∗, PNo) ≤ 1/5. (41) For our analysis we will need to consider variants of algorithm A that, rather than making q calls to PCONDD, instead “fake” the final q − k of these PCONDD queries as described below. For 39 0 ≤ k ≤ q we define A(k) to be the algorithm that works as follows: 1. A(k) exactly simulates the execution of A in making an initial q SAMPD calls and making the first k PCONDD queries precisely like A. Let (Y, Z k) be the length-k transcript prefix of A’s execution thus obtained. 2. Exactly like A, algorithm A(k) draws a pair {xk+1, yk+1} from T(Y,Z k). However, instead of calling PCONDD({xk+1, yk+1}) to obtain pk+1, algorithm A(k) generates pk+1 in the following manner: (i) If xk+1 and yk+1 both belong to the same bucket Bℓ then pk+1 is chosen uniformly from {xk+1, yk+1}. (ii) If one of {xk+1, yk+1} belongs to Bℓ and the other belongs to Bℓ′ for some ℓ < ℓ′, then pk+1 is set to be the element of {xk+1, yk+1} that belongs to Bℓ. Let (Y, Z k+1) be the length-(k+1) transcript prefix obtained by appending ({xk+1, yk+1}, pk+1) to Z k. Algorithm A(k) continues in this way for a total of q − k stages; i.e. it next draws {xk+2, yk+2} from T(Y,Z k+1) and generates pk+2 as described above; then (Y, Z k+2) is the length-(k + 2) transcript prefix obtained by appending ({xk+2, yk+2}, pk+2) to Z k+1; and so on. At the end of the process a transcript (Y, Z q) has been constructed. Let P∗,(k) denote the distribution over final transcripts (Y, Z q) that are obtained by running A(k) on a PCONDD∗ oracle. Let PNo,(k) denote the distribution over final transcripts (Y, Z q) that are obtained by (i) first drawing D from P No, and then (ii) running A(k) on a PCONDD oracle. Note that P∗,(q) is identical to P∗ and PNo,(q) is identical to PNo (since algorithm A(q), which does not fake any queries, is identical to algorithm A). Recall that our goal is to prove Equation (41). Since P∗,(q) = P∗ and PNo,(q) = PNo, Equa- tion (41) is an immediate consequence (using the triangle inequality for total variation distance) of the following two lemmas, which we prove below: Lemma 15 dTV(P∗,(0), PNo,(0)) ≤ 1/10. Lemma 16 For all 0 ≤ k < q, we have dTV(P∗,(k), P∗,(k+1)) ≤ 1/(20q) and dTV(PNo,(k), PNo,(k+1)) ≤ 1/(20q). Proof of Lemma 15: Define P∗0 to be the distribution over outcomes of the q calls to SAMPD (i.e. over length-0 transcript prefixes) when D = D∗. Define PNo to be the distribution over outcomes of the q calls to SAMPD when D is drawn from PNo. We begin by noting that by the data processing (Lemma 1), we have dTV(P∗,(0), PNo,(0)) ≤ dTV(P∗0, PNo inequality for total variation distance 0 ) (indeed, after the calls to respectively SAMPD and SAMPD∗, the same randomized function F – which fakes all remaining oracle calls – is applied to the two resulting distributions over length-0 transcript prefixes P∗0 and PNo 0 ). In the rest of the proof we show that dTV(P∗0, PNo 0 ) ≤ 1/10. 40 Let E denote the event that the q calls to SAMPD yield points s1, . . . , sq such that no bucket-pair Ui contains more than one of these points. Since D∗(Ui) = 1/r for all i, P∗0(E) = q−1Yj=0(cid:18)1 − j r(cid:19) ≥ 9/10 , (42) 3√r. where Equation (42) follows from a standard birthday paradox analysis and the fact that q ≤ 1 Since for each possible outcome of D drawn from PNo we have D(Ui) = 1/r for all i, we further have that also PNo 0 (E) = q−1Yj=0(cid:18)1 − j r(cid:19) . (43) We moreover claim that the two conditional distributions (P∗0E) and (PNo 0 E) are identical, i.e. (P∗0E) = (PNo 0 E). (44) To see this, fix any sequence (ℓ1, . . . , ℓq) ∈ [r]q such that ℓi 6= ℓj for all i 6= j. Let (s1, . . . , sq) ∈ [N ]q denote a draw from (P∗0E). The probability that (si ∈ Uℓi for all 1 ≤ i ≤ q) is precisely 1/rq. Now given that si ∈ Uℓi for all i, it is clear that si is equally likely to lie in B2ℓi−1 and in B2ℓi, and given that it lies in a particular one of the two buckets, it is equally likely to be any element in that bucket. This is true independently for all 1 ≤ i ≤ q. Now let (s1, . . . , sq) ∈ [N ]q denote a draw from (PNo 0 E). Since each distribution D in the support of PNo has D(Ui) = 1/r for all i, we likewise have that the probability that (si ∈ Uℓi for all 1 ≤ i ≤ q) is precisely 1/rq. Now given that si ∈ Uℓi for all i, we have that si is equally likely to lie in B2ℓi−1 and in B2ℓi; this is because πi (recall that π determines D = Dπ) is equally likely to be ↑↓ (in which case D(B2ℓi−1) = 3/(4r) and D(B2ℓi) = 1/(4r)) as it is to be ↓↑ (in which case D(B2ℓi−1) = 1/(4r) and D(B2ℓi) = 3/(4r)). Additionally, given that si lies in a particular one of the two buckets, it is equally likely to be any element in that bucket. This is true independently for all 1 ≤ i ≤ q (because conditioning on E ensures that no two elements of s1, . . . , sq lie in the same bucket-pair, so there is “fresh randomness for each i”), and so indeed the two conditional distributions (P∗0E) and (PNo 0 E) are identical. Finally, the claimed bound dTV(P∗0, PNo 0 ) ≤ 1/10 follows directly from Equations (42), (43) and (44). Proof of Lemma 16: Consider first the claim that dTV(P∗,(k), P∗,(k+1)) ≤ 1/(20q). Fix any 0 ≤ k < q. The data processing inequality for total variation distance implies that dTV(P∗,(k), P∗,(k+1)) is at most the variation distance between random variables X and X′, where • X is the random variable obtained by running A on CONDD∗ to obtain a length-k transcript prefix (Y, Z k), then drawing {xk+1, yk+1} from T(Y,Z k), then setting pk+1 to be the output of PCONDD∗({xk+1, yk+1}); and • X′ is the random variable obtained by running A on CONDD∗ to obtain a length-k transcript prefix (Y, Z k), then drawing {xk+1, yk+1} from T(Y,Z k), then setting pk+1 according to the aforementioned rules 2(i) and 2(ii). 41 Consider any fixed outcome of (Y, Z k) and {xk+1, yk+1}. If rule 2(i) is applied (xk+1 and yk+1 are in the same bucket), then there is zero contribution to the variation distance between X and X′, be- cause choosing a uniform element of {xk+1, yk+1} is a perfect simulation of PCONDD({xk+1, yk+1}). If rule 2(ii) is applied, then the contribution is upper bounded by O(1/K) < 1/20q, because PCONDD∗({xk+1yk+1}) would return a different outcome from rule 2(ii) with probability 1/Θ(K ℓ′−ℓ) = O(1/K). Averaging over all possible outcomes of (Y, Z k) and {xk+1, yk+1} we get that the variation distance between X and X′ is at most 1/20q as claimed. An identical argument shows that similarly dTV(PNo,(k), PNo,(k+1)) ≤ 1/(20q). The key obser- vation is that for any distribution D in the support of P No, as with D∗ it is the case that points in the same bucket have equal probability under D and for a pair of points {x, y} such that x ∈ Bℓ and y ∈ Bℓ′ for ℓ′ > ℓ, the probability that a call to PCONDD({x, y}) returns y is only 1/Θ(K ℓ′−ℓ). This concludes the proof of Lemma 16 and of Theorem 8. 5.3 A poly(1/ǫ)-query CONDD algorithm In this subsection we present an algorithm COND-Test-Known and prove the following theorem: Theorem 10 COND-Test-Known is a O(1/ǫ4)-query CONDD testing algorithm for testing equiv- alence to a known distribution D∗. That is, for every pair of distributions D, D∗ over [N ] (such that D∗ is fully specified and there is COND query access to D), the algorithm outputs ACCEPT with prob- ability at least 2/3 if D = D∗ and outputs REJECT with probability at least 2/3 if dTV(D, D∗) ≥ ǫ. This constant-query testing algorithm stands in interesting contrast to the (log N )Ω(1)-query lower bound for PCONDD algorithms for this problem. High-level overview of the algorithm and its analysis: First, we note that by reordering elements of [N ] we may assume without loss of generality that D∗(1) ≤ ··· ≤ D∗(N ); this will be convenient for us. Our (log N )Ω(1) query lower bound for PCONDD algorithms exploited the intuition that com- paring two points using the PCONDD oracle might not provide much information (e.g. if one of the two points was a priori “known” to be much heavier than the other). In contrast, with a general CONDD oracle at our disposal, we can compare a given point j ∈ [N ] with any subset of [N ] \ {j}. Thus the following definition will be useful: Definition 4 (comparable points) Fix 0 < λ ≤ 1. A point j ∈ supp(D∗) is said to be λ- comparable if there exists a set S ⊆ ([N ] \ {j}) such that D∗(j) ∈ [λD∗(S), D∗(S)/λ]. Such a set S is then said to be a λ-comparable-witness for j (according to D∗), which is denoted S ∼=∗ j. We say that a set T ⊆ [N ] is λ-comparable if every i ∈ T is λ-comparable. We stress that the notion of being λ-comparable deals only with the known distribution D∗; this will be important later. 42 Fix ǫ1 = Θ(ǫ) (we specify ǫ1 precisely in Equation (47) below). Our analysis and algorithm consider two possible cases for the distribution D∗ (where it is not hard to verify, and we provide an explanation subsequently, that one of the two cases must hold): 1. The first case is that for some i∗ ∈ [N ] we have D∗({1, . . . , i∗}) > 2ǫ1 but D∗({1, . . . , i∗ − 1}) ≤ ǫ1. (45) In this case 1 − ǫ1 of the total probability mass of D∗ must lie on a set of at most 1/ǫ1 elements, and in such a situation it is easy to efficiently test whether D = D∗ using poly(1/ǫ) queries (see Algorithm CONDD-Test-Known-Heavy and Lemma 19). 2. The second case is that there exists an element k∗ ∈ [N ] such that ǫ1 < D∗({1, . . . , k∗}) ≤ 2ǫ1 < D∗({1, . . . , k∗ + 1}). (46) This is the more challenging (and typical) case. In this case, it can be shown that every element j > k∗ has at least one ǫ1-comparable-witness within {1, . . . , j}. In fact, we show (see Claim 17) that either (a) {1, . . . , j − 1} is an ǫ1-comparable witness for j, or (b) the set {1, . . . , j − 1} can be partitioned into disjoint sets9 S1, . . . , St such that each Si, 1 ≤ i ≤ t, is a 1 2 -comparable-witness for j. Case (a) is relatively easy to handle so we focus on (b) in our informal description below. The partition S1, . . . , St is useful to us for the following reason: Suppose that dTV(D, D∗) ≥ ǫ. It is not difficult to show (see Claim 18) that unless D({1, . . . , k∗}) > 3ǫ1 (which can be easily detected and provides evidence that the tester should reject), a random sample of Θ(1/ǫ) draws from D will with high probability contain a “heavy” point j > k∗, that is, a point j > k∗ such that D(j) ≥ (1 + ǫ2)D∗(j) (where ǫ2 = Θ(ǫ)). Given such a point j, there are two possibilities: 1. The first possibility is that a significant fraction of the sets S1, . . . , St have D(j)/D(Si) “no- ticeably different” from D∗(j)/D∗(Si). (Observe that since each set Si is a 1 2 -comparable witness for j, it is possible to efficiently check whether this is the case.) If this is the case then our tester should reject since this is evidence that D 6= D∗. 2. The second possibility is that almost every Si has D(j)/D(Si) very close to D∗(j)/D∗(Si). If this is the case, though, then since D(j) ≥ (1 + ǫ2)D∗(j) and the union of S1, . . . , St is {1, . . . , j−1}, it must be the case that D({1, . . . , j}) is “significantly larger” than D∗({1, . . . , j}). This will be revealed by random sampling from D and thus our testing algorithm can reject in this case as well. Key quantities and useful claims. We define some quantities that are used in the algorithm and its analysis. Let def = ǫ1 ǫ 10 ǫ 2 ǫ 48 ; def = ǫ2 ; def = ǫ3 ; def = ǫ4 . (47) ǫ 6 9In fact the sets are intervals (under the assumption D∗(1) ≤ · · · ≤ D∗(n)), but that is not really important for our arguments. 43 Claim 17 Suppose there exists an element k∗ ∈ [N ] that satisfies Equation (46). Fix any j > k∗. Then 1. If D∗(j) ≥ ǫ1, then S1 2. If D∗(j) < ǫ1 then the set {1, . . . , j − 1} can be partitioned into disjoint sets S1, . . . , St such = {1, . . . , j − 1} is an ǫ1-comparable witness for j; def that each Si, 1 ≤ i ≤ t, is a 1 2 -comparable-witness for j. 1 ǫ1 Proof: First consider the case that D∗(j) ≥ ǫ1. In this case S1 = {1, . . . , j− 1} is an ǫ1-comparable witness for j because D∗(j) ≥ ǫ1 ≥ ǫ1D∗({1, . . . , j − 1}) and D∗(j) ≤ 1 ≤ 1 D∗({1, . . . , k∗}) ≤ D∗({1, . . . , j − 1}), where the last inequality holds since k∗ ≤ j − 1. Next, consider the case that D∗(j) < ǫ1. In this case we build our intervals iteratively from right to left, as follows. Let j1 = j − 1 and let j2 be the minimum index in {0, . . . , j1 − 1} such that ǫ1 D∗({j2 + 1, . . . , j1}) ≤ D∗(j). (Observe that we must have j2 ≥ 1, because D∗({1, . . . , k∗}) > ǫ1 > D∗(j).) Since D∗({j2, . . . , j1}) > D∗(j) and the function D∗(·) is monotonically increasing, it must be the case that 1 2 D∗(j) ≤ D∗({j2 + 1, . . . , j1}) ≤ D∗(j). Thus the interval S1 def = {j2 + 1, . . . , j1} is a 1 2 -comparable witness for j as desired. We continue in this fashion from right to left; i.e. if we have defined j2, . . . , jt as above and there is an index j′ ∈ {0, . . . , jt − 1} such that D∗({j′ + 1, . . . , jt}) > D∗(j), then we define jt+1 to be the minimum index in {0, . . . , jt − 1} such that D∗({jt+1 + 1, . . . , jt}) ≤ D∗(j), and we define St to be the interval {jt+1 + 1, . . . , jt}. The argument of the previous paragraph tells us that 1 2 D∗(j) ≤ D∗({jt+1 + 1, . . . , jt}) ≤ D∗(j) (48) and hence St is an 1 2 -comparable witness for j. At some point, after intervals S1 = {j2 + 1, . . . , j1}, . . . , St = {jt+1 + 1, . . . , jt} have been it will be the case that there is no index j′ ∈ {0, . . . , jt − 1} such that defined in this way, D∗({j′ + 1, . . . , jt}) > D∗(j). At this point there are two possibilities: first, if jt+1 + 1 = 1, then S1, . . . , St give the desired partition of {1, . . . , j − 1}. If jt+1 + 1 > 1 then it must be the case that D∗({1, . . . , jt+1}) ≤ D∗(j). In this case we simply add the elements {1, . . . , jt+1} to St, i.e. we redefine St to be {1, . . . , jt}. By Equation (48) we have that 1 2 D∗(j) ≤ D∗(St) ≤ 2D∗(j) and thus St is an 1 2 -comparable witness for j as desired. This concludes the proof. 44 Definition 5 (Heavy points) A point j ∈ supp(D∗) is said to be η-heavy if D(j) ≥ (1 + η)D∗(j). Claim 18 Suppose that dTV(D, D∗) ≥ ǫ and Equation (46) holds. Suppose moreover that D({1, . . . , k∗}) ≤ 4ǫ1. Let i1, . . . , iℓ be i.i.d. points drawn from D. Then for ℓ = Θ(1/ǫ), with prob- ability at least 99/100 (over the i.i.d. draws of i1, . . . , iℓ ∼ D) there is some point ij ∈ {i1, . . . , iℓ} such that ij > k∗ and ij is ǫ2-heavy. Proof: Define H1 to be the set of all ǫ2-heavy points and H2 to be the set of all “slightly lighter” points as follows: H1 = { i ∈ [N ] D(i) ≥ (1 + ǫ2)D∗(i) } H2 = { i ∈ [N ] (1 + ǫ2)D∗(i) > D(i) ≥ D∗(i) } By definition of the total variation distance, we have ǫ ≤ dTV(D, D∗) = Xi:D(i)≥D∗(i) (D(i) − D∗(i)) = (D(H1) − D∗(H1)) + (D(H2) − D∗(H2)) ≤ D(H1) + ((1 + ǫ2)D∗(H2) − D∗(H2)) = D(H1) + ǫ2D∗(H2) < D(H1) + ǫ2 = D(H1) + ǫ 2 . So it must be the case that D(H1) ≥ ǫ/2 = 5ǫ1. Since by assumption we have D({1, . . . , k∗}) ≤ 4ǫ1, it must be the case that D(H1 \ {1, . . . , k∗}) ≥ ǫ1. The claim follows from the definition of H1 and the size, ℓ, of the sample. Algorithm 6: CONDD-Test-Known Input: error parameter ǫ > 0; query access to CONDD oracle; explicit description (D∗(1), . . . , D∗(N )) of distribution D∗ satisfying D∗(1) ≤ ··· ≤ D∗(N ) 1: Let i∗ be the minimum index i ∈ [N ] such that D∗({1, . . . , i}) > 2ǫ1. 2: if D∗({1, . . . , i∗ − 1}) ≤ ǫ1 then 3: 4: else 5: 6: end if Call algorithm CONDD-Test-Known-Main(ǫ, CONDD, D∗, i∗ − 1) (and exit). Call algorithm CONDD-Test-Known-Heavy(ǫ, CONDD, D∗, i∗) (and exit) 5.3.1 Proof of Theorem 10 It is straightforward to verify that the query complexity of CONDD-Test-Known-Heavy is O(1/ǫ4) and the query complexity of CONDD-Test-Known-Main is also O(1/ǫ4), so the overall query com- plexity of COND-Test-Known is as claimed. By the definition of i∗ (in the first line of the algorithm), either Equation (45) holds for this setting of i∗, or Equation (46) holds for k∗ = i∗ − 1. To prove correctness of the algorithm, we first deal with the simpler case, which is that Equation (45) holds: 45 Algorithm 7: CONDD-Test-Known-Heavy Input: error parameter ǫ > 0; query access to CONDD oracle; explicit description (D∗(1), . . . , D∗(N )) of distribution D∗ satisfying D∗(1) ≤ ··· ≤ D∗(N ); value i∗ ∈ [N ] satisfying D∗({1, . . . , i∗ − 1}) ≤ ǫ1, D∗({1, . . . , i∗}) > 2ǫ1 1: Call the SAMPD oracle m = Θ((log(1/ǫ))/ǫ4) times. For each i ∈ [i∗, N ] let bD(i) be the fraction of the m calls to SAMPD that returned i. Let bD′ = 1 −Pi∈[i∗,N ] bD(i) be the fraction of the m calls that returned values in {1, . . . , i∗ − 1}. 2: if either (any i ∈ [i∗, N ] has bD(i) − D∗(i) > ǫ1 2) or (bD′ − D∗({1, . . . , i∗ − 1}) > ǫ1) then output REJECT (and exit) 3: 4: end if 5: Output ACCEPT Algorithm 8: CONDD-Test-Known-Main Input: error parameter ǫ > 0; query access to CONDD oracle; explicit description 2 , 5ǫ1 2 ] then output REJECT (and exit). (D∗(1), . . . , D∗(N )) of distribution D∗ satisfying D∗(1) ≤ ··· ≤ D∗(N ); value k∗ ∈ [N ] satisfying ǫ1 < D∗({1, . . . , k∗}) ≤ 2ǫ1 < D∗({1, . . . , k∗ + 1}) 1: Call the SAMPD oracle Θ(1/ǫ2) times and let bD({1, . . . , k∗}) denote the fraction of responses that lie in {1, . . . , k∗}. If bD({1, . . . , k∗}) /∈ [ ǫ1 2: Call the SAMPD oracle ℓ = Θ(1/ǫ) times to obtain points i1, . . . , iℓ. 3: for all j ∈ {1, . . . , ℓ} such that ij > k∗ do Call the SAMPD oracle m = Θ(log(1/ǫ)/ǫ2) times and let bD({1, . . . , ij}) be the fraction of responses that lie in {1, . . . , ij}. If bD({1, . . . , ij}) /∈ [1 − ǫ3, 1 + ǫ3]D∗({1, . . . , ij}) then output REJECT (and exit). if D∗(ij) ≥ ǫ1 then Run Compare({ij},{1, . . . , ij − 1}, ǫ2 v /∈ [1 − ǫ2 8 , 1 + ǫ2 Let S1, . . . , St be the partition of {1, . . . , ij − 1} such that each Si is an ǫ1-comparable witness for ij, which is provided by Claim 17. Select a list of h = Θ(1/ǫ) elements Sa1, . . . , Sah independently and uniformly from {S1, . . . , Sj}. For each Sar , 1 ≤ r ≤ h, run Compare({ij}, Sar , ǫ4 If v /∈ [1 − ǫ4 D∗({ij}) then output REJECT (and exit). , 1 10ℓ ) and let v denote its output. If 1 10ℓh ) and let v denote its output. 8 ] D∗({1,...,ij−1}) D∗({ij}) then output REJECT (and exit). 4 , 1 + ǫ4 4 ] D∗(Sar ) 16 , 2 ǫ1 4: 5: 6: 7: 8: 9: 10: 8 , 4, else end if 11: 12: end for 13: Output ACCEPT. 46 Lemma 19 Suppose that D∗ is such that D∗({1, . . . , i∗}) > 2ǫ1 but D∗({1, . . . , i∗ − 1}) ≤ ǫ1. Then CONDD-Test-Known-Heavy(ǫ, CONDD, D∗, i∗) returns ACCEPT with probability at least 2/3 if D = D∗ and returns REJECT with probability at least 2/3 if dTV(D, D∗) ≥ ǫ. Proof: The conditions of Lemma 19, together with the fact that D∗(·) is monotone non-decreasing, imply that each i ≥ i∗ has D∗(i) ≥ ǫ1. Thus there can be at most 1/ǫ1 many values i ∈ {i∗, . . . , N}, it must be the case that i∗ ≥ N − 1/ǫ1 + 1. Since the expected value of bD(i) (defined in i.e. Line 1 of CONDD-Test-Known-Heavy) is precisely D(i), for any fixed value of i ∈ {i∗, . . . , n} an additive Chernoff bound implies that D(i)−bD(i) ≤ (ǫ1)2 with failure probability at most ǫ1(cid:17) . Similarly bD′ − D({1, . . . , i∗ − 1}) ≤ ǫ1 with failure probability at most ǫ1(cid:17) . A union bound over all failure events gives that with probability at least 9/10 each value i ∈ {i∗, . . . , N} has D(i)−bD(i) ≤ ǫ1 2 and additionally bD′ − D({1, . . . , i∗ − 1}) ≤ ǫ1; we refer to this compound event as (*). If D∗ = D, by (*) the algorithm outputs ACCEPT with probability at least 9/10. Now suppose that dTV(D, D∗) ≥ ǫ. With probability at least 9/10 we have (*) so we suppose 10(cid:16)1+ 1 10(cid:16)1+ 1 1 1 that indeed (*) holds. In this case we have ǫ ≤ dTV(D, D∗) = Xi<i∗ D(i) − D∗(i) +Xi≥i∗ D(i) − D∗(i) ≤ Xi<i∗ (D(i) + D∗(i)) +Xi≥i∗ D(i) − D∗(i) ≤ D({1, . . . , i∗ − 1}) + ǫ1 +Xi≥i∗(cid:16)bD(i) − D∗(i) + ǫ1 ≤ bD′ + ǫ1 + 2ǫ1 +Xi≥i∗(cid:16)bD(i) − D∗(i)(cid:17) 2(cid:17) where the first inequality is by the triangle inequality, the second is by (*) and the fact that D∗({1, . . . , i∗ − 1}) ≤ ǫ1, and the third inequality is by (*) and the fact that there are at most 1/ǫ1 elements in {i∗, . . . , N}. Since ǫ1 = ǫ/10, the above inequality implies that 7 10 ǫ ≤ bD′ +Xi≥i∗(cid:16)bD(i) − D∗(i)(cid:17) . If any i ∈ {i∗, . . . , N} has bD(i) − D∗(i) > (ǫ1)2 then the algorithm outputs REJECT so we may assume that bD(i) − D∗(i) ≤ ǫ1 but since D∗({1, . . . , i∗ − 1}) ≤ ǫ1 the algorithm must REJECT. 2 for all i. This implies that ǫ ≤ bD′ 6ǫ1 = 6 10 Now we turn to the more difficult (and typical) case, that Equation (46) holds (for k∗ = i∗ − 1), i.e. ǫ1 < D∗({1, . . . , k∗}) ≤ 2ǫ1 < D∗({1, . . . , k∗ + 1}). 47 With the claims we have already established it is straightforward to argue completeness: Lemma 20 Suppose that D = D∗ and Equation (46) holds. Then with probability at least 2/3 algorithm CONDD-Test-Known-Main outputs ACCEPT. Proof: We first observe that the expected value of the quantity bD({1, . . . , k∗}) defined in Line 1 is precisely D({1, . . . , k∗}) = D∗({1, . . . , k∗}) and hence lies in [ǫ1, 2ǫ1] by Equation (46). The additive Chernoff bound implies that the probability the algorithm outputs REJECT in Line 1 is at most 1/10. Thus we may assume the algorithm continues to Line 2. In any given execution of Line 4, since the expected value of bD({1, . . . , ij}) is precisely D({1, . . . , ij}) = D∗({1, . . . , ij}) > ǫ1, a multiplicative Chernoff bound gives that the algorithm outputs REJECT with probability at most 1/(10ℓ). Thus the probability that the algorithm out- puts REJECT in any execution of Line 4 is at most 1/10. We henceforth assume that the algorithm never outputs REJECT in this step. 10ℓ D∗({ij}) Compare outputs a value v in the range [1 − ǫ2 Fix a setting of j ∈ {1, . . . , ℓ} such that ij > k∗. Consider first the case that D∗(ij ) ≥ ǫ1 so the algorithm enters Line 6. By item (1) of Claim 17 and item (1) of Lemma 2, we have that with 16 ] D∗({1,...,ij−1}) probability at least 1 − 1 (recall that D = D∗), so the algorithm does not output REJECT in Line 6. Now suppose that D∗(ij) < ǫ1 so the algorithm enters Line 8. Fix a value 1 ≤ r ≤ h in Line 10. By Claim 17 we have that Sar is a 1 2 -comparable witness for ij. By item (1) of Lemma 2, we have that with probability at Compare outputs a value v in the range [1− ǫ4 least 1− 1 D∗({ij}) (recall that D = D∗). A union bound over all h values of r gives that the algorithm outputs REJECT in Line 10 with probability at most 1/(10ℓ). So in either case, for this setting of j, the algorithm outputs REJECT on that iteration of the outer loop with probability at most 1/(10ℓ). A union bound over all ℓ iterations of the outer loop gives that the algorithm outputs REJECT at any execution of Line 6 or Line 10 is at most 1/10. 16 , 1 + ǫ2 4 , 1 + ǫ4 4 ] D∗(Sar ) 10ℓh Thus the overall probability that the algorithm outputs REJECT is at most 3/10, and the lemma is proved. Next we argue soundness: Lemma 21 Suppose that dTV(D, D∗) ≥ ǫ and Equation (46) holds. Then with probability at least 2/3 algorithm CONDD-Test-Known-Main outputs REJECT. If D({1, . . . , k∗}) /∈ [ǫ1, 3ǫ1] then a standard additive Chernoff bound implies that the Proof: algorithm outputs REJECT in Line 1 with probability at least 9/10. Thus we may assume going forward in the argument that D({1, . . . , k∗}) ∈ [ǫ1, 3ǫ1]. As a result we may apply Claim 18, and we have that with probability at least 99/100 there is an element ij ∈ {i1, . . . , iℓ} such that ij > k∗ and ij is ǫ2-heavy, i.e. D(ij) ≥ (1 + ǫ2)D∗(ij ). We condition on this event going forward (the rest of our analysis will deal with this specific element ij). We now consider two cases: Case 1: Distribution D has D({1, . . . , ij}) /∈ [1 − 3ǫ3, 1 + 3ǫ3]D∗({1, . . . , ij}). Since the quantity bD({1, . . . , ij}) obtained in Line 4 has expected value D({1, . . . , ij}) ≥ D({1, . . . , k∗}) ≥ ǫ1, applying 48 If this failure event does not occur then since the multiplicative Chernoff bound implies that bD({1, . . . , ij}) ∈ [1− ǫ3, 1 + ǫ3]D({1, . . . , ij}) except with failure probability at most ǫ/10 ≤ 1/10. D({1, . . . , ij}) /∈ [1 − 3ǫ3, 1 + 3ǫ3]D∗({1, . . . , ij}) it must hold that bD({1, . . . , ij}) /∈ [1 − ǫ3, 1 + ǫ3]D∗({1, . . . , ij}) and consequently the algorithm outputs REJECT. Thus in Case 1 the algorithm outputs REJECT with overall failure probability at least 89/100. Case 2: Distribution D has D({1, . . . , ij}) ∈ [1 − 3ǫ3, 1 + 3ǫ3]D∗({1, . . . , ij}). This case is divided into two sub-cases depending on the value of D∗(ij). Case 2(a): D∗(ij ) ≥ ǫ1. In this case the algorithm reaches Line 6. We use the following claim: Claim 22 In Case 2(a), suppose that ij > k∗ is such that D(ij) ≥ (1+ǫ2)D∗(ij ), and D({1, . . . , ij}) ∈ [1 − 3ǫ3, 1 + 3ǫ3]D∗({1, . . . , ij}). Then D({1, . . . , ij − 1}) D(ij) Proof: To simplify notation we write ≤(cid:16)1 − ǫ2 4(cid:17) · D∗({1, . . . , ij − 1}) . D∗(ij ) def = D(ij); a def = D∗(ij ); b c def = D({1, . . . , ij − 1}); d def = D∗({1, . . . , ij − 1}). We have that This gives a ≥ (1 + ǫ2)b and a + c ≤ (1 + 3ǫ3)(b + d). c ≤ (1 + 3ǫ3)(b + d) − (1 + ǫ2)b = (1 + 3ǫ3)d + (3ǫ3 − ǫ2)b < (1 + 3ǫ3)d , (49) (50) where in the last inequality we used ǫ2 > 3ǫ3. Recalling that a ≥ (1 + ǫ2)b and using ǫ3 = ǫ2/24 we get c a < (1 + 3ǫ3)d (1 + ǫ2)b = d b · 1 + ǫ2/8 1 + ǫ2 < This proves the claim. Applying Claim 22, we get that in Line 6 we have d b ·(cid:16)1 − ǫ2 4(cid:17) . D({1, . . . , ij − 1}) D(ij) ≤(cid:16)1 − ǫ2 4(cid:17) · D∗({1, . . . , ij − 1}) D∗(ij) . (51) (52) Recalling that by the premise of this case D∗(ij) ≥ ǫ1, by applying Claim 17 we have that {1, . . . , ij − 1} is an ǫ1-comparable witness for ij. Therefore, by Lemma 2, with probability at , 1 least 1 − 1 10ℓ ) in Line 6 either outputs an ele- 8 ) D∗({1,...,ij−1}) ment of {High, Low} or outputs a value v ≤ (1 − ǫ2 . In either case the algorithm outputs REJECT in Line 6, so we are done with Case 2(a). 10ℓ the call to Compare({ij},{1, . . . , ij − 1}, ǫ2 16 , 2 ǫ1 16 ) D∗({1,...,ij−1}) 4 )(1 + ǫ2 < (1 − ǫ2 D∗(ij ) D∗(ij ) Case 2(b): D∗(ij) < ǫ1. In this case the algorithm reaches Line 10, and by item 2 of Claim 17, we have that S1, . . . , St is a partition of {1, . . . , ij − 1} and each set S1, . . . , St is a 1 2 -comparable witness for ij, i.e., We use the following claim: for all i ∈ {1, . . . , t}, 1 2 D∗(ij) ≤ D∗(Si) ≤ 2D∗(ij ). (53) 49 Claim 23 In Case 2(b) suppose ij > k∗ is such that D(ij) ≥ (1 + ǫ2)D∗(ij) and D({1, . . . , ij}) ∈ [1 − 3ǫ3, 1 + 3ǫ3]D∗({1, . . . , ij}). Then at least (ǫ4/8)-fraction of the sets S1, . . . , St are such that D(Si) ≤ (1 + ǫ4)D∗(Si). Proof: The proof is by contradiction. Let ρ = 1 − ǫ4/8 and suppose that there are w sets (without loss of generality we call them S1, . . . , Sw) that satisfy D(Si) > (1 + ǫ4)D∗(Si), where ρ′ = w t > ρ. We first observe that the weight of the w subsets S1, . . . , Sw under D∗, as a fraction of D∗({1, . . . , ij − 1}), is at least D∗(S1 ∪ ··· ∪ Sw) w D∗(ij ) ρ′ = = w 2 D∗(S1 ∪ ··· ∪ Sw) + (t − w) · 2D∗(ij) ≥ w D∗(ij ) 2 + (t − w) · 2D∗(ij) 4t − 3w , 4 − 3ρ′ where we used the right inequality in Equation (53) on Sw+1, . . . , St to obtain the leftmost expression x above, and the left inequality in Equation (53) (together with the fact that x+c is an increasing function of x for all c > 0) to obtain the inequality above. This implies that D({1, . . . , ij − 1}) = wXi=1 D(Si) + ≥ (1 + ǫ4) ≥ (1 + ǫ4) From Equation (54) we have D(Si) ≥ (1 + ǫ4) tXi=w+1 D∗({1, . . . , ij − 1}) D∗({1, . . . , ij − 1}) . ρ′ ρ 4 − 3ρ′ 4 − 3ρ D∗(Si) + wXi=1 tXi=w+1 D(Si) (54) D({1, . . . , ij}) ≥ (1 + ǫ4) 3ǫ4 ≥ (cid:18)1 + ρ 4 − 3ρ D∗({1, . . . , ij − 1}) + (1 + ǫ2)D∗(ij) 8 (cid:19) D∗({1, . . . , ij − 1}) + (1 + ǫ2)D∗(ij) ρ where for the first inequality above we used D(ij) ≥ (1 + ǫ2)D∗(ij) and for the second inequality we used (1 + ǫ4) 8 (cid:19) D∗({1, . . . , ij}) D({1, . . . , ij}) > (cid:18)1 + 8 (cid:19) D∗({1, . . . , ij − 1}) +(cid:18)1 + 8 (cid:19) D∗(ij) =(cid:18)1 + 4−3ρ ≥ 1 + 3ǫ4 3ǫ4 8 . This implies that 3ǫ4 3ǫ4 where the inequality follows from ǫ2 > 3ǫ4 the claim is proved. 8 . Since 3ǫ4 8 = 3ǫ3, though, this is a contradiction and Applying Claim 23, and recalling that h = Θ(1/ǫ) = Θ(1/ǫ4) sets are chosen randomly in Line 9, we have that with probability at least 9/10 there is some r ∈ {1, . . . , h} such that D(Sar ) ≤ (1 + ǫ4)D∗(Sar ). Combining this with D(ij) ≥ (1 + ǫ2)D∗(ij), we get that D(Sar ) D(ij) ≤ 1 + ǫ4 1 + ǫ2 · D∗(Sar ) D∗(ij) ≤(cid:16)1 − ǫ4 2(cid:17) · D∗(Sar ) D∗(ij) . 50 1 10ℓn ) in Line 10 D∗(ij ) < (1 − D∗(ij ) . In either case the algorithm outputs REJECT in Line 10, so we are done in Case 2(b). By Lemma 2, with probability at least 1− 1 either outputs an element of {High, Low} or outputs a value v ≤ (1 − ǫ4 4 ) D∗(Sar ) This concludes the proof of soundness and the proof of Theorem 7. 10ℓh the call to Compare({ij}, Sar , ǫ4 8 , 4, 2 )(1 + ǫ4 8 ) D∗(Sar ) ǫ4 6 Testing equality between two unknown distributions 6.1 An approach based on PCOND queries In this subsection we consider the problem of testing whether two unknown distributions D1, D2 are identical versus ǫ-far, given PCOND access to these distributions. Although this is known to require Ω(cid:0)N 2/3(cid:1) many samples in the standard model [BFR+10, Val11], we are able to give a poly(log N, 1/ǫ)-query algorithm using PCOND queries, by taking advantage of comparisons to perform some sort of clustering of the domain. On a high level the algorithm works as follows. First it obtains (with high probability) a small set of points R such that almost every element in [N ], except possibly for some negligible subset according to D1, has probability weight (under D1) close to some “representative” in R. Next, for each representative r in R it obtains an estimate of the weight, according to D1, of a set of points U (r) such that D1(u) is close to D1(r) for each u in U (r) (i.e., r’s “neighborhood under D1”). This is done using the procedure Estimate-Neighborhood from Subsection 3.2. Note that these neighborhoods can be interpreted roughly as a succinct cover of the support of D1 into (not necessarily disjoint) sets of points, where within each set the points have similar weight (according to D1). Our algorithm is based on the observation that, if D1 and D2 are far from each other, it must be the case that one of these sets, denoted U (r∗), reflects it in one of the following ways: (1) D2(U (r∗)) differs significantly from D1(U (r∗)); (2) U (r∗) contains a subset of points V (r∗) such that D2(v) differs significantly from D2(r∗) for each v in V (r∗), and either D1(V (r∗)) is relatively large or D2(V (r∗)) is relatively large. (This structural result is made precise in Lemma 25). We thus take additional samples, both from D1 and from D2, and compare the weight (according to both distributions) of each point in these samples to the representatives in R (using the procedure Compare from Subsection 3.1). In this manner we detect (with high probability) that either (1) or (2) holds. We begin by formalizing the notion of a cover discussed above: Definition 6 (Weight-Cover) Given a distribution D on [N ] and a parameter ǫ1 > 0, we say that a point i ∈ [N ] is ǫ1-covered by a set R = {r1, . . . , rt} ⊆ [N ] if there exists a point rj ∈ R such that D(i) ∈ [1/(1 + ǫ1), 1 + ǫ1]D(rj). Let the set of points in [N ] that are ǫ1-covered by R be denoted by U D ǫ1 (R). We say that R is an (ǫ1, ǫ2)-cover for D if D([N ] \ U D ǫ1 (R)) ≤ ǫ2. For a singleton set R = {r} we slightly abuse notation and write U D that this aligns with the notation established in (11). ǫ (r) to denote U D ǫ (R); note The following lemma says that a small sample of points drawn from D gives a cover with high probability: 51 Lemma 24 Let D be any distribution over [N ]. Given any fixed c > 0, there exists a constant c′ > 0 such that with probability at least 99/100, a sample R of size m = c′ log(N/ǫ) drawn according to distribution D is an (ǫ/c, ǫ/c)-cover for D. · log(cid:16) log(N/ǫ) (cid:17) ǫ2 ǫ ǫ⌉. We define t “buckets” of points with similar weight under D Proof: Let t denote ⌈ln(2cN/ǫ) · c as follows: for i = 0, 1, . . . , t − 1, define Bi ⊆ [N ] to be def= (cid:26)x ∈ [N ] : 2cN , one can see that D(L) ≤ ǫ 2c . (1 + ǫ/c)i+1 < D(x) ≤ Bi 1 1 (1 + ǫ/c)i(cid:27) . Let L be the set of points x which are not in any of B0, . . . , Bt−1 (because D(x) is too small); since every point in L has D(x) < ǫ It is easy to see that if the sample R contains a point from a bucket Bj then every point y ∈ Bj is ǫ c -covered by R. We say that bucket Bi is insignificant if D(Bi) ≤ ǫ 2ct ; otherwise bucket Bi is significant. It is clear that the total weight under D of all insignificant buckets is at most ǫ/2c. Thus if we can show that for the claimed sample size, with probability at least 99/100 every significant bucket has at least one of its points in R, we will have established the lemma. This is a simple probabilistic calculation: fix any significant bucket Bj. The probability that 1 m random draws from D all miss Bj is at most (1 − ǫ 100t for a suitable (absolute constant) choice of c′. Thus a union bound over all (at most t) significant buckets gives that with probability at least 99/100, no significant bucket is missed by R. 2ct )m, which is at most Lemma 25 Suppose dTV(D1, D2) ≥ ǫ, and let R = {r1, . . . , rt} be an (ǫ, ǫ)-cover for D1 where ǫ ≤ ǫ/100. Then, there exists j ∈ [t] such that at least one of the following conditions holds for every α ∈ [ǫ, 2ǫ]: 1. D1(U D1 D2(U D1 2. D1(U D1 α (rj)) ≥ ǫ t and D2(U D1 α (rj)) > 2ǫ t ; α (rj)) ≥ ǫ t , and at D2(i) D2(rj ) /∈ [1/(1 + α + ǫ), 1 + α + ǫ]; α (rj)) /∈ [1 − ǫ, 1 + ǫ]D1(U D1 α (rj)), or D1(U D1 α (rj)) < ǫ t and least a ǫ-fraction of the points i in U D1 α (rj) satisfy 3. D1(U D1 α (rj)) ≥ ǫ t , and the total weight according to D2 of the points i in U D1 α (rj) for which D2(i) D2(rj ) /∈ [1/(1 + α + ǫ), 1 + α + ǫ] is at least ǫ2 t ; Proof: Without loss of generality, we can assume that ǫ ≤ 1/4. Suppose, contrary to the claim, that for each rj there exists αj ∈ [ǫ, 2ǫ] such that if we let Uj αj (rj), then the following holds: def= U D1 1. If D1(Uj) < ǫ 2. If D1(Uj) ≥ ǫ t , then D2(Uj) ≤ 2ǫ t ; t , then: (a) D2(Uj) ∈ [1 − ǫ, 1 + ǫ]D1(Uj); (b) Less than an ǫ-fraction of the points y in Uj satisfy D2(y) D2(rj ) /∈ [1/(1 + αj + ǫ), 1 + αj + ǫ]; 52 (c) The total weight according to D2 of the points y in Uj for which D2(y) D2(rj ) /∈ [1/(1 + αj + ǫ), 1 + αj + ǫ] is at most ǫ2 t ; We show that in such a case dTV(D1, D2) < ǫ, contrary to the premise of the claim. Consider each point rj ∈ R such that D1(Uj) ≥ ǫ D2(Uj) ∈ [1 − ǫ, 1 + ǫ]D1(Uj). By the definition of Uj (and since αj ≤ 2ǫ), t . By the foregoing discussion (point 2(a)), D1(rj) ∈ [1/(1 + 2ǫ), 1 + 2ǫ] D1(Uj) Uj . Turning to bound D2(rj), on one hand (by 2(b)) and so D2(Uj) = Xy∈Uj D2(y) ≥ ǫUj · 0 + (1 − ǫ)Uj · D2(rj) 1 + 3ǫ , D2(rj) ≤ (1 + 3ǫ)D2(Uj) (1 − ǫ)Uj ≤ (1 + 6ǫ) D1(Uj) Uj . On the other hand (by 2(c)), D2(Uj) = Xy∈Uj D2(Uj) − ǫ2/t (1 + 3ǫ)Uj ≥ and so D2(rj) ≥ Therefore, for each such rj we have D2(y) ≤ ǫ2 t + Uj · (1 + 3ǫ)D2(rj) , (1 − ǫ)D1(Uj) − ǫD1(Uj) (1 + 3ǫ)Uj ≥ (1 − 5ǫ) D1(Uj) Uj . (55) (56) (57) (58) (59) (60) j=1 Uj. We next partition the points in C so that each point i ∈ C is assigned to some D2(rj) ∈ [1 − 8ǫ, 1 + 10ǫ]D1(rj) . def 1. B1 Let C rj(i) such that i ∈ Uj(i). We define the following “bad” subsets of points in [N ]: = St def= [N ] \ C, so that D1(B1) ≤ ǫ (we later bound D2(B1)); = (cid:8)i ∈ C : D1(Uj(i)) < ǫ/t(cid:9), so that D1(B2) ≤ ǫ and D2(B2) ≤ 2ǫ; = (cid:8)i ∈ C \ B2 : D2(i) /∈ [1/(1 + 3ǫ), 1 + 3ǫ]D2(rj(i))(cid:9), D2(B3) ≤ ǫ2. def 2. B2 3. B3 def so that D1(B3) ≤ 2ǫ and Let B def = B1 ∪ B2 ∪ B3. Observe that for each i ∈ [N ] \ B we have that D2(i) ∈ [1/(1 + 3ǫ), 1 + 3ǫ]D2(rj(i)) ⊂ [1 − 15ǫ, 1 + 15ǫ]D1(rj(i)) ⊂ [1 − 23ǫ, 1 + 23ǫ]D1(i) , (61) 53 where the first containment follows from the fact that i /∈ B, the second follows from Equation (60), and the third from the fact that i ∈ Uj(i). In order to complete the proof we need a bound on D2(B1), which we obtain next. D2(B1) = 1 − D2([N ] \ B1) ≤ 1 − D2([N ] \ B) ≤ 1 − (1 − 23ǫ)D1([N ] \ B) ≤ 1 − (1 − 23ǫ)(1 − 4ǫ) ≤ 27ǫ . Therefore, dTV(D1, D2) = ≤ 1 2 D1(i) − D2(i) NXi=1 2(cid:16)D1(B) + D2(B) +Xi /∈B 1 23ǫD1(i)(cid:17) < ǫ , and we have reached a contradiction. (62) (63) Theorem 11 If D1 = D2 then with probability at least 2/3 Algorithm PCOND-Test-Equality- Unknown returns ACCEPT, and if dTV(D1, D2) ≥ ǫ, then with probability at least 2/3 Algorithm PCOND-Test-Equality-Unknown returns REJECT. The number of PCOND queries performed ǫ21 (cid:1). by the algorithm is O(cid:0) log6 N Proof: The number of queries performed by the algorithm is the sum of: (1) t times the number of queries performed in each execution of Estimate-Neighborhood (in Line 3-a) and (2) t·(s1+s2) = O(t · s2) times the number of queries performed in each execution of Compare (in Line 3-e). By Lemma 3 (and the settings of the parameters in the calls to Estimate-Neighborhood), the first term is O(cid:16)t · log(1/δ)·log(log(1/δ)/(βη2 )) parameters in the calls to Compare), the second term is O(cid:16)t · s2 · log(t·s2) ǫ19 (cid:17), and by Lemma 2 (and the settings of the ǫ21 (cid:17), so that (cid:17) = O(cid:16) log6 N (cid:17) = O(cid:16) log6 N κ2η4β3δ2 we get the bound stated in the theorem. θ2 We now turn to establishing the correctness of the algorithm. We shall use the shorthand Uj αj (rj), and U′j for U D1 αj +θ(rj). We consider the following “desirable” events. for U D1 1. The event E1 is that the sample R is a (ǫ, ǫ)-weight-cover for D1 (for ǫ = ǫ/100). By Lemma 24 (and an appropriate constant in the Θ(·) notation for the size of R), the probability that E1 holds is at least 99/100. 2. The event E2 is that all calls to the procedure Estimate-Neighborhood are as specified by Lemma 3. By the setting of the confidence parameter in the calls to the procedure, the event E2 holds with probability at least 99/100. 3. The event E3 is that all calls to the procedure Compare are as specified by Lemma 2. By the setting of the confidence parameter in the calls to the procedure, the event E3 holds with probability at least 99/100. 4. The event E4 is that D2(U′j \ Uj) ≤ ηβ/16 = ǫ2/(256t) for each j. If D2 = D1 then this event follows from E2. Otherwise, it holds with probability at least 99/100 by the setting of θ and the choice of αj (as shown in the proof of Lemma 3 in the analysis of the event E1 there. 54 Algorithm 9: Algorithm PCONDD1,D2 -Test-Equality-Unknown Input: PCOND query access to distributions D1 and D2 and a parameter ǫ. 1. Set ǫ = ǫ/100. 2. Draw a sample R of size t = Θ(cid:16) log N ǫ2 (cid:17) from D1. 3. For each rj ∈ R: (a) Call Estimate-NeighborhoodD1 on rj with κ = ǫ, η = ǫ 8 , β = ǫ 2t , δ = 1 100t and let the output be denoted by ( w(1) j , αj). (b) Set θ = κηβδ/64 = Θ(ǫ7/ log2 N ). (c) Draw a sample S1 from D1, of size s1 = Θ(cid:0) t (d) Draw a sample S2 from D2, of size s2 = Θ(cid:16) t log t (e) For each point i ∈ S1 ∪ S2 call CompareD1({rj},{i}, θ/4, 4, 1/(200t(s1 + s2))) and CompareD2({rj},{i}, θ/4, 4, 1/(200t(s1 + s2))), and let the outputs be denoted ρ(1) and ρ(2) (f) Let w(2) rj (i), respectively (where in particular these outputs may be High or Low). j be the fraction of occurrences of i ∈ S2 such that ǫ2(cid:1) = Θ(cid:16) log N ǫ4 (cid:17). ǫ3 (cid:17) = Θ(cid:16) log N ǫ5 (cid:17). rj (i) ρ(1) rj (i) ∈ [1/(1 + αj + θ/2), 1 + αj + θ/2]. t ) or ( w(1) t and w(2) j > 3 2 (g) If ( w(1) ǫ ǫ j > 3 4 j ≤ 3 4 output REJECT. ǫ t and w(2) j / w(1) j /∈ [1 − ǫ/2, 1 + ǫ/2] ), then (h) If there exists i ∈ S1 ∪ S2 such that ρ(1) rj (i) ∈ [1/(αj + ǫ/2), 1 + αj + ǫ/2] and ρ(2) rj (i) /∈ [1/(αj + 3ǫ/2), 1 + αj + 3ǫ/2], then output REJECT. 4. Output ACCEPT. 5. The event E5 is defined as follows. For each j, if D2(Uj) ≥ ǫ/(4t), then S2 ∩ Uj/S2 ∈ [1− ǫ/10, 1 + ǫ/10]D2(Uj), and if D2(Uj) < ǫ/(4t) then S2∩ Uj/S2 < (1 + ǫ/10)ǫ/(4t). This event holds with probability at least 99/100 by applying a multiplicative Chernoff bound in the first case, and Corollary 2 in the second. 6. The event E6 is that for each j we have S2 ∩ (U′j \ Uj )/S2 ≤ ǫ2/(128t). Conditioned on E4, the event E6 holds with probability at least 99/100 by applying Corollary 2. From this point on we assume that events E1 − E6 all hold. Note that in particular this implies the following: 1. By E2, for every j: • If D1(Uj) ≥ β = ǫ/(2t), then w(1) • If D1(Uj) < ǫ/(2t), then w(1) j ≤ (1 + ǫ/8)(ǫ/(2t)). j ∈ [1 − η, 1 + η]D1(Uj) = [1 − ǫ/8, 1 + ǫ/8]D1(Uj). 55 2. By E3, for every j and for each point i ∈ S1 ∪ S2: • If i ∈ Uj, then ρ(1) • If i /∈ U′j, then ρ(1) rj (i) ∈ [1/(1 + αj + θ rj (i) /∈ [1/(1 + αj + θ 2 ), 1 + αj + θ 2 ]. 2 ), 1 + αj + θ 2 ]. 3. By the previous item and E4–E6: • If D2(Uj) ≥ ǫ/(4t), then w(2) ǫ2/(128t) ≤ (1 + ǫ/8)D2(Uj). • If D2(Uj) < ǫ/(4t) then w(2) j ≤ (1 + ǫ/10)ǫ/(4t) + ǫ2/(128t) ≤ (1 + ǫ/4)(ǫ/(4t)). j ≥ (1 − ǫ/10)D2(Uj) and w(2) j ≤ (1 + ǫ/10)D2(Uj) + Completeness. Assume D1 and D2 are the same distribution D. For each j, if D(Uj) ≥ ǫ/t, then by the foregoing discussion, w(1) j ∈ [(1 − ǫ/8)2, (1 + ǫ/8)2] ⊂ [1 − ǫ/2, 1 + ǫ/2], so that the algorithm does not reject in Line 3-g. Otherwise (i.e., D(Uj) < ǫ/t), we consider two subcases. Either D(Uj) ≤ ǫ/(2t), in which case w(1) j ≤ 3ǫ/(4t), or ǫ/(2t) < D(Uj) < ǫ/t, and then w(1) j ≤ (1 + ǫ/8)D(Uj ) ≤ 3ǫ/(2t), the algorithm does not reject in Line 3-g. By E3, the algorithm does not reject in Line 3-h either. We next turn to establish soundness. j ∈ [1 − ǫ/8, 1 + ǫ/8]D1(Uj). Since in both cases w(2) j ≥ (1− ǫ/8)D(Uj ) > 3ǫ/(4t) and w(2) j / w(1) Soundness. Assume dTV(D1, D2) ≥ ǫ. By applying Lemma 25 on R (and using E1), there exists an index j for which one of the items in the lemma holds. We denote this index by j∗, and consider the three items in the lemma. 1. If Item 1 holds, then we consider its two cases: (a) In the first case, D1(Uj∗) ≥ ǫ/t and D2(Uj∗) /∈ [1 − ǫ, 1 + ǫ]D1(Uj∗). Due to the lower j∗ ∈ [1 − ǫ/8, 1 + ǫ/8]D1(Uj∗), so that in particular j∗ < (1 − ǫ)(1 + ǫ/8)D1(Uj∗) (this holds both when j∗ > (1 + ǫ)(1 − ǫ/10)D1(Uj∗). In j∗ /∈ [1 − ǫ/2, 1 + ǫ/2], causing the algorithm to reject in (the bound on D1(Uj∗) we have that w(1) w(1) j∗ , either w(2) j∗ > 3ǫ/(4t). As for w(2) D2(Uj∗) ≥ ǫ/(4t) and when D2(Uj∗) < ǫ/(4t)) or w(2) j∗ / w(1) either (sub)case w(2) second part of ) Line 3-g. (b) In the second case, D1(Uj∗) < ǫ/t and D2(Uj∗) > 2ǫ/t. Due to the lower bound on D2(Uj∗) we have that w(2) j∗ ≥ (1 − ǫ/10)D2(Uj∗) > (1 − ǫ/10)(2ǫ/t), so that in particular j∗ > (3ǫ/(2t)). As for w(1) w(2) j∗ ≤ 3ǫ/(4t), causing the algorithm to reject in (the first part of) Line 3-g. If ǫ/(2t) < D1(Uj∗) ≤ ǫ/t, then w(1) j∗ ∈ [1 − ǫ/8, 1 + ǫ/8]D1(Uj∗) ≤ (1 + ǫ/8)(ǫ/t), so that w(2) (1+ǫ/8)ǫ/t > (1 + ǫ/2), j∗ , if D1(Uj∗) ≤ ǫ/(2t), then w(1) j∗ ≥ (1−ǫ/10)(2ǫ/t) causing the algorithm to reject in (either the first or second part of) Line 3-g. j∗ / w(1) 2. If Item 2 holds, then, by the choice of the size of S1, which is Θ(t/ǫ2), and since all points in Uj∗ have approximately the same weight according to D1, with probability at least 99/100, the sample S1 will contain a point i for which D2(i) D2(rj∗ ) /∈ [1/(1 + αj∗ + ǫ), 1 + αj∗ + ǫ], and by E3 this will be detected in Line 3-h. 56 3. Similarly, if Item 3 holds, then by the choice of the size of S2, with probability at least 99/100, D2(rj∗ ) /∈ [1/(1 + αj∗ + ǫ), 1 + αj∗ + ǫ], and by the sample S2 will contain a point i for which D2(i) E3 this will be detected in Line 3-h. The theorem is thus established. 6.2 An approach based on simulating EVAL In this subsection we present an alternate approach for testing whether two unknown distributions D1, D2 are identical versus ǫ-far. We prove the following theorem: Theorem 12 COND-Test-Equality-Unknown is a O(cid:18) (log N )5 ǫ4 (cid:19) -query algorithm with the following properties: given CONDD1, CONDD2 oracles for any two distri- butions D1, D2 over [N ], it outputs ACCEPT with probability at least 2/3 if D1 = D2 and outputs REJECT with probability at least 2/3 if dTV(D1, D2) ≥ ǫ. At the heart of this result is our efficient simulation of an “approximate EVALD oracle” using a CONDD oracle. (Recall that an EVALD oracle is an oracle which, given as input an element i ∈ [N ], outputs the numerical value D(i).) We feel that this efficient simulation of an approximate EVAL oracle using a COND oracle is of independent interest since it sheds light on the relative power of the COND and EVAL models. In more detail, the starting point of our approach to prove Theorem 12 is a simple algorithm from [RS09] that uses an EVALD oracle to test equality between D and a known distribution D∗. We first show (see Theorem 13) that a modified version of the algorithm, which uses a SAMP oracle and an “approximate” EVAL oracle, can be used to efficiently test equality between two unknown distributions D1 and D2. As we show (in Subsection 3.3.2) the required “approximate” EVAL oracle can be efficiently implemented using a COND oracle, and so Theorem 12 follows straightforwardly by combining Theorems 13 and 4. 6.2.1 Testing equality between D1 and D2 using an approximate EVAL oracle. We now show how an approximate EVALD1 oracle, an approximate EVALD2 oracle, and a SAMPD1 oracle can be used together to test whether D1 = D2 versus dTV(D1, D2) ≥ ǫ. As mentioned earlier, the approach is a simple extension of the EVAL algorithm given in Observation 24 of [RS09]. Theorem 13 Let ORACLE1 be an (ǫ/100, ǫ/100)-approximate EVALD1 simulator and let ORACLE2 be an (ǫ/100, ǫ/100)-approximate EVALD2 simulator. There is an algorithm Test-Equality- Unknown with the following properties: for any distributions D1, D2 over [N ], algorithm Test- Equality-Unknown makes O(1/ǫ) queries to ORACLE1, ORACLE2, SAMPD1, SAMPD2, and it outputs ACCEPT with probability at least 7/10 if D1 = D2 and outputs REJECT with probability at least 7/10 if dTV(D1, D2) ≥ ǫ. 57 Algorithm 10: Test-Equality-Unknown Input: query access to ORACLE1, to ORACLE2, and access to SAMPD1 , SAMPD2 oracles 1: Call the SAMPD1 oracle m = 5/ǫ times to obtain points h1, . . . , hm distributed according to D1. 2: Call the SAMPD2 oracle m = 5/ǫ times to obtain points hm+1, . . . , h2m distributed according to D2. 3: for j = 1 to 2m do 4: 5: Call ORACLE1(hj ). If it returns UNKNOWN then output REJECT, otherwise let v1,i ∈ [0, 1] be the value it outputs. Call ORACLE2(hj ). If it returns UNKNOWN then output REJECT, otherwise let v2,i ∈ [0, 1] be the value it outputs. if v1,j /∈ [1 − ǫ/8, 1 + ǫ/8]v2,j then end if 8: 9: end for 10: output ACCEPT output REJECT and exit 6: 7: It is clear that Test-Equality-Unknown makes O(1/ǫ) queries as claimed. To prove Theorem 13 we argue completeness and soundness below. Completeness: Suppose that D1 = D2. Since ORACLE1 is an (ǫ/100, ǫ/100)-approximate EVALD1 simulator, the probability that any of the 2m = 10/ǫ points h1, . . . , h2m drawn in Lines 1 and 2 lies in S(ǫ/100,D1) is at most 1/10. Going forth, let us assume that all points hi indeed lie outside S(ǫ/100,D1). Then for each execution of Line 4 we have that with probability at least 1 − ǫ/100 the call to ORACLE(hi) yields a value v1,i satisfying v1,i ∈ [1 − ǫ 100 ]D1(i). The same holds for each execution of Line 5. Since there are 20/ǫ total executions of Lines 4 and 5, with overall probability at least 7/10 we have that each 1 ≤ j ≤ m has v1,j, v2,j ∈ [1− ǫ 100 ]D1(i). If this is the case then v1,j, v2,j pass the check in Line 6, and thus the algorithm outputs ACCEPT with overall probability at least 7/10. 100 , 1 + ǫ 100 , 1 + ǫ Soundness: Now suppose that dTV(D1, D2) ≥ ǫ. Let us say that i ∈ [N ] is good if D1(i) ∈ [1 − ǫ/5, 1 + ǫ/5]D2(i). Let BAD ⊆ [N ] denote the set of all i ∈ [N ] that are not good. We have 2dTV(D1, D2) = Xi is good D1(i) − D2(i) + Xi is bad D1(i) − D2(i) ≥ 2ǫ. Since we have D1(i) − D2(i) ≤ Xi is good Xi is good (D1(i) + D2(i)) ≥ Xi is bad Xi is bad Consequently it must be the case that either D1(BAD) ≥ 9 the argument we suppose that D1(BAD) ≥ 9 10 ǫ. For the rest of 10 ǫ (by the symmetry of the algorithm, an identical 10 ǫ or D2(BAD) ≥ 9 ǫ 5D2(i) ≤ ǫ 5 , D1(i) − D2(i) ≥ 9 5 ǫ. 58 argument to the one we give below but with the roles of D1 and D2 flipped throughout handles the other case). Since D1(BAD) ≥ 9 10 ǫ, a simple calculation shows that with probability at least 98/100 at least one of the 5/ǫ points h1, . . . , hm drawn in Line 1 belongs to BAD. For the rest of the argument we suppose that indeed (at least) one of these points is in BAD; let hi∗ be such a point. Now consider the execution of Line 4 when ORACLE1 is called on hi∗. By Definition 3, whether or not i∗ belongs to S(ǫ/100,D1), with probability at least 1− ǫ/100 the call to ORACLE1 either causes Test-Equality- Unknown to REJECT in Line 4 (because ORACLE1 returns UNKNOWN) or it returns a value v1,i∗ ∈ [1− ǫ 100 ]D1(i∗). Similarly, in the execution of Line 5 when ORACLE2 is called on hi∗ , whether or not i∗ belongs to S(ǫ/100,D2), with probability at least 1− ǫ/100 the call to ORACLE2 either causes Test-Equality- Unknown to reject in Line 5 or it returns a value v2,i∗ ∈ [1 − ǫ 100 ]D2(i∗). We may suppose that it returns a value v2,i∗ ∈ [1 − ǫ 100 ]D2(i∗). But recalling that i∗ ∈ BAD, an easy calculation shows that the values v1,i∗ and v2,i∗ must be multiplicatively far enough from each other that the algorithm will output REJECT in Line 7. Thus with overall probability at least 96/100 the algorithm outputs REJECT. 100 ]D1(i∗). We may suppose that it returns a value v1,i∗ ∈ [1− ǫ 100 , 1 + ǫ 100 , 1 + ǫ 100 , 1+ ǫ 100 , 1+ ǫ 7 An algorithm for estimating the distance to uniformity In this section we describe an algorithm that estimates the distance between a distribution D and the uniform distribution U by performing poly(1/ǫ) PCOND (and SAMP) queries. We start by giving a high level description of the algorithm. By the definition of the variation distance (and the uniform distribution), dTV(D,U ) = Xi:D(i)<1/N(cid:18) 1 N − D(i)(cid:19) . We define the following function over [N ]: ψD(i) = (1 − N · D(i)) for D(i) < Observe that ψD(i) ∈ [0, 1] for every i ∈ [N ] and 1 N , and ψD(i) = 0 for D(i) ≥ 1 N . dTV(D,U ) = 1 N NXi=1 ψD(i) . (64) (65) (66) Thus dTV(D,U ) can be viewed as an average value of a function whose range is in [0, 1]. Since D is fixed throughout this subsection, we shall use the shorthand ψ(i) instead of ψD(i). Suppose we were able to compute ψ(i) exactly for any i of our choice. Then we could obtain an estimate d of dTV(D,U ) to within an additive error of ǫ/2 by simply selecting Θ(1/ǫ2) points in [N ] uniformly at random and setting d to be the average value of ψ(·) on the sampled points. By an additive Chernoff bound (for an appropriate constant in the Θ(·) notation), with high constant probability the estimate d would deviate by at most ǫ/2 from dTV(D,U ). 59 In order to obtain such estimates ψ(i), we shall be interested in finding a reference point x. Suppose next that instead of being able to compute ψ(i) exactly, we were able to compute an estimate ψ(i) such that ψ(i) − ψ(i) ≤ ǫ/2. By using ψ(i) instead of ψ(i) for each of the Θ(1/ǫ2) sampled points we would incur an additional additive error of at most ǫ/2. Observe first that for i such that D(i) ≤ ǫ/(2N ) we have that ψ(i) ≥ 1 − ǫ/2, so the estimate ψ(i) = 1 meets our requirements. Similarly, for i such that D(i) ≥ 1/N , any estimate ψ(i) ∈ [0, ǫ/2] can be used. Finally, for i such that D(i) ∈ [ǫ/(2N ), 1/N ], if we can obtain an estimate bD(i) such that bD(i) ∈ [1 − ǫ/2, 1 + ǫ/2]D(i), then we can use ψ(i) = 1 − N · bD(i). Namely, we shall be interested in finding a pair (x, bD(x)) such that bD(x) ∈ [1 − ǫ/c, 1 + ǫ/c]D(x) for some sufficiently large constant c, and such that D(x) = Ω(ǫ/N ) and D(x) = O(1/(ǫN )). In Subsection 7.1 we describe a procedure for finding such a reference point. More precisely, the procedure is required to find such a reference point (with high constant probability) only under a certain condition on D. It is not hard to verify (and we show this subsequently), that if this condition is not met, then dTV(D,U ) is very close to 1. In order to state the lemma we introduce the following notation. For γ ∈ [0, 1], let H D γ (67) def 1 = (cid:26)i : D(i) ≥ γN(cid:27) . 1. If D(H D Lemma 26 Given an input parameter κ ∈ (0, 1/4] as well as SAMP and PCOND query access to a distribution D, the procedure Find-Reference (Algorithm 12) either returns a pair (x, bD(x)) where x ∈ [N ] and bD(x) ∈ [0, 1] or returns No-Pair. The procedure satisfies the following: κ ) ≤ 1 − κ, then with probability at least 9/10, the procedure returns a pair (x, bD(x)) such that bD(x) ∈ [1 − 2κ, 1 + 3κ]D(x) and D(x) ∈(cid:2) κ it returns a pair (x, bD(x)) such that bD(x) ∈ [1 − 2κ, 1 + 3κ]D(x) and D(x) ∈(cid:2) κ κ ) > 1− κ, then with probability at least 9/10, the procedure either returns No-Pair or The procedure performs O(1/κ20) PCOND and SAMP queries. κ(cid:3) · 1 κ(cid:3) · 1 2. If D(H D 8 , 4 8 , 4 N . N . Once we have a reference point x we can use it to obtain an estimate ψ(i) for any i of our choice, using the procedure Compare, whose properties are stated in Lemma 2 (see Subsection 3.1). In what follows we shall use the shorthand Hγ instead of H D Theorem 14 With probability at least 2/3, the estimate d returned by Algorithm 11 satisfies: d = dTV(D,U ) ± O(ǫ). The number of queries performed by the algorithm is O(1/ǫ20). Proof: γ . Let E0 denote the event that the procedure Find-Reference (Algorithm 12) obeys the requirements in Lemma 26, where by Lemma 26 the event E0 holds with probability at least 9/10. Conditioned on E0, the algorithm outputs d = 1 right after calling the procedure (because the procedure returns No-Pair) only when D(Hκ) > 1 − κ = 1 − ǫ/8. We claim that in this case dTV(D,U ) ≥ 1 − 2ǫ/8 = 1 − ǫ/4. To verify this, observe that dTV(D,U ) = Xi:D(i)>1/N(cid:18)D(i) − 1 N(cid:19) ≥ Xi∈Hκ(cid:18)D(i) − 1 N(cid:19) = D(Hκ) − Hκ N ≥ D(Hκ) − κ . (68) 60 Algorithm 11: Estimating the Distance to Uniformity Input: PCOND and SAMP query access to a distribution D and a parameter ǫ ∈ [0, 1]. 1. Call the procedure Find-Reference (Algorithm 12) with κ set to ǫ/8. If it returns No-Pair, then output d = 1 as the estimate for the distance to uniformity. Otherwise, let , bD(x) ǫ/(4N )o. 2. Select a sample S of Θ(1/ǫ2) points uniformly. bD(x) 4. For each point y ∈ S: (x, bD(x)) be its output. 3. Let K = maxn 2/N (a) Call Compare(cid:16){x},{y}, κ, K, (b) If Compare returns High or it returns a value ρ(y) such that ρ(y) · bD(x) ≥ 1/N , then (c) Else, if Compare returns Low or it returns a value ρ(y) such that ρ(y) · bD(x) ≤ ǫ/4N , (d) Else set ψ(y) = 1−N · ρ(y) · bD(x). then set ψ(y) = 1; 5. Output d = 1 1 10S(cid:17). set ψ(y) = 0; ψ(y). SPy∈S Thus, in this case the estimate d is as required. We turn to the case in which the procedure Find-Reference returns a pair (x, bD(x)) such that bD(x) ∈ [1 − 2κ, 1 + 3κ]D(x) and D(x) ∈(cid:2) κ We start by defining two more “desirable” events, which hold (simultaneously) with high con- stant probability, and then show that conditioned on these events holding (as well as E0), the output of the algorithm is as required. Let E1 be the event that the sample S satisfies N . 8 , 4 κ(cid:3) · 1 ψ(y) − dTV(D,U )(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 1 SXy∈S (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ ǫ/2 . (69) By an additive Chernoff bound, the event E1 holds with probability at least 9/10. Next, let E2 be the event that all calls to the procedure Compare return answers as specified in Lemma 2. Since Compare is called S times, and for each call the probability that it does not return an answer as specified in the lemma is at most 1/(10S), by the union bound the probability that E2 holds is at least 9/10. From this point on assume events E0, E1 and E2 all occur, which holds with probability at least 1 − 3/10 ≥ 2/3. Since E2 holds, we get the following. 61 1. When Compare returns High for y ∈ S (so that ψ(y) is set to 0) we have that D(y) > K · D(x) ≥ implying that ψ(y) = ψ(y). 1 N , 2/N bD(x) · D(x) > 2. When Compare returns Low for y ∈ S (so that ψ(y) is set to 1) we have that D(y) < D(x) K ≤ ǫ 2N , D(x) bD(x)/(ǫ/4N ) ≤ (70) (71) 3. When Compare returns a value ρ(y) it holds that ρ(y) ∈ [1 − κ, 1 + κ](D(y)/D(x)), so that implying that ψ(y) ≤ ψ(y) + ǫ/2 (and clearly ψ(y) ≤ ψ(y)). ρ(y) · bD(x) ∈ [(1 − κ)(1 − 2κ), (1 + κ)(1 + 3κ)]D(y). Since κ = ǫ/8, if ρ(y) · bD(x) ≥ 1/N (so that ψ(y) is set to 0), then ψ(y) < ǫ/2, if ρ(y) · bD(x) ≤ ǫ/4N (so that ψ(y) is set to 1), then ψ(y) ≥ 1 − ǫ/2, and otherwise ψ(y) − ψ(y) ≤ ǫ/2. ψ(y) + ǫ/2 ⊆ [dTV(D,U )−ǫ, dTV(D,U )+ǫ] ψ(y) ∈ 1 SXy∈S 1 SXy∈S 1 SXy∈S ψ(y) − ǫ/2, (72) It follows that d = as required. The number of queries performed by the algorithm is the number of queries performed by the procedure Find-Reference, which is O(1/ǫ20), plus Θ(1/ǫ2) times the number of queries performed in each call to Compare. The procedure Compare is called with the parameter K, which is bounded by O(1/ǫ2), the parameter η, which is Ω(ǫ), and δ, which is Ω(1/ǫ2). By Lemma 2, the number of queries performed in each call to Compare is O(log(1/ǫ)/ǫ4). The total number of queries performed is hence O(1/ǫ20). 7.1 Finding a reference point In this subsection we prove Lemma 26. We start by giving the high-level idea behind the procedure. For a point x ∈ [N ] and γ ∈ [0, 1], let U D γ (x) be as defined in Equation (11). Since D is fixed throughout this subsection, we shall use the shorthand Uγ(x) instead of U D γ (x). Recall that κ is a parameter given to the procedure. Assume we had a point x for which D(Uκ(x)) ≥ κd1 and Uκ(x) ≥ κd2N for some constants d1 and d2 (so that necessarily D(x) = Ω(κd1 /N ) and D(x) = O(1/(κd2 N )). It is not hard to verify (and we show this in detail subsequently), that if D(H) ≤ 1 − κ, then a sample of size Θ(1/poly(κ)) distributed according to D will contain such a point x with high constant probability. Now suppose that we could obtain an estimate w of D(Uκ(x)) such that w ∈ [1 − κ, 1 + κ]D(Uκ(x)) and an estimate u of Uκ(x) such that u ∈ [1− κ, 1 + κ]Uκ(x). By the definition of Uκ(x) we have that ( w/u) ∈ [1− O(κ), 1 + O(κ)]D(x). Obtaining good estimates of D(Uκ(x)) and Uκ(x) (for x such that both Uκ(x) and D(Uκ(x)) are sufficiently large) might be infeasible. This is due to the possible existence of many points y for 62 which D(y) is very close to (1+κ)D(x) or D(x)/(1+κ) which define the boundaries of the set Uκ(x). For such points it is not possible to efficiently distinguish between those among them that belong to Uκ(x) (so that they are within the borders of the set) and those that do not belong to Uκ(x) (so that they are just outside the borders of the set). However, for our purposes it suffices to estimate the weight and size of some set Uα(x) such that α ≥ κ (so that Uκ(x) ⊆ Uα(x)) and α is not much larger than κ (e.g., α ≤ 2κ)). To this end we can apply Procedure Estimate-Neighborhood (see Subsection 3.2), which (conditioned on D(Uκ(x)) being above a certain threshold), returns a pair ( w(x), α) such that w(x) is a good estimate of D(Uα(x)). Furthermore, α is such that for α′ slightly larger than α, the weight of Uα′(x)\ Uα(x) is small, allowing us to obtain also a good estimate µ(x) of Uα(x)/N . Algorithm 12: Procedure Find-Reference Input: PCOND and SAMP query access to a distribution D and a parameter κ ∈ (0, 1/4] 1. Select a sample X of Θ(log(1/κ)/κ2) points distributed according to D. 2. For each x ∈ X do the following: (a) Call Estimate-Neighborhood with the parameters κ as in the input to Find-Reference, β = κ2/(40 log(1/κ)), η = κ, and δ = 1/(40X). Let θ = κηβδ/64 = Θ(κ6/ log2(1/κ)) (as in Find-Reference). (b) If Estimate-Neighborhood returns a pair ( w(x), α(x)) such that w(x) < κ2/20 log(1/κ), then go to Line 2 and continue with next x ∈ X. (c) Select a sample Yx of size Θ(log2(1/κ)/κ5) distributed uniformly. (d) For each y ∈ Yx call Compare({x},{y}, θ/4, 4, 1/40XYx), and let the output be denoted ρx(y). (e) Let µ(x) be the fraction of occurrences of y ∈ Yx such that ρx(y) ∈ [1/(1 + α + θ/2), 1 + α + θ/2]. (f) Set bD(x) = w(x)/(µ(x)N ). 3. If for some point x ∈ X we have w(x) ≥ κ2/20 log(1/κ), µ(x) ≥ κ3/20 log(1/κ), and κ/4N ≤ bD(x) ≤ 2/(κN ), then return (x, bD(x)). Otherwise return No-Pair. Proof of Lemma 26: We first introduce the following notation. L def= ni : D(i) < κ 2No , M def= (cid:26)i : κ 2N ≤ D(i) < 1 κN(cid:27) . (73) κ where H D Let H = H D κ is as defined in Equation (67). Observe that D(L) < κ/2, so that if D(H) ≤ 1 − κ, then D(M ) ≥ κ/2. Consider further partitioning the set M of “medium weight” points into buckets M1, . . . , Mr where r = log1+κ(2/κ2) = Θ(log(1/κ)/κ) and the bucket Mj is defined as follows: Mj def = ni : (1 + κ)j−1 · We consider the following “desirable” events. κ 2No . κ 2N ≤ D(i) < (1 + κ)j · 63 (74) 1. Let E1 be the event that conditioned on the existence of a bucket Mj such that D(Mj) ≥ κ/2r = Ω(κ2/ log(1/κ)), there exists a point x∗ ∈ X that belongs to Mj. By the setting of the size of the sample X, the (conditional) event E1 holds with probability at least 1 − 1/40. 2. Let E2 be the event that all calls to Estimate-Neighborhood return an output as specified by Lemma 3. By Lemma 3, the setting of the confidence parameter δ in each call and a union bound over all X calls, E2 holds with probability at least 1 − 1/40. 3. Let E3 be the event that for each x ∈ X we have the following. (a) If Uα(x)(x) If Uα(x)(x) N N ≥ < (b) Let ∆α(x),θ(x) ≥ < If ∆α(x),θ(x) If ∆α(x),θ(x) N N def κ3 κ3 Yx Yx ∈ [1 − η/2, 1 + η/2]Uα(x)(x) 40 log(1/κ) , then Yx∩Uα(x)(x) 40 log(1/κ) , then Yx∩Uα(x)(x) = Uα(x)+θ(x) \ Uα(x)(x) (where θ is as specified by the algorithm). 240 log(1/κ) , then Yx∩∆α(x),θ(x) 240 log(1/κ) , then Yx∩∆α(x),θ(x) ≤ 2 · ∆α(x),θ(x) 120 log(1/κ) . 30 log(1/κ) ; < < κ4 κ4 N κ4 ; N κ3 ; Yx Yx By the size of each set Yx and a union bound over all x ∈ X, the event E3 holds with probability at least 1 − 1/40. 4. Let E4 be the event that all calls to Compare return an output as specified by Lemma 2. By Lemma 2, the setting of the confidence parameter δ in each call and a union bound over all (at most) X · Y calls, E3 holds with probability at least 1 − 1/40. Assuming events E1–E4 all hold (which occurs with probability at least 9/10) we have the following. 1. By E2, for each x ∈ X such that w(x) ≥ κ2/20 log(1/κ) (so that x may be selected for the output of the procedure) we have that D(Uα(x)(x)) ≥ κ2/40 log(1/κ). The event E2 also implies that for each x ∈ X we have that D(∆α(x),θ(x)) ≤ ηβ/16 ≤ (η/16) · D(Uα(x)(x)), so that ∆α(x),θ(x) N ≤ η(1 + α(x))(1 + α(x) + θ) 16 · Uα(x)(x) N ≤ η 6 · Uα(x)(x) N . (75) 2. Consider any x ∈ X such that w(x) ≥ κ2/20 log(1/κ). Let Tx = {y ∈ Yx : ρx(y) ∈ [1/(1+ α+ θ/2), (1 + α + θ/2]}, so that µ(x) = Tx/Yx. By E4, for each y ∈ Yx ∩ Uα(x)(x) we have that ρx(y) ≤ (1 + α)(1 + θ/4) ≤ (1 + α + θ/2) and ρx(y) ≥ (1 + α)−1(1 − θ/4) ≥ (1 + α + θ/2)−1, so that y ∈ Tx. On the other hand, for each y /∈ Yx ∩ Uα(x)+θ(x) we have that ρx(y) > (1 + α + θ)(1 − θ/4) ≥ 1 + α + θ/2 or ρx(y) < (1 + α + θ)−1(1 − θ/4) < (1 + α + θ/2)−1, so that y /∈ Tx. It follows that def Yx ∩ Uα(x)(x) ⊆ Tx ⊆ Yx ∩ (Uα(x)(x) ∪ ∆α(x),θ(x)) . (76) By E3, when µ(x) = Tx/Yx ≥ κ3/20 log(1/κ), then necessarily µ(x) ∈ [1−η, 1+η]Uα(x)(x)/N . To verify this consider the following cases. 64 (a) If Uα(x)(x) N κ3 ≥ 40 log(1/κ) , then (by the left-hand-side of Equation (76) and the definition of , and (by the right-hand-side of Equation (76), E3) we get that µ(x) ≥ (1− η/2)Uα(x)(x) Equation (75) and E3) we get that µ(x) ≤ (1 + η/2)Uα(x)(x) η)Uα(x)(x) . (b) If Uα(x)(x) < κ3 N N N N 40 log(1/κ) , then (by the right-hand-side of Equation (76), Equation (75) and E3) we get that µ(x) < κ3 30 log(1/κ) + κ4 120 log(1/κ) < κ3/20 log(1/κ). 3. If D(H) ≤ 1 − κ, so that D(M ) ≥ κ/2, then there exists at least one bucket Mj such that D(Mj) ≥ κ/2r = Ω(κ2/ log(1/κ)). By E1, the sample X contains a point x∗ ∈ Mj. By the definition of the buckets, for this point x∗ we have that D(Uκ(x∗)) ≥ κ/2r ≥ κ2/(10 log(1/κ)) and Uκ(x∗) ≥ (κ2/2r)N ≥ κ3/(10 log(1/κ)). + 2(η/6)Uα(x)(x) N < (1 + By the first two items above and the setting η = κ we have that for each x such that w(x) ≥ κ2/20 log(1/κ) and µ(x) ≥ κ3/20 log(1/κ), 1 + κ bD(x) ∈(cid:20) 1 − κ 1 + κ , 1 − κ(cid:21) D(x) ⊂ [1 − 2κ, 1 + 3κ]D(x) . necessarily, x = x∗), and the first item is established as well. of the lemma. This establishes the second item in the lemma. By combining all three items we Thus, if the algorithm outputs a pair (x, bD(x)) then it satisfies the condition stated in both items get that if D(H) ≥ 1 − κ then the algorithm outputs a pair (x, bD(x)) (where possibly, but not Turning to the query complexity, the total number of PCOND queries performed in the X = O(log(1/κ)/κ2) calls to Estimate-Neighborhood is O(cid:16)X log(1/δ)2 log(1/(βη)) (cid:17) = O(1/κ18), and the total number 8 A O(cid:16) log3 N ǫ3 (cid:17)-query ICONDD algorithm for testing uniformity of PCOND queries performed in the calls to Compare (for at most all pairs x ∈ X and y ∈ Yx) is O(1/κ20). κ2η4β3δ2 In this and the next section we consider ICOND algorithms for testing whether an unknown dis- tribution D over [N ] is the uniform distribution versus ǫ-far from uniform. Our results show that ICOND algorithms are not as powerful as PCOND algorithms for this basic testing problem; in this section we give a poly(log N, 1/ǫ)-query ICONDD algorithm, and in the next section we prove that any ICONDD algorithm must make Ω(log N ) queries. In more detail, in this section we describe an algorithm ICONDD-Test-Uniform and prove the following theorem: Theorem 15 ICONDD-Test-Uniform is a O( log3 N )-query ICONDD testing algorithm for uni- ǫ3 formity, i.e. it outputs ACCEPT with probability at least 2/3 if D = U and outputs REJECT with probability at least 2/3 if dTV(D,U ) ≥ ǫ. 65 N + ǫ Intuition. Recall that, as mentioned in Subsection 4.1, any distribution D which is ǫ-far from uniform must put Ω(ǫ) probability mass on “significantly heavy” elements (that is, if we define H′ =(cid:8) h ∈ [N ](cid:12)(cid:12) D(h) ≥ 1 4N (cid:9), it must hold that D(H′) ≥ ǫ/4). Consequently a sample of O(1/ǫ) points drawn from D will contain such a point with high probability. Thus, a natural approach to testing whether D is uniform is to devise a procedure that, given an input point y, can distinguish between the case that y ∈ H′ and the case that D(y) = 1/N (as it is when D = U ). We give such a procedure, which uses the ICONDD oracle to perform a sort of binary search over intervals. The procedure successively “weighs” narrower and narrower intervals until it converges on the single point y. In more detail, we consider the interval tree whose root is the whole domain [N ], with two children {1, . . . , N/2} and {N/2 + 1, . . . , N}, and so on, with a single point at each of the N leaves. Our algorithm starts at the root of the tree and goes down the path that corresponds to y; at each child node it uses Compare to compare the weight of the current node to the weight of its sibling under D. If at any point the estimate deviates significantly from the value it should have if D were uniform (namely the weights should be essentially equal, with slight deviations because of even/odd issues), then the algorithm rejects. Assuming the algorithm does not reject, it provides a (1± O(ǫ))-accurate multiplicative estimate of D(y), and the algorithm checks whether this estimate is sufficiently close to 1/N (rejecting if this is not the case). If no point in a sample of Θ(1/ǫ) points (drawn according to D) causes rejection, then the algorithm accepts. Algorithm 13: Binary-Descent Input: parameter ǫ > 0; integers 1 ≤ a ≤ b ≤ N ; y ∈ [a, b]; query access to ICONDD oracle 1: if a = b then 2: 3: end if return 1 4: Let c =(cid:4) a+b 2 (cid:5); ∆ = (b − a + 1)/2. 5: if y ≤ c then 6: Define Iy = {a, . . . , c}, I¯y = {c + 1, . . . , b} and ρ = ⌈∆⌉/⌊∆⌋ 7: else 8: Define I¯y = {a, . . . , c}, Iy = {c + 1, . . . , b} and ρ = ⌊∆⌋/⌈∆⌉ 9: end if 10: Call Compare on Iy, I¯y with parameters η = ǫ 48 log N , K = 2, δ = ǫ 100(1+log N ) to get an 48 log N ] · ρ (this includes the case that ρ is High or Low) then estimate ρ of D(Iy)/D(I¯y) 48 log N , 1 + ǫ return REJECT 11: if ρ /∈ [1 − ǫ 12: 13: end if 14: Call recursively Binary-Descent on input (ǫ, the endpoints of Iy, y); 15: if Binary-Descent returns a value ν then 16: 17: else 18: 19: end if 1+ρ · ν return REJECT return ρ The algorithm we use to perform the “binary search” described above is Algorithm 13, Binary- Descent. We begin by proving correctness for it: 66 Algorithm 14: ICONDD-Test-Uniform Input: error parameter ǫ > 0; query access to ICONDD oracle 1: Draw t = 20 2: for j = 1 to t do 3: ǫ points y1, . . . , yt from SAMPD. 4: 5: Call Binary-Descent(ǫ, 1, N, yj) and return REJECT if it rejects, otherwise let dj be the value it returns as its estimate of D(yj) if dj /∈ [1 − ǫ end if 6: 7: end for 8: return ACCEPT return REJECT 12 , 1 + ǫ 12 ] · 1 N then Lemma 27 Suppose the algorithm Binary-Descent is run with inputs ǫ ∈ (0, 1], a = 1, b = N , and y ∈ [N ], and is provided ICOND oracle access to distribution D over [N ]. It performs O(log3 N/ǫ2) queries and either outputs a value D(y) or REJECT, where the following holds: 1. if D(y) ≥ 1 D(y) ∈ [1 − ǫ/12, 1 + ǫ/12]D(y) or REJECT; N + ǫ 4N , then with probability at least 1 − ǫ 100 the procedure either outputs a value 2. if D = U , then with probability at least 1 − ǫ 100 the procedure outputs a value D(y) ∈ [1 − ǫ/12, 1 + ǫ/12] · 1 N . Proof of Lemma 27: The claimed query bound is easily verified, since the recursion depth is at most 1 + log N and the only queries made are during calls to Compare, each of which performs O(log(1/δ)/γ2) = O(log2 N/ǫ2) queries. Let E0 be the event that all calls to Compare satisfy the conditions in Lemma 2; since each of them succeeds with probability at least 1− δ = 1− 100(1+log N ) , a union bound shows that E0 holds with probability at least 1 − ǫ/100. We hereafter condition on E0. ǫ We first prove the second part of the lemma where D = U . Fix any specific recursive call, say the j-th, during the execution of the procedure. The intervals I (j) ¯y used in that execution of the algorithm are easily seen to satisfy D(Iy)/D(I¯y) ∈ [1/K, K] (for K = 2), so by event E0 it must be the case that Compare returns an estimate ρj ∈ [1 − ǫ ¯y ). Since D = U , we have that D(I (j) ¯y ) = ρ(j), so the overall procedure returns a numerical value rather than REJECT. 48 log N ] · D(I (j) 48 log N , 1 + ǫ y )/D(I (j) y )/D(I (j) y , I (j) Let M = ⌈log N⌉ be the number of recursive calls (i.e., the number of executions of Line 14). Note that we can write D(y) as a product D(y) = D(I (j) y ) y ) + D(I (j) ¯y ) D(I (j) = MYj=1 MYj=1 D(I (j) y )/D(I (j) ¯y ) D(I (j) y )/D(I (j) ¯y ) + 1 . (77) We next observe that for any 0 ≤ ǫ′ < 1 and ρ, d > 0, if ρ ∈ [1 − ǫ′, 1 + ǫ′]d then we have ρ+1 ∈ [1 − ǫ′ d+1 (by straightforward algebra). Applying this M times, we get 2 , 1 + ǫ′] d ρ 67 MYj=1 ρj ρj + 1 ∈ "(cid:18)1 − ∈ "(cid:18)1 − ∈ h1 − ǫ 12 ǫ ǫ ,(cid:18)1 + 96 log N(cid:19)M ,(cid:18)1 + 96 log N(cid:19)M 12i D(y). , 1 + ǫ D(I (j) y )/D(I (j) ¯y ) D(I (j) y )/D(I (j) ¯y ) + 1 ǫ 48 log N(cid:19)M# · MYj=1 48 log N(cid:19)M# · D(y) ǫ SinceQM j=1 ρj ρj +1 is the value that the procedure outputs, the second part of the lemma is proved. The proof of the first part of the lemma is virtually identical. The only difference is that now it is possible that Compare outputs High or Low at some call (since D is not uniform it need not be the case that D(I (j) ¯y ) = ρ(j)), but this is not a problem for (i) since in that case Binary-Descent would output REJECT. y )/D(I (j) See Algorithm 13 for a description of the testing algorithm ICONDD-Test-Uniform. We now prove Theorem 15: Proof of Theorem 15: Define E1 to be the event that all calls to Binary-Descent satisfy the conclusions of Lemma 27. With a union bound over all these t = 20/ǫ calls, we have Pr[E1] ≥ 8/10. Completeness: Suppose D = U , and condition again on E1. Since this implies that Binary- Descent will always return a value, the only case ICONDD-Test-Uniform might reject is by reaching Line 5. However, since it is the case that every value dj returned by the procedure satisfies D(y) ∈ [1 − ǫ/12, 1 + ǫ/12] · 1 N , this can never happen. Soundness: Suppose dTV(D,U ) ≥ ǫ. Let E2 be the event that at least one of the yi’s drawn in Line 1 belongs to H′. As D(H′) ≥ ǫ/4, we have Pr[E2] ≥ 1 − (1 − ǫ/4)20/ǫ ≥ 9/10. Conditioning on both E1 and E2, for such a yj, one of two cases below holds: puts REJECT; • either the call to Binary-Descent outputs REJECT and ICONDD-Test-Uniform out- • or a value dj is returned, for which dj ≥ (1 − ǫ N > (1 + ǫ/12)/N (where we used the fact that E1 holds); and ICONDD-Test-Uniform reaches Line 5 and rejects. 12 )(1 + ǫ 4 ) · 1 Since Pr[E1 ∪ E2] ≥ 7/10, ICONDD-Test-Uniform is correct with probability at least 2/3. Fi- nally, the claimed query complexity directly follows from the t = Θ(1/ǫ) calls to Binary-Descent, each of which makes O(log3 N/ǫ2) queries to ICONDD. 9 An Ω(log N/ log log N ) lower bound for ICONDD algorithms that test uniformity In this section we prove that any ICONDD algorithm that ǫ-tests uniformity even for constant ǫ must have query complexity Ω(log N ). This shows that our algorithm in the previous subsection is not too far from optimal, and sheds light on a key difference between ICOND and PCOND oracles. 68 Theorem 16 Fix ǫ = 1/3. Any ICONDD algorithm for testing whether D = U versus dTV(D, D∗) ≥ ǫ must make Ω(cid:16) log N log log N(cid:17) queries. To prove this lower bound we define a probability distribution PNo over possible “No”-distributions (i.e. distributions that have variation distance at least 1/3 from U ). A distribution drawn from PNo is constructed as follows: first (assuming without loss of generality that N is a power of 2), we par- tition [N ] into b = 2X consecutive intervals of the same size ∆ = N 2X , which we refer to as “blocks”, 3 log N, 1 where X is a random variable distributed uniformly on the set { 1 3 log N}. Once the block size ∆ is determined, a random offset y is drawn uniformly at random in [N ], and all block endpoints are shifted by y modulo [N ] (intuitively, this prevents the testing algorithm from “knowing” a priori that specific points are endpoints of blocks). Finally, independently for each block, a fair coin is thrown to determine its profile: with probability 1/2, each point in the first half of the block will have probability weight 1−2ǫ N and each point in the second half will have probability 1+2ǫ N (such a block is said to be a low-high block, with profile ↓↑). With probability 1/2 the reverse is true: each point in the first half has probability 1+2ǫ N and each point in the second half has probability 1−2ǫ N (a high-low block ↑↓). It is clear that each distribution D in the support of PNo defined in this way indeed has dTV(D,U ) = ǫ. 3 log N + 1, . . . , 2 To summarize, each “No”-distribution D in the support of PNo is parameterized by (b + 2) parameters: its block size ∆, offset y, and profile ϑ ∈ {↓↑,↑↓}b. Note that regardless of the profile vector, each block always has weight exactly ∆/N . We note that while there is only one “Yes”-distribution U , it will sometimes be convenient for the analysis to think of U as resulting from the same initial process of picking a block size and offset, but without the subsequent choice of a profile vector. We sometimes refer to this as the “fake construction” of the uniform distribution U (the reason for this will be clear later). The proof of Theorem 16 will be carried out in two steps. First we shall restrict the analysis to non-adaptive algorithms, and prove the lower bound for such algorithms. This result will then be extended to the general setting by introducing (similarly to Subsection 5.2) the notion of a query- faking algorithm, and reducing the behavior of adaptive algorithms to non-adaptive ones through an appropriate sequence of such query-faking algorithms. Before proceeding, we define the transcript of the interaction between an algorithm and a ICONDD oracle. Informally, the transcript captures the entire history of interaction between the algorithm and the ICONDD oracle during the whole sequence of queries. Definition 7 Fix any (possibly adaptive) testing algorithm A that queries an ICONDD oracle. The transcript of A is a sequence T = (Iℓ, sℓ)ℓ∈N∗ of pairs, where Iℓ is the ℓ-th interval provided by the algorithm as input to ICONDD, and sℓ ∈ Iℓ is the response that ICONDD provides to this query. Given a transcript T , we shall denote by T k the partial transcript induced by the first k queries, i.e. T k = (Iℓ, sℓ)1≤ℓ≤k. Equipped with these definitions, we now turn to proving the theorem in the special case of non-adaptive testing algorithms. Observe that there are three different sources of randomness in our arguments: (i) the draw of the “No”-instance from PNo, (ii) the internal randomness of the 69 testing algorithm; and (iii) the random draws from the oracle. Whenever there could be confusion we shall explicitly state which probability space is under discussion. 9.1 A lower bound against non-adaptive algorithms Throughout this subsection we assume that A is an arbitrary, fixed, non-adaptive, randomized log N algorithm that makes exactly q ≤ τ · log log N queries to ICONDD; here τ > 0 is some absolute constant that will be determined in the course of the analysis. (The assumption that A always makes exactly q queries is without loss of generality since if in some execution the algorithm makes q′ < q queries, it can perform additional “dummy” queries). In this setting algorithm A corresponds to a distribution PA over q-tuples ¯I = (I1, . . . , Iq) of query intervals. The following theorem will directly imply Theorem 16 in the case of non-adaptive algorithms: Theorem 17 (cid:12)(cid:12)(cid:12)PrD∼PNo[AICONDD outputs ACCEPT] − Pr[AICONDU outputs ACCEPT](cid:12)(cid:12)(cid:12) ≤ 1/5. (78) Observe that in the first probability of Equation (78) the randomness is taken over the draw of D from PNo, the draw of ¯I ∼ PA that A performs to select its sequence of query intervals, and the randomness of the ICONDD oracle. In the second one the randomness is just over the draw of ¯I from PA and the randomness of the ICONDU oracle. Intuition for Theorem 17. The high-level idea is that the algorithm will not be able to distin- guish between the uniform distribution and a “No”-distribution unless it manages to learn some- thing about the “structure” of the blocks in the “No”-case, either by guessing (roughly) the right block size, or by guessing (roughly) the location of a block endpoint and querying a short interval containing such an endpoint. In more detail, we define the following “bad events” (over the choice of D and the points si) for a fixed sequence ¯I = (I1, . . . , Iq) of queries (the dependence on ¯I is omitted in the notation for the sake of readability): BN size =(cid:8) ∃ℓ ∈ [q](cid:12)(cid:12) ∆/ log N ≤ Iℓ ≤ ∆ · (log N )2(cid:9) BN boundary = { ∃ℓ ∈ [q] Iℓ < ∆/ log N and Iℓ intersects two blocks } BN middle = { ∃ℓ ∈ [q] Iℓ < ∆/ log N and Iℓ intersects both halves of the same block } ℓ,outer = {∆ · (log N )2 < Iℓ and sℓ belongs to a block not contained entirely in Iℓ} BN ℓ,collide = {∆ · (log N )2 < Iℓ and ∃j < ℓ, sℓ and sj belong to the same block} BN ℓ ∈ [q] ℓ ∈ [q] The first three events depend only on the draw of D from PNo, which determines ∆ and y, while the last 2q events also depend on the random draws of sℓ from the ICONDD oracle. We define in the same fashion the corresponding bad events for the “Yes”-instance (i.e. the uniform distribution U ) BY ℓ,collide, using the notion of the “fake construction” of U mentioned above. ℓ,outer and BY boundary, BY size, BY middle, BY 70 Events BN size and BY size correspond to the possibility, mentioned above, that algorithm A “guesses” essentially the right block size, and events BN middle correspond to the possibility that algorithm A “guesses” a short interval containing respectively a block endpoint or a block midpoint. The final bad events correspond to A guessing a “too-large” block size but “getting lucky” with the sample returned by ICOND, either because the sample belongs to one of the (at most two) outer blocks not entirely contained in the query interval, or because A has already received a sample from the same block as the current sample. boundary and BN boundary, BY middle, BY We can now describe the failure events for both the uniform distribution and for a “No”- distribution as the union of the corresponding bad events: BN ( ¯I) = BN size ∪ BN boundary ∪ BN BY ( ¯I) = BY size ∪ BY boundary ∪ BY middle ∪ q[ℓ=1 middle ∪ q[ℓ=1 BN BY ℓ,outer! ∪ q[ℓ=1 ℓ,outer! ∪ q[ℓ=1 ℓ,collide! ℓ,collide! BN BY These failure events can be interpreted, from the point of view of the algorithm A, as the “opportunity to potentially learn something;” we shall argue below that if the failure events do not occur then the algorithm gains no information about whether it is interacting with the uniform distribution or with a “No”-distribution. Structure of the proof of Theorem 17. First, observe that since the transcript is the result of the interaction of the algorithm and the oracle on a randomly chosen distribution, it is itself a random variable; we will be interested in the distribution over this random variable induced by the draws from the oracle and the choice of D. More precisely, for a fixed sequence of query sets ¯I, let Z N ¯I denote the random variable over “No”-transcripts generated when D is drawn from PNo. Note that this is a random variable over the probability space defined by the random draw of D and the draws of si by ICONDD(Iℓ). We define AN ¯I as the resulting distribution over these “No”-transcripts. Similarly, Z Y ¯I will be the random variable over “Yes”-transcripts, with corresponding distribution AY ¯I . As noted earlier, the nonadaptive algorithm A corresponds to a distribution PA over q-tuples ¯I of query intervals. We define AN as the distribution over transcripts corresponding to first drawing ¯I from PA and then making a draw from AN ¯I . Similarly, we define AY as the distribution over transcripts corresponding to first drawing ¯I from PA and then making a draw from AY ¯I . To prove Theorem 17 it is sufficient to show that the two distributions over transcripts described above are statistically close: Lemma 28 dTV(cid:0)AY, AN(cid:1) ≤ 1/5. The proof of this lemma is structured as follows: first, for any fixed sequence of q queries ¯I, we bound the probability of the failure events, both for the uniform and the “No”-distributions: Claim 29 For each fixed sequence ¯I of q query intervals, we have Pr(cid:2)BY ( ¯I)(cid:3) ≤ 1/10 PrD←PNo(cid:2)BN ( ¯I)(cid:3) ≤ 1/10. and 71 (Note that the first probability above is taken over the randomness of the ICONDU responses and the choice of offset and size in the “fake construction” of U , while the second is over the random draw of D ∼ PNo and over the ICONDD responses.) Next we show that, provided the failure events do not occur, the distribution over transcripts is exactly the same in both cases: Claim 30 Fix any sequence ¯I = (I1, . . . , Iq) of q queries. Then, conditioned on their respective failure events not happening, Z N ¯I are identically distributed: ¯I and Z Y Finally we combine these two claims to show that the two overall distributions of transcripts are statistically close: for every transcript T = ((I1, s1), . . . , (Iq, sq)), PrhZ N ¯I = T (cid:12)(cid:12)(cid:12) BN Claim 31 Fix any sequence of q queries ¯I = (I1, . . . , Iq). Then dTV(cid:0)AN ¯I , AY ( ¯I)i = PrhZ Y ¯I = T (cid:12)(cid:12)(cid:12) BY ( ¯I)i . ¯I(cid:1) ≤ 1/5. Lemma 28 (and thus Theorem 17) directly follows from Claim 31 since, using the notation ¯s = (s1, . . . , sq) for a sequence of q answers to a sequence ¯I = (I1, . . . , Iq) of q queries, which together define a tran- script T ( ¯I, ¯s) = ((I1, s1), . . . , (Iq, sq)), dTV(cid:0)AY, AN(cid:1) = = 1 1 2X¯I X¯s (cid:12)(cid:12)PA( ¯I) · Pr(cid:2)Z Y 2X¯I PA( ¯I) ·X¯s (cid:12)(cid:12)Pr(cid:2)Z Y ¯I (cid:8)dTV(cid:0)AY ¯I(cid:1)(cid:9) ≤ 1/5 . ¯I , AN ≤ max ¯I = T ( ¯I, ¯s)(cid:3) − PA( ¯I) · Pr(cid:2)Z N ¯I = T ( ¯I, ¯s)(cid:3)(cid:12)(cid:12) ¯I = T ( ¯I, ¯s)(cid:3) − Pr(cid:2)Z N ¯I = T ( ¯I, ¯s)(cid:3)(cid:12)(cid:12) (79) This concludes the proof of Lemma 28 modulo the proofs of the above claims; we give those proofs in Subsection 9.1.1 below. 9.1.1 Proof of Claims 29 to 31 To prove Claim 29 we bound the probability of each of the bad events separately, starting with the “No”-case. (i) Defining the event BN ℓ,size as BN ℓ,size = {∆/ log N ≤ Iℓ ≤ ∆ · (log N )2} , size] ≤ Pq ℓ=1 Pr[BN we can use a union bound to get Pr[BN 2X X ∈ { 1 Iℓ there are O(log log N ) values of ∆ ∈ { N ∆/ log N ≤ Iℓ ≤ ∆ · (log N )2. Hence we have Pr[BN sequently Pr[BN size] = O(q(log log N )/ log N ). ℓ,size]. For any fixed setting of 3 log N, . . . , 2 3 log N}} for which ℓ,size] = O((log log N )/ log N ), and con- 72 (ii) Similarly, defining the event BN ℓ,boundary as BN ℓ,boundary = {Iℓ < ∆/ log N and Iℓ intersects two blocks} , we have Pr[BN of a uniform random offset y ∈ [N ] for the blocks, we have that Pr[BN and consequently Pr[BN ℓ,boundary]. For any fixed setting of Iℓ, recalling the choice ℓ,boundary] ≤ O(1/ log N ), ℓ=1 Pr[BN boundary] = O(q/ log N ). boundary] ≤Pq (iii) The analysis of BN middle is identical (by considering the midpoint of a block instead of its endpoint), yielding directly Pr[BN (iv) Fix ℓ ∈ [q] and recall that BN middle] = O(q/ log N ). ℓ,outer = {∆ · (log N )2 < Iℓ and sℓ is drawn from a block ( Iℓ}. Fix any outcome for ∆ such that ∆ · (log N )2 < Iℓ and let us consider only the randomness over the draw of sℓ from Iℓ. Since there are Ω((log N )2) blocks contained entirely in Iℓ, the probability that sℓ is drawn from a block not contained entirely in Iℓ (there are at most two such blocks, one at each end of Iℓ) is O(1/(log N )2). Hence we have Pr[BN ℓ,outer] ≤ O(1)/(log N )2. (v) Finally, recall that ℓ,collide = {∆ · (log N )2 < Iℓ and ∃j < ℓ s.t. sℓ and sj belong to the same block } . BN Fix ℓ ∈ [q] and a query interval Iℓ. Let rℓ be the number of blocks in Iℓ within which resides some previously sampled point sj, j ∈ [ℓ − 1]. Since there are Ω((log N )2) blocks in Iℓ and rℓ ≤ ℓ − 1, the probability that sℓ is drawn from a block containing any sj, j < ℓ, is O(ℓ/(log N )2). Hence we have Pr[BN ℓ,collide] = O(ℓ/(log N )2). With these probability bounds for bad events in hand, we can prove Claim 29: Proof of Claim 29: Recall that q ≤ τ · yields log N log log N . Recalling the definition of BN ( ¯I), a union bound Pr[BN ( ¯I)] ≤ Pr[BN size] + Pr[BN boundary] + Pr[BN Pr[BN ℓ,outer] + ℓ,collide] middle] + qXℓ=1 log N(cid:19) + log N(cid:19) + O(cid:18) q Pr[BN qXℓ=1 (log N )2(cid:19) + 1 O(cid:18) qXℓ=1 O(cid:18) ℓ (log N )2(cid:19) qXℓ=1 = O(cid:18)q · log log N log N (cid:19) + O(cid:18) q 1 10 , ≤ where the last inequality holds for a sufficiently small choice of the absolute constant τ. The same analysis applies unchanged for Pr[BY size], Pr[BY middle] and Pr[BY “fake construction” view of U as described earlier. The arguments for Pr[BY go through unchanged as well, and Claim 29 is proved. boundary], using the ℓ,collide] ℓ,outer] and Pr[BY Fix any ¯I = (I1, . . . , Iq) and any transcript T = ((I1, s1), . . . , (Iq, sq)). Proof of Claim 30: Recall that the length-ℓ partial transcript T ℓ is defined to be ((I1, s1), . . . , (Iℓ, sℓ)). We define the 73 ¯I and Z Y random variables Z N Claim 30 by establishing the following, which we prove by induction on ℓ: ¯I,ℓ to be the length-ℓ prefixes of Z N ¯I,ℓ and Z Y ¯I respectively. We prove ¯I,ℓ = T ℓ (cid:12)(cid:12)(cid:12) BN PrhZ N ( ¯I)i = PrhZ Y ¯I,ℓ = T ℓ (cid:12)(cid:12)(cid:12) BY ( ¯I)i . For the base case, it is clear that (80) holds with ℓ = 0. For the inductive step, suppose (80) holds for all k ∈ [ℓ − 1]. When querying Iℓ at the ℓ-th step, one of the following cases must hold (since we conditioned on the “bad events” not happening): (80) (1) Iℓ is contained within a half-block (more precisely, either entirely within the first half of a block or entirely within the second half). In this case the “yes” and “no” distribution oracles behave exactly the same since both generate sℓ by sampling uniformly from Iℓ. (2) The point sℓ belongs to a block, contained entirely in Iℓ, which is “fresh” in the sense that it contains no sj, j < ℓ. In the “No”-case this block may either be high-low or low-high; but since both outcomes have the same probability, there is another transcript with equal probability in which the two profiles are switched. Consequently (over the randomness in the draw of D ∼ PNo) the probability of picking sℓ in the “No”-distribution case is the same as in the uniform distribution case (i.e., uniform on the fresh blocks contained in Iℓ). This concludes the proof of Claim 30. Proof of Claim 31: following basic fact: Given Claims 29 and 30, Claim 31 is an immediate consequence of the Fact 32 Let D1, D2 be two distributions over the same finite set X. Let E1, E2, be two events such that Di[Ei] = αi ≤ α for i = 1, 2 and the conditional distributions (Di)Ei are identical, i.e. dTV((D1)E1 ) = 0. Then dTV(D1, D2) ≤ α. , (D2)E2 Proof: We first observe that since (D2)E2 be the case that (D1)E1 D2(E1 \ E2) = 0. Now let us write (E2) = 0, and likewise (D2)E2 (E2) = 0 and (D1)E1 , it must (E1) = 0. This implies that D1(E2 \ E1) = is identical to (D2)E2 2dTV(D1, D2) = Xx∈X\(E1∪E2) D1(x) − D2(x) + Xx∈E1∩E2 D1(x) − D2(x) + Xx∈E2\E1 We may upper boundPx∈E1∩E2 D1(x) − D2(x) byPx∈E1∩E2 D2(E1 ∩ E2), and the above discussion gives Px∈E1\E2 D1(x) − D2(x) = D1(E1 \ E2) and Px∈E2\E1 D1(x) − D2(x) = D2(E2 \ E1). We thus have (D1(x) + D2(x)) = D1(E1 ∩ E2) + D1(x) − D2(x) + D1(x) − D2(x). Xx∈E1\E2 2dTV(D1, D2) ≤ Xx∈X\(E1∪E2) ≤ Xx∈X\(E1∪E2) D1(x) − D2(x) + D1(E1) + D2(E2) D1(x) − D2(x) + α1 + α2. 74 Finally, since dTV((D1)E1 , (D2)E2 ) = 0, we have Xx∈X\(E1∪E2) D1(x) − D2(x) = D1(X \ (E1 ∪ E2)) − D2(X \ (E1 ∪ E2)) = (cid:12)(cid:12)D1(E1) − D2(E2)(cid:12)(cid:12) = α1 − α2. Thus 2dTV(D1, D2) ≤ α1 − α2 + α1 + α2 = 2 max{α1, α2} ≤ 2α, and the fact is established. This concludes the proof of Claim 31. 9.2 A lower bound against adaptive algorithms: Outline of the proof of Theorem 16 Throughout this subsection A denotes a general adaptive algorithm that makes q ≤ τ · log log N queries, where as before τ > 0 is an absolute constant. Theorem 16 is a consequence of the following theorem, which deals with adaptive algorithms: log N Theorem 18 (cid:12)(cid:12)(cid:12)PrD∼PNo[AICONDD outputs ACCEPT] − Pr[AICONDU outputs ACCEPT](cid:12)(cid:12)(cid:12) ≤ 1/5. The idea here is to extend the previous analysis for non-adaptive algorithms, and argue that “adaptiveness does not really help” to distinguish between D = U and D ∼ PNo given access to ICONDD. (81) As in the non-adaptive case, in order to prove Theorem 18, it is sufficient to prove that the transcripts for uniform and “No”-distributions are close in total variation distance; i.e., that dTV(cid:0)AY, AN(cid:1) ≤ 1/5. (82) The key idea used to prove this will be to introduce a sequence A scripts (where “otf” stands for “on the fly”), for 0 ≤ k ≤ q, such that (i) A of distributions over tran- (0),N otf = AY and (k),N otf will enable us to conclude by the triangle inequality, as A (q),N otf = AN, and (ii) the distance dTV(cid:16)A dTV(cid:0)AN, AY(cid:1) = dTV(cid:16)A (0),N otf (k),N otf , A (k+1),N otf , A (q),N otf (cid:17) ≤ (cid:17) for each 0 ≤ k ≤ q − 1 is “small”. This dTV(cid:16)A q−1Xk=0 (k+1),N otf (cid:17) . (k),N otf (83) , A To define this sequence, in the next subsection we will introduce the notion of an extended transcript, which in addition to the queries and samples includes additional information about the “local struc- ture” of the distribution at the endpoints of the query intervals and the sample points. Intuitively, this extra information will help us analyze the interaction between the adaptive algorithm and the oracle. We will then describe an alternative process according to which a “faking algorithm” (reminiscent of the similar notion from Subsection 5.2) can interact with an oracle to generate such an extended transcript. More precisely, we shall define a sequence of such faking algorithms, paramaterized by “how much faking” they perform. For both the original (“non-faking”) algorithm 75 A and for the faking algorithms, we will show how extended transcripts can be generated “on the over (regular) transcripts are obtained by truncating fly”. The aforementioned distributions A the extended transcripts that are generated on the fly (i.e., discarding the extra information), and we shall argue that they satisfy requirements (i) and (ii) above. (k),N otf Before turning to the precise definitions and the analysis of extended transcripts and faking algorithms, we provide the following variant of Fact 32, which will come in handy when we bound the right hand side of Equation (83). Fact 33 Let D1, D2 be two distributions over the same finite set X. Let E be an event such that Di[E] = αi ≤ α for i = 1, 2 and the conditional distributions (D1)E and (D2)E are statistically close, i.e. dTV((D1)E, (D2)E) = β. Then dTV(D1, D2) ≤ α + β. Proof: As in the proof of Fact 32, let us write 2dTV(D1, D2) = Xx∈X\E D1(x) − D2(x) +Xx∈E D1(x) − D2(x). We may upper boundPx∈E D1(x)−D2(x) byPx∈E(D1(x)+D2(x)) = D1(E)+D2(E) = α1 +α2; furthermore, Xx∈ ¯E D1(x) − D2(x) =Xx∈ ¯E(cid:12)(cid:12)(D1) ¯E(x) · D1( ¯E) − (D2) ¯E(x) · D2( ¯E)(cid:12)(cid:12) ≤ D1( ¯E) ·Xx∈ ¯E (D1) ¯E(x) − (D2) ¯E(x) +(cid:12)(cid:12)D1( ¯E) − D2( ¯E)(cid:12)(cid:12) · (D2) ¯E( ¯E) ≤ (1 − α1) · (2β) + α2 − α1 · 1 ≤ 2β + α2 − α1 Thus 2dTV(D1, D2) ≤ 2β + α1 − α2 + α1 + α2 = 2β + 2 max{α1, α2} ≤ 2(α + β), and the fact is established. 9.3 Extended transcripts and drawing D ∼ PNo on the fly. Observe that the testing algorithm, seeing only pairs of queries and answers, does not have direct access to all the underlying information – namely, in the case of a “No”-distribution, whether the profile of the block that the sample point comes from is ↓↑ or ↑↓. It will be useful for us to consider an “extended” version of the transcripts, which includes this information along with information about the profile of the “boundary” blocks for each queried interval, even though this information is not directly available to the algorithm. Definition 8 With the same notation as in Definition 7, the extended transcript of a sequence of queries made by A and the corresponding responses is a sequence E = (Iℓ, sℓ, bℓ)ℓ∈[q] of triples, ℓ ) ∈ {↓↑,↑↓}3 is a triple defined as follows: Let , bR where Iℓ and sℓ are as before, and bℓ = (bL BiL, . . . , BiR be the blocks that Iℓ intersects, going from left to right. Then ℓ , bsamp ℓ 1. bL ℓ is the profile of the block BiL; 76 2. bR ℓ is the profile of the block BiR; 3. bsamp ℓ is the profile of the block Bℓ ∈ {BiL, . . . , BiR} that sℓ belongs to. We define Ek to be the length-k prefix of an extended transcript E. As was briefly discussed prior to the current subsection, we shall be interested in considering algorithms that fake some answers to their queries. Specifically, given an adaptive algorithm A, we define A(1) as the algorithm that fakes its first query, in the following sense: If the first query made by A to the oracle is some interval I, then the algorithm A(1) does not call ICOND on I but instead chooses a point s uniformly at random from I and then behaves exactly as A would behave if the ICOND oracle had returned s in response to the query I. More generally, we define A(k) for all 0 ≤ k ≤ q as the algorithm behaving like A but faking its first k queries (note that A(0) = A). In Subsection 9.3.1 we explain how extended transcripts can be generated for A(0) = A in an “on the fly” fashion so that the resulting distribution over extended transcripts is the same as the one that would result from first drawing D from PNo and then running algorithm A on it. It follows that when we remove the extension to the transcript so as to obtain a regular transcript, we get a distribution over transcripts that is identical to AN. In Subsection 9.3.2 we explain how to generate extended transcripts for A(k) where 0 ≤ k ≤ q. We note that for k ≥ 1 the resulting distribution over extended transcripts is not the same as the one that would result from first drawing D from PNo and then running algorithm A(k) on it. However, this is not necessary for our purposes. For our purposes it is sufficient that the distributions corresponding to pairs of consecutive indices (k, k + 1) are similar (including the pair (0, 1)), and that for k = q the distribution over regular transcripts obtained by removing the extension to the transcript is identical to AY. 9.3.1 Extended transcripts for A= A(0) Our proof of Equation (82) takes advantage of the fact that one can view the draw of a “No”- distribution from PNo as being done “on the fly” during the course of algorithm A’s execution. First, the size ∆ and the offset y are drawn at the very beginning, but we may view the profile vector ϑ as having its components chosen independently, coordinate by coordinate, only as A interacts with ICOND – each time an element sℓ is obtained in response to the ℓ-th query Iℓ, only then are the elements of the profile vector ϑ corresponding to the three coordinates of bℓ chosen (if they were not already completely determined by previous calls to ICOND). More precise details follow. Consider the ℓ-th query Iℓ that A makes to ICONDD. Inductively some coordinates of ϑ may have been already set by previous queries. Let BiL, . . . , BiR be the blocks that Iℓ intersects. First, if the coordinate of ϑ corresponding to block BiL was not already set by a previous query, a fair coin is tossed to choose a setting from {↓↑,↑↓} for this coordinate. Likewise, if the coordinate of ϑ corresponding to block BiR was not already set (either by a previous query or because iR = iL), a fair coin is tossed to choose a setting from {↓↑,↑↓} for this coordinate. At this point, the values of bL ℓ and bR that these outcomes of bL ℓ and bR ℓ have been set. A simple but important observation is ℓ completely determine the probabilities (call them αL and αR 77 respectively) that the block Bℓ from which sℓ will be chosen is BiL (is BiR respectively), as we explain in more detail next. If iR = iL then there is no choice to be made, and so assume that iR > iL. For K ∈ {L, R} let ρK 1 · ∆ be the size of the intersection of Iℓ with the first (left) half of BiK and let ρK 2 · ∆ be the size of the intersection of Iℓ with the second (right) half of BiK . Note that 0 < ρK 2 ≤ 1 and that ρL 1 ≤ 1/2. If 1 + ρK ℓ =↑↓ then let wK = ρK bK ℓ =↓↑ then 2 − 2ǫ(ρK let wK = ρK wL+wR+(iL−iR−1) . The block BiL is selected with probability αL, the block BiR is selected with probability αR, and for iR ≥ iL + 2, each of the other blocks is selected with equal probability, 1 · (1 + 2ǫ) + ρK 1 − ρK 2 ≤ 1/2 and similarly ρR 2 = 0 when ρR 2 ), and if bK 2 · (1 − 2ǫ) = ρK 2 ). We now set αK = 2 + 2ǫ(ρK wK 1 = 0 when ρL 1 − ρK 1 + ρK 1 + ρK 1 wL+wR+(iL−iR−1) . Given the selection of the block Bℓ as described above, the element sℓ and the profile bsamp of the block to which it belongs are selected as follows. If the coordinate of ϑ corresponding to Bℓ has already been determined, then bsamp is set to this value and sℓ is drawn from Bℓ as determined by the ↓↑ or ↑↓ setting of bsamp is set either to ↓↑ or to ↑↓ depending on the outcome, and sℓ is drawn from Bℓ as in the previous case (as determined by the setting of bsamp ℓ ) have been determined and the triple (Iℓ, sℓ, bℓ) is taken as the ℓ-th element of the extended transcript. . Otherwise, a fair coin is tossed, bsamp ). Now all of Iℓ, sℓ, and bℓ = (bL ℓ , bsamp , bR ℓ ℓ ℓ ℓ ℓ ℓ (0),N otf We now define A as follows. A draw from this distribution over (non-extended) transcripts is obtained by first drawing an extended transcript (I1, s1, b1), . . . , (Iq, sq, bq) from the on-the-fly pro- cess described above, and then removing the third element of each triple to yield (I1, s1), . . . , (Iq, sq). This is exactly the distribution over transcripts that is obtained by first drawing D from PNo and then running A on it. (k),N otf 9.3.2 Extended transcripts for A(k), k ≥ 0 for 0 ≤ k ≤ q (the definition we give below will In this subsection we define the distribution A coincide with our definition from the previous subsection for k = 0). Here too the size ∆ and the offset y are drawn at the very beginning, and the coordinates of the profile vector ϑ are chosen on the fly, together with the sample points. For each ℓ > k, the pair (sℓ, bℓ) is selected exactly as was described for A, conditioned on the length-k prefix of the extended transcript and the new query Iℓ (as well as the choice of (∆, y)). It remains to explain how the selection is made for 1 ≤ ℓ ≤ k. Consider a value 1 ≤ ℓ ≤ k and the ℓ-th query interval Iℓ. As in our description of the “on- the-fly” process for A, inductively some coordinates of ϑ may have been already set by previous queries. Let BiL, . . . , BiR be the blocks that Iℓ intersects. As in the process for A, if the coordinate of ϑ corresponding to block BiL was not already set by a previous query, a fair coin is tossed to choose a setting from {↓↑,↑↓} for this coordinate. Likewise, if the coordinate of ϑ corresponding to block BiR was not already set (either by a previous query or because iL = iR), a fair coin is tossed to choose a setting from {↓↑,↑↓} for this coordinate. Hence, bL ℓ are set exactly the same as described for A. ℓ and bR We now explain how to set the probabilities αL and αR of selecting the block Bℓ (from which sℓ is chosen) to be BiL and BiR, respectively. Since the “faking” process should choose sℓ to be a uniform point from Iℓ, the probability αL is simply BiL ∩ Iℓ/Iℓ, and similarly for αR. (If iL = iR we take αL = 1 and αR = 0.) Thus the values of αL and αR are completely determined by the 78 number of blocks j and the relative sizes of the intersection of Iℓ with BiL and with BiR. Now, with probability αL the block Bℓ is chosen to be BiL, with probability αR it is chosen to be BiR and with probability 1 − αL − αR it is chosen uniformly among {BiL+1, . . . , BiR−1}. Given the selection of the block Bℓ as described above, sℓ is chosen to be a uniform random element of Bℓ ∩ Iℓ. The profile bsamp ℓ of Bℓ is selected as follows: 1. If the coordinate of ϑ corresponding to Bℓ has already been determined (either by a previous query or because Bℓ ∈ {BiL, BiR}), then bsamp ℓ is set accordingly. 2. Otherwise, the profile of Bℓ was not already set; note that in this case it must hold that Bℓ /∈ {BiL, BiR}. We look at the half of Bℓ that sℓ belongs to, and toss a biased coin to set its profile bsamp ∈ {↓↑,↑↓}: If sℓ belongs to the first half, then the coin toss’s probabilities are ((1 − 2ǫ)/2, (1 + 2ǫ)/2); otherwise, they are ((1 + 2ǫ)/2, (1 − 2ǫ)/2). ℓ (k),N otf (k),N otf denote the distribution induced by the above process over extended transcripts, and Let E be the corresponding distribution over regular transcripts (that is, when removing the let A N. In profiles from the transcript). As noted in Subsection 9.3.1, for k = 0 we have that A the other extreme, for k = q, since each point sℓ is selected uniformly in Iℓ (with no dependence In the next subsection we bound the total on the selected profiles) we have that A variation distance between A(k),N for every 0 ≤ k ≤ q − 1 by bounding the distance otf . Roughly speaking, the only difference and E between the corresponding distributions E between the two (for each 0 ≤ k ≤ q − 1) is in the distribution over (sk+1, bsamp k+1 ). As we argue in more detail and formally in the next subsection, conditioned on certain events (determined, among other things, by the choice of (∆, y)), we have that (sk+1, bsamp k+1 ) are distributed the same under (k),N E otf and A(k+1),N (k),N otf (q),N otf = A (0),N otf = A (k+1),N otf (k+1),N otf and E Y. otf . 9.4 Bounding dTV(cid:16)A(k),N otf , A(k+1),N otf As per the foregoing discussion, we can focus on bounding the total variation distance between extended transcripts (cid:17) dTV(cid:16)E (k),N otf , E (k+1),N otf (cid:17) for arbitrary fixed k ∈ {0, . . . , q − 1}. Before diving into the proof, we start by defining the probability space we shall be working in, as well as explaining the different sources of randomness that are in play and how they fit into the random processes we end up analyzing. The probability space. Recall the definition of an extended transcript: for notational conve- nience, we reserve the notation E = (Iℓ, sℓ, bℓ)ℓ∈[q] for extended transcript valued random variables, and will write E = (ιℓ, σℓ, πℓ)ℓ∈[q] for a fixed outcome. We denote by Σ the space of all such tuples E, and by Λ the set of all possible outcomes for (∆, y). The sample space we are considering is now defined as X def= Σ × Λ: that is, an extended transcript along with the underlying choice of 79 block size and offset10. The two probability measures on X we shall consider will be induced by the execution of A(k) and A(k+1), as per the process detailed below. A key thing to observe is that, as we focus on two “adjacent” faking algorithms A(k) and A(k+1), it will be sufficient to consider the following equivalent view of the way an extended transcript is generated: 1. up to (and including) stage k, the faking algorithm generates on its own both the queries ιℓ and the uniformly distributed samples σℓ ∈ ιℓ; it also chooses its (k + 1)-st query ιk+1; 2. then, at that point only is the choice of (∆, y) made; and the profiles πℓ (1 ≤ ℓ ≤ k) of the previous blocks decided upon, as described in Subsection 9.3; 3. after this, the sampling and block profile selection is made exactly according to the previous “on-the-fly process” description. The reason that we can defer the choice of (∆, y) and the setting of the profiles in the manner described above is the following: For both A(k) and A(k+1), the choice of each σℓ for 1 ≤ ℓ ≤ k de- pends only on ιℓ and the choice of each ιℓ for 1 ≤ ℓ ≤ k + 1 depends only on (ι1, σ1), . . . , (ιℓ−1, σℓ−1). That is, there is no dependence on (∆, y) nor on any πℓ′ for ℓ′ ≤ ℓ. By deferring the choice of the pair (∆, y) we may consider the randomness coming in its draw only at the (k + 1)-st stage (which is the pivotal stage here). Note that, both for A(k) and A(k+1), the resulting distribution over X induced by the description above exactly matches the one from the “on-the-fly” process. In the next paragraph, we go into more detail, and break down further the randomness and choices happening in this new view. Sources of randomness. To define the probability measure on this space, we describe the process that, up to stage k + 1, generates the corresponding part of the extended transcript and the (∆, y) for A(m) (where m ∈ {k, k + 1}) (see the previous subsections for precise descriptions of how the following random choices are made): (R1) A(m) draws ι1, σ1, . . . , ιk, σk and finally ιk+1 by itself; (R2) the outcome of (∆, y) is chosen: this “retroactively” fixes the partition of the ιℓ’s (1 ≤ ℓ ≤ ; k + 1) into blocks B(ℓ) iL , . . . , B(ℓ) iR (R3) the profiles of B(ℓ) iL , B(ℓ) iR and Bℓ (i.e., the values of the triples πℓ, for 1 ≤ ℓ ≤ k) are drawn; (R4) the profiles of B(k+1) iL , B(k+1) iR are chosen; (R5) the block selection (choice of the block Bk+1 to which σk+1 will belong to) is made: (a) whether it will be one of the two end blocks, or one of the inner ones (for A(k+1) this is based on the respective sizes of the end blocks, and for A(k) this is based on the weights of the end blocks, using the profiles of the end blocks); 10We emphasize the fact that the algorithm, whether faking or not, has access neither to the “extended” part of the transcript nor to the choice of (∆, y); however, these elements are part of the events we analyze. 80 (b) the choice itself: • if one of the outer ones, draw it based on either the respective sizes (for A(k+1)) or the respective weights (for A(k), using the profiles of the end blocks) • if one of the inner ones, uniformly at random among all inner blocks; (R6) the sample σk+1 and the profile πsamp k+1 are chosen; (R7) the rest of the transcript, for k + 1, . . . , q, is iteratively chosen (in the same way for A(k) and A(k+1)) according to the on-the-fly process discussed before. Note that the only differences between the processes for A(k) and A(k+1) lie in steps (R5a), (R5b) and (R6) of the (k + 1)-st stage. Bad events and outline of the argument Let G(ιk+1) (where ‘G’ stands for ‘Good’) denote the settings of (∆, y) that satisfy the following: Either (i) ιk+1 > ∆·(log N )2 or (ii) ιk+1 < ∆/ log N and ιk+1 is contained entirely within a single half block. We next define three indicator random variables for a given element ω = (E, (∆, y)) of the sample space X, where E = ((ι1, σ1, π1), . . . , (ιq, σq, πq)). The first, Γ1, is zero when (∆, y) /∈ G(ιk+1). Note that the randomness for Γ1 is over the choice of (∆, y) and the choice of ιk+1. The second, Γ2, is zero when ιk+1 intersects at least two blocks and the block Bk+1 is one of the two extreme blocks intersected by ιk+1. The third, Γ3, is zero when ιk+1 is not contained entirely within a single half block and Bk+1 is a block whose profile had already been set (either because it contains a selected point σℓ for ℓ ≤ k or because it belongs to one of the two extreme blocks for some queried interval ιℓ for ℓ ≤ k). For notational ease we write Γ(E) to denote the triple (Γ1, Γ2, Γ3). Observe that these indicator variables are well defined, and correspond to events that are indeed subsets of our space X: given any element ω ∈ X, whether Γi(ω) = 1 (for i ∈ {1, 2, 3}) is fully determined. Define D1, D2 as the two distributions over X induced by the executions of respectively A(k) and A(k+1) (in particular, by only keeping the first marginal of D1 we get back E(k),N). Applying Fact 33 to D1 and D2, we obtain that dTV(D1, D2) ≤ Pr(cid:2) Γ 6= (1, 1, 1)(cid:3) + dTV(cid:0)D1 Γ = (1, 1, 1), D2 Γ = (1, 1, 1)(cid:1) ≤ Pr[ Γ1 = 0 ] + Pr[ Γ2 = 0 Γ1 = 1 ] + Pr[ Γ3 = 0 Γ1 = Γ2 = 1 ] To conclude, we can now deal which each of these 4 summands separately: + dTV(cid:0)D1 Γ = (1, 1, 1), D2 Γ = (1, 1, 1)(cid:1) . log N (cid:17). Claim 34 We have that Pr[ Γ1 = 0 ] ≤ η(N ), where η(N ) = O(cid:16) log log N values of ∆ ∈(cid:8) N fore, the probability that one of these (“bad”) values of ∆ is selected is O(cid:16) log log N 3 log N}(cid:9) for which ∆/ log N ≤ ιk+1 ≤ ∆ · (log N )2. There- log N (cid:17). If the choice of ∆ is such that ιk+1 < ∆/ log N , then, by the choice of the random offset y, the probability that ιk+1 is not entirely contained within a single half block is O(1/ log N ). The claim follows. Proof: Similarly to the proof of Claim 29, for any fixed setting of ιk+1, there are O(log log N ) (84) 3 log N, . . . , 2 2j (cid:12)(cid:12) j ∈ { 1 81 Claim 35 We have that Pr[ Γ2 = 0 Γ1 = 1 ] ≤ η(N ). If Γ1 = 1 because ιk+1 < ∆/(log N )2 and ιk+1 is entirely contained within a single half Proof: block, then Γ2 = 1 (with probability 1). Otherwise, ιk+1 > ∆ · (log N )2, so that ιk+1 intersects at least (log N )2 blocks. The probability that one of the two extreme blocks is selected is hence O(1/(log N )2), and the claim follows. Claim 36 We have that Pr[ Γ3 = 0 Γ1 = Γ2 = 1 ] ≤ η(N ). If Γ1 = 1 because ιk+1 < ∆/(log N )2 and ιk+1 is entirely contained within a single half Proof: block, then Γ3 = 1 (with probability 1). Otherwise, ιk+1 > ∆ · (log N )2, so that ιk+1 intersects at least (log N )2 blocks. Since Γ2 = 1, the block Bk+1 is uniformly selected from (log N )2 − 2 non- extreme blocks. Among them there are at most 3k = O(cid:16) log N log log N(cid:17) blocks whose profiles were already log N log log N(cid:17) = O(cid:16) log log N log N (cid:17), set. The probability that one of them is selected (so that Γ3 = 1) is O(cid:16) We are left with only the last term, dTV(cid:0)D1 Γ = (1, 1, 1), D2 Γ = (1, 1, 1)(cid:1). But as we are now ruling out all the “bad events” that would induce a difference between the distributions of the extended transcripts under A(k) and A(k+1), it becomes possible to argue that this distance is actually zero: and the claim follows. 1 We start by observing that, for m ∈ {k, k + 1}, where Y (m) denotes the Λ-valued random variable corresponding to A(m). In order to bound this sum, we will show that each of its terms is zero: i.e., that for any fixed (E, (∆, y)) ∈ Σ× Λ we have Claim 37 dTV(cid:0)D1 Γ = (1, 1, 1), D2 Γ = (1, 1, 1)(cid:1) = 0. Proof: Unrolling the definition, we can write dTV(cid:0)D1 Γ = (1, 1, 1), D2 Γ = (1, 1, 1)(cid:1) as XE,(∆,y)(cid:12)(cid:12)(cid:12)PrhE (k) = E,Y (m) = (∆, y)(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1)i − PrhE (k+1) = E,Y (m) = (∆, y)(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1)i(cid:12)(cid:12)(cid:12) . PrhE (k) = E,Y (k) = (∆, y)(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1)i = PrhE (k+1) = E,Y (k+1) = (∆, y)(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1)i . PrhE (m) = E,Y (m) = (∆, y)(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1)i = PrhE (m) = E(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1),Y (m) = (∆, y)i PrhY (m) = (∆, y)(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1)i and that the term Pr(cid:2)Y (m) = (∆, y)(cid:12)(cid:12) Γ = (1, 1, 1)(cid:3) = Pr(cid:2)Y (m) = (∆, y)(cid:3) is identical for m = k PrhE (k) = E(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1),Y (k) = (∆, y)i = PrhE (k+1) = E(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1),Y (k+1) = (∆, y)i . = Pr(cid:2)E (m) = E(cid:12)(cid:12) Γ = (1, 1, 1),Y (m) = (∆, y)(cid:3) as the product Let ω = (E, (∆, y)) ∈ X be arbitrary, with E = ((ι1, σ1, π1), . . . , (ιq, σq, πq)) ∈ Σ, and let m ∈ {k, k + 1}. We can express Φ(m)(ω) of the following 5 terms: and m = k + 1. Therefore, it is sufficient to show that def 82 (T1) p(m),int,samp k (ω), defined as p(m),int,samp k (ω) def = PrhE (m),int,sampk = Eint,sampk(cid:12)(cid:12)(cid:12) Γ = (1, 1, 1),Y (m) = (∆, y)i = PrhE (m),int,sampk = Eint,sampki , where Eint,samp ℓ denotes (ιℓ, σℓ) and Eint,sampk denotes (Eint,samp 1 , . . . , Eint,samp ); k (T2) p(m),prof k (ω), defined as p(m),prof k (ω) def = PrhE (m),profk = Eprofk(cid:12)(cid:12)(cid:12) E (m),int,sampk = Eint,sampk, Γ = (1, 1, 1),Y (m) = (∆, y)i = PrhE (m),profk = Eprofk(cid:12)(cid:12)(cid:12) E (m),int,sampk = Eint,sampk,Y (m) = (∆, y)i , where Eprofk denotes (π1, . . . , πk); (T3) p(m),int k+1 (ω), defined as p(m),int k+1 (ω) def= Prh Ik+1 = ιk+1(cid:12)(cid:12)(cid:12) E (m),int,sampk = Eint,sampk, Γ = (1, 1, 1),Y (m) = (∆, y)i = Prh Ik+1 = ιk+1(cid:12)(cid:12)(cid:12) E (m),int,sampk = Eint,sampki ; (T4) p(m),samp,prof k+1 (ω), defined as p(m),samp,prof k+1 (ω) (T5) and the last term p(m) def= Prh (sk+1, bk+1) = (σk+1, πk+1)(cid:12)(cid:12)(cid:12) Ik+1 = ιk+1,E(m) k = Ek, Γ = (1, 1, 1),Y (m) = (∆, y)i ; k+2(ω) def= PrhE (m)k+2,...,q = Ek+2,...,q(cid:12)(cid:12)(cid:12) E (m)k+1 = Ek+1, Γ = (1, 1, 1),Y (m) = (∆, y)i , k+2(ω), defined as where Ek+1 = ((ιk+1, σk+1, πk+1), . . . , (ιq, σq, πq)). p(m) Note that we could remove the conditioning on ¯Γ for the first three terms, as they only depend on the length-k prefix of the (extended) transcript and the choice of ιk+1, that is, on the randomness from (R1). The important observation is that the above probabilities are independent of whether m = k or m = k + 1. We first verify this for (T1), (T2), (T3) and (T5), and then turn to the slightly less straightforward term (T4). This is true for p(m),int,samp (E) because A(k) and A(k+1) select their interval queries in exactly the same manner, and for 1 ≤ ℓ ≤ k, the ℓ-th sample point is uniformly selected in the ℓ-th queried interval. Similarly we get that p(k),int (E). The probabilities p(k),prof (E) are induced in the same manner by (R2) and (R3), and p(k) k+2 (E) since for both A(k) and A(k+1), the pair (sℓ, bℓ) is distributed the same for every ℓ ≥ k + 2 (conditioned on any length-(k + 1) prefix of the (extended) transcript and the choice of (∆, y)). k+2(E) = p(k+1) (E) and p(k+1),prof (E) = p(k+1),int k+1 k+1 k k k 83 Turning to (T4), observe that Γ1 = Γ2 = Γ3 = 1 (by conditioning). Consider first the case that Γ1 = 1 because ιk+1 < ∆/ log N and ιk+1 is contained entirely within a single half block. For this case there are two subcases. In the first subcase, the profile of the block that contains ιk+1 was already set. This implies that bk+1 is fully determined (in the same manner) for both m = k and m = k + 1. In the second subcase, the profile of the block that contains ιk+1 (which is an extreme block) is set independently and with equal probability to either ↓↑ or ↑↓ for both m = k and m = k + 1. In either subcase, sk+1 is uniformly distributed in ιk+1 for both m = k and m = k + 1. Next, consider the remaining case that Γ1 = 1 because ιk+1 > ∆ · (log N )2. In this case, since Γ2 = 1, the block Bk+1 is not an extreme block, and since Γ3 = 1, the profile of the block Bk+1 was not previously set. Given this, it follows from the discussion at the end of Subsection 9.3 that the distribution of (sk+1, bk+1) is identical whether m = k (and A(m) does not fake the (k + 1)-th query) or m = k + 1 (and A(m) fakes the (k + 1)-th query). Assembling the pieces, the 4 claims above together with Equation (84) yield dTV(cid:0)E(k),N, E(k+1),N(cid:1) ≤ dTV(D1, D2) ≤ 3η(N ), and finally dTV(cid:0)AN, AY(cid:1) = dTV(cid:16)A (0),N otf , A (q),N otf (cid:17) ≤ q−1Xk=0 q−1Xk=0 ≤ ≤ 1/5 , A (cid:17) (k),N otf (k+1),N otf dTV(cid:16)A dTV(cid:16)E(k),N, E(k+1),N(cid:17) ≤ 3q · η(N ) for a suitable choice of the absolute constant τ . 10 Conclusion We have introduced a new conditional sampling framework for testing probability distributions and shown that it allows significantly more query-efficient algorithms than the standard framework for a range of problems. This new framework presents many potential directions for future work. One specific goal is to strengthen the upper and lower bounds for problems studied in this paper. As a concrete question along these lines, we conjecture that COND algorithms for testing equality of two unknown distributions D1 and D2 over [N ] require (log N )Ω(1) queries. A broader goal is to study more properties of distributions beyond those considered in this paper; natural can- didates here, which have been well-studied in the standard model, are monotonicity (for which we have preliminary results), independence between marginals of a joint distribution, and entropy.Yet another goal is to study distributions over other structured domains such as the Boolean hypercube {0, 1}n – here it would seem natural to consider “subcube” queries, analogous to the ICOND queries we considered when the structured domain is the linearly ordered set [N ]. A final broad goal is to study distribution learning (rather than testing) problems in the conditional sampling framework. 84 Acknowledgements We are sincerely grateful to the anonymous referees for their close reading of this paper and for their many helpful suggestions, which significantly improved the exposition of the final version. References [AJ06] Jos´e A. Adell and Pedro Jodra. Exact Kolmogorov and total variation distances between some familiar discrete distributions. J. of Ineq. App., 2006(1):64307, 2006. 4.2 [BDKR05] Tugkan Batu, Sanjoy Dasgupta, Ravi Kumar, and Ronitt Rubinfeld. The complexity of approximating the entropy. SICOMP, 35(1):132–150, 2005. 1.1 [BFF+01] Tugkan Batu, Eldar Fischer, Lance Fortnow, Ravi Kumar, Ronitt Rubinfeld, and Patrick White. Testing random variables for independence and identity. In Proceedings of FOCS, pages 442–451, 2001. 1.1, 1.3, 4, 7 [BFR+00] Tugkan Batu, Lance Fortnow, Ronitt Rubinfeld, Warren D. Smith, and Patrick White. Testing that distributions are close. In Proceedings of FOCS, pages 189–197, 2000. 1.1, 10 [BFR+10] Tugkan Batu, Lance Fortnow, Ronitt Rubinfeld, Warren D. Smith, and Patrick White. Testing closeness of discrete distributions. (abs/1009.5397), 2010. This is a long version of [BFR+00]. 1.1, 1, 1.3, 4, 6.1 [BFRV11] Arnab Bhattacharyya, Eldar Fischer, Ronitt Rubinfeld, and Paul Valiant. Testing monotonicity of distributions over general partial orders. In Proceedings of ITCS, pages 239–252, 2011. 1.1 [BKR04] Tugkan Batu, Ravi Kumar, and Ronitt Rubinfeld. Sublinear algorithms for testing monotone and unimodal distributions. In Proceedings of STOC, pages 381–390, New York, NY, USA, 2004. ACM. 1.1 [CDVV14] Siu-On Chan, Ilias Diakonikolas, Gregory Valiant, and Paul Valiant. Optimal algo- rithms for testing closeness of discrete distributions. pages 1193–1203. Society for In- dustrial and Applied Mathematics (SIAM), 2014. 1.3 [CFGM13] Sourav Chakraborty, Eldar Fischer, Yonatan Goldhirsh, and Arie Matsliah. On the power of conditional samples in distribution testing. In Proceedings of the 4th conference on Innovations in Theoretical Computer Science, ITCS ’13, pages 561–580, New York, NY, USA, 2013. ACM. (document), 1.2, 1.4 [DDS+13] Constantinos Daskalakis, Ilias Diakonikolas, Rocco A. Servedio, Gregory Valiant, and Paul Valiant. Testing k-modal distributions: Optimal algorithms via reductions. In Proceedings of SODA, pages 1833–1852. Society for Industrial and Applied Mathematics (SIAM), 2013. 1.1 85 [DP09] [Fis01] Devdatt P. Dubhashi and Alessandro Panconesi. Concentration of measure for the analysis of randomized algorithms. Cambridge University Press, Cambridge, 2009. 2.2 Eldar Fischer. The art of uninformed decisions: A primer to property testing. BEATCS, 75:97–126, 2001. 1.1 [GGR98] Oded Goldreich, Shafi Goldwasser, and Dana Ron. Property testing and its connection to learning and approximation. JACM, 45(4):653–750, 1998. 1.1 [Gol10] [GR00] [ILR12] [Ma81] [MR95] [Ney34] [Pan04] [Pan08] [Rey11] [Ron08] [Ron10] Oded Goldreich, editor. Property Testing: Current Research and Surveys. Springer, 2010. LNCS 6390. 1.1 Oded Goldreich and Dana Ron. On testing expansion in bounded-degree graphs. Tech- nical Report TR00-020, ECCC, 2000. 1.1, 1.3 Piotr Indyk, Reut Levi, and Ronitt Rubinfeld. Approximating and Testing k-Histogram Distributions in Sub-linear Time. In Proceedings of PODS, pages 15–22, 2012. 1.1 Shang-Keng Ma. Calculation of entropy from data of motion. J. Stat. Phys., 26(2):221– 240, 1981. 1.1 Rajeev Motwani and Prabhakar Raghavan. Randomized Algorithms. Cambridge Uni- versity Press, New York, NY, 1995. 2.2 Jerzy Neyman. On the two different aspects of the representative method: The method of stratified sampling and the method of purposive selection. Journal of the Royal Statistical Society, 97(4):558–625, 1934. 1.2 Liam Paninski. Estimating entropy on m bins given fewer than m samples. IEEE-IT, 50(9):2200–2203, 2004. 1.1 Liam Paninski. A coincidence-based test for uniformity given very sparsely sampled discrete data. IEEE-IT, 54(10):4750–4755, 2008. 1.1, 1.3 Reyzin. Leo hash http://www.cs.bu.edu/~reyzin/teaching/s11cs937/notes-leo-1.pdf, 2011. Lecture notes. 2.2 Extractors and the leftover lemma. March Dana Ron. Property Testing: A Learning Theory Perspective. FnTML, 1(3):307–402, 2008. 1.1 Dana Ron. Algorithmic and analysis techniques in property testing. FnTCS, 5:73–205, 2010. 1.1 [RRSS09] Sofya Raskhodnikova, Dana Ron, Amir Shpilka, and Adam Smith. Strong lower bonds for approximating distributions support size and the distinct elements problem. SICOMP, 39(3):813–842, 2009. 1.1 [RS96] Ronitt Rubinfeld and Madhu Sudan. Robust characterization of polynomials with applications to program testing. SICOMP, 25(2):252–271, 1996. 1.1 86 [RS09] [Val11] Ronitt Rubinfeld and Rocco A. Servedio. Testing monotone high-dimensional distribu- tions. RSA, 34(1):24–44, January 2009. 1.1, 6.2, 6.2.1 Paul Valiant. Testing symmetric properties of distributions. SICOMP, 40(6):1927–1968, 2011. 1.1, 1.3, 6.1 [VV10a] Gregory Valiant and Paul Valiant. A CLT and tight lower bounds for estimating entropy. Technical Report TR10-179, ECCC, 2010. 1.3, 1.3.1, 10 [VV10b] Gregory Valiant and Paul Valiant. Estimating the unseen: A sublinear-sample canonical estimator of distributions. Technical Report TR10-180, ECCC, 2010. 1.3, 10 [VV11] Gregory Valiant and Paul Valiant. Estimating the unseen: an n/ log(n)-sample esti- mator for entropy and support size, shown optimal via new CLTs. In Proceedings of STOC, pages 685–694, 2011. See also [VV10a] and [VV10b]. 1.1, 1.3, 1.3.1 [VV14] Gregory Valiant and Paul Valiant. An automatic inequality prover and instance optimal identity testing. In Proceedings of FOCS, 2014. 1.3 [Wik13] Wikipedia contributors. Stratified Sampling. http://en.wikipedia.org/wiki/Stratified_sampling accessed July 1, 2013. 1.2 87
1701.06446
3
1701
2018-10-04T07:39:07
Algorithm for an arbitrary-order cumulant tensor calculation in a sliding window of data streams
[ "cs.DS", "math.NA" ]
High order cumulant tensors carry information about statistics of non-normally distributed multivariate data. In this work we present a new efficient algorithm for calculation of cumulants of arbitrary order in a sliding window for data streams. We showed that this algorithms enables speedups of cumulants updates compared to current algorithms. This algorithm can be used for processing on-line high-frequency multivariate data and can find applications in, e.g., on-line signal filtering and classification of data streams. To present an application of this algorithm, we propose an estimator of non-Gaussianity of a data stream based on the norms of high-order cumulant tensors. We show how to detect the transition from Gaussian distributed data to non-Gaussian ones in a~data stream. In order to achieve high implementation efficiency of operations on super-symmetric tensors, such as cumulant tensors, we employ the block structure to store and calculate only one hyper-pyramid part of such tensors.
cs.DS
cs
Algorithm for an arbitrary-order cumulant tensor calculation in a sliding window of data streams Krzysztof Domino1 and Piotr Gawron∗1 1Institute of Theoretical and Applied Informatics, Polish Academy of Sciences, Ba(cid:32)ltycka 5, 44-100 Gliwice, Poland October 5, 2018 Abstract High order cumulant tensors carry information about statistics of non-normally distributed multivariate data. In this work we present a new efficient algo- rithm for calculation of cumulants of arbitrary order in a sliding window for data streams. We showed that this algorithms enables speedups of cumulants updates compared to current algorithms. This algorithm can be used for processing on-line high-frequency multivariate data and can find applications in, e.g., on-line signal filtering and classification of data streams. To present an application of this algorithm, we propose an esti- mator of non-Gaussianity of a data stream based on the norms of high-order cumulant tensors. We show how to detect the transition from Gaussian distributed data to non-Gaussian ones in a data stream. In order to achieve high implementation efficiency of operations on super-symmetric tensors, such as cumulant tensors, we employ the block structure to store and calculate only one hyper-pyramid part of such tensors. Keywords: High order cumulants, time-series statis- tics, non-normally distributed data, data streaming. 1 Introduction Cumulants of order one and two of n-dimensional mul- tivariate data, i.e. mean vector and covariance matrix are widely used in signal and data processing, for ex- ample, in one of the most widely used algorithm in data and signal processing, namely Principal Component Analysis. Cumulants of order one and two describe completely statistically signal or data whose values are govern by a Gaussian distribution. In many real-life cases data or signals are not normally distributed. In this case it is necessary to employ higher order cumu- lants, such as, for example, skewness and kurtosis, to analyze this kind of data. As the high order cumulant of n dimensional multi- variate data we understand the super-symmetric1, cu- mulant tensor C ∈ R[n,d] of d ≥ 3 modes, each of size ∗[email protected] 1A tensor is super-symmetric if it is invariant under permu- tation of its indices. n. Importantly they are zeros only if calculated for data sampled from multivariate Gaussian distribution [1, 2]. High order cumulants carry information about the divergence of the empirical distribution from the multivariate Gaussian one, hence we use them to ex- tract such information from data. Calculation of higher order cumulants for multi- dimensional data is time consuming. Furthermore, such data are often recorded in form of a stream and hence the on-line scheme of calculation and updates of cumulants is useful to analyze them. In this pa- per we present an efficient algorithm for calculation of cumulants of arbitrary order in a sliding window for data streams. We show the application of this algo- rithm to detect change in the underling distribution of multivariate time-series. Our algorithm uses so called block-structure, which is a data structure designed for efficient storage and processing of symmetric tensors. 1.1 Motivation Our motivation to design such an algorithm comes from the fact that there exist many contemporary applica- tions of higher order cumulants based algorithms in data processing. Typically these algorithms employ cumulants up to order four, and rarely up to order six. This limitation comes mainly from two factors: high computational cost of calculating higher order cumu- lants, and large amounts of data samples required to estimate faithfully higher order cumulants. Nowadays computational power is widely available and amounts of data collected every day is increasing dramatically. Therefore we believe that algorithms requiring usage of high order cumulants will be employed more widely in the near future. Yet, as it was pointed out by [3], processing data streams is a challenging task because it imposes constraints on memory usage, processing time, and number of data inputs reads. The algorithm pre- sented in this work is dedicated to process efficiently on-line large data streams. High order cumulants are used to analyze signal data, such as audio signals, for example in direction- finding methods of the multi-source signal (q-MUSIC algorithm) [4]. Additionally, high order cumulants are being used in signal filtering problems [5, 6] or neu- 1 roimaging signals analysis [7, 8]. The neuroscience application often uses the Independent Components Analysis (ICA) [9], that can be evaluated by means of high order cumulant tensors [10, 11]. Another impor- tant issue that requires fast algorithm to compute and update high order cumulants is financial data analy- sis, especially concerning high frequency financial data, where we deal with large data sets and the computa- tional time is a crucial factor. For multi-assets portfo- lio analysis, high order cumulant tensors measures risk [12, 13], especially during a crisis where large fluctua- tions of assets values are possible [14, 15, 16]. While estimating high order statistics from data, there rises a problem of high estimation error. In gen- eral, large data set required for the accurate estimation of high order cumulants from data. This is discussed in [17] in some details. Unfortunately, large data set requires large computational time what becomes prob- lematic if we want to analyze n-variate data on-line and n is respectively large. To solve this problem we intro- duce an algorithm, that computes high order statistics in a sliding window of length t. Statistics are updated every time a new data batch of size tup is collected. The values of parameters t and tup depend on par- ticular application. On one hand t and tup have to be large enough for an accurate approximation of the statistics, on the other hand the larger they are the weaker the time resolution of accessible for an ap- plication. We typically choose tup = αt with α = 2.5%, 5%, . . . Given such parameters, we have reached over an order of magnitude speedup compared with a simple cumulants' recalculation using fast algorithm introduced in [17]. In both cases we use the block struc- ture [18] that allows to calculate and store efficiently super-symmetric cumulant and moment tensors [17]. We show that using the presented algorithm we can an- alyze data recorded at frequencies up to 2000 Hz from 150 Hz, depending in the number of marginal variables n: 60 -- for the higher frequency figure to 120 -- for the lower figure, on a modern six-core workstation. 2 Statistics updates 2.1 Data format Let us consider the data that consists of t realizations sampled from n-dimensional multivariate distribution forming an observation window whose number we will index by w: Rt×n (cid:51) X(w) = Note that samples form rows in the data matrix. Further consider an update, that consists of another tup n-dimensional realizations: Rtup×n (cid:51) X(w) (+) = x(w) ... x(w) t,1 1,1  . . . . . . . . . . x(w) 1,n ... x(w) t,n  x(w) t+1,1 ... x(w) t+tup,1 . . . . . . . . . x(w) t+1,n ... x(w) t+tup,n 1,1 ... x(w) tup,1  x(w) x(w) x(w+1) ... x(w) t+tup,1 tup+1,1 1,1 ... x(w+1) t,1 . . . . . . . . . x(w) 1,n ... x(w) tup,n . . . . . . . . . x(w) tup+1,n ... x(w) t+tup,n . . . . . . . . . x(w+1) 1,n ... x(w+1) t,n  . (1) (2) (3) (4)  ,  .  = that will be concatenated to X(w) in order to form a new window. Additionally forming of a new window will require to drop first tup realizations represented by the following matrix The new observation window w + 1 is given by the following equation Rtup×n (cid:51) X(w) (−) = Rt×n (cid:51) X(w+1) = = 1.2 Paper structure The sliding window mechanism is visualized in Fig. 1. The paper is organized as follows. In Section 2 we present formulas and algorithm employed to calculate cumulants of a data stream, the input data format, the sliding window mechanism, the block structure, mo- ments tensors updates, cumulants calculation, and the complexity analysis. In Section 3 we discuss the algo- rithm implementation in Julia programming language, and the performance tests of the implementation. In Section 4 we introduce an illustratory application of our algorithm applied to analyze on-line the statistics of a data stream and analyze the maximal frequency of data that can be calculated on-line given a computer hardware. 2.2 Sliding window The algorithm presented in this work calculates cu- mulants of a data stream in a sliding window. It is assumed that data arrive continuously to a system and are fed to the algorithm in typically small batches. The algorithm uses only a subset of current data stored in a buffer and minimal required statistics. As new data are incoming the calculations are performed on stored data and statistics. Historical data are iteratively discarded. The main loop is summarized in Algorithm 1. Which consists of the following steps: acquire new batch of data; calculate the oldest batch of data; update mo- ments; calculate cumulants; update the data buffer. 2 Algorithm 1 Sliding window cumulant calculation algorithm 1: Input: X(1) -- first data batch 2: Output: C1(X(w)), . . . ,Cd(X(w)) -- cumulants for windows 1 : w 3: Calculate moments M1(X(1)), . . . ,Md(X(1)) 4: w ← 1 5: for w do 6: Acquire X(w) (+). Calculate X(w) (−) from fist tup rows of X(w). 8: M1(X(w+1)), . . . ,Md(X(w+1)) ← momentsupdate(M1(X(w)), . . . ,Md(X(w)), X(w) C1(X(w+1)), . . . ,Cd(X(w+1)) ← mom2cums(M1(X(w+1)), . . . ,Md(X(w+1))) Calculate X(w+1) by concatenating row by row X(w) with X(w) Emit C1(X(w+1)), . . . ,Cd(X(w+1)). w ← w + 1 (+), X(w) (−)) (+) and remove rows belonging to X(w) (−). 7: 9: 10: 11: 12: 13: end for X(1) X(1) (+) time X(1) (−) X(2) X(2) (+) X(2) (−) X(3) X(3) (+) Figure 1: Schematic representation of data flow in slid- ing window mechanism. In the picture the time flows from top to bottom. Subsequent windows are placed from left to right. Each multivariate data sample forms a row of a matrix. 2.3 Block structure Moments and cumulants are super-symmetric tensors, therefore we use block structure as introduced in [18] to compute and store them effectively. Using the such a block structure we store and compute only one hyper- pyramidal part of the super-symmetric tensor in blocks of size bd, where b is a parameter of the storage method. One advantage of the block structure is that it allows for efficient further processing of cumulants what was discussed in [17]. 2.4 Moment tensor updates Given data X ∈ Rt×n the super-symmetric moment tensor of order d: Md(X) ∈ R[n,d] consists of the fol- lowing elements: (cid:33) (cid:32)(cid:89) t(cid:88) l=1 ik∈i mi(X) = 1 t xl,ik . (5) 3 where i = (i1, . . . , id) is element's multi-index and i1, . . . , id ∈ 1 : n. A naive approach to calculate mo- ments M(cid:0)X(w)(cid:1) would be to calculate all mi(X(w)) for each window w. But in order to reduce the amount of computation required to calculate moments in slid- ing windows we take advantage of the fact, that given (−) and X(w) X(w) (+) it is easy to update each element of the (cid:16) moment tensor using the following relation: (cid:32)(cid:89) (cid:33) x(w) l,ik = mi 1 t = X(w+1)(cid:17) (cid:32)(cid:89) t(cid:88) (cid:32) t+tup(cid:88) (cid:16) X(w)(cid:17) ik∈i 1 tup l=1 + l=1+t l=1+tup t+tup(cid:88) (cid:33) (cid:32)(cid:89) (cid:16) + ik∈i mi x(w) l,ik tup t = + 1 t tup t = mi ik∈i (cid:33) (cid:33)(cid:33) = − 1 tup tup(cid:88) (cid:17) − mi (cid:16) l=1 (cid:32)(cid:89) (cid:17)(cid:17) ik∈i X(w) (−) x(w) l,ik x(w) l,ik (cid:16) X(w) (+) . (6) We can write Eq. (6) using tensor notation in the fol- lowing tensor form: M(cid:16) X(w+1)(cid:17) =M(cid:16) + X(w) (+) (cid:17) − M(cid:16) X(w) (−) (cid:17)(cid:17) . (7) X(w)(cid:17) (cid:16)M(cid:16) + tup t Exploiting this form we can write the Algorithm 2 which calculates moments in a sliding window w + 1 given moments of window w, and the data batches (−) and X(w) X(w) (+). There exists a different approach to this problem. We could calculate t/tup moments of data batches and (cid:17) organize the moments in a FIFO queue (cid:17)(cid:17) (cid:17) , . . . ,M(cid:16) (cid:16)M(cid:16) ,M(cid:16) X . (wt/tup ) (+) X(w1) (+) X(w2) (+) (8) With arrival of new batch its moments would be cal- culated and added to the aggregate moments then the oldest batch moments would be subtracted from the aggregate. This scheme reduces the amount of calcula- tions because it does not require to calculate moments (+) ∈ Rtup×n, X(w) Algorithm 2 momentsupdate() 1: Input: data -- X(w) (cid:17)(cid:17) 2: Output: updated moments -- M1(X(w+1)), . . . ,Md(X(w+1)) 3: for s ← 1 : d do 4: Ms(X(w+1)) ← Ms(X(w)) + tup 5: end for 6: return M1(X(w+1)), . . . ,Md(X(w+1)) (−) ∈ Rtup×n, moments -- M1(X(w)), . . . ,Md(X(w)). (cid:16)M(cid:16) (cid:17) − M(cid:16) X(w) (−) X(w) (+) t (cid:46) See Eq. (7) of X(w) (−) for each window w, but requires the storage of for wb ∈ w : w + t/tup. t/tup moments for data X(wb) (+) Therefore in approach we propose we have traded some of the computational complexity for the reduction in memory size requirements. The moment tensor computation and storage in the block structure is explained in details in [17] from where we can conclude that if b (cid:28) n and d (cid:28) n d! (d − 1)t multiplications to we need approximately nd compute Md(X). Analogically, we need nd d! (d − 1)tup multiplications to compute M(cid:16) (cid:17) number of multiplications to compute M(cid:16) d! (d−1)t multiplications. Hence given M(cid:0)X(w)(cid:1) . Ob- viously a simple recalculation of M(X(w+1)) would re- quire nd computed priorly, the theoretical speedup factor of the update compared with a simple recalculation of M(cid:0)X(w+1)(cid:1) would be: and the same X(w) (−) X(w) (+) (cid:17) Algorithm 4 Calculation of symmetrized outer prod- uct 1: Input: i -- multi-index of cumulant tensor, s -- order of cumulant being calculated, C1(X), C2(X), . . . , Cs−1(X) -- cumulant tensors of lower orders 2: Output: Ai -- element of super-symmetric tensor A 3: Ai = 0 4: for σ ← 2 : s do (cid:46) using Knuth's algorithm [20, Section 7.2.1.4] calculate partitions of the set 1 : s into σ parts for ξ ∈ partitions do 5: 6: 7: a ← 1 for k ∈ ξ do a ← a × Ci(k)(X) end for Ai ← Ai + a 8: 9: 10: 11: 12: 13: end for end for nd d! (d − 1)t d! (d − 1)tup + nd nd d! (d − 1)tup = t 2tup , (9) 2.6 Complexity analysis what is significant especially if tup (cid:28) t. In next two subsections we are going to show how to use the mo- ment update scheme to update cumulant tensors. 2.5 Cumulant updates calculation Given the moment tensor update scheme, due to the re- cursive relation between moments and cumulants ten- sors [19], we can use this scheme to form a cumu- lants' update algorithm. The recursive relation be- tween cumulants and moments was discussed in details the previous work [17]. Here this relation is summa- rized in a form of Algorithm 3. This algorithm cal- culates cumulants' tensors Cs(X) ∈ R[n,s] for orders s ∈ {1, 2, . . . , d}, given moments M1(X), . . . ,Md(X). Algorithm 3 moms2cums() 1: Input: M1(X), . . . ,Md(X) -- moments 2: Output: C1(X), . . . ,Cd(X) -- cumulants 3: for s ← 1 : d do 4: Cs(X) ← Ms(X) − A (cid:46) Calculate elements of A using algorithm 4 5: end for 6: return C1(X), . . . ,Cd(X) Despite using cumulants -- moment recursive relation form [17], there are important computational differ- ences between the cumulants' updated scheme pro- posed in this paper and cumulants calculation scheme proposed in [17], see Eq. (34) therein. In the first case: 1. we need much less arithmetic operations to update a moment tensor than in the second case since tup (cid:28) t, but 2. we need slightly more computational power to compute A in Algorithm 4. In the first case we can not use central moments for Md because in general updates affect the centering of the data. Hence in the first case the inner loop starting in line 6 of Algorithm 4 runs over all partitions, in contrary to the second case, where similar algo- rithm sums over partitions containing only ele- ments of size ≥ 2. In order to analyze the computational complexity of sliding window cumulant calculation algorithm, we have to count the number of multiplications performed 4 in line 9 of the Algorithm 4. This number is given by: Simple cumulant series recalculation using [17] requires d(cid:88) d(cid:88) σ=1 = S(d, σ)(σ − 1) = S(d, σ)(σ − 1) ≤(d − 1) d(cid:88) (10) S(d, σ) < σ=2 σ=2 <(d − 1)B(d), second kind [21]; the sum(cid:80)d where S(d, σ) > 0 is the number of partitions of set of size d into σ parts, i.e. the Stirling Number of the σ=1 S(d, σ) = B(d), is the Bell number [22], the number of all partitions of the set of size d. The upper limit (d − 1)B(d) will be used further to approximate the number of multiplications required. The number of multiplications is reduced due to the use of the block storage of super-symmetric tensors. We need only to calculate approximately nd d! tensor el- ements see [17]. Given a moment tensor Md and cumu- lant tensors C1, . . . ,Cd−1 we can approximate number of multiplications to compute Cd by (d − 1)B(d). (11) nd d! Nevertheless it is important to notice, that there is some additional computational overhead in the imple- mentation due to operations on relatively small blocks. Referring to Eq. (9) in order to update a series of moments we need approximately: #Nmup(d) ≈ d(cid:88) k=1 2 nk k! (k − 1)tup (12) approximately(cid:80)d nk k! (k − 1)t ≈ nd d! (d − 1)t multipli- k=1 cations. The final speedup factor compared with such recalculation is: t 2tup + B(d) . (16) The first term in the denominator corresponds to Algorithm 2, while the second one to Algo- rithm 3. For analyzed parameters' values the func- tion momentsupdate() is more computationally costly in comparison with moms2cums() by a factor of 2tup B(d) . For example for tup = 25000 and d = 4 the this factors is of three orders of magnitude. In the following Sections we present the computer implementation of the cumulants updates algorithm in Julia programming language, and performance tests. 3 Implementation and perfor- mance 3.1 Implementation The sliding window cumulant calculation algorithm was implemented in Julia programming language [23, 24, 25] and provided on the Zenodo repository [26]. Our implementation uses the block structure pro- vided in [27], and parallel computation via the function pmap() implemented in Julia programming language. For the parallel computation implementation we per- form the following. 1. We use parallel implementation of moment ten- sor calculation introduced in [17], i.e. data are split into p non-overlapping sub-series, where p is a number of workers, next we compute moment tensors for each sub-series and combine them into a single moment tensor. 2. We have also parallelized the for loop in line 4 of Algorithm 4 using pmap() function which is one of the ways Julia programming language imple- ments a parallel for. The advantage of this so- lution is that each term of that sum is super- symmetric and we can compute it using block structure. The disadvantage is that the sum has only d−1 elements hence for large number of work- ers we do not take full advantage of the parallel implementation. Despite some inefficiencies of parallel implementation, we obtain large speedup due to multiprocessing what is presented below. 3.2 Performance tests In what follows we present performance tests carried out mainly using multiple CPU cores. All tests were performed on a computer equipped with Intel(R) Core(TM) i7-6800K CPU @ 3.40GHz processor pro- viding 6 physical cores and 12 computing cores with multiplications. Further according to Eq. (11) to com- pute a series of cumulant tensors given a series of mo- ment tensors we need approximately: d(cid:88) k=1 (k − 1)B(k) nk k! (13) multiplications. Finally to update a series of cumulants we need #Ncup ≈ d(cid:88) d(cid:88) k=1 = k=1 2 nk k! 2 nk k! d(cid:88) k=1 (k − 1)tup + (k − 1)B(k) = nk k! (k − 1)(2tup + B(k)) (14) multiplications. In practice, we use cumulants' orders of d = 4, 5, 6, number of data t > 105, batch size of tup = αt, where α = 2.5%, 5%, . . ., and number of vari- ables n (cid:29) d. Further given that Bell number B(d) rises rapidly with d [22] the last term of the sum in Eq. (14) is dominant and hence the final number of multiplications can be approximated by: #Ncup ≈ nd d! (d − 1)(2tup + B(d)). (15) 5 (a) d = 4, n = 60 (a) d = 4, n = 120, b = 4 (b) d = 4, n = 120 (b) d = 5, n = 60, b = 3 Figure 3: Performance tests for multiprocessing im- plementation. In Figure 2 we present the computational time of the update of cumulant tensors series of order 1, . . . , d for different block sizes. One can observe that, the higher cumulant order d the lower optimal block size b. Finally fluctuations of computational time vs. block size are caused by the fact that, in our implementation, if b does not divide n some blocks are not hyper-squares and hence calculation of their size and block sizes con- version cause additional computational overhead. The computations of the optimal block size were performed using 6 parallel worker processes. Scalability of the algorithm with raising number of CPU cores is pretended in Figure 3. At first the com- putational time speedup is proportional to number of workers as it should be expected, however for large number of workers we do not fully take advantage of parallel implementation what is discussed in a previ- ous section. Despite this problem we have still large speedup due to use multiple cores. In Figure 4 we present the computational speedup of the update cumulants of order 1, . . . , d, compared with their simple recalculation [16] implemented in Julia [28]. The main conclusion is that the computational speedup is of about one order of magnitude. Higher speedup is recorded for large data sets. (c) d = 5, n = 60 Figure 2: Cumulants updates computational times for different block sizes b and the multiprocessing imple- mentation on 6 workers. hyper-threading, and 64 GB of random access mem- ory. We start with determining the optimal block size pa- rameter b of the block structure (see Subsection 2.3). This parameter has complex impact on the computa- tional time. On the one hand the higher b, the more computational and storage redundancy while calculat- ing moment tensors, due to larger diagonal blocks. On the other hand the lower b the more computational overhead due to larger amount of operations performed on small blocks. 6 2345678910blocksize25303540455055computationaltime[s]tup=2.5×104tup=5.×104tup=7.5×10424681012blocksize345678computationaltime[s]×102tup=2.5×104tup=5.×104tup=7.5×104234567blocksize23456computationaltime[s]×103tup=1.2×105tup=2.4×105tup=3.6×105123456numberofprocs1.01.52.02.53.03.54.0computationalspeeduptup=2.5×104tup=5.×104tup=7.5×104123456numberofprocs1.01.52.02.53.03.5computationalspeeduptup=1.2×105tup=2.4×105tup=3.6×105 (a) t = 5 × 105, d = 4, b = 4. (b) t = 1 × 106, d = 4, b = 4. (c) t = 5 × 106, d = 5, b = 3. (d) t = 25 × 106, d = 6, b = 2. Figure 4: Speedup of cumulants updates comparing with [17] recalculation, 6 workers implementation. 4 Illustrative application should be zero as well. Let us introduce a function In this section we show a practical application of the sliding window cumulant calculation algorithm to ana- lyze data that are updated in batches. As a simple ap- plication we propose the following scenario. The initial batch of data X(1) is drawn from a multivariate Gauss distribution. Then the subsequent update batches X(w) (+) are drawn from t-Student copula -- a strongly non-Gaussian distribution -- having the same univari- ate marginal as the Gauss distribution. The transition from a Gaussian to a non-Gaussian regime is observed using the value of Froebenius norm of fourth cumulant tensor. 4.1 Cumulants based measures of data statistics According to the definition of high order cumulants [1, 2] they are zero only if data are sampled from mul- tivariate Gaussian distribution. Hence in this case the Frobenius norm of high order cumulant tensor: (cid:115)(cid:88) i (cid:107)Cd(cid:107)k = k cik (17) 7 νd = (cid:107)Cd(cid:107)2 (cid:107)C2(cid:107)d/2 2 for d > 2, (18) that will be used to detect non-Gaussianity of data. Recall that in the case of univariate random variable, for d = 3 and d = 4 the function νd is equal to the modules of asymmetry and kurtosis. Obviously, for multivariate data, the higher values of νd the less likely that data were drawn from a multivariate Gaussian distribution. Due to the use of block structure [18, 17] the func- tion νd can be computed fast and use small amount of memory Suppose we have the supper-symmetric cumulant tensor A ∈ R[n,d] stored in a block structure, i.e. we store only one hyper-pyramidal part of such tensor in blocks. Let j = (j1, . . . , jd) be a multi-index of block (A)j ∈ Rbd , without loss of generality and for the sake of simplicity we assume that bn. Then, in the block structure, we store only blocks indexed by such j whose elements are sorted in an increasing order. We propose Algorithm 5 that computes a k-norm of given super-symmetric tensor A ∈ R[n,d]. Blocks in a block structure can be super-diagonal (super- symmetric), partially diagonal (partially-symmetric) or off-diagonal. 1.52.02.53.03.5tup×1047891011computationalspeedupn=60n=120234567tup×1041416182022242628computationalspeedupn=60n=1201234tup×1051015202530computationalspeedupn=600.60.81.01.2tup×10610121416182022computationalspeedupn=36 Algorithm 5 Calculate k-norm of the tensor stored in a block structure. 1: Input: A ∈ R[n,d] -- the supper -- symmetric tensor stored in blocks, ¯n -- number of blocks 2: Output: Number -- the k-norm of the tensor 3: z ← 0 4: for j1 ← 1 : ¯n, . . . , jd ← jd−1 to ¯n do j = (j1, . . . , jd) 5: 6: z ← z + d!(cid:81) l rl! (cid:88) e∈(A)j ek (cid:46) (A)j denotes a block indexed by multi-index j 7: end for 8: return k√ z Let (A)j be an off-diagonal block, hence j1 < j2 < . . . < jd. In order to compute the Froebenius norm its elements must be counted d! times in the sum since such block appears -- up to generalized transpositions -- d! times in the in the full super-symmetric tensor. Since the Froebenius norm is an element-wise function, the order of tensor elements is not important. In two other cases, partially diagonal or super- diagonal blocks have repeating indices -- theirs multi- indices j are equal to: (j1 < . . . < js1 = . . . = jsr1 < . . . < < . . .). (cid:124) (cid:123)(cid:122) < js2 = . . . = jsr2 (cid:125) Note that, if j1 < j2 < . . . < jd then(cid:81) (cid:123)(cid:122) Such blocks are repeated super-diagonal case i.e. j = (j1 = . . . = jd (cid:124) (cid:125) r2 d!(cid:81) l rl! times in the full tensor. l rl! = 1. In the ) we have: (19) (cid:124) (cid:123)(cid:122) r1 (cid:125) d d!(cid:81) l rl! = d! d! = 1, (20) so the super-diagonal block is counted only once as expected. The advantage of Algorithm 5 is that it iterates over blocks in the block structure, what allows for efficient computation of the internal sum elements. A naive element-wise norm calculation approach would require nd power operations. To compute (cid:107)A(cid:107) using Algorithm 5 we need bd power operations for each block. Taking advantage of the block structure, required number of multiplications can be approximated by nd d! . Finally, the computational complexity of Algorithm 5 is small comparing with the computational complexity of Algo- rithm 2, the complexity of the procedure of cumulants updates and computation of their norms can be ap- proximated by Eq. (15). 4.2 Data stream generation In order to illustrate the functioning of aforementioned algorithms we use an artificially generated stream of data. 8 Figure 5: Maximums of absolute values of univariate asymmetries and kurtosises for X(w) with number of marginal values n = 60, t = 106 data samples, tup = 2.5 · 104, wmax = 61. The initial data batch X(1) ∈ Rt×n is sampled from a Gaussian multivariate distribution N (µ, Σ), where ideally µ = C1(X(1)), Σ = C2(X(1)). The subsequent (+) ∈ Rtup×n, for w ≥ 1 are sampled data batches X(w) from distribution F , which explained further. Our goal is to determine if the distribution of the updated data X(w) ∈ Rt×n did not change with raising w, and is still a multivariate Gaussian. A naive approach would be to compute the multi- ple univariate statistics, such as for example: asym- metry κ3 and kurtosis κ4 for each of the marginal variables of the data stream in windows X(w) [29]. However such approach is oversimplified, since from the Sklar Theorem [30] one can deduce that it is al- ways possible to construct such non-Gaussian multi- variate distribution F that has all marginal distribu- tions (Fi) being univariate Gaussian. Hence despite ∀i κ3(Fi) = 0, κ4(Fi) = 0, F is not a multivariate Gaussian. To generate such data in practice we can use a copula approach, see e.g. [31] for definition and formal intro- duction of copulas. The probability distribution F is derived from the t-Student copula parametrized by Σ and ν as defined in [31]. In our case we set the param- eter to ν = 10 degrees of freedom and the marginals equal to those of X(1). In order to visualize statistics of the generated data we calculate the maximums over marginals of abso- lute values of univariate asymmetries and kurtosises for X(w). The results are presented in Fig. 5, as discussed before neither univariate asymmetry nor kurtosis is sig- nificantly affected by the update. 4.3 Stream statistics analysis In order to detect the change in the probability distri- bution we calculate the following values of cumulants based measures in function of w. Those measures are (cid:107)C2(X(w))(cid:107), ν3(X(w)) and ν4(X(w)), see Eq. (18). The obtained results are gathered in Fig. 6. Analyzing the panel 6(a) one can see that the norm of the covariance matrix is not significantly affected by the updates, this 0102030405060w0.60.81.01.21.41.6univariatestatistics×10−2maxasymmetrymaxkurtosis is due to the particular choice of the t-Student copula parameters [31] used to generate the updates. Further, as presented in panel 6(b) the ν3(X(w)) is also unaffected by updates, because t-Student copula is symmetric [31] in such a way that, given symmetric marginals, its high order odd cumulants are zero. How- ever given t-Student copula this is not the case for even cumulants, e.g.ν4(X(w)) is strongly affected by updates and in this case can by used to distinguish between un- derling distributions from which data are drawn. The values of ν4(X(w)) raise with raising window number w, up to w = 41, since for w > 41 there is no orig- inal data from multivariate Gaussian distribution left in X(w). The normalization factor in the denominator of ν4 assures that the function behaves similarly for different number of marginal variables n. This behavior depends from the particular choice of the t-Student copula used in updates, however in general the choice of the partic- ular measure νd should depend on the expected statis- tical model of a data stream. (a) (cid:107)C2(cid:107), Let us discuss the approximation error of ν4(X). We assume that estimation error of dth cumulant elements comes mainly from estimation error of corresponding dth moment element. In an super-diagonal case, we can refer directly to Appendix A in [17] and recall that the standard error of the estimation of dth univariate mo- , in our case it is limited ment md is limited by(cid:112) m2d (cid:113) t 7!! 106 ≈ 10−2. In a case of off-diagonal elements of by C4, as mentioned in aforementioned Appendix A, esti- mation error is limited by the product of lower order moments which generally should by limited by m2d, since moments' values rise rapidly with d. Finally, while computing C4, see (17), we sum up squares of its elements, hence their individual errors should can- cel out to some extend. However dependency between those elements is complex and a standard error calcu- lus would be complicated. Hence we have performed 100 numerical experiment, and computed for n = 100 and t = 106 ν4 from generated data. We obtained the following results summarized by the triplet of values: 5th quantile, median and 95th quantile of ν4 values. At w = 1 -- Gaussian multivariate distribution -- we have obtained (0.004, 0.006, 0.011), while at w ≥ 41 -- t-Student copula with Gaussian marginals -- we have obtained (0.199, 0.209, 0.220). In the second case the error is higher since the t-Student copula introduces high order dependencies between data and elements of C4. Concluding the estimation error is small in com- parison with ν4 values. 4.4 Data frequency analysis In order to estimate the maximal frequency of a data stream that can be analyzed on-line using Algorithm 1 we perform the following experiment using the same hardware discussed in Section 3.2. We fix the number of samples in a observation window t and vary the num- ber of marginals n and number of samples in a batch tup. After the line 11 of Algorithm 1 is executed values 9 (b) ν3(X(w)) ν4(X(w)) n = 100, Figure 6: Cumulants based statistical measures for data X(w) ∈ Rt×n, with window width t = 106, up- date width tup = 2.5 · 104, and number of windows wmax = 61. The initial data are drawn from a Gaussian distribution, then the subsequent updates are drawn from a non-Gaussian one. We can observe that, in this case, ν4 is a good estimator of non-Gaussianity in con- trast to function ν3. The value of ν4 raises with each window up to the saturation point at w = 41. of (cid:107)C1(X(w))(cid:107), (cid:107)C2(X(w))(cid:107), ν3(X(w)) and ν4(X(w)) are calculated. In Figure 7 we present the maximal frequency of data analyzed on-line using the proposed scheme. In presented example we compute and update cumu- lants of order 1, . . . , 4 and use (cid:107)C1(X(w))(cid:107), (cid:107)C2(X(w))(cid:107), ν3(X(w)) and ν4(X(w)) to extract statistical features. Consider that the Algorithm 4 for cumulants' up- dates, is independent of tup and therefore has constant execution time. Therefore one can increase maximal data frequency at the expanse of the method sensitiv- ity by increasing tup. 5 Conclusions In this paper we have introduced a sliding window cumulant calculation algorithm for processing on-line high frequency multivariate data. For computer hard- ware described in Section 3 we have obtained maximum 0102030405060w3540455055606570kC2kn=60n=80n=1000102030405060w00.050.10.150.2ν3,ν4ν4ν3 [5] M. Geng, H. Liang, and J. Wang, "Research on methods of higher-order statistics for phase differ- ence detection and frequency estimation," in Im- age and Signal Processing (CISP), 2011 4th In- ternational Congress on, vol. 4, pp. 2189 -- 2193, IEEE, 2011. [6] J. R. Latimer and N. Namazi, "Cumulant filters-a recursive estimation method for systems with non- Gaussian process and measurement noise," in Sys- tem Theory, 2003. Proceedings of the 35th South- eastern Symposium on, pp. 445 -- 449, IEEE, 2003. [7] G. Birot, L. Albera, F. Wendling, and I. Mer- let, "Localization of extended brain sources from EEG/MEG: the ExSo-MUSIC approach," Neu- roImage, vol. 56, no. 1, pp. 102 -- 113, 2011. [8] H. Becker, L. Albera, P. Comon, M. Haardt, G. Birot, F. Wendling, M. Gavaret, C.-G. B´enar, and I. Merlet, "EEG extended source localiza- tion: tensor-based vs. conventional methods," NeuroImage, vol. 96, pp. 143 -- 157, 2014. [9] A. Hyvarinen, "Independent component analysis of images," Encyclopedia of Computational Neu- roscience, pp. 1 -- 5, 2013. [10] T. Blaschke and L. Wiskott, "Cubica: In- dependent component analysis by simultaneous third-and fourth-order cumulant diagonalization," IEEE Transactions on Signal Processing, vol. 52, no. 5, pp. 1250 -- 1256, 2004. [11] J. Virta, K. Nordhausen, and H. Oja, "Joint use of third and fourth cumulants in independent compo- nent analysis," arXiv preprint arXiv:1505.02613, 2015. [12] M. Rubinstein, E. Jurczenko, and B. Maillet, Multi-moment asset allocation and pricing mod- els, vol. 399. John Wiley & Sons, 2006. [13] I. W. Martin, "Consumption-based asset pricing with higher cumulants," The Review of Economic Studies, vol. 80, no. 2, pp. 745 -- 773, 2013. [14] J. C. Arismendi and H. Kimura, "Monte Carlo Approximate Tensor Moment Simulations," Avail- able at SSRN 2491639, 2014. [15] E. Jondeau, E. Jurczenko, and M. Rockinger, "Moment component analysis: An illustration with international stock markets," Swiss Finance Institute Research Paper, no. 10-43, 2015. [16] K. Domino, "The use of the multi-cumulant tensor analysis for the algorithmic optimisation of invest- ment portfolios," Physica A: Statistical Mechanics and its Applications, vol. 467, pp. 267 -- 276, 2017. [17] K. Domino, (cid:32)L. Pawela, and P. Gawron, "Effi- cient computation of higer-order cumulant ten- sors," SIAM J. SCI. COMPUT., vol. 40, no. 3, pp. A1590 -- A1610, 2018. Figure 7: Maximum frequency of on-line data an- alyzed using the cumulants updates scheme, d = 4, b = 4, multiprocessing computation on 6 workers. data processing frequency of 150 -- 2000 Hz depending on a number of marginal variables. We have presented an illustratory application of our algorithm by employ- ing an example of Gaussian distributed data updated by data generated using t-Student copula. We have shown that our algorithm can be used successfully to determine if on-line updates break the Gaussian distri- bution. We believe that presented algorithm can find many new applications for example in on-line signal filter- ing or classification of data streams. The algorithm can be combined with many different methods of the cumulant-based statistical features extractions, such as the Independent Component Analysis (ICA) [10, 11] or based on tensor eigenvalues [32]. Acknowledgments The research was partially financed by the Na- tional Science Centre, Poland -- project number 2014/15/B/ST6/05204. The authors would like to thank Przemys(cid:32)law G(cid:32)lomb for reading the manuscript and providing valuable discussion. References [1] M. G. Kendall et al., "The advanced theory of statistics," The advanced theory of statistics., no. 2nd Ed, 1946. [2] E. Lukacs, "Characteristics functions," Griffin, London, 1970. [3] J. Stefanowski, K. Krawiec, and R. Wrembel, "Ex- ploring complex and big data," Int. J. Appl. Math. Comput. Sci., vol. 27, no. 4, pp. 669 -- 679, 2017. [4] P. Chevalier, A. Ferr´eol, and L. Albera, "High- Resolution Direction Finding From Higher Order Statistics: The 2rmq-MUSIC Algorithm," IEEE Transactions on signal processing, vol. 54, no. 8, pp. 2986 -- 2997, 2006. 10 6080100120n0.00.51.01.52.0frequency[Hz]×103tup=2.5×104tup=5.×104tup=7.5×104 [18] M. D. Schatz, T. M. Low, R. A. van de Geijn, and T. G. Kolda, "Exploiting symmetry in tensors for high performance: Multiplication with symmetric tensors," SIAM Journal on Scientific Computing, vol. 36, no. 5, pp. C453 -- C479, 2014. [19] O. E. Barndorff-Nielsen and D. R. Cox, Asymp- totic techniques for use in statistics. Chapman & Hall, 1989. [20] D. E. Knuth, The Art of Computer Programming, Volume 4A: Combinatorial Algorithms, Part 1, vol. 4. Addison-Wesley Professional, 2011. [21] R. L. Graham, D. E. Knuth, and O. Patashnik, "Concrete Mathematics: A Foundation for Com- puter Science," Addison & Wesley, 1989. [22] L. Comtet, "Advanced combinatorics, reidel pub," Co., Boston, 1974. [23] J. Bezanson, S. Karpinski, V. B. Shah, and A. Edelman, "Julia: A fast dynamic language for technical computing," arXiv:1209.5145, 2012. [24] J. Bezanson, A. Edelman, S. Karpinski, and V. B. Shah, "Julia: A fresh approach to numerical com- puting," SIAM Review, vol. 59, no. 1, pp. 65 -- 98, 2017. [25] J. Bezanson, J. Chen, S. Karpinski, V. Shah, and A. Edelman, "Array operators using multiple dis- patch: A design methodology for array implemen- tations in dynamic languages," in Proceedings of ACM SIGPLAN International Workshop on Li- braries, Languages, and Compilers for Array Pro- gramming, p. 56, ACM, 2014. [26] K. Domino and P. Gawron, "CumulantsUp- dates.jl," Apr. 2018. [27] K. Domino, (cid:32)L. Pawela, and P. Gawron, "Symmet- ricTensors.jl," Sept. 2017. [28] K. Domino, P. Gawron, and (cid:32)L. Pawela, "Cummu- lants.jl," Feb. 2018. [29] J. Gama, Knowledge Discovery from Data Streams, vol. 20103856 of Chapman & Hall/CRC Data Mining and Knowledge Discovery Series. Chapman and Hall/CRC, May 2010. [30] A. Sklar, "Fonctions de r´epartition `a n dimensions et leurs marges. publications de l'institut de statis- tique de l'universit´e de paris," 1959. [31] U. Cherubini, E. Luciano, and W. Vecchiato, Cop- ula methods in finance. John Wiley & Sons, 2004. [32] L. Qi, "Eigenvalues of a real supersymmetric ten- sor," Journal of Symbolic Computation, vol. 40, no. 6, pp. 1302 -- 1324, 2005. 11
1908.06806
1
1908
2019-08-19T13:55:35
A New Fast Unweighted All-pairs Shortest Path Search Algorithm Based on Pruning by Shortest Path Trees
[ "cs.DS" ]
We present a new fast all-pairs shortest path algorithm for unweighted graphs. In breadth-first search which is said to representative and fast in unweighted graphs, the average number of accesses to adjacent vertices (expressed by {\alpha}) is about equal to the average degree of the graph. On the other hand, our algorithm utilizes the shortest path trees of adjacent vertices of each source vertex, and reduce {\alpha} drastically. Roughly speaking {\alpha} is reduced to the value close to 1, because the average degree of a tree is about 2, and one is used to come in and the other is used to go out, although that does not hold true when the depth of the shortest path trees is small. We compared our algorithm with breadth-first search algorithm, and our results showed that ours outperforms breadth-first search on speed and {\alpha}.
cs.DS
cs
A New Fast Unweighted All-pairs Shortest Path Search Algorithm Based on Pruning by Shortest Path Trees Yasuo Yamane1 and Kenichi Kobayashi2 1 Fujitsu Limited, 17-25, Shinkamata 1-chome, Ota-ku, Tokyo, 144-8588, Japan 2 Fujitsu Laboratories Ltd., 4-1-1, Kamikodanaka, Nakahara-ku, Kawasaki, 211-8588, Japan Abstract We present a new fast all-pairs shortest path algorithm for unweighted graphs. In breadth-first search which is said to representative and fast in unweighted graphs, the average number of accesses to adjacent vertices (expressed by α) is about equal to the average degree of the graph. On the other hand, our algorithm utilizes the shortest path trees of adjacent vertices of each source vertex, and reduce α drastically in comparison with breadth-first search. Roughly speaking α is reduced to the value close to 1, because the average degree of a tree is about 2, and one is used to come in and the other is used to go out, although that does not hold true when the depth of the shortest path trees is small. We compared our algorithm with breadth-first search algorithm, and our results showed that ours outperforms breadth-first search on speed and α. 1. Introduction We present a new fast all-pairs shortest path algorithm for unweighted graphs, which we call PST (Pruning by Shortest path Trees) algorithm, or PST simply below. All pairs shortest path algorithms have many applications in general graphs, for example, railroad networks, transportation networks, Web and SNS (Social Networking Service). Restricted to unweighted graphs, they have various applications such as Web and SNS. Breadth-first search is applied for various purposes, and it can be applied for computing the all- pairs shortest paths [BFS]. We call it simply BFS. It is one of the representative algorithms for unweighted all-pairs shortest path search and known to be fast. In BFS, the average number of accesses to adjacent vertices at each vertex, which is expressed by 𝛼 below, is about equal to the average degree of the graph. On the other hand, PST utilizes the shortest path trees of adjacent vertices of each source (starting) vertex for pruning when traversing from the source vertex beyond the adjacent vertices and reduce α drastically in comparison with BFS. And roughly speaking 𝛼 of PST is reduced to the value close to 1, because the average degree of a tree is about 2, and one is used to come in and the other is used to go out, although that does not hold true when the depth of the shortest path trees is small. We compared PST with BFS, and our result showed that PST outperforms BFS on speed and 𝛼. 1 2. Relative Works In this section, we explain representative algorithms for all-pairs shortest path algorithms for unweighted graphs as follows: 1) Floyd-Warshall algorithm ([Floyd62], [Warshall62]) It is one of the most famous algorithms for all-pairs shortest algorithms. This is the algorithm for weighted graphs, but it can be applied to unweighted graphs letting all weights be one. The (worst) time complexity is 𝑂(𝑛3) where 𝑛 is the number of vertices, but the implementation is very simple requiring only some lines. Let 𝑛 and 𝑚 mean the numbers of vertices and edges of a graph respectively, and time complexity mean worst one below. 2) Dijkstra's algorithm ([Dijkstra]) It is well-known as a fast algorithm for computing the shortest paths from a source vertex to the all vertices in weighted graphs, and the time complexity is 𝑂(𝑛 𝑙𝑜𝑔 𝑛 + 𝑚). It can be applied for computing the all-pairs shortest paths by letting each vertex as a source one, and the time complexity is 𝑂(𝑛(𝑛 𝑙𝑜𝑔 𝑛 + 𝑚)). To distinguish them, we call the former algorithm SS-Dijkstra (Single-Source Dijkstra), and the latter AP-Dijkstra (All-Pairs Dijkstra) or simply Dijkstra. 3) breadth-first search ([BFS]) As mentioned above, breadth-first search is originally an algorithm to traverse all the vertices in breadth-first manner, and it is applied for various purposes. The time complexity is 𝑂(𝑛 + 𝑚). It can be applied for computing the all-pairs shortest paths by letting each vertex as a source one, and the time complexity is 𝑂(𝑛(𝑛 + 𝑚)). To distinguish from an original breadth-first search, we call this algorithm AP-BFS (All-Pairs shortest path Breadth-First Search) or simply BFS. AP- BFS is faster than AP-Dijkstra and Floyd-Warshall algorithm on unweighted graphs. 4) Peng's algorithm ([Peng12]) This is a variant of AP-Dijkstra's algorithm, and it computes the shortest paths from each vertex to all the vertices serially. We call this algorithm Peng simply. The feature of it is to utilize the length of the already computed shortest paths to reduce 𝛼. AP-BFS is faster than AP-Dijkstra, so we thought of improving Peng for unweighted graphs likewise, but we have not achieved that. We will submit a paper on a variant of PST for weighted graphs to arXiv at almost the same time as this paper, so we will compare PST with Peng in the paper. 3. PST algorithm In this section, PST algorithm is explained in more detail. Our basic idea is explained in 3.1 and the details of the algorithm is explained in 3.2. 3. 1 Basic idea Generally speaking, in all-pairs shortest path algorithms, a shortest path tree is generated at each 2 vertex. It is well-known that the shortest paths from each vertex 𝑣 to all the vertices can be compactly expressed by a tree whose root is 𝑣. This tree is called a "shortest path tree" and represented by 𝑇(𝑣) below. Fig.3.1(b) shows the shortest path tree for an unweighted graph shown in (a). As mentioned above, PST utilizes the shortest path trees being generated for pruning, that is, to reduce α. Here, let us consider how similar 𝑇(𝑣) and 𝑇(𝑤) are if 𝑣 and 𝑤 are adjacent; for example, your closest railway station 𝑣 and another station 𝑤 next to 𝑣. 𝑇(𝑣) and 𝑇(𝑤) must be almost the same. This suggests that 𝑇(𝑤) has only to be traversed, that is, it is unnecessary to traverse the edges which are not contained in 𝑇(𝑤) when searching through w to generate 𝑇(𝑣) if the necessary part of 𝑇(𝑤) is already generated. This leads to reducing α drastically in comparison with BFS, as mentioned above. This is our basic idea. PST is a variant of BFS where the following two modifications are added. The shortest path from 𝑣 to x on 𝑇(𝑣) is expressed by 𝜎𝑣(𝑥). (a) an unweighted graph (b) a shortest path tree Fig.3.1 An unweighted graph and a shortest path tree 1) Pruning by shortest path trees Let us consider two adjacent vertices 𝑣 and 𝑤, and another vertex 𝑥 different from them. It is well known that a partial path of a shortest path is also the shortest. Therefore, if 𝜎𝑣( 𝑥) contains edge (𝑣, 𝑤), then 𝜎𝑣( 𝑥) can be let to be edge (𝑣, 𝑤) plus 𝜎𝑤( 𝑥). This means that when searching through 𝑤 from 𝑣, it is unnecessary to search the part other than 𝑇(𝑤). Let the adjacent vertices of 𝑣 be 𝑤1, 𝑤2 and 𝑤3. Fig.3.2 shows the parts of the three shortest path trees 𝑇(𝑤1), 𝑇(𝑤2) and 𝑇(𝑤3) which are traversed to create 𝑇(𝑣) . They are expressed as red, green, and blue edges respectively. Based on what is mentioned above, PST traverses only 𝑇(𝑤) when searching through (𝑣, 𝑤). As mentioned above, this improvement reduces 𝛼 drastically in comparison with BFS. Roughly speaking to make the effect understandable, 𝛼 is reduced to the value close to one. Because the 3 average degree of a tree is about 2 (correctly 2(n−1) 𝑛 ), and on each vertex 𝑥, one of the adjacent vertices of 𝑥 is used to go into it and the other is used to access the adjacent vertex, so 𝛼 is about 1. However, this does not hold true when the depth of shortest path trees is small. Here, it seems worth to note the accesses to adjacent vertices from a source vertex and those from adjacent vertices to their adjacent vertices cannot be reduced to understand that it does not hold true. Fig.3.2 Traversing the shortest path trees of adjacent vertices to create 𝑇(𝑣) 2) Synchronous generation of shortest path trees In PST it is necessary to generate shortest path trees synchronously to realize 1). Concretely speaking, at each vertex 𝑣, the parts of 𝑇(𝑣) is synchronously generated, and they are like concentric circles. First the part of the vertices adjacent to 𝑣, that is, the vertices on the circle centering around 𝑣 whose radius is 1 is generated synchronously with all the other vertices. Secondly the part of the vertices on the circle whose radius is 2 is generated synchronously as if the computation is done parallelly, and so on. Therefore, letting a vertex 𝑤 is adjancent to 𝑣, when generating 𝑇(𝑣) it is guaranteed that the necessary part of 𝑇(𝑤) has already be generated. 3.2 The details of PST algorithm Here, we explain concretely how the modifications mentioned above are added. We implemented for undirected graphs but it is easy to modify for directed graphs. We add notice when necessary. 1) Modification for pruning by shortest path trees This is modification of the data structure representing shortest path trees. In BFS, 𝑇(𝑣) of each source vertex 𝑣 can be represented as a vector of size n. That is, letting all the vertices be 𝑣1, 𝑣2, ⋯ , 𝑣𝑛 and the vector be [𝑠𝑖], it is sufficient to let 𝑠𝑖 be 𝑗 of the parent 𝑣𝑗 of 𝑣𝑖 on 𝑇(𝑣) . And all the shortest path trees can be represented by an 𝑛 by 𝑛 matrix. However, in PST, it is 4 necessary to memorize children in shortest path trees to prune using shortest path trees. So, for each source vertex, a shortest path tree retaining the relationship between the parents and the children is generated. 2) Modification for synchronous generation of shortest path trees This is modification on queues. PST uses FIFO queues in the same manner as BFS, but it is necessary to modify them to synchronize as follows: A pair of a vertex and its distance from the source vertex is enqueued. And only the pair at the top of the queue whose distance is equal to a specified distance is dequeued. This modification enables to add synchronously the vertices to the shortest path tree whose distance from the source vertex is the same. We call this queue a "queue with distances" or a "d-queue" simply. Although we do not explain the class of d-queue in detail, each d-queue 𝑞 has two methods. One is 𝑞. 𝑒𝑛𝑞𝑢𝑒(𝑥, 𝑑) which is used to enqueue a vertex 𝑥 whose distance from 𝑣 is 𝑑, and the other is 𝑞. 𝑑𝑒𝑞𝑢𝑒(𝑑) which returns 𝑥 whose distance from 𝑣 is 𝑑 at the top of the queue, or 𝑁𝑜𝑛𝑒 when such a vertex does not exist. We implemented d-queue as a circular list of size 𝑠. Likewise, we implemented the FIFO queue in BFS as a circular list of size 𝑠. We show the two classes: One is 𝑉𝑒𝑟𝑡𝑒𝑥 , and its instance represents a vertex of a graph 𝐺. The other is 𝑇_𝑉𝑒𝑟𝑡𝑒𝑥 and its instance represents a vertex on a shortest path tree, which is called "t-vertex" to distinguish from a vertex of 𝑉𝑒𝑟𝑡𝑒𝑥. Let 𝑥 be a vertex. Then we express a t-vertex whose id is the same as 𝑥 by 𝑥′. Then we say 𝑥′ corresponds to 𝑥. 1) 𝑉𝑒𝑟𝑡𝑒𝑥 Let an instance of this class be 𝑣. It consists of five properties 𝑖𝑑, 𝑎𝑑𝑗_𝑣𝑒𝑟𝑖𝑡𝑐𝑒𝑠, 𝑟𝑜𝑜𝑡, 𝑐 and 𝑞𝑢𝑒. Each vertex 𝑣𝑖 (1 ≤ 𝑖 ≤ 𝑛) has an id whose value is 𝑖, and property 𝑖𝑑 represents 𝑖. Property 𝑎𝑑𝑗_𝑣𝑒𝑟𝑖𝑡𝑐𝑒𝑠 represents the set of adjacent vertices of 𝑣 whose class is also 𝑉𝑒𝑟𝑡𝑒𝑥. Property 𝑟𝑜𝑜𝑡 represents a vertex 𝑣′ in 𝑇(𝑣) corresponding to 𝑣, that is, the root of 𝑇(𝑣). The class of 𝑣′ is 𝑇_𝑉𝑒𝑟𝑡𝑒𝑥 explained next. Property 𝑐 represents a counter for vertices whose shortest paths from 𝑣 have already been obtained. Property 𝑞𝑢𝑒 represents a d-queue prepared for each vertex explained above. 𝑖𝑑 the id of 𝑣 from 1 to 𝑛 𝑎𝑑𝑗_𝑣𝑒𝑟𝑖𝑡𝑐𝑒𝑠 the set of adjacent vertices of 𝑣 whose class is 𝑉𝑒𝑟𝑡𝑒𝑥 𝑟𝑜𝑜𝑡 the root of 𝑇(𝑣) whose class is 𝑇_𝑉𝑒𝑟𝑡𝑒𝑥 c a counter for vertices whose shortest paths have already been obtained. 𝑞𝑢𝑒 a d-queue for 𝑣 2) 𝑇_𝑉𝑒𝑟𝑡𝑒𝑥 As mentioned above, an instance of this class is used to represent each vertex of 𝑇(𝑣). 𝑇 of 5 𝑇_𝑉𝑒𝑟𝑡𝑒𝑥 means (shortest path) tree. Let 𝑥′ be a t-vertex of 𝑇(𝑣) . The t-vertex 𝑥′ has four properties 𝑣𝑒𝑟𝑡𝑒𝑥, 𝑐𝑜𝑟, 𝑝𝑎𝑟𝑒𝑛𝑡, and 𝑐ℎ𝑖𝑙𝑑𝑟𝑒𝑛. Property 𝑣𝑒𝑟𝑡𝑒𝑥 represents 𝑥. Here, let 𝑥' be a t-vertex reached through 𝑤′ where 𝑤 and a source vertex 𝑣 are adjacent. Property 𝑐𝑜𝑟 represents the t-vertex corresponding to 𝑥' on 𝑇(𝑤). This t-vertex is represented by 𝑥′′ below. That is, the value of 𝑐𝑜𝑟 is 𝑥′′ . Property 𝑝𝑎𝑟𝑒𝑛𝑡 represents the parent of 𝑥' in 𝑇(𝑣). Property 𝑐ℎ𝑖𝑙𝑑𝑟𝑒𝑛 represents the set of the children of 𝑥' in 𝑇(𝑣). The values of properties of 𝑥' and the relationships between these data structures are summarized in Fig.3.3. Fig3.3 the data structure of a t-vertex and the relationship between t-vertices and shortest path trees The python-like pseudo code of PST algorithm is shown below. First the algorithm for creating a graph 𝐺 = (𝑉, 𝐸) where 𝑉 = 𝑛 and initialization is shown. We implemented the creation of a graph and initialization together in our experiments, but they should be separated to be exact because it relates to the measurements as mentioned later. Here, initialization means preparation for PSTw algorithm; for example, initialization of a queue at each vertex. In python's class definition, the name of a method creating a new instance is __ 𝑖𝑛𝑖𝑡__, and the first parameter of it is 𝑠𝑒𝑙𝑓 which represents a new instance. However, we use an understandable parameter name instead of 𝑠𝑒𝑙𝑓, for example 𝑣. Algorithm for creation of a graph and initialization input: 𝑛 output: 𝐺 = (𝑉, 𝐸) class 𝑉𝑒𝑟𝑡𝑒𝑥(): __𝑖𝑛𝑖𝑡__(𝑣, 𝑖𝑑, 𝑛): # returns a new instance 𝑣 𝑣. 𝑖𝑑 = 𝑖𝑑 𝑣. 𝑎𝑑𝑗_𝑣𝑒𝑟𝑡𝑖𝑐𝑒𝑠 = { } 𝑣′ = 𝑇_𝑉𝑒𝑟𝑡𝑒𝑥(𝑣) 6 𝑣. 𝑟𝑜𝑜𝑡 = 𝑣′ 𝑣. 𝑐 = 1 set an empty d-queue of size n to 𝑣. 𝑞𝑢𝑒 𝑐𝑙𝑎𝑠𝑠 𝑇_𝑉𝑒𝑟𝑡𝑒𝑥(): __𝑖𝑛𝑖𝑡__(𝑣′, 𝑣): # returns a new instance 𝑣′ 𝑣′. 𝑣𝑒𝑟𝑡𝑒𝑥 = 𝑣 𝑣′. 𝑐𝑜𝑟 = 𝑁𝑜𝑛𝑒 𝑣′. 𝑝𝑎𝑟𝑒𝑛𝑡 = 𝑁𝑜𝑛𝑒 set an empty set to 𝑣′. 𝑐ℎ𝑖𝑙𝑑𝑟𝑒𝑛 set an empty set to 𝑉 𝑓𝑜𝑟 𝑖𝑑 ∈ {1, 2, ⋯ , 𝑛}: 𝑣 = 𝑉𝑒𝑟𝑡𝑒𝑥(𝑖𝑑, 𝑛) # create a new instance of 𝑉𝑒𝑟𝑡𝑒𝑥 add 𝑣 to 𝑉 𝑓𝑜𝑟 𝑣 ∈ 𝑉: add 𝑣′𝑠 adjacent vertices to 𝑣. 𝑎𝑑𝑗_𝑣𝑒𝑟𝑖𝑡𝑐𝑒𝑠 Secondly the main routine of PST algorithm, and the definition of function 𝑒𝑥𝑡𝑒𝑛𝑑( 𝑣, 𝑑, 𝐷, 𝑆) , which extends 𝑇(𝑣), are shown. A variable 𝑑 represents the depth of shortest path trees being generated. 𝐷 is an 𝑛 by 𝑛 matrix to represent distances between vertices. It is called a "distance matrix". Its element 𝐷[𝑖, 𝑗] means the distance from 𝑣𝑖 to 𝑣𝑗. All the elements of 𝐷 are initialized to 0.0. 𝑆 is an 𝑛 by 𝑛 matrix to represent all the generated shortest path trees. It is called a "shortest path tree matrix". Its element 𝑆[𝑖, 𝑗] represents the parent of 𝑣𝑖 on the shortest path from 𝑣𝑖 𝑡𝑜 a source vertex 𝑣𝑗. Let the diagonal elements of 𝑆 already be initialized to 𝑁𝑂_𝑃𝐴𝑅𝐸𝑁𝐸𝑇(= −1), and all the other elements to 𝑁𝑂𝑇_𝑆𝐸𝐴𝑅𝐶𝐻𝐸𝐷(= 0). 𝑁𝑂_𝑃𝐴𝑅𝐸𝑁𝐸𝑇 means there is not a parent, that is, 𝑣𝑖 is a source vertex. NOT_SEARCHED means it has not been searched yet. The function returns if 𝑣. 𝑐 == 𝑛; BFS was implemented likewise. It is necessary to note that this condition cannot be used for directed graphs because all the vertices cannot necessarily be reached from a source vertex. It is worth noting that although at first 𝑉 represents the set of all the vertices, 𝑉 virtually represents the set of vertices whose all the shortest paths form source vertices have not been computed yet. PST algorithm input: 𝐺 = (𝑉, 𝐸) 7 output: 𝐷 and 𝑆 set an 𝑛 × 𝑛 initialized distance matrix to 𝐷 set an 𝑛 × 𝑛 initialized shortest path tree matrix to 𝑆 𝑑 = 0 𝑤ℎ𝑖𝑙𝑒 0 < 𝑉: 𝑑 = 𝑑 + 1 set an empty set to 𝑉𝑛𝑒𝑤 𝑓𝑜𝑟 𝑣 ∈ 𝑉: 𝑒𝑥𝑡𝑒𝑛𝑑(𝑣, 𝑑, 𝐷, 𝑆): 𝑖𝑓 𝑣. 𝑐 < 𝑛: add 𝑣 to 𝑉𝑛𝑒𝑤 𝑉 = 𝑉𝑛𝑒𝑤 𝑑𝑒𝑓 𝑒𝑥𝑡𝑒𝑛𝑑(𝑣, 𝑑, 𝐷, 𝑆): 𝑖𝑓 𝑑 == 1: 𝑓𝑜𝑟 𝑤 ∈ 𝑣. 𝑎𝑑𝑗_𝑣𝑒𝑟𝑡𝑖𝑐𝑒𝑠: 𝐷[𝑤. 𝑖𝑑, 𝑣. 𝑖𝑑] = 𝑑 𝑆[𝑤. 𝑖𝑑, 𝑣. 𝑖𝑑] = 𝑣. 𝑖𝑑 𝑤′=T_Vertex(w) # create a new instance of 𝑇_𝑉𝑒𝑟𝑡𝑒𝑥 𝑤′. 𝑐𝑜𝑟 = 𝑤. 𝑟𝑜𝑜𝑡 # the value of 𝑤. 𝑟𝑜𝑜𝑡 𝑖𝑠 𝑤′′ add 𝑤′ to 𝑣′. 𝑐ℎ𝑖𝑙𝑑𝑟𝑒𝑛 𝑤′.parent = 𝑣′ 𝑣. 𝑞𝑢𝑒. 𝑒𝑛𝑞𝑢𝑒(𝑤′, 1) 𝑣. 𝑐 = 𝑣. 𝑐 + 1 𝑒𝑙𝑠𝑒: 𝑛 = 𝑙𝑒𝑛(𝐷) 𝑤′ = 𝑣. 𝑞𝑢𝑒. 𝑑𝑒𝑞𝑢𝑒(𝑑 − 1) 𝑤ℎ𝑖𝑙𝑒 𝑤′𝑖𝑠 𝑛𝑜𝑡 𝑁𝑜𝑛𝑒: 𝑓𝑜𝑟 𝑥′′ ∈ 𝑤′. 𝑐𝑜𝑟. 𝑐ℎ𝑖𝑙𝑑𝑟𝑒𝑛: 𝑥 = 𝑥′′. 𝑣𝑒𝑟𝑡𝑒𝑥 𝑖𝑓 𝑆[𝑥. 𝑖𝑑, 𝑣. 𝑖𝑑] == 𝑁𝑂𝑇_𝑆𝐸𝐴𝑅𝐶𝐻𝐸𝐷: 𝐷[𝑥. 𝑖𝑑, 𝑣. 𝑖𝑑] = 𝑑 𝑤 = 𝑤′. 𝑣𝑒𝑟𝑡𝑒𝑥 𝑆[𝑥. 𝑖𝑑, 𝑣. 𝑖𝑑] = 𝑤. 𝑖𝑑 𝑥′=T_Vertex(x) # create a new instance of 𝑇_𝑉𝑒𝑟𝑡𝑒𝑥 𝑥′. 𝑐𝑜𝑟 = 𝑥′′ 8 add 𝑥′ to 𝑤′.children 𝑥′.parent = 𝑤′ 𝑣. 𝑞𝑢𝑒. 𝑒𝑛𝑞𝑢𝑒(𝑥′, 𝑑) 𝑣. 𝑐 = 𝑣. 𝑐 + 1 𝑖𝑓 𝑣. 𝑐 == 𝑛: 𝑟𝑒𝑡𝑢𝑟𝑛 𝑤′ = 𝑣. 𝑞𝑢𝑒. 𝑑𝑒𝑞𝑢𝑒(𝑑 − 1) 𝑟𝑒𝑡𝑢𝑟𝑛 4. Evaluation We compared PST with BFS. We excluded Floyd-Warshall algorithm (abbreviated as WF) because its time complexity is 𝑂(𝑛3) which is worse than 𝑂(𝑛(𝑛 + 𝑚)) of BFS. We measured letting 𝑛 = 22𝑖(𝑖 = 3,4,5,6), that is, 𝑛 = 64, 256, 1024, 4096. On CPU time, as mentioned above, creating a graph also includes initialization. Therefore, CPU time of PSTw does not include the initialization time. We think initialization does not affect the total CPU time so much, but it should be included in PSTw to be exact. Peng and Dijkstra are also implemented in the same manner, so their CPU time also do not include initialization time. We used the following two kinds of graphs for comparison, which are hypercube-shaped and scale- free graphs. We selected scale-free graphs because they are said to be ubiquitous in the real world. The relationship between the degree of each vertex 𝑑 and the frequency of the vertices whose degree is equal to 𝑑 obey to a power distribution. So 𝑑 takes various values. On the other hand, hypercube- shaped graphs have a feature quite opposite to scale-free graphs, that is, 𝑑 takes only one value. We selected hypercube-shaped graphs because we wanted to examine the two algorithms from two quite different viewpoints. 1) hypercube-shaped graph It is worth to note that the degree of each vertex of this graph is log2𝑛, the values of 𝛼 are about 6, 8, 10, and 12 for 𝑛 = 64, 256, 1024, and 4096. 2) Scale-free graph The graph is created as follows: When creating a graph of size 𝑛, first a complete graph 𝐺 = (𝑉, 𝐸) of size 𝑛′(< 𝑛) is created. Secondly the remaining 𝑛 − 𝑛′ vertices are added one by one as follows: Let one of them be 𝑣. Let 𝑛′ vertices chosen randomly from 𝑉 be 𝑣1, 𝑣2, ⋯ , 𝑣𝑛′. Then Let 𝑉 = 𝑉 ∪ {𝑣} and 𝐸 = 𝐸 ∪ {(𝑣, 𝑣1), (𝑣, 𝑣2), ⋯ , (𝑣, 𝑣𝑛′)}. The probability of choosing 𝑣𝑖 (𝑖 = 1, 2, ⋯ , 𝑛′) is let to be proportional to the degree of 𝑣𝑖. For measurement environment, we used FUJITSU Workstation CELSIUS M740 with Intel Xeon 9 E5-1603 v4 (2.80GHz) and 32GB main memory, programing language Python, and OS Linux. 4.1 Comparison in hypercube-shaped graphs Fig. 4.1 and Table 4.1 show the comparison of CPU time of the two algorithms in hypercube-shaped graphs. Fig. 4.1 is shown in a double-logarithmic graph. CPU time graphs are shown in the same manner below. Table 4.1 shows the actual values in detail. Tables show the actual values likewise below. The column whose name is /PST shows the rate of the CPU time (called "CPU time rate") of BFS against that of PST, that is, how many times PST is faster than BFS. When 𝑛 = 4096, PST is 3.1 times faster than BFS, and the CPU rate increases as 𝑛 increases. Fig. 4.2 and Table 4.2 show the comparison of 𝛼. The /PST column shows the rate of 𝛼 (called "𝛼 rate") likewise. PST outperforms BFS greatly, and the 𝛼 rate increases as 𝑛 increases. BFS's 𝛼 is about equal to the degree of each vertex and increases as 𝑛 increases. PST's does not reach 1 but decreases from 1.71 to 1.52, a close value to 1. To sum up, PST outperforms BFS in CPU time and 𝛼, and especially greatly in 𝛼. The 𝛼 rate is larger than CPU rate. It seems to be because of the overhead of t-vertices. Fig. 4.1 Comparison in CPU time Fig. 4.2 Comparison in α Table 4.1 Comparison in CPU time Table 4.2 Comparison in α 4.2 Comparison in scale-free graphs The result of comparison in sparse case (𝑛′ = 2) is mentioned in 4.2.1, and that in dense case (𝑛′ = √𝑛) is mentioned in 4.2.2. 10 PSTtime (s)time (s) /.PSTw640.040.061.642560.621.312.12102410.1725.612.524096163.73504.203.08BFSnPSTαα /.PSTw641.715.423.172561.607.754.8410241.549.906.4340961.5211.967.87nBFS 4.2.1 Sparse case (𝑛′ = 2) Fig. 4.3 and Table 4.3 shows the comparison of the two algorithms in CPU time. These show PST outperforms BFS slightly. When 𝑛 = 4096, PST is 1.38 times faster than BFS and the CPU time rate increases as 𝑛 increases. Fig.4.4 and Table 4.4 shows the comparison inα. When 𝑛 = 4096, PST's 𝛼 is 1.19, a value to close to 1, and PST outperforms BFS by 3.26 times. Theαrate increases as 𝑛 increases. To sum up, PST outperforms BFS, but not so much as in case of hypercube-shaped graphs. Fig. 4.3 Comparison in CPU time Fig. 4.4 Comparison in α Table 4.3 Comparison in CPU time Table 4.4Comparison in α 4.2.2 Dense case (𝑛′ = √𝑛) Fig.4.5 and Table 4.5 shows the comparison of CPU time. PST is 1.42 times faster than BFS when 𝑛 = 4096, and the CPU time rate increases as 𝑛 increases. Fig. 4.6 and Table 4.6 show the comparison of α. PST outperforms BFS by 1.95 times when 𝑛 = 4096, and the α rate seems to increase. PST's α is 6.23 when 𝑛 = 4096, and increases as 𝑛 increases. The depth of shortest path trees tends to be small when the graph is dense. As mentioned above, it does not holds true when the depth of shortest path tree is small that the value of α is close to 1, but it is smaller than in case of BFS. To sum up, PST outperforms BFS on CPU time as well as in the sparse case, but not so much on α as in the sparse case. It does not holds true that the value of α is close to 1, 11 PSTtime (s)time (s) /.PSTw640.040.051.242560.530.681.2810248.8611.631.314096148.94206.041.38nBFSPSTαα /.PSTw641.383.152.282561.253.532.8210241.213.713.0740961.193.883.26nBFS Fig. 4.5 Comparison in CPU time Fig. 4.5 Comparison in α Table 4.6 Comparison in CPU time Table 4.6 Comparison in α 4.3 Consideration We show our consideration on the result of comparison and space complexity. 4.3.1 On the result of comparison 1) Comparison with BFS PST outperforms BFS in CPU time and 𝛼 in all the graphs measured. The reason seems as follows: BFS's 𝛼 is about equal to the average degree of each vertex. On the other hand, BFS's 𝛼 is close to 1 in case of hypercube-shaped and sparse scale-free graphs. In case of dense scale-free graphs, BFS's 𝛼 is 6.23 and not close to 1, but it is 1.95 times smaller than BFS's 𝛼 12.1. In short, PST's 𝛼 is at least 1.95 times smaller than BFS's 𝛼, and that seems to be the reason why PST outperforms BFS on CPU time. 2) PST's 𝛼 It is between 1.52 and 1.71 in hypercube-shaped graphs and it decrease as 𝑛 increases, and it is also between 1.19 and 1.38 in sparse scale-free graphs and it also decreases as 𝑛 increases and these values are closes to 1. On the other hand, in case of dense scale-free graphs it is between 3.50 and 6.23, which are far from 1. The reason seems as follows: Let vertex 𝑤 be adjacent to a source vertex 𝑣. Then T(𝑤) contains all the vertices adjacent to 𝑤, so T(𝑣) cannot be pruned at the depth of 1. In addition, the depth of T(𝑣) is small. These seem to cause that 𝛼 is far from 1. The value of 𝛼 increases as 𝑛 increases. 12 PSTtime (s)time (s) /.PSTw640.060.050.982560.931.171.25102417.8824.051.354096333.72472.441.42nBFSPSTαα /.PSTw643.504.581.312564.477.521.6810245.3610.021.8740966.2312.121.95BFSn 4.3.2 On space complexity We mention our consideration about space complexity, which has not been discussed above. Both PST and BFS needs 𝑂(𝑛2) memory to store the matrix for shortest path trees. In addition, BFS only needs 𝑂(𝑛 + 𝑚) memory to represent a graph, and memory for the FIFO queue. However, in addition to the memory mentioned above, PST needs the memory to store T(𝑣) at each vertex 𝑣. Therefore, BFS outperforms PST from the viewpoint of space complexity. 5. Conclusion We proposed a new all-pairs shortest path search algorithm for unweighted graphs, which reduces 𝛼 to the value close to 1 by pruning based on the shortest path trees of adjacent vertices of a source vertex when the depth of the shortest paths is relatively large. The result mentioned above showed the following: 1) PST outperforms BFS in CPU time and 𝛼. 2) PST's 𝛼 is close to 1 in case of hypercube-shaped and sparse scale-free graphs, and it decreases as 𝑛 increases 3) In case of dense scale-free graphs, PST's 𝛼 is between 3.50 and 6.23 and far from 1. The reason seems that the shortest paths cannot be pruned at the depth of 1 and the depth of them is small. 4) BFS outperforms PST from the viewpoint of space complexity. References [BFS] Wikipedia's title: "Breadth-first search" [Dijkstra] Wikipedia's title: Dijkstra's algorithm. [Floyd62] R. W. Floyd. Algorithm 97: Shortest Path. CACM 5 (6): 345, 1962. [Kim18] J. W. Kim, H. Choi, and S. Bae. Efficient Parallel All-Pairs ShortestPaths Algorithm for Complex Graph Analysis. Proceedings of International Conference on Parallel Processing Companion, 2018. [Peng12] W. Peng, X. Hu, F. Zhao, and J. Su, A Fast algorithm to find all-pairs shortest paths in complex networks. Procedia Computational Science 9: 557-566, 2012. [Warshall62] S. Warshall. A theorem on Boolean matrices. JACM 9 (1): 11 -- 12, 1962. 13
1608.00673
1
1608
2016-08-02T02:07:51
Adaptivity Gaps for Stochastic Probing: Submodular and XOS Functions
[ "cs.DS" ]
Suppose we are given a submodular function $f$ over a set of elements, and we want to maximize its value subject to certain constraints. Good approximation algorithms are known for such problems under both monotone and non-monotone submodular functions. We consider these problems in a stochastic setting, where elements are not all active and we can only get value from active elements. Each element $e$ is active independently with some known probability $p_e$, but we don't know the element's status \emph{a priori}. We find it out only when we \emph{probe} the element $e$---probing reveals whether it's active or not, whereafter we can use this information to decide which other elements to probe. Eventually, if we have a probed set $S$ and a subset $\text{active}(S)$ of active elements in $S$, we can pick any $T \subseteq \text{active}(S)$ and get value $f(T)$. Moreover, the sequence of elements we probe must satisfy a given \emph{prefix-closed constraint}---e.g., these may be given by a matroid, or an orienteering constraint, or deadline, or precedence constraint, or an arbitrary downward-closed constraint---if we can probe some sequence of elements we can probe any prefix of it. What is a good strategy to probe elements to maximize the expected value? In this paper we study the gap between adaptive and non-adaptive strategies for $f$ being a submodular or a fractionally subadditive (XOS) function. If this gap is small, we can focus on finding good non-adaptive strategies instead, which are easier to find as well as to represent. We show that the adaptivity gap is a constant for monotone and non-monotone submodular functions, and logarithmic for XOS functions of small \emph{width}. These bounds are nearly tight. Our techniques show new ways of arguing about the optimal adaptive decision tree for stochastic problems.
cs.DS
cs
Adaptivity Gaps for Stochastic Probing: Submodular and XOS Functions Anupam Gupta ∗ Viswanath Nagarajan † Sahil Singla∗ August 3, 2016 Abstract Suppose we are given a submodular function f over a set of elements, and we want to maximize its value subject to certain constraints. Good approximation algorithms are known for such problems under both monotone and non-monotone submodular functions. We consider these problems in a stochastic setting, where elements are not all active and we can only get value from active elements. Each element e is active independently with some known probability pe, but we don't know the element's status a priori. We find it out only when we probe the element e-probing reveals whether it's active or not, whereafter we can use this information to decide which other elements to probe. Eventually, if we have a probed set S and a subset active(S) of active elements in S, we can pick any T ⊆ active(S) and get value f (T ). Moreover, the sequence of elements we probe must satisfy a given prefix-closed constraint-e.g., these may be given by a matroid, or an orienteering constraint, or deadline, or precedence constraint, or an arbitrary downward- closed constraint-if we can probe some sequence of elements we can probe any prefix of it. What is a good strategy to probe elements to maximize the expected value? In this paper we study the gap between adaptive and non-adaptive strategies for f being a submodular or a fractionally subadditive (XOS) function. If this gap is small, we can focus on finding good non-adaptive strategies instead, which are easier to find as well as to represent. We show that the adaptivity gap is a constant for monotone and non-monotone submodular functions, and logarithmic for XOS functions of small width. These bounds are nearly tight. Our techniques show new ways of arguing about the optimal adaptive decision tree for stochastic problems. 1 Introduction Consider the problem of maximizing a submodular function f over a set of elements, subject to some given constraints. This has been a very useful abstraction for many problems, both theoretical (e.g., the classical k- coverage problem [WS11]), or practical (e.g., the influence maximization problem [KKT15], or many problems in machine learning [Kra13]). We now know how to perform constrained submodular maximization, both when the function is monotone [FNW78, CCPV11], and also when the function may be non-monotone but non-negative [FMV11, LMNS09, FNS11]. In this paper we investigate how well we can solve this problem if the instance is not deterministically known up-front, but there is uncertainty in the input. Consider the following setting. We have a submodular function over a ground set of elements U. But the elements are not all active, and we can get value only for active elements. The bad news is that a priori we don't know the elements' status-whether it is active or not. The good news is that each element e is active independently with some known probability pe. We find out an element e's status only by probing it. Once we know its status, we can use this information to decide which other elements to probe next, and in what order. ∗Computer Science Department, Carnegie Mellon University, Pittsburgh, PA 15213, USA. Research partly supported by NSF awards CCF-1319811, CCF-1536002, CCF-1540541 and CCF-1617790. †Department of Industrial and Operations Engineering, University of Michigan, Ann Arbor, MI 48109, USA. 1 (I.e., be adaptive.) We have some constraints on which subsets we are allowed to probe. Eventually, we stop with some probed set S and a known subset active(S) of the active elements in S. At that time we can pick any T ⊆ active(S) and get value f (T ).1 What is a good strategy to probe elements to maximize expected value? Since this sounds quite abstract, here is an example. In the setting of influence maximization, the ground set is a set of email addresses (or Facebook accounts), and for a set S of email addresses f (S) is the fraction of the network that can be influenced by seeding the set S. But not all email addresses are still active. For each email address e, we know the probability pe that it is active. (Based, e.g., on when the last time we know it was used, or some other machine learning technique.) Now due to time constraints, or our anti-spam policies, or the fact that we are risk-averse and do not want to make introductory offers to too many people-we can only probe some K of these addresses, and make offers to the active ones in these K, to maximize our expected influence. Observe that it makes sense to be adaptive-if [email protected] happens to be active we may not want to probe [email protected], since we may believe they are the same person. A different example is robot path-planning. We have a robot that can travel at most distance D each day and is trying the maximize value by picking items. The elements are locations, and an element is active if the location has an item to be picked up. (Location e has an item with probability pe independent of all others.) Having probed S, if T is the subset of active locations, the value f (T ) is some submodular function of the set of elements-e.g., the number of distinct items. There are other examples: e.g., Bayesian mechanism design problems (see [GN13] for details) and stochastic set cover problems that arise in database applications [LPRY08, DHK14]. The question that is of primary interest to us is the following: Even though our model allows for adaptive queries, what is the benefit of this adaptivity? Note that there is price to adaptivity: the optimal adaptive strategy may be an exponentially-large decision tree that is difficult to store, and also may be computationally intractable to find. Moreover, in some cases the adaptive strategy would require us to be sequential (probe one email address, then probe the next, and so on), whereas a non-adaptive strategy may be just a set of K addresses that we can probe in parallel. So we want to bound the adaptivity gap: the ratio between the expected value of the best adaptive strategy and that of the best non-adaptive strategy. Secondly, if this adaptivity gap is small, we would like to find the best non-adaptive strategy efficiently (in polynomial time). This would give us our ideal result: a non-adaptive strategy that is within a small factor of the best adaptive strategy. The goal of this work is to get such results for as broad a class of functions, and as broad a class of probing constraints as possible. Recall that we were not allowed to probe all the elements, but only those which satisfied some problem-specific constraints (e.g., probe at most K email addresses, or probe a set of locations that can be reached using a path of length at most D.) 1.1 Our Results In this paper, we allow very general probing constraints: the sequence of elements we probe must satisfy a given prefix-closed constraint-e.g., these may be given by a matroid, or an orienteering constraint, or deadline, or precedence constraint, or an arbitrary downward-closed constraint-if we can probe some sequence of elements we can probe any prefix of it. We cannot hope to get small adaptivity gaps for arbitrary functions (see §B for a monotone 0 − 1 function where the gap is exponential in n even for cardinality constraint), and hence we have to look at interesting sub-classes of functions. Submodular Functions. Our first set of results are for the case where the function f is a non-negative submodular function. The first result is for monotone functions. 1If the function is monotone, clearly we should choose T = active(S). 2 Theorem 1.1 (Monotone Submodular). For any monotone non-negative submodular function f and any prefix- closed probing constraints, the stochastic probing problem has adaptivity gap at most 3. The previous results in this vein either severely restricted the function type (e.g., we knew a logarithmic gap for matroid rank functions [GNS16]) or the probing constraints (e.g., Asadpour et al. [AN16] give a gap of for matroid probing constraints). We discuss these and other prior works in §1.3. There is a lower bound of e−1 on the adaptivity gap for monotone submodular functions with prefix-closed probing constraints (in fact for the rank function of a partition matroid, with the constraint being a simple cardinality constraint). It remains an interesting open problem to close this gap. e−1 e e We then turn to non-monotone submodular functions, and again give a constant adaptivity gap. While the constant can be improved slightly, we have not tried to optimize it, focusing instead on clarity of exposition. Theorem 1.2 (Non-Monotone Submodular). For any non-negative submodular function f and any prefix- closed probing constraints, the stochastic probing problem has adaptivity gap at most 40. Both Theorems 1.1 and 1.2 just consider the adaptivity gap. What about the computational question of finding the best non-adaptive strategy? This is where the complexity of the prefix-closed constraints come in. The problem of finding the best non-adaptive strategy with respect to some prefix-closed probing constraint can be reduced to the problem of maximizing a submodular function with respect to the same constraints. XOS Functions. We next consider more general classes of functions. We conjecture that the adaptivity gap for all subadditive functions is poly-logarithmic in the size of the ground set. Since we know that any subadditive function can be approximated to within a logarithmic factor by an XOS (a.k.a. max-of-sums, or fractionally subadditive) function [Dob07], and every XOS function is subadditive, it suffices to focus on XOS functions. As a step towards our conjecture, we show a nearly-tight logarithmic adaptivity gap for monotone XOS functions of small "width", which we explain below. A monotone XOS function f : 2[n] → R≥0 is one that can be written as the maximum of linear functions: i.e., there are vectors ai ∈ Rn ≥0 for some i = 1 . . . W such that f (S) := maxi(cid:0)a⊺ i χS(cid:1) = maxi(cid:0)Pj∈S ai(j)(cid:1). We define the width of (the representation of) an XOS function as W , the number of linear functions in this representation. E.g., a width-1 XOS function is just a linear function. In general, even representing submodular functions in this XOS form requires an exponential width [BH11, BDF+12]. Theorem 1.3 (XOS Functions). For any monotone XOS function f of width W , and any prefix-closed prob- ing constraints, the adaptivity gap is O(log W ). Moreover, there are instances with W = Θ(n) where the adaptivity gap is Ω(cid:0) log W log log W(cid:1). In this case, we can also reduce the computation problem to linear maximization over the constraints. Theorem 1.4. Suppose we are given a width-W monotone XOS function f explicitly in the max-of-sums rep- resentation, and an oracle to maximize positive linear functions over some prefix-closed constraint. Then there exists an algorithm that runs in time poly(n, W ) and outputs a non-adaptive strategy that has expected value at least an Ω(log W )-fraction of the optimal adaptive strategy. 1.2 Our Techniques Before talking about our techniques, a word about previous approaches to bounding the adaptivity gap. Several works, starting with the work of Dean et al. [DGV08] have used geometric "relaxations" (e.g., a linear program 3 for linear functions [DGV08], or the multilinear extension for submodular settings [ANS08, ASW14]) to get an estimate of the value achieved by the optimal adaptive strategy. Then one tries to find a non-adaptive strategy whose expected value is not much less than this relaxation. This is particularly successful when the probing constraints are amenable to being captured by linear programs-e.g., matroid or knapsack constraints. Dealing with general constraints (which include orienteering constraints, where no good linear relaxations are known) means we cannot use this approach. The other approach is to argue about the optimal decision-tree directly. An induction on the tree was used, e.g., by Chen et al. [CIK+09] and Adamczyk [Ada11] to study stochastic matchings. A different approach is to use concentration bounds like Freedman's inequality to show that for most paths down the tree, the function on the path behaves like the path-mean-this was useful in [GKNR12], and also in our previous work on adaptivity gaps of matroid rank functions [GNS16]. However, this approach seems best suited to linear functions, and loses logarithmic factors due to the need for union bounds. Given that we prove a general result for any submodular function, how do we show a good non-adaptive strategy? Our approach is to take a random path down the tree (the randomness coming from the element activation probabilities) and to show the expected value of this path, when viewed as a non-adaptive strategy, to be good. To prove this, surprisingly, we use induction. It is surprising because the natural induction down the tree does not seem to work. So we perform a non-standard inductive argument, where we consider the all-no path (which we call the stem), show that a non-adaptive strategy would get value comparable to the decision tree on the stem, and then induct on the subtrees hanging off this stem. The proof for monotone functions, though basic, is subtle-requiring us to change representations and view things "right". This appears in §3. For non-monotone submodular functions, the matter is complicated by the fact that we cannot pick elements in an "online" fashion when going down the tree-greedy-like strategies are bad for non-monotone func- tions. Hence we pick elements only with some probability, and show this gives us a near-optimal solution. The argument is complicated by the fact that having picked some elements X, the marginal-value function fX(S) := f (X ∪ S) − f (X) may no longer be non-negative. Finally, for monotone XOS functions of small width, we use the approach based on Freedman's concentration inequality to show that a simple algorithm that either picks the set optimizing one of the linear functions, or a single element, is within an O(log W ) factor of the optimum. We then give a lower bound example showing an (almost-)logarithmic factor is necessary, at least for W = O(n). 1.3 Related Work The adaptivity gap of stochastic packing problems has seen much interest: e.g., for knapsack [DGV08, BGK11, Ma14], packing integer programs [DGV05, CIK+09, BGL+12], budgeted multi-armed bandits [GM07, GKMR11, LY13, Ma14] and orienteering [GM09, GKNR12, BN14]. All except the orienteering results rely on having relaxations that capture the constraints of the problem via linear constraints. For stochastic monotone submodular functions where the probing constraints are given by matroids, Asadpour et al. [AN16] bounded the adaptivity gap by e τ , where τ is the smallest probability of some set being materialized. (See also [LPRY08, DHK14].) e−1; Hellerstein et al. [HKL15] bound it by 1 The work of Chen et al. [CIK+09] (see also [Ada11, BGL+12, BCN+15, AGM15]) sought to maximize the size of a matching subject to b-matching constraints; this was motivated by applications to online dating and kidney exchange. More generally, see, e.g. [RS U05, AR12], for pointers to other work on kidney exchange problems. The work of [GN13] abstracted out the general problem of maximizing a function (in their case, the rank function of the intersection of matroids or knapsacks) subject to probing constraints (again, intersection of matroids and knapsacks). This was improved and generalized by Adamczyk, et al. [ASW14] to submodular objectives. All these results use LP relaxations, or non-linear geometric relaxations for the submodular settings. 4 The previous work of the authors [GNS16] gave results for the case where f was the rank function of matroids (or their intersections). That work bounded the adaptivity gap by logarithmic factors, and gave better results for special cases like uniform and partition matroids. This work both improves the quantitative bounds (down to small constants), generalizes it to all submodular functions with the hope of getting to all subadditive functions, and arguably also makes the proof simpler. 2 Preliminaries and Notation We denote the ground set by X, with n = X. Each element e ∈ X has an associated probability pe. Given a subset S ⊆ X and vector p = (p1, p2, . . . , pn), let S(p) denote the distribution over subsets of S obtained by picking each element e ∈ S independently with probability pe. (Specifying a single number p ∈ [0, 1] in S(p) indicates each element is chosen with probability pe = p.) A function f : 2X → R is • monotone if f (S) ≤ f (T ) for all S ⊆ T . • linear if there exist ai ∈ R for each i ∈ X such that f (S) =Pi∈S ai. • submodular if f (A ∪ B) + f (A ∩ B) ≤ f (A) + f (B) for all A, B ⊆ X. We will normally assume that f is non-negative and f (∅) = 0. • subadditive if f (A ∪ B) ≤ f (A) + f (B). A non-negative submodular function is clearly subadditive. • fractionally subadditive (or XOS) if f (T ) ≤Pi αif (Si) for all αi ≥ 0 and χT =Pi αiχSi. 2 An alternate characterization: a function is XOS if there exist linear functions a1, a2, . . . , aw : 2X → R such that f (X) = maxj{aj(X)}. The width of an XOS function is the smallest number W such that f can be written as the maximum over W linear functions. All objective functions f that we deal with are non-negative with f (∅) = 0. Given any function f : 2X → R, define f max(S) := maxT ⊆S f (T ) to be the maximum value subset contained within S. The function f is monotone if and only if f max = f . In general, f max may be difficult to compute given access to f . However, Feige et al. [FMV11] show that for submodular functions 1 4 f max(S) ≤ E R∼S( 1 2 )[f (R)] ≤ f max(S). (1) Also, for a subset S, define the "contracted" function fS(T ) := f (S ∪ T ) − f (S). Note that if f is non- monotone, then fS may be negative-valued even if f is not. Adaptive Strategies An adaptive strategy tree T is a a binary rooted tree where every internal node v rep- resents some element e ∈ X (denoted by elt(v) = e), and has two outgoing arcs-the yes arc indicating the node to go to if the element e = elt(v) is active (which happens with probability pe) when probed, and the no arc indicating the node to go to if e is not active (which happens with the remaining probability qe = 1 − pe). No element can be represented by two different nodes on any root-leaf path. Moreover, any root-leaf path in T should be feasible according to the constraints. Hence, each leaf ℓ in the tree T is associated with the root-path Pℓ: the elements probed on this path are denoted by elt(Pℓ). Let Aℓ denote the active elements on this path Pℓ-i.e., the elements represented by the nodes on Pℓ for which we took the yes arc. The tree T naturally gives us a probability distribution πT over its leaves: start at the root, at each node v, follow the yes branch with probability pelt(v) and the "no" branch otherwise, to end at a leaf. 2Our definitions of fractionally subadditive/XOS differ slightly from those in the literature, since we allow non-monotonicity in our functions. See §A for a discussion. 5 Given a submodular function f and a tree T , the associated adaptive strategy is to probe elements until we reach a leaf ℓ, and then to pick the max-value subset of the active elements on this path Pℓ. Let adap(T , f ) denote the expected value obtained this way; it can be written compactly as adap(T , f ) := Eℓ←πT [f max(Aℓ)]. (2) Definition 2.1 (stem of T ). For any adaptive strategy tree T the stem represents the all-no path in T starting at the root, i.e., when all the probed elements turn out inactive. Definition 2.2 (deepness of T ). The deepness of a strategy tree T is the maximum number of active nodes that adap sees along a root-leaf path of T . Note that this notion of deepness is not the same as that of depth used for trees: it measures the number of yes- arcs on the path from the root to the leaf, rather than just the number of arcs seen on the path. This definition is inspired by the induction we will do in the submodular sections. We can also define the natural non-adaptive algorithm given the tree T : just pick a leaf ℓ ← πT from the distribution given by T , probe all elements on that path, and choose the max-value subset of the active elements. We denote the expected value by alg(T , f ): alg(T , f ) := Eℓ←πT [E R∼X(p)[f max(R ∩ elt(Pℓ))]]. (3) 3 Monotone Non-Negative Submodular Functions We now prove Theorem 1.1, and bound the adaptivity gap for monotone submodular functions f over any prefix-closed set of constraints. The idea is a natural one in retrospect: we take an adaptive tree T , and show that the natural non-adaptive strategy (given by choosing a random root-leaf path down the tree, and probing the elements on that path) is within a factor of 3 of the adaptive tree. The proof is non-trivial, though. One strategy is to induct on the two children of the root (which, say, probes element e), but note that the adaptive and non-adaptive algorithms recurse having seen different sets of active elements.3 This forced previous results to proceed along different lines, using massive union bounds over the paths in the decision tree, and hence losing logarithmic factors. They were also restricted to matroid rank functions, instead of all submodular functions. A crucial insight in our proof is to focus on the stem of the tree (the all-no path off the root, see Definition 2.1), and induct on the subtrees hanging off this stem. Again we have issues of adaptive and non-adaptive recursing with different active elements, but we control this by giving the adaptive strategy some elements for free, and contracting some elements in the non-adaptive strategy without collecting value for them. The proof for non- monotone functions in §4 will be even more tricky, and will build on ideas from this monotone case. Formally, the main technical result is the following: Theorem 3.1. For any adaptive strategy tree T , and any monotone non-negative submodular function f : 2X → R≥0 with f (∅) = 0, alg(T , f ) ≥ adap(T , f ). 1 3 Theorem 1.1 follows by the observation that each root-leaf path in T satisfies the prefix-closed constraints, which gives us a feasible non-adaptive strategy. Some comments on the proof: because the function f is 3Adaptive sees e as active when it takes the yes branch (with probability pe), and nothing as active when taking the no branch. Non-adaptive recurses on the yes branch with the same probability pe because it picks a random path down the tree-but it then also probes e. So when it takes the yes branch, it has either seen e as active (with probability pe) or not (with probability 1 − pe). Hence the set of active elements on both sides are quite different. 6 monotone, f max = f . Plugging this into (2) and (3), we want to show that Eℓ←πT [E R∼X(p)[f (R ∩ elt(Pℓ))]] ≥ 1 3 Eℓ←πT [f (Aℓ)]. (4) Since both expressions take expectations over the random path, the proof proceeds by induction on the deepness of the tree. (Recall the definition of deepness in Definition 2.2.) We argue that for the stem starting at the root, alg gets a value close to adap in expectation (Lemma 3.3). However, to induct on the subtree that the algorithms leave the stem on, the problem is that the two algorithms may have picked up different active elements on the stem, and hence the "contracted" functions may look very different. The idea now is to give adap the elements picked by alg for "free" and disallow alg (just for the analysis) to pick elements picked by adap after exiting the stem. Now both the algorithms work after contracting the same set of elements in f , and we are able to proceed with the induction. 3.1 Proof of Theorem 3.1 Proof. We prove by induction on the deepness of the adaptive strategy tree T . For the base case of deepness 0, T contains exactly one node, and there are no internal nodes representing element. Hence both alg and adap get zero value, so the theorem is vacuously true. To prove the induction step, recall that the stem is the path in T obtained by starting at the root node and following the no arcs until we reach a leaf. (See Figure 1.) Let v1, v2, . . . , vℓ denote the nodes along the stem of T with v1 being the root and vℓ being a leaf; let ei = elt(vi). For i ≥ 1, let Ti denote the subtree hanging off the yes arc leaving vi. The probability that a path following the probability distribution πT enters Ti is pi Qj<i qj, where pi = 1 − qi denotes the probability that the ith element is active. no yes T1 T2 T3 T4 Figure 1: Adaptive strategy tree T . The thick line shows the all-no path. The arrows show the path taken by adap. In this example i = 4 and Si = {e1, e2, e3, e4}. Let Si = {e1, e2, . . . , ei} be the first i elements probed on the stem, and Ri ∼ Si(p) be a random subset of Si that contains each element e of Si independently w.p. pe. We can now rewrite adap and alg in a form more convenient for induction. Here we recall the definition of a marginal with respect to subset Y : fY (S) := f (Y ∪ S) − f (Y ). Note that the leaf vℓ has no associated element; to avoid special cases we define a dummy element eℓ with f ({eℓ}) = 0 and f{eℓ} = f . Claim 3.2. Let I be the r.v. denoting the index of the node at which a random walk according to πT leaves the stem. (If I = ℓ then the walk does not leave the stem, and Tℓ is a deepness-zero tree.) Then, adap(T , f ) = EI(cid:2)f (eI ) + adap(TI , f{eI })(cid:3) 7 (5) ≤ E algH (T ) = E ≥ E I,R∼SI (p)(cid:2)f (eI ) + f (R) + adap(TI, fR∪eI )(cid:3) I,R∼SI (p)(cid:2)f (R) + alg(TI , fR)(cid:3) I,R∼SI (p)(cid:2)f (R) + alg(TI , fR∪eI )(cid:3) Proof. Equation (5) follows from the definition of adap; (6) follows from the monotonicity of f . (We are giving the adaptive strategy elements in R "for free".) Equation (7) follows from the definition of alg, and (8) uses the consequence of submodularity that marginals can only decrease for larger sets. (cid:4) Observe the expressions in (6) and (8) are ideally suited to induction. Indeed, since the function fR∪eI also satisfies the assumptions of Theorem 3.1, and the height of Ti is smaller than that of T , we use induction hypothesis on Ti with monotone non-negative submodular function fR∪EI to get Finally, we use the following Lemma 3.3 to show that E I,R∼SI (p)(cid:2)alg(TI , fR∪eI )(cid:3) ≥ 1 3 E I,R∼SI (p)(cid:2)adap(TI , fR∪eI )(cid:3). Substituting these two into (6) and (8) finishes the induction step. E I,R∼SI (p)(cid:2)f (R)(cid:3) ≥ I,R∼SI (p)(cid:2)f (R) + f (eI )(cid:3). 1 3 E (cid:4) Lemma 3.3. Let I be the r.v. denoting the index of the node at which a random walk according to πT leaves the stem. (If I = ℓ then the walk does not leave the stem.) Then, Proof. For brevity, we use EI,R[·] as shorthand for E by showing that I,R∼SI (p)[·] in the rest of the proof. We prove this lemma E I,R∼SI (p)(cid:2)f (R)(cid:3) ≥ EI(cid:2)f (eI)(cid:3). 1 2 EI,R(cid:2)f (R)(cid:3) ≥ EI,R(cid:2) max ej ∈R f (ej)(cid:3) ≥ EI(cid:2)f (eI )(cid:3). 1 2 The first inequality uses monotonicity. The rest of the proof shows the latter inequality. For any real x ≥ 0, let Wx denote the indices of the elements ej on the stem with f (ej) ≥ x, and let W x denote the indices of stem elements not in Wx. Then, EI(cid:2)f (eI )(cid:3) =Z ∞ [I ∈ Wx] dx =Z ∞ where the last equality uses that the probability of exiting stem at i is pi Qj<i qj. [f (eI ) ≥ x] dx =Z ∞ On the other hand, we have Pr I Pr I 0 0 0 Xi∈Wx(cid:0)pi Yj<i (10) qj(cid:1) dx, (6) (7) (8) (9) (11) (12) ej ∈R Pr I,R EI,R(cid:2) max =Z ∞ 0 Xk∈Wx =Z ∞ 0 Xk∈Wx =Z ∞ 0 Xk∈Wx(cid:0)Yj<k Pr I f (ej)(cid:3) =Z ∞ 0 Pr I,R [max ej ∈R f (ej) ≥ x] dx =Z ∞ 0 Pr I,R [R ∩ Wx 6= ∅] dx [ek ∈ R and ej 6∈ R for all j < k with j ∈ Wx] dx I [I ≥ k] · Pr[ek active] · Pr qj(cid:1) · pk ·(cid:0) Yj<k & j∈Wx [ ej inactive for all j < k with j ∈ Wx ] dx qj(cid:1) dx = Z ∞ 0 Xk∈Wx(cid:0) Yj<k & j∈Wx q2 j(cid:1) ·(cid:0) Yj<k & j6∈Wx qj(cid:1) · pk dx. 8 Recall that R ∼ SI (p). Above (11) is because, for ek to be the first element in Wx ∩ R (i) the index I must go past k, (ii) ek must be active, and (iii) all elements before k on the stem with indices in Wx must be inactive (which are all independent events). Equation (12) is by definition of these probabilities. Renaming k to i, EI,R(cid:2) max ej ∈R f (ej)(cid:3) =Z ∞ 0 Xi∈Wx(cid:0)pi(cid:0) Yj<i & j∈Wx q2 j(cid:1)(cid:0) Yj<i & j6∈Wx qj(cid:1)(cid:1) dx. To complete the proof, we compare equations (10) and (13) and want to show that for every x, Xi∈Wx(cid:0)pi(cid:0) Yj<i & j∈Wx q2 j(cid:1)(cid:0) Yj<i & j6∈Wx qj(cid:1)(cid:1) ≥ 1 2 Xi∈Wx(cid:0)piYj<i qj(cid:1). (13) (14) While the expressions look complicated, things simplify considerably when we condition on the outcomes of elements outside Wx. Indeed, observe that the LHS of (14) equals E W x(cid:2) Xi∈Wx(cid:0)pi(cid:0) Yj<i & j∈Wx q2 j(cid:1)(cid:0) Yj<i & j6∈Wx 1qj(cid:1)(cid:1)(cid:3), (15) where 1qj is an independent indicator r.v. taking value 1 w.p. qj, and we take the expectation over coin tosses for elements of stem outside Wx. Similarly, the RHS of (14) is 1 2 Xi∈Wx(cid:0)piYj<i qj(cid:1) = E W x(cid:2) 1 2 Xi∈Wx(cid:0)pi(cid:0) Yj<i & j∈Wx qj(cid:1)(cid:0) Yj<i & j6∈Wx 1qj(cid:1)(cid:1)(cid:3). (16) Hence, after we condition on the elements outside Wx, the remaining expressions can be related using the following claim. Claim 3.4. For any ordered set A of probabilities {a1, a2, . . . , aA}, let bj denote 1− aj for j ∈ [1,A]. Then, Xi ai(cid:0)Yj<i bj(cid:1)2 ≥ 1 2Xi ai(cid:0)Yj<i bj(cid:1) Proof. Xi ai(cid:18)Yj<i bj(cid:19)2 i =Xi =(⋆) 1 1 ≥ b2 j(cid:19) 1 bj(cid:19)2 1 − b2 1 + bi(cid:18)Yj<i 2Xi ≥ 2(cid:0)1 −Yi 2(cid:0)1 −Yi i(cid:1) = bi(cid:1) =(⋆) 1 ai(cid:0)Yj<i 2Xi 2(cid:0)1 −Yi i )(cid:18)Yj<i (1 − b2 bi(cid:1)(cid:0)1 +Yi bi(cid:1) bj(cid:1), b2 1 where we have repeatedly used aj + bj = 1 for all j. The equalities marked (⋆) move between two ways of expressing the probability of at least one "heads" when the tails probability is b2 (cid:4) j and bj respectively. Applying the claim to the elements in Wx, in order of their distance from the root, completes the proof. (cid:4) 9 3.2 Lower Bounds Our analysis cannot be substantially improved, since Claim 3.4 is tight. Consider the setting with A being infinite for now, and ai = ε for all i. Then the LHS of Claim 3.4 is εPi(1 − ε)2(i−1) = 2 + O(ε), whereas the sum on the right is 1. Making A finite but large compared to 1 However, there is still hope that a smaller adaptivity gap can be proved using other techniques. The best lower bound on adaptivity gaps for monotone submodular functions we currently know is e−1. The function is the rank function of a partition matroid, where the universe has k parts (each with k2 elements) for a total of n = k3 elements. Each element has pe = 1 k . The probing constraint is a cardinality constraint that at most k2 elements can be probed. In this case the optimal adaptive strategy can get (1 − o(1))k value, whereas any non-adaptive strategy will arbitrarily close to (1 − 1 3.3 Finding Non-Adaptive Polices 1−(1−ε)2 ≈ 1 ε would give similar results. e )k in expectation. (See, e.g., [AN16, Section 3.1].) ε e A non-adaptive policy is given by a fixed sequence σ = he1, e2, . . . , eki of elements to probe (such that σ satisfies the given prefix-closed probing constraint. If A is the set of active elements, then the value we get is A∼X(p)[f max(A∩{e1, . . . , ek})] = EA[f (A∩{e1, . . . , ek})], the inequality holding for monotone functions. E A∼X(p)[f (X ∩ A)], g is also a monotone submodular function. Hence finding good If we define g(S) := E non-adaptive policies for f is just optimizing the monotone submodular function g over the allowed sequences. E.g., for the probing constraint being a matroid constraint, we can get a e e−1-approximation [CCPV11]; for it being an orienteering constraint we can get an O(log n)-approximation in quasi-polynomial time [CP05]. For non-monotone functions (discussed in the next section), we can approximate the f max(S) function by 2 )[f (S ∩ R)], and losing a factor of 4, reduce finding good non-adaptive strategies to (non-monotone) ER∼X( 1 submodular optimization over the probing constraints. 4 Non-Monotone Non-Negative Submodular Functions We now prove Theorem 1.2. The proof for the monotone case used monotonicity in several places, but perhaps the most important place was to claim that going down the tree, both adap and alg could add all active elements to the set. This "online" feature seemed crucial to the proof. In contrast, when the adaptive strategy adap reaches a leaf in the non-monotone setting, it chooses the best subset within the active elements; a similar choice is done by the non-adaptive algorithm. This is why we have f max(Aℓ) in (2) versus f (Aℓ) in (4). Fortunately, Feige el al. [FMV11] show that for non-negative non-monotone submodular functions, the simple strategy of picking every active element independently w.p. half gives us a near-optimal possible subset. Losing a factor of four, this result allows us to analyze the performance relative to an adaptive online algorithm adapon which selects (with probability 1 2) each probed element that happens to be active. The rest of the proof is similar (at a high level) to the monotone case: to relate adapon and alg we bound them using comparable terms (adap and alg in Definition 4.1) and apply induction. Altogether we will obtain: alg (Lemma 4.2(ii)) ≥ alg (Lemma 4.4) ≥ 1 5 · adap (Lemma 4.2(i)) ≥ 1 10 · adapon (1) ≥ 1 40 · adap. In the inductive proof, we will work with "contracted" submodular functions g obtained from f , which may take negative values but have g(∅) = 0. In order to deal with such issues, the induction here is more complex than in the monotone case. We first define the surrogates adap and alg for adap and alg recursively as follows. Definition 4.1. For any strategy tree T and submodular function g with g(∅) = 0, let 10 • I be the node at which a random walk according to πT exits the stem. • R ∼ SI (p) where SI denotes the elements on the stem until node I. • J = arg max{g(e) e ∈ R, g(e) > 0} w.p. 1 2 and J = ⊥ w.p. 1 2 . Then we define: and alg(T , g) := EI,J(cid:2)g(J) + alg(TI , gI∪J )(cid:3) . adap(T , g) := EI,J(cid:2)g(I) + g(J) + adap(TI, gI∪J )(cid:3) Above we account for the non-monotonicity of the function, via this process of random sampling used in the definition of adap and alg. One problem with following the proof from §3 is that when we induct on the "contracted" function fS for some set S, this function may not be non-negative any more. Instead, our proof considers the entire path down the tree and argues about it at one shot; to make the analysis easier we imagine that the non-adaptive algorithm picks at most one item from the stem, i.e., the one with the highest marginal value. Lemma 4.2. For any strategy tree T , the following hold: 2 adapon(T , f ). (i) For any non-negative submodular function f , adap(T , f ) ≥ 1 (ii) For any submodular function g, alg(T , g) ≥ alg(T , g). We make use of the following property of submodular functions. Lemma 4.3 ([BFNS14], Lemma 2.2). For any non-negative submodular function h : 2A → R≥0 (possibly with h(∅) 6= 0) let S ⊆ A be a random subset that contains each element of A with probability at most p (and not necessarily independently). Then, ES[f (S)] ≥ (1 − p) · f (∅). Proof of Lemma 4.2. We condition on a random leaf ℓ drawn according to πT . Let I1, . . . , Id denote the se- quence of nodes that correspond to active elements on the path Pℓ, i.e., I1 is the point where Pℓ exits the stem of T , I2 is the point where Pℓ exits the stem of TI1 etc. Then, the adaptive online value is exactly f ({I1, . . . Id). For any k = 1, . . . , d let Pℓ[Ik−1, Ik] denote the elements on path Pℓ between Ik−1 and Ik. Also let R denote the random subset where each element e on path Pℓ is chosen independently w.p. pe. For k = 1, . . . , d, define Jk as follows: Jk = arg max{fLk−1(e) e ∈ R ∩ ℓ[Ik−1, Ik], fLk−1(e) > 0} w.p. 1 2 and Jk = ⊥ w.p. 1 2 , where Lk−1 := {I1, . . . , Ik−1} ∪ {J1, . . . , Jk−1}. In words, the sets L contain the exit points from the stems, and for each stem also the element with maximum marginal value (if any) with probability half. For (i), by Definition 4.1, the value of adap(T , f ) conditioned on path Pℓ and elements J1, . . . , Jd is d Xk=1 fLk−1(Ik) + fLk−1(Jk) ≥ d Xk=1 fLk−1({Ik, Jk}) = f ({I1, J1, . . . Id, Jd}). (17) The inequality follows from the following two cases: • If Ik 6= Jk, then by submodularity of fLk−1, fLk−1(Ik) + fLk−1(Jk) ≥ fLk−1({Ik, Jk}) + fLk−1(∅) = fLk−1({Ik, Jk}). 11 • If Ik = Jk, then by choice of Jk we have fLk−1(Jk) > 0 and fLk−1(Ik) + fLk−1(Jk) = 2 · fLk−1(Jk) > fLk−1(Jk). Using (17) and taking expectation over the Js, adap(T , f ) conditioned on path Pℓ is at least EJ1,...Jd [f ({I1, J1, . . . Id, Jd})] ≥ 1 2 · f ({I1, . . . Id}). Above we used Lemma 4.3 on the non-negative submodular function h(S) := f (S ∪ {I1, . . . , Id}), using the fact that the set {J1, . . . , Jd} contains each element with probability at most half. Finally, deconditioning over ℓ (i.e., over I1, . . . Id) proves part (i). For part (ii), by Definition 4.1, the value of alg(T , g) conditioned on path Pℓ and elements J1, . . . , Jd is d d gLk−1(Jk) ≤ gJ1,...Jk−1(Jk) = g({J1, . . . , Jd}), Xk=1 Xk=1 where the inequality is by submodularity of g. Since alg chooses the maximum value subset in R and {J1, . . . , Jd} ⊆ R, taking expectations over ℓ and R, we prove part (ii). (cid:4) Lemma 4.4. For any strategy tree T and submodular function g with g(∅) = 0, alg(T , g) ≥ 1 5 · adap(T , g). Proof. We proceed by induction. Recall the notation in Definition 4.1. For each node i on the stem of T define ai := max{g(i), 0}. Note that g(J) = aJ by choice of J: if J 6= ⊥ we have g(J) > 0 and if J = ⊥, g(J) = g(∅) = 0 = aJ . We will show that EI,J [aI ] ≤ 4 · EI,J [aJ ]. (18) Then the definition of adap(T , g) and alg(T , g), and induction on TI and gI∪J , would prove the lemma. Let K = arg max{ae e ∈ R} be the r.v. denoting the maximum weight active (i.e., in R) element on the stem. Then, by definition of J, we have EI,J[aJ ] = 1 EI,K[aK]. Finally we can use Lemma 3.3 from Section 3 2 to obtain EI,K[aK ] ≥ 1 EI,J[aI ], which proves (18). (cid:4) 5 Monotone XOS Functions 2 In this section we study adaptivity gaps for monotone non-negative XOS functions. To recall, a function is monotone XOS if there exist linear functions a1, a2, . . . , aW : X → R+ such that f (S) = maxW i=1{Pe∈S ai(e)}. To simplify notation we use ai(S) :=Pe∈S ai(e) for any i and subset S ⊆ X. The width of an XOS function is the smallest number W such that f can be written as the maximum over W linear functions. Let T ∗ denote the optimal adaptive strategy. By monotonicity f max = f and (2) gives adap(T ∗, f ) = Eℓ←πT ∗ [f (Aℓ)]. The following is our main result in this section. Theorem 5.1. The stochastic probing problem for monotone XOS functions of width W has adaptivity gap O(log W ) for any prefix-closed constraints. Moreover, there are instances with W = O(n) and adaptivity gap Ω( log W log log W ). In §5.2, we also present an efficient non-adaptive algorithm for XOS functions of width W that makes O(W + log n) calls to the following linear oracle. Definition 5.2 (Oracle O). Given a prefix-closed constraint family F and linear function a : X → R+, oracle O(F, a) returns a set S ∈ F that maximizesPe∈S a(e). 12 5.1 Adaptivity Gap Upper Bound We first state a useful property that is used critically later. Assumption 5.3 (Subtree property). For any node u in the optimal adaptive strategy tree T ∗, if we consider the subtree T ′ rooted at u then the expected value of T ′ is at most that of T ∗: adap(T ′, f ) ≤ adap(T ∗, f ), when T ′ is a subtree of T ∗. This is because otherwise a better strategy would be to go directly to u (probing all the element along the way, so that we satisfy the prefix-closed constraint, but ignore these elements), and then to run strategy T ′. Proof Idea. The proof consists of three steps. In the first step we argue that one can assume that every coefficient in every linear function ai is smaller than O( adap(T ∗,f ) log W ) (else there is a simple non-adaptive strategy that is comparable to the adaptive value obtained from a single active item). The second step shows that by losing a constant factor, one can truncate the tree T ∗ to obtain tree T , where the instantiated value at each leaf is at most 2·adap(T ∗, f ). The combined benefit of these steps is to ensure that root-leaf paths have neither high variance nor too large a value. In the third step, we use Freedman's concentration inequality (which requires the above properties of T ) to argue that for any linear function ai, the instantiated value on a random root-leaf path is close to its mean with high probability. Taking union bound over the W linear functions, we can then show that (again with high probability), no linear function has an instantiation much more than its mean. Hence, for a random root-leaf path, adap gets value (the maximum instantiation over linear functions) that is not much more than the corresponding mean, which is a lower bound on the non-adaptive value. Below we use OPT = adap(T ∗, f ) to denote the optimal adaptive value. Small and large elements. Define λ := 103 log W . An element e ∈ X is called large if maxW i=1 ai(e) ≥ h := OPT λ ; it is called small otherwise. Let L be the set of large elements, and let OPTl (resp., OPTs) denote the value obtained by tree T ∗ from large (resp., small) elements. By subadditivity, we have OPTl +OPTs ≥ OPT. Lemma 5.4 shows that that when OPTl ≥ OPT/2, a simple non-adaptive strategy proves that the adaptivity gap is O(log W ). Then Lemma 5.5 shows that when OPTs ≥ OPT/2, the adaptivity gap is O(1). Choosing between the two by flipping an unbiased coin gives a non-adaptive strategy that proves the adaptivity gap is O(log W ). This would prove the first part of Theorem 5.1. Lemma 5.4. Assuming that OPTl ≥ OPT/2, there is a non-adaptive solution of value Ω(1/ log W ) · OPT. Moreover, there is a solution S satisfying the probing constraint with h · min{Pe∈S∩L pe, 1} ≥ OPT Proof. We restrict the optimal tree T ∗ to the large elements. So each node in T ∗ either contains a large element, or corresponds to making a random choice (and adds no value). The expected value of this restricted tree is ∗ as follows. Consider the first active node u on any root-leaf path, OPTl. We now truncate T ∗ to obtain tree T remove the subtree below the yes (active) arc from u, and assign exactly a value of h to this instantiation. The subtree property (Assumption 5.3) implies that the expected value in this subtree below u is at most OPT. On the other hand, just before the truncation at u, the adaptive strategy gains value of h = OPT since it observed λ 1+λ · OPTl. an active large element at node u. By taking expectations, we obtain that the value of T ∗ is a feasible solution to the stochastic probing instance Note that T with the probing constraint F and a different objective g(R) = h · min{R ∩ L, 1} which is the rank function of the uniform-matroid of rank 1 (scaled by h) over all large elements. As any matroid rank function is a monotone submodular function, Theorem 1.1 implies that there is a non-adaptive strategy which probes a 1+λ . Note that feasible sequence of elements S ∈ F, having value E ∗ is a simpler adaptive strategy. In fact T R∼S(p)[g(R)] ≥ 1 , g) ≥ 1 3 · OPTl ∗ is at least 1 O(log W ). ∗ 3 · adap(T 13 for any subset R ⊆ L of large elements f (R) ≥ maxe∈R{maxW inequality is by monotonicity of f and the second is by definition of large elements. So we have: i=1 ai(e)} ≥ h · min{R, 1} = g(R); the first E R∼S(p)[f (R)] ≥ E R∼S(p)[g(R)] = Ω(1/ log W ) · OPTl. It follows that S is the claimed non-adaptive solution for the original instance with objective f . We now show the second part of the lemma using the above solution S. Note that OPT O(log W ) = E R∼S(p)[g(R)] = h · E R∼S(p)[1(R ∩ L 6= ∅)] ≤ h · min( Xe∈S∩L pe, 1) , as desired. (cid:4) In the rest of this section we prove the following, which implies an O(log W ) adaptivity gap. Lemma 5.5. Assuming that OPTs ≥ OPT/2, there is a non-adaptive solution of value Ω(1) · OPT. Proof. We start with the restriction of the optimal tree T ∗ to the small elements; recall that OPTs is the expected value of this restricted tree. The next step is to truncate tree T ∗ to yet another tree T with further useful properties. For any root-leaf path in T ∗ drop the subtree below the first node u (including u) where f (Au) > 2 · OPT; here Au denotes the set of active elements on the path from the root to u. The subtree property (Assumption 5.3) implies that the expected value in the subtree below u is at most OPT. On the other hand, before the truncation at u, the adaptive value obtained is more that 2 · OPT. Hence, the expected value of T ∗ obtained at or above the truncated nodes is at least 2 3 · OPTs. Finally, since all elements are small and thus the expected value from any truncated node itself is at most h ≤ 0.01 · OPT, the tree T has at least 3 − 0.01)OPTs ≥ 1 ( 2 2 OPTs value. This implies the next claim: Claim 5.6. Tree T has expected value at least 1 i=1{ai(Pℓ)} ≤ 2· OPT. Next, we want to claim that each linear function behaves like its expectation (with high probability) on a random path down the tree. For any i ∈ [W ] and root-leaf path Pℓ in T , define 4 · OPT and maxℓ∈T maxW 2 · OPTs ≥ 1 µi(Pℓ) := E R∼X(p)[ai(R ∩ Pℓ)] = Xv∈Pℓ(cid:0)pelt(v) · ai(elt(v))(cid:1) . Claim 5.7. For any i ∈ [W ], Pr ℓ←πT [ai(Aℓ) − µi(Pℓ) > 0.1 OPT] ≤ 1 W 2 . (19) Proof. Our main tool in this proof is the following concentration inequality for martingales. Theorem 5.8 (Freedman, Theorem 1.6 in [Fre75]). Consider a real-valued martingale sequence {Xt}t≥0 such that X0 = 0, and E [Xt+1 Xt, Xt−1, . . . , X0] = 0 for all t. Assume that the sequence is uniformly bounded, i.e., Xt ≤ M almost surely for all t. Now define the predictable quadratic variation process of the martingale Xj−1, Xj−2, . . . , X0i for all t ≥ 1. Then for all ℓ ≥ 0 and σ2 > 0, and any to be Wt = Pt Xj(cid:12)(cid:12) ≥ ℓ and Wτ ≤ σ2  ≤ 2 exp(cid:18)− EhX 2 Pr (cid:12)(cid:12) stopping time τ we have ℓ2/2 σ2 + M ℓ/3(cid:19) . τ Xj=0 j=0 j 14 Consider a random root-leaf path Pℓ = hr = v0, v1, . . . , vτ = ℓi in T , and let et = elt(vt). Now define a sequence of random variables X0, X1, . . . , where Let Ht be a filter denoting the sequence of variables before Xt. Observe that E[Xt Ht] = 0, which implies {Xt} forms a martingale. Clearly Xt ≤ ai(et) ≤ h. Now, Xt = (1(et ∈ A) − pet) · ai(et). t Xj=0 E [Xj Hj] ≤ ≤ t Xj=0 Xj=0 1 2 t (pet(1 − pet) + (1 − pet)pet) · ai(et) ai(et) ≤ 1 2 · max ℓ W max i=1 ai(Pℓ) ≤ OPT, where the last inequality is by Claim 5.6. We use Xj ≤ h = OPT variance, λ and the above equation to bound the Applying Theorem 5.8, we get t j Xj=0 E(cid:2)X 2 Xj(cid:12)(cid:12) > 0.1 OPT Pr (cid:12)(cid:12) τ Xj=0 Hj(cid:3) ≤ h · E [Xj Hj] ≤ OPT2 λ . t Xj=0  = Pr[ai(Aℓ) − µi(Pℓ) > 0.1 OPT] ≤ 2 exp(cid:18)− 1 ≤ W 2 . (0.1 OPT)2/2 OPT2/(λ) + (OPT/(λ)) · (0.1 OPT)/3(cid:19) This completes the proof of Claim 5.7. Now we can finish the proof of Lemma 5.5. We label every leaf ℓ in T according to the linear function ai that achieves the value f (Aℓ), breaking ties arbitrarily. I.e., for leaf ℓ we define (cid:4) Also define µmax ℓ := µi for i as above. Using Claim 5.7 and taking a union bound over all i ∈ [W ], cmax ℓ := ai, where ai(Aℓ) = f (Aℓ). Pr ℓ←πT (cid:20)(cid:12)(cid:12)cmax ℓ (Aℓ) − µmax ℓ (Pℓ)(cid:12)(cid:12) > 0.1 OPT(cid:21) ≤ 1 W . (20) Consider the natural non-adaptive solution which selects ℓ ← πT and probes all elements in Pℓ. This has expected value at least: (20) 1 W (Claim 5.6) 2 W ℓ (Pℓ)] ≥ Eℓ←πT [cmax Eℓ←πT [µmax ) · OPT. If W ≥ 20 then we obtain the desired non-adaptive strategy. The remaining case of W < 20 is trivial: the adaptivity gap is 1 for a single linear function, and taking the best non-adaptive solution among the W possibilities has value at least 1 (cid:4) (Aℓ)] − 0.1 OPT − (0.15 − W · OPT. This completes the proof of Lemma 5.5. (2 OPT) ≥ ℓ Let us record an observation that will be useful for the non-adaptive algorithm. Remark 1. Observe that the above proof shows that when OPTs ≥ OPT/2, there exists a path Q in T ∗ (i.e. Q satisfies the probing constraints) and a linear function aj with mean value E R∼Q(p)[aj(R)] = Ω(OPT). 15 5.2 Polynomial Time Non-adaptive Algorithm Consider any instance of the stochastic probing problem with a width-W monotone XOS objective and prefix- closed constraint F. Our non-adaptive algorithm is the following (here λ = 103 log W is as in §5.1). Algorithm 5.1 Non-adaptive Algorithm for XOS functions 1: define m := maxe∈X{pe · maxi∈[W ] ai(e)} 2: for j ∈ {0, . . . , 1 + log n} do λ and bj(e) = 0 otherwise. 3: define bj with bj(e) = pe if maxi∈[W ]{ai(e)} ≥ 2j m Tj ← O(F, bj ) and v(Tj) ← 2j m λ · min{bj(Tj), 1}. 4: 5: end for 6: for i ∈ {1, . . . , W} do define ci with ci(e) = pe · ai(e) Si ← O(F, ci) and v(Si) ← ci(Si). 7: 8: 9: end for 10: return set S ∈ {S1, . . . , SW , T0, T1, . . . , T1+log n} that maximizes v(S). Case I: OPTl ≥ OPT/2. Lemma 5.4 shows that in this case it suffices to consider only the set of large elements and to maximize the probability of selecting a single large element. While we do not know OPT, and the large elements are defined in terms of OPT, we do know m = maxe∈X{pe · maxi∈[W ] ai(e)} ≤ OPT ≤ n· m. In the above algorithm, consider the value of j ∈ {0, . . . , 1 + log n} when 2j · m/λ is between h and 2h. Let L denote the set of large elements; note that these correspond to the elements with positive bj(e) values. By the second part of Lemma 5.4, the solution Tj returned by the oracle will satisfy v(Tj) ≥ OPT/O(log W ). Now interpreting this solution Tj as a non-adaptive solution, we get an expected value at least: R∼Tj (p)[1(R ∩ L 6= ∅)] = h ·(cid:0)1 − Πe∈Tj (1 − bj(e))(cid:1) ≥ h ·(cid:16)1 − e−bj (Tj )(cid:17) h · E ≥ (1 − 1/e)h · min{bj(Tj), 1} = (1 − 1/e) · v(Tj) ≥ O(log W ) OPT Case II: OPTs ≥ OPT/2. In this case Remark 1 following the proof of Lemma 5.5 shows that there ex- ists a solution Q satisfying the probing constraints F and a linear function aj with mean value cj(Q) = R∼Q(p)[aj(R)] = Ω(OPT). Since the above algorithm calls O(F, ci) for each i ∈ [W ] and chooses the best E one, it will return a set with value Ω(OPT). 5.3 Adaptivity Gap Lower Bound Consider a k-ary tree of depth k, whose edges are the ground set. Each edge/element has probability pe = 1 k . Here, imagine k = Θ( log n i=1 ki = n. For each of the kk leaves l, consider the path Pl from the root to that leaf. The XOS function is f (S) := maxl Pl ∩ S. Note that the width W = Θ(n) in this case. Suppose the probing constraint is the following prefix-closed constraint: there exists a root-leaf path Pl such that all probed edges have at least one endpoint on this path. This implies that we can probe at most k2 edges. log log n ), so that the total number of edges isPk • For an adaptive strategy, probe the k edges incident to the root. If any one of these happens to be active, start probing the k edges at the next level below that edge. (If none were active, start probing the edges below the left-most child, say.) Each level will have at least one active edge with probability 1 − (1 − 1 k )k ≥ 1 − 1/e, so we will get an expected value of Ω(k). 16 • Now consider any non-adaptive strategy: it is specified by the path Pl whose vertices hit every edge that is probed. There are k2 such edges, we can probe all of them. But the XOS function can get at most 1 from an edge not on Pl, and it will get at most k · 1/k = 1 in expectation from the edges on Pl. This shows a gap of Ω(k) = Ω( log n constraint. log log n ) for XOS functions with a prefix-closed (in fact subset-closed) probing 5.3.1 A Lower Bound for Cardinality Constraints We can show a near-logarithmic lower bound for XOS functions even for the most simple cardinality con- straints. The setup is the same as above, just the constraint is that a subset of at most k2 edges can be probed. • The adaptive strategy remains the same, with expected value Ω(k). • We claim that any non-adaptive strategy gets expected value O(log k). Such a non-adaptive strategy can fix any set S of k2 edges to probe. For each of these edges, choose an arbitrary root-leaf path passing through it, let T be the edges lying in these k2 many root-leaf paths of length k. So T ≤ k3. Let us even allow the strategy to probe all the edges in T -clearly this is an upper bound on the non-adaptive value. The main claim is that the expected value to be maximized when T consists of k2 many disjoint paths. (The k-ary tree does not have these many disjoint paths, but this is just a thought-experiment.) The claim follows from an inductive application of the following simple fact. Fact 5.9. Given independent non negative random variables X, X ′, Y, Z, where X ′ and X have the same distribution, the following holds: EX,Y,Z[max{X + Y, X + Z}] ≤ EX,X ′,Y,Z[max{X + Y, X ′ + Z}]. Proof. Follows from the fact that {max{X + Y, X + Z} > c} ⊆ {max{X + Y, X ′ + Z} > c}. Finally, for any path with k edges, we expect to get value 1 in expectation. The probability that any one path gives value c log k is 1 k3 , for suitable constant c. So a union bound implies that the maximum value over k2 path is at most c log k with probability 1/k. Finally, the XOS function can take on value at most k, so the expected value is at most 1 + c log k. (cid:4) This shows an adaptivity gap of Ω( k log k ) = Ω( log n (log log n)2 ) even for cardinality constraints. 6 Conclusions In this paper we saw that submodular functions, both monotone and non-monotone, have a constant adaptivity gap, with respect to all prefix-closed probing constraints. Moreover, for monotone XOS functions of width W , the adaptivity gap is O(log W ), and there are nearly-matching lower bounds for all W = O(n). The most obvious open question is whether for all XOS functions, the adaptivity gap is O(logc n) for some constant c ≥ 1. This would immediately imply an analogous result for all subadditive functions as well. (In §A we show that it suffices to bound the adaptivity gap for monotone XOS and subadditive functions.) Other questions include: can we get better bounds for special submodular functions of interest? E.g., for matroid rank functions, can we improve the bound of 3 from Theorem 1.1. We can improve the constants of 40 for the non-monotone case with more complicated analyses, but getting (near)-tight results will require not losing the factor of 4 from (1), and may require a new insight. Or can we do better for special prefix- closed constraints. Our emphasis was to give the most general result we could, but it should be possible to do quantitatively better for special cases of interest. 17 References [Ada11] Marek Adamczyk. Improved analysis of the greedy algorithm for stochastic matching. Inf. Process. Lett., 111(15):731–737, 2011. 1.2, 1.3 [AGM15] Marek Adamczyk, Fabrizio Grandoni, and Joydeep Mukherjee. Improved approximation algorithms for stochastic matching. CoRR, abs/1505.01439, 2015. 1.3 [AN16] Nazerzadeh. Asadpour submodular Arash tone http://www-bcf.usc.edu/nazerzad/pdf/stochastic_submodular.pdf. 3.2, 6 Maximizing 2016. Management Science, Hamid and functions. stochastic to mono- appear. 1.1, 1.3, [ANS08] Arash Asadpour, Hamid Nazerzadeh, and Amin Saberi. Stochastic submodular maximization. In Interna- tional Workshop on Internet and Network Economics, pages 477–489. Springer, 2008. Full version appears as [AN16]. 1.2 [AR12] Itai Ashlagi and Alvin E. Roth. New challenges in multihospital kidney exchange. American Economic Review, 102(3):354–59, 2012. 1.3 [ASW14] Marek Adamczyk, Maxim Sviridenko, and Justin Ward. Submodular stochastic probing on matroids. In STACS, pages 29–40, 2014. 1.2, 1.3 [BCN+15] Alok Baveja, Amit Chavan, Andrei Nikiforov, Aravind Srinivasan, and Pan Xu. Improved bounds in stochas- tic matching and optimization. In APPROX, pages 124–134, 2015. 1.3 [BDF+12] Ashwinkumar Badanidiyuru, Shahar Dobzinski, Hu Fu, Robert Kleinberg, Noam Nisan, and Tim Roughgar- den. Sketching valuation functions. In Proceedings of the twenty-third annual ACM-SIAM symposium on Discrete Algorithms, pages 1025–1035. SIAM, 2012. 1.1 [BFNS14] Niv Buchbinder, Moran Feldman, Joseph Seffi Naor, and Roy Schwartz. Submodular maximization with cardinality constraints. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Al- gorithms, pages 1433–1452. SIAM, 2014. 4.3 [BGK11] Anand Bhalgat, Ashish Goel, and Sanjeev Khanna. Improved approximation results for stochastic knapsack problems. In SODA, pages 1647–1665, 2011. 1.3 [BGL+12] Nikhil Bansal, Anupam Gupta, Jian Li, Juli´an Mestre, Viswanath Nagarajan, and Atri Rudra. When LP Is the Cure for Your Matching Woes: Improved Bounds for Stochastic Matchings. Algorithmica, 63(4):733–762, 2012. 1.3 [BH11] [BN14] Maria-Florina Balcan and Nicholas JA Harvey. Learning submodular functions. forty-third annual ACM symposium on Theory of computing, pages 793–802. ACM, 2011. 1.1 In Proceedings of the Nikhil Bansal and Viswanath Nagarajan. On the adaptivity gap of stochastic orienteering. In IPCO, pages 114–125, 2014. 1.3 [CCPV11] Gruia Calinescu, Chandra Chekuri, Martin P´al, and Jan Vondr´ak. Maximizing a monotone submodular function subject to a matroid constraint. SIAM J. Comput., 40(6):1740–1766, 2011. 1, 3.3 [CIK+09] Ning Chen, Nicole Immorlica, Anna R. Karlin, Mohammad Mahdian, and Atri Rudra. Approximating Matches Made in Heaven. In ICALP (1), pages 266–278, 2009. 1.2, 1.3 [CP05] [DGV05] [DGV08] Chandra Chekuri and Martin P´al. A recursive greedy algorithm for walks in directed graphs. In FOCS, pages 245–253, 2005. 3.3 Brian C. Dean, Michel X. Goemans, and Jan Vondr´ak. Adaptivity and approximation for stochastic packing problems. In SODA, pages 395–404, 2005. 1.3 Brian C. Dean, Michel X. Goemans, and Jan Vondr´ak. Approximating the stochastic knapsack problem: the benefit of adaptivity. Math. Oper. Res., 33(4):945–964, 2008. 1.2, 1.3 18 [DHK14] Amol Deshpande, Lisa Hellerstein, and Devorah Kletenik. Approximation algorithms for stochastic boolean function evaluation and stochastic submodular set cover. In Proceedings of the Twenty-Fifth Annual ACM- SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, pages 1453–1466, 2014. 1, 1.3 [Dob07] Shahar Dobzinski. Two randomized mechanisms for combinatorial auctions. In Approximation, Randomiza- tion, and Combinatorial Optimization. Algorithms and Techniques, 10th International Workshop, APPROX 2007, and 11th International Workshop, RANDOM 2007, Princeton, NJ, USA, August 20-22, 2007, Pro- ceedings, pages 89–103, 2007. 1.1 [Fei09] Uriel Feige. On maximizing welfare when utility functions are subadditive. SIAM Journal on Computing, 39(1):122–142, 2009. A [FMV11] Uriel Feige, Vahab S Mirrokni, and Jan Vondr´ak. Maximizing non-monotone submodular functions. SIAM Journal on Computing, 40(4):1133–1153, 2011. 1, 2, 4 [FNS11] Moran Feldman, Joseph Naor, and Roy Schwartz. A unified continuous greedy algorithm for submodular maximization. In Foundations of Computer Science (FOCS), 2011 IEEE 52nd Annual Symposium on, pages 570–579. IEEE, 2011. 1 [FNW78] M.L. Fisher, G.L. Nemhauser, and L.A. Wolsey. An analysis of approximations for maximizing submodular set functions II. Mathematical Programming Study, 8:73–87, 1978. 1 [Fre75] David A. Freedman. On tail probabilities for martingales. Annals of Probability, 3:100–118, 1975. 5.8 [GKMR11] Anupam Gupta, Ravishankar Krishnaswamy, Marco Molinaro, and R. Ravi. Approximation algorithms for correlated knapsacks and non-martingale bandits. In FOCS, pages 827–836, 2011. 1.3 [GKNR12] Anupam Gupta, Ravishankar Krishnaswamy, Viswanath Nagarajan, and R. Ravi. Approximation algorithms for stochastic orienteering. In SODA, 2012. 1.2, 1.3 [GM07] [GM09] [GN13] [GNS16] [HKL15] [KKT15] [Kra13] Sudipto Guha and Kamesh Munagala. Approximation algorithms for budgeted learning problems. In STOC, pages 104–113. 2007. Full version as: Approximation Algorithms for Bayesian Multi-Armed Bandit Prob- lems, http://arxiv.org/abs/1306.3525. 1.3 Sudipto Guha and Kamesh Munagala. Multi-armed bandits with metric switching costs. In ICALP, pages 496–507, 2009. 1.3 Anupam Gupta and Viswanath Nagarajan. A stochastic probing problem with applications. In IPCO, pages 205–216, 2013. 1, 1.3 Anupam Gupta, Viswanath Nagarajan, and Sahil Singla. Algorithms and adaptivity gaps for stochastic probing. In Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1731–1747. SIAM, 2016. 1.1, 1.2, 1.3 Lisa Hellerstein, Devorah Kletenik, and Patrick Lin. Discrete stochastic submodular maximization: Adaptive vs. non-adaptive vs. offline. In Algorithms and Complexity - 9th International Conference, CIAC 2015, Paris, France, May 20-22, 2015. Proceedings, pages 235–248, 2015. 1.3 David Kempe, Jon Kleinberg, and ´Eva Tardos. Maximizing the spread of influence through a social network. Theory of Computing, 11(4):105–147, 2015. 1 Andreas Krause. Submodularity in machine learning and vision. In British Machine Vision Conference, BMVC 2013, Bristol, UK, September 9-13, 2013, 2013. 1 [LMNS09] Jon Lee, Vahab S Mirrokni, Viswanath Nagarajan, and Maxim Sviridenko. Non-monotone submodular max- imization under matroid and knapsack constraints. In Proceedings of the forty-first annual ACM symposium on Theory of computing, pages 323–332. ACM, 2009. 1 [LPRY08] Zhen Liu, Srinivasan Parthasarathy, Anand Ranganathan, and Hao Yang. Near-optimal algorithms for shared filter evaluation in data stream systems. In Proceedings of the ACM SIGMOD International Conference on Management of Data, SIGMOD 2008, Vancouver, BC, Canada, June 10-12, 2008, pages 133–146, 2008. 1, 1.3 19 [LY13] [Ma14] [RS U05] [WS11] Jian Li and Wen Yuan. Stochastic combinatorial optimization via poisson approximation. In Symposium on Theory of Computing Conference, STOC'13, Palo Alto, CA, USA, June 1-4, 2013, pages 971–980, 2013. 1.3 Will Ma. Improvements and generalizations of stochastic knapsack and multi-armed bandit approximation algorithms: Extended abstract. In SODA, pages 1154–1163, 2014. 1.3 Alvin E. Roth, Tayfun Sonmez, and M. Utku Unver. Pairwise kidney exchange. 125(2):151–188, 2005. 1.3 J. Econom. Theory, David P. Williamson and David B. Shmoys. The design of approximation algorithms. Cambridge University Press, Cambridge, 2011. 1 A Monotonicity of XOS and Subadditive Functions Our definition of fractionally subadditive/XOS differs from the usual one, since it allows the function to be non-monotone. To show the difference, here is the usual definition: • A function f is monotone fractionally subadditive if f (T ) ≤ Pi αif (Si) for all χT ≤ Pi αiχSi with αi ≥ 0. Note the subtle difference: we now place a constraint when the set T is fractionally covered by the sets Si. Note that such a function is always monotone: for T ⊆ S we have χT ≤ χS and hence f (T ) ≤ f (S). Similarly, we can define a function f to be monotone XOS (a.k.a. max-of-sums) if there exist linear functions a1, a2, . . . , aw : 2X → R≥0 such that f (X) = maxj{aj(X)}. The difference is that we only allow non-negative coefficients in the linear functions. The equivalence of these definitions is shown in [Fei09]. It is also known that the class of monotone XOS functions lies between monotone submodular and monotone subadditive functions. These same proofs, with minor alterations, show that XOS functions are the same as fractionally subadditive functions (according to the definitions in §2), and lie between general submodular and general subadditive functions. Finally, if f satisfies the XOS definition in §2, and f is monotone, it also satisfies the definition above. Indeed, by duplicating sets and dropping some elements, we can take the sets T,{Si} and values αi ≥ 0 satisfying χT ≤ Pi αiχSi, and get sets S′ . By the general XOS definition, we get f (T ) ≤ Pi αif (S′ i), which by monotonicity is at most Pi αif (Si). Hence, the definitions in §2 and above i ⊆ Si satisfying χT = Pi αiχS′ are consistent. i A.1 Adaptivity Gaps for Non-Monotone Functions It suffices to prove the adaptivity gap conjecture for monotone XOS or subadditive functions, since for any XOS function f , the function f max is also XOS (shown below). Note that f max is clearly monotone. So we can just deal with the monotone XOS/subadditive function f max. (We note that such a property is not true for submodular functions, i.e. f being submodular does not imply that f max is.) Consider any (possibly non-monotone) XOS function f . We will show that f max is fractionally subadditive, i.e., for any T ⊆ X, {Si ⊆ X} and {αi ≥ 0} with χT =Pi αiχSi, f max(T ) ≤Pi αif max(Si). Consider any T,{Si},{αi} as above. Let U ⊆ T be the set achieving the maximum in f max(T ), i.e. f max(T ) = f (U ). Now consider the linear combination of the sets {Si ∩ U} with multipliers {αi}. We have χU =Pi αiχSi∩U . So, by the fractionally subadditive property of f , f (U ) ≤Xi αi · f (Si ∩ U ) ≤Xi αi · f max(Si). The last inequality above is by definition of f max as Si ∩ U ⊆ Si. Thus we have f max(T ) ≤ Pi αif max(Si) as desired. 20 B Large Adaptivity Gap for Arbitrary Functions Consider a monotone function f on k = √n types of items, with k items of each type (total k2 = n items). On any set S of items, function f takes value 1 if S contains at least one item of every type, and takes value 0 otherwise. Suppose each item is active independently w.p. 1/2 and the constraint allows us to probe at most 4k items. The optimal non-adaptive strategy here is to probe 4 items of each type. This strategy has an expected value of ( 15 16 )k. On the other hand, consider an adaptive strategy that arbitrarily orders the types and probes items of a type until it sees an active copy, and then moves to the next type. Since in expectation this strategy only probes 2 items of a type before moving to the next, with constant probability it will see an active copy of every type within the 4k probes. Hence, the adaptivity gap for this example is Ω(16/15)k. 21
1508.05567
2
1508
2017-07-20T18:57:42
Dual-Based Approximation Algorithms for Cut-Based Network Connectivity Problems
[ "cs.DS", "cs.DM", "math.OC" ]
We consider a variety of NP-Complete network connectivity problems. We introduce a novel dual-based approach to approximating network design problems with cut-based linear programming relaxations. This approach gives a $3/2$-approximation to Minimum 2-Edge-Connected Spanning Subgraph that is equivalent to a previously proposed algorithm. One well-studied branch of network design models ad hoc networks where each node can either operate at high or low power. If we allow unidirectional links, we can formalize this into the problem Dual Power Assignment (DPA). Our dual-based approach gives a $3/2$-approximation to DPA, improving the previous best approximation known of $11/7\approx 1.57$. Another standard network design problem is Minimum Strongly Connected Spanning Subgraph (MSCS). We propose a new problem generalizing MSCS and DPA called Star Strong Connectivity (SSC). Then we show that our dual-based approach achieves a 1.6-approximation ratio on SSC. As a consequence of our dual-based approximations, we prove new upper bounds on the integrality gaps of these problems.
cs.DS
cs
Dual-Based Approximation Algorithms for Cut-Based Network Connectivity Problems Benjamin Grimmer [email protected] Abstract We consider a variety of NP-Complete network connectivity problems. We intro- duce a novel dual-based approach to approximating network design problems with cut-based linear programming relaxations. This approach gives a 3/2-approximation to Minimum 2-Edge-Connected Spanning Subgraph that is equivalent to a pre- viously proposed algorithm. One well-studied branch of network design models ad hoc networks where each node can either operate at high or low power. If we allow uni- directional links, we can formalize this into the problem Dual Power Assignment (DPA). Our dual-based approach gives a 3/2-approximation to DPA, improving the previous best approximation known of 11/7 ≈ 1.57. Another standard network design problem is Minimum Strongly Connected Spanning Subgraph (MSCS). We propose a new problem generalizing MSCS and DPA called Star Strong Connectivity (SSC). Then we show that our dual-based approach achieves a 1.6-approximation ratio on SSC. As a consequence of our dual- based approximations, we prove new upper bounds on the integrality gaps of these problems. 1 Introduction In this work, we present approximation algorithms for multiple network connectivity prob- lems. All the problems we consider seek a minimum cost graph meeting certain connectivity requirements. Problems of this type have a wide array of applications. They have uses in the design and modeling of communication and ad hoc networks. Often these problems involve balancing fault tolerance and connectivity against cost of building and operating a network. Many standard network connectivity problems have been shown to be NP-Complete [10]. As a result, there is little hope of producing fast (polynomial time) algorithms to solve these problems (unless P = N P ). So the focus has shifted to giving fast (polynomial time) algorithms that approximately solve these problems. An approximation algorithm is said to have an approximation ratio of α if the cost of its output is always within a factor of α of the cost of the optimal solution. Technically, α can depend on the size of the problem instance, but a constant approximation ratio is better than one that grows. In Subsections 1.1 and 1.2, we introduce a number of standard graph connectivity prob- lems and their notable approximation algorithms. There are many other connectivity prob- lems and algorithmic tools that we omit from our discussion (See [12] for a more in-depth 1 survey). Then in Subsection 1.3, we summarize our contributions. In Section 2, we introduce our novel approach to approximating network design problems. The remaining sections will present our approximation algorithms based on this methodology. 1.1 Edge-Connectivity Problems One standard graph connectivity problems is Minimum 2-Edge-Connected Spanning Subgraph (2ECS). This problem takes as input a 2-edge-connected graph and outputs a 2-edge-connected spanning subgraph with minimum cardinality edge set. A 5/4 = 1.25- approximation was proposed using a matching lower bound in [15]. A 4/3 ≈ 1.33-approximation was given by Vempala and Vetta [23]. Another notable approximation algorithm appears in [18], which achieves a 1.5 ratio using a graph carving method with linear runtime. This graph carving method is a special case of the dual-based approach we introduce in Section 2. One can generalize the problem of 2ECS to have weights on every edge. Then the output is the spanning subgraph with minimum total weight on its edges. This problem seems to be harder to approximate that the unweighted version. The best approximation known for the weighted problem was given by Khuller and Vishkin and achieves a 2-approximation in [18]. Later, Jain proposed a 2-approximation that applies to a more general class of Steiner problems [14]. Another generalization of 2ECS is to search for the k-edge-connected spanning subgraph with the least number of edges. Using a linear program rounding algorithm, this problem on a multigraph input has a 1 + 3/k-approximation if k is odd and a 1 + 2/k-approximation if k is even [9]. Further, in [9], it is shown that for any fixed integer k ≥ 2 that a (1 + )- approximation cannot exist for arbitrary  > 0 (unless P = N P ). One of the most fundamental directed graph connectivity problems is Minimum Strongly Connected Spanning Subgraph (MSCS). This problem takes as input a strongly con- nected digraph and outputs a strongly connected spanning subgraph with minimum cardi- In [24], Vetta proposes the best approximation known for MSCS using a nality arc set. matching lower bound to get an approximation ratio of 1.5. There are two other notable ap- proximation algorithms for MSCS. First, Khuller, Raghavachari and Young gave a greedy algorithm with a 1.61 +  approximation ratio [16], [17]. Second, Zhao, Nagamochi and Ibaraki give an algorithm that runs in linear time with a 5/3 ≈ 1.66-approximation ratio in [27]. This algorithm implicitly uses the dual of the corresponding cut-based linear program to bound the optimal solution. When MSCS is generalized to have weights on each arc, the best algorithm known is a 2-approximation. This straightforward algorithm works by computing an in-arborescence and an out-arborescence with the same root in the digraph, and outputting their union. This is the best algorithm known even when arc weights are restricted to be in {0, 1}. 1.2 Power Assignment Problems A well-studied area of network design focuses on the problem of assigning power levels to vertices of a graph to achieve some connectivity property. This is useful in modeling radio networks and ad hoc wireless networks. It is common in this type of problem to minimize total power consumed by the system. This class of problems take as input a directed simple 2 graph G = (V, E) and a cost function c : E → R+. A solution to this problem assigns every vertex a non-negative power, p(v). We use H(p) to denote the spanning subgraph of G induced by the power assignment p (we will formally define H(p) later). The minimization problem then is to find the minimum power assignment,(cid:80) p(v), subject to H(p) satisfying a specific property. The first work on Power Assignment was done by Chen and Huang [8], which assumed that E is bidirected. We say an instance of Power Assignment is bidirected if whenever uv ∈ E then vu ∈ E and c(uv) = c(vu). There has been a large amount of interest in this type of problem since 2000 (some of the earlier papers are [13], [22] and [26]). While we consider problems seeking strong connectivity, other works have focused on designing fault-tolerant networks. In [25], approximations for both problems seeking biconnectivity and edge-biconnectivity are given. Further, [20] considers the more general problems of k-connectivity and k-edge-connectivity. We consider an asymmetric version of Power Assignment that allows unidirectional links defined as follows. The power assignment induces a spanning directed subgraph H(p) where xy ∈ E(H(p)) if the arc xy ∈ E and p(x) ≥ c(xy). The goal is to minimize the total power subject to H(p) being strongly connected. This problem was shown to be NP-Complete in [6]. Many different approximations for this problem have been proposed, which are com- pared in [5]. If we assume the input digraph and cost function are bidirected, the best approximation known achieves a 1.85-approximation ratio [2]. We are particularly interested in a special case of asymmetric Power Assignment called Dual Power Assignment (DPA). This problem takes a bidirected instance of Asymmet- ric Power Assignment with cost function c : E → {0, 1}. This models a network where each node can operate at either high or low power, and finds a minimum sized set of nodes to assign high power to produce a strongly connected network. The best approximation known for DPA was proposed by [1] and achieves an 11/7 ≈ 1.57-approximation. This algorithm is based on interesting properties of Hamiltonian cycles. A greedy approach to approximating DPA was first given in [7] and achieved a 1.75-approximation ratio. Then in Calinescu in [3] showed that this greedy approach can be extended to match the 1.61 + -approximation ratio of Khuller et al. for MSCS in [16], [17]. A greedy algorithm based on the same heuristic was later shown to give a 5/3 ≈ 1.66-approximation with nearly linear runtime in [11]. 1.3 Our Results (cid:83) strongly connected. F∈C F = E. Then SSC finds a minimum cardinality set R ⊆ C such that (V,(cid:83) MSCS and DPA both have approximation algorithms based on very similar ideas. This raises the question of how these two problems are related. To answer this question, we propose a new connectivity problem generalizing both of them called Star Strong Con- nectivity (SSC), defined as follows: We call a set of arcs sharing a source endpoint a star. SSC takes a strongly connected digraph G = (V, E) and a set C of stars as input such that F∈R F ) is SSC is exactly MSCS when all F ∈ C are restricted to have F = 1. Under this restriction, choosing any star in SSC would be equivalent to choosing its single arc in MSCS. Further, we make the following claim relating SSC and DPA (proof of this lemma is deferred to Section 3). 3 Lemma 1. When Star Strong Connectivity has a bidirected input digraph G (an arc uv exists if and only if the arc vu exists), it is equivalent to Dual Power Assignment. In some sense, SSC has a more elegant formulation than DPA. It removes the complexity of having two different classes of arcs. This benefit becomes very clear when constructing Integer Linear Programs for the two problems (our linear programs for SSC and DPA will be formally introduced in Section 3). Besides this difference in elegance, both the resulting programs for DPA and SSC constrained to have a bidirected input digraph are equivalent to each other. We introduce a novel dual-based approach to approximating connectivity problems. This methodology utilizes the cut-based linear programming relaxation of a connectivity problem. In Section 2, we give a full description of our approach and apply it to the problem of 2ECS. The resulting algorithm is equivalent to the 3/2-approximation given in [18]. Its value is solely in its simplicity and serving as an example of our approach. Applying our dual-based method to DPA gives a tight 3/2-approximation. This improves the previous best approximation known for DPA of 11/7 ≈ 1.57 [1]. Our algorithm and its analysis are made simpler by viewing it as an instance of SSC with a bidirected input digraph instead of DPA. In Section 3, we present our algorithm, prove its approximation ratio and show this bound is tight. Theorem 1. Dual Power Assignment has a dual-based 1.5-approximation algorithm. Integer Linear Programs are often used to formulate NP-Complete problems. An ap- proximation that uses a linear programming relaxation typically cannot give a better ap- proximation ratio that the ratio between solutions of the integer and relaxed programs. This ratio is known as the integrality gap of a program. For minimization problems, it is formally defined as the supremum of the ratio between the optimal integer solution and the optimal fractional solution over all problem instances. As a result of our analysis for Theorem 1, we prove an upper bound of 1.5 for DPA's integrality gap. This improves the previous upper bound of 1.85 proven in [2]. Corollary 1. The integrality gap of the standard cut-based linear program for Dual Power Assignment is at most 1.5. In fact, we prove a slightly stronger statement. Our algorithm constructs integer primal and integer dual solutions. As a result, the gap between integer solutions of these two problems is at most 1.5. Now, we turn our focus to the more general problem of SSC. Our algorithm for DPA is dependent on the underlying digraph being bidirected. Further the 3/2-approximation for MSCS in [24] and 11/7-approximation for DPA in [1] do not seem to generalize to SSC. in [18] and [16] on MSCS and by However the greedy approach used by Khuller et al. Calinescu in [3] on DPA appears to generalize easily to SSC. Claim 1. SSC has a 1.61 +  polynomial approximation algorithm using a simple variation of the greedy algorithm of [16]. In Section 4, we improve on this 1.61 + -approximation by applying our dual-based approach to SSC. This produces an algorithm with a tight 1.6-approximation ratio. Since 4 MSCS is a subproblem of SSC, this approximation ratio also extends to it. As with our approximation of DPA, we observe that an upper bound on the integrality gap follows from our analysis. Theorem 2. Star Strong Connectivity has a dual-based 1.6-approximation algorithm. Corollary 2. The integrality gap of the standard cut-based linear program for Star Strong Connectivity (and thus MSCS) is at most 1.6. Again, we actually prove a slightly stronger statement. Since our algorithm constructs integer primal and integer dual solutions, the primal-dual integer gap of these two problems is at most 1.6. A lower bound on the integrality gap of a problem provides a bound on the quality of approximation that can be achieved with certain methods. Linear program rounding, primal-dual algorithms, and our dual-based algorithms are all limited by this value. Recently, Laekhanukit et al. proved the integrality gap of MSCS is at least 3/2 −  for any  > 0 [19]. 2 Dual-Based Methodology In Subsection 2.1, we describe the typical form of integer linear programs (ILPs) related to graph connectivity problems and give a high-level description of our dual-based approach for a general problem. Finally, we apply our dual-based approach to the problem of 2ECS as a simple example. 2.1 Cut-Based Linear Programs All the connectivity problems considered in this work have cut-based ILPs. In this type of program, the constraints are based on having at least a certain number of edges or arcs crossing each cut of the graph. We will give the standard cut-based ILP for Minimum 2- Edge-Connected Spanning Subgraph to demonstrate this structure. For a cut ∅ ⊂ S ⊂ V , we use ∂E(S) to denote all edges with exactly one endpoint in S. Then the standard cut-based linear programming relaxation for 2ECS is the following. (cid:88) (cid:88) e∈E xe minimize subject to 2ECS Primal LP xe ≥ 2 , ∀∅ ⊂ S ⊂ V , ∀e ∈ E e∈∂E(S) xe ≥ 0 The integer programming formulation for 2ECS is given by adding the constraint that all xe are integer valued. The linear program will always have objective less than or equal to the objective of the integer program. 5 It is worth noting that this type of program has an exponential number of constraints, but it could be converted into a polynomial sized program using flow-based constraints. Previous algorithms have taken advantage of polynomial time linear program solvers to approximate 2ECS using its linear programming relaxation. However, our dual-based algorithms do not need to solve the linear program. As a result, we can keep it in the simpler cut-based form. Our method takes advantage of the corresponding dual linear program. The dual program will always have objective at most that of the original (primal) program. This property is known as weak duality. In fact, their optimal solutions will have equal objective, but we do not need this stronger property. The dual program corresponding to 2ECS is the following. 2ECS Dual LP maximize subject to (cid:88) (cid:88) ∅⊂S⊂V e∈∂E(S) yS ≥ 0 2yS yS ≤ 1 , ∀e ∈ E , ∀∅ ⊂ S ⊂ V Since the optimal solution to our integer program is lowerbounded by that of the primal linear program, we know that the optimal integer solution is lowerbounded by every feasible solution to the dual program. The basic idea of our dual-based method is to build a feasible dual solution while con- structing our integer primal solution. We construct our primal solution by repeatedly finding and contracting a problem specific type of subgraph: a cycle for 2ECS, a perfect set for SSC (defined later). Using a cut-based linear program, a dual solution will be a set of disjoint cuts (where the exact definition of disjoint is problem specific). We are interested in cuts that are disjoint from all cuts after contracting a subgraph. Later, we formally define these as internal cuts. We choose the subgraph to contract based on it having a number of disjoint internal cuts. When our algorithm terminates, the union of these disjoint internal cuts in each iteration will give a feasible dual solution. To apply this to a new connectivity problem, we first must define a contractible subgraph such that repeated contraction will yield a feasible primal solution. Definitions for disjoint and internal cuts will follow from the cut-based program and the contractible subgraphs. Finally, any polynomial runtime procedure that constructs a contractible subgraph with at least one internal cut produces an algorithm creating integer primal and dual solutions. The quality of the approximation depends directly on the number of internal cuts in each contraction. Our dual solution could use fractional cuts. However, this did not result in improvements in the approximation bounds for the problems studied in this paper. 2.2 Application to 2ECS We will illustrate our dual-based approach by giving a straightforward 3/2-approximation to 2ECS. This is neither best known in approximation ratio nor runtime. Its value is to serve 6 as a simple example of our dual-based approach. In [18], an equivalent 3/2-approximation is given for 2ECS that implicitly uses the dual bound. They also show that simple modifi- cations of the algorithm allow it to run in linear time. Our approximation is based on iteratively selecting and contracting cycles in the graph until the graph is reduced to a single vertex (this approach has been used by multiple previous approximations). We claim that such a procedure will always produce a 2-edge-connected spanning subgraph. Consider any cut ∅ ⊂ S ⊂ V in the graph. At some point, we will select a cycle with vertices in both S and V \ S. This cycle must have two edges crossing the cut. Thus such a procedure will always produce a feasible solution. Consider the primal and dual programs for 2ECS given in Section 2.1. When the dual problem is restricted to integer values, it can be thought of as choosing a set of cuts such that no two cuts share any edges. Our algorithm builds a solution to this dual problem to lower bound the optimal primal solution. We say a cut S is internal to a cycle C if all edges in ∂E(S) have both endpoints in the vertices of C. To contract a cycle means to replace all vertices of the cycle with a single supervertex whose edge set is all edges with exactly one endpoint in the cycle. When contracting a cycle, we keep duplicate edges (and thus the resulting structure is a 2- edge-connected multigraph). Contracting a cycle with an internal cut will remove all edges crossing that cut from the graph. As a result, after repeated contraction of cycles each with an internal cut, the set of all these internal cuts is dual feasible. Following from this, our algorithm will find a cycle with an internal cut, add the edges of the cycle to our approximate solution, contract the vertices of our cycle, and then repeat. Complete description of this process is given in Algorithm 1. Algorithm 1 Dual-Based Approximation for 2ECS 1: R = ∅ 2: while V (cid:54)= 1 do 3: 4: Find a cycle C with an internal cut as shown in Lemma 2 Contract the vertices of C into a single vertex 5: R := R ∪ E(C) 6: end while Lemma 2. Every 2-edge-connected multigraph has a cycle with an internal cut. Proof. Let N (v) denote the neighbors of a vertex v. We give a direct construction for a cycle C with a vertex ¯v such that all neighbors of ¯v are in the cycle. Then the cut {¯v} will be internal to this cycle. Our construction maintains a path P and repeatedly updates a vertex ¯v to be the last vertex of the path as it grows. 1: Set P to any edge in G 2: Set ¯v to be the last vertex in the path P 3: while ∃u ∈ N (¯v) \ V (P ) do P := P concatenated with the edge ¯vu ¯v := u 4: 5: 6: end while 7 7: Set w to be the vertex in N (¯v) earliest in P 8: Set C to the cycle using ¯vw and edges in P Our choice of C immediately gives us that N (¯v) ⊂ V (C), which implies that the cut {¯v} is internal to C. Let n denote the number of vertices and k denote the number of cycles contracted by Algorithm 1. Then we bound the optimal objective value (denoted by OP T) and the objective value of this algorithm's output (denoted by R) as follows: Lemma 3. OP T ≥ max{n, 2k} Proof. Consider the dual solution given by combining the internal cuts in each cycle. This is feasible since any edge crossed by one of these internal cuts is removed from the graph in the following contraction. Thus we have a dual feasible solution with objective 2k. Further any 2ECS solution must have at least n edges. Then the cost of the optimal solution is at least max{n, 2k}. Lemma 4. R = n + k − 1 know(cid:80)n Proof. Let Ci be the number of cycles of size i contracted by our algorithm. Since each cycle of size i reduces the number of vertices by i − 1 and our final graph has a single vertex, we i=2(i− 1)Ci = n− 1. Then our algorithm's output has cost(cid:80)n i=2 iCi = n + k− 1. Simple algebra can show n+k−1 max{n,2k} < 3 2. Thus this algorithm has a 1.5-approximation ratio. 3 A 1.5-Approximation for DPA To apply our dual-based methodology to DPA, we need to formulate it as a cut-based integer linear program. Since DPA has two types of arcs (high and low power), the corresponding program has to distinguish between these. The program corresponding to SSC avoids having different types of arcs and thus has a simpler form. Then for ease of notation, we will give our dual-based algorithm for DPA by approximating an instance of SSC with a bidirected input digraph. In Lemma 1, we claimed these problems are equivalent and problem instances can be easily transformed between the two. We now prove this result. Proof. of Lemma 1. We give a procedures that will turn any instance of DPA on digraph H into an instance of SSC with a bidirected input digraph, (G,C), and the reverse direction. Our transformations have linear runtime and will not substantially increase the size of the problem instance. Then our equivalence will follow. We first consider transforming an instance of DPA into SSC. Let H0 be the digraph in- duced by assigning no vertices of H high power. Then H0 will only have zero cost arcs. Since instances of DPA are bidirected, no arcs cross between the strongly connected components of H0. We then construct an instance of SSC with a vertex for each strongly connected com- ponent of H0. For each vertex v in H0, we add a star with source at the strong component of v and arcs going to each other strong component that v has an arc to in H. Note that G is bidirected. Feasible solutions to these DPA and SSC instances can be converted between 8 the two while preserving objective as follows: Given a feasible solution to DPA, for each vertex assigned high power add the corresponding star to our SSC solution. Similarly, given a feasible solution to SSC, we assign each vertex to high power when the corresponding star is in our SSC solution. This will produce a feasible DPA instance. Note these conversions will have equal objective since there is a one-to-one mapping between high power vertices and stars. Now we give a transformation for the reverse direction from an instance of SSC with a bidirected input digraph, (G,C). Our instance of DPA will have a vertex vF for every star F ∈ C. For each vertex v of G, consider the set of stars sourced at v, {Fsource(F ) = 1}. Add zero-cost arcs forming a cycle over this set. For every pair of arcs, uv and vu, in our bidirected G and for every star F with uv ∈ F and star F (cid:48) with vu ∈ F (cid:48), we add a one-cost arc between to vF and vF (cid:48). The resulting digraph will be bidirected, as is required for DPA. As with our previous transformation, there is a one-to-one relationship between high power vertices and stars. This relationship immediately gives a conversion between our feasible solutions that will maintain objective. We now proceed to construct a cut-based program for SSC and then give all the relevant definitions for our algorithms. Our approximations for both DPA and SSC will utilize these definitions. For the remainder of our definitions, we consider an instance of SSC on a digraph G = (V, E) and a set of stars C. Definition 1. For any star F ∈ C, we define source(F ) to be the common source vertex of all arcs in F . We define sinks(F ) to be the set of endpoints of arcs in F . Definition 2. For a cut, ∅ ⊂ S ⊂ V , we define ∂C(S) to be the set of all F ∈ C such that source(F ) ∈ S and at least one element of sinks(F ) is in V \ S. This notation allows us to use ∂C(S) as the set of all stars with an arc crossing from S to V \ S. Using these definitions, we can create a cut-based linear programming relaxation for SSC similar to those proposed in [21] and [5]. (cid:88) (cid:88) F∈C xF minimize subject to SSC Primal LP xF ≥ 1 , ∀∅ ⊂ S ⊂ V , ∀F ∈ C F∈∂C(S) xF ≥ 0 Lemma 5. When SSC Primal LP is restricted to xF ∈ Z, it is exactly SSC. We defer the proof of Lemma 5 to the appendix. Intuitively, the dual of SSC is to find the maximum set of cuts, such that no star F ∈ C crosses multiple of our cuts. Properly, we can consider fractional cuts in our dual problem, but our algorithm only uses integer solutions to the dual problem. 9 SSC Dual LP maximize subject to 3.1 Definitions (cid:88) (cid:88) ∅⊂S⊂V F∈∂C(S) yS ≥ 0 yS yS ≤ 1 , ∀F ∈ C , ∀∅ ⊂ S ⊂ V In our approximation of 2ECS, we repeatedly found cycles in the graph and contracted them. A cycle of length k, adds k to the cost of the solution and reduces the number of vertices by k − 1. A similar method has been applied to MSCS in many previous works. In [3], Calinescu proposed a novel way to extend this approach to DPA. Following from those definitions, we will use the following two definitions to define a contractible structure in SSC. Definition 3. A set Q ⊆ C is quasiperfect if and only if all F ∈ Q have a distinct source(F ) F∈Q F is strongly F∈Q F may contain arcs with endpoints outside of and the subgraph with vertex set the sources of the stars of Q and arc set(cid:83) connected. (Here we abuse notation as(cid:83) the source vertices of Q. Such arcs are ignored.) We will use source(Q) for a quasiperfect Q to be the set of all source vertices in Q. The distinction between source defined on F ∈ C and source defined on quasiperfect sets will always be clear from context. Definition 4. A set Q ⊆ C is perfect if and only if Q is quasiperfect and all F ∈ Q have sinks(F ) ⊆ source(Q). We define contracting a perfect set as follows: replace all the source vertices of the perfect set with a single supervertex whose arc set is all arcs with exactly one end point in our perfect set. We can combine duplicate arcs into a single arc during this contraction process. As a result of contraction, the size of a star may decrease, and a star may be removed if it has no remaining arcs. A quasiperfect Q adds Q cost and contracts the Q vertices of source(Q) into one, but may have extra arcs leaving the new supervertex. A perfect set has no such arcs, so the problem after contracting such a set will be another instance of SSC. Our next lemma describes how to expand any quasiperfect set into a perfect set. This an extension of Lemma 2 given by Calinescu in [3]. Lemma 6. Every quasiperfect set is a subset of some perfect set. Proof. Consider the following expansion procedure for any quasiperfect set Q. 1: while ∃F ∈ Q with u ∈ sinks(F ) \ source(Q) do 2: Find a path P from u to source(Q) that is internally disjoint from Q 10 u (a) (b) (c) Figure 1: Examples of both quasiperfect and perfect sets. A star is denoted by a square with a set of arcs leaving it. The vertex connected to the square by a regular line segment is the source. (a) A star made of three arcs. (b) A quasiperfect set of size five. If the arc to vertex u did not exist, this would be a perfect set. (c) A perfect set of size eight containing the previous example. for each arc e in P do add a star containing e to Q end for 3: 4: end while Line 2 of this construction can be implemented using a simple depth first search. Any star added must have had source outside of source(Q). So no star added will share a source vertex with any other star in Q. Further Q will still have a strongly connected subgraph. Thus each iteration of this procedure maintains the invariant that Q is quasiperfect. When this construction terminates, no such F exists. Therefore the resulting set Q is perfect. Each iteration also increases the size of Q, so it will terminate eventually. Our expansion procedure can be simplified slightly for DPA. Since the digraph is bidi- rected, lines 2 and 3 can just choose any star containing the reverse arc from u to source(F ). For the special case of MSCS, all stars have size exactly one. It follows that all quasiperfect sets will be perfect. In fact, for MSCS, it can easily be shown that all quasiperfect and perfect sets are cycles. Our approximation algorithms will repeatedly find perfect sets and contract them. As in our 2ECS example, the dual problem requires us to build a set of cuts that share no crossing stars. We use the following two definitions to relate the dual to perfect sets. Definition 5. Two cuts S1 and S2 are star-disjoint if and only if ∂C(S1) and ∂C(S2) are disjoint (i.e. ∂C(S1) ∩ ∂C(S2) = ∅). Definition 6. A cut S is internal to a set Q ⊆ C if and only if every F ∈ ∂C(S) has source(F ) ∈ source(Q) and sinks(F ) ⊆ source(Q). Then contracting a perfect set with internal cut S will remove all stars in ∂C(S) from the digraph. Then S must be star-disjoint from all cuts in the resulting digraph. 3.2 The 1.5-Approximation Algorithm Now we will give our approximation algorithm for DPA by considering any instance of SSC with a bidirected input digraph. In Lemma 7, we give a construction for a perfect set with 11 two star-disjoint internal cuts. Utilizing this lemma, our approximation algorithm becomes very simple. Our algorithm will repeatedly apply this construction and contract the resulting perfect set. This procedure is formally given in Algorithm 2. Algorithm 2 Dual-Based Approximation for Dual Power Assignment 1: R = ∅ 2: while V (cid:54)= 1 do 3: 4: Find a perfect set Q with two star-disjoint internal cuts as shown in Lemma 7 Contract the sources of Q into a single vertex 5: R := R ∪ Q 6: end while Lemma 7. Every instance of SSC with a bidirected input digraph has a perfect set with two star-disjoint internal cuts. Proof. We consider an instance of SSC defined on a bidirected digraph G = (V, E). In the degenerate case, we have a digraph with only two vertices, u and v. Then the perfect set {{uv},{vu}} will have star-disjoint internal cuts {u} and {v}. Now we assume V ≥ 3. Again, we let N (v) denote the neighbors of a vertex v. Note that the set of in-neighbors and out-neighbors for a vertex are identical since the digraph is bidirected. We call any vertex with exactly one neighbor a leaf. Then our assumption that V ≥ 3 implies some non-leaf vertex exists. Consider the following cycle construction in G (Figure 2 shows its possible outputs). 1: Set P to be any arc r¯v ∈ E, where ¯v is not a leaf 2: while TRUE do 3: 4: 5: 6: 7: 8: 9: 10: P := P concatenated with the arc ¯vu ¯v := u Set w to be the vertex in N (¯v) ∩ V (P ) earliest in P Set ¯w to be the successor of w in P if ∃u ∈ V s.t. u ∈ N ( ¯w) \ V (P ) and u is not a leaf then if ∃u ∈ V s.t. u ∈ N (¯v) \ V (P ) and u is not a leaf then else 11: 12: 13: 14: 15: else Replace P with the path using w¯v instead of w ¯w, reversing all arcs between ¯v and ¯w P := P concatenated with the arc ¯wu ¯v := u Set x to be the vertex in N ( ¯w) ∩ V (P ) earliest in P Set C to the cycle using the arc ¯vw, the reverse of arcs in P from w to x, the arc x ¯w, and arcs in P from ¯w to ¯v return C, ¯v, ¯w end if 16: 17: 18: 19: end while end if 12 p x w ¯w (a) ¯v p x = w ¯v = ¯w (b) Figure 2: Examples of cycles produced by our construction for Lemma 7. Dashed curves represent a path. We do not show the leaves that may exist next to ¯v or ¯w. (a) Shows the general form of our cycle. (b) Shows the special case when C = 2. Note that it is possible for ¯v and ¯w to be the same vertex. We make the following claim about the output of this procedure. Lemma 8. For any instance of SSC with a bidirected input digraph and V ≥ 3, this con- struction will output a cycle C with vertices ¯v, ¯w ∈ V (C) having the following two properties: 1. ¯v and ¯w are not leaves. 2. Each neighbor of ¯v or ¯w is either in V (C) or a leaf. Proof. Any strongly connected digraph with at least three vertices will have an initial arc r¯v where ¯v is not a leaf. This guarantees that step 1 is possible. Then each iteration increases the length of the path P . It follows that there are at most V iterations before the construction terminates. For our first property, we maintain the invariant that ¯v is not a leaf. This is true from our initial choice of ¯v, and also maintained in each u ∈ V chosen to extend P . Finally, ¯w is either equal to ¯v and thus not a leaf, or inside the path P and thus has two neighbors. For our second property, the choice of the cycle C implies that V (C) contains all vertices in P between x and ¯v. All non-leaf neighbors of ¯w are at most as early as x in P . All non-leaf neighbors of ¯v are at most as early as w in P . Note that w is at most as early as x in p. Then all the non-leaf neighbors of ¯v and ¯w must be in the V(C). Using this cycle C, we will construct our perfect set with two star-disjoint internal cuts. Note our resulting perfect set may not fully contain C. Let L¯v and L ¯w be the set of leaves adjacent to ¯v and ¯w, respectively. Consider the case where there is a star F sourced at ¯v containing arcs to multiple leaves. Let l1 and l2 be two distinct leaves in sinks(F ). Then we expand the quasiperfect set {F} into a perfect set Q using Lemma 6. The resulting set is shown in Figure 3 (a). This Q will have internal cuts {l1} and {l2}. Note that if two cuts share no vertices, then they also share no crossing stars (i.e. they are star-disjoint). The same construction can be made for such a star sourced at ¯w. For the remainder of our proof, we can assume no star exists sourced from ¯v or ¯w going to multiple leaves. Now we consider two separate cases: ¯v = ¯w and ¯v (cid:54)= ¯w. 13 ¯v l1 l2 (a) u p p x = w ¯v = ¯w l (b) ¯w x = w ¯v = ¯w l (c) l ¯v (d) ¯v (e) Figure 3: Depicting the quasiperfect or perfect sets selected by our construction based on the cycle C with vertices ¯v and ¯w ∈ V (C). We omit additional arcs that could be part of each star shown. If such arcs exist, they will be handled by the expansion shown in Lemma 6. Note ¯v and ¯w are symmetric and each case shown applies to both. Case 1: ¯v = ¯w. In this case, w must be the predecessor of ¯v. We can conclude that C = 2. Further, ¯v is only adjacent to w and leaves. We know that ¯v is not a leaf. Therefore the set L¯v must be non-empty. Let l ∈ L¯v be a leaf of ¯v. As previously shown, we can assume that no star sourced at ¯v contains multiple of our leaves. Then all stars containing the arc ¯vl are either {¯vl, ¯vw} or {¯vl}. Suppose the star F = {¯vl, ¯vw} exists. Then we expand the quasiperfect set {F} into a perfect set Q using Lemma 6. The resulting perfect set will have {l} as an internal cuts since the only neighbor of l is ¯v. Further, V \{l} is internal to this perfect set since {¯vl, ¯vw} and {¯vl} are the only stars containing this arc and all three vertices w, ¯v, and l are inside the perfect set. These two internal cuts are star-disjoint since they have no common vertices. If the star {¯vl, ¯vw} does not exist, then the star {¯vl} must exist. Therefore the set {{¯vl},{l¯v}} is perfect and has internal cuts {l} and V \ {l}. These two possibilities are shown in Figure 3 (b) and (c). Case 2: ¯v (cid:54)= ¯w. First suppose a star sourced at ¯v exists with an arc to a leaf l ∈ L¯v and an arc to a cycle vertex u ∈ V (C). Then let F be the star of this form with u nearest after ¯v in C (using an arbitrary direction around C). We construct a quasiperfect set by taking F and a star containing each arc of the cycle from u to ¯v. We can expand 14 this quasiperfect set into a perfect set Q using Lemma 6. Then {l} is an internal cut to Q. This perfect set is shown in Figure 3 (d). We know that any star F sourced at ¯v with an arc to l cannot have an arc to any other leaf. Then our choice of Q gives us that all stars F crossing the cut V \ {l} have sinks(F ) ⊂ source(Q). Therefore the cut V \ {l} is also internal to Q. Now, we can assume no star sourced at ¯v exists with arcs into both L¯v and V (C). Then every star F crossing the cut {¯v} ∪ L¯v has sinks(F ) ⊂ V (C). The same claim holds for ¯w by symmetry. Then we construct a quasiperfect set by iterating over the arcs of C, selecting a star containing each arc. Let Q be the perfect set made by expanding this quasiperfect set using Lemma 6. This perfect set is shown in Figure 3 (e). We will have {¯v} ∪ L¯v as an internal cut since V (C) ⊆ source(Q). Similarly we also have the internal cut { ¯w} ∪ L ¯w. Since ¯v (cid:54)= ¯w, the two internal cuts are star-disjoint. Therefore in either of our cases we can construct a perfect set with two star-disjoint internal cuts. This concludes our proof of Lemma 7. 3.3 Analysis of 1.5-Approximation Ratio Let I be the set of all possible SSC problem instances with bidirected input digraphs. We denote the solution from our algorithm on some I ∈ I as A(I) and the optimal solution as OP T (I). We let k denote the total number of perfect sets added by our algorithm. Further, we let Ai denote the number of perfect sets of size i added by the algorithm. Lemma 9. A(I) = n + k − 1 Proof. Observe that Ai = 0 for any i > n since the source of stars in a perfect set are distinct. Each perfect set of size i contracts i − 1 vertices, and over the whole algorithm, i=2(i − 1)Ai = n − 1. Each perfect set of size i we contract n vertices into 1. Therefore(cid:80)n contributes i cost to our solution. Then our cost is(cid:80)n i=2 iAi = n + k − 1. Lemma 10. OP T (I) ≥ n Proof. Consider the dual solution of assigning one to the cut {v} for all v ∈ V . This dual feasible solution has objective n. The lemma follows from weak duality. Lemma 11. OP T (I) ≥ 2k Proof. Whenever the algorithm adds a perfect set, we can identify two star-disjoint internal cuts. We construct a dual feasible solution by assigning each of our internal cuts yS = 1. To accomplish this, we must show that no star F crosses multiple of our internal cuts. Consider any star F ∈ C crossed by at least of our cuts. Let S be the first of our internal cuts with F ∈ ∂C(S). Since S is an internal cut, all arcs of F will be removed from the graph after contracting the corresponding perfect set. Thus this F will be crossing at most one of our internal cuts. So we have a dual feasible solution with objective 2k. The lemma follows from weak duality. 15 By taking a convex combination of Lemmas 10 and 11, we know the following: OP T (I) ≥ 2 3 n + 1 3 (2k). (1) Taking the ratio of Lemma 9 and Equation (1), we get a bound on the approximation ratio. Straightforward algebra on this ratio completes our proof of Theorem 1: OP T (I) ≤ n + k − 1 A(I) 2n 3 + 2k 3 < 3 2 = 1.5. As a corollary, 1.5 upper bounds the ratio between integer primal and integer dual solu- tions to our program. This is easily verified on any SSC instance I by choosing A(I) for the integer primal and the larger of the two dual solutions used in Lemma 10 and 11. Corollary 1 follows from this observation. Further, our analysis of the approximation ratio is tight as shown by an example in our appendix. Theorem 3. The 1.5-approximation ratio of Algorithm 2 is tight. 4 A 1.6-Approximation for SSC As in our approximation for DPA, we need a method to construct perfect sets with internal cuts. Without the restriction to bidirected input digraphs, we are unable the guarantee two star-disjoint internal cuts in each perfect set. Such a construction would give SSC a 1.5-approximation. Instead, we guarantee the following weaker condition. Lemma 12. Every instance of SSC has a perfect set Q with either Q ≥ 4 and one internal cut, or two star-disjoint internal cuts. Proof. We use N +(v) to denote the set of out-neighbors of a vertex v in G. We use the following cycle construction, which is a simplification of the construction used for DPA. 1: Set P to be any arc r¯v ∈ E 2: while ∃u ∈ N +(¯v) \ V (P ) do P := P concatenated with the arc ¯vu ¯v := u 3: 4: 5: end while 6: Set w to be the vertex in N +(¯v) earliest in P 7: Set C to the cycle using ¯vw and arcs in P 8: return C and ¯v Lemma 13. This construction will output a cycle C and ¯v ∈ V (C) such that N +(¯v) ⊆ V (C). Proof. Follows immediately from our choice of C. Using this C and ¯v, we will construct our perfect set. We consider this in three separate cases: C ≥ 4, C = 3, and C = 2. 16 Case 1: C ≥ 4. We construct a quasiperfect set by iterating over the arcs of our cycle C, selecting a star containing each arc. Then let Q be the perfect set created by expanding this set using Lemma 6. Note that Q ≥ 4. Since N +(¯v) ⊂ V (C), the cut {¯v} will be internal to Q. Case 2: C = 3. Our cycle construction must have found a cycle C on vertices {¯v, u1, u2}. Then ¯v has the property that N +(¯v) ⊆ {u1, u2}. Suppose some of the cycle arcs, ¯vu1, u1u2, or u2¯v, are part of a star with a vertex outside our cycle in its sink set. Then we can construct a quasiperfect set containing this star and a star for each other arc in the cycle. Expanding this quasiperfect set, as defined in Lemma 6, will produce a perfect set of size four or more with the internal cut {¯v}. So we assume that no such F exists, and thus C is a perfect set. If there exists a nontrivial path from u1 to u2 or from u2 to ¯v internally disjoint from V (C), then we can replace an arc of C with this path to get a larger cycle that has the same property with respect to ¯v (nontrivial meaning with P ≥ 2). Then we can apply Case 1 to handle the new cycle. Similarly, we can assume at least one of the following does not exist: path from u2 to u1 internally disjoint from V (C), path from u1 to ¯v internally disjoint from V (C), or the arc from ¯v to u2. If all three of these existed and at least one of the paths is nontrivial, we could construct a larger cycle with the same property with respect to ¯v by starting at ¯v, following the arc to u2, following the path to u1, finally following the path to ¯v. We know the paths from u2 to u1 and u1 to ¯v are internally disjoint because any overlap would create a path from u2 to ¯v. Thus this construction will produce a larger cycle containing all of neighbors of ¯v. Then we can assume this structure does not exist. We handle the four possible cases of our assumption separately. Note that the strong connectivity of the digraph implies there exists a path between any pair of vertices. Let RC(u) be the set of vertices reachable by u without using any arcs with both endpoints in C. Subcase 2.1 No path from u2 to u1 exists that is internally disjoint from V (C). Note that we also assume no nontrivial path from u2 to ¯v exists. Then RC(u2) includes neither ¯v nor u1. Further, the only arc crossing RC(u2) is u2¯v (since we have assumed the arc u2u1 does not exist). It follows that RC(u2) is internal to any perfect set contracting all three cycle vertices since no star contains a cycle arc and an arc to a fourth external vertex. Furthermore, the cut {¯v} will be internal to any perfect set contracting all three cycle vertices. Therefore we select any star containing each of our cycle arcs to produce a perfect set with internal cuts {¯v} and RC(u2). These two cuts are star-disjoint since they have no vertices in common. Subcase 2.2 No path from u1 to ¯v exists that is internally disjoint from V (C). Note that we also assume no nontrivial path from u1 to u2 exists. Then RC(u1) includes neither ¯v nor u2. Further, the only arc crossing this cut is u1u2 (since we have 17 assumed the arc u1¯v does not exist). It follows that RC(u1) is internal to any perfect set contracting all three cycle vertices since no star contains a cycle arc and an arc to a fourth external vertex. Furthermore, the cut {¯v} will be internal to any perfect set contracting all three cycle vertices. Therefore we select any star containing each of our cycle arcs to produce a perfect set with internal cuts {¯v} and RC(u1). These two cuts are star-disjoint since they have no vertices in common. Subcase 2.3 The arc ¯vu2 does not exist. Again, we select a perfect set made by selecting a star containing each arc of our cycle. The cut {¯v} is internal to C from our choice of C and ¯v. Further, we know that no nontrivial path exists from ¯v to u2 internally disjoint from V (C) and no nontrivial path exists from u1 to u2. Then we can conclude that the cut {¯v} ∪ RC(u1) is only crossed by the arc u1u2 (since ¯vu2 does not exist). Since we assumed no star containing a cycle arc and an arc to a fourth external vertex exists, {¯v} ∪ RC(u1) is also internal to our perfect set. These two cuts are star-disjoint because the arc ¯vu2 does not exist. Subcase 2.4 The arcs ¯vu2, u2u1 and u1¯v exist, but no nontrivial paths exist from u2 to u1 or from u1 to ¯v internally disjoint from V (C). Suppose any of the reversed cycle arcs ¯vu2, u2u1 or u1¯v are part of a star containing an arc to a fourth vertex outside of V (C). Then we could construct a perfect set of size four or more with internal cut {¯v} based on this cycle. Now we assume no such stars exist. We select our perfect set by choosing any star containing each of our cycle arcs. The cut {¯v} will be internal to such a perfect set. Since no nontrivial path exists from u1 to u2 or to ¯v that is internally star-disjoint from V (C), the cut RC(u1) will only be crossed by the arcs u1u2 and u1¯v. Thus RC(u1) is internal to our perfect set. These two cuts are star-disjoint since they have no vertices in common. Thus under any case we can find two star-disjoint internal cuts in our cycle or a larger perfect set with one internal cut. Case 3: C = 2. Our cycle construction must have found a cycle C on vertices {¯v, u1}. Note that the only arc leaving ¯v goes to u1, and there is a star containing only this arc. The strong connectivity of our digraph implies there is a path from u1 to ¯v. If a nontrivial path Q exists from u1 to ¯v, then we can replace C with the cycle made by concatenating the arc ¯vu1 with Q. This larger cycle can then be processed by either Case 1 or 2. So we can assume that the only path from u1 to ¯v is the arc between them. Consider the cut V \ {¯v}, which is only crossed by u1¯v. Either there exists a F1 ∈ C containing u1¯v and some u1u2, or this cut is internal to any perfect set contracting ¯v and u1. In the latter case, we can choose the perfect set {{¯vu1},{u1¯v}}. This perfect set has two star-disjoint internal cuts: {¯v} and V \ {¯v}. If this F1 and u2 exist, then any nontrivial path Q from u2 to u1 would create a quasiperfect set of size at least four. Then by Lemma 6, we could find a perfect set of 18 size four or more with the internal cut {¯v}. Finally, we handle the case where the only path from u2 to u1 is the arc u2u1. Let R ⊂ V be the set of all vertices that can be reached by u2 without using the arc u2u1. Consider the cut given by R, which is only crossed by u2u1. Either there exists a F2 ∈ C containing u2u1 and some u2u3, or R is internal to any perfect set contracting u1 and u2. In the former case, expanding the quasiperfect set {F1, F2}, as defined in Lemma 6, will give a perfect set of size at least four with internal cut {¯v}. In the latter case, expanding the quasiperfect set {F1}, as defined in Lemma 6, will give a perfect set with two star-disjoint internal cuts: {¯v} and R. Therefore regardless of the size of C, we can construct either a size four or more perfect set with an internal cut or a smaller perfect set with two star-disjoint internal cuts. This concludes our proof of Lemma 12. Using Lemma 12, our approximation algorithm is very simple. We repeatedly apply this construction and contract the resulting perfect set. This procedure is formally given in Algorithm 3. Algorithm 3 Dual-Based Approximation for Star Strong Connectivity 1: R = ∅ 2: while V (cid:54)= 1 do 3: 4: Find a perfect set Q as shown in Lemma 12 Contract the sources of Q into a single vertex 5: R := R ∪ Q 6: end while 4.1 Analysis of 1.6-Approximation Ratio The analysis of our approximation ratio is very similar to the analysis given in Section 3.3. Let I be the set of all possible SSC problem instances. We denote the solution from our algorithm on some I ∈ I as A(I) and the optimal solution as OP T (I). We let Ai denote the number of perfect sets of size i added by the algorithm. Lemma 14. A(I) = n(cid:80) iAi i=2 Proof. Each perfect set in Ai has i stars, and thus contributes i cost to our solution. Lemma 15. OP T (I) ≥ n > (i − 1)Ai n(cid:80) i=2 Proof. Consider the dual solution of assigning one to the cut {v} for all v ∈ V . This dual feasible solution has objective n. Since each perfect set of size i added by the algorithm (i − 1)Ai. The lemma follows from weak contracts i − 1 vertices, we know that n − 1 = duality. n(cid:80) i=2 19 Lemma 16. OP T (I) ≥ 2A2 + 2A3 + n(cid:80) i=4 Ai Proof. Whenever the algorithm adds a perfect set of size two, we can identify two star- disjoint internal cuts. Similarly, there are two star-disjoint internal cuts in every perfect set of size three and one internal cut in the remaining perfect sets. From the definition of internal cuts, we know that all of these internal cuts will be star-disjoint from previously added internal cuts. So we have a dual feasible solution and the lemma follows from weak duality. By taking a convex combination of Lemmas 15 and 16, we know the following: n(cid:88) ( n(cid:88) (i − 1)Ai) + (2A2 + 2A3 + Ai) OP T (I) > = 3 4 5 4 i=2 A2 + 2A3 + 1 4 i − 1 2 3 4 n(cid:88) i=4 ( i=4 )Ai. (2) Taking the ratio of Lemma 14 and Equation (2), we get a bound on the approximation ratio. Straightforward algebra on this ratio can show it is at most 8/5: n(cid:80) A(I) OP T (I) < i=2 5 4A2 + 2A3 + iAi n(cid:80) i=4 4i − 1 ( 3 2)Ai ≤ 8 5 = 1.6. This finishes the proof of Theorem 2. Corollary 2 follows from the same observation made about our 1.5-approximation for DPA. Further, our analysis of the approximation ratio is tight as shown by an example in our appendix. Theorem 4. The 1.6-approximation ratio of Algorithm 3 is tight. 5 Conclusion We introduced a novel approach to approximating network design problems with cut-based linear programming relaxations. Our method combines the combinatorial (recursive) struc- ture of the problem with the cut-based structure produced by the corresponding dual linear program. Identifying subgraphs that meet both the recursive and dual structural constraints can produce provably good approximations. We applied this methodology to a number of standard network design problems. In the case of Minimum 2-Edge-Connected Spanning Subgraph, the resulting algorithm is equivalent to a previously proposed 3/2-approximation [18]. For the problem of Minimum Strongly Connected Spanning Subgraph, we produce a tight 1.6-approximation. Although this is slightly worse than the 1.5-approximation of Vetta [24], our algorithm has notably fewer cases than Vetta's algorithm. 20 We also applied our dual-based approach to a common power assignment network design problem. The resulting algorithm for Dual Power Assignment achieves the best approx- imation ratio known of 1.5 (improving on the previous best known 1.57-approximation of [1]). We introduced a new problem generalizing DPA and MSCS, which we call Star Strong Connectivity. Our approach gives a tight 1.6-approximation to SSC. Each of our ap- proximation results also proves an upper bound on the integrality gap of the corresponding problem. Our dual-based approach can likely be applied to other unweighted connectivity problems with cut-based linear programs. Further application of this method will likely produce new approximation algorithms and improved upper bounds on their integrality gaps. Another interesting extension of this work would generalize SSC to have costs on each star. Even when costs are constrained to be in {0, 1}, Weighted SSC is at least as hard to approx- imate as Set Cover. This follows from a very simple reduction that was observed in [3]. As a consequence, any work on approximating the weighted variant will at best achieve a logarithmic approximation ratio. We believe the methods used in [4] will generalize to give Weighted SSC such a logarithmic approximation. Acknowledgments. This research was supported in part by a College of Science Under- graduate Summer Research Award at the Illinois Institute of Technology. We thank Gruia Calinescu for his many valuable comments and fruitful discussions, which notably improved the paper. References [1] Karim Abu-Affash, Paz Carmi, and Anat Parush Tzur. Dual power assignment via second Hamiltonian cycle. arXiv preprint, arXiv:1402.5783, 2014. [2] Gruia Calinescu. Approximate min-power strong connectivity. SIAM J. Discrete Math., 27(3):1527 -- 1543, 2013. [3] Gruia Calinescu. 1.61-approximation for min-power strong connectivity with two power levels. Journal of Combinatorial Optimization, pages 1 -- 21, 2014. [4] Gruia Calinescu, Sanjiv Kapoor, Alexander Olshevsky, and Alexander Zelikovsky. Net- work lifetime and power assignment in ad hoc wireless networks. In Giuseppe Di Bat- tista and Uri Zwick, editors, Algorithms - ESA 2003, volume 2832 of Lecture Notes in Computer Science, pages 114 -- 126. Springer Berlin Heidelberg, 2003. [5] Gruia Calinescu and Kan Qiao. Asymmetric topology control: Exact solutions and fast approximations. In INFOCOM, 2012 Proceedings IEEE, pages 783 -- 791, March 2012. [6] Paz Carmi and Matthew J. Katz. Power assignment in radio networks with two power levels. Algorithmica, 47(2):183 -- 201, 2007. 21 [7] Jian-Jia Chen, Hsueh-I Lu, Tei-Wei Kuo, Chuan-Yue Yan, and Ai-Chun Pang. Dual power assignment for network connectivity in wireless sensor networks. In Global Telecommunications Conference, 2005. GLOBECOM '05. IEEE, volume 6, pages 5 pp. -- 3642, Dec 2005. [8] Wen-Tsuen Chen and Nen-Fu Huang. The strongly connecting problem on multihop packet radio networks. Communications, IEEE Transactions on, 37(3):293 -- 295, Mar 1989. [9] Harold N. Gabow, Michel X. Goemans, ´Eva Tardos, and David P. Williamson. Ap- proximating the smallest k-edge connected spanning subgraph by LP-rounding. Netw., 53(4):345 -- 357, July 2009. [10] Michael R. Garey and David S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York, NY, USA, 1979. [11] Benjamin Grimmer and Kan Qiao. Near linear time 5/3-approximation algorithms for two-level power assignment problems. In Proceedings of the 10th ACM International Workshop on Foundations of Mobile Computing, FOMC '14, pages 29 -- 38, New York, NY, USA, 2014. ACM. [12] Anupam Gupta and Jochen Koenemann. Approximation algorithms for network design: A survey. Surveys in Operations Research and Management Science, 16(1):3 -- 20, 2011. [13] Mohammadtaghi Hajiaghayi, Nicole Immorlica, and Vahab S. Mirrokni. Power opti- mization in fault-tolerant topology control algorithms for wireless multi-hop networks. In in Proceedings of the 9th Annual International Conference on Mobile Computing and Networking. 2003, pages 300 -- 312. ACM Press, 2003. [14] Kamal Jain. A factor 2 approximation algorithm for the generalized steiner network problem. Combinatorica, 21(1):39 -- 60, 2001. [15] Raja Jothi, Balaji Raghavachari, and Subramanian Varadarajan. A 5/4-approximation algorithm for minimum 2-edge-connectivity. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '03, pages 725 -- 734, Philadel- phia, PA, USA, 2003. Society for Industrial and Applied Mathematics. [16] Samir Khuller, Balaji Raghavachari, and Neal Young. Approximating the minimum equivalent digraph. SIAM Journal on Computing, 24(4):859 -- 872, 1995. [17] Samir Khuller, Balaji Raghavachari, and Neal Young. On strongly connected digraphs with bounded cycle length. Discrete Applied Mathematics, 69(3):281 -- 289, 1996. [18] Samir Khuller and Uzi Vishkin. Biconnectivity approximations and graph carvings. J. ACM, 41(2):214 -- 235, March 1994. [19] Bundit Laekhanukit, Shayan Oveis Gharan, and Mohit Singh. A rounding by sampling approach to the minimum size k-arc connected subgraph problem. In Proceedings of the 39th International Colloquium Conference on Automata, Languages, and Programming - Volume Part I, ICALP'12, pages 606 -- 616, Berlin, Heidelberg, 2012. Springer-Verlag. 22 [20] Nhat X. Lam, Trac N. Nguyen, Min Kyung An, and Dung T. Huynh. Dual power assign- ment optimization and fault tolerance in wsns. Journal of Combinatorial Optimization, 30(1):120 -- 138, 2015. [21] Tobias Polzin and Siavash Vahdati Daneshmand. On Steiner trees and minimum span- ning trees in hypergraphs. Oper. Res. Lett., 31(1):12 -- 20, 2003. [22] Ram Ramanathan and Regina Rosales-Hain. Topology control of multihop wireless networks using transmit power adjustment. In INFOCOM 2000. Nineteenth Annual Joint Conference of the IEEE Computer and Communications Societies. Proceedings. IEEE, volume 2, pages 404 -- 413 vol.2, 2000. [23] Santosh Vempala and Adrian Vetta. Factor 4/3 approximations for minimum 2- connected subgraphs. In Klaus Jansen and Samir Khuller, editors, Approximation Al- gorithms for Combinatorial Optimization, volume 1913 of Lecture Notes in Computer Science, pages 262 -- 273. Springer Berlin Heidelberg, 2000. [24] Adrian Vetta. Approximating the minimum strongly connected subgraph via a match- In Proceedings of the Twelfth Annual ACM-SIAM Symposium on ing lower bound. Discrete Algorithms, SODA '01, pages 417 -- 426, Philadelphia, PA, USA, 2001. Society for Industrial and Applied Mathematics. [25] Chen Wang, Myung-Ah Park, James Willson, Yongxi Cheng, Andras Farago, and Weili Wu. On approximate optimal dual power assignment for biconnectivity and edge- biconnectivity. Theoretical Computer Science, 396(13):180 -- 190, 2008. [26] Roger Wattenhofer., Li Li, Paramvir Bahl, and Yi-Min Wang. Distributed topology control for power efficient operation in multihop wireless ad hoc networks. In INFOCOM 2001. Twentieth Annual Joint Conference of the IEEE Computer and Communications Societies. Proceedings. IEEE, volume 3, pages 1388 -- 1397 vol.3, 2001. [27] Liang Zhao, Hiroshi Nagamochi, and Toshihide Ibaraki. A linear time 5/3- approximation for the minimum strongly-connected spanning subgraph problem. Inf. Process. Lett., 86(2):63 -- 70, April 2003. A Proof of Lemma 5 Consider some instance of SSC given by a digraph G = (V, E) and a set of stars C. Let ROP T ⊆ C be the optimal solution to SSC. Let x∗ be the optimal solution to SSC Primal LP when restricted to xF ∈ Z. We then need to show that ROP T =(cid:80) First we show that ROP T ≥(cid:80) F ∈ ROP T value 1 and the rest value 0. Then ROP T =(cid:80) this xF = 1, we know(cid:80) F . Consider the vector x produced by assigning all F∈C xF . Our inequality will follow if we show x is a feasible solution to SSC Primal LP, since x∗ is the minimum feasible solution. From our construction, all xF ≥ 0. Further consider any cut ∅ ⊂ S ⊂ V . Since ROP T produces a strongly connected spanning subgraph, some F ∈ ROP T crosses S. Since F∈∂C(S) xF ≥ 1. Thus x is feasible. 23 F∈C x∗ F∈C x∗ F . l1 l2 l3 ... lk u1 u2 u3 ... uk ¯v uk+1 ¯w Figure 4: Example instance of Gk used to show our 1.5-approximation ratio for DPA is tight. Now we prove that ROP T ≤ (cid:80) prove this by contradiction. Let G(cid:48) be the digraph induced by R (i.e. G(cid:48) = (V,(cid:83) F ∈ {0, 1} (if a larger x∗ F exists, our objective is reduced by reducing it to x∗ F = 1 without effecting feasibility). Consider the set of stars R = {Fx∗ F . Our inequality will follow if we show R is a feasible solution to SSC, since ROP T is the minimum feasible solution. We F∈R F )). Assume G(cid:48) is not strongly connected. Then there exists s, t ∈ V such that there is no s, t- path in G(cid:48). Consider the set Vs ⊆ V of all vertices u with a s, u-path. Note t /∈ Vs. Then Vs is a cut with no arcs or stars crossing it. However, this contradicts the fact that x∗ is feasible. Thus we can conclude R is feasible. Lemma 5 follows. F∈C x∗ F . We know that all x∗ F∈C x∗ F = 1}. Then R =(cid:80) B Tightness of 1.5-Approximation Ratio for DPA We prove this by giving a family Gk of instances of SSC with a bidirected input digraphs where our algorithm can choose arbitrarily close to 3OP T (Gk)/2 stars. Our family of instances will only have stars of size one. Therefore, we can represent an instance of SSC using only the corresponding digraph. Further, since the digraph must be bidirected, we can represent it using an undirected graph. We define our family Gk as follows: Let V (Gk) = {¯v, ¯w} ∪ {u1, u2, ...uk+1} ∪ {l1, l2, ...lk}. Let E(Gk) contains ¯vuk+1, ¯wuk, and all edges in the cycle ¯v, u1, u2, ...uk+1 ¯w and the cycle ¯v, u1, l1, u2, l2, ...lk, uk+1, ¯w. An example instance of Gk is depicted in Figure 4 Suppose Algorithm 2 is run on Gk. When our cycle construction is run, it could build the path uk+1, ¯w, uk, ...u2, u1, ¯v before terminating. Then it would choose the perfect set corresponding to the cycle ¯v, uk+1, ¯w, uk, ...u2, u1. This set has disjoint internal cuts {¯v} and { ¯w}. After this is contracted into a vertex s, the algorithm will have to choose the perfect set of size two contracting li into s for each 1 ≤ i ≤ k. Each of these sets have disjoint internal cuts {li} and V \ {li}. Therefore our algorithm could choose 3k + 3 stars. The optimal solution to Gk will choose the perfect set corresponding to the Hamiltonian cycle ¯v, u1, l1, u2, l2, ...lk, uk+1, ¯w. This solution has objective 2k +3. Then the approximation ratio achieved on Gk could be as large as 3k+3 2k+3. As k approaches infinity, the ratio achieved on Gk approaches 3/2. 24 b (a) a y z d b(cid:48) c x a(cid:48) y(cid:48) d(cid:48) c(cid:48) x(cid:48) b(cid:48) a(cid:48) y(cid:48) (b) d(cid:48) c(cid:48) x(cid:48) (c) Figure 5: Example instances of Tk used to show our 1.6-approximation ratio for MSCS and SSC is tight. (a) T1 (b) T2 (c) T5 C Tightness of 1.6-Approximation Ratio for SSC We show our ratio is tight by giving a simple family of digraphs where our algorithm may choose arbitrarily close to a 1.6-approximation. We use an example where all F = 1 (i.e. when SSC is equivalent to MSCS). This allows us to describe any instance uniquely by giving its digraph. Figure 5 gives examples of our family of digraphs, Tk. Formally, Tk is recursively defined as follows: First, T1 is a digraph with vertices {a, b, c, d, x, y, z} and arcs of the cycles abcdxyz and yxca. Each Tk will have four specific vertices denoted by c, d, x and y. To construct Tk+1 from Tk, we replace x with the vertices {a(cid:48), b(cid:48), c(cid:48), d(cid:48), x(cid:48), y(cid:48)}. The arc from x to c is replaced with the arc from a(cid:48) to c. The arc from d to x is replaced with the arc from d to a(cid:48). Similarly the two arcs between x and y are replaced with two arcs between y(cid:48) and y. Further, we connect these new vertices with the arcs of the paths a(cid:48)b(cid:48)c(cid:48)d(cid:48)x(cid:48)y(cid:48) and y(cid:48)x(cid:48)c(cid:48)a(cid:48). The vertices c(cid:48), d(cid:48), x(cid:48) and y(cid:48) from our expansion of Tk are c, d, x and y for Tk+1 respectively. We prove the following two lemmas about Tk to establish the approximation ratio of Tk approaches 1.6 as k grows. Lemma 17. Every Tk has a Hamiltonian cycle containing the path dxy and of length 5k + 2. Proof. We prove this by induction. By the definition of T1, it contains the Hamiltonian cycle abcdxyz. Then for our inductive step, we assume there is such a Hamiltonian cycle C in the digraph Tk. We consider the path made by the arcs of C in Tk+1 (note the arc xy becomes the arc y(cid:48)y and dx becomes da(cid:48)). Then the arcs of C form a path starting at y(cid:48), going through all vertices common with Tk and ending at a(cid:48). Concatenating this with the path a(cid:48)b(cid:48)c(cid:48)d(cid:48)x(cid:48)y(cid:48) will yield a Hamiltonian cycle in Tk+1. Note this cycle contains the path d(cid:48)x(cid:48)y(cid:48). We added five new arcs to this cycle, giving a total size of 5k + 2 + 5 = 5(k + 1) + 2, which completes our inductive proof. Lemma 18. Our algorithm may choose 8k + 2 arcs on input Tk. 25 Proof. We prove this by induction. For T1, our cycle construction could build the path cayx. Then the cycle cayx with internal cut {x} may be used to create our perfect set. Let w be the resulting supervertex after contracting these four vertices. The next three iterations of our algorithm will contract the cycles wd, wb and wz. Total this choose 10 arcs, confirming our base case. Now we assume our algorithm will produce a solution to Tk using 8k + 2 arcs. Given an instance of Tk+1, consider the vertices added in our recursive construction: {a(cid:48), b(cid:48), c(cid:48), d(cid:48), x(cid:48), y(cid:48)}. As in our base case, the algorithm may contract the cycle y(cid:48)x(cid:48)c(cid:48)a(cid:48) into a supervertex w. Then it can contract the cycles wd(cid:48) and wb(cid:48). After these contractions, the six vertices that replaced x in Tk have been combined to a single vertex. Then it follows that after our algorithm selects these 8 arcs and contracts, Tk+1 becomes an instance of Tk. By our inductive assumption, this process could choose 8 + (8k + 2) = 8(k + 1) + 2 arcs. From Lemma 17, we know that the optimal solution to Tk costs 5k + 2. Combining 5k+2, which this result with Lemma 18, we find Tk could have an approximation ratio of 8k+2 approaches 8/5 = 1.6. 26
1701.00381
1
1701
2017-01-02T13:18:05
A generalized power iteration method for solving quadratic problem on the Stiefel manifold
[ "cs.DS" ]
In this paper, we first propose a novel generalized power iteration method (GPI) to solve the quadratic problem on the Stiefel manifold (QPSM) as min_{W^TW=I}Tr(W^TAW-2W^TB) along with the theoretical analysis. Accordingly, its special case known as the orthogonal least square regression (OLSR) is under further investigation. Based on the aforementioned studies, we then cast major focus on solving the unbalanced orthogonal procrustes problem (UOPP). As a result, not only a general convergent algorithm is derived theoretically but the efficiency of the proposed approach is verified empirically as well.
cs.DS
cs
A generalized power iteration method for solving quadratic problem on the Stiefel manifold Feiping Nie, Rui Zhang, and Xuelong Li, Fellow IEEE 1 7 1 0 2 n a J 2 ] S D . s c [ 1 v 1 8 3 0 0 . 1 0 7 1 : v i X r a Abstract-In this paper, we first propose a novel generalized power iteration method (GPI) to solve the quadratic problem on the Stiefel manifold (QPSM) as minW T W =I T r(W T AW − 2W T B) along with the theoretical analysis. Accordingly, its spe- cial case known as the orthogonal least square regression (OLSR) is under further investigation. Based on the aforementioned studies, we then cast major focus on solving the unbalanced orthogonal procrustes problem (UOPP). As a result, not only a general convergent algorithm is derived theoretically but the efficiency of the proposed approach is verified empirically as well. Index Terms-quadratic problem, Stiefel manifold, power it- eration, procrustes problem, orthogonal least square regression. I. INTRODUCTION The orthogonal procrustes problem (OPP) is the least square problem on the Stiefel manifold. The OPP originates from the factor analysis in psychometrics during 1950s and 1960s [1], [2]. The major purpose is to determine an orthogonal matrix that rotates the factor matrix to best fit some hypothesis matrix. The balanced case of the OPP was surveyed in multiple introductory textbooks such as [3], [4]. Recently, due to the wide applications of the orthogonal regression in computer science, see [5], [6], solving the unbalanced OPP (UOPP) is under increasing concern. Multiple approaches are proposed to solve UOPP such as the expansion balanced algorithm (EB), the right hand side and the left hand side relaxation (RSR), (LSR), the successive projection (SP) and the Lagrangian relaxation (LR). In [7], the EB method employs the expanded balanced OPP as its objective function. In [8] and [9] respectively, the RSR and the LSR approaches update the solution row by row or column by column iteratively based on solving the least square regression with a quadratic equality constraint (LSQE). In [10], the SP method updates the solution column by column by virtue of the projection method combined with correction techniques (PMCT) discussed by [12], which is efficient to solve LSQE. In [11], the LR method solves UOPP by selecting different Lagrangian multipliers. All the approaches mentioned above could converge to the solution of UOPP successfully, whereas they deal with more Feiping Nie and Rui Zhang are with School of Computer Science and Cen- ter for OPTical IMagery Analysis and Learning (OPTIMAL), Northwestern Polytechnical University, Xi'an 710072, Shaanxi, P. R. China. E-mail: {ruizhang8633, feipingnie}@gmail.com. Xuelong Li is with Center for OPTical IMagery Analysis and Learning (OPTIMAL), State Key Laboratory of Transient Optics and Photonics, Xi'an Institute of Optics and Precision Mechanics, Chinese Academy of Sciences, Xi'an 710119, Shaanxi, P. R. China. E-mail: xuelong [email protected]. complex procedures, which represent high orders of complex- ity. Furthermore, all these methods initialize the parameters deliberately to optimize their proposed algorithms. Last but not least, all these approaches are unable to deal with a more general problem known as the quadratic problem on the Stiefel manifold (QPSM). To address the referred deficiencies, we derive a novel generalized power iteration method (GPI) for QPSM in order to efficiently solve the orthogonal least square regression (OLSR) and UOPP with a random initial guess and concise computational steps. In sum, the proposed GPI method can deal with a more general problem known as QPSM than other approaches. Furthermore, the experimental results show that the proposed GPI method not only takes much less CPU time for the convergence but becomes more efficient dealing with the data matrix of large dimension as well. Notations: For any matrix M , Frobenius norm is defined as kM k2 F = T r(M T M ), where T r(·) is the trace operator. For any positive integer n, In denotes a n × n identity matrix. II. POWER ITERATION METHOD REVISITED The power iteration method is an iterative algorithm to seek the dominant eigenvalue and the related eigenvector of any given symmetric matrix A ∈ Rm×m, where the dominant eigenvalue is defined as the greatest eigenvalue in magnitude. The power iteration can be performed as the following steps: 1. Initialization. Random initialize a vector w ∈ Rm×1, which has a nonzero component in the direction of the dominant eigenvector. 2. Update m ← Aw. 3. Calculate q = m kmk2 4. Update w ← q. 5. Iteratively perform the step 2-4 until convergence. . The power iteration could be further extended to the orthogo- nal iteration (also called subspace iteration or simultaneous iteration) method to find the first k (k ≤ m) dominant eigenvalues and their associated eigenvectors for the given matrix A. The orthogonal iteration method could be described as the following iterative algorithm: 1. Initialization. Random initialize W ∈ Rm×k. 2. Update M ← AW . 3. Calculate QR = M via the compact QR factorization of M , where Q ∈ Rm×k and R ∈ Rk×k. 4. Update W ← Q. 5. Iteratively perform the step 2-4 until convergence. Apparently, the orthogonal iteration method above indicates a normalization process, which is similar as the normalization 2 ORDERS OF COMPLEXITY FOR 6 ALGORITHMS. TABLE I (t stands for the iteration number and (n, m, k) stands for the dimension.) RSR [8] LSR [9] SP [10] O(mnk + m3kt) O(mnk + m3kt) O(mnk + (m2n + m3)t) LR [11] EB [7] GPI (our) O(m2n + nk2 + m2kt) O(m3 + (m2n + m3)t) O(m2n + m2kt) Order of the complexity Order of the complexity in the power iteration method. When the matrix A is positive semi-definite (psd), the orthogonal iteration method is equiv- alent to solving the following optimization problem max W T W =Ik T r(W T AW ). (1) Therefore, the orthogonal iteration method is equivalent to the following steps under the psd matrix A: 1. Initialization. Random initialize W ∈ Rm×k. 2. Update M ← AW . 3. Calculate U SV T = M via the compact SVD method of M , where U ∈ Rm×k, S ∈ Rk×k and V ∈ Rk×k. 4. Update W ← U V T . 5. Iteratively perform the step 2-4 until convergence. From the observation, the solution of the above algorithm as W K differs from the solution of the orthogonal iteration method as W by the form, where KK T = Ik. However, the difference between the solutions of these two algorithms doesn't affect the objective value of the problem (1) due to the following derivation T r((W K)T AW K) = T r(W T AW KK T ) = T r(W T AW ). III. QUADRATIC PROBLEM ON THE STIEFEL MANIFOLD The Stiefel manifold νm,k is a set of the matrices W ∈ Rm×k, which have orthonormal columns as νm,k = {W ∈ Rm×k : W T W = Ik}. In this section, a novel approach is derived to unravel the following quadratic problem on the Stiefel manifold (QPSM) [13] as min W T W =Ik T r(W T AW − 2W T B) (2) where W ∈ Rm×k, B ∈ Rm×k and the symmetric matrix A ∈ Rm×m. In order to solve the problem (2), QPSM in (2) can be further relaxed into max W T W =Ik T r(W T AW ) + 2T r(W T B) (3) where A = αIm − A ∈ Rm×m. The relaxation parameter α is an arbitrary constant such that A is a positive definite (pd) matrix. Instead of the method of the Lagrangian multipliers to deal with an optimization problem with orthogonal constraints, one may use a geometric optimization algorithm tailored to the Stiefel manifold, such as, for example, the one surveyed in [14]. Accordingly, the Lagrangian function for the problem (3) can be written as L1(W, Λ) = T r(W T AW )+2T r(W T B)−T r(Λ(W T W −Ik)). (4) From Eq. (4), we could obtain the KKT condition for the problem (3) as ∂L1 ∂W = 2 AW + 2B − 2W Λ = 0 (5) which is difficult to solve directly. Thus, motivated by [16] and the power iteration method mentioned in Section 2, we could propose the following iterative algorithm: 1. Initialization. Random initialize W ∈ Rm×k such that W T W = Ik. 2. Update M ∈ Rm×k ← 2 AW + 2B. 3. Calculate W ∗ by solving the following problem max W T W =Ik T r(W T M ). (6) 4. Update W ← W ∗. 5. Iteratively perform the step 2-4 until convergence. Besides, a closed form solution of the problem (6) can be achieved by the following derivation. Suppose the full SVD of M is M = UΣVT with U ∈ Rm×m, Σ ∈ Rm×k and V ∈ Rk×k, then we have T r(W T M ) = T r(W T UΣVT ) = T r(ΣVT W T U) k = T r(ΣZ) = σiizii Xi=1 where Z = VT W T U ∈ Rk×m with zii and σii being the (i, i)-th elements of the matrix Z and Σ, respectively. Note that ZZ T = Ik, thus zii ≤ 1. On the other hand, is a singular value of the matrix M . σii ≥ 0 since σii Therefore, we have k k T r(W T M ) = ziiσii ≤ σii. Xi=1 Xi=1 Apparently, the equality holds when zii = 1, (1 ≤ i ≤ k). That is to say, T r(W T M ) reaches the maximum when the matrix Z = [Ik, 0] ∈ Rk×m. Recall that Z = VT W T U, thus the optimal solution to the problem (6) can be represented as W = UZ T VT = U[Ik; 0]VT . (7) Since Eq. (7) is based upon the full SVD of the matrix M , Eq. (7) can be rewritten as W = U V T via the compact SVD of the matrix M , where M = U SV T with U ∈ Rm×k, S ∈ Rk×k and V ∈ Rk×k. Based on the above analysis, the generalized power iteration method (GPI) can be summarized in the algorithm 1. 3000 2500 2000 l Test 7 δ=1 δ=2 δ=3 δ=4 δ=5 δ=6 14000 12000 10000 l Test 8 δ=1 δ=2 δ=3 δ=4 δ=5 δ=6 4500 4000 3500 3000 l Test 9 δ=1 δ=2 δ=3 δ=4 δ=5 δ=6 3 i a u d s e r f o e u a V l 1500 1000 500 0 5 10 15 20 25 30 Iteration 35 40 45 50 55 60 i a u d s e r f o e u a V l 8000 6000 4000 2000 0 10 20 30 40 50 Iteration 60 70 80 90 100 i a u d s e r f o e u a V l 2500 2000 1500 1000 500 0 10 20 30 40 50 Iteration 60 70 80 90 100 (a) (50, 100, 30) (b) (80, 170, 80) (c) (40, 120, 60) Fig. 1. Comparisons of 6 different values of δ are performed under the GPI method with 3 different data matrices. Algorithm 1 Generalized power iteration method (GPI) 1: Input: The symmetric matrix A ∈ Rm×m and the matrix B ∈ Rm×k. 2: Initialize a random W ∈ Rm×k satisfying W T W = Ik and α such that A = αIm − A ∈ Rm×m is a positive definite matrix. 3: Update M ← 2 AW + 2B. 4: Calculate U SV T = M via the compact SVD method of M where U ∈ Rm×k, S ∈ Rk×k and V ∈ Rk×k. 5: Update W ← U V T . 6: Iteratively perform the step 3-5 until the algorithm con- verges. We will prove that the proposed algorithm 1 converges monotonically to the local minimum of QPSM (2). Step 5 of algorithm 1 is an instance of a class of methods, called manifold retractions, to update a matrix on the Stiefel manifold, that were discussed in details in [15]. A. Theoretical analysis of GPI Lemma 3.1: If the symmetric matrix A ∈ Rm×m is positive definite (pd), then T r( W T A W ) − 2T r( W T AW ) + T r(W T AW ) ≥ 0 where W ∈ Rm×k and W ∈ Rm×k are arbitrary matrices. Proof: Since the matrix A is positive definite (pd), we could rewrite A = LT L via Cholesky factorization. Therefore, we have the following proof for Lemma 3.1 as kL W − LW k2 ⇒ T r( W T A W ) − 2T r( W T AW ) + T r(W T AW ) ≥ 0 F ≥ 0 (cid:3) Theorem 3.1: The algorithm 1 decreases the value of the objective function in (2) monotonically in each iteration until it converges. Proof: Suppose the updated W is W in the algorithm 1, then we have T r( W T M ) ≥ T r(W T M ) (8) since W is the optimal solution of the problem (6). Based on the fact that M = 2 AW +2B, Eq. (8) can be further illustrated as 2T r( W T AW )+2T r( W T B) ≥ 2T r(W T AW )+2T r(W T B). (9) Based on Lemma 3.1 and Eq. (9), we could infer that T r( W T A W ) + 2T r( W T B) ≥ T r(W T AW ) + 2T r(W T B) ⇒ T r( W T A W ) − 2T r( W T B) ≤ T r(W T AW ) − 2T r(W T B) which indicates that the algorithm 1 decreases the objective value of QPSM in (2) in each iteration until the algorithm converges. (cid:3) Theorem 3.2: The algorithm 1 converges to a local minimum of the QPSM problem (2). Proof: Since the algorithm 1 performs based on solving the problem (6) in each iteration, the Lagrangian function for the solution of the algorithm 1 can be represented as L2(W, Λ) = T r(W T M ) − T r(Λ(W T W − Ik)). (10) Therefore, the solution of the algorithm 1 satisfies the follow- ing KKT condition ∂L2 ∂W = M − 2W Λ = 0 (11) Generally speaking, the matrix M will be updated by W in each iteration under the algorithm 1. Since the algorithm 1 converges to the optimal solution W i.e. W = W due to The- orem 3.1, Eq. (11) can be further formulated by substituting M = 2 AW + 2B as ∂L2 ∂W = 2 AW + 2B − 2W Λ = 0. (12) By comparing Eq. (5) and (12), we could draw the conclusion that the solution of the algorithm 1 and the problem (3) satisfy the same KKT condition. Therefore, the algorithm 1 converges to a local minimum of QPSM (2) since the problems (2) and (3) are equivalent. (cid:3) Besides, the problem (6) has an unique solution under full column-rank matrix M due to the uniqueness of the SVD method. On the other hand, the experimental results in Section 5 represent that the proposed GPI method uniformly converges l i a u d s e r f o e u a v l 3500 3000 2500 2000 1500 1000 500 0 (100,10,100) LR SP LSR RSR EB our 5 10 15 20 25 iteration 30 35 40 45 50 4000 3500 3000 2500 2000 1500 1000 500 0 (100,15,100) LR SP LSR RSR EB our 10 20 30 40 iteration 50 60 70 (200,15,200) 4 LR SP LSR RSR EB our 5 10 15 20 25 iteration 30 35 40 45 9000 8000 7000 6000 5000 4000 3000 2000 1000 0 l i a u d s e r f o e u a v l l i a u d s e r f o e u a v l (a) (100, 10, 100) (b) (100, 15, 100) (c) (200, 15, 200) Fig. 2. Comparisons of the convergence rate are performed for 6 approaches including EB [7], RSR [8], LSR [9], SP [10] LR [11] and our proposed GPI method under 3 different data matrices. to the same objective value with a large amount of random initial guesses. Based on the unique solution of the problem (6) and the associated experimental results, it is rational to conjecture that the proposed GPI method converges to the global minimum of QPSM. B. Unbalanced Orthogonal Procrustes Problem Definition 4.1: With Q ∈ Rm×k, E ∈ Rn×m and G ∈ Rn×k, we name the optimization problem min QT Q=Ik kEQ − Gk2 F (16) IV. TWO SPECIAL CASES OF QUADRATIC PROBLEM ON THE STIEFEL MANIFOLD A. Orthogonal Least Square Regression The orthogonal least square regression (OLSR) can be written as 1. balanced orthogonal procrustes problem (OPP) if and only if m = k. 2. unbalanced orthogonal procrustes problem (UOPP) if and only if m > k. Especially when Q serves as a column vector (k = 1), the problem (16) degenerates to min W T W =Ik ,b kX T W + 1bT − Y k2 F (13) where the data matrix X ∈ Rm×n and the hypothesis matrix Y ∈ Rn×k with 1 = (1, 1, · · · , 1)T ∈ Rn×1. Moreover, W ∈ Rm×k is the regression matrix and b ∈ Rk×1 is the bias vector. Obviously, b is free from any constraint. By virtue of the extreme value condition w.r.t. b, we can derive as ∂kX T W + 1bT − Y k2 F ∂b = 0 ⇒ W T X1 + b1T 1 − Y T 1 = 0 ⇒ b = 1 n (Y T 1 − W T X1). By substituting the above result as b = 1 n (Y T 1 − W T X1), Eq. (13) can be simplified to the following form as min W T W =Ik kH(X T W − Y )k2 F (14) where H = In − 1 n 11T . Accordingly, the problem (14) can be further reformulated into in which min W T W =Ik T r(W T AW − 2W T B) (15) ( A = XHX T B = XHY . Apparently, Eq. (15) is in the exact same form as QPSM in (2). Therefore, OLSR in (13) can be solved via the algorithm 1. min qT q=1 kEq − gk2 2 (17) which is known as the least square problem with a quadratic equality constraint (LSQE). 1) Balanced orthogonal procrustes problem revisited: To solve the balanced OPP (m = k), we could expand Eq. (16) into min QT Q=Ik kEQ − Gk2 F ⇒ min QT Q=Ik ⇒ max QT Q=Ik kEk2 F + kGk2 F − 2T r(QT ET G) T r(QT ET G) which is same as the problem (6) with treating ET G = M . Thus, the balanced OPP has the analytical solution of the closed form (7). 2) Unbalanced orthogonal procrustes problem: When m > k, UOPP (16) can be expanded into min QT Q=Ik kEQ − Gk2 F ⇒ min QT Q=Ik T r(QT ET EQ − 2QT ET G). (18) Denote ET E = A and ET G = B, then Eq. (18) is in the exact same form as QPSM (2). Based on the algorithm 1, the algorithm 2 can be proposed to converge to a local minimum of UOPP monotonically due to the theoretical supports proved in Section 3. Generally speaking, QPSM can not be reformulated into UOPP while UOPP could always be rewritten into QPSM. 1800 1600 1400 1200 l Dimension (900,1000) GPI(our) PMCT 4500 4000 3500 3000 l Dimension (2000,1700) GPI(our) PMCT 5 i a u d s e r f o e u a V l 1000 800 600 400 200 0 5 10 15 20 25 Iteration 30 35 40 45 50 i a u d s e r f o e u a V l 2500 2000 1500 1000 500 0 5 10 15 20 25 Iteration 30 35 40 45 50 (a) (900, 1000) (b) (2000, 1700) Fig. 3. Comparisons of PMCT [12] and GPI are performed over 2 different data matrices. COMPARISONS OF CPU TIME UNDER THE SQUARE MATRIX E FOR CASE 2. TABLE II (n = m = 200) CPU time CPU time CPU time (Iteration stops when kEQi−1 − Gk2 LSR[9] 23.426s 21.635s 20.560s LSR[9] 842.849s 851.231s 860.746s RSR[8] 64.940s 136.020s 229.851s RSR[8] CPU time CPU time CPU time - - - k = 10 k = 15 k = 20 k = 10 k = 15 k = 20 (n = m = 1000) F − kEQi − Gk2 SP[10] 2.386s 3.221s 5.054s SP[10] 132.232s 196.761s 260.132s F ≤ τ where τ = 10−3.) LR[11] 0.541s 1.134s 1.806s LR[11] 3.869s 5.180s 7.700s EB[7] 0.337s 0.347s 0.445s EB[7] 11.440s 12.534s 12.625s GPI(our) 0.228s 0.226s 0.273s GPI(our) 1.290s 1.434s 1.575s Algorithm 2 GPI for solving UOPP in (16) 1: Input: The matrix E ∈ Rn×m and the matrix G ∈ Rn×k where m > k. 2: Initialize Q ∈ Rm×k and γ such that QT Q = Ik and the matrix γIm − ET E is positive definite, respectively. 3: While not converge do 4: Update matrix M ← 2(γIm − ET E)Q + 2ET G. 5: Calculate U ∈ Rm×k and V ∈ Rk×k via the compact SVD of M as M = U SV T . 6: Update Q ← U V T . 7: End while 8: Return Q. 250 200 ) s ( e m i t U P C 150 100 50 0 1000 Dimension (n,m) GPI(our) PMCT 1500 2000 2500 3000 n=m 3500 4000 4500 5000 Fig. 4. CPU time comparison under Case 3. Therefore, the GPI method is more general than other ap- proaches, which can only cope with UOPP. Based on the experimental results involved in the next section, the proposed GPI method takes much less time to converge to the solution of UOPP. V. EXPERIMENTAL RESULTS In this section, we analyze and report the numerical results of the generalized power iteration method (GPI) represented by both the algorithm 1 and the algorithm 2. We randomly choose the test data matrix with normally distributed singular values. Besides, the computer we use is MacBook Air, whose CPU is 1.4 GHz Intel Core i5, RAM is 4 GB 1600 MHz DDR3 and operating system is OS X Yosemite 10.10.5. Case 1: (parameter dependence) Firstly, we try to inves- tigate the GPI method in the algorithm 2 via varying the relaxation parameter γ. Suppose le is the largest eigenvalue of ET E, then we can let γ = δle such that γIm − ET E is a positive definite matrix, where δ is an arbitrary constant. 1) From the figure 1, we can further notice that although the convergence rate for the algorithm 2 is inversely proportional to the value of γ, the relaxation parameter γ does not affect the uniform convergence of the GPI method. Case 2:(CPU time comparison for solving UOPP) Sec- ondly, we further investigate the proposed GPI method in the algorithm 2 by comparing it with five existing approaches mentioned in section 1 as EB [7], RSR [8], LSR [9], SP [10] COMPARISON OF THE CPU TIME UNDER THE GENERAL DIMENSION FOR CASE 2. TABLE III 6 (Iteration stops when kEQi−1 − Gk2 F − kEQi − Gk2 F ≤ τ where τ = 10−3.) RSR[8] LSR[9] SP[10] LR[11] EB[7] GPI(our) 713.156s 528.034s 450.028s 20.709s 16.554s Dimension (n, m, k) (5000, 500, 15) (10000, 1000, 30) (3000, 3000, 90) (30000, 1500, 30) (5000, 4000, 100) (100000, 3000, 50) CPU time CPU time CPU time CPU time CPU time CPU time - - - - - - - - - - - - - - - 3.581s 9.384s 56.772s 191.970s 186.125s 395.401s 17.320s 306.132s 1056.311s 19.440s 405.937s 1187.512s 30.128s - - 215.173s and LR [11]. Based on solving LSQE problem, RSR [8] and LSR [9] respectively update the solution row by row and column by column iteratively. EB [7] utilizes the expanded balanced OPP as the objective function. SP [10] employs the projection method combined with correction techniques (PMCT) [12]. LR [11] solves UOPP by fixing different Lagrangian multipli- ers. The proposed GPI method includes two terms as ET E outside the loop and AW within the loop, whose orders of complexity are m2n and m2k, respectively. Besides, these two terms have the highest orders of complexity for the proposed GPI method. Besides, the order of the complexity for each method is shown in the table I. The comparative results are based on fixing E as the square matrix at first hand (Table II) and then extend E to a more general case (Table III) afterwards. (Mark − in the table II and the table III represents that it takes too much time to record in the tables.) 1) From the figure 2, we notice that the existing methods as EB [7], RSR [8], LSR [9], SP [10] LR [11] and the proposed GPI method converge to the same objective value under the same input data. Besides, our proposed GPI method converges faster than other approaches during iteration. 2) From the table I, the proposed GPI method has the lowest order of complexity due to its succinct computational process to obtain the optimal solution. During the experiments, we observe that the iteration number t for the LR method is usually very large for the convergence. Thus, the time consumption for LR method is much larger than that for the proposed GPI method though orders of complexity for these two approaches seem close. Besides, the GPI method becomes more efficient when n (the number of data) is large. 3) From the table II, the proposed algorithm 2 (GPI) serves as the most efficient method under the square matrix case. 4) From the table III, we can observe that LSR [9], SP [10] and RSR [8] are unable to compete with LR [11], EB [7] and GPI due to the complex updating procedures including the expanded OPP and solving LSQE. Especially when the dimension increases, the superiority of our proposed GPI method would be more obvious. Case 3:(CPU time comparison for solving LSQE) Finally, the projection method combined with correction techniques (PMCT) [12] is compared to the GPI method in the algorithm 2 targeting at solving the least square regression with a quadratic equality constraint (LSQE) in (17). Actually, solving LSQE (17) is no different from solving UOPP (16) under k = 1. 1) From the figure 3, we can notice that PMCT [12] and the algorithm 2 (GPI) converge to the same objective value though in terms of the different patterns. 2) From the figure 4, the algorithm 2 (GPI) takes much less time for convergence than PMCT [12] does. VI. CONCLUDING REMARKS In this paper, we analyze the quadratic problem on the Stiefel manifold (QPSM) by deriving a novel generalized power iteration (GPI) method. Based on the proposed GPI method, two special and significant cases of QPSM known as the orthogonal least square regression and the unbalanced orthogonal procrustes problem are under further investigation. With the theoretical supports, the GPI method decreases the objective value of the QPSM problem monotonically to a local minimum until convergence. Eventually, the effectiveness and the superiority of the proposed GPI method are verified em- pirically. In sum, the proposed GPI method not only takes less CPU time to converge to the optimal solution with a random initial guess but becomes much more efficient especially for the data matrix of large dimension as well. REFERENCES [1] Green, B.: The orthogonal approximation of an oblique simple structure in factor analysis. Psychometrika. 17 (1952) 429-440. [2] Hurley, J., Cattell, R.: The procrustes program: producing direct rotation to test a hypothesized factor structure. Behavioural Science. 6 (1962) 258- 262. [3] Golub, G. H., Van Loan, C. F.: Matrix Computations. The Johns Hopkins University Press (1989). [4] Thomas, V.: Algorithms for the weighted orthogonal procrustes problem and other least squares problems: [D]. (2006) Umea University, Sweden. [5] Souza, P., Leite, C., Borges, H., Fonseca, R.: Online algorithm based on support vectors for orthogonal regression. Pattern Recognition Letters 34 (2013) 1394-1404. [6] Chu, M., Trendafilov, N.: The orthogonally constrained regression re- visted. J. Comput. Graph. Stat. 10 (2001) 746-771. [7] Green, B., Goers, J.: A problem with congruence. The Annual Meeting of the Psychometric Society. Monterey, California (1979). [8] Park, H.: A parallel algorithm for the unbalanced orthogonal procrustes problem. Parallel Computing. 17 (1991) 913-923. [9] Bojanczyk, A., Lutoborski, A.: The procrustes problem for orthogonal stiefel matrices. SIAM. J. Sci. Comput. 21 (1999) 1291-1304. [10] Zhang, Z., Du, K.: Successive projection method for solving the unbal- anced procrustes problem. Science in China: Series A Mathematics. 49 (2006) 971-986. 7 [11] Xia, Y., Han, Y.: Partial lagrangian relaxation for the unbalanced orthogonal procrustes problem. Math. Meth. Oper. Res. 79 (2014) 225- 237. [12] Zhang, Z., Huang, Y.: A projection method for least square prob- lems with quadratic equality constraint. SIAM. J. Matr. Anal. Appl. 25 (2003)188-212. [13] Journ´ee, M., Nesterov, Y., Richt´arik, P., Sepulchre, R.: Generalized power method for sparse principal component analysis. Journal of Machine Learning Research. 11 (2008) 517-553. [14] Fiori, S.: Formulation and integration of learning differential equations on the Stiefel manifold. IEEE Transactions on Neural Networks. 16 (2005) 1697-1701. [15] Kaneko, T., Fiori, S., Tanaka, T.: Empirical arithmetic averaging over the compact stiefel manifold. IEEE Transactions on Signal Processing. 61 (2013) 883-894. [16] Nie, F., Yuan, J., Huang, H.: Optimal mean robust principal component analysis. in Proc. ICML. (2014) 2755-2763.
1501.01711
2
1501
2015-04-21T16:17:01
Frequent Directions : Simple and Deterministic Matrix Sketching
[ "cs.DS" ]
We describe a new algorithm called Frequent Directions for deterministic matrix sketching in the row-updates model. The algorithm is presented an arbitrary input matrix $A \in R^{n \times d}$ one row at a time. It performed $O(d \times \ell)$ operations per row and maintains a sketch matrix $B \in R^{\ell \times d}$ such that for any $k < \ell$ $\|A^TA - B^TB \|_2 \leq \|A - A_k\|_F^2 / (\ell-k)$ and $\|A - \pi_{B_k}(A)\|_F^2 \leq \big(1 + \frac{k}{\ell-k}\big) \|A-A_k\|_F^2 $ . Here, $A_k$ stands for the minimizer of $\|A - A_k\|_F$ over all rank $k$ matrices (similarly $B_k$) and $\pi_{B_k}(A)$ is the rank $k$ matrix resulting from projecting $A$ on the row span of $B_k$. We show both of these bounds are the best possible for the space allowed. The summary is mergeable, and hence trivially parallelizable. Moreover, Frequent Directions outperforms exemplar implementations of existing streaming algorithms in the space-error tradeoff.
cs.DS
cs
Frequent Directions : Simple and Deterministic Matrix Sketching Mina Ghashami University of Utah Edo Liberty Yahoo Labs [email protected] [email protected] Jeff M. Phillips∗ University of Utah David P. Woodruff† IBM Research–Almaden [email protected] [email protected] Abstract We describe a new algorithm called Frequent Directions for deterministic matrix sketching in the row-updates model. The algorithm is presented an arbitrary input matrix A ∈ Rn×d one row at a time. It performed O(d(cid:96)) operations per row and maintains a sketch matrix B ∈ R(cid:96)×d such that for any k < (cid:96) (cid:107)AT A − BT B(cid:107)2 ≤ (cid:107)A − Ak(cid:107)2 F /((cid:96) − k) and (cid:107)A − πBk (A)(cid:107)2 F ≤ (cid:107)A − Ak(cid:107)2 F . Here, Ak stands for the minimizer of (cid:107)A − Ak(cid:107)F over all rank k matrices (similarly Bk) and πBk (A) is the rank k matrix resulting from projecting A on the row span of Bk.1 We show both of these bounds are the best possible for the space allowed. The summary is mergeable, and hence trivially parallelizable. Moreover, Frequent Directions outperforms exemplar implementations of existing streaming algorithms in the space-error tradeoff.2 (cid:0)1 + (cid:1) k (cid:96) − k 1 Introduction The data streaming paradigm [28, 45] considers computation on a large data set A where data items arrive in arbitrary order, are processed, and then never seen again. It also enforces that only a small amount of memory is available at any given time. This small space constraint is critical when the full data set cannot fit in memory or disk. Typically, the amount of space required is traded off with the accuracy of the computation on A. Usually the computation results in some summary S(A) of A, and this trade-off determines how accurate one can be with the available space resources. Modern large data sets are often viewed as large matrices. For example, textual data in the bag-of-words model is represented by a matrix whose rows correspond to documents. In large scale image analysis, each row in the matrix corresponds to one image and contains either pixel values or other derived feature values. Other large scale machine learning systems generate such matrices by converting each example into a list of numeric features. Low rank approximations for such matrices are used in common data mining tasks such as Principal Component Analysis (PCA), Latent Semantic Indexing (LSI), and k-means clustering. Regardless of the data source, the optimal low rank approximation for any matrix is obtained by its truncated Singular Value Decompositions (SVD). ∗Thanks to support by NSF CCF-1350888, IIS-1251019, and ACI-1443046. †Supported by the XDATA program of DARPA administered through Air Force Research Laboratory contract FA8750-12- C0323. 1The matrix A0 is defined to be an all zeros matrix of the appropriate dimensions. 2This paper combines, extends and simplifies the results in [39] [27] and [56]. 1 In large matrices as above, one processor (and memory) is often incapable of handling all of the dataset A in a feasible amount of time. Even reading a terabyte of data on a single processor can take many hours. Thus this computation is often spread among some set of machines. This renders standard SVD algorithms infeasible. Given a very large matrix A, a common approach is to compute in the streaming paradigm a sketch matrix B that is significantly smaller than the original. A good sketch matrix B is such that A ≈ B or AT A ≈ BT B and so computations can be performed on B rather than on A without much loss in precision. Prior to this work, there are three main matrix sketching approaches, presented here in an arbitrary or- der. The first generates a sparser version of the matrix. Sparser matrices are stored more efficiently and can be multiplied faster by other matrices [4, 7, 23]. The second approach is to randomly combine matrix rows [40, 47, 51, 52]. The proofs for these rely on subspace embedding techniques and strong concentration of measure phenomena. The above methods will be collectively referred to as random-projection in the experimental section. A recent result along these lines [14], gives simple and efficient subspace embeddings that can be applied in time O(nnz(A)) for any matrix A. We will refer to this result as hashing in the exper- imental section. While our algorithm requires more computation than hashing, it will produce more accurate estimates given a fixed sketch size. The third sketching approach is to find a small subset of matrix rows (or columns) that approximate the entire matrix. This problem is known as the ‘Column Subset Selection Problem’ and has been thoroughly investigated [9, 10, 18, 19, 22, 25]. Recent results offer algorithms with almost matching lower bounds [9, 13, 18]. A simple streaming solution to the ‘Column Subset Selection Problem’ is obtained by sampling rows from the input matrix with probability proportional to their squared (cid:96)2 norm. Despite this algorithm’s apparent simplicity, providing tight bounds for its performance required over a decade of research [6, 19, 22, 25, 46, 49, 53]. We will refer to this algorithm as sampling. Algorithms such as CUR utilize the leverage scores of the rows [21] and not their squared (cid:96)2 norms. The discussion on matrix leverage scores goes beyond the scope of this paper, see [22] for more information and references. In this paper, we propose a fourth approach: frequent directions. It is deterministic and draws on the similarity between the matrix sketching problem and the item frequency estimation problem. We provide additive and relative error bounds for it; we show how to merge summaries computed in parallel on disjoint subsets of data; we show it achieves the optimal tradeoff between space and accuracy, up to constant factors, for any row-update based summary; and we empirically demonstrate that it outperforms exemplars from all of the above described approaches. (cid:113)(cid:80) 1.1 Notations and preliminaries Frobenius norm of a matrix A is defined as (cid:107)A(cid:107)F =(cid:112)(cid:80) Throughout this manuscript, for vectors, (cid:107) · (cid:107) will denote the Euclidian norm of a vectors (cid:107)x(cid:107) = i . i x2 For matrices (cid:107) · (cid:107) will denote the operator (or spectral) norm (cid:107)A(cid:107) = sup(cid:107)x(cid:107)=1 (cid:107)Ax(cid:107). Unless otherwise stated, vectors are assumed to be column vectors. The notation ai denotes the ith row of the matrix A. The i=1 (cid:107)ai(cid:107)2. I(cid:96) refers to the (cid:96) × (cid:96) identity matrix. The singular value decomposition of matrix B ∈ R(cid:96)×d is denoted by [U, Σ, V ] = svd(B). If (cid:96) ≤ d it guarantees that B = U ΣV T , U T U = I(cid:96), V T V = Id, U ∈ R(cid:96)×(cid:96), V ∈ Rd×(cid:96), and Σ ∈ R(cid:96)×(cid:96) is a non-negative diagonal matrix such that Σ1,1 ≥ Σ2,2 ≥ . . . ≥ Σ(cid:96),(cid:96) ≥ 0. It is convenient to denote by Uk, and Vk the matrices containing the first k columns of U and V and Σk ∈ Rk×k the top left k × k k is the best rank k approximation of A in the sense that Ak = block of Σ. The matrix Ak = UkΣkV T arg minC:rank(C)≤k(cid:107)A− C(cid:107)2,F . Finally we denote by πB(A) the projection of the rows A on the span of the rows of B. In other words, πB(A) = AB†B where (·)† indicates taking the Moore-Penrose psuedoinverse. Alternatively, setting [U, Σ, V ] = svd(B), we also have πB(A) = AV T V . Finally, we denote πk B(A) = AV T k Vk, the right projection of A on the top k right singular vectors of B. 2 1.2 Item Frequency Approximation Our algorithm for sketching matrices is an extension of a well known algorithm for approximating item frequencies in streams. The following section shortly overviews the frequency approximation problem. Here, a stream A = {a1,··· , an} has n elements where each ai ∈ [d]. Let fj = {ai ∈ A ai = j} be the frequency of item j and stands for number of times item j appears in the stream. It is trivial to produce all item frequencies using O(d) space simply by keeping a counter for each item. Although this method computes exact frequencies, it uses space linear to the size of domain which might be huge. Therefore, we are interested in using less space and producing approximate frequencies fj. This problem received an incredibly simple and elegant solution by Misra and Gries [44]. Their algo- rithm [44] employes a map of (cid:96) < d items to (cid:96) counters. It maintains the invariant that at least one of the items is mapped to counter of value zero. The algorithm counts items in the trivial way. If it encounters an item for which is has a counter, that counter is increased. Else, it replaces one of the items mapping to zero value with the new item (setting the counter to one). This is continued until the invariant is violated, that is, (cid:96) items map to counters of value at least 1. At this point, all counts are decreased by the same amount until at least one item maps to a zero value. The final values in the map give approximate frequencies fj such that 0 ≤ fj − fj ≤ n/(cid:96) for all j ∈ [d]; unmapped j imply fj = 0 and provides the same bounds. The reason for this is simple, since we decrease (cid:96) counters simultaneously, we cannot do this more that n/(cid:96) times. And since we decrement different counters, each item’s counter is decremented at most n/(cid:96) times. Variants of this very simple (and very clever) algorithm were independently discovered several times [17, 29, 35, 43].3 From this point on, we refer to these collectively as FREQUENTITEMS. Rk =(cid:80)d is, the optimal solution has a cost of Rk =(cid:80)d Later, Berinde et al. [8] proved a tighter bound for FREQUENTITEMS. Consider summing up the errors by i=k+1 fj − fj and assume without loss of generality that fj ≥ fj+1 for all j. Then, it is obvious that counting only the top k items exactly is the best possible strategy if only k counters are allowed. That i=k+1 fj. Berinde et al. [8] showed that if FREQUENTITEMS uses (cid:96) > k counters then fj − fj ≤ Rk/((cid:96) − k). By summing the error over the top k items it is easy to obtain that Rk < (cid:96) (cid:96)−k Rk. Setting (cid:96) = (cid:100)k + k/ε(cid:101) yields the convenient form of Rk < (1 + ε)Rk. The authors also show that to get this kind of guarantee in the streaming setting Ω(k/ε) bits are indeed necessary. This make FREQUENTITEMS optimal up to a log factor in that regard. 1.3 Connection to Matrix Sketching There is a tight connection between the matrix sketching problem and the frequent items problem. Let A be a matrix that is given to the algorithm as a stream of its rows. For now, let us constrain the rows of A to be indicator vectors. In other words, we have ai ∈ {e1, ..., ed}, where ej is the jth standard basis vector. Note that such a matrix can encode a stream of items (as above). If the ith element in the stream is j, then the ith row of the matrix is set to ai = ej. The frequency fj can be expressed as fj = (cid:107)Aej(cid:107)2. Assume that we construct a matrix B ∈ R(cid:96)×d as follows. First, we run FREQUENTITEMS on the input. Then, for every item 1/2 j for which fj > 0 we generate one row in B equal to f · ej. The result is a low rank approximation of A. j Note that rank(B) = (cid:96) and that (cid:107)Bej(cid:107)2 = fj. Notice also that (cid:107)A(cid:107)2 F = n and that AT A = diag(f1, . . . , fd) and that BT B = diag( f1, . . . , fd). Porting the results we obtained from FREQUENTITEMS we get that (cid:107)AT A − BT B(cid:107)2 = maxj fj − fj ≤ (cid:107)A(cid:107)2 F /((cid:96) − k). Moreover, since the rows of A (corresponding to different counters) are orthogonal, the best rank k approximation of A would capture exactly the most i=k+1 fj. If we follow the step above we can also reach frequent items. Therefore, (cid:107)A − Ak(cid:107)2 the conclusion that (cid:107)A − πk F . We observe that, for the case of matrices whose rows are basis vectors, FREQUENTITEMS actually provides a very efficient low rank approximation result. F = Rk =(cid:80)d B(A)(cid:107)2 F ≤ (cid:96) (cid:96)−k(cid:107)A − Ak(cid:107)2 3The reader is referred to [35] for an efficient streaming implementation. 3 In this paper, we argue that an algorithm in the same spirit as FREQUENTITEMS obtains the same bounds for general matrices and general test vectors. 1.4 Main results We describe the FREQUENTDIRECTIONS algorithm, an extension of FREQUENTITEMS to general matrices. The intuition behind FREQUENTDIRECTIONS is surprisingly similar to that of FREQUENTITEMS: In the same way that FREQUENTITEMS periodically deletes (cid:96) different elements, FREQUENTDIRECTIONS peri- odically ‘shrinks’ (cid:96) orthogonal vectors by roughly the same amount. This means that during shrinking steps, the squared Frobenius norm of the sketch reduces (cid:96) times faster than its squared projection on any single direction. Since the Frobenius norm of the final sketch is non negative, we are guaranteed that no direction in space is reduced by “too much”. This intuition is made exact below. As a remark, when presented with an item indicator matrix, FREQUENTDIRECTIONS exactly mimics a variant of FREQUENTITEMS. Theorem 1.1. Given any matrix A ∈ Rn×d, FREQUENTDIRECTIONS processes the rows of A one by one and produces a sketch matrix B ∈ R(cid:96)×d, such that for any unit vector x ∈ Rd F /((cid:96) − k). 0 ≤ (cid:107)Ax(cid:107)2 − (cid:107)Bx(cid:107)2 ≤ (cid:107)A − Ak(cid:107)2 This holds also for all k < (cid:96) including k = 0 where we define A0 as the n × d all zeros matrix. Other convenient formulations of the above are AT A (cid:23) BT B (cid:23) AT A − Id · (cid:107)A − Ak(cid:107)2 F /((cid:96) − k) or F /((cid:96)− k). Note that setting (cid:96) = (cid:100)k + 1/ε(cid:101) yields error AT A− BT B (cid:23) 0 and (cid:107)AT A− BT B(cid:107)2 ≤ (cid:107)A− Ak(cid:107)2 F using O(dk + d/ε) space. This gives an additive approximation result which extends and of ε(cid:107)A − Ak(cid:107)2 refines that of Liberty [39]. We also provide a multiplicative error bound from Ghashami and Phillips [27]. Theorem 1.2. Let B ∈ R(cid:96)×d be the sketch produced by FREQUENTDIRECTIONS. For any k < (cid:96) it holds that (cid:107)A − πk B(A)(cid:107)2 F ≤ (1 + )(cid:107)A − Ak(cid:107)2 F . k (cid:96) − k B(A)(cid:107)2 F ≤ (1+ε)(cid:107)A−Ak(cid:107)2 Note that by setting (cid:96) = (cid:100)k +k/ε(cid:101) one gets the standard form (cid:107)A−πk F . FRE- QUENTDIRECTIONS achieves this bound while using less space than any other known algorithm, namely O((cid:96)d) = O(kd/ε) floating point numbers, and is deterministic. Also note that the πk B operator projects onto a rank k subspace Bk, where as other similar bounds [9, 13, 24, 42, 51] project onto a higher rank subspace B, and then considers the best rank k approximation of πB(A). Our lower bound in Theorem 1.4, from Woodruff [56], shows our approach is also tight even for this weaker error bound. Theorem 1.3. Assuming a constant word size, any matrix approximation algorithm, which guarantees F /((cid:96) − k) must use Ω(d(cid:96)) space; or in more standard terms, guarantees of (cid:107)AT A − BT B(cid:107)2 ≤ (cid:107)A − Ak(cid:107)2 F must use Ω(dk + d/ε) space. (cid:107)AT A − BT B(cid:107)2 ≤ ε(cid:107)A − Ak(cid:107)2 Theorem 1.4. Assuming a constant word size, any randomized matrix approximation streaming algorithm F and that succeeds in the row-wise-updates model, which guarantees (cid:107)A − πk with probability at least 2/3, must use Ω(kd/ε) space. F ≤ (1 + ε)(cid:107)A − Ak(cid:107)2 B(A)(cid:107)2 Theorem 1.4 claims that FREQUENTDIRECTIONS is optimal with respect to the tradeoff between sketch size and resulting accuracy. On the other hand, in terms of running time, FREQUENTDIRECTIONS is not known to be optimal. Theorem 1.5. The running time of FREQUENTDIRECTIONS on input A ∈ Rn×d and parameter (cid:96) is O(nd(cid:96)). FREQUENTDIRECTIONS is also “embarrassingly parallel” because its resulting sketch matrices constitute mergeable summaries [5]. 4 1.5 Practical Implications Before we describe the algorithm itself, we point out how it can be used in practice. As its name suggests, the FREQUENTITEMS algorithm is often used to uncover frequent items in an item stream. Namely, if one sets (cid:96) > 1/ε, then any item that appears more than εn times in the stream must appear in the final sketch. Similarly, FREQUENTDIRECTIONS can be used to discover the space of unit vectors (directions) in space x for which (cid:107)Ax(cid:107)2 ≥ ε(cid:107)A(cid:107)2 F , for example. This property makes FREQUENTDIRECTIONS extremely useful in practice. In data mining, it is common to represent data matrices A by their low rank approximations Ak. But, choosing the right k for which this representation is useful is not straight forward. If the chosen value of k is too small the representation might be poor. If k is too large, precious space and computation cycles are squandered. The goal is therefore to pick the minimal k which provides an acceptable approximation. To do this, as practitioners, we typically compute the top k(cid:48) (cid:29) k singular vectors and values of A (computing svd(A) partially). We then keep only the k singular vectors whose corresponding singular values are larger than some threshold value t. In other words, we only “care about” unit vectors x such that (cid:107)Ax(cid:107) ≥ t. Using FREQUENTDIRECTIONS we can invert this process. We can prescribe in advance the acceptable approximation t and directly find a space containing those vectors x for which (cid:107)Ax(cid:107) ≥ t. Thereby, not only enabling a one-pass or streaming application, but also circumventing the svd computation altogether. 2 Frequent Directions The algorithm keeps an (cid:96)× d sketch matrix B that is updated every time a new row from the input matrix A is added. The algorithm maintains the invariant that the last row of the sketch B is always all-zero valued. During the execution of the algorithm, rows from A simply replace the all-zero valued row in B. Then, the last row is nullified by a two-stage process. First, the sketch is rotated (from the left) using its SVD such that its rows are orthogonal and in descending magnitude order. Then, the sketch rows norms are “shrunk” so that at least one of them is set to zero. Algorithm 2.1 FREQUENTDIRECTIONS Input: (cid:96), A ∈ Rn×d B ← 0(cid:96)×d for i ∈ 1, . . . , n do B(cid:96) ← ai [U, Σ, V ] ← svd(B) C ← ΣV T δ ← σ2 B ← return B (cid:112)Σ2 − δI(cid:96) · V T (cid:96) # ith row of A replaced (all-zeros) (cid:96)th row of B # Not computed, only needed for proof notation # The last row of B is again zero 2.1 Error Bound This section proves our main results for Algorithm 2.1 which is our simplest and most space efficient algo- rithm. The reader will notice that we occasionally use inequalities instead of equalities at different parts of the proof to obtain three Properties. This is not unintentional. The reason is that we want the same exact proofs to hold also for Algorithm 3.1 which we describe in Section 3. Algorithm 3.1 is conceptually identical to Algorithm 2.1, it requires twice as much space but is far more efficient. Moreover, any algorithm which produces an approximate matrix B which satisfies the following facts (for any choice of ∆) will achieve the error bounds stated in Lemma 1.1 and Lemma 1.2. 5 In what follows, we denote by δi, B[i], C[i] the values of δ, B and C respectively after the ith row of A i=1 δi, be the total mass we subtract from the stream during the algorithm. To was processed. Let ∆ =(cid:80)n prove our result we first prove three auxiliary properties. Property 1. For any vector x we have (cid:107)Ax(cid:107)2 − (cid:107)Bx(cid:107)2 ≥ 0. Proof. Use the observations that (cid:104)ai, x(cid:105)2 + (cid:107)B[i−1]x(cid:107)2 = (cid:107)C[i]x(cid:107)2. n(cid:88) [(cid:104)ai, x(cid:105)2 + (cid:107)B[i−1]x(cid:107)2 − (cid:107)B[i]x(cid:107)2] ≥ (cid:107)Ax(cid:107)2 − (cid:107)Bx(cid:107)2 = i=1 n(cid:88) [(cid:107)C[i]x(cid:107)2 − (cid:107)B[i]x(cid:107)2] ≥ 0. i=1 Property 2. For any unit vector x ∈ Rd we have (cid:107)Ax(cid:107)2 − (cid:107)Bx(cid:107)2 ≤ ∆. Proof. To see this, first note that (cid:107)C[i]x(cid:107)2 − (cid:107)B[i]x(cid:107)2 ≤ (cid:107)CT [i]C[i] − BT that (cid:107)C[i]x(cid:107)2 = (cid:107)B[i−1]x(cid:107)2 + (cid:107)aix(cid:107)2. Substituting for (cid:107)C[i]x(cid:107)2 above and taking the sum yields [i]B[i](cid:107) ≤ δi. Now, consider the fact (cid:88) ((cid:107)B[i−1]x(cid:107)2 + (cid:107)aix(cid:107)2) − (cid:107)B[i]x(cid:107)2 (cid:80) = (cid:107)Ax(cid:107)2 + (cid:107)B[0]x(cid:107)2 − (cid:107)B[n]x(cid:107)2 = (cid:107)Ax(cid:107)2 − (cid:107)Bx(cid:107)2. i δi = ∆ yields that (cid:107)Ax(cid:107)2 − (cid:107)Bx(cid:107)2 ≤ ∆. i i (cid:107)C[i]x(cid:107)2 − (cid:107)B[i]x(cid:107)2 = (cid:88) Combining this with(cid:80) Property 3. ∆(cid:96) ≤ (cid:107)A(cid:107)2 Proof. In the ith round of the algorithm (cid:107)C[i](cid:107)2 n(cid:88) solving for (cid:107)ai(cid:107)2 and summing over i we get i (cid:107)C[i]x(cid:107)2 − (cid:107)B[i]x(cid:107)2 ≤ F . F − (cid:107)B(cid:107)2 n(cid:88) F ≥ (cid:107)B[i](cid:107)2 F + (cid:96)δi and (cid:107)C[i](cid:107)2 F = (cid:107)B[i−1](cid:107)2 F + (cid:107)ai(cid:107)2. By (cid:107)A(cid:107)2 F = (cid:107)ai(cid:107)2 ≤ i=1 i=1 (cid:107)B[i](cid:107)2 F − (cid:107)B[i−1](cid:107)2 F + (cid:96)δi = (cid:107)B(cid:107)2 F + (cid:96)∆. Equipped with the above observations, and no additional requirements about the construction of B, we F /((cid:96) − k). We use can prove Lemma 1.1. Namely, that for any k < (cid:96), (cid:107)AT A − BT B(cid:107)2 ≤ (cid:107)A − Ak(cid:107)2 Property 2 verbatim and bootstrap Property 3 to prove a tighter bound on ∆. In the following, yi correspond to the singular vectors of A ordered with respect to a decreasing corresponding singular values. k(cid:88) ∆(cid:96) ≤ (cid:107)A(cid:107)2 k(cid:88) i=1 = = i=1 F F − (cid:107)B(cid:107)2 (cid:107)Ayi(cid:107)2 + d(cid:88) i=k+1 (cid:107)Ayi(cid:107)2 − (cid:107)B(cid:107)2 F (cid:107)A(cid:107)2 F = (cid:107)Ayi(cid:107)2 via Property 3 d(cid:88) i=1 (cid:107)Ayi(cid:107)2 + (cid:107)A − Ak(cid:107)2 k(cid:88) (cid:0) F F − (cid:107)B(cid:107)2 (cid:107)Ayi(cid:107)2 − (cid:107)Byi(cid:107)2(cid:1) ≤ (cid:107)A − Ak(cid:107)2 ≤ (cid:107)A − Ak(cid:107)2 F + i=1 F + k∆. k(cid:88) i=1 (cid:107)Byi(cid:107)2 < (cid:107)B(cid:107)2 via Property 2 F F + k∆ for ∆ to obtain ∆ ≤ (cid:107)A− Ak(cid:107)2 Solving ∆(cid:96) ≤ (cid:107)A− Ak(cid:107)2 and Property 2 proves Theorem 1.1: for any unit vector x we have F /((cid:96)− k), which combined with Property 1 0 ≤ (cid:107)Ax(cid:107)2 − (cid:107)Bx(cid:107)2 ≤ ∆ ≤ (cid:107)A − Ak(cid:107)2 F /((cid:96) − k). 6 Now we can show that projecting A onto Bk provides a relative error approximation. Here, yi correspond to the singular vectors of A as above and vi to the singular vectors of B in a similar fashion. (cid:107)A − πk B(A)(cid:107)2 F = (cid:107)A(cid:107)2 F = (cid:107)A(cid:107)2 F − (cid:107)Avi(cid:107)2 Pythagorean theorem j(cid:88) i=1 since via Property 1 j(cid:88) i=1 (cid:107)Bvi(cid:107)2 ≥ (cid:107)Byi(cid:107)2 via Property 2 by ∆ ≤ (cid:107)A − Ak(cid:107)2 F /((cid:96) − k) k(cid:88) i=1 ≤ (cid:107)A(cid:107)2 ≤ (cid:107)A(cid:107)2 i=1 F − (cid:107)Bvi(cid:107)2 F − (cid:107)πk B(A)(cid:107)2 k(cid:88) k(cid:88) k(cid:88) ((cid:107)Ayi(cid:107)2 − ∆) F + k∆ (cid:107)Byi(cid:107)2 F − i=1 i=1 F − F − (cid:107)Ak(cid:107)2 F + ≤ (cid:107)A(cid:107)2 = (cid:107)A(cid:107)2 ≤ (cid:107)A − Ak(cid:107)2 (cid:96) − k(cid:107)A − Ak(cid:107)2 = (cid:96) k F . (cid:96) − k(cid:107)A − Ak(cid:107)2 F This concludes the proof of Theorem 1.2. It is convenient to set (cid:96) = (cid:100)k + k/ε(cid:101) which results in the standard bound form (cid:107)A − πk F . F ≤ (1 + ε)(cid:107)A − Ak(cid:107)2 B(A)(cid:107)2 3 Running Time Analysis Each iteration of Algorithm 2.1 is dominated by the computation of the svd(B). The standard running time of this operation is O(d(cid:96)2) [30]. Since this loop is executed once per row in A the total running time would naıvely be O(nd(cid:96)2). However, note that the sketch matrix B actually has a very special form. The first (cid:96)− 1 rows of B are always orthogonal to one another. This is a result of the sketch having been computed by an svd in the previous iteration. Computing the svd of this matrix is possible in O(d(cid:96)) time using the Gu- Eisenstat procedure [31]. This requires using the Fast Multiple Method (FMM) and efficient multiplication of Cauchy matrices by vectors which is, unfortunately, far from being straight forward. It would have been convenient to use a standard svd implementation and still avoid the quadratic term in (cid:96) in the running time. We show below that this is indeed possible at the expense of doubling the space used by the algorithm. Algorithm 3.1 gives the details. Algorithm 3.1 FAST-FREQUENTDIRECTIONS Input: (cid:96), A ∈ Rn×d B ← all zeros matrix ∈ R2(cid:96)×d for i ∈ 1, . . . , n do Insert ai into a zero valued row of B if B has no zero valued rows then [U, Σ, V ] ← svd(B) C = ΣV T δ ← σ2 B ← return B (cid:112)max(Σ2 − I(cid:96)δ, 0) · V T (cid:96) # Only needed for proof notation # The last (cid:96) + 1 rows of B are zero valued. 7 Note that in Algorithm 3.1 the svd of B is computed only n/((cid:96)+1) times because the “if” statement is only triggered once every (cid:96) + 1 iterations. Thereby exhibiting a total running time of O((n/(cid:96))d(cid:96)2) = O(nd(cid:96)). The reader should revisit the proofs in Section 2.1 and observe that they still hold. Consider the values of i for which the “if” statement is triggered. It still holds that 0 (cid:22) CT [i]B[i] (cid:22) δId and that F ≥ (cid:96)δ. For the other values of i, the sketch simply aggregates the input rows and there is (cid:107)C[i](cid:107)2 clearly no incurred error in doing that. This is sufficient for the same analysis to go through and complete our discussion on the correctness of Algorithm 3.1. [i]C[i] − BT F − (cid:107)B[i](cid:107)2 3.1 Parallelization and Merging Sketches In extremely large datasets, the processing is often distributed among several machines. Each machine receives a disjoint input of raw data and is tasked with creating a small space summary. Then to get a global summary of the entire data, these summaries need to be combined. The core problem is illustrated in the case of just two machines, each process a data set A1 and A2, where A = [A1; A2], and create two summaries B1 and B2, respectively. Then the goal is to create a single summary B which approximates A using only B1 and B2. If B can achieve the same formal space/error tradeoff as each B1 to A1 in a streaming algorithm, then the summary is called a mergeable summary [5]. Here we show that the FREQUENTDIRECTIONS sketch is indeed mergeable under the following proce- dure. Consider B(cid:48) = [B1; B2] which has 2(cid:96) rows; then run FREQUENTDIRECTIONS (in particular Al- gorithm 3.1) on B(cid:48) to create sketch B with (cid:96) rows. Given that B1 and B2 satisfy Facts 1, 2, and 3 with parameters ∆1 and ∆2, respectively, we will show that B satisfies the same facts with ∆ = ∆1 + ∆2 + δ, where δ is taken from the single shrink operation used in Algorithm 3.1. This implies B automatically inherits the bounds in Theorem 1.1 and Theorem 1.2 as well. First note that B(cid:48) satisfies all facts with ∆(cid:48) = ∆1 + ∆2, by additivity of squared spectral norm along any direction x (e.g. (cid:107)B1x(cid:107)2 + (cid:107)B2x(cid:107)2 = (cid:107)B(cid:48)x(cid:107)2) and squared Frobenious norms (e.g. (cid:107)B1(cid:107)2 F + (cid:107)B2(cid:107)2 F = (cid:107)B(cid:48) F ), but has space twice as large as desired. Property 1 is straight forward for B since B only shrinks in (cid:107)2 all directions in relation to B(cid:48). For Property 2 follows by considering any unit vector x and expanding (cid:107)Bx(cid:107)2 ≥ (cid:107)B Similarly, Property 3 can be seen as (cid:107)2 F − δ(cid:96) ≤ (cid:107)A(cid:107)2 F ≤ (cid:107)B (cid:107)B(cid:107)2 x(cid:107)2 − δ ≥ (cid:107)Ax(cid:107)2 − (∆1 + ∆2) − δ = (cid:107)Ax(cid:107)2 − ∆. (cid:48) (cid:48) F − (∆1 + ∆2)(cid:96) − δ(cid:96) = (cid:107)A(cid:107)2 F − ∆(cid:96). This property trivially generalizes to any number of partitions of A. It is especially useful when the matrix (or data) is distributed across many machines. In this setting, each machine can independently compute a local sketch. These sketches can then be combined in an arbitrary order using FREQUENTDIRECTIONS. 3.2 Worst case update time The total running time of the Algorithm 3.1 is O(nd(cid:96)) and the amortized running time per row update is O(d(cid:96)). However, the worst case update time is still Ω(d(cid:96)2) in those cases where the svd is computed. Using the fact that FREQUENTDIRECTIONS sketches are mergeable, we can actually use a simple trick to guarantee a worst case O(d(cid:96)) update time. The idea is to double the space usage (once again) and hold two sketches, one in ‘active’ mode and one in svd ‘maintenance’ mode. For any row in the input, we first add it to the active sketch and then spend O(d(cid:96)) floating point operations in completing the svd of the sketch in maintenance mode. After (cid:96) updates, the active sketch runs out of space and must go into maintenance mode. But, in the same time, a total of O(d(cid:96)2) floating point operations were invested in the inactive sketch which completed its svd computation. At this point, we switch the sketch roles and continue. Once the entire matrix was processed, we combine the two sketches using their mergeable property. 8 4 Space Lower Bounds In this section we show that FREQUENTDIRECTIONS is space optimal with respect to the guaranteed ac- curacy. We present nearly-matching lower bounds for each case. We show the number of bits needed is equivalent to d times the number of rows FREQUENTDIRECTIONS requires. We first prove Theorem 1.3 showing the covariance error bound in Theorem 1.1 is nearly tight, regardless of streaming issues. Theorem 4.1. Let B be a (cid:96) × d matrix approximating a n × d matrix A such that (cid:107)AT A − BT B(cid:107)2 ≤ F /((cid:96)−k). For any algorithm with input as an n×d matrix A, the space complexity of representing (cid:107)A−Ak(cid:107)2 B is Ω(d(cid:96)) bits of space. Proof. For intuition, consider the set of matrices A such that for all A ∈ A we have AT A is an (cid:96)/4 dimensional projection matrix. For such matrices (cid:107)AT A(cid:107) = 1 and (cid:107)A − Ak(cid:107)2 F /((cid:96) − k) = 1/4. The condition (cid:107)AT A − BT B(cid:107)2 ≤ 1/4 means that BT B gets “close to” AT A which should intuitively require roughly Θ(d(cid:96)) bits (which are also sufficient to represent AT A). j Aj(cid:107) > 1/2 for all Ai, Aj ∈ A. Consider also that the sketching algorithm computes B which corresponds to j Aj(cid:107) > 1/2 there could be only one index such Ai ∈ A. Since (cid:107)AT A − BT B(cid:107)2 ≤ 1/4 and (cid:107)AT i Ai − BT B(cid:107) ≤ 1/4 by the triangle inequality. Therefore, since B indexes uniquely into A, it must that (cid:107)AT be that encoding B requires at least log(A) bits. To complete the proof we point out that there exists a set A for which (cid:107)AT j Aj(cid:107) > 1/2 for all Ai, Aj ∈ A and log(A) = Ω(d(cid:96)). This is proven by Kapralov and Talwar [34] using a result of Absil, Edelman, and Koev [2]. In [34] Corollary 5.1, setting δ = 1/2 and k = (cid:96)/4 (assuming d ≥ (cid:96)) yields that A = 2Ω((cid:96)d) and completes the proof. To make this argument hold mathematically, consider a set of matrices A such that (cid:107)AT i Ai − AT i Ai − AT i Ai − AT The consequence of Theorem 4.1 is that the space complexity of FREQUENTDIRECTIONS is optimal regardless of streaming issues. In other words, any algorithm satisfying (cid:107)AT A−BT B(cid:107)2 ≤ (cid:107)A−Ak(cid:107)2 F /((cid:96)− k) must use space Ω((cid:96)d) since this is the information lower bound for representing B; or any algorithm F must have (cid:96) = Ω(k + 1/ε) and hence use Ω(d(cid:96)) = Ω(dk + d/ε) satisfying (cid:107)AT A− BT B(cid:107)2 ≤ ε(cid:107)A− Ak(cid:107)2 space. Next we will prove Theorem 1.4, showing the subspace bound (cid:107)A − πk F ≤ (1 + ε)(cid:107)A − Ak(cid:107)2 F preserved by Theorem 1.2 with (cid:96) = k + k/ε rows, and hence O(kd/ε) space, is also nearly tight in the row-update streaming setting. In fact it shows that finding B such that (cid:107)A− AB†B(cid:107)F = (cid:107)A− πB(A)(cid:107)F ≤ (1+ε)(cid:107)A−Ak(cid:107)F requires Ω(dk/ε) space in a row-update streaming setting. This requires careful invocation of more machinery from communication complexity common in streaming lower bounds, and hence we start with a simple and weaker lower bound, and then some intuition before providing the full construction. B(A)(cid:107)2 4.1 A Simple Lower Bound We start with a simple intuitive lemma showing an Ω(kd) lower bound, which we will refer to. We then prove our main Ω(kd/) lower bound. Lemma 4.1. Any streaming algorithm which, for every input A, with constant probability (over its internal randomness) succeeds in outputting a matrix R for which (cid:107)A − AR†R(cid:107)F ≤ (1 + ε)(cid:107)A − Ak(cid:107)F must use Ω(kd) bits of space. Proof. Let S be the set of k-dimensional subspaces over the vector space GF (2)d, where GF (2) denotes the finite field of 2 elements with the usual modulo 2 arithmetic. The cardinality of S is known [41] to be (2d − 1)(2d − 1)··· (2d−k+1 − 1) (2k − 1)(2k−1 − 1)··· 1 ≥ 2dk/2−k2 ≥ 2dk/6, where the inequalities assume that k ≤ d/3. 9 Now let A1 and A2 be two k × d matrices with entries in {0, 1} whose rows span two different k- span of the rows of A2. If A1 and A2 had the same row span over Rd, then v =(cid:80) dimensional subspaces of GF (2)d. We first claim that the rows also span two different k-dimensional subspaces of Rd. Indeed, consider a vector v ∈ GF (2)d which is in the span of the rows of A1 but not in the i , where the wi ∈ R i wiA2 and A2 i have integer coordinates, we can assume the wi are rational, since the irrational parts must cancel. By scaling by the least common multiple of the denominators of the wi, we obtain that i denotes the i-th row of A2. Since v has integer coordinates and the A2 (cid:88) i α · v = βiA2 i , (1) i βiA2 that αv = (cid:80) where α, β1, . . . , βk are integers. We can assume that the greatest common divisor (gcd) of α, β1, . . . , βk is 1, otherwise the same conclusion holds after we divide α, β1, . . . , βk by the gcd. Note that (1) implies i mod 2, i.e., when we take each of the coordinates modulo 2. Since the βi cannot all be divisible by 2 (since α would then be odd and so by the gcd condition the left hand side would contain a vector with at least one odd coordinate, contradicting that the right hand side is a vector with even coordinates), and the rows of A2 form a basis over GF (2d), the right hand side must be non-zero, which implies that α = 1 mod 2. This implies that v is in the span of the rows of A2 over GF (2d), a contradiction. It follows that there are at least 2dk/6 distinct k-dimensional subspaces of Rd spanned by the rows of the set of binary k × d matrices A. For each such A, (cid:107)A− Ak(cid:107)F = 0 and so the row span of R must agree with the row span of A if the streaming algorithm succeeds. It follows that the output of the streaming algorithm can be used to encode log2 2dk/6 = Ω(dk) bits of information. Indeed, if A is chosen at random from this set of at least 2dk/6 binary matrices, and Z is a bit indicating if the streaming algorithm succeeds, then R ≥ H(R) ≥ I(R; AZ) ≥ (2/3)I(R; A Z = 1) ≥ (2/3)(dk/6) = Ω(dk), where R denotes the expected length of the encoding of R, H is the entropy function, and I is the mutual information. For background on information theory, see [15]. This completes the proof. 4.2 Intuition for Main Lower Bound The only other lower bounds for streaming algorithms for low rank approximation that we know of are due to Clarkson and Woodruff [13]. As in their work, we use the Index problem in communication complexity to establish our bounds, which is a communication game between two players Alice and Bob, holding a string x ∈ {0, 1}r and an index i ∈ [r] =: {1, 2, . . . , r}, respectively. In this game Alice sends a single message to Bob who should output xi with constant probability. It is known (see, e.g., [36]) that this problem requires Alice’s message to be Ω(r) bits long. If Alg is a streaming algorithm for low rank approximation, and Alice can create a matrix Ax while Bob can create a matrix Bi (depending on their respective inputs x and i), then if from the output of Alg on the concatenated matrix [Ax; Bi] Bob can output xi with constant probability, then the memory required of Alg is Ω(r) bits, since Alice’s message is the state of Alg after running it on Ax. The main technical challenges are thus in showing how to choose Ax and Bi, as well as showing how the output of Alg on [Ax; Bi] can be used to solve Index. This is where our work departs significantly from that of Clarkson and Woodruff [13]. Indeed, a major challenge is that in Theorem 1.4, we only require the output to be the matrix R, whereas in Clarkson and Woodruff’s work from the output one can reconstruct AR†R. This causes technical complications, since there is much less information in the output of the algorithm to use to solve the communication game. The intuition behind the proof of Theorem 1.4 is that given a 2 × d matrix A = [1, x; 1, 0d], where x is a random unit vector, then if P = R†R is a sufficiently good projection matrix for the low rank approximation 10 problem on A, then the second row of AP actually reveals a lot of information about x. This may be counterintuitive at first, since one may think that [1, 0d; 1, 0d] is a perfectly good low rank approximation. However, it turns out that [1, x/2; 1, x/2] is a much better low rank approximation in Frobenius norm, and even this is not optimal. Therefore, Bob, who has [1, 0d] together with the output P , can compute the second row of AP , which necessarily reveals a lot of information about x (e.g., if AP ≈ [1, x/2; 1, x/2], its second row would reveal a lot of information about x), and therefore one could hope to embed an instance of the Index problem into x. Most of the technical work is about reducing the general problem to this 2 × d primitive problem. 4.3 Proof of Main Lower Bound for Preserving Subspaces Now let c > 0 be a small constant to be determined. We consider the following two player problem between Alice and Bob: Alice has a ck/ε × d matrix A which can be written as a block matrix [I, R], where I is the ck/ε × ck/ε identity matrix, and R is a ck/ε × (d − ck/ε) matrix in which the entries are in {−1/(d − ck/ε)1/2, +1/(d − ck/ε)1/2}. Here [I, R] means we append the columns of I to the left of the columns of R; see Figure 1. Bob is given a set of k standard unit vectors ei1, . . . , eik, for distinct i1, . . . , ik ∈ [ck/ε] = {1, 2, . . . , ck/ε}. Here we need c/ε > 1, but we can assume ε is less than a sufficiently small constant, as otherwise we would just need to prove an Ω(kd) lower bound, which is established by Lemma 4.1. 1/4 1/3 ν,1/3 (Index) = Ω(r). We use the following two-player problem Index in order to lower bound D1−way 1/4 µ,1/4 (f ). µ,1/4 (f ) = Ω(kd/ε), where D1−way Let B be the matrix [A; ei1, . . . , eik ] obtained by stacking A on top of the vectors ei1, . . . , eik. The goal is for Bob to output a rank-k projection matrix P ∈ Rd×d for which (cid:107)B − BP(cid:107)F ≤ (1 + ε)(cid:107)B − Bk(cid:107)F . Denote this problem by f. We will show the randomized 1-way communication complexity of this prob- lem R1−way (f ), in which Alice sends a single message to Bob and Bob fails with probability at most 1/4, is Ω(kd/ε) bits. More precisely, let µ be the following product distribution on Alice and Bob’s inputs: the entries of R are chosen independently and uniformly at random in {−1/(d− ck/ε)1/2, +1/(d− ck/ε)1/2}, while {i1, . . . , ik} is a uniformly random set among all sets of k distinct indices in [ck/ε]. We will show that D1−way µ,1/4 (f ) denotes the minimum communication cost over all deter- ministic 1-way (from Alice to Bob) protocols which fail with probability at most 1/4 when the inputs are distributed according to µ. By Yao’s minimax principle (see, e.g., [37]), R1−way (f ) ≥ D1−way µ,1/4 (f ). In this problem Alice is given a string x ∈ {0, 1}r, while Bob is given an index i ∈ [r]. Alice sends a single message to Bob, who needs to output xi with probability at least 2/3. Again by Yao’s minimax principle, we have that (Index) ≥ D1−way R1−way ν,1/3 (Index), where ν is the distribution for which x and i are chosen independently and uniformly at random from their respective domains. The following is well-known. Fact 4.1. [36] D1−way Theorem 4.2. For c a small enough positive constant, and d ≥ k/ε, we have D1−way Proof. We will reduce from the Index problem with r = (ck/ε)(d − ck/ε). Alice, given her string x to Index, creates the ck/ε × d matrix A = [I, R] as follows. The matrix I is the ck/ε × ck/ε identity matrix, while the matrix R is a ck/ε × (d − ck/ε) matrix with entries in {−1/(d − ck/ε)1/2, +1/(d − ck/ε)1/2}. For an arbitrary bijection between the coordinates of x and the entries of R, Alice sets a given entry in R to −1/(d − ck/ε)1/2 if the corresponding coordinate of x is 0, otherwise Alice sets the given entry in R to +1/(d − ck/ε)1/2. In the Index problem, Bob is given an index, which under the bijection between coordinates of x and entries of R, corresponds to being given a row index i and an entry j in the i-th row of R that he needs to recover. He sets i(cid:96) = i for a random (cid:96) ∈ [k], and chooses k − 1 distinct and random indices ij ∈ [ck/ε] \ {i(cid:96)}, for j ∈ [k] \ {(cid:96)}. Observe that if (x, i) ∼ ν, then (R, i1, . . . , ik) ∼ µ. Suppose µ,1/4 (f ) = Ω(dk/ε). 11 Figure 1: Illustration of matrix B used for lower bound construction. there is a protocol in which Alice sends a single message to Bob who solves f with probability at least 3/4 under µ. We show that this can be used to solve Index with probability at least 2/3 under ν. The theorem will follow by Fact 4.1. Consider the matrix B which is the matrix A stacked on top of the rows ei1, . . . , eik, in that order, so that B has ck/ε + k rows. We proceed to lower bound (cid:107)B − BP(cid:107)2 Fact 4.2. ((2.4) of [50]) Let A be an m×n matrix with i.i.d. entries which are each +1/√n with probability 1/2 and −1/√n with probability 1/2, and suppose m/n < 1. Then for all t > 0, F in a certain way, which will allow our reduction to Index to be carried out. We need the following fact: Pr[(cid:107)A(cid:107)2 > 1 + t +(cid:112) m/n] ≤ αe −α(cid:48)nt3/2 . where α, α(cid:48) > 0 are absolute constants. Here (cid:107)A(cid:107)2 is the operator norm supx We apply Fact 4.2 to the matrix R, which implies, Pr[(cid:107)R(cid:107)2 > 1 + √c +(cid:112)(ck/ε)/(d − (ck/ε))] ≤ αe and using that d ≥ k/ε and c > 0 is a sufficiently small constant, this implies (cid:107)Ax(cid:107) (cid:107)x(cid:107) of A. −α(cid:48)(d−(ck/ε))c3/4 −βd, Pr[(cid:107)R(cid:107)2 > 1 + 3√c] ≤ e 2 ≤ 1 + 7√c, which we condition on. where β > 0 is an absolute constant (depending on c). Note that for c > 0 sufficiently small, (1 + 3√c)2 ≤ 1 + 7√c. Let E be the event that (cid:107)R(cid:107)2 We partition the rows of B into B1 and B2, where B1 contains those rows whose projection onto the first ck/ε coordinates equals ei for some i /∈ {i1, . . . , ik}. Note that B1 is (ck/ε − k) × d and B2 is 2k × d. Here, B2 is 2k × d since it includes the rows in A indexed by i1, . . . , ik, together with the rows ei1, . . . , eik. Let us also partition the rows of R into RT and RS, so that the union of the rows in RT and in RS is equal to R, where the rows of RT are the rows of R in B1, and the rows of RS are the non-zero rows of R in B2 (note that k of the rows are non-zero and k are zero in B2 restricted to the columns in R). , (2) 12 111111100000000000000000000000000000B2B1STck/"kck/"dck/"RSRTRRAliceBob Lemma 4.2. For any unit vector u, write u = uR + uS + uT , where S = {i1, . . . , ik}, T = [ck/ε] \ S, and R = [d] \ [ck/ε], and where uA for a set A is 0 on indices j /∈ A. Then, conditioned on E occurring, (cid:107)Bu(cid:107)2 ≤ (1 + 7√c)(2 − (cid:107)uT(cid:107)2 − (cid:107)uR(cid:107)2 + 2(cid:107)uS + uT(cid:107)(cid:107)uR(cid:107)). Proof. Let C be the matrix consisting of the top ck/ε rows of B, so that C has the form [I, R], where I is a ck/ε×ck/ε identity matrix. By construction of B, (cid:107)Bu(cid:107)2 = (cid:107)uS(cid:107)2 +(cid:107)Cu(cid:107)2. Now, Cu = uS +uT +RuR, and so (cid:107)Cu(cid:107)2 2 = (cid:107)uS + uT(cid:107)2 + (cid:107)RuR(cid:107)2 + 2(us + uT )T RuR ≤ (cid:107)uS + uT(cid:107)2 + (1 + 7√c)(cid:107)uR(cid:107)2 + 2(cid:107)uS + uT(cid:107)(cid:107)RuR(cid:107) ≤ (1 + 7√c)((cid:107)uS(cid:107)2 + (cid:107)uT(cid:107)2 + (cid:107)uR(cid:107)2) + (1 + 3√c)2(cid:107)uS + uT(cid:107)(cid:107)uR(cid:107) ≤ (1 + 7√c)(1 + 2(cid:107)uS + uT(cid:107)(cid:107)uR(cid:107)), and so (cid:107)Bu(cid:107)2 ≤ (1 + 7√c)(1 + (cid:107)uS(cid:107)2 + 2(cid:107)uS + uT(cid:107)(cid:107)uR(cid:107)) = (1 + 7√c)(2 − (cid:107)uR(cid:107)2 − (cid:107)uT(cid:107)2 + 2(cid:107)uS + UT(cid:107)(cid:107)uR(cid:107)). (cid:112) 2 + 2y = 0. We will also make use of the following simple but tedious fact. (cid:113) Fact 4.3. For x ∈ [0, 1], the function f (x) = 2x√1 − x2 − x2 is maximized when x = 1/2 − √5/10. We define ζ to be the value of f (x) at its maximum, where ζ = 2/√5 + √5/10 − 1/2 ≈ .618. (cid:112)1 − y2 + y2, or equivalently (cid:112)1 − y2 + y2. Differentiating this expression and equating to 0, we have Proof. Setting y2 = 1 − x2, we can equivalently maximize f (y) = −1 + 2y g(y) = 2y 2y2(cid:112)1 − y2 Multiplying both sides by(cid:112)1 − y2 one obtains the equation 4y2 − 2 = 2y sides, after some algebra one obtains 5y4 − 5y2 + 1 = 0. Using the quadratic formula, we get that the maximizer satisfies y2 = 1/2 + √5/10, or x2 = 1/2 − √5/10. Corollary 4.1. Conditioned on E occurring, (cid:107)B(cid:107)2 Proof. By Lemma 4.2, for any unit vector u, (cid:112)1 − y2, and squaring both 2 ≤ (1 + 7√c)(2 + ζ). 1 − y2 − (cid:107)Bu(cid:107)2 ≤ (1 + 7√c)(2 − (cid:107)uT(cid:107)2 − (cid:107)uR(cid:107)2 + 2(cid:107)uS + uT(cid:107)(cid:107)uR(cid:107)). when (cid:107)uT(cid:107) = 0, for which it equals (1 + 7√c)(2 − (cid:107)uR(cid:107)2 + 2(cid:112)1 − (cid:107)uR(cid:107)2(cid:107)uR(cid:107)), and setting (cid:107)uR(cid:107) to Suppose we replace the vector uS + uT with an arbitrary vector supported on coordinates in S with the same norm as uS + uT . Then the right hand side of this expression cannot increase, which means it is maximized equal the x in Fact 4.3, we see that this expression is at most (1 + 7√c)(2 + ζ). Write the projection matrix P output by the streaming algorithm as U U T , where U is d × k with or- thonormal columns ui (note that R†R = P ). Applying Lemma 4.2 and Fact 4.3 to each of the columns ui, 13 we have: (cid:107)BP(cid:107)2 F = (cid:107)BU(cid:107)2 i=1 i=1 F = (cid:107)Bui(cid:107)2 k(cid:88) k(cid:88) ≤ (1 + 7√c) (2 − (cid:107)ui k(cid:88) = (1 + 7√c)(2k − ((cid:107)ui k(cid:88) = (1 + 7√c)(2k − ((cid:107)ui k(cid:88) ≤ (1 + 7√c)(2k − ((cid:107)ui T(cid:107)2) + kζ) k(cid:88) = (1 + 7√c)((2 + ζ)k − T(cid:107)2) + T(cid:107)2). (cid:107)ui i=1 i=1 i=1 i=1 i=1 T(cid:107)(cid:107)ui R(cid:107)) S + ui R(cid:107)2 + 2(cid:107)ui T(cid:107)2 − (cid:107)ui k(cid:88) (2(cid:107)ui (cid:113) k(cid:88) 1 − (cid:107)ui T(cid:107)2) + S + ui i=1 (2 T(cid:107)(cid:107)ui R(cid:107) − (cid:107)ui R(cid:107)2)) R(cid:107)2(cid:107)ui R(cid:107) − (cid:107)ui R(cid:107)2)) (3) (4) (5) (6) Using the matrix Pythagorean theorem, we thus have, (cid:107)B − BP(cid:107)2 F = (cid:107)B(cid:107)2 F − (cid:107)BP(cid:107)2 F k(cid:88) ≥ 2ck/ε + k − (1 + 7√c)((2 + ζ)k − (cid:107)ui ≥ 2ck/ε + k − (1 + 7√c)(2 + ζ)k + (1 + 7√c) i=1 T(cid:107)2) using (cid:107)B(cid:107)2 k(cid:88) (cid:107)ui T(cid:107)2. i=1 F = 2ck/ε + k We now argue that (cid:107)B − BP(cid:107)2 F . To do so, we create a matrix Bk of rank-k and bound (cid:107)B − Bk(cid:107)2 F cannot be too large if Alice and Bob succeed in solving f. First, we need to upper bound (cid:107)B − Bk(cid:107)2 F . Matrix Bk will be 0 on the rows in B1. We can group the rows of B2 into k pairs so that each pair has the form ei + vi, ei, where i ∈ [ck/ε] and vi is a unit vector supported on [d] \ [ck/ε]. We let Yi be the optimal (in Frobenius norm) rank-1 approximation to the matrix [ei + vi; ei]. By direct computation 4 the maximum squared singular value of this matrix is 2 + ζ. Our matrix Bk then consists of a single Yi for each pair in B2. Observe that Bk has rank at most k and (cid:107)B − Bk(cid:107)2 F ≤ 2ck/ε + k − (2 + ζ)k, F ≤ (cid:107)B − Bk(cid:107)2 Therefore, if Bob succeeds in solving f on input B, then, (cid:107)B − BP(cid:107)2 F ≤ (1 + ε)(2ck/ε + k − (2 + ζ)k) ≤ 2ck/ε + k − (2 + ζ)k + 2ck. Comparing (4) and (5), we arrive at, conditioned on E: k(cid:88) i=1 (cid:107)ui T(cid:107)2 ≤ 1 1 + 7√c · (7√c(2 + ζ)k + 2ck) ≤ c1k, where c1 > 0 is a constant that can be made arbitrarily small by making c > 0 arbitrarily small. 4For an online SVD calculator, see http://www.bluebit.gr/matrix-calculator/ 14 Since P is a projector, (cid:107)BP(cid:107)F = (cid:107)BU(cid:107)F . Write U = U + ¯U, where the vectors in U are supported on T , and the vectors in ¯U are supported on [d] \ T . We have, (cid:107)B U(cid:107)2 F ≤ (cid:107)B(cid:107)2 2c1k ≤ (1 + 7√c)(2 + ζ)c1k ≤ c2k, where the first inequality uses (cid:107)B U(cid:107)F ≤ (cid:107)B(cid:107)2(cid:107) U(cid:107)F and (6), the second inequality uses that event E occurs, and the third inequality holds for a constant c2 > 0 that can be made arbitrarily small by making the constant c > 0 arbitrarily small. Combining with (5) and using the triangle inequality, (cid:107)B ¯U(cid:107)F ≥ (cid:107)BP(cid:107)F − (cid:107)B U(cid:107)F c2k ≥ (cid:107)BP(cid:107)F − = (cid:112) (cid:113) (cid:112) (cid:112)(2 + ζ)k − 2ck − F − (cid:107)B − BP(cid:107)2 (cid:112)(2 + ζ)k − c3k, (cid:107)B(cid:107)2 ≥ ≥ F − c2k (cid:112) c2k using the triangle inequality using our bound on (cid:107)B U(cid:107)2 by the matrix Pythagorean theorem F by (5) (7) where c3 > 0 is a constant that can be made arbitrarily small for c > 0 an arbitrarily small constant (note that c2 > 0 also becomes arbitrarily small as c > 0 becomes arbitrarily small). Hence, (cid:107)B ¯U(cid:107)2 F ≥ (2+ζ)k−c3k, and together with Corollary 4.1, that implies (cid:107) ¯U(cid:107)2 F ≥ k − c4k for a constant c4 that can be made arbitrarily small by making c > 0 arbitrarily small. F . Consider any column ¯u of ¯U, and Our next goal is to show that (cid:107)B2 ¯U(cid:107)2 write it as ¯uS + ¯uR. Hence, F is almost as large as (cid:107)B ¯U(cid:107)2 (cid:107)B ¯u(cid:107)2 = (cid:107)RT ¯uR(cid:107)2 + (cid:107)B2 ¯u(cid:107)2 ≤ (cid:107)RT ¯uR(cid:107)2 + (cid:107)¯uS + RS ¯uR(cid:107)2 + (cid:107)¯uS(cid:107)2 = (cid:107)R¯uR(cid:107)2 + 2(cid:107)¯uS(cid:107)2 + 2¯uT ≤ 1 + 7√c + (cid:107)¯uS(cid:107)2 + 2(cid:107)¯uS(cid:107)(cid:107)RS ¯uR(cid:107) S RS ¯uR using B1 ¯u = RT ¯uR by definition of the components using the Pythagorean theorem using (cid:107)R¯uR(cid:107)2 ≤ (1 + 7√c)(cid:107)¯uR(cid:107)2 and (cid:107)¯uR(cid:107)2 + (cid:107)¯uS(cid:107)2 ≤ 1 (also using Cauchy-Schwarz to bound the other term). We thus have, Suppose (cid:107)RS ¯uR(cid:107) = τ(cid:107)¯uR(cid:107) for a value 0 ≤ τ ≤ 1 + 7√c. Then (cid:107)B ¯u(cid:107)2 ≤ 1 + 7√c + (cid:107)¯uS(cid:107)2 + 2τ(cid:107)¯uS(cid:107) (cid:112) 1 − (cid:107)¯uS(cid:107)2. (cid:112) (cid:107)B ¯u(cid:107)2 ≤ 1 + 7√c + (1 − τ )(cid:107)¯uS(cid:107)2 + τ ((cid:107)¯uS(cid:107)2 + 2(cid:107)¯uS(cid:107) ≤ 1 + 7√c + (1 − τ ) + τ (1 + ζ) by Fact 4.3 ≤ 2 + τ ζ + 7√c, 1 − (cid:107)¯uS(cid:107)2) and hence, letting τ1, . . . , τk denote the corresponding values of τ for the k columns of ¯U, we have Comparing the square of (7) with (9), we have k(cid:88) i=1 τi. (cid:107)B ¯U(cid:107)2 F ≤ (2 + 7√c)k + ζ k(cid:88) τi ≥ k − c5k, i=1 15 (8) (9) (10) where c5 > 0 is a constant that can be made arbitrarily small by making c > 0 an arbitrarily small constant. Now, (cid:107) ¯U(cid:107)2 F ≥ k − c4k as shown above, while since (cid:107)Rs ¯uR(cid:107) = τi(cid:107)¯uR(cid:107) if ¯uR is the i-th column of ¯U, by (10) we have (cid:107)RS ¯UR(cid:107)2 F ≥ (1 − c6)k (11) for a constant c6 that can be made arbitrarily small by making c > 0 an arbitarily small constant. F + (cid:107)RS ¯UR(cid:107)2 Now (cid:107)R ¯UR(cid:107)2 rows of R are the concatenation of rows of RS and RT , so combining with (11), we arrive at F ≤ (1 + 7√c)k since event E occurs, and (cid:107)R ¯UR(cid:107)2 F = (cid:107)RT ¯UR(cid:107)2 F since the (cid:107)RT ¯UR(cid:107)2 F ≤ c7k, for a constant c7 > 0 that can be made arbitrarily small by making c > 0 arbitrarily small. Combining the square of (7) with (12), we thus have F = (cid:107)B ¯U(cid:107)2 F = (cid:107)B ¯U(cid:107)2 F − (cid:107)B1 ¯U(cid:107)2 (cid:107)B2 ¯U(cid:107)2 ≥ (2 + ζ)k − c8k, F − (cid:107)RT ¯UR(cid:107)2 F ≥ (2 + ζ)k − c3k − c7k (12) (13) (14) where the constant c8 > 0 can be made arbitrarily small by making c > 0 arbitrarily small. By the triangle inequality, (cid:107)B2U(cid:107)F ≥ (cid:107)B2 ¯U(cid:107)F − (cid:107)B2 U(cid:107)F ≥ ((2 + ζ)k − c8k)1/2 − (c2k)1/2. Hence, F F = 3k,(15) using (14), (cid:107)B2(cid:107)2 F − (cid:107)B2U(cid:107)2 F − ((cid:107)B2 ¯U(cid:107)F − (cid:107)B2 U(cid:107)F )2 (cid:107)B2 − B2P(cid:107)F = ≤ ≤ by matrix Pythagorean, (cid:107)B2U(cid:107)F = (cid:107)B2P(cid:107)F by triangle inequality (cid:113) (cid:113) (cid:107)B2(cid:107)2 (cid:113) (cid:107)B2(cid:107)2 3k − (((2 + ζ)k − c8k)1/2 − (c2k)1/2)2 or equivalently, (cid:107)B2 − B2P(cid:107)2 F ≤ 3k − ((2 + ζ)k − c8k) − (c2k) + 2k(((2 + ζ) − c8)c2)1/2 ≤ (1 − ζ)k + c8k + 2k(((2 + ζ) − c8)c2)1/2 ≤ (1 − ζ)k + c9k for a constant c9 > 0 that can be made arbitrarily small by making the constant c > 0 small enough. This intuitively says that P provides a good low rank approximation for the matrix B2. Notice that by (15), F − (cid:107)B2 − B2P(cid:107)2 (16) Now B2 is a 2k × d matrix and we can partition its rows into k pairs of rows of the form Z(cid:96) = (ei(cid:96) + Ri(cid:96), ei(cid:96)), for (cid:96) = 1, . . . , k. Here we abuse notation and think of Ri(cid:96) as a d-dimensional vector, its first ck/ε coordinates set to 0. Each such pair of rows is a rank-2 matrix, which we abuse notation and call ZT (cid:96) . By direct computation 5 ZT (cid:96) has squared maximum singular value 2 + ζ. We would like to argue that the projection of P onto the row span of most Z(cid:96) has length very close to 1. To this end, for each Z(cid:96) consider the orthonormal basis V T (cid:96),1, vT (cid:96),2 be these two right singular vectors with corresponding singular values σ1 and σ2 (which will be the same F which intuitively measures how for all (cid:96), see below). We are interested in the quantity ∆ =(cid:80)k (cid:96) of right singular vectors for its row space (which is span(ei(cid:96), Ri(cid:96))). We let vT F ≥ 3k − (1 − ζ)k − c9k ≥ (2 + ζ)k − c9k. much of P gets projected onto the row spaces of the ZT (cid:96) . Lemma 4.3. Conditioned on event E, ∆ ∈ [k − c10k, k + c10k], where c10 > 0 is a constant that can be made arbitrarily small by making c > 0 arbitrarily small. (cid:107)B2P(cid:107)2 F = (cid:107)B2(cid:107)2 (cid:96)=1 (cid:107)V T (cid:96) P(cid:107)2 5We again used the calculator at http://www.bluebit.gr/matrix-calculator/ 16 Proof. For any unit vector u, consider(cid:80)k E, (cid:107)RSuR(cid:107)2 ≤ (1 + 7√c)(cid:107)uR(cid:107)2. Hence,(cid:80)k F = (cid:80)k (cid:96) u(cid:107)2. This is equal to (cid:107)uS(cid:107)2 + (cid:107)RSuR(cid:107)2. Conditioned on (cid:96) u(cid:107)2 ≤ 1 + 7√c, and consequently, ∆ ≤ k(1 + 7√c). On the other hand, (cid:107)B2P(cid:107)2 F . Since (cid:107)ZT 2 ≤ 2 + ζ, it follows by (16) that ∆ ≥ The lemma now follows since √c and c9 can be made arbitrarily small by making the constant c > 0 k − (c9/(2 + ζ))k, as otherwise ∆ would be too small in order for (16) to hold. small enough. (cid:96)=1 (cid:107)V T (cid:96)=1 (cid:107)V T (cid:96) P(cid:107)2 (cid:96)=1 (cid:107)ZT (cid:96) (cid:107)2 We have the following corollary. Corollary 4.2. Conditioned on event E, for a 1 − √c9 + 2c10 fraction of (cid:96) ∈ [k], (cid:107)V T for a 99/100 fraction of (cid:96) ∈ [k], we have (cid:107)V T arbitrarily small by making the constant c > 0 arbitrarily small. F ≤ 1 + c11, and F ≥ 1− c11, where c11 > 0 is a constant that can be made (cid:96) P(cid:107)2 (cid:96) P(cid:107)2 Proof. For the first part of the corollary, observe that 1(cid:107)vT (cid:96),1P(cid:107)2 + σ2 (cid:96),2 are right singular vectors of V T (cid:96) , and σ1, σ2 are its singular values, with σ2 where vT 2 = 1 − ζ. Since ∆ ≤ k + c10k by Lemma 4.3, we have σ2 (cid:96),2P(cid:107)2, (cid:96),1 and vT F = σ2 2(cid:107)vT 1 = 2 + ζ and (cid:107)ZT (cid:96) P(cid:107)2 k(cid:88) (cid:96)=1 (cid:107)vT (cid:96),1P(cid:107)2 + (cid:107)vT (cid:96),2P(cid:107)2 ≤ k + c10k. If(cid:80)k (cid:96)=1 (cid:107)vT (cid:96),2P(cid:107)2 ≥ (c9 + 2c10)k, then (cid:107)B2P(cid:107)2 F ≤ (cid:107)ZT (cid:96) P(cid:107)2 F (cid:88) (cid:96) F ≤ 1 + √c9 + 2c10. ≤ (2 + ζ)(k + c10k − 2c10k − c9k) + (1 − ζ)(2c10k + c9k) ≤ (2 + ζ)(k − c9k) − (2 + ζ)c10k + (1 − ζ)(2c10k + c9k) ≤ (2 + ζ)k − 2c9k − ζc9k − 2c10k − ζc10k + 2c10k + c9k − 2ζc10k − ζc9k ≤ (2 + ζ)k − (1 + 2ζ)c9k + −3ζc10k < (2 + ζ)k − c9k which is a contradiction to (16). Hence,(cid:80)k (cid:96),2P(cid:107)2 ≤ (c9 + 2c10)k. This means by a Markov bound (cid:96)=1 (cid:107)vT that a 1 − √c9 + 2c10 fraction of (cid:96) satisfy (cid:107)vT (cid:96),2P(cid:107)2 ≤ √c9 + 2c10, which implies that for this fraction that (cid:96) P(cid:107)2 (cid:107)V T For the second part of the corollary, suppose at most 99k/100 different (cid:96) satisfy (cid:107)V T (cid:96) P(cid:107)2 F > 1 − 200√c9 + 2c10. By the previous part of the corollary, at most √c9 + 2c10k of these (cid:96) can satisfy (cid:107)V T (cid:96) P(cid:107)2 F > 1 + √c9 + 2c10. Hence, since (cid:107)V T ∆ < 2√c9 + 2c10k + (1 + √c9 + 2c10)(99/100 − √c9 + 2c10)k + (1 − 200√c9 + 2c10)k/100 ≤ 2√c9 + 2c10k + 99k/100 + 99k√c9 + 2c10/100 − k√c9 + 2c10 + k/100 − 2√c9 + 2c10k ≤ k − √c9 + 2c10k/100 ≤ k − √2c10k/100 < k − c10k, F ≤ 2, (cid:96) P(cid:107)2 where the final inequality follows for c10 > 0 a sufficiently small constant. This is a contradiction to F > 1 − 200√c9 + 2c10. Letting c11 = Lemma 4.3. Hence, at least 99k/100 different (cid:96) satisfy (cid:107)V T 200√c9 + 2c10, we see that c11 can be made an arbitrarily small constant by making the constant c > 0 arbitrarily small. This completes the proof. (cid:96) P(cid:107)2 17 Recall that Bob holds i = i(cid:96) for a random (cid:96) ∈ [k]. It follows (conditioned on E) by a union bound that with probability at least 49/50, (cid:107)V T F ∈ [1 − c11, 1 + c11], which we call the event F and condition (cid:96) P(cid:107)2 on. We also condition on event G that (cid:107)ZT F ≥ (2 + ζ) − c12, for a constant c12 > 0 that can be made (cid:96) P(cid:107)2 arbitrarily small by making c > 0 an arbitrarily small constant. Combining the first part of Corollary 4.2 together with (16), event G holds with probability at least 99.5/100, provided c > 0 is a sufficiently small constant. By a union bound it follows that E, F, and G occur simultaneously with probability at least 49/51. As (cid:107)ZT 1 = 1 − ζ, events E,F, and G imply (cid:96) P(cid:107)2 (cid:96),1P(cid:107)2 ≥ 1 − c13, where c13 > 0 is a constant that can be made arbitrarily small by making the that (cid:107)vT (cid:96),1P(cid:107)2 = (cid:104)v(cid:96),1, z(cid:105)2, where z is a unit vector in the direction constant c > 0 arbitrarily small. Observe that (cid:107)vT of the projection of v(cid:96),1 onto P . (cid:96),2P(cid:107)2, with σ2 1 = 2 + ζ and σ2 F = σ2 1(cid:107)vT (cid:96),1P(cid:107)2 + σ2 2(cid:107)vT By the Pythagorean theorem, (cid:107)v(cid:96),1 − (cid:104)v(cid:96),1, z(cid:105)z(cid:107)2 = 1 − (cid:104)v(cid:96),1, z(cid:105)2, and so (cid:107)v(cid:96),1 − (cid:104)v(cid:96),1, z(cid:105)z(cid:107)2 ≤ c14, (17) for a constant c14 > 0 that can be made arbitrarily small by making c > 0 arbitrarily small. We thus have ZT (cid:96) P = σ1(cid:104)v(cid:96),1, z(cid:105)u(cid:96),1zT + σ2(cid:104)v(cid:96),2, w(cid:105)u(cid:96),2wT , where w is a unit vector in the direction of (cid:96) . Since F occurs, we have the projection of of v(cid:96),2 onto P , and u(cid:96),1, u(cid:96),2 are the left singular vectors of ZT that (cid:104)v(cid:96),2, w(cid:105) ≤ c11, where c11 > 0 is a constant that can be made arbitrarily small by making the constant c > 0 arbitrarily small. It follows now by (17) that (cid:107)ZT (cid:96) P − σ1u(cid:96),1vt (cid:96),1(cid:107)2 F ≤ c15, (18) F ≤ c15. Since ei(cid:96) is the second row of ZT where c15 > 0 is a constant that can be made arbitrarily small by making the constant c > 0 arbitrarily small. By direct calculation6, u(cid:96),1 = −.851ei(cid:96) − .526Ri(cid:96) and v(cid:96),1 = −.851ei(cid:96) − .526Ri(cid:96). (cid:107)ZT (cid:96) P − (2 + ζ)[.724ei(cid:96) + .448Ri(cid:96); .448ei(cid:96) + .277Ri(cid:96)](cid:107)2 follows that (cid:107)eT i(cid:96)P − (2 + ζ)(.448ei(cid:96) + .277Ri(cid:96))(cid:107)2 ≤ c15. i(cid:96)P . Moreover, as c15 > 0 can be made Observe that Bob has ei(cid:96) and P , and can therefore compute eT arbitrarily small by making the constant c > 0 arbitrarily small, it follows that a 1− c16 fraction of the signs of coordinates of eT i(cid:96)P , restricted to coordinates in [d] \ [ck/ε], must agree with those of (2 + ζ).277Ri(cid:96), which in turn agree with those of Ri(cid:96). Here c16 > 0 is a constant that can be made arbitrarily small by making the constant c > 0 arbitrarily small. Hence, in particular, the sign of the j-th coordinate of Ri(cid:96), which Bob needs to output, agrees with that of the j-th coordinate of eT i(cid:96)P with probability at least 1 − c16. Call this event H. By a union bound over the occurrence of events E,F, G, and H, and the streaming algorithm succeeding (which occurs with probability 3/4), it follows that Bob succeeds in solving Index with probability at least 49/51 − 1/4 − c16 > 2/3, as required. This completes the proof. It follows that (cid:96) , it 5 Related Work on Matrix Sketching and Streaming As mentioned in the introduction, there are a variety of techniques to sketch a matrix. There are also several ways to measure error and models to consider for streaming. In this paper we focus on the row-update streaming model where each stream elements appends a row to the input matrix A. A more general model the entry-update model fixes the size of A at n × d, but each element indicates a single matrix entry and adds (or subtracts) to its value. 6Using the online calculator in earlier footnotes. 18 Error measures. The accuracy of a sketch matrix B can be measured in several ways. Most commonly one considers an n × d, rank k matrix A that is derived from B (and sometimes A) and measures the projection error where proj-err = (cid:107)A − A(cid:107)2 F . When A can be derived entirely from B, we call this a construction result, and clearly requires at least Ω(n + d) space. When the space is required to be independent of n, then A either implicitly depends on A, or requires another pass of the data. It can then be defined one of two ways: A = πk B(A) (as is considered in this paper) takes Bk, the best rank-k approximation to B, and then projects A onto Bk; A = Πk B(A) projects A onto B, and then takes the best rank-k approximation of the result. Note that πk B(A), since it knows the rank-k subspace to project onto without re-examining A. B(A) is better than Πk F /(cid:107)A − Ak(cid:107)2 We also consider covariance error where covar-err = (cid:107)AT A − BT B(cid:107)2/(cid:107)A(cid:107)2 F in this paper. One can also bound (cid:107)AT A− BT B(cid:107)2/(cid:107)A− Ak(cid:107)2 F , but this has an extra parameter k, and is less clean. This measure captures the norm of A along all directions (where as non-construction, projection error only indicates how accurate the choice of subspace is), but still does not require Ω(n) space. Sketch paradigms Given these models, there are several types of matrix sketches. We describe them here with a bit more specificity than in the Introduction, with particular attention to those that can operate in the row-update model we focus on. Specific exemplars are described which are used in out empirical study to follow. The first approach is to sparsify the matrix [4,7,23], by retaining a small number of non-zero. These algorithms typically assume to know the n × d dimensions of A, and are thus not directly applicable in out model. Random-projection: The second approach randomly combines rows of the matrix [40, 47, 51, 52]. For an efficient variant [3] we will consider where the sketch B is equivalent to RA where R is an (cid:96) × n matrix such that each element Ri,j ∈ {−1/√(cid:96), 1/√(cid:96)} uniformly. This is easily computed in a streaming fashion, while requiring at most O((cid:96)d) space and O((cid:96)d) operation per row updated. Sparser constructions of random projection matrices are known to exist [16, 33]. These, however, were not implemented since the running time of applying random projection matrices is not the focus of this experiment. Hashing: A variant of this approach [14] uses an extra sign-hash function to replicate the count-sketch [12] with matrix rows (analogously to how FREQUENTDIRECTIONS does with the MG sketch). Specifically, the sketch B is initialized as the (cid:96) × d all zeros matrix, then each row ai of A is added to row h(i) as Bh(i) ← Bh(i) + s(i)ai, where h : [n] → [(cid:96)] and s : [n] ← {−1, 1} are perfect hash functions. There is no harm in assuming such functions exist since complete randomness is naıvely possible without dominating either space or running time. This method is often used in practice by the machine learning community and is referred to as “feature hashing” [55]. Surprising new analysis of this method [14] shows this approach is optimal for construction bounds and takes O(nnz(A)) processing time for any matrix A. Sampling: The third sketching approach is to find a small subset of matrix rows (and/or columns) that approximate the entire matrix. This problem is known as the ‘Column Subset Selection Problem’ and has been thoroughly investigated [9, 10, 18, 19, 22, 25]. Recent results offer algorithms with almost matching lower bounds [9,13,18]. A simple streaming solution to the ‘Column Subset Selection Problem’ is obtained by sampling rows from the input matrix with probability proportional to their squared (cid:96)2 norm. Specifically, each row Bj takes the value Ai/√(cid:96)pi iid with probability pi = (cid:107)Ai(cid:107)2/(cid:107)A(cid:107)2 F . The space it requires is O((cid:96)d) in the worst case but it can be much lower if the chosen rows are sparse. Since the value of (cid:107)A(cid:107)F is not a priori known, the streaming algorithm is implemented by (cid:96) independent reservoir samplers, each sampling a single row according to the distribution. The update running time is therefore O(d) per row in A. Despite this algorithm’s apparent simplicity, providing tight bounds for its error performance required over a decade of research [6, 19, 22, 25, 46, 49, 53]. Advanced such algorithms utilize the leverage scores of the rows [21] and not their squared (cid:96)2 norms. The discussion on matrix leverage scores goes beyond the scope of this paper, see [22] for more information and references. There are a couple of other sketching techniques that try to maintain some form of truncated SVD as the 19 data is arriving. Incremental SVD and its variants [11, 30, 32, 38, 48], are quite similar to FREQUENTDI- RECTIONS, but do not perform the shrinkage step; with each new row they recompute the truncated SVD, simply deleting the smallest singular value/vector. No worst case error bounds can be shown for this ap- proach, and a recent paper [26] demonstrates how it may fail dramatically; this paper [26] (which appeared after the initial conference versions of this paper) also shows how to approach or surpass the performance of Incremental SVD approaches using variants of the FREQUENTDIRECTIONS approach described herein. Another approach by Feldman et al. [24] decomposes the stream into geometrically increasing subparts, and maintains a truncated SVD for each. Recombining these in a careful process prevents the error from accumulating too much, and takes O(n · poly(d, (cid:96), log n)) time. Catalog of Related Bounds. We have summarized bounds of row-update streaming in Table 1. The space and time bounds are given in terms of n (the number of rows), d (the number of columns), k (the specified rank to approximate), r (the rank of input matrix A), ε (an error parameter), and δ (the probability of failure of a randomized algorithm). An expresion O(x) hides poly log(x) terms. The size is sometimes measured in terms of the number of rows (#R). Otherwise, if #R is not specified the space refers the number of words in the RAM model where it is assumed O(log nd) bits fit in a single word. Recall that the error can be measured in several ways. • A construction result is denoted C. • If it is not constructive, it is denoted by a P for projection if it uses a projection A = πk tively if the weaker form of A = Πk projection. B(A). Alterna- B(A), then this is denoted Pr where r is the rank of B before the • In most recent results a projection error of 1 + ε is obtained, and is denoted εR. • Although in some cases a weaker additive error of the form (cid:107)A − A(cid:107)2 achieved and denoted εA. This can sometimes also be expressed as a spectral norm of the form (cid:107)A− A(cid:107)2 F still has a Frobenius norm). This is denoted εL2. (note the error term ε(cid:107)A(cid:107)2 • In a few cases the error does not follow these patterns and we specially denote it. • Algorithms are randomized unless it is specified. In all tables we state bounds for a constant probabil- ity of failure. If we want to decrease the probability of failure to some parameter δ, we can generally increase the size and runtime by O(log(1/δ)). F ≤ (cid:107)A − Ak(cid:107)2 F + ε(cid:107)A(cid:107)2 F is 2 ≤ (cid:107)A−Ak(cid:107)2 2 +ε(cid:107)A(cid:107)2 F It is worth noting that under the construction model, and allowing streaming turnstile updates to each element of the matrix, the hashing algorithm has been shown space optimal by Clarkson and Woodruff [13] (assuming each matrix entry requires O(log nd) bits, and otherwise off by only a O(log nd) factor). It is randomized and it constructs a decomposition of a rank k matrix A that satisfies (cid:107)A − A(cid:107)F ≤ (1 + ε)(cid:107)A − Ak(cid:107)F , with probability at least 1 − δ. This provides a relative error construction bound of size O((k/ε)(n + d) log(nd)) bits. They also show an Ω((k/ε)(n + d)) bits lower bound. Our paper shows that the row-update model is strictly easier with a lower upper bound. Although not explicitly described in their paper [13], one can directly use their techniques and analysis to achieve a weak form of a non-construction projection bound. One maintains a matrix B = AS with m = O((k/ε) log(1/δ)) columns where S is a d × m matrix where each entry is chosen from {−1, +1} at random. Then setting A = πB(A), achieves a proj-err = 1 + ε, however B is rank O((k/ε) log(1/δ)) and hence that is the only bound on A as well. 6 Experimental Results We compare FREQUENTDIRECTIONS to five different algorithms. The first two constitute brute force and naıve baselines, described precisely next. The other three are common algorithms that are used in practice: 20 Space #R = O(1/ε2) O((d + 1/ε2)/ε4) #R = O(k/ε2) O((k/ε2)2(d + k/ε2)) #R = O(k/ε + k log k) O(d(k/ε + k log k)) #R = O(k/ε) O((n + d)(k/ε)) O((dk/ε) log n) Paper DKM06 [20] LinearTimeSVD Sar06 [51] turnstile CW09 [13] CW09 [13] FSS13 [24] deterministic This paper deterministic #R = (cid:100)1/ε(cid:101) Θ(d/ε) #R = (cid:100)k/ε + k(cid:101) Θ(dk/ε) O(nd/ε) O(ndk/ε) Table 1: Streaming Algorithms Streaming algorithms Time Bound O((d + 1/ε2)/ε4 + nnz(A)) P, εL2 O((k/ε2)2(d + k/ε2) + nnz(A)) O(nnz(A)(k/ε + k log k) + d(k/ε + k log k)2)) O(nd2 + (ndk/ε)) O(nd2 + (ndk/ε)) n((dk/ε) log n)O(1) P, εA PO(k/ε+k log k), εR PO(k/ε), εR C, εR P, εR covar-err ≤ ε P, εR sampling, hashing, and random-projection, described in Section 5. All tested methods receive the rows of an n × d matrix A one by one. They are all limited in storage to an (cid:96) × d sketch matrix B and additional o((cid:96)d) space for any auxiliary variables. This is with the exception of the brute force algorithm that requires Θ(d2) space. For a given input matrix A we compare the computational efficiency of the different methods and their resulting sketch accuracy. The computational efficiency is taken as the time required to produce B from the stream of A’s rows. The accuracy of a sketch matrix B is measured by both the covariance error and the projection error. Since some of the algorithms below are randomized, each algorithm was executed 5 times for each input parameter setting. The reported results are median values of these independent executions. All methods are implemented in python with NumPy and compiled by python 2.7 compiler, and experiments are performed on a linux machine with a 6 Core Intel (R) Xeon (R) 2.4GHz CPU and 128GB RAM. i=1 AT putes the matrix AT A =(cid:80)n 6.1 Competing algorithms Brute Force: The brute force approach produces the optimal rank (cid:96) approximation of A. It explicitly com- i Ai by aggregating the outer products of the rows of A. The final ‘sketch’ consists of the top (cid:96) right singular vectors and values (square rooted) of AT A which are obtained by com- puting its SVD. The update time of Brute Force is Θ(d2) and its space requirement is Θ(d2). Naıve: Upon receiving a row in A the naıve method does nothing. The sketch it returns is an all zeros (cid:96) by d matrix. This baseline is important for two reasons: First, it can actually be more accurate than random methods due to under sampling scaling issues. Second, although it does not perform any computation, it does incur computation overheads such as I/O exactly like the other methods. The other three baselines are Sampling, Hashing, and Random-projection, described in Section 5. 6.2 Datasets We compare the performance of our algorithm on both synthetic and real datasets. For the synthetic dataset, each row of the generated input matrices, A, consists of an m dimensional signal and d dimensional noise (m (cid:28) d). More accurately, A = SDU + N/ζ. The signal coefficients matrix S ∈ Rn×m is such that Si,j ∼ N (0, 1) i.i.d. The matrix D ∈ Rm×m has only diagonal non-zero entered Di,i = 1−(i−1)/m, which 21 Figure 2: Covariance error vs sketch size. On synthetic data with different signal dimension (m). m = 10 (left), m = 20 (middle), and m = 50 (right). Figure 3: Projection error vs sketch size. On synthetic data with different signal dimension (m). m = 10 (left), m = 20 (middle), and m = 50 (right). gives linearly diminishing signal singular values. The signal row space matrix U ∈ Rm×d contains a random m dimensional subspace in Rd, for clarity, U U T = Id. The matrix SDU is exactly rank m and constitutes the signal we wish to recover. The matrix N ∈ Rn×d contributes additive Gaussian noise Ni,j ∼ N (0, 1). Due to [54], the spectral norms of SDU and N are expected to be the same up to some universal constant c1. Experimentally, c1 ≈ 1. Therefore, when ζ ≤ c1 we cannot expect to recover the signal because the noise spectrally dominates it. On the other hand, when ζ ≥ c1 the spectral norm is dominated by the signal which is therefore recoverable. Note that the Frobenius norm of A is dominated by the noise for any ζ ≤ c2 d/m, d/m, the signal is for another constant close to 1, c2. Therefore, in the typical case where c1 ≤ ζ ≤ c2 recoverable by spectral methods even though the vast majority of the energy in each row is due to noise. In our experiments, we consider n ∈ {10000, 20000, . . . , 100000} (n = 10000 as default value), d = 1000, m ∈ {10, 20, 50} (m = 10 as default value), and ζ ∈ {5, 10, 15, 20} (ζ = 10 as default value). In projection error experiments, we recover rank k = m of the dataset. We consider the real-world dataset Birds [1] in which each row represents an image of a bird, and each column a feature. This dataset has 11788 data points and 312 features, and we recover rank k = 100 for projection error experiments. (cid:112) (cid:112) 6.3 Results The performance of FREQUENTDIRECTIONS was measured both in terms of accuracy and running time compared to the above algorithms. In the first experiment, a moderately sized matrix (10,000 × 1,000) was approximated by each algorithm. The moderate input matrix size is needed to accommodate the brute force algorithm and to enable the exact error measure. The results are shown as we vary the data dimension m 22 050100150200Sketch Size0.000.020.040.060.080.100.120.140.160.18Covariance ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.000.020.040.060.080.100.120.140.16Covariance ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.000.020.040.060.080.100.120.140.160.18Covariance ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.81.01.21.41.61.82.0Projection ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.51.01.52.02.53.0Projection ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0123456Projection ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force Figure 4: Covariance error vs sketch size. On synthetic data with different noise ratio (η). η = 5 (left), η = 15 (middle), and η = 20 (right). Figure 5: Projection error vs sketch size. On synthetic data with different noise ratio (η). η = 5 (left), η = 15 (middle), and η = 20 (right). in Figure 2 for covariance error and Figure 3 for projection error; similar results are shown as the noise parameter η is changed in Figure 4 for covariance error and Figure 5 for projection error. These give rise to a few interesting observations. First, all three random techniques actually perform worse in covariance error than naıve for small sketch sizes. This is a side effect of under-sampling which causes overcorrection. This is not the case with FREQUENTDIRECTIONS. Second, the three random techniques perform equally well. This might be a result of the chosen input. Nevertheless, practitioners should consider these as potentially comparable alternatives. Third, the curve indicated by “Frequent Direction Bound” plots the relative accu- racy guaranteed by FREQUENTDIRECTIONS, which is equal to 1/(cid:96) in case of covariance error, and equal to (cid:96)/((cid:96) − k) in case of projection error. Note that in covariance error plots,“Frequent Direction Bound” is consistently lower than the random methods. This means that the worst case performance guarantee is lower than the actual performance of the competing algorithms. Finally, FREQUENTDIRECTIONS produces significantly more accurate sketches than predicted by its worst case analysis. The running time of FREQUENTDIRECTIONS (specifically Algorithm 3.1), however, is not better than its competitors. This is clearly predicted by their asymptotic running times. In Figure 6 as we vary the data dimension m and in Figure 7 as we vary the noise parameter η, the running times (in seconds) of the sketch- ing algorithms are plotted as a function of their sketch sizes. Clearly, the larger the sketch, the higher the running time. Note that hashing is extremely fast. In fact, it is almost as fast as naıve, which does nothing other than read the data! Sampling is also faster than Frequent Directions. Random-project is also faster than FREQUENTDIRECTIONS, but only by a factor 3; this makes sense since they have the same asymptotic runtime, but random-projection just needs to add each new row to (cid:96) other vectors while FREQUENTDIREC- TIONS amortizes over more complex svd calls. It is important to stress that the implementations above are not carefully optimized. Different implementations might lead to different results. Similar results in error and runtime are shown on the real Birds data set in Figure 8. 23 050100150200Sketch Size0.000.020.040.060.080.100.120.14Covariance ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.000.050.100.150.20Covariance ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.000.050.100.150.200.25Covariance ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.81.01.21.41.61.82.0Projection ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.81.01.21.41.61.82.0Projection ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.81.01.21.41.61.82.02.22.42.6Projection ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force Figure 6: Running time (seconds) vs sketch size. On synthetic data with different signal dimension (m). m = 10 (left), m = 20 (middle), and m = 50 (right). Figure 7: Running time (seconds) vs sketch size. On synthetic data with different noise ratio (η). η = 5 (left), η = 10 (middle), and η = 15 (right). Figure 8: Covariance error (left), Projection error (middle) and Running time (right) on birds data. Nevertheless, we will claim that FREQUENTDIRECTIONS scales well. Its running time is O(nd(cid:96)), which is linear in each of the three terms. In Figure 9, we fix the sketch size to be (cid:96) = 100 and increase n and d. Note that the running time is indeed linear in both n and d as predicted. Moreover, sketching an input matrix of size 105 × 104 requires roughly 3 minutes. Assuming 4 byte floating point numbers, this matrix occupies roughly 4Gb of disk space. More importantly though, FREQUENTDIRECTIONS is a streaming algorithm. Thus, its memory footprint is fixed and its running time is exactly linear in n. For example, sketching a 40Gb matrix of size 106× 104 terminates in half an hour. The fact that FREQUENTDIRECTIONS is also perfectly parallelizable (Section 3.1) makes FREQUENTDIRECTIONS applicable to truly massive and distributed matrices. 24 050100150200Sketch Size020406080100120140160Running TimeRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size020406080100120140160Running TimeRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size020406080100120140160Running TimeRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size020406080100120140160Running TimeRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size020406080100120140160Running TimeRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size020406080100120140160Running TimeRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size0.000.050.100.150.20Covariance ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size024681012Projection ErrorFrequent Directions BoundRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force050100150200Sketch Size05101520253035Running TimeRandom ProjectionsHashingSamplingFrequent DirectionsNaiveBrute Force Figure 9: Running time in seconds vs. input size. Here, we measure only the running time of FREQUENT- DIRECTIONS (specifically Algorithm 3.1). The sketch size is kept fixed at (cid:96) = 100. The size of the synthetic input matrix is n × d. The value of n is indicated on the x-axis. Different plot lines correspond to different values of d (indicated in the legend). The running time is measured in seconds and is indicated on the y-axis. It is clear from this plot that the running time of FREQUENTDIRECTIONS is linear in both n and d. Note also that sketching a 105 × 104 dense matrix terminates in roughly 3 minutes. Acknowledgments The authors thank Qin Zhang for discussion on hardness results. We also thank Stanley Eisenstat, and Mark Tygert for their guidance regarding efficient svd rank-1 updates. References [1] http://www.vision.caltech.edu/visipedia/cub-200-2011.html. [2] P.A. Absil, A. Edelman, and P. Koev. On the largest principal angle between random subspaces. Linear Algebra and its Applications, 414:288–294, 2006. [3] Dimitris Achlioptas. Database-friendly random projections. In Proceedings of the 20th ACM Sympo- sium on Principles of Database Systems, 2001. [4] Dimitris Achlioptas and Frank McSherry. Fast computation of low rank matrix approximations. In Proceedings of the 33rd Annual ACM Symposium on Theory of Computing, 2001. [5] Pankaj K. Agarwal, Graham Cormode, Zengfeng Huang, Jeff M. Phillips, Zhewei Wei, and Ke Yi. Mergeable summaries. ACM Transactions on Database Systems, 38:26, 2013. [6] Rudolf Ahlswede and Andreas Winter. Strong converse for identification via quantum channels. IEEE Transactions on Information Theory, 48:569–579, 2002. [7] Sanjeev Arora, Elad Hazan, and Satyen Kale. A fast random sampling algorithm for sparsifying matri- ces. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, 2006. [8] Radu Berinde, Graham Cormode, Piotr Indyk, and Martin J. Strauss. Space-optimal heavy hitters with strong error bounds. In Proceedings ACM Symposium on Principals of Database Systems, 2009. [9] Christos Boutsidis, Petros Drineas, and Malik Magdon-Ismail. Near optimal column-based matrix reconstruction. In Proceedings of the 52nd Annual Symposium on Foundations of Computer Science, 2011. 25 100002000030000400005000060000700008000090000100000Input Size02004006008001000Running Time10002000300040005000600070008000900010000 [10] Christos Boutsidis, Michael W Mahoney, and Petros Drineas. An improved approximation algorithm for the column subset selection problem. In Proceedings of the 20th Annual ACM-SIAM Symposium on Discrete Algorithms, 2009. [11] Matthew Brand. Incremental singular value decomposition of uncertain data with missing values. In Proceedings of the 7th European Conference on Computer Vision, 2002. [12] Moses Charikar, Kevin Chen, and Martin Farach-Colton. Finding frequent items in data streams. In Proceedings of International Conference on Automata, Languages, and Programming, 2002. [13] Kenneth L. Clarkson and David P. Woodruff. Numerical linear algebra in the streaming model. In Proceedings of the 41st Annual ACM Symposium on Theory of Computing, 2009. [14] Kenneth L. Clarkson and David P. Woodruff. Low rank approximation and regression in input sparsity time. In Proceedings of the 45th Annual ACM Symposium on Symposium on Theory of Computing, 2013. [15] Thomas M. Cover and Joy Thomas. Elements of Information Theory. Wiley, 1991. [16] Anirban Dasgupta, Ravi Kumar, and Tam´as Sarl´os. A sparse Johnson-Lindenstrauss transform. In Proceedings of the 42nd ACM Symposium on Theory of Computing, 2010. [17] Erik D Demaine, Alejandro L´opez-Ortiz, and J. Ian Munro. Frequency estimation of internet packet streams with limited space. In Proceedings of European Symposium on Algorithms, 2002. [18] Amit Deshpande and Santosh Vempala. Adaptive sampling and fast low-rank matrix approximation. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, 2006. [19] Petros Drineas and Ravi Kannan. Pass efficient algorithms for approximating large matrices. In Pro- ceedings of the 14th Annual ACM-SIAM Symposium on Discrete Algorithms, 2003. [20] Petros Drineas, Ravi Kannan, and Michael W. Mahoney. Fast monte carlo algorithms for matrices II: Computing a low-rank approximation to a matrix. SIAM Journal on Computing, 36:158–183, 2006. [21] Petros Drineas, Michael W. Mahoney, and S. Muthukrishnan. Relative-error CUR matrix decomposi- tions. SIAM Journal on Matrix Analysis and Applications, 30:844–881, 2008. [22] Petros Drineas, Michael W Mahoney, S Muthukrishnan, and Tam´as Sarl´os. Faster least squares ap- proximation. Numerische Mathematik, 117:219–249, 2011. [23] Petros Drineas and Anastasios Zouzias. A note on element-wise matrix sparsification via a matrix- valued bernstein inequality. Information Processing Letters, 111:385–389, 2011. [24] Dan Feldman, Melanie Schmidt, and Christian Sohler. Turning big data into tiny data: Constant-size coresets for k-means, pca and projective clustering. In Proceedings of the 24th ACM-SIAM Symposium on Discrete Algorithms, 2013. [25] Alan Frieze, Ravi Kannan, and Santosh Vempala. Fast Monte-Carlo algorithms for finding low-rank approximations. Journal of the ACM, 51:1025–1041, 2004. [26] Mina Ghashami, Amey Desai, and Jeff M. Phillips. Improved practical matrix sketching with guaran- tees. In Proceedings of the 22nd Annual Symposium on Algorithms, 2014. 26 [27] Mina Ghashami and Jeff M. Phillips. Relative errors for deterministic low-rank matrix approximations. In Proceedings of the 25th ACM-SIAM Symposium on Discrete Algorithms, 2014. [28] Phillip B Gibbons and Yossi Matias. Synopsis data structures for massive data sets. In Proceedings of the 10th Annual ACM-SIAM Symposium on Discrete Algorithms, 1999. [29] Lukasz Golab, David DeHaan, Erik D. Demaine, Alejandro Lopez-Ortiz, and J. Ian Munro. Identi- fying frequent items in sliding windows over on-line packet streams. In Proceedings of the 3rd ACM SIGCOMM Conference on Internet Measurement, 2003. [30] Gene H Golub and Charles F Van Loan. Matrix computations, volume 3. JHUP, 2012. [31] M. Gu and S. C. Eisenstat. A stable and fast algorithm for updating the singular value decomposition. Technical Report YALEU/DCS/RR-966, Yale University, New Haven, CT, 1993. [32] Peter Hall, David Marshall, and Ralph Martin. Incremental eigenanalysis for classification. In Pro- ceedings of the British Machine Vision Conference, 1998. [33] Daniel M Kane and Jelani Nelson. Sparser Johnson-Lindenstrauss transforms. In Proceedings of the 23rd Annual ACM-SIAM Symposium on Discrete Algorithms, 2012. [34] Michael Kapralov and Kunal Talwar. On differentially private low rank approximation. In Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms, 2013. [35] Richard M. Karp, Scott Shenker, and Christos H. Papadimitriou. A simple algorithm for finding frequent elements in streams and bags. ACM Transactions on Database Systems, 28:51–55, 2003. [36] Ilan Kremer, Noam Nisan, and Dana Ron. On randomized one-round communication complexity. Computational Complexity, 8:21–49, 1999. [37] Eyal Kushilevitz and Noam Nisan. Communication Complexity. Cambridge University Press, 1997. [38] A. Levey and Michael Lindenbaum. Sequential Karhunen-Loeve basis extraction and its application to images. IEEE Transactions on Image Processing, 9:1371–1374, 2000. [39] Edo Liberty. Simple and deterministic matrix sketching. In Proceedings of the 19th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2013. [40] Edo Liberty, Franco Woolfe, Per-Gunnar Martinsson, Vladimir Rokhlin, and Mark Tygert. Random- ized algorithms for the low-rank approximation of matrices. Proceedings of the National Academy of Sciences, 104:20167–20172, 2007. [41] R. Lidl and H. Niederreiter. Introduction to finite fields and their applications. Cambridge University Press, 1986. [42] Michael W. Mahoney and Petros Drineas. CUR matrix decompositions for improved data analysis. Proceedings of the National Academy of Sciences, 106:697–702, 2009. [43] Ahmed Metwally, Divyakant Agrawal, and Amr El. Abbadi. An integrated efficient solution for com- puting frequent and top-k elements in data streams. ACM Transactions on Database Systems, 31:1095– 1133, 2006. [44] J. Misra and D. Gries. Finding repeated elements. Science of computer programming, 2:143–152, 1982. 27 [45] S. Muthukrishnan. Data Streams: Algorithms and Applications. Foundations and Trends in Theoretical Computer Science. Now publishers Inc, 2005. [46] Roberto Imbuzeiro Oliveira. Sums of random hermitian matrices and an inequality by rudelson. The Electronic Communications in Probability, 15:203–212, 2010. [47] Christos H. Papadimitriou, Hisao Tamaki, Prabhakar Raghavan, and Santosh Vempala. Latent semantic In Proceedings of the 17th ACM Symposium on Principles of indexing: A probabilistic analysis. Database Systems, 1998. [48] David A Ross, Jongwoo Lim, Ruei-Sung Lin, and Ming-Hsuan Yang. Incremental learning for robust visual tracking. International Journal of Computer Vision, 77:125–141, 2008. [49] Mark Rudelson and Roman Vershynin. Sampling from large matrices: An approach through geometric functional analysis. Journal of the ACM, 54:21, 2007. [50] Mark Rudelson and Roman Vershynin. Non-asymptotic theory of random matrices: extreme singular values. Proceedings of International Congress of Mathematics, 2010. [51] Tamas Sarlos. Improved approximation algorithms for large matrices via random projections. In Proceedings of the 47th Annual IEEE Symposium on Foundations of Computer Science, 2006. [52] Santosh S Vempala. The random projection method. American Mathematical Society, 2004. [53] Roman Vershynin. A note on sums of independent random matrices after Ahlswede-Winter. Lecture Notes, 2009. [54] Roman Vershynin. Spectral norm of products of random and deterministic matrices. Probability theory and related fields, 150:471–509, 2011. [55] Kilian Weinberger, Anirban Dasgupta, John Langford, Alex Smola, and Josh Attenberg. Feature hash- ing for large scale multitask learning. In Proceedings of the 26th Annual International Conference on Machine Learning, 2009. [56] David P. Woodruff. Low rank approximation lower bounds in row-update streams. In Proceedings of the 27th Annual Conference on Advances in Neural Information Processing Systems, 2014. 28
1012.0032
1
1012
2010-11-30T21:41:24
Testing of sequences by simulation
[ "cs.DS" ]
Let $\xi$ be a random integer vector, having uniform distribution \[\mathbf{P} \{\xi = (i_1,i_2,...,i_n) = 1/n^n \} \ \hbox{for} \ 1 \leq i_1,i_2,...,i_n\leq n.\] A realization $(i_1,i_2,...,i_n)$ of $\xi$ is called \textit{good}, if its elements are different. We present algorithms \textsc{Linear}, \textsc{Backward}, \textsc{Forward}, \textsc{Tree}, \textsc{Garbage}, \textsc{Bucket} which decide whether a given realization is good. We analyse the number of comparisons and running time of these algorithms using simulation gathering data on all possible inputs for small values of $n$ and generating random inputs for large values of $n$.
cs.DS
cs
Acta Univ. Sapientiae, Informatica, 2, 2 (2010) 135 -- 153 Testing of sequences by simulation Antal Iv´anyi Eotvos Lor´and University Bal´azs Nov´ak Eotvos Lor´and University Department of Computer Algebra Department of Computer Algebra H-1117, Budapest, Hungary P´azm´any s´et´any 1/C email: [email protected] H-1117, Budapest, Hungary P´azm´any s´et´any 1/C email: [email protected] Abstract. Let ξ be a random integer vector, having uniform distribution P{ξ = (i1, i2, . . . , in) = 1/nn} for 1 ≤ i1, i2, . . . , in ≤ n. A realization (i1, i2, . . . , in) of ξ is called good, if its elements are dif- ferent. We present algorithms Linear, Backward, Forward, Tree, Garbage, Bucket which decide whether a given realization is good. We analyse the number of comparisons and running time of these algo- rithms using simulation gathering data on all possible inputs for small values of n and generating random inputs for large values of n. 1 Introduction Let ξ be a random integer vector, having uniform distribution P{ξ = (i1, i2, . . . , in)} = 1/nn for 1 ≤ i1, i2, . . . , in ≤ n. We present six algorithms which decide whether a given realization is good. A realization (i1, i2, . . . , in) of ξ is called good, if its elements are different. This problem arises in connection with the design of agricultural [4, 5, 57, 72] and industrial [34] experiments, with the testing of Latin [1, 9, 22, 23, 27, 32, Computing Classification System 1998: G.2.2 Mathematics Subject Classification 2010: 68M20 Key words and phrases: random sequences, analysis of algorithms, Latin squares, sudoku squares 135 136 A. Iv´anyi, B. Nov´ak 53, 54, 63, 64] and sudoku [3, 4, 6, 12, 13, 14, 15, 16, 17, 20, 21, 22, 26, 29, 30, 31, 41, 42, 44, 46, 47, 51, 55, 59, 61, 64, 66, 67, 68, 69, 70, 72, 74] squares, with genetic sequences and arrays [2, 7, 8, 18, 24, 28, 35, 36, 37, 38, 45, 48, 49, 50, 56, 65, 71, 73, 75], with sociology [25], and also with the analysis of the performance of computers with interleaved memory [11, 33, 39, 40, 41, 43, 52]. Section 2 contains the pseudocodes of the investigated algorithms. In Section 3 the results of the simulation experiments and the basic theoretical results are presented. Section 4 contains the summary of the paper. Further simulation results are contained in [62]. The proofs of the lemmas and theorems can be found in [43]. 2 Pseudocodes of the algorithms This section contains the pseudocodes of the investigated algorithms Linear, Backward, Forward, Tree, Garbage, and Bucket. The psudocode con- ventions described in the book [19] written by Cormen, Leiserson, Rivest, and Stein are used. The inputs of the following six algorithms are n (the length of the sequence s) and s = (s1, s2, . . . , sn), a sequence of nonnegative integers with 0 ≤ si ≤ n for 1 ≤ i ≤ n) in all cases. The output is always a logical variable g (its value is True, if the input sequence is good, and False otherwise). The working variables are usually the cycle variables i and j. 2.1 Definition of algorithm Linear Linear writes zero into the elements of an n length vector v = (v1, v2, . . . , vn), then investigates the elements of the realization and if v[si] > 0 (signalising a repetition), then stops, otherwise adds 1 to v[s[i]]. Linear(n, s) 01 g ← True 02 for i ← 1 to n do v[i] ← 0 04 for i ← 1 to n 03 do if v[s[i]] > 0 05 06 07 08 09 return g return g then g ← False else v[s[i]] ← v[s[i]] + 1 Testing of sequences by simulation 137 2.2 Definition of algorithm Backward Backward compares the second (i2), third (i3), . . . , last (in) element of the realization s with the previous elements until the first collision or until the last pair of elements. Backward(n, s) 01 g ← True 02 for i ← 2 to n 03 04 05 06 07 return g do for j ← i − 1 downto 1 do if s[i] = s[j] then g ← False return g 2.3 Definition of algorithm Forward Forward compares the first (s1), second (s2), . . . , last but one (sn−1) element of the realization with the following elements until the first collision or until the last pair of elements. Forward(n, s) 01 g ← True 02 for i ← 1 to n − 1 do for j ← i + 1 to n do if s[i] = s[j] 03 04 05 06 07 return g then g ← False return g 2.4 Definition of algorithm Tree Tree builds a random search tree from the elements of the realization and finishes the construction of the tree if it finds the following element of the realization in the tree (then the realization is not good) or it tested the last element too without a collision (then the realization is good). Tree(n, s) 02 let s[1] be the root of a tree 01 g ← True 03 for i ← 2 to n 138 A. Iv´anyi, B. Nov´ak if [s[i] is in the tree then g ← False return 04 05 06 07 08 return g else insert s[i] in the tree 2.5 Definition of algorithm Garbage This algorithm is similar to Linear, but it works without the setting zeros into the elements of a vector requiring linear amount of time. Beside the cycle variable i Garbage uses as working variable also a vector v = (v1, v2, . . . , vn). Interesting is that v is used without initialisation, that is its initial values can be arbitrary integer numbers. The algorithm Garbage was proposed by G´abor Monostori [58]. Garbage(n, s) do if v[s[i]] < i and s[v[s[i]]] = s[i] 01 g ← True 02 for i ← 1 to n 03 04 05 06 07 return g return g then g ← False else v[s[i]] ← i 2.6 Definition of algorithm Bucket Bucket handles the array Q[1 : m, 1 : m] (where m = ⌈√n⌉ and puts the element si into the rth row of Q, where r = ⌈si/m⌉ and it tests using linear search whether sj appeared earlier in the corresponding row. The elements of the vector c = (c1, c2, . . . , cm) are counters, where cj (1 ≤ j ≤ m) shows the number of elements of the ith row. For the simplicity we suppose that n is a square. Bucket(n, s) 01 g ← True √n 02 m ← 03 for j ← 1 to m do c[j] ← 1 05 for i ← 1 to n do r ← ⌈s[i]/m⌉m 04 06 Testing of sequences by simulation 139 07 08 09 10 11 12 13 return g for j ← 1 to c[r] − 1 do if s[i] = Q[r, j] return g then g ← False else Q[r, c[r]] ← s[i] c[r] ← c[r] + 1 3 Analysis of the algorithms 3.1 Analysis of algorithm Linear The first algorithm is Linear. It writes zero into the elements of an n length vector v = (v1, v2, . . . , vn), then investigates the elements of the realization sequentially and if ij = k, then adds 1 to vk and tests whether vk > 0 signalizing a repetition. In best case Linear executes only two comparisons, but the initialization of the vector v requires Θ(n) assignments. It is called Linear, since its running time is Θ(n) in best, worst and so also in expected case. Theorem 1 The expected number Cexp(n, Linear) = CL of comparisons of Linear is CL = 1 − n! nn + n!k2 (n − k)!nk+1 nX k=1 = r πn 2 + 2 3 + κ(n) − n! nn , n!k where κ(n) = 1 3 −r πn 2 + nX k=1 (n − k)!nk+1 tends monotonically decreasing to zero when n tends to infinity. n!/nn also tends monotonically decreasing to zero, but their difference δ(n) = κ(n) − n!/nn is increasing for 1 ≤ n ≤ 8 and is decreasing for n ≥ 8. Theorem 2 The expected running time Texp(n, Linear) = TL of Linear is TL = n + √2πn + 7 3 + 2δ(n), 140 A. Iv´anyi, B. Nov´ak n 1 2 3 4 5 6 7 8 9 10 CL 1.000000 2.000000 2.666667 3.125000 3.472000 3.759259 4.012019 4.242615 4.457379 4.659853 pπn/2 + 2/3 1.919981 2.439121 2.837470 3.173295 3.469162 3.736647 3.982624 4.211574 4.426609 4.629994 n!/nn 1.000000 0.500000 0.222222 0.093750 0.038400 0.015432 0.006120 0.002403 0.000937 0.000363 κ(n) δ(n) 0.080019 −0.919981 0.060879 −0.439121 0.051418 −0.170804 0.045455 −0.048295 0.041238 +0.002838 0.038045 +0.022612 0.035515 +0.029395 0.033444 +0.031040 0.031707 +0.030770 0.030222 +0.029859 Table 1: Values of CL, pπn/2 + 2/3, n!/nn, κ(n), and δ(n) = κ(n) − n!/nn for n = 1, 2, . . . , 10 where δ(n) = κ(n) − n! nn tends to zero when n tends to infinity, further δ(n + 1) > δ(n) for 1 ≤ n ≤ 7 and δ(n + 1) < δ(n) for n ≥ 8. Table 1 shows some concrete values connected with algorithm Linear. 3.2 Analysis of algorithm Backward The second algorithm is Backward. This algorithm is a naive comparison- based one. Backward compares the second (i2), third (i3), . . . , last (in) element of the realization with the previous elements until the first repetition or until the last pair of elements. The running time of Backward is constant in the best case, but it is quadratic in the worst case. Theorem 3 The expected number Cexp(n, Backward) = CB of comparisons of the algorithm Backward is CB = n +r πn 8 + 2 3 − α(n), where α(n) = κ(n)/2 + (n!/nn)((n + 1)/2) monotonically decreasing tends to zero when n tends to ∞. Testing of sequences by simulation 141 Table 2 shows some concrete values characterizing algorithm Backward. n 1 2 3 4 5 6 7 8 9 10 CB 0.000000 1.000000 2.111111 3.156250 4.129600 5.058642 5.966451 6.866676 7.766159 8.667896 n −pπn/8 + 2/3 1.040010 1.780440 2.581265 3.413353 4.265419 5.131677 6.008688 6.894213 7.786695 8.685003 (n!/nn)((n + 1)/2) κ(n) 1.000000 0.750000 0.444444 0.234375 0.115200 0.054012 0.024480 0.010815 0.004683 0.001996 0.080019 0.060879 0.051418 0.045455 0.041238 0.038045 0.035515 0.033444 0.031707 0.030222 α(n) 1.040010 0.780440 0.470154 0.257103 0.135819 0, 073035 0.042237 0.027536 0.020537 0.017107 Table 2: Values of CB, n −pπn/8 + 2/3, (n!/nn)((n + 1)/2), κ(n), and α(n) = κ(n)/2 + (n!/nn)((n + 1)/2) for n = 1, 2, . . . , 10 The next assertion gives the expected running time of algorithm Back- ward. Theorem 4 The expected running time Texp(n, Backward) = TB of the al- gorithm Backward is TB = n +r πn 8 + 4 3 − α(n), where α(n) = κ(n)/2 + (n!/nn)((n + 1)/2) monotonically decreasing tends to zero when n tends to ∞. 3.3 Analysis of algorithm Forward Forward compares the first (s1), second (s2), . . . , last but one (sn−1) element of the realization with the next elements until the first collision or until the last pair of elements. Taking into account the number of the necessary comparisons in line 04 of Forward, we get Cbest(n, Forward) = 1 = Θ(1), and Cworst(n, Forward) = B(n, 2) = Θ(n2). The next assertion gives the expected running time. 142 A. Iv´anyi, B. Nov´ak Theorem 5 The expected running time Texp(n, Forward) = TF of the algo- rithm Forward is TF = n + Θ(√n). (1) Although the basic characteristics of Forward and Backward are iden- tical, as Table 3 shows, there is a small difference in the expected behaviour. n number of sequences number of good sequences 2 3 4 5 6 7 8 9 2 6 24 120 720 5 040 40 320 362 880 4 27 256 3 125 46 656 823 543 16 777 216 387 420 489 CF 1.000000 2.111111 3.203125 4.264000 5.342341 6.326760 7.342926 8.354165 CW 1.000000 2.111111 3.156250 4.126960 5.058642 5.966451 6.866676 7.766159 Table 3: Values of n, the number of possible input sequences, number of good sequences, expected number of comparisons of Forward (CF) and expected number of comparisons of Backward (CW ) for n = 2, 3, . . . , 9 3.4 Analysis of algorithm Tree Tree builds a random search tree from the elements of the realization and finishes the construction of the tree if it finds the following element of the realization in the tree (then the realization is not good) or it tested the last element too without a collision (then the realization is good). The worst case running time of Tree appears when the input contains different elements in increasing or decreasing order. Then the result is Θ(n2). The best case is when the first two elements of s are equal, so Cbest(n, Tree) = 1 = Θ(1). Using the known fact that the expected height of a random search tree is Θ(lg n) we can get that the order of the expected running time is √n log n. Theorem 6 The expected running time TT of Tree is TT = Θ(√n lg n). (2) Testing of sequences by simulation 143 n number of good inputs number of comparisons number of assignments 1 1.000000 1.499460 2 1.889900 3 2.219390 4 5 2.511409 2.773160 6 3.021820 7 8 3.252989 3.459510 9 3.663749 10 3.860450 11 12 4.039530 4.214370 13 4.384480 14 15 4.537880 4.716760 16 4.853530 17 4.989370 18 19 5.147560 5.279180 20 100 000.000000 49 946.000000 22 243.000000 9 396.000000 3 723.000000 1 569.000000 620.000000 251.000000 104 33 17 3 3 0 2 0 0 0 0 0 0.000000 1.000000 2.038960 2.921710 3.682710 4.352690 4.985280 5.590900 6.148550 6.704350 7.271570 7.779950 8.314370 8.824660 9.302720 9.840690 10.287560 10.719770 11.242740 11.689660 Table 4: Values of n, number of good inputs, number of comparisons, number of assignments of Tree for n = 1, 2, . . . , 10 Table 4 shows some results of the simulation experiments (the number of random input sequences is 100 000 in all cases). Using the method of the smallest squares to find the parameters of the formula a√n log2 n we received the following approximation formula for the expected number of comparisons: Cexp(n, Tree) = 1.245754√n log2 n − 0.273588. 3.5 Analysis of algorithm Garbage This algorithm is similar to Linear, but it works without the setting zeros into the elements of a vector requiring linear amount of time. Beside the cycle variable i Garbage uses as working variable also a vector 144 A. Iv´anyi, B. Nov´ak v = (v1, v2, . . . , vn). Interesting is that v is used without initialisation, that is its initial values can be arbitrary integer numbers. The worst case running time of Garbage appears when the input con- tains different elements and the garbage in the memory does not help, but even in this case Cworst(n, Garbage) = Θ(n). The best case is when the first element is repeated in the input and the garbage helps to find a repe- tition of the firs element of the input. Taking into account this case we get Cbest(n, Garbage) = Θ(1). According to the next assertion the expected running time is Θ(√n). Lemma 7 The expected running time of Garbage is Texp(n, Garbage) = Θ(√n). (3) 3.6 Analysis of algorithm Bucket Algorithm Bucket divides the interval [1, n] into m = ⌈√n⌉ subintervals . . . , Im, where Ik = [(k − 1)m + 1, km)], and assigns a bucket Bk to I1, I2, interval Ik. Bucket sequentially puts the input elements ij into the corre- sponding bucket: if ij belongs to the interval Ik then it checks whether ij is contained in Bk or not. Bucket works up to the first repetition. (For the simplicity we suppose that n = m2.) In best case Bucket executes only 1 comparison, but the initialization of the buckets requires Θ(√n) assignments, therefore the best running time is also √n. The worst case appears when the input is a permutation. Then each bucket requires Θ(n) comparisons, so the worst running time is Θ(n√n). Lemma 8 Let bj (j = 1, 2, . . . , m) be a random variable characterising the number of elements in the bucket Bj at the moment of the first repetition. Then for j = 1, 2, . . . , m, where E{bj} = r π 2 − µ(n) µ(n) = 1 3√n − κ(n) √n , and µ(n) tends monotonically decreasing to zero when n tends to infinity. Table 5 contains some concrete values connected with E{b1}. Testing of sequences by simulation 145 n 1 2 3 4 5 6 7 8 9 10 E{b1} 1.000000 1.060660 1.090055 1.109375 1.122685 1.132763 1.147287 1.147287 1.152772 1.157462 pπ/2 1.253314 1.253314 1.253314 1.253314 1.253314 1.253314 1.253314 1.253314 1.253314 1.253314 1/(3√n) κ(n)/√n 0.080019 0.333333 0.043048 0.235702 0.029686 0.192450 0.022727 0.166667 0.149071 0.018442 0.015532 0.136083 0.013423 0.125988 0.117851 0.011824 0.010569 0.111111 0.105409 0.009557 µ(n) 0.253314 0.192654 0.162764 0.143940 0.130629 0.120551 0.112565 0.106027 0.100542 0.095852 Table 5: Values of E{b1}, pπ/2, 1/(3√n), κ(n)/√n, and µ(n) = 1/(3√n) − κ(n)/√n of Bucket for n = 1, 2, . . . , 10 Lemma 9 Let fn be a random variable characterising the number of compar- isons executed in connection with the first repeated element. Then E{fn} = 1 +r π 8 − η(n), where η(n) = 8 − κ(n) 2 1 3 +p π √n + 2 , and η(n) tends monotonically decreasing to zero when n tends to infinity. Theorem 10 The expected number Cexp(n, Bucket) = CB of comparisons of algorithm Bucket in 1 bucket is where CB = √n + 1 3 −r π 8 + ρ(n), ρ(n) = 5/6 −p9π/8 − 3κ(n)/2 √n + 1 tends to zero when n and tends to infinity. 146 A. Iv´anyi, B. Nov´ak Index and Algorithm Cbest(n) Cworst(n) 1. Linear 2. Backward 3. Forward 4. Tree 5. Garbage 6. Bucket Θ(n) Θ(n2) Θ(n2) Θ(n2) Θ(n) Θ(n√n) Θ(1) Θ(1) Θ(1) Θ(1) Θ(1) Θ(√n) Cexp(n) Θ(√n) Θ(n) Θ(n) Θ(√n) Θ(√n) Θ(√n lg n) Table 6: The number of necessary comparisons of the investigated algorithms in best, worst and expected cases Theorem 11 The expected running time TB(n, Bucket) = TB of Bucket is TB = (cid:18)3 + 3r π 2(cid:19)√n +r 25π 8 + φ(n), where φ(n) = 3κ(n) − ρ(n) − 3η(n) − n! nn − 3pπ/8 − 1/3 − 3κ(n)/2 √n + 1 and φ(n) tends to zero when n tends to infinity. It is worth to remark that simulation experiments of B. Nov´ak [62] show that the expected running time of Garbage is a few percent better, then the expected running time of Bucket. 4 Summary Table 6 contains the number of necessary comparisons in best, worst and expected cases for all investigated algorithms. Table 7 contains the running time in best, worst and expected cases for all investigated algorithms. Acknowledgements. The authors thank Tam´as F. M´ori [60] for proving Lemma 8 and 9 and P´eter Burcsi [10] for useful information on references, both are teachers of Eotvos Lor´and University. The European Union and the European Social Fund have provided finan- cial support to the project under the grant agreement no. T ´AMOP 4.2.1/B- 09/1/KMR-2010-0003. Testing of sequences by simulation 147 Tworst(n) Index and Algorithm Tbest(n) 1. Linear 2. Backward 3. Forward 5. Tree 6. Garbage 7. Bucket Θ(n) Θ(n) Θ(n2) Θ(1) Θ(n2) Θ(1) Θ(n2) Θ(1) Θ(1) Θ(n) Θ(√n) Θ(n√n) Texp(n) n + Θ(√n) Θ(√n lg n) Θ(n) Θ(n) Θ(√n) Θ(√n) Table 7: The running times of the investigated algorithms in best, worst and expected cases References [1] P. Adams, D. Bryant, M. Buchanan, Completing partial Latin squares with two filled rows and two filled columns, Electron. J. Combin. 15, 1 (2008), Research paper 56, 26 p. ⇒ 136 [2] M.-C. Anisiu, A. Iv´anyi, Two-dimensional arrays with maximal complex- ity, Pure Math. Appl. (PU.M.A.) 17, 3 -- 4 (2006) 197 -- 204. ⇒ 136 [3] C. Arcos, G. Brookfield, M. Krebs, Mini-sudokus and groups, Math. Mag. 83, 2 (2010) 111 -- 122. ⇒ 136 [4] R. A. Bailey, R. Cameron, P. J. Connelly, Sudoku, gerechte designs, reso- lutions, affine space, spreads, reguli, and Hamming codes, American Math. Monthly 115, 5 (2008) 383 -- 404. ⇒ 135, 136 [5] W. U. Behrens, Feldversuchsanordnungen mit verbessertem Ausgleich der Bodenunterschiede, Zeitschrift fur Landwirtschaftliches Versuchs- und Untersuchungswesen, 2 (1956) 176 -- 193. ⇒ 135 [6] D. Berthier, Unbiased statistics of a constraint satisfaction problem -- a controlled-bias generator, in: S. Tarek et al. (eds.), Innovations in computing sciences and software engineering, Proc. Second International Conference on Systems, Computing Sciences and Software Engineering (SCSS'2009, December 4 -- 12, 2009, Dordrecht). Springer, Berlin, 2010. pp. 91 -- 97. ⇒ 136 [7] S. Brett, G. Hurlbert, B. Jackson, Preface [Generalisations of de Bruijn cycles and Gray codes], Discrete Math., 309, 17 (2009) 5255 -- 5258. ⇒ 136 148 A. Iv´anyi, B. Nov´ak [8] A. A. Bruen, R. A. Mollin, Cryptography and shift registers, Open Math. J., 2 (2009) 16 -- 21. ⇒ 136 [9] H. L. Buchanan, M. N. Ferencak, On completing Latin squares, J. Com- bin. Math. Combin. Comput., 34 (2000) 129 -- 132. ⇒136 [10] P. Burcsi, Personal communication. Budapest, March 2009. ⇒ 146 [11] G. J. Burnett, E. G. Coffman, Jr., Combinatorial problem related to in- terleaved memory systems, J. ACM, 20, 1 (1973) 39 -- 45. ⇒ 136 [12] P. J. Cameron, Sudoku -- an alternative history, Talk to the Archimedeans, Queen Mary University of London, February 2007. ⇒ 136 [13] A. Carlos, G. Brookfield, M. Krebs, Mini-sudokus and groups, Math. Mag., 83, 2 (2010) 111 -- 122. ⇒ 136 [14] J. Carmichael, K. Schloeman, M. B. Ward, Cosets and Cayley-sudoku tables, Math. Mag., 83, 2 (2010) 130 -- 139. ⇒136 [15] Ch.-Ch. Chang, P.-Y. Lin, Z.-H. Wang, M.-Ch. Li, A sudoku-based secret image sharing scheme with reversibility, J. Commun., 5, 1 (2010) 5 -- 12. ⇒ 136 [16] Z. Chen, Heuristic reasoning on graph and game complexity of sudoku, ARXIV.org, 2010. 6 p. ⇒ 136 [17] Y.-F. Chien, W.-K. Hon, Cryptographic and physical zero-knowledge proof: From sudoku to nonogram, in: P. Boldi (ed.), Fun with Algorithms, (5th International Conference, FUN 2010, Ischia, Italy, June 2 -- 4, 2010.) Springer, Berlin, 2010, Lecture Notes in Comput. Sci., 6099 (2010) 102 -- 112. ⇒ 136 [18] J. Cooper, C. Heitsch, The discrepancy of the lex-least de Bruijn sequence, Discrete Math., 310, 6 -- 7 (2010), 1152 -- 1159. ⇒ 136 [19] T. H. Cormen, C. E. Leiserson, R. L. Rivest, C. Stein, Introduction to Algorithms, Third edition. The MIT Press, Cambridge, 2009. ⇒ 136 [20] J. F. Crook, A pencil-and-paper algorithm for solving sudoku puzzles, Notices Amer. Math. Soc., 56 (2009) 460 -- 468. ⇒136 [21] G. Dahl, Permutation matrices related to sudoku, Linear Algebra Appl., 430 (2009), 2457 -- 2463. ⇒ 136 Testing of sequences by simulation 149 [22] J. D´enes, A. D. Keedwell, Latin squares. New developments in the theory and applications, North-Holland, Amsterdam, 1991. ⇒136 [23] T. Easton, R. G. Parker, On completing Latin squares, Discrete Appl. Math., 113, 2 -- 3 (2001) 167 -- 181. ⇒ 136 [24] C. H. Elzinga, S. Rahmann, H. Wung, Algorithms for subsequence com- binatorics, Theor. Comput. Sci., 409, 3 (2008) 394 -- 404. ⇒ 136 [25] C. H. Elzinga, Complexity of categorial time series, Sociological Methods & Research, 38, 3 (2010) 463 -- 481. ⇒ 136 [26] M. Erickson, Pearls of discrete mathematics, Discrete Mathematics and its Applications, CRC Press, Boca Raton, FL, 2010. ⇒ 136 [27] R. Euler, On the completability of incomplete Latin squares, European J. Combin. 31 (2010) 535 -- 552. ⇒ 136 [28] S. Ferenczi, Z. K´asa, Complexity for finite factors of infinite sequences, Theoret. Comput. Sci. 218, 1 (1999) 177 -- 195. ⇒ 136 [29] R. Fontana, F. Rapallo, M. P. Rogantin, Indicator function and su- doku designs, in: P. Gibilisco, E. Ricco-magno, M. P. Rogantin, H. P. Wynn (eds.) Algebraic and Geometric Methods in Statistics, pp. 203 -- 224. Cambridge University Press, Cambridge, 2010. ⇒ 136 [30] R. Fontana, F. Rapallo, M. P. Rogantin, Markov bases for sudoku grids. Rapporto interno N. 4, marzo 2010, Politecnico di Torino. ⇒ 136 [31] A. F. Gabor, G. J. Woeginger, How *not* to solve a Sudoku. Operation Research Letters, 38, 6 (2010) 582 -- 584. ⇒136 [32] I. Hajirasouliha, H. Jowhari, R. Kumar, R. Sundaram, On completing Latin squares, Lecture Notes in Comput. Sci., 4393 (2007), 524 -- 535. Springer, Berlin, 2007. ⇒ 136 [33] H. Hellerman, Digital computer system principles. Mc Graw Hill, New York, 1967. ⇒ 136 [34] A. Heppes, P. R´ev´esz, A new generalization of the concept of latin squares and orthogonal latin squares and its application to the design of exper- iments (in Hungarian), Magyar Tud. Akad. Mat. Int. Kozl., 1 (1956) 379 -- 390. ⇒ 135 150 A. Iv´anyi, B. Nov´ak [35] M. Horv´ath, A. Iv´anyi, Growing perfect cubes, Discrete Math., 308, 19 (2008) 4378 -- 4388. ⇒136 [36] A. Iv´anyi, On the d-complexity of words, Ann. Univ. Sci. Budapest. Sect. Comput. 8 (1987) 69 -- 90 (1988). ⇒ 136 [37] A. Iv´anyi, Construction of infinite de Bruijn arrays, Discrete Appl. Math. 22, 3 (1988/89), 289 -- 293. ⇒ 136 [38] A. Iv´anyi, Construction of three-dimensional perfect matrices, (Twelfth British Combinatorial Conference, Norwich, 1989). Ars Combin. 29C (1990) 33 -- 40. ⇒ 136 [39] A. Iv´anyi, I. K´atai, Estimates for speed of computers with interleaved memory systems, Ann. Univ. Sci. Budapest. Sect. Math., 19 (1976) 159 -- 164. ⇒ 136 [40] A. Iv´anyi, I. K´atai, Processing of random sequences with priority, Acta Cybern. 4, 1 (1978/79) 85 -- 101. ⇒ 136 [41] A. Iv´anyi, I. K´atai, Quick testing of random variables, Proc. ICAI'2010 (Eger, January 27 -- 30, 2010). To appear. ⇒ 136 [42] A. Iv´anyi, I. K´atai, Testing of uniformly distributed vectors, in: Abstracts J´anos Bolyai Memorial Conference, (Budapest, August 28 -- 30, 2010), p. 47. ⇒136 [43] A. Iv´anyi, I. K´atai, Testing of random matrices, Ann. Univ. Sci. Budapest. Sect. Comput. (submitted). ⇒ 136 [44] A. Iv´anyi, B. Nov´ak, Testing of random sequences by simulation, in: Ab- stracts 8th MACS (Kom´arno, July 14 -- 17, 2010). ⇒ 136 [45] A. Iv´anyi, Z. T´oth, Existence of de Bruijn words, Second Conference on Automata, Languages and Programming Systems (Salg´otarj´an, 1988), 165 -- 172, DM, 88-4, Karl Marx Univ. Econom., Budapest, 1988. ⇒136 [46] I. Kanaana, B. Ravikumar, Row-filled completion problem for sudoku, Util. Math. 81 (2010) 65 -- 84. ⇒ 136 [47] Z. Karimi-Dehkordi, K. Zamanifar, A. Baraani-Dastjerdi, N. Ghasem- Aghaee, Sudoku using parallel simulated annealing, in: Y. Tan et al. Testing of sequences by simulation 151 (eds.), Advances in Swarm Intelligence (Proc. First International Con- ference, ICSI 2010, Beijing, China, June 12 -- 15, 2010, Part II. Lecture Notes in Comput. Sci., 6146 (2010) 461 -- 467, Springer, Berlin, 2010. ⇒ 136 [48] Z. K´asa, Computing the d-complexity of words by Fibonacci-like se- quences, Studia Univ. Babe¸s-Bolyai Math. 35, 3 (1990) 49 -- 53. ⇒ 136 [49] Z. K´asa, Pure Math. Appl. On the d-complexity of strings, (PU.M.A.) 9, 1 -- 2 (1998) 119 -- 128. ⇒ 136 [50] Z. K´asa, Super-d-complexity of finite words, Proc. 8th Joint Conference on Mathematics and Computer Science, (Kom´arno, Slovakia, July 14 -- 17), 2010, To appear. ⇒ 136 [51] A. D. Keedwell, Constructions of complete sets of orthogonal diagonal sudoku squares, Australas. J. Combin. 47 (2010) 227 -- 238. ⇒ 136 [52] D. E. Knuth, The art of computer programming, Vol. 1. Fundamental algorithms (third edition). Addison -- Wesley, Reading, MA, 1997. ⇒ 136 [53] J. S. Kuhl, T. Denley, On a generalization of the Evans conjecture, Discrete Math. 308, 20 (2008), 4763 -- 4767. ⇒ 136 [54] S. R. Kumar S., A. Russell, R. Sundaram, Approximating Latin square extensions, Algorithmica 24, 2 (1999) 128 -- 138. ⇒ 136 [55] L. Lorch, Mutually orthogonal families of linear sudoku solutions, J. Aust. Math. Soc., 87, 3 (2009) 409 -- 420. ⇒ 136 [56] M. Matamala, F. Moreno, Minimum Eulerian circuits and minimum de Bruijn sequences, Discrete Math., 309, 17 (2009) 5298 -- 5304. ⇒ 136 [57] H.-D. Mo, R.-G. Xu, Sudoku square -- a new design in field, Acta Agronomica Sinica, 34, 9 (2008) 1489 -- 1493. ⇒ 135 [58] G. Monostori, Personal communication, Budapest, May 2010. ⇒ 138 [59] T. K. Moon, J. H. Gunther, J. J. Kupin, Sinkhorn solves sudoku,IEEE Trans. Inform. Theory , 55, 4 (2009) 1741 -- 1746. ⇒ 136 [60] T. M´ori, Personal communication, Budapest, April 2010. ⇒ 146 152 A. Iv´anyi, B. Nov´ak [61] P. K. Newton, S. A. deSalvo, The Shannon entropy of sudoku matrices, Proc. R. Soc. Lond. Ser. A, Math. Phys. Eng. Sci. 466 (2010) 1957-1975. [62] B. Nov´ak, Analysis of sudoku algorithms (in Hungarian), MSc thesis, ⇒ 136 Eotvos Lor´and University, Fac. of Informatics, Budapest, 2010. ⇒ 136, [63] L.-D. Ohman, A note on completing Latin squares, Australas. J. Combin., 146 [64] R. M. Pedersen, T. L. Vis, Sets of mutually orthogonal sudoku Latin [65] R. Penne, A note on certain de Bruijn sequences with forbidden subse- 45 (2009) 117 -- 123. ⇒ 136 squares. College Math. J., 40, 3 (2009) 174 -- 180. ⇒ 136 quences, Discrete Math., 310, 4 (2010) 966 -- 969. ⇒ 136 116, 8 (2009), 702 -- 707. ⇒ 136 Note 25, 7 p. ⇒ 136 [66] J. S. Provan, Sudoku: strategy versus structure, Amer. Math. Monthly, [67] T. Sander, Sudoku graphs are integral, Electron. J. Combin., 16, 1 (2009), [68] Y. Sato, H. Inoue, Genetic operations to solve sudoku puzzles, Proc. 12th Annual Conference on Genetic and Evolutionary Computation GECCO'10, July 7 -- 11, 2010, Portland, OR, pp. 2111 -- 21012. ⇒ 136 [69] M. J. Soottile, T. G. Mattson, C. E. Rasmussen, Introduction to concur- rency in programming languages, Chapman & Hall/CRC Computational [70] D. Thom, SUDOKU ist NP-vollstandig, PhD Dissertation, Stuttgart, Science Series. CRC Press, Boca Raton, FL, 2010. ⇒ 136 2007. ⇒ 136 [71] O. G. Troyanskaya, O. Arbell, Y. Koren, G. M. Landau, A. Bolshoy, Se- quence complexity profiles of prokaryotic genomic sequences: A fast algo- rithm for calculating linguistic complexity, Bioinformatics, 18, 5 (2002) [72] E. R. Vaughan, The complexity of constructing gerechte designs, Electron. 679 -- 688. ⇒ 136 J. Combin., 16, 1 (2009), paper R15, 8 p. ⇒ 135, 136 Comput. Math. Appl., 59, 4 (2010), 716 -- 723. ⇒ 136 [73] X. Xu, Y. Cao, J.-M. Xu, Y. Wu, Feedback numbers of de Bruijn digraphs, Testing of sequences by simulation 153 [74] C. Xu, W. Xu, The model and algorithm to estimate the difficulty levels of sudoku puzzles, J. Math. Res. 11, 2 (2009), 43 -- 46. ⇒ 136 [75] W. Zhang, S. Liu, H. Huang, An efficient implementation algorithm for generating de Bruijn sequences, Computer Standards & Interfaces, 31, 6 (2009) 1190 -- 1191. ⇒136 Received: August 20, 2010 • Revised: October 15, 2010
1807.09417
1
1807
2018-07-25T02:35:48
Shared-Memory Parallel Maximal Clique Enumeration
[ "cs.DS" ]
We present shared-memory parallel methods for Maximal Clique Enumeration (MCE) from a graph. MCE is a fundamental and well-studied graph analytics task, and is a widely used primitive for identifying dense structures in a graph. Due to its computationally intensive nature, parallel methods are imperative for dealing with large graphs. However, surprisingly, there do not yet exist scalable and parallel methods for MCE on a shared-memory parallel machine. In this work, we present efficient shared-memory parallel algorithms for MCE, with the following properties: (1) the parallel algorithms are provably work-efficient relative to a state-of-the-art sequential algorithm (2) the algorithms have a provably small parallel depth, showing that they can scale to a large number of processors, and (3) our implementations on a multicore machine shows a good speedup and scaling behavior with increasing number of cores, and are substantially faster than prior shared-memory parallel algorithms for MCE.
cs.DS
cs
Shared-Memory Parallel Maximal Clique Enumeration Apurba Das Iowa State University [email protected] Seyed-Vahid Sanei-Mehri Iowa State University [email protected] Srikanta Tirthapura Iowa State University [email protected] 8 1 0 2 l u J 5 2 ] S D . s c [ 1 v 7 1 4 9 0 . 7 0 8 1 : v i X r a Abstract -- We present shared-memory parallel methods for Maximal Clique Enumeration (MCE) from a graph. MCE is a fundamental and well-studied graph analytics task, and is a widely used primitive for identifying dense structures in a graph. Due to its computationally intensive nature, parallel methods are imperative for dealing with large graphs. However, surprisingly, there do not yet exist scalable and parallel methods for MCE on a shared-memory parallel machine. In this work, we present efficient shared-memory parallel algorithms for MCE, with the following properties: (1) the parallel algorithms are provably work-efficient relative to a state-of-the-art sequential algorithm (2) the algorithms have a provably small parallel depth, showing that they can scale to a large number of processors, and (3) our implementations on a multicore machine shows a good speedup and scaling behavior with increasing number of cores, and are substantially faster than prior shared-memory parallel algorithms for MCE. I. INTRODUCTION We study the problem of Maximal Clique Enumeration (MCE) from a graph, which requires to enumerate all cliques (complete subgraphs) in the graph that are maximal. A clique C in a graph G = (V, E) is a dense subgraph such that every pair of vertices in C are directly connected by an edge. A clique C is said to be maximal when there is no clique C(cid:48) such that C is a proper subgraph of C(cid:48). Maximal cliques are perhaps the most fundamental dense subgraphs, and MCE has been widely used in diverse research areas, such as clustering and community detection in social and biological networks [1] and in genomics [2]. It has also applications in finding common substructures in chemical compounds [3], mining from biological data [4], [5], [6], [7], [8], [9], and inference from graphical models [10]. MCE is a computationally hard problem since it is harder than the problem of finding the maximum clique, which is a classical NP-hard combinatorial problem. The computational cost of enumerating maximal cliques can be higher than the cost of finding the maximum clique, since the output size (set of all maximal cliques) may itself be very large, in the worst case. In particular, Moon and Moser [11] showed that a graph on n vertices can have as many as 3n/3 maximal cliques, which is proven to be a tight bound. Real-world networks typically do not have cliques of such high complexity and it is possible to enumerate maximal cliques from large graphs. The literature is rich on sequential algorithms for MCE. Bron and Kerbosch [12] introduced a backtracking search method to enumerate maximal cliques. Tomita et. al [13] used the idea of "pivoting" in the backtracking search, which led to a significant improvement in the runtime. This has been followed up by further work such as due to Eppstein et al. [14], who used a degeneracy-based vertex ordering scheme on top of the pivot selection strategy. Sequential approaches to MCE can lead to high runtimes on large graphs. Based on our experiments, a real-world network orkut with approximately 3 million vertices, 117 million edges requires approximately 8 hours to enumerate all maximal cliques using an efficient sequential algorithm due to Tomita et al. [13]. Graphs that are larger and/or more complex cannot be handled by sequential algorithms with a reasonable turnaround time, and the high computational complexity of MCE calls for parallel methods. In this work, we consider shared memory parallel methods for MCE. In the shared memory model, the input graph can reside within globally shared memory, and multiple threads can work in parallel on enumerating maximal cliques. Shared memory parallelism is attractive today since machines with tens to hundreds of cores and hundreds of Gigabytes of shared memory are readily available. The advantage of using shared memory approach over a distributed memory approach are: (1) Unlike distributed memory, it is not necessary to divide the graph into subgraphs and communicate the subgraphs among processors. In shared memory, different threads can work with a single shared copy of the graph (2) Subproblems generated during MCE are often irregular, and it is hard to predict which subproblems are small and which are large, while initially dividing the problem into subproblems. With a shared memory method, is easy to further subdivide subproblems and process them in parallel. With a distributed memory method, handling such irregularly sized subproblems in a load-balanced manner requires greater coordination and is more complex. it Prior works on parallel MCE have largely focused on dis- tributed memory algorithms [15], [16], [17], [18], [19]. There are a few works on shared-memory parallel algorithms [20], [21], [22]. However, these algorithms do not scale to larger graphs due to memory or computational bottlenecks -- either the algorithms miss out significant pruning opportunities as in [21] or they need to generate a large number of non- maximal cliques as in [20], [22]. A. Our Contributions II. RELATED WORK We design shared-memory parallel algorithms for enumer- ating all maximal cliques in a simple graph. Our contributions are as follows: Theoretically Efficient Parallel Algorithm: We present a shared-memory parallel algorithm ParTTT that takes as input a graph G and enumerates all maximal cliques in G. ParTTT is an efficient parallelization of the algorithm due to Tomita et al. [13]. Our analysis of ParTTT using a work- depth model [23] of computation shows that it is work-efficient when compared with [13] and has a low parallel depth. To our knowledge, this is the first shared memory parallel algorithm for MCE with such provable properties. Optimized Parallel Algorithm: We present the following ideas to further improve the practical performance of ParTTT, leading to Algorithm ParMCE. First, instead of starting with a single task that spawns recursive subtasks as it proceeds, which leads to a lack of parallelism at the top level of recursion, we start with multiple parallel subtasks. To achieve this, we con- sider per-vertex parallelization, where a separate subproblem is created for each vertex and the different subproblems are pro- cessed in parallel. Each subproblem is required to enumerate cliques that contain the assigned vertex, where care is taken to prevent overlap between subproblems, and to balance the load between subproblems. Each per-vertex subproblem is further processed in parallel using ParTTT. This additional (recursive) level of parallelism is useful since the different per-vertex subproblems may have significantly different computational costs, having each run as a separate sequential task may lead to uneven load balance. To further address load balance, we consider different methods for ranking the vertices, so that the ranking functions can be used in creating subproblems that are balanced as much as possible. For ranking the vertices, we use metrics such as degree, triangle count, and degeneracy number of the vertices. Experimental Evaluation: We experimentally evaluate our algorithm and show that ParMCE is 15x-31x faster than an efficient sequential algorithm (due to Tomita et al. [13]) on a multicore machine with 32 physical cores and 256G RAM. For example, on the orkut network with around 3M vertices, 117M edges, and 2B maximal cliques 1, ParTTT achieves a 14x parallel speedup over the sequential algorithm, and the optimized ParMCE achieves a 16x speedup. In contrast, prior shared memory parallel algorithms for MCE [20], [21], [22] failed to handle the input graphs that we considered, and either ran out of memory ([20], [22]) or did not complete in 5 hours ([21]). Roadmap. The rest of the paper is organized as follows. We present preliminaries in Section III, followed by a description of the algorithm and analysis in Section IV, an experimental evaluation in Section V, and conclusions in Section VI. 1M and B stand for million and billion respectively. Maximal Clique Enumeration (MCE) from a graph is a fundamental problem that has been extensively studied for more than two decades, and there are multiple prior works on sequential and parallel algorithms. We first discuss sequential algorithms for MCE, followed by parallel algorithms. Sequential MCE: Bron and Kerbosch [12] presented an algorithm for MCE based on depth-first-search. Following their work, a number of algorithms have been presented [24], [25], [13], [26], [27], [28], [14]. The algorithm of Tomita et al. [13] has a worst-case time complexity O(3 n 3 ) for an n vertex graph, which is optimal in the worst-case, since the size of the output can be as large as O(3 n 3 ) [11]. Eppstein et al. [14], [29] present an algorithm for sparse graphs whose complexity can be parameterized by the degeneracy of the graph, a measure of graph sparsity. Another approach to MCE is a class of "output-sensitive" algorithms whose time complexity for enumerating maximal cliques is a function of the size of the output. There exist many such output-sensitive algorithms for MCE, including [25], [27], [24], which can be viewed as instances of a general paradigm called "reverse-search" [30]. The output-sensitive algorithm due to Makino and Uno [27] provides the best theoretical worst-case time complexity among output-sensitive algorithms. In terms of practical performance, the best output- sensitive algorithms [25], [27] are not as efficient as the best depth-first-search based algorithms such as [13], [14]. Other sequential methods for MCE include algorithms due to Kose et al. [31], Johnson et al. [32], and Cheng et al. [33]. There have also been works on maintaining maximal cliques in a dynamic graph [34], [35], [36]. Parallel MCE: There are multiple prior works on parallel algorithms for MCE [20], [37], [15], [16], [17], [38], [18], [19]. We first discuss shared memory algorithms and then distributed memory algorithms. Zhang et al. [20] presented a shared memory parallel algo- rithm based on the sequential algorithm due to Kose et al. [31]. This algorithm computes maximal cliques in an iterative man- ner, and in each iteration, it maintains a set of cliques that are not necessarily maximal and for each such clique, maintains the set of vertices that can be added to form larger cliques. This algorithm does not provide a theoretical guarantee on the runtime and suffers for large memory requirement. Du et al. [37] present a output-sensitive shared-memory parallel algorithm for MCE, but their algorithm suffers from poor load balancing as also pointed out by Schmidt et al. [16]. Lessley et al. [22] present a shared memory parallel algorithm that generates maximal cliques using an iterative method, where in each iteration, cliques of size (k − 1) are extended to cliques of size k. The algorithm of [22] is memory-intensive, since it needs to store a number of intermediate non-maximal cliques in each iteration. Note that the number of non-maximal cliques may be far higher than the number of maximal cliques that are finally emitted, and a number of distinct non-maximal cliques may finally lead to a single maximal clique. In the extreme case, a complete graph on n vertices has (2n − 1) non-maximal cliques, and only a single maximal clique. We present a comparison of our algorithm with [22], [20], [37] in later sections. Distributed memory parallel algorithms for MCE include works due to Wu et al. [15], designed for the MapReduce framework, Lu et al. [17], which is based on the sequential algorithm due to Tsukiyama et al. [24], Xu et al. [19], and Svendsen et al. [18]. Other works on parallel algorithms for enumerating dense subgraphs from a massive graph include parallel algorithms for enumerating k-cores [39], [40], [41], [42], k-trusses [42], [43], [44], nuclei [42], and distributed memory algorithms for enumerating bicliques [45]. III. PRELIMINARIES We consider a simple undirected graph without self loops or multiple edges. For graph G, let V (G) denote the set of vertices in G and E(G) denote the set of edges in G. Let n denote the size of V (G), and m denote the size of E(G). For vertex u ∈ V (G), let ΓG(u) denote the set of vertices adjacent to u in G. When the graph G is clear from the context, we use Γ(u) to mean ΓG(u). Let C(G) denote the set of all maximal cliques in G. Sequential Algorithm TTT: The algorithm due to Tomita, Tanaka, and Takahashi. [13], which we call TTT, is a recursive backtracking-based algorithm for enumerating all maximal cliques in an undirected graph, with a worst-case time com- plexity of O(3n/3) where n is the number of vertices in the graph. In practice, this is one of the most efficient sequential algorithms for MCE. Since we use TTT as a subroutine in our parallel algorithms, we present a short description here. In any recursive call, TTT maintains three disjoint sets of vertices K, cand, and fini where K is a candidate clique to be extended, cand is the set of vertices that can be used to extend K, and fini is the set of vertices that are adjacent to K, but need not be used to extend K (these are being explored along other search paths). Each recursive call iterates over vertices from cand and in each iteration, a vertex q ∈ cand is added to K and a new recursive call is made with parameters K∪{q}, candq, and finiq for generating all maximal cliques of G that extend K ∪{q} but do not contain any vertices from finiq. The sets candq and finiq can only contain vertices that are adjacent to all vertices in K ∪ {q}. The clique K is a maximal clique when both cand and fini are empty. The ingredient that makes TTT different from the algorithm due to Bron and Kerbosch [12] is the use of a "pivot" where a vertex u ∈ cand ∪ fini is selected that maximizes cand ∩ Γ(u). Once the pivot u is computed, it is sufficient to iterate over all the vertices of cand \ Γ(u), instead of iterating over all vertices of cand. The pseudo code of TTT is presented in Algorithm 1. For the initial call, K and fini are initialized to an empty set, cand is the set of all vertices of G. Parallel Cost Model: For analyzing our shared-memory parallel algorithms, we use the CRCW PRAM model [46], which is a model of shared parallel computation that assumes Algorithm 1: TTT(G, K, cand, fini) Input: G - The input graph K - a clique to extend, cand - Set of vertices that can be used extend K, fini - Set of vertices that have been used to extend K Output: Set of all maximal cliques of G containing K and vertices from cand but not containing any vertex from fini Output K and return size of cand ∩ ΓG(u) 1 if (cand = ∅) & (fini = ∅) then 2 3 pivot ← (u ∈ cand ∪ fini) such that u maximizes the 4 ext ← cand − ΓG(pivot) 5 for q ∈ ext do 6 7 8 9 10 11 Kq ← K ∪ {q} candq ← cand ∩ ΓG(q) finiq ← fini ∩ ΓG(q) cand ← cand − {q} fini ← fini ∪ {q} TTT(G, Kq, candq, finiq) concurrent reads and concurrent writes. Our parallel algorithm can also work in other related models of shared memory such as EREW PRAM (exclusive reads and exclusive writes), with a logarithmic factor increase in work as well as parallel depth. We measure the effectiveness of the parallel algorithm using the work-depth model [23]. Here, the "work" of a parallel algorithm is equal to the total number of operations of the parallel algorithm, and the "depth" (also called the "parallel time" or the "span") is the longest chain of dependent computations in the algorithm. A parallel algorithm is said to be work-efficient if its total work is of the same order as the work due to the best sequential algorithm2. We aim for work- efficient algorithms with a low depth, ideally poly-logarithmic in the size of the input. Using Brent's theorem [46], it can be seen that a parallel algorithm on input size n with a depth of d can theoretically achieve Θ(p) speedup on p processors as long as p = O(n/d). IV. PARALLEL MCE ALGORITHMS In this section, we present shared-memory parallel algo- rithms for MCE. We first describe a parallel algorithm ParTTT and an analysis of its theoretical properties, where ParTTT is a parallel version of the TTT algorithm. Then, we discuss prac- tical bottlenecks in ParTTT, leading us to another algorithm ParMCE with a better practical runtime performance. A. Algorithm ParTTT Our first algorithm ParTTT is a work-efficient paralleliza- tion of the sequential TTT algorithm. The two main compo- nents of TTT (Algorithm 1) are (1) Selection of the pivot 2Note that work-efficiency in the CRCW PRAM model does not imply work-efficiency in the EREW PRAM model element (Line 3) and (2) Sequential backtracking for extend- ing candidate cliques until all maximal cliques are explored (Line 5 to Line 11). We discuss how to parallelize each of these steps. Parallel Pivot Selection: Within a single recursive call of ParTTT, the pivot element is computed in parallel using two steps, as described in ParPivot (Algorithm 2). In the first step, the size of the intersection cand∩ Γ(u) is computed in parallel for each vertex u ∈ cand ∪ fini. In the second step, the vertex with the maximum intersection size is selected. The parallel algorithm for selecting a pivot is presented in Algorithm 2. Lemma 1. is w∈cand∪fini(min{cand,Γ(w)}), which is O(n2), O((cid:80) ParPivot of The total work and depth is O(log n). Proof: If the sets cand and Γ(w) are stored as hashsets, then for vertex w the size tw = intersect(cand, Γ(w)) can be computed sequentially in time O(min{cand,Γ(w)}) -- the intersection of two sets S1 and S2 can be found by considering the smaller set among the two, say S2, and searching for its elements within the larger set, say S1. It is possible to parallelize the computation of intersect(S1, S2) by executing the searches elements in S2 in parallel, followed by counting the number of elements that lie in the intersection, which can also be done in parallel in a work-efficient manner using logarithmic depth. Since computing the maximum of a set of n numbers can be accomplished using work O(n) and depth O(log n), for vertex w, tw can be computed using work O(min{cand,Γ(w)}) and depth O(log n). Once the different tw are computed, argmax({tw : w ∈ cand ∪ fini}) can be computed using additional work cand∪ fini the total work of ParPivot and depth O(log n). Hence, w∈cand∪fini(min{cand,Γ(w)}). Since the size of cand, fini, and Γ(w) are bounded by n, this is O(n2), but typically much smaller. Algorithm 2: ParPivot(G, K, cand, fini) Input: K - a clique in G that may be further extended G - Input graph cand - Set of vertices that may extend K fini - vertices that have been used to extend K Output: pivot vertex u ∈ cand ∪ fini 1 for w ∈ cand ∪ fini do in parallel In parallel, compute 2 tw ← intersect(cand, ΓG(w)) is O((cid:80) 3 In parallel, find v ← argmax({tw : w ∈ cand ∪ fini}) 4 return v Parallelization of Backtracking: We first note that there is a sequential dependency among the different iterations within a recursive call of TTT. In particular, the contents of the sets cand and fini in a given iteration are derived from the contents of cand and fini in the previous iteration. Such sequential dependence of updates of cand and fini restricts us from calling the recursive TTT for different vertices of ext in parallel. To remove this dependency, we adopt a different view of TTT which enables us to make the recursive calls in parallel. The elements of ext, the vertices to be considered for extending a maximal clique, are arranged in a predefined total order. Then, we unroll the loop and explicitly compute the parameters cand and fini for recursive calls. Suppose (cid:104)v1, v2, ..., vκ(cid:105) is the order of vertices in ext to be processed in sequence. Each vertex vi ∈ ext, once added to K, should be removed from further consideration from cand. To ensure this, instead of incrementally updating cand and fini with vi as in TTT, in ParTTT, we explicitly remove vertices v1, v2, ..., vi−1 from cand and add them to fini, before making the recursive calls. This way, the parameters of the ith iteration are computed independently of prior iterations. Algorithm 3: ParTTT(G, K, cand, fini) Input: G - The input graph K - a non-maximal clique to extend cand - Set of vertices that may extend K fini - vertices that have been used to extend K Output: Set of all maximal cliques of G containing K and vertices from cand but not containing any vertex from fini Output K and return 1 if (cand = ∅) & (fini = ∅) then 2 3 pivot ← ParPivot(G, cand, fini) 4 ext[1..κ] ← cand − ΓG(pivot) // in parallel 5 6 for i ∈ [1..κ] do in parallel 7 8 9 10 11 q ← ext[i] Kq ← K ∪ {q} candq ← intersect(cand \ ext[1..i − 1], ΓG(q)) finiq ← intersect(fini ∪ ext[1..i − 1], ΓG(q)) ParTTT(G, Kq, candq, finiq) Next, we present an analysis of the total work and depth of ParPivot and ParTTT algorithms. Lemma 2. Total work of ParTTT (Algorithm 3) is O(3n/3) and depth is O(M log n) where n is the number of vertices in the graph and M is the size of maximum clique in G. Proof: First, we analyze the total work. Note that the computational tasks in ParTTT is different from TTT at Line 9 and Line 10 of ParTTT where at an iteration i, we remove all vertices {v1, v2, ..., vi−1} from cand and add all these vertices to fini as opposed to the removal of a single vertex vi−1 from cand and addition of that vertex to fini as in TTT (Line 9 and Line 10 of Algorithm 1). Therefore, in ParTTT, additional O(n) work is required due to independent computations of candq and finiq. The total work, excluding the call to ParPivot is O(n2). Adding up the work of ParPivot, which requires O(n2) work, requires O(n2) total work for each single call of ParTTT excluding further recursive calls (Algorithm 3, Line 11), which is same as in original sequential algorithm TTT (Section 4, [13]). Hence, using Lemma 2 and Theorem 3 of [13], we infer that the total work of ParTTT is the same as the sequential algorithm TTT and is bounded by O(3n/3). Next we analyze the depth of the algorithm. The depth of ParTTT consists of the (sum of the) following components: (1) Depth of ParPivot, (2) Depth of computation of ext, (3) Maximum depth of an iteration in the for loop from Line 6 to Line 11. According to Lemma 1, the depth of ParPivot is O(log n). The depth of computing ext is O(log n) because it takes O(1) time to check whether an element in cand is in the neighborhood of pivot by doing a set membership check on the set of vertices that are adjacent to pivot. Similarly, the depth of computing candq and finiq at Line 8 and Line 9 are O(log n) each. The remaining is the depth of the call of ParTTT at Line 10. Observe that the recursive call of ParTTT continues until there is no further vertex to add for expanding K, and this depth can be at most the size of the maximum clique which is M because, at each recursive call of ParTTT the size of K is increased by 1. Thus, the overall depth of ParTTT is O(M log n). Corollary 1. Using P parallel processors that share memory, ParTTT (Algorithm 3) is a parallel algorithm for MCE, and can achieve a worst case parallel time of O using P parallel processors. This is work-efficient as long as P = O( 3n/3 M log n ), and also work-optimal. (cid:16) 3n/3 M log n + P (cid:17) Proof: The parallel time follows from using Brent's theorem [46], which states that the parallel time using P processors is O(w/d + P ), where w and d are the work and the depth of the algorithm respectively. If the number of processors P = O , then using Lemma 2 the parallel . The total work time is O across all processors is O(3n/3), which is worst-case optimal, since the size of the output can be as large as 3n/3 maximal cliques (Moon and Moser [11]). (cid:16) 3n/3 (cid:17) P , M log n}(cid:17) (cid:16) 3n/3 max{ 3n/3 (cid:16) (cid:17) M log n = O P B. Algorithm ParMCE While ParTTT is a theoretically work-efficient parallel al- gorithm, we note that it is not that efficient in practice. One of the reasons is the implementation of ParPivot. While the worst case work complexity of ParPivot matches that of the pivoting routine in TTT, in practice, it may have a higher overhead, since the pivoting routine in TTT may take time less than O(n2). This can cause ParTTT to have greater work than TTT, resulting in a lower speedup than the theoretically expected one. We set out to improve on this to derive a more effi- cient parallel implementation through a more selective use of ParPivot in that the cost of pivoting can be reduced by carefully choosing many pivots in parallel instead of a single pivot element as in ParTTT at the beginning of the algorithm. We first note that the cost of ParPivot is the highest during the iteration when the parameter K (clique so far) is empty. During this iteration, the set of vertices still to be considered, cand ∪ fini, can be high, as large as the number of vertices in the graph. To improve upon this, we can perform the first few steps of pivoting, when K is empty, using a sequential algorithm. Once the set K has at least one element in it, the number of the vertices in cand ∪ fini still to be considered, drops down to no more than the size of the intersection of neighborhoods of all vertices in K, which is typically a number much smaller than the number of vertices in the graph (it is smaller than the smallest degree of a vertex in K). Problem instances with K set to a single vertex can be seen as subproblems and on each of these subproblems, the overhead of ParPivot is much smaller since the number of vertices that have to be dealt with is also much smaller. Based on this observation, we present a parallel algorithm ParMCE that works as follows. The algorithm can be viewed as considering for each vertex v ∈ V (G), a subgraph Gv that is induced by the vertex v and its neighborhood ΓG(v). It enumerates all maximal cliques from each subgraph Gv in parallel using ParTTT. While processing subproblem Gv, it is important to not enumerate maximal cliques that are being enumerated elsewhere, in other subproblems. To handle this, the algorithm considers a specific ordering of all vertices in V such that v is the least ranked vertex in each maximal clique enumerated from Gv. The subgraphs Gv for each vertex v are handled in parallel -- these subgraphs need not be processed in any particular order. However, the ordering allows us to populate the cand and fini sets accordingly, so that each maximal clique is enumerated in exactly one subproblem. The order in which the vertices are considered is defined by a "rank" function rank, which indicates the position of a vertex in the total order. The specific ordering that is used influences the total work of the algorithm, as well as the load balance of the parallel implementation. Load Balancing: Observe that the sizes of the subgraphs Gv may vary widely because of two reasons: (1) the subgraphs themselves may be of different sizes, depending on the vertex degrees, and (2) the number of maximal cliques and the sizes of the maximal cliques containing v can vary widely from one vertex to another. Clearly, the subproblems that deal with a large number of maximal cliques or maximal cliques of a large size are more expensive than others. In order to maintain the size of the subproblems approx- imately balanced, we use an idea from PECO [18], where we choose the rank function on the vertices in such a way that for any two vertices v and w, rank(v) > rank(w) if the complexity of enumerating maximal cliques from Gv is higher than the complexity of enumerating maximal cliques from Gw. By giving a higher rank to v than w, we are decreasing the complexity of the subproblem Gv, since the subproblem at Gv need not enumerate maximal cliques that involve any vertex whose rank is less than v. Hence, the higher the rank of vertex v, the lower is its "share" (of maximal cliques it belongs to) of maximal cliques in Gv. We use this idea for approximately balancing the workload across subproblems. The additional enhancements in ParMCE, when compared with the idea from PECO are as follows: (1) In PECO the algorithm is designed for distributed memory so that the subgraphs and subproblems have to be explicitly copied across the network, and (2) In ParMCE, the vertex specific subproblem, dealing with Gv is itself handled through a parallel algorithm, ParTTT. However, in PECO, the subproblem for each vertex was handled through a sequential algorithm. Note that it is computationally expensive to accurately count the number of maximal cliques within Gv, and hence it is not possible to compute the rank of each vertex exactly according to the complexity of handling Gv. Instead, we estimate the complexity of handling Gv using some easy-to- evaluate metrics on the subgraphs. In particular, we consider the following: • Degree Based Ranking: For vertex v, define rank(v) = (d(v), id(v)) where d(v) and id(v) are degree and identifier of v respectively. For two vertices v and w, rank(v) > rank(w) if d(v) > d(w) or d(v) = d(w) and id(v) > id(w); rank(v) < rank(w) otherwise. • Triangle Count Based Ranking: For vertex v, define rank(v) = (t(v), id(v)) where t(v) is the number of triangles containing vertex v. This is more expensive to compute than degree based ranking, but may yield a better estimate of the complexity of maximal cliques within Gv. • Degeneracy Based Ranking [14]: For a vertex v, define rank(v) = (degen(v), id(v)) where degen(v) is the degeneracy of a vertex v. A vertex v has degeneracy number k when it belongs to a k-core but no (k + 1)- core where a k-core is a maximal induced subgraph with minimum degree of each vertex k in that subgraph. A computational overhead of using this ranking is due to computing the degeneracy of the vertices which takes O(n + m) time where n is the number of vertices and m is the number of edges. The different implementations of ParMCE using degree, tri- angle, and degeneracy rankings are called as ParMCEDegree, ParMCETri, ParMCEDegen respectively. Algorithm 4: ParMCE(G) Input: G - The input graph Output: C(G) - set of all maximal cliques of G 1 for v ∈ V (G) do in parallel 2 3 4 5 6 7 8 Create Gv, the subgraph of G induced by ΓG(v) ∪ {v} K ← {v} cand ← φ fini ← φ for w ∈ ΓG(v) do in parallel if rank(w) > rank(v) then cand ← cand ∪ {w} 9 10 11 else fini ← fini ∪ {w} ParTTT(Gv, K, cand, fini) V. EXPERIMENTS In this section, we present results from an experimental evaluation of the performance of parallel algorithms for MCE. For our experiments, we used an Intel Xeon (R) CPU on a Compute Engine in the Google Cloud Platform, with 32 phys- ical cores and 256 GB RAM. We implement all algorithms using java 1.8 with a maximum of 100 GB heap memory for the JVM. A. Datasets use We large network real world from KONECT [47], SNAP [48], and Network Repository [49]. Table I contains a summary of the datasets. All networks, used in our experiments, were undirected graphs. Self-loops are removed, and if the input graph was directed, we ignored the direction on the edges to derive an undirected graph. datasets B. Implementation of the algorithms implementation of ParTTT and ParMCE, we In our implement a parallel For loop using the primitive parallelStream() provided by java 1.8. For computing the intersection of two sets as is required for computing pivot and updating cand and fini in Algorithm 3, we perform a sequential implementation. This is because the sizes of the sets cand and fini are typically not large so that we can benefit from the use of parallelism. For the garbage collection in java we use flag -XX:+UseParallelGC so that parallel garbage collection is run by JVM whenever required. To compare with prior works in maximal clique enumera- tion, we implemented some of them [13], [14], [21], [18], [20] in Java, except the sequential algorithm GreedyBB [50], and the parallel algorithm Hashing [22], for which we used the executables provided by the authors (code written in C++). See Subsection V-D for more details. We call our implementation of ParMCE using degree based vertex ordering as ParMCEDegree, using degeneracy based vertex ordering as ParMCEDegen, and using triangle count based vertex ordering as ParMCETri. We compute the de- generacy number and triangle count for each vertex using sequential procedures. While the computation of per-vertex triangle counts and the degeneracy ordering could be poten- tially parallelized, implementing a parallel method to rank vertices based on their degeneracy number or triangle count is in itself a non-trivial task. We decided not to parallelize these routines since the degeneracy- and triangle-based ordering did not yield significant benefits when compared with degree- based ordering, where as degree-based ordering is trivially available, without any additional computation. We assume that the entire graph is stored in available in shared global memory. The runtime of ParMCE consists of (1) the time required to rank vertices of the graph based on the ranking metric used in the algorithm, i.e. degree, degeneracy number, or triangle count of vertices and (2) the time required to enumerate all maximal cliques. For ParMCEDegen and ParMCETri algorithms, the runtime of ranking is also reported. Figures 1 and 2 show the parallel speedup (with respect to Dataset dblp-coauthors orkut as-skitter wiki-talk V 540,486 3,072,441 1,696,415 2,394,385 E 15,245,729 117,184,899 11,095,298 4,659,565 # maximal cliques 139,340 2,270,456,447 37,322,355 86,333,306 avg. size of a maximal clique 11 20 19 13 size of the maximum clique 337 51 67 26 TABLE I: Undirected graphs used for evaluation, and their properties. the runtime of TTT) and and the total computation time of ParMCE using different vertex ordering strategies, respectively. Table III shows the breakdown of the runtime into time for ordering and the time for clique enumeration. C. Performance of Parallel Clique Enumeration Algorithms The total runtimes of the parallel algorithms with 32 threads are shown in Table II. We observe that ParTTT achieves a speedup of 12x to 14x over the sequential algorithm TTT. The three versions of ParMCE, ParMCEDegree, ParMCEDegen, ParMCETri achieve a speedup of 15x to 31x with 32 threads, when we consider only the runtime for maximal clique enu- meration. This speedup are smaller for ParMCEDegen and ParMCETri when we add up the time taken by ranking strategies (See Figure 1). The reason for the higher runtimes of ParTTT when com- pared with ParMCE is the greater cumulative overhead of computing the pivot and in processing the cand and fini sets in ParTTT. For example, for dblp-coauthors graph, in ParTTT, the cumulative overhead of computing pivot is 248 sec. and cumulative overhead of updating the cand and fini is 38 sec. whereas in ParMCE, these number are 156 sec. and 21 sec. respectively and these reduced cumulative times in ParMCE are reflected in the overall reduction in the parallel enumeration time of ParMCE over ParTTT by a factor of 2. a) Impact of vertex ordering on overall performance of ParMCE: Next we consider the influence of different vertex ordering strategies, degree, degeneracy, and triangle count, on the performance of ParMCE. The total computation time when using different vertex ordering strategies are presented in Table III. Overall, we observe that degree based ordering (ParMCEDegree) usually achieves the smallest (or close to the smallest) runtime for clique enumeration, even when we don't take into account the time to compute the ordering. If we add in the time for computing the ordering, degree based ordering is clearly better than triangle count or degeneracy based orderings, since degree based ordering is available for free, while the degeneracy based ordering and triangle based ordering require additional computational overhead. b) Scaling up with the degree of parallelism: As the number of threads (and the degree of parallelism) increases, the runtime of ParMCE and of ParTTT decreases, and the speedup as a function of the number of threads is shown in Figure 1 and the runtimes are shown in Figure 2. We see that ParMCEDegree achieves a speedup of more than 15x on all graphs, using 32 threads. On the dblp-coauthors graph, the speedup with 32 threads was nearly 30x. To get a better understanding of the variation of speedups achieved on different input graphs, we plotted the distribution of the sizes of maximal cliques for different input graphs, see Figure 3. We observe that the speedup of ParMCE is higher on those graphs that have large maximal cliques. For instance, there are many maximal cliques of size in the range 100 to 330 for dblp-coauthors, and we observed the highest speedup, of nearly 30x with 32 threads, for dblp-coauthors. A good speedup of nearly 20x was also observed for the orkut graph, which has a large number of maximal cliques, which are of relatively large sizes (the average size of a maximal clique is 20). Overall, we see that the speedup obtained is roughly correlated with the complexity of the graph, measured in terms of the presence of large maximal cliques, as well as the number of such large maximal cliques. D. Comparison with prior work We compare the performance of ParMCE with prior se- quential and parallel algorithms for MCE. We consider the following sequential algorithms: GreedyBB due to Segundo et al. [50], TTT due to Tomita et al. [13], and BKDegeneracy due to Eppstein et al. [14]. For the comparison with parallel algorithm, we consider algorithm CliqueEnumerator due to Zhang et al. [20], Peamc due to Du et al. [21], PECO due to Svendsen et al. [18], and most recent parallel algorithm Hashing due to Lessley et al. [22]. The parallel algorithms CliqueEnumerator, Peamc, and Hashing are designed for the shared memory model, while PECO is designed for dis- tributed memory. We modified PECO to work with shared memory, by reusing the method for subproblem construction, and eliminating the need to communicate subgraphs by storing a single copy of the graph in shared memory. We considered three different ordering strategies for PECO, which we call PECODegree, PECODegen, and PECOTri. The comparison of performance of ParMCE with PECO is presented in Table IV. We note that ParMCE is significantly better than that of PECO, no matter which ordering strategy was considered. The comparison of ParMCE with other shared memory al- gorithms Peamc, CliqueEnumerator, and Hashing is shown in Table V. The performance of ParMCE is seen to be much better than that of any of these prior shared memory parallel algorithms. For the graph dblp-coauthor, Peamc did not finish within 5 hours, whereas ParMCE takes around 50 secs for enumerating 139K maximal cliques. The poor running time of Peamc is due to two following reasons: (1) the algorithm does not apply efficient pruning techniques such as pivoting, used in TTT, and (2) the method to determine DataSet TTT ParTTT ParMCEDegree ParMCEDegen ParMCETri dblp-coauthors orkut as-skitter wiki-talk 356 26,407 807 1022 28 1886 60 85 14 1362 45 62 21.4 2141.1 71.9 70.1 152.2 2278 85.6 89.2 TABLE II: Comparison of total computation time (in sec.) of ParMCE (with degree based, degeneracy based, and triangle count based vertex ordering) and computation time ParTTT (with 32 threads) with TTT. (a) dblp-coauthor (b) orkut (c) as-skitter (d) wiki-talk Fig. 1: Parallel speedup of ParMCEDegree, ParMCEDegen, ParMCETri, and ParTTT with respect to TTT as a function of the number of threads. We use total computation time (time for computing ranking + parallel enumeration time) for measuring the speedup. (a) dblp-coauthor (b) orkut (c) as-skitter (d) wiki-talk Fig. 2: Total computation time of ParMCEDegree, ParMCEDegen, ParMCETri, and ParTTT as a function of the number of threads. (a) dblp-coauthor (b) orkut (c) as-skitter (d) wiki-talk Fig. 3: Frequency distribution of sizes of maximal cliques across different input graphs. DataSet ParMCEDegree dblp-coauthors orkut as-skitter wiki-talk 14 1362 45 62 RT 8.4 599.1 26.9 8.1 ET 13 1542 45 62 TT 21.4 2141.1 71.9 70.1 ParMCEDegen ParMCETri RT 138.2 786.7 43.6 30.2 ET 14 1492 42 59 TT 152.2 2278 85.6 89.2 TABLE III: Total computation time (in sec.) of ParMCEDegree, ParMCEDegen, and ParMCETri. "RT" stands for time for computing the vertex ranking, "ET" stands for parallel enumeration time, and "TT" stands for total computation time. 248162432No.ofThreads100200300400500ParMCEDegreeParMCEDegeneracyParMCETriangleParTTT248162432No.ofThreads510152025ParallelSpeedup248162432No.ofThreads2.557.51012.51517.520ParallelSpeedup248162432No.ofThreads24681012141618ParallelSpeedup248162432No.ofThreads246810121416ParallelSpeedup248162432No.ofThreads100200300400500ParMCEDegreeParMCEDegeneracyParMCETriangleParTTT248162432No.ofThreads50100150200Time(sec)248162432No.ofThreads250050007500100001250015000175002000022500Time(sec)248162432No.ofThreads100200300400500Time(sec)248162432No.ofThreads100200300400500600700Time(sec)50100150200250300SizeofMaximalClique100101102103104Frequency1020304050SizeofMaximalClique101102103104105106107108Frequency102030405060SizeofMaximalClique101102103104105106Frequency510152025SizeofMaximalClique102103104105106107Frequency DataSet PECODegree dblp-coauthors orkut as-skitter wiki-talk 73 2001 272 1423 ParMCEDegree 14 1362 45 62 PECODegen 78 7502 450 1776 ParMCEDegen 14 1542 45 62 PECOTri 74 2500 267 1534 ParMCETri 13 1492 42 59 TABLE IV: Comparison of parallel enumeration time (in sec.) of ParMCE with PECO (modified to use shared memory), using 32 threads. Three different variants are considered for each algorithm, based on the ordering strategy used. DataSet ParMCEDegree Hashing Clique Enumerator Peamc dblp-coauthors orkut as-skitter wiki-talk 14 1362 45 62 run out of memory in 3 min. run out of memory in 7 min. run out of memory in 5 min. run out of memory in 10 min. run out of memory in 10 min. run out of memory in 20 min. run out of memory in 10 min. run out of memory in 20 min. did not complete in 5 hours. did not complete in 5 hours. did not complete in 5 hours. did not complete in 5 hours. TABLE V: Comparison of total computation time (in sec.) of ParMCE with Hashing. the maximality of a clique in the search space is not efficient. The CliqueEnumerator algorithms run out of memory after a few minutes. The reason is that CliqueEnumerator maintains a bit vector for each vertex that is as large as the size of the input graph, and additionally, needs to store intermediate non-maximal cliques. For each such non-maximal clique, it is required to maintain a bit vector of length equal to the size of the vertex set of the original graph. Therefore, in CliqueEnumerator a memory issue is inevitable for a graph with millions of vertices. A recent parallel algorithm in the literature, Hashing also has a significant memory overhead, and ran out of memory on the input graphs that we considered. The reason for its high memory requirement is that Hashing enumerates intermedi- ate non-maximal cliques before finally outputting maximal cliques. The number of such intermediate non-maximal cliques may be very large, even for graphs with few number of maximal cliques. For example, a maximal clique of size c contains 2c − 1 non-maximal cliques. Next, we compare the performance of ParMCE with that of sequential algorithms BKDegeneracy and a recent sequential algorithm GreedyBB -- results are in Table VI. For large graphs, the performance of BKDegeneracy is almost similar to TTT whereas GreedyBB performs much worse than TTT. Since our ParMCE algorithm outperforms TTT, we can conclude that ParMCE is significantly faster than other sequential algorithms. E. Summary of Experimental Results We found that both ParTTT and ParMCE yield signifi- cant speedups over the sequential algorithm TTT, sometimes as much as the number of cores available. ParMCE using the degree-based vertex ranking always performs better than ParTTT. The runtime of ParMCE using degeneracy/triangle count based vertex ranking is sometimes worse than ParTTT due to the overhead of sequential computation of vertex ranking -- note that this overhead is not needed in ParTTT. The parallel speedup of ParMCE is better when the input graph has many large sized maximal cliques. Overall, ParMCE con- sistently outperforms prior sequential and parallel algorithms for MCE. VI. CONCLUSION We presented shared memory parallel algorithms for enu- merating maximal cliques from a graph. ParTTT is a work- efficient parallelization of a sequential algorithm due to Tomita et al. [13], and ParMCE is a practical adaptation of ParTTT that has more opportunities for parallelization and better load bal- ancing. Our algorithms are significant improvements compared with the current state-of-the-art on MCE. Our experiments show that ParMCE has a speedup of up to 31x (on a 32 core machine) when compared with an efficient sequential baseline. In contrast, prior shared memory parallel methods for MCE were either unable to process the same graphs in a reasonable time, or ran out of memory. Many questions remain open : (1) Can these methods scale to even larger graphs, and to machines with larger numbers of cores (2) How can one adapt these methods to other parallel systems such as a cluster of computers with a combination of shared and distributed memory, or GPUs? REFERENCES [1] G. Palla, I. Der´enyi, I. Farkas, and T. Vicsek, "Uncovering the overlap- ping community structure of complex networks in nature and society," Nature, vol. 435, no. 7043, pp. 814 -- 818, 2005. [2] O. Rokhlenko, Y. Wexler, and Z. Yakhini, "Similarities and differences of gene expression in yeast stress conditions," Bioinformatics, vol. 23, no. 2, pp. e184 -- e190, 2007. [3] S. Koichi, M. Arisaka, H. Koshino, A. Aoki, S. Iwata, T. Uno, and H. Satoh, "Chemical structure elucidation from 13c nmr chemical shifts: Efficient data processing using bipartite matching and maximal clique algorithms," Journal of chemical information and modeling, vol. 54, no. 4, pp. 1027 -- 1035, 2014. [4] H. M. Grindley, P. J. Artymiuk, D. W. Rice, and P. Willett, "Identification of tertiary structure resemblance in proteins using a maximal common subgraph isomorphism algorithm," J. Mol. Biol., vol. 229, no. 3, pp. 707 -- 721, 1993. [5] M. Hattori, Y. Okuno, S. Goto, and M. Kanehisa, "Development of a chemical structure comparison method for integrated analysis of chemical and genomic information in the metabolic pathways," J. Am. Chem. Soc., vol. 125, no. 39, pp. 11 853 -- 11 865, 2003. [6] S. Mohseni-Zadeh, P. Br´ezellec, and J.-L. Risler, "Cluster-c, an algo- rithm for the large-scale clustering of protein sequences based on the extraction of maximal cliques," Comp. Biol. Chem., vol. 28, no. 3, pp. 211 -- 218, 2004. [7] Y. Chen and G. M. Crippen, "A novel approach to structural alignment using realistic structural and environmental information," Protein sci- ence, vol. 14, no. 12, pp. 2935 -- 2946, 2005. DataSet dblp-coauthors orkut as-skitter wiki-talk BKDegeneracy GreedyBB ParMCEDegree ParMCEDegen ParMCETri 231 19,958 588 844 did not finish in 30 min. run out of memory in 5 min. out of memory in 10 min. run out of memory in 10 min. 14 1362 45 62 21.4 2141.1 71.9 70.1 152.2 2278 85.6 89.2 TABLE VI: Total computation time (sec.) of ParMCE (with 32 threads) and sequential BKDegeneracy and GreedyBB. [8] P. F. Jonsson and P. A. Bates, "Global topological features of cancer proteins in the human interactome," Bioinformatics, vol. 22, no. 18, pp. 2291 -- 2297, 2006. [9] B. Zhang, B.-H. Park, T. Karpinets, and N. F. Samatova, "From pull- down data to protein interaction networks and complexes with biological relevance," Bioinformatics, vol. 24, no. 7, pp. 979 -- 986, 2008. [10] D. Koller and N. Friedman, Probabilistic Graphical Models: Principles and Techniques. MIT Press, 2009. [11] J. W. Moon and L. Moser, "On cliques in graphs," Israel J. Math., vol. 3, no. 1, pp. 23 -- 28, 1965. [12] C. Bron and J. Kerbosch, "Algorithm 457: finding all cliques of an undirected graph," Commun. ACM, vol. 16, no. 9, pp. 575 -- 577, 1973. [13] E. Tomita, A. Tanaka, and H. Takahashi, "The worst-case time complex- ity for generating all maximal cliques and computational experiments," Theoretical Computer Science, vol. 363, no. 1, pp. 28 -- 42, 2006. [14] D. Eppstein, M. Loffler, and D. Strash, "Listing all maximal cliques in sparse graphs in near-optimal time," in ISAAC, 2010, pp. 403 -- 414. [15] B. Wu, S. Yang, H. Zhao, and B. Wang, "A distributed algorithm to enumerate all maximal cliques in mapreduce," in Frontier of Computer Science and Technology, 2009. FCST'09. Fourth International Confer- ence on. IEEE, 2009, pp. 45 -- 51. [16] M. C. Schmidt, N. F. Samatova, K. Thomas, and B.-H. Park, "A scalable, parallel algorithm for maximal clique enumeration," Journal of Parallel and Distributed Computing, vol. 69, no. 4, pp. 417 -- 428, 2009. [17] L. Lu, Y. Gu, and R. Grossman, "dmaximalcliques: A distributed algorithm for enumerating all maximal cliques and maximal clique distribution," in Data Mining Workshops (ICDMW), 2010 IEEE Inter- national Conference on. IEEE, 2010, pp. 1320 -- 1327. [18] M. Svendsen, A. P. Mukherjee, and S. Tirthapura, "Mining maximal cliques from a large graph using mapreduce: Tackling highly uneven subproblem sizes," Journal of Parallel and distributed computing, vol. 79, pp. 104 -- 114, 2015. [19] Y. Xu, J. Cheng, and A. W.-C. Fu, "Distributed maximal clique com- putation and management," IEEE Transactions on Services Computing, vol. 9, no. 1, pp. 110 -- 122, 2016. [20] Y. Zhang, F. N. Abu-Khzam, N. E. Baldwin, E. J. Chesler, M. A. Langston, and N. F. Samatova, "Genome-scale computational ap- proaches to memory-intensive applications in systems biology," in Proceedings of the 2005 ACM/IEEE conference on Supercomputing. IEEE Computer Society, 2005, p. 12. [21] N. Du, B. Wu, L. Xu, B. Wang, and P. Xin, "Parallel algorithm for enumerating maximal cliques in complex network," in Mining Complex Data. Springer, 2009, pp. 207 -- 221. [22] B. Lessley, T. Perciano, M. Mathai, H. Childs, and E. W. Bethel, "Maximal clique enumeration with data-parallel primitives," in 2017 IEEE 7th Symposium on Large Data Analysis and Visualization (LDAV). IEEE, 2017, pp. 16 -- 25. [23] J. Shun, Shared-memory parallelism can be simple, fast, and scalable. Morgan & Claypool, 2017. [24] S. Tsukiyama, M. Ide, H. Ariyoshi, and I. Shirakawa, "A new algorithm for generating all the maximal independent sets," SIAM J. Comput., vol. 6, no. 3, pp. 505 -- 517, 1977. [25] N. Chiba and T. Nishizeki, "Arboricity and subgraph listing algorithms," SIAM J. Comput., vol. 14, pp. 210 -- 223, 1985. [26] I. Koch, "Enumerating all connected maximal common subgraphs in two graphs," Theoretical Computer Science, vol. 250, no. 1, pp. 1 -- 30, 2001. [27] K. Makino and T. Uno, "New algorithms for enumerating all maximal cliques," in SWAT, 2004, pp. 260 -- 272. [28] F. Cazals and C. Karande, "A note on the problem of reporting maximal cliques," Theoretical Computer Science, vol. 407, no. 1, pp. 564 -- 568, 2008. [29] D. Eppstein and D. Strash, "Listing all maximal cliques in large sparse real-world graphs," in Experimental Algorithms, ser. LNCS, P. Pardalos and S. Rebennack, Eds., 2011, vol. 6630, pp. 364 -- 375. [30] D. Avis and K. Fukuda, "Reverse search for enumeration," Discrete Applied Mathematics, vol. 65, pp. 21 -- 46, 1993. [31] F. Kose, W. Weckwerth, T. Linke, and O. Fiehn, "Visualizing plant metabolomic correlation networks using clique-metabolite matrices." Bioinformatics, vol. 17, no. 12, pp. 1198 -- 1208, 2001. [32] D. S. Johnson, M. Yannakakis, and C. H. Papadimitriou, "On generating all maximal independent sets," Information Processing Letters, vol. 27, no. 3, pp. 119 -- 123, 1988. [33] J. Cheng, Y. Ke, A. W.-C. Fu, J. X. Yu, and L. Zhu, "Finding maximal cliques in massive networks," TODS, vol. 36, no. 4, p. 21, 2011. [34] A. Das, M. Svendsen, and S. Tirthapura, "Change-sensitive algorithms for maintaining maximal cliques in a dynamic graph," CoRR, vol. abs/1601.06311, 2016. [Online]. Available: http://arxiv.org/abs/1601. 06311 [35] V. Stix, "Finding all maximal cliques in dynamic graphs," Comput. Optim. Appl., vol. 27, no. 2, pp. 173 -- 186, 2004. [36] T. J. Ottosen and J. Vomlel, "Honour thy neighbour: clique maintenance in dynamic graphs," in PGM, 2010, pp. 201 -- 208. [37] N. Du, B. Wu, L. Xu, B. Wang, and X. Pei, "A parallel algorithm for enumerating all maximal cliques in complex network," in Data Mining Workshops, 2006. ICDM Workshops 2006. Sixth IEEE International Conference on. IEEE, 2006, pp. 320 -- 324. [38] J. Cheng, L. Zhu, Y. Ke, and S. Chu, "Fast algorithms for maximal clique enumeration with limited memory," in Proceedings of the 18th ACM SIGKDD international conference on Knowledge discovery and data mining. ACM, 2012, pp. 1240 -- 1248. [39] A. Montresor, F. De Pellegrini, and D. Miorandi, "Distributed k-core decomposition," IEEE Transactions on parallel and distributed systems, vol. 24, no. 2, pp. 288 -- 300, 2013. [40] N. S. Dasari, R. Desh, and M. Zubair, "Park: An efficient algorithm for k-core decomposition on multicore processors," in Big Data (Big Data), 2014 IEEE International Conference on. IEEE, 2014, pp. 9 -- 16. [41] H. Kabir and K. Madduri, "Parallel k-core decomposition on multicore platforms," in Parallel and Distributed Processing Symposium Work- shops (IPDPSW), 2017 IEEE International. IEEE, 2017, pp. 1482 -- 1491. [42] A. E. Sariyuce, C. Seshadhri, and A. Pinar, "Parallel local algo- truss, and nucleus decompositions," arXiv preprint rithms for core, arXiv:1704.00386, 2017. [43] H. Kabir and K. Madduri, "Shared-memory graph truss decomposition," arXiv preprint arXiv:1707.02000, 2017. [44] -- -- , "Parallel k-truss decomposition on multicore systems," in High Performance Extreme Computing Conference (HPEC), 2017 IEEE. IEEE, 2017, pp. 1 -- 7. [45] A. P. Mukherjee and S. Tirthapura, "Enumerating maximal bicliques from a large graph using mapreduce," IEEE Trans. Services Computing, vol. 10, no. 5, pp. 771 -- 784, 2017. [46] G. E. Blelloch and B. M. Maggs, "Parallel algorithms," in Algorithms and theory of computation handbook, 2010, pp. 25 -- 25. [47] J. Kunegis, "Konect: the koblenz network collection," in Proceedings of the 22nd International Conference on World Wide Web. ACM, 2013, pp. 1343 -- 1350. [48] J. Leskovec and A. Krevl, "SNAP Datasets: Stanford large network dataset collection," http://snap.stanford.edu/data, 2014. [49] R. A. Rossi and N. K. Ahmed, "The network data repository with interactive graph analytics and visualization," in Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015. [Online]. Available: http://networkrepository.com [50] P. San Segundo, J. Artieda, and D. Strash, "Efficiently enumerating all maximal cliques with bit-parallelism," Computers & Operations Research, vol. 92, pp. 37 -- 46, 2018.
1102.4884
3
1102
2011-04-29T18:50:33
Upper Bounds for Maximally Greedy Binary Search Trees
[ "cs.DS" ]
At SODA 2009, Demaine et al. presented a novel connection between binary search trees (BSTs) and subsets of points on the plane. This connection was independently discovered by Derryberry et al. As part of their results, Demaine et al. considered GreedyFuture, an offline BST algorithm that greedily rearranges the search path to minimize the cost of future searches. They showed that GreedyFuture is actually an online algorithm in their geometric view, and that there is a way to turn GreedyFuture into an online BST algorithm with only a constant factor increase in total search cost. Demaine et al. conjectured this algorithm was dynamically optimal, but no upper bounds were given in their paper. We prove the first non-trivial upper bounds for the cost of search operations using GreedyFuture including giving an access lemma similar to that found in Sleator and Tarjan's classic paper on splay trees.
cs.DS
cs
Upper Bounds for Maximally Greedy Binary Search Trees Kyle Fox Department of Computer Science, University of Illinois, Urbana-Champaign [email protected] Abstract. At SODA 2009, Demaine et al. presented a novel connec- tion between binary search trees (BSTs) and subsets of points on the plane. This connection was independently discovered by Derryberry et al. As part of their results, Demaine et al. considered GreedyFuture, an offline BST algorithm that greedily rearranges the search path to min- imize the cost of future searches. They showed that GreedyFuture is actually an online algorithm in their geometric view, and that there is a way to turn GreedyFuture into an online BST algorithm with only a constant factor increase in total search cost. Demaine et al. conjectured this algorithm was dynamically optimal, but no upper bounds were given in their paper. We prove the first non-trivial upper bounds for the cost of search operations using GreedyFuture including giving an access lemma similar to that found in Sleator and Tarjan's classic paper on splay trees. 1 Introduction The dynamic optimality conjecture states that given a sequence of success- ful searches on an n-node binary search tree, the number of nodes accessed by splay trees is at most a constant times the number of node accesses and rota- tions performed by the optimal algorithm for that sequence. Sleator and Tarjan gave this conjecture in their paper on splay trees in which they showed O(log n) amortized performance as well as several other upper bounds [12]. Proving the dynamic optimality conjecture seems very difficult. There is no known polyno- mial time algorithm for finding an optimal BST in the offline setting where we know all searches in advance,1 and this conjecture states that splaying is a simple solution to the online problem. Until recently, there has been little progress made directly related to this conjecture. Wilber gave two lower bounds on the number of accesses needed for any given search sequence [16]. There are a handful of online BST algorithms that are O(log log n)-competitive [5,15,14,1], but no upper bound is known for the competitiveness of splay trees except the trivial O(log n). 1 In fact, the exact optimization problem becomes NP-hard if we must access an arbitrary number of specified nodes during each search [4]. 1.1 A Geometric View Recently, Demaine et al. introduced a new way of conceptualizing BSTs using geometry [4]. A variant of this model was independently discovered by Derry- berry et al. [6]. In the geometric view, BST node accesses are represented as points (x, y) where x denotes the rank of the accessed node and y represents which search accessed the node. A pair of points a and b in point set P are called arborally satisfied if they lie on the same horizontal or vertical line, or if the closed rectangle with corners a and b contains another point from P . The family of arborally satisfied point sets corresponds exactly to BST accesses when rotations upon accessed nodes are allowed [4]. By starting with a point set X that represents the points a BST must access to complete searches in a given search sequence S, we can describe an optimal BST algorithm for S as a minimum superset of X that is arborally satisfied [4]. This correspondence between BSTs and arborally satisfied supersets allows us to focus on algorithms strictly in the geometric view. Additionally, it is possible to show lower bounds for the BST model by showing the same for the geomet- ric model. Demaine et al. take advantage of this fact to show a class of lower bounds that supersede the lower bounds of Wilber [16,4]. Further, it is possible to describe an online version of the arborally satisfied superset problem and transform solutions to this problem into online BST algorithms with at most a constant factor increase in cost [4]. 1.2 Being Greedy Demaine et al. also consider an offline BST algorithm they call GreedyFuture, originally proposed by Lucas [10] and Munro [11]. GreedyFuture only touches nodes on the search path, and then rearranges the search path in order to greedily minimize the time for upcoming searches. The worst-case example known for the competitiveness of GreedyFuture is a complete binary search tree with searches performed in bit-reversal order upon the leaves [11]. GreedyFuture has an amortized cost of lg n per search on this sequence. The optimal algorithm rotates the leaves closer to the root and obtains an amortized cost of lg n 2 + o(1). Given a search sequence of length m, let OPT be the total cost of the optimal algorithm for that sequence. Demaine et al. conjecture that GreedyFuture is O(1)-competitive. In fact, the bit-reversal example suggests that the cost of GreedyFuture is at most OPT + m; it appears optimal within an additive term. Surprisingly, Demaine et al. showed that GreedyFuture, an offline algo- rithm that uses very strong knowledge about the future, is actually an online algorithm in the geometric model [4]. Recall that online algorithms in the geo- metric model correspond to online algorithms in the BST model with essentially the same cost. If GreedyFuture is actually an offline dynamically optimal BST algorithm as it appears to be, then there exists an online dynamically optimal BST algorithm. 1.3 Our Contributions Despite the apparent optimality of the GreedyFuture algorithm, nothing was known about its amortized behavior when Demaine et al. wrote their report. We provide the first theoretical evidence that GreedyFuture is an optimal algorithm in the following forms: -- An access lemma similar to that used by Sleator and Tarjan for splay trees [12]. This lemma implies several upper bounds including O(log n) amortized per- formance. -- A sequential access theorem that states GreedyFuture takes linear time to access all nodes in order starting from any arbitrary BST. We heavily use the geometric model of Demaine et al. to prove the access lemma while focusing directly on BSTs to prove the sequential access theo- rem. It is our hope that these results will create further interest in studying GreedyFuture as its structural properties seem well suited for further theo- retical analysis (the proof of the sequential access theorem takes only a page). Additionally, the proof of the access lemma may provide additional insight into other algorithms running in the geometric model. 1.4 A Note on Independent Work John Iacono and Mihai Patra¸scu have discovered a similar access lemma to that given here using different proof techniques from those shown below. The author learned about their work via personal correspondence with them and Erik Demaine well into performing the research contained in this report. Their results have never been published. Additionally, the author became aware of work by Goyal and Gupta [8] after initially writing this report. They show GreedyFuture has O(log n) amortized performance. This result appears in our paper as Corollary 2. As in our proof, they use the geometric model, but they do not use a potential function as we do to prove a more general access lemma. 2 Arboral and Geometric Models of BSTs 2.1 The Arboral Model We will consider the same BST model used by Demaine et al. [4]. We consider only successful searches and not insertions or deletions. Let n and m be the number of elements in the search tree and the number of searches respectively. We assume the elements have distinct keys in {1, . . . , n}. Given a BST T1, a subtree τ of T1 containing the root, and a tree τ ′ on the same nodes as τ , we say T1 can be reconfigured by an operation τ → τ ′ to another BST T2 if T2 is identical to T1 except for τ being replaced by τ ′. The cost of the reconfiguration is τ = τ ′. Given a search sequence S = hs1, s2, . . . , smi, we say a BST algorithm ex- ecutes S by an execution E = hT0, τ1 → τ ′ mi if all reconfigu- rations are performed on subtrees containing the root, and si ∈ τi for all i. 1, . . . , τm → τ ′ cost of execution E is Pm i=1 τi. As explained by Demaine et al. [4], this model is constant-factor equivalent to other reasonable BST models such as those by Wilber and Lucas [16,10]. 2.2 The Geometric Model We now turn our focus to the geometric model as given by Demaine et al. [4]. Define a point p to be a point in 2D with integer coordinates (p.x, p.y) such that 1 ≤ p.x ≤ n and 1 ≤ p.y ≤ m. Let (cid:3)ab denote the closed axis-aligned rectangle with corners a and b. A pair of points (a, b) (or their induced rectangle (cid:3)ab) is arborally satisfied with respect to a point set P if (1) a and b are orthogonally collinear (horizontally or vertically aligned), or (2) there is at least one point from P \ {a, b} in (cid:3)ab. A point set P is arborally satisfied if all pairs of points in P are arborally satisfied with respect to P . See Fig. 1 and Fig. 2. As explained in [4], there is a one-to-one correspondence between BST exe- cutions and arborally satisfied sets of points. Let the geometric view of a BST execution E be the point set P (E) = {(x, y)x ∈ τy}. The point set P (E) for any BST execution E is arborally satisfied [4]. Further, for any arborally satisfied point set X, there exists a BST execution E with P (E) = X [4]. Let the geometric view of an access sequence S be the set of points P (S) = {(s1, 1), (s2, 2), . . . , (sm, m)}. The above facts suggest that finding an optimal BST algorithm for S is equivalent to finding a minimum cardinality arborally satisfied superset of S. Due to this equivalence with BSTs, we will refer to values in {1, . . . , n} as elements. Naturally, we may want to use the geometric model to find dynamically op- timal online BST algorithms. The online arborally satisfied superset (on- line ASS) problem is to design an algorithm that receives a sequence of points h(s1, 1), (s2, 2), . . . , (sm, m)i incrementally. After receiving the ith point (si, i), the algorithm must output a set Pi of points on the line y = i such that {(s1, 1), (s2, 2), . . . , (si, i)} ∪ P1 ∪ P2 ∪ · · · ∪ Pi is arborally satisfied. The cost of For i = 1, 2, . . . , m, define Ti to be Ti−1 with the reconfiguration τi → τ ′ i . The the algorithm is m +Pm i=1 Pi. We say an online ASS algorithm performs a search at time i when it outputs the set Pi. Further, we say an online ASS algorithm accesses x at time i if (x, i) is included in the input set of points or in Pi. The (non-amortized) cost of a search at time i is Pi + 1. Unfortunately, the algorithm used to create a BST execution from an arbo- rally satisfied point set requires knowledge about points above the line y = i to construct Ti [4]. We are not able to go directly from a solution to the online ASS problem to a solution for the online BST problem with exactly the same cost. However, this transformation is possible if we allow the cost of the BST algorithm to be at most a constant multiple of the ASS algorithm's cost [4]. Fig. 1. An unsatisfied pair of points. The closed axis-aligned rectangle with corners defined by the pair is shown. Fig. 2. An arborally satisfied superset of the same pair of points 3 GreedyFuture We now turn our focus to describing the GreedyFuture algorithm in more detail. Let S = hs1, . . . , smi be an arbitrary search sequence of length m. After every search, GreedyFuture will rearrange the search path to minimize the cost of future searches. More precisely, consider the ith search for the given sequence S. If i = m, then GreedyFuture does not rearrange the search path. Otherwise, if si+1 lies on the search path τi, GreedyFuture makes si+1 the root of τ ′ i . If si+1 does not lie along the search path, then GreedyFuture makes the predecessor and successor of si+1 within τi the root and root's right child of τ ′ i (if the successor (predecessor) does not exist, then GreedyFuture makes the predecessor (suc- cessor) the root and does not assign a right (left) child within τ ′ i .) Now that it has fixed one or two nodes xℓ and xr with xℓ < xr, GreedyFuture recursively sets the remaining nodes of τi less than xℓ using the subsequence of hsi+1, . . . , smi containing nodes less than xℓ. It then sets the nodes of τi greater than xr using the subsequence of hsi+1, . . . , smi containing nodes greater than xr. Taking a cue from Demaine et al., we will call the online geometric model of the algorithm GreedyASS. Let X = P (S) for some BST access sequence S. At each time i, GreedyASS simply outputs the minimal set of points at y = i needed to satisfy X up to y ≤ i. We note that the set of points needed to satisfy X up to y ≤ i is uniquely defined. For each unsatisfied rectangle formed with (si, i) in one corner, we add the other corner at y = i. We can also define GreedyASS as an algorithm that sweeps right and left from the search node, accessing nodes that have increasingly greater last access times. See Fig. 3. GreedyASS, the online geometric view of GreedyFuture, greatly reduces the complexity of predicting GreedyFuture's behavior. By focusing our atten- tion on this geometric algorithm, we proceed to prove several upper bounds on both algorithms' performance in the following section. 4 An Access Lemma and its Corollaries In their paper on splay trees, Sleator and Tarjan prove the access lemma, a very general expression detailing the amortized cost of a splay (and therefore search) operation [12]. They use this lemma to prove several upper bounds, including the entropy bound, the static finger bound, and the working set bound. time time key key Fig. 3. (Left) A sample execution of GreedyASS. Search elements are represented as solid disks. For the latest search, GreedyASS sweeps right, placing points when the greatest last access time seen increases. The staircase represents these increasing last access times. Fig. 4. (Right) Later in the same execution of GreedyASS. The most recent neigh- borhoods for two of the elements are represented as line segments surrounding those elements. Observe that adding another search for anything within a neighborhood will result in accessing the corresponding element for that neighborhood. Wang et al. prove a similar lemma for their multi-splay tree data structure to show O(log log n)-competitiveness and O(log n) amortized performance, and the version of the lemma given in Wang's Ph.D. thesis is used to prove the other distribution sensitive upper bounds listed above [15,14]. In this section, we provide a similar lemma for GreedyASS and discuss its consequences. 4.1 Potentials and Neighborhoods Fix a BST access sequence S and let X = P (S). We consider the execution of GreedyASS on X. Let ρ(x, i) be the last access of x at or before time i. For- mally, ρ(x, i) is the y coordinate of the highest point on the closed ray from (x, i) to (x, −∞). Let a be the greatest positive integer smaller than x such that ρ(a, i) ≥ ρ(x, i) (or let a = 0 if no such integer exists). The left neighborhood of x at time i is {a + 1, a + 2, . . . , x − 1} and denoted Γℓ(x, i). The right neighborhood of x at time i is defined similarly and denoted Γr(x, i). Finally, the inclusive neigh- borhood of x at time i is Γ (x, i) = Γℓ(x, i) ∪ Γr(x, i) ∪ {x}. The inclusive neighborhood of x at time i contains precisely those keys whose appearance as si+1 would prompt GreedyASS to access x at time i + 1. Intu- itively, the inclusive neighborhood is similar to a node's subtree in the arboral model. See Fig. 4. Assign to each element x ∈ {1, . . . , n} a positive real weight w(x). The size of x at time i is σ(x, i) = Pe∈Γ (x,i) w(e). The rank of x at time i and let the amortized cost of a search at time i be 1 + Pi + Φ(i) − Φ(i − 1). is r(x, i) = ⌊lg σ(x, i)⌋. Finally, define a potential function Φ(i) = Px∈[n] r(x, i) Lemma 1 (Access Lemma). Let W = Px∈[n] w(x). The amortized cost of a search at time i is at most 5 + 6 ⌊lg W ⌋ − 6r(si, i − 1). 4.2 Immediate Consequences Before we proceed to prove Lemma 1, we will show several of its consequences. Recall that the equivalence between the arboral and geometric models mean these corollaries apply to both GreedyASS and GreedyFuture. The proofs of these corollaries mirror the proofs by Sleator and Tarjan for splay trees [12]. Corollary 2 (Balance Theorem). The total cost of searching is O((m + n)× log n). Corollary 3 (Static Optimality Theorem). Let t(x) be the number of times x appears in the search sequence S. If every element is searched at least once, the x=1 t(x) log (m/t(x))). Corollary 4 (Static Finger Theorem). Fix some element f . The total cost total cost of searching is O (m +Pn of searching is O(m +Pm i=1 log(si − f + 1)). Corollary 5 (Working Set Theorem). Let d(i) be the number of distinct elements in the search sequence S before si and since the last instance of si. If there are no earlier instances of si, then let d(i) = i − 1. The total cost of searching is O(m +Pm i=1 log(d(i) + 1)). Note that Corollary 5 implies other upper bounds on GreedyFuture's perfor- mance such as key-independent optimality [9]. 4.3 Telescoping Rank Changes We proceed to prove Lemma 1. First we observe the following. Lemma 6. Let x be any element not accessed during search i. Then we have Γ (x, i − 1) = Γ (x, i). Proof: Assume without loss of generality that x > si. Let xℓ be the greatest element in {si, si + 1, . . . , x − 1} such that ρ(xℓ, i − 1) ≥ ρ(x, i − 1). Element xℓ must exist, because GreedyASS does not access x at time i. No elements in {xℓ + 1, . . . , x − 1} are accessed at time i since they have smaller last access time than xℓ, so Γℓ(x, i − 1) = Γℓ(x, i). Likewise, no elements in Γr(x, i − 1) are accessed at time i since they have smaller last access time than x. The inclusive neighborhood of x (as well as its size and rank) remains unchanged by the search. (cid:3) Consider a search at time i. Lemma 6 immediately implies the amortized cost of the search is equal to Xx∈Pi∪{si} (1 + r(x, i) − r(x, i − 1)) . (1) Suppose we access an element x 6= si. Assume x > si without loss of generality. If it exists, let xr be the least accessed element greater than x. We call xr the successor of x. Observe that Γ (x, i) contains a subset of the elements in {si + 1, . . . , xr − 1} while Γ (xr, i − 1) contains a superset of the elements in {si, . . . , xr}. This fact implies Γ (x, i) ⊂ Γ (xr, i − 1) which in turn implies σ(x, i) < σ(xr, i − 1) and r(x, i) ≤ r(xr, i − 1). If the second inequality is strict, then 1 + r(x, i) − r(x, i − 1) ≤ r(xr, i − 1) − r(x, i − 1). Otherwise, 1 + r(x, i) − r(x, i − 1) = 1 + r(xr, i − 1) − r(x, i − 1). (2) (3) (4) Call an accessed element x > si a stubborn element if x has a successor xr and r(x, i) = r(xr, i − 1). From (1), (3), and (4) above, the amortized cost of accessing elements greater than si forms a telescoping sum and we derive the following lemma. Lemma 7. Let α be the number of elements greater than si that are stubborn and let erℓ and err be the least and greatest elements greater than si to be accessed. The amortized cost of accessing elements greater than si is 1 + α + r(err, i) − r(erℓ, i − 1). 4.4 Counting Stubborn Elements The biggest technical challenge remaining is to upper bound the number of stubborn elements α. We have the following lemma. Lemma 8. The number of accessed elements greater than si which are stubborn is at most 1 + 2 ⌊lg W ⌋ − 2r(si, i − 1) Proof: Consider any stubborn element x > si and its successor xr. Let the left size of x at time i be σℓ(x, i) = Pe∈Γℓ(x,i) w(e). Further, let the left rank of x at time i be rℓ(x, i) = ⌊lg(σℓ(x, i))⌋. By the definitions of stubborn elements and left sizes we see σ(x, i) > 1 2 σ(xr, i − 1) > 1 2 σℓ(xr, i − 1). (5) We note that for any accessed element v (stubborn or not) with si < v < x we have 1 2 σℓ(v, i − 1) < σℓ(xr, i − 1) (6) by (5) since every element of Γℓ(v, i − 1) is in Γℓ(xr, i − 1), but none of these elements are in Γ (x, i) since the left neighborhood of x at time i cannot extend past v. Further, σℓ(x, i − 1) ≥ σ(si, i − 1) (7) since all weights are positive and every element in Γ (si, i−1) is also in Γℓ(x, i−1). Let z > si be the greatest stubborn element, and let zr be its successor. We will inductively argue the number of stubborn elements is at most 1 + 2rℓ(zr, i − 1) − 2r(si, i − 1) which is a stronger statement than that given in the lemma. The argument can be divided into two cases. 1. Suppose σℓ(zr, i − 1) < 2σ(si, i − 1). For any stubborn element v between si and z we have σℓ(v, i − 1) < σ(si, i − 1) by (6). There can be no such element v by (7), making z the only stubborn element. The total number of stubborn elements is 1 ≤ 1 + 2rℓ(z, i − 1) − 2r(si, i − 1) ≤ 1 + 2rℓ(zr, i − 1) − 2r(si, i − 1) by (7) and the definition of left rank. 2. Now suppose σℓ(zr, i − 1) ≥ 2σ(si, i − 1). Consider any stubborn element v with successor vr such that si < v < vr < z. Note that if a stubborn element exists with z as its successor, v cannot be this stubborn element. We have σℓ(vr, i − 1) < 1 2 σℓ(zr, i − 1) by (6). By induction on the left sizes of stubborn element successors greater than si, the successors of at most 1 + 2(cid:22)lg(cid:18) 1 2 σℓ(zr, i − 1)(cid:19)(cid:23) − 2r(si, i − 1) stubborn elements can have this smaller left size. Counting z and the one other stubborn element that may exist with z as its successor, the total number of stubborn elements is at most 3 + 2(cid:22)lg(cid:18) 1 2 σℓ(zr, i − 1)(cid:19)(cid:23) − 2r(si, i − 1) = 1 + 2rℓ(zr, i − 1) − 2r(si, i − 1). (cid:3) 4.5 Finishing the Proof We now conclude the proof of Lemma 1. Proof: By Lemma 6, the amortized cost of accessing si alone is 1 + r(si, i) − r(si, i − 1) ≤ 5 + 6 ⌊lg W ⌋ − 6r(si, i − 1) so the lemma holds in this case. If all other accessed elements are greater than si, let erℓ and err be the least and greatest of these elements. Observe r(erℓ, i − 1) ≥ r(si, i) and r(err, i) ≤ ⌊lg W ⌋. By Lemma 7 and Lemma 8, the total amortized cost of accessing ele- ments is at most 3 + r(si, i) − 3r(si, i − 1) + 2 ⌊lg W ⌋ + r(err, i) − r(erℓ, i − 1) ≤ 3 + 3 ⌊lg W ⌋ − 3r(si, i − 1) ≤ 5 + 6 ⌊lg W ⌋ − 6r(si, i − 1) so the lemma holds in this case. It also holds in the symmetric case when all accessed elements are smaller than si. Finally, consider the case when there are accessed elements both greater than and less than si. Let eℓℓ and eℓr be the least and greatest elements less than si. Observe r(eℓℓ, i) ≤ ⌊lg W ⌋ and r(eℓr, i − 1) ≥ r(si, i − 1). By two applications of Lemma 7 and Lemma 8, the total amortized cost of the search is at most 5 + r(si, i) − 5r(si, i − 1) + 4 ⌊lg W ⌋ + r(err, i) − r(erℓ, i − 1) + r(eℓℓ, i) − r(eℓr, i − 1) ≤ 5 + 6 ⌊lg W ⌋ − 6r(si, i − 1) (cid:3) 5 A Sequential Access Theorem The working set bound proven above shows that GreedyFuture has good temporal locality. Accessing an element shortly after its last access guarantees a small amortized search time. Sleator and Tarjan conjectured that their splay trees also demonstrate good spatial locality properties in the form of the dynamic finger conjecture [12]. This conjecture was verified by Cole, et al. [3,2]. One special case of the dynamic finger theorem considered by Tarjan and others was the sequential access theorem [13,7,15,14]. We give a straightforward proof of the sequential access theorem when applied to GreedyFuture. Note that this theorem requires focusing on an arbitrary fixed BST, so we do not use the geometric model in the proof. Theorem 9 (Sequential Access Theorem). Let S = h1, 2, . . . , ni. Starting with an arbitrary BST T0, the cost of running GreedyFuture on search se- quence S is O(n). Let T0, T1, . . . , Tn be the sequence of search trees configured by GreedyFuture. We make the following observations: Lemma 10. For all i > 1, either node i is the root of Ti−1 or i − 1 is the root and i is the leftmost node of the root's right subtree. Proof: If i was accessed during the i − 1st search, then i is the root of Ti−1. Otherwise, i − 1 is the predecessor node of i on the search path. Therefore, i − 1 is the root of Ti−1 and i is the leftmost node of the root's right subtree. (cid:3) Lemma 11. Node x is accessed at most once in any position other than the root or the root's right child. Proof: Consider node x and search i. Node x cannot be accessed if x < i − 1 according to Lemma 10. If x lies on the search path and x ≤ i + 1 then either x becomes the root or x moves into the root's left subtree so that i or i + 1 can become the root. Now suppose x lies along the search path and x > i + 1. Let xℓ be the least node strictly smaller than x that does not become the root. If xℓ does not exist, then x becomes the root's right child as either x is the successor of i + 1 on the search path, node i + 1 is on the search path and x = i + 2, or node i + 1 is on the search path and x is the successor of i + 2 on the search path. If xℓ does exist, then xℓ becomes the root's right child for one of the reasons listed above and x becomes a right descendent of xℓ. Node x cannot be moved to the left subtree of the root's right child in all the cases above. Lemma 10 therefore implies x is accessed in the root's left subtree on the first search, x is accessed once in the left subtree of the root's right child, or x is never accessed anywhere other than as the root or root's right child. (cid:3) We now conclude the proof of Theorem 9. Proof: The cost of the first search is at most n. The costs of all subsequent searches is at most 2(n − 1) + n according to Lemma 11; at most 2(n − 1) node accesses occur at the root or root's right child, and at most n nodes are accessed exactly once in a position other than the root or the root's right child. The total cost of all searches is at most 4n − 2. (cid:3) 6 Closing Remarks The ultimate goal of this line of research is to prove GreedyFuture or splay trees optimal, but showing other upper bounds may prove interesting. In par- ticular, it would be interesting to see if some difficult to prove splay tree prop- erties such as the dynamic finger bound have concise proofs when applied to GreedyFuture. Another direction is to explore how GreedyFuture may be modified to support insertions and deletions while still maintaining its small search cost. Acknowledgements The author would like to thank Alina Ene, Jeff Erickson, Benjamin Moseley, and Benjamin Raichel for their advice and helpful discussions as well as the anonymous reviewers for their suggestions on improving this report. This research is supported in part by the Department of Energy Office of Science Graduate Fellowship Program (DOE SCGF), made possible in part by the American Recovery and Reinvestment Act of 2009, administered by ORISE- ORAU under contract no. DE-AC05-06OR23100. References 1. Bose, P., Douıeb, K., Dujmovi´c, V., Fagerberg, R.: An O(log log n)-competitive bi- nary search tree with optimal worst-case access times. In: Proc. 12th Scandinavian Symp. and Workshop on Algorithm Theory. pp. 38 -- 49 (2010) 2. Cole, R.: On the dynamic finger conjecture for splay trees. Part II: The proof. SIAM J. Comput. 30, 44 -- 85 (2000) 3. Cole, R., Mishra, B., Schmidt, J., Siegel, A.: On the dynamic finger conjecture for splay trees. Part I: Splay sorting log n-block sequences. SIAM J. Comput. 30, 1 -- 43 (2000) 4. Demaine, E.D., Harmon, D., Iacono, J., Kane, D., Patra¸scu, M.: The geometry of binary search trees. In: Proc. 20th ACM/SIAM Symposium on Discrete Algorithms. pp. 496 -- 505 (2009) 5. Demaine, E.D., Harmon, D., Iacono, J., Patra¸scu, M.: Dynamic optimality -- almost. SIAM J. Comput. 37(1), 240 -- 251 (2007) 6. Derryberry, J., Sleator, D.D., Wang, C.C.: A lower bound framework for binary search trees with rotations. Tech. Rep. CMU-CS-05-187, Carnegie Mellon Univer- sity (2005) 7. Elmasry, A.: On the sequential access theorem and deque conjecture for splay trees. Theoretical Computer Science 314(3), 459 -- 466 (2004) 8. Goyal, N., Gupta, M.: On dynamic optimality for binary search trees. http://arxiv.org/abs/1102.4523 (2011) 9. Iacono, J.: Key independent optimality. Algorithmica 42, 3 -- 10 (2005) 10. Lucas, J.M.: Canonical forms for competitive binary search tree algorithms. Tech. Rep. DCS-TR-250, Rutgers University (1988) 11. Munro, J.I.: On the competitiveness of linear search. In: Proc. 8th Annual Euro- pean Symposium on Algorithms. pp. 338 -- 345 (2000) 12. Sleator, D.D., Tarjan, R.E.: Self-adjusting binary search trees. Journal of the As- sociation for Computing Machinery 32(3), 652 -- 686 (1985) 13. Tarjan, R.E.: Sequential access in splay trees takes linear time. Combinatorica 5, 367 -- 378 (1985) 14. Wang, C.C.: Multi-Splay Trees. Ph.D. thesis, Carnegie Mellon University (2006) 15. Wang, C.C., Derryberry, J., Sleator, D.D.: O(log log n)-competitive binary search trees. In: Proc. 17th Ann. ACM-SIAM Symp. Discrete Algorithms. pp. 374 -- 383 (2006) 16. Wilber, R.E.: Lower bounds for accessing binary search trees with rotations. SIAM J. Comput. 18(1), 56 -- 67 (1989)
1304.6358
1
1304
2013-04-23T17:31:18
Maximizing Barrier Coverage Lifetime with Mobile Sensors
[ "cs.DS" ]
Sensor networks are ubiquitously used for detection and tracking and as a result covering is one of the main tasks of such networks. We study the problem of maximizing the coverage lifetime of a barrier by mobile sensors with limited battery powers, where the coverage lifetime is the time until there is a breakdown in coverage due to the death of a sensor. Sensors are first deployed and then coverage commences. Energy is consumed in proportion to the distance traveled for mobility, while for coverage, energy is consumed in direct proportion to the radius of the sensor raised to a constant exponent. We study two variants which are distinguished by whether the sensing radii are given as part of the input or can be optimized, the fixed radii problem and the variable radii problem. We design parametric search algorithms for both problems for the case where the final order of the sensors is predetermined and for the case where sensors are initially located at barrier endpoints. In contrast, we show that the variable radii problem is strongly NP-hard and provide hardness of approximation results for fixed radii for the case where all the sensors are initially co-located at an internal point of the barrier.
cs.DS
cs
Maximizing Barrier Coverage Lifetime with Mobile Sensors Amotz Bar-Noy1, Dror Rawitz2, and Peter Terlecky1 1 The Graduate Center of the City University of New York, NY 10016, USA [email protected], [email protected] 2 School of Electrical Engineering, Tel Aviv University, Tel-Aviv 69978, Israel [email protected] Abstract. Sensor networks are ubiquitously used for detection and tracking and as a result covering is one of the main tasks of such networks. We study the problem of maximizing the coverage lifetime of a barrier by mobile sensors with limited battery powers, where the coverage lifetime is the time until there is a breakdown in coverage due to the death of a sensor. Sensors are first deployed and then coverage commences. Energy is consumed in proportion to the distance traveled for mobility, while for coverage, energy is consumed in direct proportion to the radius of the sensor raised to a constant exponent. We study two variants which are distinguished by whether the sensing radii are given as part of the input or can be optimized, the fixed radii problem and the variable radii problem. We design parametric search algorithms for both problems for the case where the final order of the sensors is predetermined and for the case where sensors are initially located at barrier endpoints. In contrast, we show that the variable radii problem is strongly NP-hard and provide hardness of approximation results for fixed radii for the case where all the sensors are initially co-located at an internal point of the barrier. 1 Introduction One important application of Wireless Sensor Networks is monitoring a barrier for some phenomenon. By covering the barrier, the sensors protect the interior of the region from exogenous elements more efficiently than if they were to cover the interior area. In this paper we focus on a model in which sensors are battery- powered and both moving and sensing drain energy. A sensor can maintain coverage until its battery is completely depleted. The network of sensors cover the barrier until the death of the first sensor, whereby a gap in coverage is created and the life of the network expires. More formally, there are n sensors denoted by {1, . . . , n}. Each sensor i has a battery of size bi and initial position xi. The coverage task is accomplished in two phases. In the deployment phase, sensors move from their initial positions to new positions, and in the covering phase the sensors set their sensing radii to fully cover the barrier. A sensor which moves a distance d drains a · d amount of battery on movement for some constant a ≥ 0. In the coverage phase, sensing with a radius of r drains energy per time unit in direct proportion to rα, for some constant α ≥ 1 (see e.g., [1,12]). The lifetime of a sensor i traveling a distance di and sensing with a radius ri is given by Li = bi−adi . The coverage lifetime of the barrier is the minimum lifetime of any sensor, mini Li. We seek to determine a destination yi and a radius ri, for each sensor i, that maximizes the barrier coverage lifetime of the network. rα i Many parameters govern the length of coverage lifetime, and optimizing them is hard even for simple variants. Therefore, most of the past research adopted natural strategies that try to optimize the lifetime indirectly. For example, the duty cycle strategy partitions the sensors into disjoint groups that take turns in covering the barrier. The idea is that a good partition would result in a longer lifetime. Another example is the objective of minimizing the maximum distance traveled by any of the sensors. This strategy would maximize the coverage life- time for sensors with homogeneous batteries and radii, but would fail to do so if sensors have non-uniform batteries or radii. See a discussion in the related work section. In this paper we address the lifetime maximization problem directly. We focus on the set-up and sense model in which the sensors are given one chance to set their positions and sensing radii before the coverage starts. We leave the more general model in which sensors may adjust their positions and sensing radii during the coverage to future research. Related work. There has been previous research on barrier coverage focused on minimizing a parameter which is proportional to the energy sensors expend on movement, but not directly modeling sensor lifetimes with batteries. Czyzowicz et al. [8] assume that sensors are located at initial positions on a line barrier and that the sensors have fixed and identical sensing radii. The goal is to find a deployment that covers the barrier and that minimizes the maximum distance traveled by any sensor. Czyzowicz et al. provide a polynomial time algorithm for this problem. Chen et al. [7] extended the result to the more general case in which the sensing radii are non-uniform (but still fixed). Czyzowicz et al.[9] considered covering a line barrier with sensors with the goal of minimizing the sum of the distances traveled by all sensors. Mehrandish et al. [13] considered the same model with the objective of minimizing the num- ber of sensors which must move to cover the barrier. Tan and Wu [15] presented improved algorithms for minimizing the max distance traveled and minimizing the sum of distances traveled when sensors must be positioned on a circle in regular n-gon position. The problems were initially considered by Bhattacharya et al. [5]. Several works have considered the problem of covering a straight-line boundary by stationary sensors. Li et al. [12] look to choose radii for sensors for coverage which minimize the sum of the power spent. Agnetis et al. [1] seek to choose radii for coverage to minimize the sum of a quadratic cost function. Max- imizing the network lifetime of battery-powered sensors that cover a barrier was previously considered for static sensors from a scheduling point of view. Buchs- baum et al. [6] and Gibson and Varadarajan [11] considered the Restricted Strip Covering in which sensors are static and radii are fixed, but sensors 2 may start covering at any time. Bar Noy et al. [2,3,4] considered the variant of this problem in which the radii are adjustable. The only previous result we are aware of that considered a battery model with movement and transmission on a line is by Phelan et al. [14] who considered the problem of maximizing the transmission lifetime of a sender to a receiver on a line using mobile relays. Our contribution. We introduce two problems in the model in which sensors are battery-powered and both moving and sensing drain energy. In the Barrier Coverage with Variable Radii problem (abbreviated BCVR) we are given initial locations and battery powers, and the goal is to find a deployment and radii that maximizes the lifetime. In the Barrier Coverage with Fixed Radii problem (BCFR) we are also given a radii vector ρ, and the goal is to find a deployment and a radii assignment r, such that ri ∈ {0, ρi}, for every i, that maximizes the lifetime. We show in Appendix A that the static (a = ∞) and fully dynamic (a = 0) In Section 3 we consider constrained versions of BCFR and BCVR in which the input contains a total order on the sensors that the solution is required to satisfy. We design polynomial-time algorithms for the decision problems in which the goal is to determine whether a given lifetime t is achievable and to compute a solution with lifetime t, if t is achievable. Using these decision algorithms we present parametric search algorithms for constrained BCFR and BCVR. cases are solvable in polynomial time for both BCFR and BCVR. We consider the case where the sensors are initially located on the edges of the barrier (i.e., x ∈ {0, 1}n) in Section 4. For both BCFR and BCVR, we show that, for every candidate lifetime t, we may assume a final ordering of the sensors. (The ordering depends only on the battery powers in the BCVR case, and it can be computed in polynomial time in the BCFR case.) Using our decision algorithms, we obtain parametric search algorithms for this special case. On the negative side, we show that there is no polynomial time multiplicative approximation algorithm for BCFR and that there is no polynomial time algo- rithm that computes solutions that are within an additive factor ε, for some con- stant ε > 0, unless P6=NP. Both results hold even if x = pn, for some p ∈ (0, 1)n. We also show that BCVR is strongly NP-hard. The hardness results apply to any 0 < a < ∞ and α ≥ 1 and they are given in Section C. space considerations. Finally, we note that several proofs were relegated to the appendix due to 2 Preliminaries In this section we formally define the problems and introduce the notation that will be used throughout the paper. Model. We consider a setting in which n mobile sensors with finite batteries are located on a barrier represented by the interval [0, 1]. The initial position 3 ri ri 0 xi yi 1 Fig. 1. Sensor i moves from xi to yi and covers the interval [yi − ri, yi + ri]. and battery power of sensor i is denoted by xi and bi, respectively. We denote x = (x1, . . . , xn) and b = (b1, . . . , bn). The sensors are used to cover the barrier, and they can achieve this goal by moving and sensing. In our model the sensors first move, and afterwards each sensor covers an interval that is determined by its sensing radius. In motion, energy is consumed in proportion to the distance traveled, namely a sensor consumes a·d units of energy by traveling a distance d, where a is a constant. A sensor i consumes rα i energy per time unit for sensing, where ri is the sensor's radius and α ≥ 1 is a constant. More formally, the system works in two phases. In the deployment phase sensors move from the initial positions x to new positions y. This phase is said to occur at time 0. In this phase, sensor i consumes ayi− xi energy. Notice that sensor i may be moved to yi only if ayi − xi ≤ bi. In the covering phase sensor i is assigned a sensing radius ri and covers the interval [yi − ri, yi + ri]. (An example is given in Figure 2.) A pair (y, r), where y is a deployment vector and r is a sensing radii vector, is called feasible if (i) ayi − xi ≤ bi, for every sensor i, and (ii) [0, 1] ⊆ Pi[yi − ri, yi + ri]. Namely, (y, r) is feasible, if the sensors have enough power to reach y and each point in [0, 1] is covered by some sensor. Given a feasible pair (y, r), the lifetime of a sensor i, denoted Li(y, r), is the time that transpires until its battery is depleted. If ri > 0, Li(y, r) = bi−ayi−xi , and if ri = 0, we define Li(y, r) = ∞. Given initial locations x and battery powers b, the barrier coverage lifetime of a feasible pair (y, r), where y is a deployment vector and r is a sensing radii vector is defined as L(y, r) = mini Li(y, r). We say that a t is achievable if there exists a feasible pair such that Li(y, r) = t. rα i Problems. We consider two problems which are distinguished by whether the radii are given as part of the input. In the Barrier Coverage with Variable Radii problem (BCVR) we are given initial locations x and battery powers b, and the goal is to find a feasible pair (y, r) of locations and radii that maximizes L(y, r). In the Barrier Coverage with Fixed Radii problem (BCFR) we are also given a radii vector ρ, and the goal is to find a feasible pair (y, r), such that ri ∈ {0, ρi} for every i, that maximizes L(y, r). Notice that a necessary condition for achieving non-zero lifetime is Pi 2ρi ≥ 1. Given a total order ≺ on the sensors, we consider the constrained variants of BCVR and BCFR, in which the deployment y must satisfy the following requirement: i ≺ j if and only if yi ≤ yj. That is, we are asked to maximize barrier coverage lifetime subject to the condition that the sensors are ordered by ≺. Without loss of generality, we assume that the sensors are numbered according to the total order. 4 3 Constrained Problems and Parametric Search We present polynomial time algorithms that, given t > 0, decide whether t is achievable for constrained BCFR and constrained BCVR. If t is achievable, a solution with lifetime at least t is computed. We use these algorithms to design parametric search algorithms for both problems. We use the following definitions for both BCFR and BCVR. Given an order requirement ≺, we define: l(i) def= max{maxj≤i {xj − bj/a} , 0} u(i) def= min{minj≥i {xj + bj/a} , 1} l(i) and u(i) are the leftmost and rightmost points reachable by i. Observation 1. Let (y, r) be a feasible solution that satisfies an order require- ment ≺. Then l(i) ≤ u(i) and yi ∈ [l(i), u(i)], for every i. Proof. If there exists i such that u(i) < l(i), then there are two sensors j and k, such that where k < j and xj + bj/a < xk − bk/a. Hence, no deployment that ⊓⊔ satisfies the total order exists. 3.1 Fixed Radii We start with an algorithm that solves the constrained BCFR decision problem. Given a BCFR instance and a lifetime t, we define s(i) def = max{xi − (bi − tρα i )/a, l(i)} e(i) def = min{xi + (bi − tρα i )/a, u(i)} If tρα i ≤ bi, then s(i) ≤ e(i). Moreover s(i) and e(i) are the leftmost and right- most points that are reachable by i, if i participates in the cover for t time. (l(i) and u(i) can be replaced by l(i − 1) and u(i − 1) in the above definitions.) Observation 2. Let (y, r) be a feasible pair with lifetime t that satisfies an order ≺. For every i, if ri = ρi, it must be that tρα i ≤ bi and yi ∈ [s(i), e(i)]. Algorithm Fixed is our decision algorithm for constrained BCFR. It first computes l, u, s, and e. If there is a sensor i such that l(i) > u(i), it outputs NO. Otherwise it deploys the sensors one by one according to ≺. Iteration i starts with checking whether i can extend the current covered interval [0, z]. If it cannot, i is moved to the left as much as possible (power is used only for moving), and it is powered down (ri is set to 0). If i can extend the current covered interval, it is assigned radius ρi, and it is moved to the rightmost possible position, while maximizing the right endpoint of the currently covered interval (i.e., [0, z]). If i is located to the left of a sensor j, where j < i, then j is moved to yi. As for the running time, l, u, s and e can be computed in O(n) time. There are n iterations, each takes O(n) time. Hence, the running time of Algorithm Fixed is O(n2). It remains to prove the correctness of the algorithm. Theorem 1. Fixed solves the constrained BCFR decision problem. 5 if tρα i > bi or z 6∈ [s(i) − ρi, e(i) + ρi) then yi ← max {l(i), yi−1} and ri ← 0 else Algorithm 1 : Fixed (x, b, ρ, t) 1: Compute l, u, s, and e 2: if there exists i such that u(i) < l(i) then return NO 3: z ← 0 4: for i = 1 → n do 5: 6: 7: 8: 9: 10: 11: 12: 13: end for 14: if z < 1 then return NO 15: else return YES yi ← min {z + ρi, e(i)} and ri ← ρi S ← {k : k < i, yi < yk} yk ← yi and rk ← 0, for every k ∈ S z ← yi + ri end if ⊲ y0 = 0 Proof. If u(i) < l(i) for some i, then no deployment that satisfies the order ≺ exists by Observation 1. Hence, the algorithm responds correctly. We show that if the algorithm outputs YES, then the computed solution is feasible. First, notice that yi−1 ≤ yi, for every i, by construction. We prove by induction on i, that yj ∈ [l(j), u(j)] and that yj ∈ [s(j), e(j)], if rj = ρj, for every j ≤ i. Consider the ith iteration. If tρα i > bi or z 6∈ [s(i) − ρi, e(i) + ρi), then yi ∈ [l(i), u(i)], since max{l(i), yi−1} ≤ max{u(i), u(i − 1)} ≤ u(i). Otherwise, yi = min{z + ρi, e(i)} ≥ s(i), since z ≥ s(i)− ρi. Hence, if ri = ρi, we have that yi ∈ [s(i), e(i)]. Furthermore, if j < i is moved to the left to i, then yj = yi ≥ s(i) ≥ l(i) ≥ l(j). Finally, let zi denote the value of z after the ith iteration. (Initially, z0 = 0.) We proof by induction on i that [0, zi] is covered. Consider iteration i. If ri = 0, then we are done. Otherwise, zi−1 ∈ [yi − ρi, yi + ρi] and zi = yi + ρi. Furthermore, the sensors in S can be powered down and moved, since [yj − rj, yj + rj ] ⊆ [yi − ρi, yi + ρi], for every j ∈ S. Finally, we show that if the algorithm outputs NO, there is no feasible so- lution. We prove by induction that [0, zi] is the longest interval than can be covered by sensors 1, . . . , i. In the base case, observe that z0 = 0 is optimal. For the induction step, let y′ be a deployment of 1, . . . , i that covers the interval [0, z′i]. Let [0, z′i−1] be the interval that y′ covers by 1, . . . , i − 1. By the induc- tive hypothesis, z′i−1 ≤ zi−1. If tρα i > bi or zi−1 < s(i) − ρi, it follows that z′i = z′i−1 ≤ zi−1 = zi. Otherwise, observe that y′i ≤ yi and therefore z′i ≤ zi. ⊓⊔ 3.2 Variable Radii We present an algorithm that solves the constrained BCVR decision problem. Before presenting our algorithm, we need a few definitions. Given a BCVR instance (x, b) and t > 0, if sensor i moves from xi to p ∈ [l(i), u(i)], then we may assume without loss of generality that its radius is ri(p, t) = αp(bi − ap − xi)/t. 6 Similarly to Algorithm Fixed, our al- gorithm tries to cover [0, 1] by deploying sensors one by one, such that the length of the covered prefix [0, z] is maximized. This motivates the following definitions. Let d ∈ [− bi a ] denote the distance trav- eled by sensor i, where d > 0 means trav- eling right, and d < 0 means traveling left. If a sensor travels a distance d, then its lifetime t sustaining radius is given by a , bi αp(bi − ad)/t. Given t, we define: i (d) def= d + αp(bi − ad)/t . gt gt i (d) is the right reach of sensor i at dis- tance d from xi, i.e., the rightmost point that i covers when it has traveled a dis- tance of d and the required lifetime is t. Similarly define ht i (−d) is the left reach of sensor i at distance d from xi. See depiction in Figure 3.2. We explore these functions in the next lemma whose proof is given in the appendix. i(d) def= gt i(dt gt i) αpbi/t −dt i − bi a bi a dt i d − αpbi/t i(−dt ht i) Fig. 2. Depiction of the functions gt i (d) and ht i(d) for a = 2, α = 2, bi = 1, and t = 4. The top (blue) curve corre- sponds to gt i (d), and the bottom (red) curve corresponds to ht i(d). The dashed line corresponds to the location of sen- sor i, while the vertical interval be- tween the curves is the interval that is covered by i at distance d from xi. Lemma 3. Let t > 0. For any i, the distance dt i maximizes gt i (d), where dt i =  If α > 1 or a 6= t, gt and a = t, gt bi a − 1 α bi a 0 α−1p a αt α > 1 α = 1, a < t α = 1, a ≥ t gt i (dt i) =( bi a +(cid:0)1 − 1 min{a,t} bi α(cid:1) α−1p a αt α > 1 α = 1 i is increasing for d < dt i, and decreasing for d > dt i. If α = 1 i is constant, for d ≥ 0, and it is increasing for d < 0. Given a point z ∈ [0, 1], the attaching position of sensor i to z, denoted by pi(z, t), is the position p for which p − ri(p, t) = z such that p + ri(p, t) is maximized, if such a position exist. If such a point does not exist we define pi(z, t) = ∞. Observe that by Lemma 3 there may be at most two points that satisfy the equation p−ri(p, t) = z. Such a position can either be found explicitly or numerically as it involves solving an equation of degree α. We ignore calcu- lation inaccuracies for ease of presentation. These inaccuracies are subsumed by the additive factor. Algorithm Variable is our decision algorithm for BCVR. It first computes u and l. If there is a sensor i, such that l(i) > u(i), it outputs NO. Then, it deploys the sensors one by one according to ≺ with the goal of extending the coverage interval [0, z]. If i cannot increase the covering interval it is placed at max{l(i), yi−1} so as not to block sensor i + 1. If i can increase coverage, it is 7 i, l(i)(cid:9) , u(i)(cid:9) i, u(i)(cid:9) , l(i)(cid:9) qL(i) ← min (cid:8)max (cid:8)xi − dt qR(i) ← max (cid:8)min (cid:8)xi + dt if z 6∈ [qL(i) − ri(qL(i), t), qR(i) + ri(qR(i), t)] then Algorithm 2 : Variable (x, b, t) 1: Compute l and u 2: if there exists i such that u(i) < l(i) then return NO 3: z ← 0 4: for i = 1 → n do 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: end for 16: if z < 1 then return NO 17: else return YES yi ← max (cid:8)min (cid:8)pi(z, t), u(i), xi + dt S ← {k : k < i, yi < yk} yk ← yi and rk ← 0, for every k ∈ S z ← yi + ri else end if yi ← max {l(i), yi−1} and ri ← 0 ⊲ y0 = 0 i(cid:9) , l(i)(cid:9) and ri ← ri(yi, t) placed in [l(u), u(i)] such that z is covered and coverage to the right is maximized. It may be the case that the best place for i is to the left of previously positioned sensors. In this case the algorithm moves the sensors such that coverage and order are maintained. Finally, if z < 1 after placing sensor n, the algorithm outputs NO, and otherwise it outputs YES. l and u can be computed in O(n) time. There are n iterations of the main loop, each taking O(n) time (assuming that computing pi(z, t) takes O(1) time), thus the running time of the algorithm is O(n2). We now prove the correctness of Algorithm Variable. We define P (i) = {p : p ∈ [l(i), u(i)] and z ∈ [p − ri(p, t), p + ri(p, t)]} . P (i) is the set of points from which sensor i can cover z. Observe that P (i) is an interval due to Lemma 3. Hence, we write P (i) = [pL(i), pR(i)]. In the next two lemmas it is shown that when the algorithm checks whether z 6∈ [qL(i) − ri(qL(i), t), qR(i) + ri(qR(i), t)] it actually checks whether P (i) = ∅, and that y∗i i} , l(i)} is equal to argmaxp∈P {p + ri(p, t)}. Hence, in each iteration we check whether [0, z] can be extended, and if it can, we take the best possible extension. def= max{min{pi(z, t), u(i), xi + dt Lemma 4. [pL(i), pR(i)] ⊆ [qL(i), qR(i)]. Moreover, P (i) = ∅ if and only if z 6∈ [qL(i) − ri(qL(i), t), qR(i) + ri(qR(i), t)]. Proof. By Lemma 3 qL(i) is the location that maximized coverage to the left, ⊓⊔ and qR(i) is the location that maximized coverage to the right. Lemma 5. If P (i) 6= ∅, then y∗i = argmaxp∈P (i) {p + ri(p, t)}. 8 Proof. By Lemma 3, there are three cases: -- If xi + dt y∗i = xi + dt -- If xi + dt i, since pi(z, t) ≥ xi + dt i. i ∈ P (i), then argmaxp∈P (i) {p + ri(p, t)} = xi + dt i. i > pR(i), then argmaxp∈P (i) {p + ri(p, t)} = pR(i). i < pL(i), then argmaxp∈P (i) {p + ri(p, t)} = pL(i). y∗i = min{pi(z, t), u(i)}, since pR(i) = min{pi(z, t), u(i)} ≥ l(i). i ≥ min{pi(z, t), u(i), xi + dt y∗i = l(i), since qL(i) = l(i) > xi + dt i}. -- If xi + dt ⊓⊔ We are now ready to prove the correctness of our algorithm. Theorem 2. Variable solves the constrained BCVR decision problem. 3.3 Parametric Search Algorithms We design parametric search algorithms for constrained BCFR and BCVR. Since we have an algorithm that, given t and an order ≺, decides whether there exists a solution that satisfies ≺ with lifetime t, we can perform a binary search on t. The maximum lifetime of a given instance is bounded by the lifetime of this instance in the case where a = 0. In Appendix A we show that the lifetime in the fixed case is at most maxi {bi/ρα i } and that in the variable radii case it αpbj)α. Hence, the running time of the parametric search in is at most (2Pj polynomial in the input size and in the log 1 ε , where ε is the accuracy parameter. 4 Sensors are Located on the Edges of the Barrier In this section we consider the special case in which the initial locations are on either edge of the barrier, namely the case where x ∈ {0, 1}n. For both BCVR and BCFR we show that, given an achievable lifetime t, there exists a solution with lifetime t in which the sensors satisfy a certain ordering. In the case of BCVR, the ordering depends only on the battery sizes, and hence we may use the parametric search algorithm for constrained BCVR from Section 3 to solve this special case of BCVR. In the case of BCFR, the ordering depends on t, and therefore may change. Even so, we may use parametric search for this special case of BCFR since, given t, the ordering can be computed in polynomial time. Fixed radii. We start by considering the special case of BCFR in which all sensors are located at x = 0. (The case where x = 1 is symmetric.) Given a BCFR instance (0, b, ρ) and a lifetime t, the maximum reach of sensor i is defined as the farthest point from its initial position that sensors i can cover while maintaining lifetime t, and is given by: ft(i) = (bi − tρα i )/a + ρi, if tρα i ≤ bi, and ft(i) = 0, otherwise. We assume without loss of generality in the following that the sensors are ordered according to reach ordering, namely that i < j if and only if ft(i) < ft(j). Also, we ignore sensors with zero reach, since they must power down. Hence, if ft(i) = 0, we place i at 0 and set its radius to 0. Let t be an achievable lifetime, we show that there exists a solution (y, r) with lifetime t such that sensors are deployed according to reach ordering. 9 Lemma 6. Let (0, b, ρ) be a BCFR instance and let p ∈ (0, 1]. Suppose that there exists a solution that covers [0, p] for t time. Then, there exists a solution that covers [0, p] lifetime for t time that satisfies reach ordering. Variable radii. We now consider the case where x = 0 for BCVR. (x = 1 is symmetric.) Given a BCVR instance (0, b) and a lifetime t, the maximum reach of sensor i is gt i (dt i). Note that if the sensors are ordered by battery size, namely that i < j if and only if bi < bj, they are also ordered by reach. Thus, we assume in the following that sensors are ordered by battery size. Let t be an achievable lifetime. We show that there exists a deployment y with lifetime t such that sensors are deployed according to the battery ordering, namely bi ≤ bj if and only if yi ≤ yj. We need the following technical lemma. Lemma 7. Let c1, c2, d1, d2 ≥ 0 such that (i) d1 < c1 ≤ c2 < d2, and (ii) c1 + c2 > d1 + d2. Also let α ≥ 1. Then, α√c1 + α√c2 > α√d1 + α√d2 Lemma 8. Let (0, b) be a BCVR instance and let p ∈ (0, 1]. Suppose that there exists a deployment that covers [0, p] for t time. Then, there exists a deployment that covers [0, p] lifetime for t time that satisfies battery ordering. Proof. Given a solution that covers [0, p] with lifetime t, a pair of sensors is said to violate battery ordering if bi < bj and yi > yj. Let y be a solution with lifetime t for (x, b, r) that minimizes battery ordering violations. If there are no violations, then we are done. Otherwise, we show that the number of violations can be decreased. If y has ordering violations, then there must exist at least one violation due to a pair of adjacent sensors. Let i and j be such sensors. If the barrier is covered without i, then i is moved to yj. (Namely y′k = yk, for every k 6= i, and y′i = yj.) y′ is feasible, since i moves to the left. Otherwise, if the barrier is covered without j, then j is moved to yi and j's radius is decreased accordingly. Otherwise, both sensors actively participate in covering the barrier, which means that the interval [yj − rj , yi + ri] is covered by i and j. In this case, we place i at y′i with radii r′i, such that y′i− r′i = yj − rj. We place j at the rightmost location y′j such that y′j ≤ yi and y′j − r′j ≤ y′i + r′i. If y′j = yi then we are done, as sensor j has more battery power at yi than i does at yi. Otherwise, we may assume that y′j − r′j = y′i + r′i. We show that it must be that y′j + r′j ≥ yi + ri. We have that y′i < yj and y′j < yi. It follows that β′i + β′j > βi + βj, where βi = bi − ayi. Also, notice that βi < β′j < βj and βi < β′i < βj. It follows that r′i +r′j = αpβ′i/t+ αqβ′j/t > αpβi/t+ αpβj/t = ri +rj, where the inequality is due to Lemma 7. Hence, y′j + r′j = (yj − rj)+ 2r′i + 2r′j > (yj − rj)+ 2ri + 2rj ≥ yi + ri. Since i moves to the left, it may bypass several sensors. In this case we move all sensors with smaller batteries that were bypassed by i, to y′i. This can be done since these sensors are not needed for covering to the right of y′i − r′i. Similarly, since j moves to the right, it may bypass several sensors. As long as there is a sensor with larger reach that was bypassed by j, let k be the rightmost 10 such sensor. Notice that k is not needed for covering to the left of y′j. Hence, if yk + rk ≥ y′j + r′j , we move j to yk. Otherwise, we move k to y′j. smaller number of violations than y. A contradiction. In all cases, we get a deployment y′ that covers [0, p] with lifetime t with a ⊓⊔ Separation. We are now ready to tackle the case where x ∈ {0, 1}n. We start with the fixed radii case. Given a BCFR instance (x, b, r) and a lifetime t, we assume without loss of generality that the sensors are ordered according to the following bi-directional reach order: first the sensors that are located at 0 according to reach order, and then the sensors that are located at 1 according to reverse reach order. We show that we may assume that the sensors are deployed using the bi- directional reach order. The first step is to show that the sensors that are located at 0 are deployed to the left of the sensors that are placed at 1. Lemma 9. Let (x, b, ρ) be a BCFR instance, where x ∈ {0, 1}n, and let t be an achievable lifetime. Then, there exists a feasible solution (y, r) with lifetime t such that yi ≤ yj, for every i ≤ ℓ < j. Next we show that we may assume that the sensors are deployed using the bi-directional reach order. Theorem 3. Let (x, b, ρ) be a BCFR instance, and let t be an achievable life- time. Then there exists a feasible solution (y, r) with lifetime t such that the sensors are deployed using bi-directional reach order. We treat the variable radius case in a similar manner. Given a BCVR in- stance (x, b), we assume without loss of generality that the sensors are ordered according to a bi-directional battery order: first the sensors that are located at 0 according to battery order, and then the sensors that are located at 1 according to reverse battery order. The proofs of the next lemma and theorem are similar to the proofs of Lemma 9 and Theorem 3. Lemma 10. Let (x, b) be a BCVR instance, where x ∈ {0, 1}n, and let t be an achievable lifetime. Then, there exists a feasible solution (y, r) with lifetime t such that yi ≤ yj, for every i ≤ ℓ < j. Theorem 4. Let (x, b) be a BCVR instance, and let t be an achievable lifetime. Then there exists a feasible solution (y, r) with lifetime t such that the sensors are deployed using bi-directional battery order. 5 Discussion and Open Problems We briefly discuss some research directions and open problems. We have shown that BCVR is strongly NP-Hard. Finding an approximation algorithm or show- ing hardness of approximation remains open. In a natural extension model, sen- sors could be located anywhere in the plane and asked to cover a boundary or a 11 circular boundary. In a more general model the sensors need to cover the plane or part of the plane where their initial locations could be anywhere. Another model which can be considered is the duty cycling model in which sensors are partitioned into shifts that cover the barrier. Bar-Noy et al. [3] considered this model for stationary sensors and α = 1. Extending it to moving sensors and α > 1 is an interesting research direction. Finally, in the most general covering problem with the goal of maximizing the coverage lifetime, sensors could change their locations and sensing ranges at any time. Coverage terminates when all the batteries are drained. References 1. A. Agnetis, E. Grande, P. B. Mirchandani, and A. Pacifici. Covering a line segment with variable radius discs. Computers & OR, 36(5):1423 -- 1436, 2009. 2. A. Bar-Noy and B. Baumer. Maximizing network lifetime on the line with ad- In 7th ALGOSENSORS, volume 7111 of LNCS, pages justable sensing ranges. 28 -- 41, 2011. 3. A. Bar-Noy, B. Baumer, and D. Rawitz. Changing of the guards: Strip cover with duty cycling. In 19th SIROCCO, volume 7355 of LNCS, pages 36 -- 47, 2012. 4. A. Bar-Noy, B. Baumer, and D. Rawitz. Set it and forget it: Approximating the set once strip cover problem. Technical Report 1204.1082, CoRR, 2012. 5. B. K. Bhattacharya, M. Burmester, Y. Hu, E. Kranakis, Q. Shi, and A. Wiese. Optimal movement of mobile sensors for barrier coverage of a planar region. Theor. Comput. Sci., 410(52):5515 -- 5528, 2009. 6. A. L. Buchsbaum, A. Efrat, S. Jain, S. Venkatasubramanian, and K. Yi. Restricted strip covering and the sensor cover problem. In SODA, pages 1056 -- 1063, 2007. 7. D. Z. Chen, Y. Gu, J. Li, and H. Wang. Algorithms on minimizing the maximum sensor movement for barrier coverage of a linear domain. In 13th SWAT, volume 7357 of LNCS, pages 177 -- 188, 2012. 8. J. Czyzowicz, E. Kranakis, D. Krizanc, I. Lambadaris, L. Narayanan, J. Opatrny, L. Stacho, J. Urrutia, and M. Yazdani. On minimizing the maximum sensor move- ment for barrier coverage of a line segment. In 8th ADHOC-NOW, volume 5793 of LNCS, pages 194 -- 212, 2009. 9. J. Czyzowicz, E. Kranakis, D. Krizanc, I. Lambadaris, L. Narayanan, J. Opatrny, L. Stacho, J. Urrutia, and M. Yazdani. On minimizing the sum of sensor movements for barrier coverage of a line segment. In 9th ADHOC-NOW, volume 6288 of LNCS, pages 29 -- 42, 2010. 10. M. R. Garey and D. S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman and Company, 1979. 11. M. Gibson and K. Varadarajan. Decomposing coverings and the planar sensor cover problem. In FOCS, pages 159 -- 168, 2009. 12. M. Li, X. Sun, and Y. Zhao. Minimum-cost linear coverage by sensors with ad- justable ranges. In 6th WASA, volume 6843 of LNCS, pages 25 -- 35, 2011. 13. M. Mehrandish, L. Narayanan, and J. Opatrny. Minimizing the number of sensors moved on line barriers. In WCNC, pages 653 -- 658, 2011. 14. B. Phelan, P. Terlecky, A. Bar-Noy, T. Brown, and D. Rawitz. Should i stay or should i go? maximizing lifetime with relays. In 8th DCOSS, pages 1 -- 8, 2012. 15. X. Tan and G. Wu. New algorithms for barrier coverage with mobile sensors. In 4th FAW, volume 6213 of LNCS, pages 327 -- 338, 2010. 12 A Extreme Movement Costs In this section we consider the two extreme cases, the static case (a = ∞) and the fully dynamic case (a = 0). A.1 The Static Case In the static case the initial deployment is the final deployment, i.e., y = x, and therefore a feasible solution is a radii assignment r, such that [0, 1] ⊆ ∪i[xi − ri, xi + ri]. We describe a simple algorithm for static BCFR. First, if [0, 1] 6⊆ ∪i[xi − ρi, xi + ρi], then the maximum lifetime is 0. Otherwise, compute ti = bi/ρα i for every i, and let S = ∅. Then, as long as S does not cover the barrier, add i = argmaxi6∈S ti to S. Finally, assign ri = ρi, for i ∈ S, and ri = 0, for i 6∈ S. The correctness of this algorithm is straightforward. Bar-Noy et al. [4] presented a polynomial time algorithm for static BCVR with α = 1. This algorithm readily extends to static BCVR with α > 1. We refer the reader to [4] for the details. A.2 Fully Dynamic Case In the fully dynamic case movement is for free, and therefore any radii vector j=1 2rj + ri, for every i.) the maximum lifetime is 0. Otherwise, compute ti = bi/ρα i r, such that Pi 2ri ≥ 1, has a deployment vector y such that (y, r) is a feasible pair. (e.g., yi =Pi−1 We describe a simple algorithm for fully dynamic BCFR. First, ifPi 2ρi < 1, S = ∅. Then, as long asPi∈S 2ρi < 1, add i = argmaxi6∈S ti to S. Finally, assign ri = ρi, for i ∈ S, and ri = 0, for i 6∈ S. The correctness of this algorithm is straightforward. We now consider fully dynamic BCVR. Given a feasible radii vector r and a corresponding deployment vector y, the lifetime of sensors i is simply Li(y, r) = bi/rα i , and the lifetime of the system is L(y, r) = mini Li(y, r). for every i, and let Theorem 5. Let a = 0. Given a BCVR instance, the radii assignment ri = α√bi α√bj 2 Pj , for every i, is optimal. α√bi α√bj Pj Li(r) = bi/rα feasible. Furthermore, = 1, which means that r is Proof. First, observe that 2Pi ri = Pi αpbj α√bi !α i = bi · 2Pj αpbj  αpbj)α. for every i. Hence, L(r) = (2Pj 6= r. Since r′ is feasible, we have that 2Pi r′i ≥ 1. It follows that there exists i such that r′i > ri. Hence, L(r′) ≥ Li(r′) > Li(r) = L(r). ⊓⊔ We show that L(r) < L(r′), for any radii assignment r′ = 2Xj α , 13 B Omitted Proofs Proof (of Lemma 3). First consider the case where α > 1. For d ∈ [bi/a, 0) we get For d ∈ (0, bi/a], the derivative of gt a ∂ht i ∂d = 1 + a αt(cid:18) bi + ad t (cid:19)1/α−1 i is given by > 0 . ∂gt i ∂d = 1 − αt (cid:18) bi − ad t (cid:19)1/α−1 . It follows that ∂gt i ∂d (d) = 0 when d = dt i = bi a − t αt(cid:17)α/(α−1) a(cid:16) a = bi a − 1 α α−1r a αt . Furthermore, gt i (d) > 0 when d < dt i, and gt i (d) < 0 when d > dt i. The radius at this distance is α−1p a αt . The maximum reach is thus gt i (dt i) = bi a +(cid:18)1 − 1 α(cid:19) α−1r a αt . For α = 1 we have Hence, gt i (d) =(d(1 − a/t) + bi/t d ≥ 0, d(1 + a/t) + bi/t d < 0. ∂gt i (d) ∂d =(1 − a/t d > 0, 1 + a/t d < 0. i) = bi If d > 0, we have several cases. If a > t, the maximum occurs at dt gt i (dt for any d ≤ bi i = 0 and a . If a < t, the function is increasing ⊓⊔ t , for any d ≤ bi a and gt a , and thus dt t . If a = t, gt a . Hence, gt i (d) = bi i) = bi i = bi min{a,t} i (dt i) = i (dt bi . Proof (Proof of Theorem 2). If u(i) < l(i) for some i, then no deployment that satisfies the order ≺ exists by Observation 1. Hence, the algorithm responds correctly. We show that if the algorithm outputs YES, then the computed solu- tion is feasible. First, notice that yi−1 ≤ yi, for every i, by construction. We prove by induction on i, that yj ∈ [l(j), u(j)] for every j ≤ i. Con- sider the ith iteration. If z 6∈ [qL(i) − ri(qL(i), t), qR(i) + ri(qR(i), t)], then yi ∈ [l(i), u(i)], since max{l(i), yi−1} ≤ max{u(i), u(i − 1)} ≤ u(i). Otherwise, yi = max{min{pi(z, t), u(i), xi + dt i} , l(i)} ∈ [l(i), u(i)]. Furthermore, if j < i is moved to the left due i, then yj = yi ≥ l(i) ≥ l(j). Finally, let zi denote the value 14 of z after the ith iteration. (Initially, z0 = 0.) We prove by induction on i that [0, zi] is covered. Consider iteration i. If ri = 0, then we are done. Otherwise, zi−1 ∈ [yi − ri, yi + ri] and zi = yi + ri, and the sensors in S can be powered down and moved, since [yj − rj, yj + rj ] ⊆ [yi − ri, yi + ri], for every j ∈ S. Finally, we show that if the algorithm outputs NO, there is no feasible so- lution. We prove by induction that [0, zi] is the longest interval that can be covered by sensors 1, . . . , i. In the base case, observe that z0 = 0 is optimal. For the induction step, let y′ be a deployment of 1, . . . , i that covers the interval [0, z′i]. Let [0, z′i−1] be the interval that it covers by 1, . . . , i− 1. By the inductive hypothesis, z′i−1 ≤ zi−1. If z′i ≤ zi−1, then we are done. Otherwise, we have that y′i + ri(y′i, t) > zi−1. In this case we have that y′i ∈ P (i). It follows, by Lemma 4, that we place i at yi = y∗i . By Lemma 5 we have yi is better than y′i in terms of coverage to the right, namely zi = yi + ri(yi, t) ≥ y′i + ri(y′i, t) = z′i. ⊓⊔ Proof (Proof of Lemma 6). We first prove that we may focus on feasible solutions where r = ρ. Given a feasible solution (y, r) that covers [0, p] with lifetime t, we define y′i = yi, if ri = ρi, and y′i = 0, otherwise. The pair (y′, ρ) clearly covers [0, p] with lifetime t. (Recall that we ignore sensors with zero reach.) Given a solution that covers [0, p] with lifetime t, a pair of sensors is said to violate reach ordering if i < j and yi > yj. Let (y, ρ) be a solution with lifetime t for (0, b, ρ) that minimizes reach ordering violations. If there are no violations, then we are done. Otherwise, we show that the number of violations can be decreased. If y has ordering violations, then there must exist at least one violation due to a pair of adjacent sensors. Let i and j be such sensors. If the barrier is covered without i, then i is moved to yj. (Namely y′k = yk, for every k 6= i, and y′i = yj.) y′ is feasible, since i moves to the left. Otherwise, if the barrier is covered without j, then j is moved to y′j = min{yi, ft(j) − ρj}. If y′j = yi, then we are done. If y′j < yi, then [yi − ρi, yi + ρi] ⊆ [yj − ρj, yj + ρj], since ft(j) > ft(i). It follows that the barrier is covered without i, and so we can move i to y′j. Since y′j ≤ ft(j) − ρj, and i moves to the left, we get a feasible deployment. If both sensors participate in the cover, we define a new deployment y′ by moving i to y′i = yj + (ρi − ρj) and moving j to y′j = yi + (ρi − ρj). The interval [0, p] is covered, since [yj − ρj, yi + ρi] is covered. Also, y′i ≤ y′j. Furthermore, i and j can maintain their radii for t time, since y′i ≤ yi and ft(j) > ft(i). Since i moves to the left, it may bypass several sensors. In this case we move all sensors with smaller reach that were bypassed by i, to y′i. Since j moves to the right, it may bypass several sensors. As long as there is a sensor with larger reach that was bypassed by j, let k be the rightmost such sensor, and move both j and k to min(cid:8)y′j, ft(k) − ρk(cid:9). Notice that k is not needed for covering to the left of y′j, and thus it can be moved to the right, as long as it has the power to do so. If k cannot move to y′j, it follows that j is not needed for covering to the right of y′k. In all cases, we get a deployment y′ that covers [0, p] with lifetime t with a ⊓⊔ smaller number of violations than y. A contradiction. 15 Proof (of Lemma 7). The case where α = 1 is immediate, so henceforth we assume that α > 1. Let s = c1 + c2, and let d′2 = s − d1. We prove that d1/α 1 + (s − d1)1/α < c1/α Define f (x) = x1/α + (s − x)1/α. The derivative is: αx1−1/α − 1 + (s − c1)1/α. Since d′2 > d2 the lemma follows. (s − x)1/α−1 α − f′(x) = x1/α−1 1 = α 1 α(s − x)1−1/α . 2 . It follows that f (x) 2 ). Thus we have f (c1) > f (d1). ⊓⊔ f′(x) = 0 implies that x = s is an increasing function in the interval (0, s 2 and f′(x) > 0 for 0 ≤ x < s Proof (of Lemma 9). Given a deployment y for (x, b, r), a pair of sensors is called bad if i ≤ ℓ < j and yi > yj. Let y be a deployment with lifetime t for (x, b, r) that minimizes the number of bad pairs. If there are no bad pairs, then we are done. Otherwise, we show that the number of bad pairs can be decreased. If y has a bad pair, then there must exist at least one bad pair of adjacent sensors. Let i and j be such sensors. We construct a new deployment vector y′ as follows. If the barrier is covered without i, then i is moved to 0, namely y′k = yk, for every k 6= i, and y′i = 0. Otherwise, if the barrier is covered without j, then j is moved to 1, namely y′k = yk, for every k 6= j, and y′i = 1. In both cases the pair (y′, r) is feasible and has lifetime t. Furthermore the number of bad pairs decreases. A contradiction. If both i and j are essential to the cover, we define y′ as follows: yj + (ρi − ρj) k = i, yi + (ρi − ρj) k = j, k 6= i, j. yk y′k =  We show that (y′, r) is a feasible solution. First, notice that y′i = yj + (ρi − ρj) < yi, since otherwise the barrier can be covered without j. Similarly, y′j = yi + (ρi − ρj) < yj. Hence, y′k ≤ yk, for k ≤ ℓ, and y′k ≥ yk, for k > ℓ, which means that y′ consumes less power than y. Also the barrier is covered, since the interval [yj −ρj, yi +ρi] is covered by i and j. Finally, y′i = yj +(ρi−ρj) ≤ yi +(ρi−ρj) = y′j, and therefore the number of bad pair decreases. A contradiction. ⊓⊔ Proof (of Theorem 3). By Lemma 9 we know that there exists a deployment y, such that yi ≤ yj, for every i ≤ ℓ < j. It follows that sensors from 0 cover [0, p0] while sensors from 1 cover [p1, 1], where p0 ≥ p1. Lemma 6 implies that there is a deployment y0 of the sensors from 0 that covers [0, p0] that satisfies reach order, and that there is a deployment y1 of sensors from 1 that covers [p1, 1] that satisfies reverse reach order. Define y′i =(y0 i i , y0 max(cid:8)y1 i ≤ ℓ, ℓ(cid:9) i > ℓ. y′ covers [0, 1] and it satisfies the bi-directional reach order. ⊓⊔ 16 C Hardness Results In this section we show that (i) BCFR is NP-hard, even if x ∈ pn, for any p ∈ (0, 1). (ii) There is no polynomial time multiplicative approximation algorithm for BCFR, unless P=NP, even if x = pn. (iii) There is no polynomial time algorithm that computes a solution within an additive factor ε, for some constant ε > 0, unless P=NP, even if x = pn. (iv) BCVR is strongly NP-hard. The hardness results apply to any a > 0 and α ≥ 1. We note that throughout the section we assume that α is integral for ease of presentation. More specifically, we assume that exponentiation with exponent α can be done in polynomial time. Our constructions can be fixed by taking a numerical approximation which is slightly larger than the required power. C.1 Fixed Radii The first result is obtained using a reduction from Partition.3 Roughly speak- ing, our reduction uses a sensor that cannot move if it is required to maintain its radius for one unit of time. This sensor splits the line into two segments, and therefore the question of whether the given numbers can be partitioned into two subsets of equal sum translates into the question of whether we can cover the two segments for some time interval. Lemma 11. BCFR is NP-hard, for any a > 0 and α ≥ 1, even if x = 1 . Furthermore, in this case it is NP-hard to decide whether the maximum lifetime is zero or at least a. n 2 Proof. Given a Partition instance a1, ..., an, let B = Pi ai. We construct a BCFR instance with n + 1 sensors as follows: xi = 1 2 , for every i; ρi =( ai 1 2(B+1) 2(B+1) i ≤ n, i = n + 1; bi =(aρα aρα i i + a 2 i 6= n + 1, i = n + 1. 2B+2 , 1 2 + 1 the interval [ 1 interval [0, 1 We show that (a1, . . . , an) ∈ Partition implies that there exists a solution with lifetime a, and that the maximum lifetime is zero if (a1, . . . , an) 6∈ Partition. Suppose that (a1, . . . , an) ∈ Partition, and let I ⊆ {1, . . . , n} be such that Pi∈I ai = 1 2Pi ai. Set ri = ρi, for every sensor i. Use sensor n + 1 to cover 2 − 1 2B+2 ], the sensors that correspond to I to cover the 2− 1 2B+2 ], and the rest of the sensors to cover the interval [ 1 2 + 1 2B+2 , 1]. 2 − 1 This is possible, since Pi∈I 2ρi = 1 2B+2 . Suppose that (a1, . . . , an) 6∈ Partition, and assume that there exists a solution (y, r) with non-zero lifetime. It must be that ri = ρi, for every i, 2B+2 . 2B+2 , and Pi∈{1,...,n}\I 2ρi = 1 since Pi 2ρi = 1. Since α ≥ 1, sensor n + 1 cannot move more than 3 A Partition instance consists of a list a1, . . . , an of positive integers, and the goal It is not hard to verify that a lifetime of a is achievable. 2 − 1 1 is to decide whether there exists I ⊆ {1, . . . , n} such that Pi∈I ai = Pi6∈I ai. 17 It follows that yn+1 = 1 a subset I ⊆ {1, . . . , n} of sensors that covers [0, 1 2B+2 ], and Pi∈I ai = (B + 1)Pi∈I 2ρi = 1 2 B. Hence, (a1, . . . , an) ∈ Partition. A contradiction. ⊓⊔ The next step is to prove a similar result for any p ∈ (0, 1). Since we already 2 , since all radii are multiples of 2 − 1 2B+2 . Thus there is 2 , we assume, without loss of generality, that p < 1 2 . considered p = 1 1 Lemma 12. BCFR is NP-hard, for any a > 0 and α ≥ 1, even if x = pn, where p ∈ (0, 1 2 ). Furthermore, in this case it is NP-hard to decide whether the maximum lifetime is zero or at least a. Proof. Given a Partition instance a1, ..., an, let B = Pi ai. We construct a BCFR instance with n + 3 sensors as follows: xi = p, for every i; aid 2(B+1) d 2(B+1) p−d/2 1−p−d/2 2 2 i ≤ n, i = n + 1, i = n + 2, i = n + 3; bi =(aρα aρα i i + a i 6= n + 1, i = n + 1. ρi =   where d = min{p, 1 − 2p}. We show that (a1, . . . , an) ∈ Partition implies that there exists a solution with lifetime a, and that the maximum lifetime is zero if (a1, . . . , an) 6∈ Partition. Supposed that (a1, . . . , an) ∈ Partition, and let I ⊆ {1, . . . , n} such that Pi∈I ai = Pi6∈I ai. Define ¯I = {1, . . . , n} \ I. Set ri = ρi, for every i, and use the following deployment: 1. Sensor n + 1 does not move and covers [p − d 2. Sensor n + 2 moves to p−d/2 3. Sensor n + 3 moves to 1+p+d/2 4. The sensors that correspond to I deploy such that they cover [p − d/2, p − 5. The sensors that correspond to ¯I deploy such that they cover [p + p 2B+2 , p + and covers [0, p − d/2]. and covers [p + d/2, 1]. 2B+2 , p + d 2B+2 ]. 2B+2 ]. p 2 2 d/2]. Bd 2 − d 2 − d (See example in Figure 3.) This is possible, since Pi∈I 2ρi = Pi∈I 2(B+1) = d verify that a lifetime of a is achievable. 2B+2 , and similarly Pi∈ ¯I 2ri = d aid B+1 = 2B+2 . It is not hard to Suppose that (a1, . . . , an) 6∈ Partition, and assume that there exists a so- lution (y, r) with non-zero lifetime. Notice that Pi 2ρi = 1, and thus it must be that ri = ρi, for every i. Since α ≥ 1, the battery of sensor n + 1 is depleted if it 2B+2 , p + d 2B+2 . This means that yn+1 ∈ (p − d moves a distance of 2B+2 ). Since 2 − p yn+1 < p+ d 2B+2 ≤ p+ d 4 , 1 2(cid:9) = 2 − 3p 4 , 1 4(cid:9) ≥ 1 max(cid:8) 1 4 , it follows that n + 3 must be deployed such that its cov- ering interval is to the right of the interval of n + 1, namely yn+3 − ρn+3 ≥ yn+1 + ρn+1. Next, observe that ρn+2 + ρn+3 = p−d/2 2 . Since 2 −min(cid:8) p 2 , and ρn+3 = 1 2 + 1−p−d/2 2 ≤ p+( 1 2 −p) = 1 4 − p = 1−d d 2 18 n + 2 n + 1 n + 3 0 p − d 2 p + d 2 1 p 2 − d 4 p 1 2 + p 2 + d 4 Fig. 3. Depiction of the deployment and radii assignment of sensors n + 1, n + 2, and n + 3. 2B+2 + d yn+1 + ρn+1 > p − d 2B+2 = p ≥ d, it follows that sensor n + 2 must be deployed such that its covering interval is to the left of the interval of n + 1, namely yn+2 + ρn+2 ≤ yn+1 − ρn+1. Without loss of generality we assume that sensors n + 2 and n + 3 are adjacent to 0 and 1, respectively. Since all remaining radii are multiples of 2B+2 , it follows that yn+1 = p. Hence there is a subset I ⊆ {1, . . . , n} of sensors that covers the remaining uncovered area to the left of p − d 2B+2 , while the rest of the sensors cover the remaining uncovered area to the right of p + d d 2B+2 . Thus d (cid:16) d d Pi∈I 2ρi = B+1 Hence, (a1, . . . , an) ∈ Partition. A contradiction. Pi∈I ai = B+1 2 − d 2B+2(cid:17) = 1 2 B . ⊓⊔ The following results are implied by Lemmas 11 and 12. Corollary 1. There is no polynomial time multiplicative approximation algo- rithm for BCFR, unless P=NP, for any a > 0 and α ≥ 1, even if x = pn, where p ∈ (0, 1). Corollary 2. There is no polynomial time algorithm that computes a solution within an additive factor ε, for some ε > 0, unless P=NP, for any a > 0 and α ≥ 1, even if x = pn, where p ∈ (0, 1). C.2 Variable Radii For BCVR we show strong NP-hardness using a reduction from 3-Partition4 that is based on the notion of block, which is a set of evenly spaced sensors with relatively small batteries. A block battery cannot move much, but together the block batteries can cover a long interval, assuming they stay in their initial locations. Formally, a block B = (z, ℓ, b, ρ) is a set of ℓ sensors located at z + (2i− 1)ρ, for i ∈ {1, . . . , ℓ}. The radius of each block sensor is ρ, and the battery power of each sensor is b. Typically, ρ would be small, while ℓ would be large. 4 < ai < Q 4 A 3-Partition instance consists of a list a1, . . . , an of n = 3m positive integers such that Q 2 , for every i, and Pi ai = mQ, and the goal is to decide whether the list can be partitioned into m triples all having the same sum Q. 3- Partition remains NP-hard even if Q is bounded above by a polynomial in n. In other words, the problem remains NP-hard even when representing the integers in the input instance in unary representation [10]. 19 a ]. a , z + 2ℓρ + b Observation 13. Let B = (z, ℓ, b, ρ) be a block. (i) B can cover the interval [z, z + 2ℓρ] for b/ρα time, and (ii) no block sensor can cover points outside [z − b Proof. If a block battery remains in its initial position, it can stay alive for b/ρα time. Since the batteries are at distance 2ρ from their neighbors, the interval [z, z + 2ℓρ] is covered. A sensor can move at most b/a, hence the leftmost and rightmost point that can be reached by a block sensor are z + ρ − b/a and z + 2ℓρ− ρ + b/a. Hence, no point outside [z − b/a, z + 2ℓρ + b/a] can be covered ⊓⊔ by a block sensor. We are now ready to present the reduction. Theorem 6. BCVR is strongly NP-hard, for every a > 0 and α ≥ 1. Proof. Given an BCVR instance and T , we show that it is NP-hard to determine whether the instance can stay alive for T time. δ 1 1 Given a 3-Partition instance, we construct the following BCVR instance. (2m−1)Q and T = 2aQ[2(2m − 1)Q]α. There is a sensor for each input Let δ = number: xi = 0, and bi = T (aiδ/2)α + a, for every i ∈ {1, . . . , n}. We also add m − 1 blocks: Bj = ((2j − 1)Qδ,⌈Qδ/2ρ⌉ , T ρα, ρ), for every j, where ρ = 4 · [2(2m−1)Q]α . The running time of the reduction is polynomial, since each block contains O(mαQα+1) sensors, and there are m − 1 blocks. We show that if (a1, . . . , an) ∈ 3-Partition, then there exists a solution with lifetime T . Since this instance belongs to 3-Partition, there is partition of {1, . . . , n} into m index subsets I1, . . . , Im, such that Ij = 3 andPi∈Ij ai = Q, for any j. We set ri = δai/2 for every i ≤ n, and we deploy the sensors in Ij such that they cover [2jQδ, (2j + 1)Qδ]. Observe that the three sensors in Ij can cover the interval, since Pi∈Ij aiδ = Qδ. Also, each such sensor uses at most a energy for deployment, and hence it has enough energy to stay alive for T time. Block sensors are not moved and their radii are set to ρ. Hence, block sensors can stay alive for T time. Furthermore, due to Observation 13, the sensors of block j can cover the interval [(2j − 1)Qδ, (2j − 1)Qδ + 2ρ⌈Qδ/(2ρ)⌉] during their lifetime. Observed that this interval contains [(2j − 1)Qδ, 2jQδ]. Hence [0, 1] can be covered for T time. Now supposed that there is a solution with lifetime T . It follows that the block sensors radii cannot be larger than ρ. Hence, Observation 13 implies that the sensors of block j do not cover points outside 2ri =Pi∈Ij [(2j − 1)Qδ − T ρα/a, (2j − 1)Qδ + 2ρ⌈Qδ/(2ρ)⌉ + T ρα/a] . Since T ρα/a = 2Q[2(2m − 1)Q]α · δα and 4α · [2(2m − 1)Q]−2α ≤ 1 2 Qδ · [2(2m − 1)Q]−α ≤ δ 8 2ρ = 2δ 4 · 1 [2(2m−1)Q]α ≤ δ 8 , 20 δ we have that the sensors of block j do not cover points outside [(2j − 1)Qδ − 8 , 2jQδ + δ 8 ] must be covered by a subset of the first n sensors whose sum of radii is at least (Q− 3 8 )δ. 4 ]. It follows that the interval [2jQδ + δ 4 , (2j + 1)Qδ − δ Since T (aiδ/2)α = 2aQ[2(2m − 1)Q]αaα we have that the battery power of sensor i is i [2(2m − 1)Q]−α = 2aQaα i , bi = 2aQaα i + a ≤ 2aQaα i · 2Q+1 2Q ≤ T (aiδ/2)α · ( 2Q+1 2Q )α . Hence, the radius that can be maintained by sensor i for T time is at most 2 · 2Q+1 aiδ 2Q . Since ai < Q/2, this radius is smaller that δQ, and therefore the n sensors can be partitioned into m subsets I1, . . . , Im, each covering an interval of length (Q − 3 ai ≥ Q for every subset j. If this is not the case, then Pi∈Ij 2 · 2Q+1 Pi∈Ij Hence, we can partition a1, . . . , an into m subsets each of sum at least Q, which means that (a1, . . . , an) ∈ 3-Partition. ⊓⊔ 8 )δ. We claim that Pi∈Ij 2Q ≤ (Q − 1)δ · 2Q+1 ai ≤ Q − 1, for some j. Hence, 2Q = 2Q2−Q−1 2 )δ < (Q − 3 · δ < (Q − 1 8 )δ . aiδ 2Q 21
1604.05337
1
1604
2016-04-18T20:15:47
Design of Dynamic Algorithms via Primal-Dual Method
[ "cs.DS" ]
We develop a dynamic version of the primal-dual method for optimization problems, and apply it to obtain the following results. (1) For the dynamic set-cover problem, we maintain an $O(f^2)$-approximately optimal solution in $O(f \cdot \log (m+n))$ amortized update time, where $f$ is the maximum "frequency" of an element, $n$ is the number of sets, and $m$ is the maximum number of elements in the universe at any point in time. (2) For the dynamic $b$-matching problem, we maintain an $O(1)$-approximately optimal solution in $O(\log^3 n)$ amortized update time, where $n$ is the number of nodes in the graph.
cs.DS
cs
Design of Dynamic Algorithms via Primal-Dual Method∗ Sayan Bhattacharya† Monika Henzinger‡ Giuseppe F. Italiano§ August 27, 2018 Abstract We develop a dynamic version of the primal-dual method for optimization problems, and apply it to obtain the following results. (1) For the dynamic set-cover problem, we maintain an O(f 2)- approximately optimal solution in O(f · log(m + n)) amortized update time, where f is the maximum "frequency" of an element, n is the number of sets, and m is the maximum number of elements in the uni- verse at any point in time. (2) For the dynamic b-matching problem, we maintain an O(1)-approximately optimal solution in O(log3 n) amortized update time, where n is the number of nodes in the graph. 1 Introduction The primal-dual method lies at the heart of the design of algorithms for combinatorial optimization prob- lems. The basic idea, contained in the "Hungarian Method" [16], was extended and formalized by Dantzig et al. [6] as a general framework for linear programming, and thus it became applicable to a large variety of problems. Few decades later, Bar-Yehuda et al. [2] were the first to apply the primal-dual method to the design of approximation algorithms. Subsequently, this paradigm was applied to obtain approximation algorithms for a wide collection of NP-hard problems [10, 11]. When the primal-dual method is applied to approximation algorithms, an approximate solution to the problem and a feasible solution to the dual of an LP relaxation are constructed simultaneously, and the performance guarantee is proved by comparing the values of both solutions. The primal-dual method was also extended to online problems [5]. Here, the input is revealed only in parts, and an online algorithm is required to respond to each new input upon its arrival (without being able to see the future). The algorithm's performance is compared against the benchmark of an optimal omniscient algorithm that can view the entire input sequence in advance. In this paper, we focus on dynamic algorithms for optimization problems. In the dynamic setting, the input of a problem is being changed via a sequence of updates, and after each update one is interested in maintaining the solution to the problem much faster than recomputing it from scratch. We remark that the dynamic and the online setting are completely different: in the dynamic scenario one is concerned more with guaranteeing fast (worst-case or amortized) update times rather than comparing the algorithms' performance against optimal offline algorithms. As a main contribution of this paper, we develop a dynamic version of the primal-dual method, thus opening up a completely new area of application of the primal-dual paradigm to ∗A preliminary version of this paper appeared in ICALP' 2015 (Track A). †The Institute of Mathematical Sciences, Chennai, India. Email: [email protected] ‡Faculty of Computer Science, University of Vienna, Austria. Email: [email protected]. The research leading to this work has received funding from the European Union's Seventh Framework Programme (FP7/2007-2013) under grant agreement number 317532 and from the European Research Council under the European Union's Seventh Framework Programme (FP7/2007- 2013)/ERC grant agreement number 340506. §Universit`a di Roma "Tor Vergata", Italy. E-mail: [email protected]. Partially supported by MIUR, the Italian Ministry of Education, University and Research, under Project AMANDA (Algorithmics for MAssive and Networked DAta). 1 the design of dynamic algorithms. With some careful insights, our recent algorithms for dynamic matching and dynamic vertex cover [4] can be reinterpreted in this new framework. In this paper, we show how to apply the new dynamic primal-dual framework to the design of two other optimization problems: the dynamic set-cover and the dynamic b-matching. Before proceeding any further, we formally define these problems. Definition 1.1 (Set-Cover). We are given a universe U of at most m elements, and a collection S of n sets S ⊆ U. Each set S ∈ S has a (polynomially bounded by n) "cost" cS > 0. The goal is to select a subset S ′ ⊆ S such that each element in U is covered by some set S ∈ S ′ and the total costPS∈S ′ c(S) is minimized. Definition 1.2 (Dynamic Set-Cover). Consider a dynamic version of the problem specified in Definition 1.1, where the collection S, the costs {cS}, S ∈ S, the upper bound f on the maximum frequency maxu∈U {S ∈ S : u ∈ S}, and the upper bound m on the maximum size of the universe U remain fixed. The universe U, on the other hand, keeps changing dynamically. In the beginning, we have U = ∅. At each time-step, either an element u is inserted into the universe U and we get to know which sets in S contain u, or some element is deleted from the universe. The goal is to maintain an approximately optimal solution to the set-cover problem in this dynamic setting. Definition 1.3 (b-Matching). We are given an input graph G = (V, E) with V = n nodes, where each node v ∈ V has a capacity cv ∈ {1, . . . , n}. A b-matching is a subset E′ ⊆ E of edges such that each node v has at most cv edges incident to it in E′. The goal is to select the b-matching of maximum cardinality. Definition 1.4 (Dynamic b-Matching). Consider a dynamic version of the problem specified in Defini- tion 1.3, where the node set V and the capacities {cv}, v ∈ V remain fixed. The edge set E, on the other hand, keeps changing dynamically. In the beginning, we have E = ∅. At each time-step, either a new edge is inserted into the graph or some existing edge is deleted from the graph. The goal is to maintain an approximately optimal solution to the b-matching problem in this dynamic setting. As stated in [5, 19], the set-cover problem has played a pivotal role both for approximation and for online algorithms, and thus it seems a natural problem to consider in our dynamic setting. Our definition of dynamic set-cover is inspired by the standard formulation of the online set-cover problem [5], where the elements arrive online. There exists algorithms for online set cover that achieve a competitive ratio of O(log n log m) [5], and it is also known that this bound is asymptotically tight [15]. Our Techniques. Roughly speaking, our dynamic version of the primal-dual method works as follows. We start with a feasible primal solution and an infeasible dual solution for the problem at hand. Next, we consider the following process: gradually increase all the primal variables at the same rate, and whenever a primal constraint becomes tight, stop the growth of all the primal variables involved in that constraint, and update accordingly the corresponding dual variable. This primal growth process is used to define a suitable data structure based on a hierarchical partition. A level in this partition is a set of the dual variables whose corresponding primal constraints became (approximately) tight at the same time-instant. To solve the dynamic problem, we maintain the data structure, the hierarchical partition and the corresponding primal- dual solution dynamically using a simple greedy procedure. This is sufficient for solving the dynamic set-cover problem. For the dynamic b-matching problem, we need some additional ideas. We first get a fractional solution to the problem using the previous technique. To obtain an integral solution, we perform randomized rounding on the fractional solution in a dynamic setting. This is done by sampling the edges with probabilities that are determined by the fractional solution. 2 Our Results. Our new dynamic primal-dual framework yields efficient dynamic algorithms for both the dynamic set-cover problem and the dynamic b-matching problem. In particular, for the dynamic set-cover problem we maintain a O(f 2)-approximately optimal solution in O(f · log(m + n)) amortized update time (see Theorem 3.2 in Section 3). On the other hand, for the dynamic b-matching problem, we maintain a O(1)-approximation in O(log3 n) amortized time per update (see Theorem 4.8 in Section 4). Further, we can show that an edge insertion/deletion in the input graph, on average, leads to O(log2 n) changes in the set of matched edges maintained by our algorithm. Related Work. The design of dynamic algorithms is one of the classic areas in theoretical computer science with a countless number of applications. Dynamic graph algorithms have received special attention, and there have been many efficient algorithms for several dynamic graph problems, including dynamic connectivity, minimum spanning trees, transitive closure, shortest paths and matching problems (see, e.g., the survey in [7]). The b-matching problem contains as a special case matching problems, for which many dynamic algorithms are known [3, 4, 12, 17, 18]. Unfortunately, none of the results on dynamic matching extends to the dynamic b-matching problem. To the best of our knowledge, no previous result was known for dynamic set-cover problem. In the static setting, a simple greedy algorithm for the set-cover problem gives O(log n) approxi- mation [13], whereas a primal-dual algorithm gives f -approximation [2]. Both the algorithms run in O(f · (m + n))-time. On the other hand, there exists some constant c > 0 such that obtaining a c log n- approximation to the set cover problem in polynomial time will imply P = N P [8]. Similarly, under the Unique-Games conjecture, one cannot obtain a better than f -approximation to the set cover problem in polynomial time [14]. For the maximum b-matching problem, the best known exact algorithm runs in O(mn log n)-time [9] in the static setting, where n (resp. m) is the number of nodes (resp. edges) in the graph. Very recently, Ahn and Guha [1] presented another static algorithm that runs in O(m · poly(δ−1, log n))-time and returns a (1 + δ)-approximation for maximum b-matching, for any δ > 0. Roadmap for the rest of the paper. We first define a problem called "fractional hypergraph b-matching" (see Definitions 1.5 and 1.6). In Section 2, we show how to maintain a fractional hypergraph b-matching in a dynamic setting. In Section 3, we use our result from Section 2 to design a dynamic algorithm for set cover. Finally, in Section 4 we present our result for dynamic b-matching. Definition 1.5 (Fractional Hypergraph b-Matching). We are given an input hypergraph G = (V, E) with V = n nodes and at most m ≥ E edges. Let Ev ⊆ E denote the set of edges incident upon a node v ∈ V , and let Ve = {v ∈ V : e ∈ Ev} denote the set of nodes an edge e ∈ E is incident upon. Let cv > 0 denote the "capacity" of a node v ∈ V , and let µ ≥ 1 denote the "multiplicity" of an edge. We assume that the µ and the cv values are polynomially bounded by n. Our goal is to assign a "weight" x(e) ∈ [0, µ] to each edge e ∈ E in such a way that (a)Pe∈Ev x(e) ≤ cv for all nodes v ∈ V , and (b) the sum of the weights of all the edges is maximized. Definition 1.6 (Dynamic Fractional Hypergraph b-Matching). Consider a dynamic version of the problem specified in Definition 1.5, where the node-set V , the capacities {cv}, v ∈ V , the upper bound f on the maximum frequency maxe∈E Ve, and the upper bound m on the maximum number of edges remain fixed. The edge-set E, on the other hand, keeps changing dynamically. In the beginning, we have E = ∅. At each time-step, either an edge is inserted into the graph or an edge is deleted from the graph. The goal is to maintain an approximately optimal solution to the problem in this dynamic setting. 3 2 Maintaining a Fractional Hypergraph b-Matching in a Dynamic Setting 2.1 Preliminaries We first define a linear program for fractional hypergraph b-matching (Definition 1.5). Next, we define the concept of a "λ-maximal" solution of this LP (Definition 2.1) and prove the approximation guarantee for such a solution (Theorem 2.2). Our main result is summarized in Theorem 2.3 and Corollary 2.4. Below, we write a linear program for a fractional hypergraph b-matching. Primal LP: Maximize Xe∈E x(e) x(e) ≤ cv subject to: Xe∈Ev 0 ≤ x(e) ≤ µ Minimize Xv∈V subject to: cv · y(v) +Xe∈E z(e) + Xv∈Ve y(v) ≥ 1 y(v), z(e) ≥ 0 ∀v ∈ V. ∀e ∈ E. µ · z(e) ∀e ∈ E. ∀v ∈ V, e ∈ E. Dual LP: (1) (2) (3) (4) (5) (6) We next define the concept of a "λ-maximal" solution. Definition 2.1. A feasible solution to LP (1) is λ-maximal (for λ ≥ 1) iff for every edge e ∈ E with x(e) < µ, there is some node v ∈ Ve such thatPe′∈Ev x(e′) ≥ cv/λ. Theorem 2.2. Let f ≥ maxe∈E Ve be an upper bound on the maximum possible "frequency" of an edge. Let OPT be the optimal objective value of LP (1). Any λ-maximal solution to LP (1) has an objective value that is at least OPT/(λf + 1). Proof. Let {x∗(e)} be a λ-maximal solution to the primal LP. Construct a dual solution {y∗(v), z∗(e)}, as follows. For every v ∈ V , set y∗(v) = 1 if Pe∈Ev x∗(e) ≥ cv/λ, and y∗(v) = 0 otherwise. For every e ∈ E, set z∗(e) = 1 if x∗(e) = µ and z∗(e) = 0 otherwise. Consider the dual constraint corresponding to any edge e′ ∈ E. Since the primal solution {x∗(e)} is λ-maximal, either x∗(e) = µ or there is some v′ ∈ Ve′ for which y∗(v′) = 1. In the former case we have z∗(e) = 1, whereas in the latter case we have y∗(v′) = 1. Hence, the dual constraint under consideration is satisfied. This shows that the values {y∗(v), z∗(e)}, constitute a feasible dual solution. Next, we infer that: Xv∈V cv · y∗(v) +Xe∈E µ · z∗(e) µ cv + Xe∈E:z∗(e)=1 λ · Xe∈Ev x∗(e) +Xe∈E x∗(e) +Xe∈E = Xv∈V :y∗(v)=1 ≤ Xv∈V :y∗(v)=1 ≤ Xv∈V λ · Xe∈Ev ≤ λ · f ·Xe∈E = (λf + 1) ·Xe∈E x∗(e) x∗(e) x∗(e) x∗(e) + Xe∈E:z∗(e)=1 4 x∗(e) (7) (8) (9) Equation 7 holds since y∗(v) ∈ {0, 1} for all v ∈ V and z∗(e) ∈ {0, 1} for all e ∈ E. Equation 8 holds since y∗(v) = 1 only ifPe∈Ev x∗(e) ≥ cv/λ, and since x∗(e) = µ for all e ∈ E with z∗(e) = 1. Equation 9 holds since each edge can be incident upon at most f nodes. Thus, we have constructed a feasible dual solution whose objective is at most (λf +1)-times the objective of the λ-maximal primal solution. The theorem now follows from weak duality. Our main result is summarized below. For the rest of Section 2, we focus on proving Theorem 2.3. Theorem 2.3. We can maintain a (f + 1 + ǫf )-maximal solution to the dynamic fractional hypergraph b-matching problem in O(f · log(m + n)/ǫ2) amortized update time. Corollary 2.4. We can maintain an O(f 2)-approximate solution to the dynamic hypergraph b-matching problem in O(f log(m + n)/ǫ2) amortized update time. Proof. Follows from Theorem 2.2 and Theorem 2.3. 2.2 The (α, β)-partition and its properties. For the time being, we restrict ourselves to the static setting. Inspired by the primal-dual method for set- cover, we consider the following algorithm for the fractional hypergraph b-matching problem. • Consider an initial primal solution with x(e) ← 0 for all e ∈ E, and define F ← E. • WHILE there is some primal constraint that is not tight: -- Keep increasing the primal variables {x(e)}, e ∈ F , uniformly at the same rate till some pri- mal constraint becomes tight. At that instant, "freeze" all the primal variables involved in that constraint and delete them from the set F , and set the corresponding dual variable to one. In Figure 1, we define a variant of the above procedure that happens to be easier to maintain in a dynamic setting. The main idea is to discretize the continuous primal growth process. Define cmin = minv∈V cv, and without any loss of generality, assume that cmin > 0. Fix two parameters α, β > 1, and define L = ⌈logβ(mµα/cmin)⌉. Claim 2.5. If we set x(e) ← µ · β−L for all e ∈ E, then we get a feasible primal solution. Proof. Clearly, x(e) ≤ µ for all e ∈ E. Now, consider any node v ∈ V . We have Pe∈Ev x(e) = Ev · µ · β−L ≤ E · µ · β−L ≤ m · µ · β−L ≤ m · µ · (cmin/(mµα)) = cmin/α < cv. Hence, all the primal constraints are satisfied. 01. 02. 03. 04. 05. 06. 07. 08. Set x(e) ← µ · β−L for all e ∈ E, and define c∗ v = cv/(f αβ) for all v ∈ V . Ev. FOR i = L − 1 to 1: Set VL ← {v ∈ V :Pe∈Ev x(e) ≥ c∗ Set x(e) ← x(e) · β for all e ∈ E \SL Set Vi ←nv ∈ V \SL Set Ei ←Sv∈Vi Set V0 ← V \SL k=1 Vi, and E0 ←Sv∈V0 v}, and EL ←Sv∈VL vo. k=i+1 Vk :Pe∈Ev x(e) ≥ c∗ Set x(e) ← x(e) · β for all e ∈ E0. Ev. k=i+1 Ei. Ev. Figure 1: DISCRETE-PRIMAL-DUAL(). 5 Our new algorithm is described in Figure 1. We initialize our primal solution by setting x(e) ← µβ−L for every edge e ∈ E, as per Claim 2.5. We call a node v nearly-tight if its corresponding primal constraint is tight within a factor of f αβ, and slack otherwise. Furthermore, we call an edge nearly-tight if it is incident upon some nearly tight node, and slack otherwise. Let VL ⊆ V and EL ⊆ E respectively denote the sets of nearly tight nodes and edges, immediately after the initialization step. The algorithm then performs L − 1 iterations. At iteration i ∈ {L − 1, . . . , 1}, the algorithm increases the weight x(e) of every slack edge e by a factor of β. Since the total weight received by every slack node v (from its incident edges) never exceeds cv/(f αβ), this weight-increase step does not violate any primal constraint. The algorithm then defines Vi (resp. Ei) to be the set of new nodes (resp. edges) that become nearly-tight due to this weight-increase step. Finally, the algorithm defines V0 (resp. E0) to be the set of nodes (resp. edges) that are slack at the end of iteration i = 1. It terminates after increasing the weight of every edge in E0 by a factor of β. When the algorithm terminates, it is easy to check that x(e) = µ · β−i for every edge e ∈ Ei, i ∈ {0, . . . , L}. We also have c∗ v for every node v ∈ V0. Furthermore, at the end of the algorithm, every edge e ∈ E \ E0 is nearly-tight, and every edge e ∈ E0 has weight x(e) = µ. We, therefore, reach the following conclusion. k=1 Vk, andPe∈Ev x(e) ≤ β · c∗ v for every node v ∈SL v ≤Pe∈Ev x(e) ≤ β · c∗ Claim 2.6. The algorithm described in Figure 1 returns an (f αβ)-maximal solution to the fractional hy- pergraph b-matching problem with the additional property that c∗ v for every node v ∈SL k=1 Vk, andPe∈Ev x(e) ≤ β · c∗ v for every node v ∈ V0. Our goal is to make a variant of the procedure in Figure 1 work in a dynamic setting. Towards this end, we introduce the concept of an (α, β)-partition (see Definition 2.7) satisfying a certain invariant (see Invariant 2.9). The reader is encouraged to notice the similarities between this construct and the output of the procedure in Figure 1. v ≤ Pe∈Ev x(e) ≤ β · c∗ Definition 2.7. An (α, β)-partition of the graph G partitions its node-set V into subsets V0 . . . VL, where L = ⌈logβ(mµα/cmin)⌉ and α, β > 1. For i ∈ {0, . . . , L}, we identify the subset Vi as the ith "level" of this partition, and call i the level ℓ(v) of a node v. We also define the level of each edge e ∈ E as ℓ(e) = maxv∈Ve {ℓ(v)}, and assign a "weight" w(e) = µ · β−ℓ(e) to the edge e. Given an (α, β)-partition, let Ev(i) ⊆ Ev denote the set of edges incident to v that are in the ith level, and let Ev(i, j) ⊆ Ev denote the set of edges incident to v whose levels are in the range [i, j]. Ev(i) = {e ∈ Ev : ℓ(e) = i} ∀v ∈ V ; i ∈ {0, . . . , L} j Ev(i, j) = Ev(k) ∀v ∈ V ; i, j ∈ {0, . . . , L}, i ≤ j. [k=i Similarly, we define the notations Dv and Dv(i, j). Dv = Ev Dv(i) = Ev(i) Dv(i, j) = Ev(i, j) (10) (11) (12) (13) (14) Given an (α, β)-partition, let Wv =Pe∈Ev w(e) denote the total weight a node v ∈ V receives from the edges incident to it. We also define the notation Wv(i). It gives the total weight the node v would receive from the edges incident to it, if the node v itself were to go to the ith level. Thus, we have Wv = Wv(ℓ(v)). 6 Since the weight of an edge e in the hierarchical partition is given by w(e) = µ · β−ℓ(e), we derive the following equations for all nodes v ∈ V . µ · β−ℓ(e). Wv = Xe∈Ev µ · β− max(ℓ(e),i) ∀i ∈ {0, . . . , L}. Wv(i) = Xe∈Ev Lemma 2.8. An (α, β)-partition satisfies the following conditions for all nodes v ∈ V . Wv(L) ≤ cmin/α Wv(L) ≤ · · · ≤ Wv(i) ≤ · · · ≤ Wv(0) Wv(i) ≤ β · Wv(i + 1) ∀i ∈ {0, . . . , L − 1}. Proof. Fix any (α, β)-partition and any node v ∈ V . We prove the first part of the lemma as follows. (15) (16) (17) (18) (19) Wv(L) = Xe∈Ev µ · β− max(ℓ(e),L) = Xe∈Ev µ · β−L ≤ mµ · β−L ≤ mµ · β− logβ (mµα/cmin) = cmin/α. We now fix any level i ∈ {0, . . . , L − 1} and show that the (α, β)-partition satisfies equation 18. Wv(i + 1) = Xe∈Ev µ · β− max(ℓ(e),i+1) ≤ Xe∈Ev Finally, we prove equation 19. µ · β− max(ℓ(e),i) = Wv(i). Wv(i) = Xe∈Ev µ · β− max(ℓ(e),i) = µ · β · Xe∈Ev ≤ µ · β · Xe∈Ev β− max(ℓ(e),i+1) = β · Wv(i + 1) β−1−max(ℓ(e),i) Fix any node v ∈ V , and focus on the value of Wv(i) as we go down from the highest level i = L to the lowest level i = 0. Lemma 2.8 states that Wv(i) ≤ cmin/α when i = L, that Wv(i) keeps increasing as we go down the levels one after another, and that Wv(i) increases by at most a factor of β between consecutive levels. We will maintain a specific type of (α, β)-partition, where each node is assigned to a level in a way that v = cv/(f αβ). For every node v ∈ V \ V0, it holds that c∗ v ≤ Wv ≤ f αβ · c∗ v and satisfies the following Invariant 2.9. This invariant is a relaxation of the bounds on Pe∈Ev x(e) for every node v stated in Claim 2.6. Invariant 2.9. Define c∗ for every node v ∈ V0 it holds that Wv ≤ f αβ · c∗ v. Theorem 2.10. Consider an (α, β)-partition that satisfies Invariant 2.9. The edge-weights {w(e)}, e ∈ E, give an (f αβ)-maximal solution to LP (1). Proof. By Invariant 2.9, we have Wv ≤ (f αβ) · c∗ for every edge e ∈ E. Thus, the weights {w(e)}, e ∈ E, define a feasible solution to LP (1). v = cv for every node v ∈ V . Next, note that w(e) ≤ µ We claim that for every edge e ∈ E with w(e) < µ, there is some node v ∈ Ve for which Wv ≥ cv/(f αβ). This will imply that the weights {w(e)}, e ∈ E, form an (f αβ)-maximal feasible solution to the primal LP. To prove the claim, consider any edge e ∈ E with w(e) < µ. Since w(e) = µβ−ℓ(e), this implies that ℓ(e) > 0. Let v ∈ arg maxu∈Ve {ℓ(u)}. Note that ℓ(e) = ℓ(v). This implies that ℓ(v) > 0. Hence, by Invariant 2.9, we have Wv ≥ c∗ v = cv/(f αβ). This concludes the proof of the theorem. 7 2.3 The algorithm: Handling the insertion/deletion of an edge. We now show how to maintain an (α, β)-partition under edge insertions and deletions. A node is called dirty if it violates Invariant 2.9, and clean otherwise. At the beginning of the algorithm the edge-set E is empty, and, thus, every node is initially clean and at level zero. Now consider the time instant just prior to the tth update. By induction hypothesis, at this instant every node is clean. Then the tth update takes place, which inserts (resp. deletes) an edge e in E with weight w(e) = µβ−ℓ(e). This increases (resp. decreases) the weights {Wv}, v ∈ Ve. Due to this change, the nodes v ∈ Ve might become dirty. To recover from this, we call the subroutine in Figure 2, which works as follows 01. WHILE there exists a dirty node v 02. IF Wv > f αβc∗ v, THEN 03. 04. 05. // If true, then by equation 17, we have ℓ(v) < L. Increment the level of v by setting ℓ(v) ← ℓ(v) + 1. ELSE IF (Wv < c∗ v and ℓ(v) > 0), THEN Decrement the level of v by setting ℓ(v) ← ℓ(v) − 1. Figure 2: RECOVER(). Consider any node v ∈ V and suppose that Wv > f αβc∗ v = cv ≥ cmin. In this event, the algorithm increments the level of the node. since α > 1, equation 17 implies that Wv(L) < Wv(ℓ(v)) and, hence, we have L > ℓ(v). In other words, when the procedure described in Figure 2 decides to increment the level of a dirty node v (Step 02), we know for sure that the current level of v is strictly less than L (the highest level in the (α, β)-partition). Next, consider an edge e ∈ Ev. If we change ℓ(v), then this may change the weight w(e), and this in turn may change the weights {Wz}, z ∈ Ve. Thus, a single iteration of the WHILE loop in Figure 2 may lead to some clean nodes becoming dirty, and some other dirty nodes becoming clean. If and when the WHILE loop terminates, however, we are guaranteed that every node is clean and that Invariant 2.9 holds. 2.4 Data structures. We now describe the relevant data structures that will be used by our algorithm. • We maintain for each node v ∈ V : -- A counter LEVEL[v] to keep track of the current level of v. Thus, we set LEVEL[v] ← ℓ(v). -- A counter WEIGHT[v] to keep track of the weight of v. Thus, we set WEIGHT[v] ← Wv. -- For every level i > LEVEL[v], we store the set of edges Ev(i) in the form of a doubly linked list INCIDENT-EDGES v[i]. For every level i ≤ LEVEL[v], the list INCIDENT-EDGES v[i] is empty. -- For level i = LEVEL[v], we store the set of edges Ev(0, i) in the form of a doubly linked list INCIDENT-EDGES v[0, i]. For every level i 6= LEVEL[v], the list INCIDENT-EDGES v[0, i] is empty. • When the graph gets updated due to an edge insertion/deletion, we may discover that a node violates Invariant 2.9. Recall that such a node is called dirty, and we store the set of such nodes as a doubly linked list DIRTY-NODES. For every node v ∈ V , we maintain a bit STATUS[v] ∈ {dirty, clean} that indicates if the node is dirty or not. Every dirty node stores a pointer to its position in the list DIRTY-NODES. 8 • The collection of linked lists SL i=0 {INCIDENT-EDGESv[0, i], INCIDENT-EDGES v[i]} is denoted by the phrase "incidence lists of v". For every edge e ∈ E, we maintain a counter LEVEL[e] to keep track of ℓ(e). Furthermore, for every edge e ∈ E, we maintain Ve bidirectional pointers corresponding to the nodes in Ve. The pointer corresponding to a node v ∈ Ve points to the position of e in the incidence lists of v. Using these pointers, we can update the incidence lists of the relevant nodes when the edge e is inserted into (resp. deleted from) the graph, or when some node v ∈ Ve increases (resp. decreases) its level by one. 2.5 Bounding the amortized update time. We devote this section to the proof of the following theorem. Theorem 2.11. Fix any ǫ ∈ (0, 1), α = 1 + 1/f + 3ǫ and β = 1 + ǫ. Starting from an empty graph, we can maintain an (α, β) partition in G satisfying Invariant 2.9 in O(f log(m + n)/ǫ2) amortized update time. The main idea is as follows. After an edge insertion or deletion the data structure can be updated in time O(1), plus the time to adjust the levels of the nodes, i.e., the time for procedure RECOVER. To bound the latter quantity we note that each time the level of an edge e ∈ E changes, we have to update at most f lists (one corresponding to each node v ∈ Ve). Hence, the time taken to update the lists is given by f · δl, where δl is the number of times the procedure in Figure 2 changes the level of an edge. Below, we show that δl ≤ t · O(L/ǫ) = t · O(log(m + n)/ǫ2) after t edge insertions/deletions in G starting from an empty graph. This gives the required O(f δl/t) = O(f log(m + n)/ǫ2) bound on the amortized update time. Hence, to complete the proof of Theorem 2.11, we need to give an amortized bound on the number of times we have to change the level (or, equivalently, the weight) of an already existing edge. During a single iteration of the WHILE loop in Figure 2, this number is exactly Dv(0, i) when node v goes from level i to level i + 1, and at most Dv(0, i) when node v goes from level i to level i − 1. Specifically, we devote the rest of this section to the proof of Theorem 2.12, which implies that on average we change the weights of O(L/ǫ) = O(log(m + n)/ǫ2) edges per update in G. Theorem 2.12. Set α ← 1+ 1/f + 3ǫ and β ← 1+ ǫ. In the beginning, when G is an empty graph, initialize a counter COUNT ← 0. Subsequently, each time we change the weight of an already existing edge in the hierarchical partition, set COUNT ← COUNT + 1. Then COUNT = O(tL/ǫ) just after we handle the tth update in G. Recall that the level of an edge e is defined as ℓ(e) = maxv∈Ve(ℓ(v)). Consider the following thought experiment. We have a bank account, and initially, when there are no edges in the graph, the bank account has a balance of zero dollars. For each subsequent edge insertion/deletion, at most 3L/ǫ dollars are deposited to the bank account; and every time our algorithm changes the level of an already existing edge, one dollar is withdrawn from it. We show that the bank account never runs out of money, and this implies that COUNT = O(tL/ǫ) after t edge insertions/deletions starting from an empty graph. Let B denote the total amount of money (or potential) in the bank account at the present moment. We keep track of B by distributing an ǫ-fraction of it among the nodes and the current set of edges in the graph. B = (1/ǫ) · Xe∈E Φ(e) +Xv∈V Ψ(v)! (20) In the above equation, the amount of money (or potential) associated with an edge e ∈ E is given by Φ(e), and the amount of money (or potential) associated with a node v ∈ V is given by Ψ(v). At every point in time, the potentials {Φ(e), Ψ(v)} will be determined by two invariants. But, before stating the invariants, we need to define the concepts of "active" and "passive" nodes. 9 Definition 2.13. Consider any node v ∈ V . In the beginning, there is no edge incident upon the node v, and we initialize a counter κv ← 0. Subsequently, whenever an edge-insertion occurs in the graph, if the inserted edge is incident upon v, then we set κv ← κv + 1. At any given time-step, we say that a node v ∈ V is active if µκv ≥ cv and passive otherwise. It is easy to check that if a node is active at time-step t, then it will remain active at every time-step t′ > t. A further interesting consequence of the above definition is that a passive node is always at level zero, as shown in the lemma below. Lemma 2.14. At any given time-step, if a node v ∈ V is passive, then we have ℓ(v) = 0. Proof. We prove this by induction. Let ℓ(t)(v) and κ(t) respectively denote the level of the node v and the v value of the counter κv at time-step t. Further, let W (t) denote the value of Wv at time-step t. Initially, v at time-step t = 0, the graph is empty, we have W (0) v = 0, and hence ℓ(0)(v) = 0. Now, by induction hypothesis, suppose that at time-step t the node v is passive and ℓ(t)(v) = 0, and, furthermore, suppose that the node v remains passive at time-step (t + 1). Given this hypothesis, we claim that ℓ(t+1)(v) = 0. The lemma will follow if we can prove the claim. v To prove the claim, note that since the node v is passive at time-step (t + 1), we have κ(t+1) µ < cv = v. Since the node v has at most κ(t+1) f αβc∗ edges incident to it at time-step (t + 1), and since each of these ≤ κ(t+1) edges has weight at most µ, we have W (t+1) v. Now, recall Figure 2. Since ℓ(t)(v) = 0 and since W (t+1) v, the node v can never become dirty during the execution of the procedure in Figure 2 after the edge insertion/deletion that occurs at time-step (t + 1). Thus, the node v will not change its level, and we will have ℓ(t+1)(v) = 0. This concludes the proof. µ < f αβc∗ < f αβc∗ v v v v We are now ready to state the invariants that define edge and node potentials. Invariant 2.15. For every edge e ∈ E, we have: Invariant 2.16. Recall Definition 2.13. For every node v ∈ V , we have: Φ(e) = (1 + ǫ) · (L − ℓ(e)) Ψ(v) =((cid:0)βℓ(v)+1/(f µ(β − 1))(cid:1) · max (0, f α · c∗ (β/(f (β − 1)) · κv v − Wv) if v is active; otherwise. When the algorithm starts, the graph has zero edges, and all the nodes v ∈ V are passive and at level 0 with Wv = 0 and κv = 0 < cv/µ. At that moment, Invariant 2.16 sets Ψ(v) = 0 for all nodes v ∈ V . Consequently, equation 20 implies that B = 0. Theorem 2.12, therefore, will follow if we can prove the next two lemmas. Their proofs appear in Section 2.6 and Section 2.7 respectively. Lemma 2.17. Consider the insertion (resp. deletion) of an edge e in E. It creates (resp. destroys) the weight w(e) = µ · β−ℓ(e), creates (resp. destroys) the potential Φ(e), and changes the potentials {Ψ(v)}, v ∈ Ve. Due to these changes, the total potential B increases by at most 3L/ǫ. Lemma 2.18. During every single iteration of the WHILE loop in Figure 2, the total increase in COUNT is no more than the net decrease in the potential B. 10 2.6 Proof of Lemma 2.17. Edge-insertion. Suppose that an edge e is inserted into the graph at time-step t. Then the potential Φ(e) is created and gets a value of at most (1 + ǫ)L units. Now, fix any node v ∈ Ve, and consider three possible cases. Case 1. The node v was passive at time-step (t − 1) and remains passive at time-step t. In this case, due to the edge-insertion, the potential Ψ(v) increases by β/(f (β − 1)). Case 2. The node v was passive at time-step (t − 1) and becomes active at time-step t. In this case, we must have: cv − µ ≤ µκ(t−1) v . By Invariant 2.16, just before the insertion of the edge e we had: v < cv ≤ µκ(t) Ψ(v) = {β/(f µ(β − 1))} · µκ(t−1) ≥ {β/(f µ(β − 1))} · (cv − µ) v (21) Since the node v was passive at time-step (t − 1), by Lemma 2.14 we infer that ℓ(t−1)(v) = 0. Hence, by Invariant 2.16, just after the insertion of the edge e we get: Ψ(v) = {β/(f µ(β − 1))} · max (0, f α · c∗ v − Wv) ≤ {β/(f µ(β − 1))} · (f αc∗ v) ≤ {β/(f µ(β − 1))} · cv (22) By equations 21, 22, the potential Ψ(v) increases by at most {β/(f µ(β − 1))} · (cv − (cv − µ)) = {β/(f (β − 1))}. Case 3. The node v was active at time-step (t−1). In this case, clearly the node v remains active at time-step t, the weight Wv increases, and hence the potential Ψ(v) can only decrease. From the above discussion, we conclude that the potential Ψ(v) increases by at most β/(f (β − 1)) for every node v ∈ Ve. Since Ve ≤ f , this accounts for a net increase of at most f · β/(f (β − 1)) = β/(β − 1) = β/ǫ ≤ L/ǫ. Finally, recall that the potential Φ(e) is created and gets a value of at most (1 + ǫ)L ≤ 2L/ǫ units. Thus, the net increase in the potential B is at most L/ǫ + 2L/ǫ = 3L/ǫ. Edge-deletion. If an edge e is deleted from E, then the potential Φ(e) is destroyed. The weight Wv of each node v ∈ Ve decreases by at most µ · β−ℓ(v). Furthermore, no passive node becomes active due to this edge-deletion, and, in particular, the counter κv remains unchanged for every node v ∈ V . Hence, each of the potentials {Ψ(v)}, v ∈ Ve, increases by at most βℓ(v)+1/(f µ(β − 1)) · µβ−ℓ(v) = β/(f (β − 1)) = ((1 + 1/ǫ)/f ) ≤ 2L/(ǫf ). The potentials of the remaining nodes and edges do not change. Since Ve ≤ f , by equation 20, the net increase in B is at most 2L/ǫ ≤ 3L/ǫ. 2.7 Proof of Lemma 2.18. Throughout this section, fix a single iteration of the WHILE loop in Figure 2 and suppose that it changes the level of a dirty node v by one unit. We use the superscript 0 (resp. 1) on a symbol to denote its state at the time instant immediately prior to (resp. after) that specific iteration of the WHILE loop. Further, we preface a symbol with δ to denote the net decrease in its value due to that iteration. For example, consider the potential B. We have B = B0 immediately before the iteration begins, and B = B1 immediately after iteration ends. We also have δB = B0 − B1. A change in the level of node v does not affect the potentials of the edges e ∈ E \ Ev. This observation, coupled with equation 20, gives us the following guarantee. 11 δB = (1/ǫ) · δΨ(v) + Xe∈Ev δΦ(e) + Xu∈V \{v} δΨ(u)  (23) Remark. Since the node v is changing its level, it must be active. Hence, by Invariant 2.16, we must have Ψ(v) = βℓ(v)+1/(f µ(β − 1)) · max(0, f αc∗ v − Wv). We will use this observation multiple times throughout the rest of this section. We divide the proof of Lemma 2.18 into two possible cases, depending upon whether the concerned iteration of the WHILE loop increments or decrements the level of v. The main approach to the proof remains the same in each case. We first give an upper bound on the increase in COUNT due to the iteration. Next, we separately lower bound each of the following quantities: δΨ(v), δΦ(e) for all e ∈ Ev, and δΨ(u) for all u ∈ V \ {v}. Finally, applying equation 23, we derive that δB is sufficiently large to pay for the increase in COUNT. Remark. Note that ℓ0(u) = ℓ1(u) for all nodes u ∈ V \ {v}, and E 0 u = E 1 will use the symbols ℓ(u) and Eu without any ambiguity for all such nodes. u for all nodes u ∈ V . Thus, we Case 1: The level of the node v increases from k to (k + 1). Claim 2.19. We have ℓ0(e) = k and ℓ1(e) = k + 1 for every edge e ∈ E 0 v (0, k). Proof. Consider edge e ∈ E 0 v (0, k), we have ℓ0(e) ≤ k. Since ℓ0(v) = k and e ∈ Ev, we must have ℓ0(e) = k. Finally, since ℓ1(u) = ℓ0(u) for all nodes u ∈ V \ {v}, we conclude that ℓ1(e) = ℓ1(v) = k + 1. v (0, k). Since e ∈ E 0 Claim 2.20. We have ℓ0(e) = ℓ1(e) for every edge e ∈ E 0 v (k + 1, L). Proof. Consider any edge e ∈ E 0 v (k + 1, L). Since ℓ0(e) ≥ k + 1 and ℓ0(v) = k, there must be some node u ∈ V \ {v} such that ℓ0(u) ≥ k + 1, e ∈ Eu and ℓ0(e) = ℓ0(u). Since ℓ1(u) = ℓ0(u) ≥ k + 1 and ℓ1(v) = k + 1, we infer that ℓ1(e) = ℓ1(u) = ℓ0(e). Claim 2.21. We have COUNT1 − COUNT0 = D0 v(0, k). Proof. When the node v changes its level from k to (k + 1), this only affects the levels of those edges that are at level k or below. Claim 2.22. We have δΨ(v) = 0. Proof. Since the node v increases its level from k to (k + 1), Step 02 (Figure 2) guarantees that W 0 W 0 both W 0 v (k) > f αc∗ v, we get: Ψ0(v) = Ψ1(v) = 0. It follows that δΨ(v) = Ψ0(v) − Ψ1(v) = 0. v. Next, from Lemma 2.8 we infer that W 1 v (k + 1) ≥ β−1 · W 0 v = W 0 v (k) > f αβ · c∗ v , W 1 v > f αc∗ v = v. Since Claim 2.23. For every edge e ∈ Ev, we have: δΦ(e) =((1 + ǫ) 0 if e ∈ E 0 if e ∈ E 0 v (0, k); v (k + 1, L). v (0, k), then we have ℓ0(e) = k and ℓ1(e) = k + 1 (see Claim 2.19). Hence, we have Proof. If e ∈ E 0 Φ0(e) = (1+ǫ)·(L−k) and Φ1(e) = (1+ǫ)·(L−k −1). It follows that δΦ(e) = Φ0(e)−Φ1(e) = (1+ǫ). v (k + 1, L), then Claim 2.20 implies that ℓ0(e) = ℓ1(e) = l (say). Accordingly, we In contrast, if e ∈ E 0 have Φ0(e) = Φ1(e) = (1 + ǫ) · (L − l). Hence, we get δΦ(e) = Φ0(e) − Φ1(e) = 0. 12 Claim 2.24. For every node u ∈ V \ {v}, we have: δΨ(u) ≥ −(1/f ) · Eu ∩ E 0 v (0, k) Proof. Consider any node u ∈ V \ {v}. If the node u is passive, then we have δΨ(u) = 0, and the claim is trivially true. Thus, for the rest of the proof we assume that the node u is active. Clearly, we have ℓ0(e) = ℓ1(e) for each edge e ∈ Eu \ Ev. Hence, we get δw(e) = 0 for each edge v (k + 1, L). Thus, we get Eu \ Ev. Next, by Claim 2.20, we have ℓ0(e) = ℓ1(e) for each edge e ∈ Eu ∩ E 0 δw(e) = 0 for each edge e ∈ Eu ∩ E 0 v (k + 1, L). We therefore conclude that: δWu = Xe∈Eu\Ev = Xe∈Eu∩E 0 δw(e) + Xe∈Eu∩E 0 v (k+1,L) δw(e) + Xe∈Eu∩E 0 v (0,k) δw(e) δw(e) = Eu ∩ E 0 = Eu ∩ E 0 v (0,k) v (0, k) · µ · (β−k − β−(k+1)) v (0, k) · µ · (β − 1)/βk+1 Using this observation, we infer that: δΨ(u) ≥ −(cid:16)βℓ(u)+1/(f µ(β − 1))(cid:17) · δWu = −(cid:16)βℓ(u)+1/(f µ(β − 1))(cid:17) · Eu ∩ E 0 ≥ −βℓ(u)−k · (1/f ) · Eu ∩ E 0 ≥ −(1/f ) · Eu ∩ E 0 v (0, k) v (0, k) v (0, k) · µ · (β − 1)/βk+1 (24) Equation 24 holds since either Eu ∩ E 0 v (0, k). In the former case, equation 24 is trivially true. In the latter case, by Claim 2.19 we have ℓ0(e) = k, and since ℓ0(e) ≥ ℓ(u), we infer that ℓ(u) ≤ k and βℓ(u)−k ≤ 1. v (0, k) = 0, or there is an edge e ∈ Eu ∩ E 0 Claim 2.25. We have: Proof. We have: δΨ(u) ≥ −D0 v(0, k) Xu∈V \{v} δΨ(u) = Xu∈V \{v} ≥ u∈V \{v}:Eu∩E 0 v (0,k)6=∅ X X δΨ(u) −(1/f ) · Eu ∩ E 0 v (0, k) (25) (26) (27) u∈V \{v}:Eu∩E 0 v (0,k)6=∅ f · (−1/f ) ≥ Xe∈E 0 = −D0 v (0,k) v(0, k) Equations 25 and 26 follow from Claim 2.24. Equation 27 follows from a simple counting argument and the fact that the maximum frequency of an edge is f . 13 From Claims 2.22, 2.23, 2.25 and equation 23, we derive the following bound. δB = (1/ǫ) · δΨ(v) + Xe∈Ev ≥ (1/ǫ) ·(cid:0)0 + (1 + ǫ) · D0 = D0 v(0, k) δΦ(e) + Xu∈V \{v} v(0, k)(cid:1) v(0, k) − D0 δΨ(u)  Thus, Claim 2.21 implies that the net decrease in the potential B in no less than the increase in COUNT. This proves Lemma 2.18 for Case 1. Case 2: The level of the node v decreases from k to k − 1. Claim 2.26. For every edge e ∈ E 0 v (0, k), we have ℓ0(e) = k and w0(e) = µβ−k. Proof. Consider any edge e ∈ E 0 show that ℓ0(e) = k. Since ℓ0(e) = k, we must have w0(e) = µβ−k. v (0, k). Using the same argument as in the proof of Claim 2.19, we can The next claim bounds the degree D0 v(0, k) of node v, which we then use in the following claim to bound the increase in COUNT. Claim 2.27. We have W 0 v = W 0 v (k) < c∗ v, and, furthermore, D0 v(0, k) ≤ βkc∗ v/µ. Proof. Since the node v decreases its level from k to (k−1), Step 04 (Figure 2) ensures that W 0 c∗ v. Claim 2.26 implies that w0(e) = µβ−k for all e ∈ E 0 v (0, k). We conclude that: v = W 0 v (k) < c∗ v > W 0 v ≥ Xe∈E 0 v (0,k) w0(e) = µβ−k · D0 v(0, k). Thus, we get D0 v(0, k) ≤ c∗ vβk/µ. Claim 2.28. We have COUNT1 − COUNT0 ≤ c∗ vβk/µ. Proof. The node v decreases its level from k to k − 1. Due to this event, the level of an edge changes only if it belongs to E 0 v (0, k). Thus, we have COUNT1 − COUNT0 ≤ D0 v(0, k) ≤ c∗ vβk/µ. Claim 2.29. For all u ∈ V \ {v}, we have δΨ(u) ≥ 0. Proof. Fix any node u ∈ V \ {v}. If the node u is passive, then we have δΨ(u) = 0, and the claim is trivially true. Thus, for the rest of the proof we assume that the node u is active. If Eu ∩ E 0 v (0, k) = ∅, then we have W 0 v (0, k) 6= ∅. In this case, as the level of the node v decreases from k to k − 1, we infer that w0(e) ≤ w1(e) for all u . This implies that Ψ0(u) ≥ Ψ1(u). Thus, we have e ∈ Eu ∩ E 0 δΨ(u) = Ψ0(u) − Ψ1(u) ≥ 0. u , and hence, δΨ(u) = 0. Else we have Eu ∩ E 0 v (0, k), and, accordingly, we get W 0 u ≤ W 1 u = W 1 We now partition the edge-set Ev into two subsets, X and Y , according to the level of the other endpoint. X =(cid:26)e ∈ Ev : max u∈Ve\{v} {ℓ(u)} < k(cid:27) and Y = Ev \ X. 14 Claim 2.30. For every edge e ∈ Ev, we have: δΦ(e) =(0 −(1 + ǫ) if e ∈ Y ; if e ∈ X. Proof. Fix any edge e ∈ Ev. We consider two possible scenarios. 1. We have e ∈ Y . As the level of the node v decreases from k to k − 1, we infer that ℓ0(e) = ℓ1(e), and accordingly, Φ0(e) = Φ1(e). Hence, we get δΦ(e) = Φ0(e) − Φ1(e) = 0. 2. We have e ∈ X. Since the level of node v decreases from k to k − 1, we infer that ℓ0(e) = k and ℓ1(e) = k − 1, and accordingly, Φ0(e) = (1 + ǫ) · (L − k) and Φ1(e) = (1 + ǫ) · (L − k + 1). Hence, we get δΦ(e) = Φ0(e) − Φ1(e) = −(1 + ǫ). This concludes the proof of the Claim. Next, we partition W 0 v into two parts: x and y. The first part denotes the contributions towards W 0 the edges e ∈ X, while the second part denotes the contribution towards W 0 X ⊆ E 0 v (0, k), which implies that x =Pe∈X w0(e) = µβ−k · X. Thus, we get the following equations. v by v by the edges e ∈ Y . Note that W 0 v = x + y < c∗ v x = µβ−k · X w0(e) y = Xe∈Y (28) (29) (30) Equation 28 holds due to Claim 2.27. Claim 2.31. We havePe∈Ev δΦ(e) = −(1 + ǫ) · x · βk/µ. Proof. Claim 2.30 implies that Pe∈Ev δΦ(e) = −(1 + ǫ) · X. Applying equation 29, we infer that X = x · βk/µ. Claim 2.32. We have: δΨ(v) = (f αc∗ v − x − y) · βk+1 f µ(β − 1) − max (0, f αc∗ v − βx − y) · βk f µ(β − 1) . Proof. Equation 28 states that W 0 v = x + y < c∗ v. Since ℓ0(v) = k, we get: Ψ0(v) = (f αc∗ v − x − y) · βk+1 f µ(β − 1) As the node v decreases its level from k to k − 1, we have: w1(e) =(β · w0(e) w0(e) if e ∈ X; if u ∈ Y Accordingly, we have W 1 v = β · x + y, which implies the following equation. Ψ1(v) = max(0, f αc∗ v − βx − y) · βk f µ(β − 1) Since δΨ(v) = Ψ0(v) − Ψ1(v), the Claim follows from equations 31 and 32. 15 (31) (32) We now consider two possible scenarios depending upon the value of (f αc∗ each case δB ≥ c∗ Lemma 2.18 for Case 2. v − βx − y). We show that in vβk/µ. This, along with Claim 2.28, implies that δB ≥ COUNT1 − COUNT0. This proves 1. Suppose that (f αc∗ v − βx − y) < 0. From Claims 2.29, 2.31, 2.32 and equation 23, we derive: ǫ · δB = Xu∈V \{v} δΨ(u) + Xe∈Ev δΦ(e) + Ψ(v) ≥ −(1 + ǫ) · x · ≥ −(1 + ǫ) · c∗ v · βk µ βk µ + (f αc∗ v − x − y) · + (f α − 1)c∗ v · = = c∗ vβk µ (cid:26)−(1 + ǫ) + (α − 1/f ) · µ (cid:26)−(1 + ǫ) + (1 + 3ǫ) · c∗ vβk (β − 1)(cid:27) ǫ (cid:27) (1 + ǫ) βk+1 f µ(β − 1) βk+1 f µ(β − 1) β ≥ ǫ · c∗ v · βk µ (33) (34) Equation 33 follows from equation 28. Equation 34 holds since α = 1 + 1/f + 3ǫ and β = 1 + ǫ. 2. Suppose that (f αc∗ v − βx − y) ≥ 0. From Claims 2.29, 2.31, 2.32 and equation 23, we derive: δΨ(u) + Xe∈Ev ǫ · δB = Xu∈V \{v} ≥ −(1 + ǫ) · x · βk µ + (f αc∗ v − x − y) · δΦ(u, v) + Ψ(v) βk+1 f µ(β − 1) − (f αc∗ v − βx − y) · βk f µ(β − 1) v − x − y) · β f − (f αc∗ v − βx − y) · 1 f (βx + βy − βx − y) − (1 + ǫ) · x · (β − 1)(cid:9) − (1 + ǫ) · x · (β − 1)(cid:9) − (1 + ǫ) · x · (β − 1)(cid:9) ·(cid:8)(f αc∗ ·(cid:8)αc∗ ·(cid:8)αc∗ v − y f vβ − αc∗ v − v · (β − 1) − f y(β − 1) f − (1 + ǫ) · x(cid:9) v − β(y + x)(cid:9) · (α − β) · c∗ v = = = = ≥ ≥ βk µ(β − 1) βk µ(β − 1) βk µ(β − 1) βk µ βk µ βk µ ·(cid:8)αc∗ ·(cid:8)αc∗ ≥ ǫ · c∗ v · βk µ (35) (36) (37) Equation 35 holds since β = 1 + ǫ and f ≥ 1. Equation 36 follows from Equation 28. Equation 37 holds since α = 1 + 1/f + 3ǫ and β = 1 + ǫ. 16 3 Maintaining a Set-Cover in a Dynamic Setting We first show the link between the fractional hypergraph b-matching and set-cover. Lemma 3.1. The dual LP (4) is an LP-relaxation of the set-cover problem (Definition 1.1). Proof. Given an instance of the set-cover problem, we create an instance of the hypergraph b-matching problem as follows. For each element u ∈ U create an edge e(u) ∈ E, and for each set S ∈ S, create a node v(S) ∈ V with cost cv(S) = cS. Ensure that an element u belongs to a set S iff e(u) ∈ Ev(S). Finally, set µ = maxv∈V cv + 1. Since µ > maxv∈V cv, it can be shown that an optimal solution to the dual LP (4) will set z(e) = 0 for every edge e ∈ E. Thus, we can remove the variables {z(e)} from the constraints and the objective function of LP (4) to get a new LP with the same optimal objective value. This new LP is an LP-relaxation for the set-cover problem. We now present the main result of this section. Theorem 3.2. We can maintain an (f 2 + f + ǫf 2)-approximately optimal solution to the dynamic set cover problem in O(f · log(m + n)/ǫ2) amortized update time. Proof. We map the set cover instance to a fractional hypergraph b-matching instance as in the proof of Lemma 3.1. By Theorem 2.3, in O(f log(m + n)/ǫ2) amortized update time, we can maintain a feasible solution {x∗(e)} to LP (1) that is λ-maximal, where λ = f + 1 + ǫf . x∗(e) ≥ cv(S)/λ}. Since we can maintain the fractional solution {x∗(e)} in O(f log(m + n)/ǫ2) amortized update time, we can also maintain S ∗ without incurring any additional overhead in the update time. Now, using complementary slackness conditions, we Consider a collection of sets S ∗ = {S ∈ S : Pe∈Ev(S) can show that each element e ∈ U is covered by some S ∈ S ∗, and the sumPS∈S ∗ cS is at most (λf )-times the size of the primal solution {x∗(e)}. The corollary follows from LP duality. 4 Maintaining a b-Matching in a Dynamic Setting We will present a dynamic algorithm for maintaining an O(1)-approximation to the maximum b-matching (see Definitions 1.3, 1.4). Our main result is summarized in Theorem 4.8. We use the following ap- proach. First, we note that the fractional b-matching problem is a special case of the fractional hypergraph b-matching problem (see Definition 1.5) with f = 2 (for each edge is incident upon exactly two nodes). Hence, by Theorems 2.2 and 2.3, we can maintain a O(f 2) = O(1) approximate "fractional" solution to the maximum b-matching problem in O(f log(m + n)) = O(log n) amortized update time. Next, we perform randomized rounding on this fractional solution in the dynamic setting, whereby we select each edge in the solution with some probability that is determined by its fractional value. This leads to Theorem 4.8. Notations. Let G = (V, E) be the input graph to the b-matching problem. Given any subset of edges E′ ⊆ E and any node v ∈ V , let N (v, E′) = {u ∈ V : (u, v) ∈ E′} denote the set of neighbors of v with respect to the edge-set E′, and let deg(v, E′) = N (v, E′). Next, consider any "weight" function w : E′ → R+ that assigns a weight w(e) to every edge e ∈ E′. For every node v ∈ V , we define Wv =Pu∈N (v,E) w(u, v). Finally, for every subset of edges E′ ⊆ E, we define w(E′) =Pe∈E′ w(e). Recall that in the b-matching problem, we are given an "input graph" G = (V, E) with V = n nodes, where each node v ∈ V has a "capacity" cv ∈ {1, . . . , n}. We want to select a subset E′ ⊆ E of edges of maximum size such that each node v has at most cv edges incident to it in E′. We will also be interested in "fractional" b-matchings. In the fractional b-matching problem, we want to assign a weight w(e) ∈ [0, 1] to 17 every edge e ∈ E such thatPu∈N (v,E) w(u, v) ≤ cv for every node v ∈ V , and the sum of the edge-weights w(E) is maximized. In the dynamic version of these problems, the node-set V remains fixed, and at each time-step the edge-set E gets updated due to an edge insertion or deletion. We now show how to efficiently maintain an O(1)-approximate fractional b-matching in the dynamic setting. Theorem 4.1. Fix a constant ǫ ∈ (0, 1/4), and let λ = 4, and γ = 1 + 4ǫ. In O(log n) amortized update time, we can maintain a fractional b-matching w : E → [0, 1] in G = (V, E) such that: Wv ≤ cv/γ for all nodes v ∈ V. w(u, v) = 1 for each edge (u, v) ∈ E with Wu, Wv < cv/λ. (38) (39) Further, the size of the optimal b-matching in G is O(1) times the sumPe∈E w(e). Proof. Note that the fractional b-matching problem is a special case of fractional hypergraph b-matching where µ = 1, m = n2, and f = 2. We scale down the capacity of each node v ∈ V by a factor of γ, by defining cv = cv/γ for all v ∈ V . Next, we apply Theorem 2.3 on the input simple graph G = (V, E) with µ = 1, m = n2, f = 2, and the reduced capacities {cv}, v ∈ V . Let {w(e)}, e ∈ E, be the resulting (f + 1 + ǫf )-maximal matching (see Definition 2.1). Since ǫ < 1/3 and f = 2, we have λ ≥ f + 1 + ǫf . Since ǫ is a constant, the amortized update time for maintaining the fractional b-matching becomes O(f · log(m + n)/ǫ2) = O(log n). Finally, by Theorem 2.2, the fractional b-matching {w(e)} is an (λf + 1) = 9-approximate optimal b-matching in G in the presence of the reduced capacities {cv}. But scaling down the capacities reduces the objective of LP (1) by at most a factor of γ. Hence, the size of the optimal b-matching in G is at most 9γ = O(1) times the sumPe∈E w(e). This concludes the proof. Set λ = 4, γ = 1 + 4ǫ and ǫ ∈ (0, 1/4) for the rest of this section. We will show how to dynamically convert the fractional b-matching {w(e)} from Theorem 4.1 into an integral b-matching, by losing a constant factor in the approximation ratio. The main idea is to randomly sample the edges e ∈ E based on their w(e) values. But, first we introduce the following notations. Say that a node v ∈ V is "nearly-tight" if Wv ≥ cv/λ and "slack" otherwise. Let T denote the set of all nearly-tight nodes. We also partition of the node-set V into two subsets: B ⊆ V and S = V \ B. Each node v ∈ B is called "big" and has deg(v, E) ≥ c log n, for some large constant c > 1. Each node v ∈ S is called "small" and has deg(v, E) < c log n. Define EB = {(u, v) ∈ E : either u ∈ B or v ∈ B} to be the subset of edges with at least one endpoint in B, and let ES = {(u, v) ∈ E : either u ∈ S or v ∈ S} be the subset of edges with at least one endpoint in S. We define the subgraphs GB = (V, EB) and GS = (V, ES ). Observation 4.2. We have N (v, E) = N (v, EB) for all big nodes v ∈ B, and N (u, E) = N (u, ES) for all small nodes u ∈ S. Overview of our approach. Our algorithm maintains the following structures. • A fractional b-matching as per Theorem 4.1. • A random subset HB ⊆ EB, and a weight function wB : HB → [0, 1] in the subgraph GB(H) = (V, HB), as per Definition 4.3. • A random subset HS ⊆ ES, and a weight function wS : HS → [0, 1] in the subgraph GS (H) = (V, HS), as per Definition 4.4. • A maximal b-matching MS ⊆ HS in the subgraph GS (H), that is, for every edge (u, v) ∈ HS \ MS, there is a node q ∈ {u, v} such that deg(q, MS ) = cq. 18 • The set of edges E∗ = {e ∈ E : w(e) = 1}. The rest of this section is organized as follows. In Lemmas 4.5 (resp. Lemma 4.6), we prove some properties of the random set HB (resp. HS) and the weight function wB (resp. wS). In Lemma 4.7, we show that the edge-sets HB, HS, MS and E∗ can be maintained in a dynamic setting in O(log3 n) amortized update time. In Theorem 4.8, we prove our main result, by showing that one of the edge-sets HB, MS, E∗ is an O(1)-approximation to the optimal b-matching with high probability. The proofs of Lemmas 4.5, 4.6 and 4.7 appear in Sections 4.2, 4.3 and 4.4 respectively. Definition 4.3. The random set HB ⊆ EB and the weight function wB : HB → [0, 1] are defined so as to fulfill the following conditions. With probability one, we have deg(v, HB) ≤ cv for every small node v ∈ S. Pr[e ∈ HB] = w(e) for every edge e ∈ EB. ∀v ∈ B, the events {[(u, v) ∈ HB]}, u ∈ N (v, EB), are mutually independent. For each edge e ∈ HB, we have wB(e) = 1 (40) (41) (42) (43) We define ZB(e) ∈ {0, 1} to be an indicator random variable that is set to one if e ∈ HB and zero otherwise. Definition 4.4. The random set HS ⊆ ES and the weight function wS : HS → [0, 1] are defined so as to fulfill the following conditions. Pr[e ∈ HS] = pe = min(1, w(e) · (cλ log n/ǫ)) ∀e ∈ ES. The events {[e ∈ HS]}, e ∈ ES, are mutually independent. if pe ≥ 1; if pe < 1. For each edge e ∈ HS, we have wS(e) =(w(e) ǫ/(cλ log n) (44) (45) (46) We define ZS(e) ∈ {0, 1} to be an indicator random variable that is set to one if e ∈ HS and zero otherwise. Lemma 4.5. For every node v ∈ V , define W B hold with high probability. v = Pu∈N (v,HB ) wB(u, v). Then the following conditions • For every node v ∈ V , we have W B v ≤ cv. • For every node v ∈ B ∩ T , we have W B v ≥ (1 − ǫ) · (cv/λ). Lemma 4.6. For every node v ∈ V , define W S with high probability. v = Pu∈N (v,HS ) wS(u, v). The following conditions hold • For each node v ∈ V , we have W S v ≤ cv. • For each node v ∈ S, we have deg(v, HS) = O(log2 n). • For each node v ∈ S ∩ T , we have W S v ≥ (1 − ǫ) · (cv/λ). Lemma 4.7. With high probability, we can maintain the random sets of edges HB and HS, a maximal b- matching MS in the random subgraph GS (H) = (V, HS), and the set of edges E∗ in O(log3 n)-amortized update time. Theorem 4.8. With high probability, we can maintain a O(1)-approximate b-matching in the input graph G = (V, E) in O(log3 n) amortized update time. 19 4.1 Proof of Theorem 4.8 We maintain the random sets of edges HB and HS, a maximal b-matching MS in the subgraph GS (H) = (V, HS), and the set of edges E∗ = {e ∈ E : w(e) = 1} as per Lemma 4.7. This requires O(log3 n) amortized update time with high probability. The theorem will follow from Theorem 4.1, Lemma 4.9 and Lemma 4.11. Lemma 4.9. With high probability, each of the edge-sets HB, MS and E∗ is a valid b-matching in G. Proof. Since wB(e) = 1 for every edge e ∈ HB (see Definition 4.3), Lemma 4.5 implies that the edge-set HB is a b-matching in G with high probability. Next, by definition, the edge-set MS is a b-matching in GS (H) = (V, HS ). Since HS ⊆ E, the edge-set MS is also a b-matching in G. Finally, since w : E → [0, 1] is a fractional b-matching in G, the set of edges E∗ is also a b-matching in G. Lemma 4.10. We have w(E∗) +Pv∈B∩T Wv +Pv∈S∩T Wv ≥ w(E). Proof. Consider any edge (u, v) ∈ E. If u /∈ T and v /∈ T , then by equation 39, we must have (u, v) ∈ E∗. In contrast, if there is some node x ∈ {u, v} such that x ∈ T , then we must have either x ∈ B ∩ T or x ∈ S ∩ T . In other words, every edge (u, v) satisfies this property: Either (u, v) ∈ E∗, or it is incident upon some node in B ∩ T , or it is incident upon some node S ∩ T . Thus, each edge e ∈ E contributes at least w(e) to the sum w(E∗) +Pv∈B∩T Wv +Pv∈S∩T Wv. The lemma follows. Lemma 4.11. We have w(E) ≤ O(1) · max(E∗, HB, MS) with high probability. Proof. Note that w(E∗) = E∗. We consider three possible cases, based on Lemma 4.10. Case 1. w(E∗) ≥ (1/3) · w(E). In this case, clearly w(E) ≤ 3 · max(E∗, HB, MS). Case 2. Pv∈B∩T Wv ≥ (1/3) · w(E). In this case, we condition on the event under which Lemma 4.5 holds. Thus, we get: w(E) ≤ Xv∈B∩T 3 · Wv ≤ Xv∈B∩T ≤ (3λ/(1 − ǫ)) · Xe∈HB 3 · cv ≤ Xv∈B∩T (3λ/(1 − ǫ)) · W B v 2 · wB(e) = (6λ/(1 − ǫ)) · HB Case 3. Pv∈S∩T Wv ≥ (1/3) · w(E). In this case, we condition on the event under which Lemma 4.6 holds. Thus, we get: w(E) ≤ Xv∈S∩T 3 · Wv ≤ Xv∈S∩T ≤ (3λ/(1 − ǫ)) · Xe∈HS 3 · cv ≤ Xv∈S∩T 2 · wS (e) = (6λ/(1 − ǫ)) · Xe∈HS (3λ/(1 − ǫ)) · W S v wS(e) ≤ (12λ/(1 − ǫ)) · MS. The last inequality holds since MS is a maximal b-matching in GS(H) = (V, HS), and since every maximal b-matching is a 2-approximation to the maximum fractional b-matching (this follows from LP duality). Accordingly, we havePe∈HS wS (e) ≤ 2 · MS. Since λ, ǫ are constants, this concludes the proof of Theorem 4.8. 20 4.2 Proof of Lemma 4.5 Lemma 4.12. With high probability, we have W B v ≥ (1 − ǫ) · (cv/λ) for every node v ∈ B ∩ T . Proof. Fix any node v ∈ B ∩ T . Note that N (v, EB) = N (v, E), Wv ≥ cv/λ, and cv ≥ cλ log n/ǫ. Linearity of expectation, in conjunction with equations 41, 43 and Observation 4.2 imply that we have E[W B c log n/ǫ. Thus, applying Chernoff bound, we infer that E[W B The lemma follows if we take a union bound over all nodes v ∈ B ∩ T . E[ZB(u, v)] = Pu∈N (v,EB) w(u, v) = Pu∈N (v,E) w(u, v) = Wv ≥ cv/λ ≥ v ] ≥ (1 − ǫ) · (cv/λ) with high probability. v ] = Pu∈N (v,EB ) Lemma 4.13. With high probability, we have W B v ≤ cv for every node v ∈ V . Proof. Consider any node v ∈ V . If v ∈ S, then we have W B tions 40, 43). v ≤ cv with probability one (see equa- of Lemma 4.12, we infer that E[W B γ > (1 + ǫ) and cv ≥ cλ log n/ǫ, applying Chernoff bound we derive that W B For the rest of the proof, suppose that v ∈ B. Applying an argument similar to the one used in the proof v ] = Wv ≤ cv/γ. The last inequality holds due to equation 38. Since v ≤ cv with high probability. v ≤ cv with high probability. The lemma now follows if we Thus, for each node v ∈ V , we have W B take a union bound over all nodes v ∈ B. Lemma 4.5 now follows from Lemmas 4.12 and 4.13. 4.3 Proof of Lemma 4.6 4.3.1 High Level Overview In order to highlight the main idea, we assume that pe < 1 for every edge e ∈ ES. First, consider any small node v ∈ S. Since N (v, ES ) = N (v, E), from equations 38, 44, 46 and linearity of expectation, we infer that E[deg(v, HS )] = (cλ log n/ǫ) · Wv ≤ (cλ log n/ǫ) · (cv/(1 + ǫ)). Since cv ∈ [1, c log n], from equation 45 and Chernoff bound we infer that deg(v, HS ) ≤ (cλ log n/ǫ) · cv = O(log2 n) with high probability. Next, note that W S v ≤ cv with high probability. Next, suppose that v ∈ S ∩ T . In this case, we have E[deg(v, HS )] = (cλ log n/ǫ) · Wv ≥ (cλ log n/ǫ) · (cv/λ). Again, since this expectation is sufficiently large, applying Chernoff bound we get deg(v, HS) ≥ (cλ log n/ǫ) · (1 − ǫ) · (cv/λ) with high probability. It follows that W S v = (ǫ/(cλ log n)) · deg(v, HS) ≥ (1 − ǫ) · (cv/λ) with high probability. v = deg(v, HS) · (ǫ/(cλ log n)). Hence, we also get W S Finally, applying a similar argument we can show that for every big node v ∈ B, we have W S v ≤ cv with high probability. 4.3.2 Full Details For every node v ∈ V , we partition the node-set N (v, ES ) into two subsets -- X(v) and Y (v) -- as defined below. X(v) = {u ∈ N (v, ES ) : p(u,v) = 1} Y (v) = {u ∈ N (v, ES ) : p(u,v) < 1} Next, for every node v ∈ V , we define: δX(v) = Xu∈X(v) δY (v) = Xu∈Y (v) w(u, v) w(u, v) 21 (47) (48) (49) (50) Since N (v, ES ) ⊆ N (v, E) for every node v ∈ V , by equation 38 we have: w(u, v) = δX(v) + δY (v) ≤ cv/γ Xu∈N (v,ES ) Since X(v) ⊆ N (v, ES ) and wS (u, v) = w(u, v) for every node u ∈ X(v), we get: Lemma 4.14. For every node v ∈ V , if δY (v) ≤ ǫ/λ, then with high probability, we have: wS(u, v) = δX (v). Xu∈X(v) (51) (52) Y (v) ∩ N (v, HS) ≤ (1 + ǫ) · c log n; and Xu∈Y (v)∩N (v,HS ) wS (u, v) ≤ 2ǫ/λ. Proof. Recall that for every node u ∈ Y (v), we have defined ZS(u, v) ∈ {0, 1} to be an indicator random variable that is set to one if (u, v) ∈ HS and zero otherwise. Clearly, we have E[ZS(u, v)] = (cλ log n/ǫ) · w(u, v) for all u ∈ Y (v). Applying linearity of expectation, we get: E [Y (v) ∩ N (v, HS)] = E  Xu∈Y (v) ZS(u, v)  = (cλ log n/ǫ) · Xu∈Y (v) = (cλ log n/ǫ) · δY (v) ≤ c log n. w(u, v) Since E [Y (v) ∩ N (v, HS )] ≤ c log n, applying Chernoff bound we infer that Y (v) ∩ N (v, HS) ≤ (1 + ǫ)c log n with high probability. Finally, note that each node u ∈ Y (v) ∩ N (v, HS) has wS(u, v) = ǫ/(cλ log n). This implies that Pu∈Y (v)∩N (v,HS ) wS(u, v) = ǫ/(cλ log n) · Y (v) ∩ HS. Since Y (v) ∩ HS ≤ (1 + ǫ)c log n with high probability, we get: Pu∈Y (v)∩N (v,HS ) wS(u, v) ≤ (1+ǫ)ǫ/λ ≤ 2ǫ/λ with high probability. This concludes the proof of the lemma. Lemma 4.15. For every node v ∈ V , if δY (v) ≥ ǫ/λ, then with high probability, we have: (cλ log n/ǫ) · δY (v) (1 + ǫ) ≤ Y (v) ∩ N (v, ES ) ≤ (cλ log n/ǫ) · (1 + ǫ)δY (v); and δY (v) (1 + ǫ) ≤ Xu∈Y (v)∩N (v,HS ) wS (u, v) ≤ (1 + ǫ)δY (v). Proof. Let µ = E[Y (v) ∩ N (v, HS )]. Applying an argument as in the proof of Lemma 4.14, we get: µ = (cλ log n/ǫ) · δY (v) ≥ c log n. Hence, applying Chernoff bound, we infer that µ/(1 + ǫ) ≤ Y (v) ∩ N (v, HS) ≤ (1 + ǫ)µ with high probability. This proves the first part of the lemma. To prove the second part of the lemma, we simply note that, as in the proof of Lemma 4.14, we have Pu∈Y (v)∩N (v,HS ) wS(u, v) = (ǫ/(cλ log n)) · Y (v) ∩ N (v, HS ). Lemma 4.16. For every node v ∈ V , we have deg(v, HS) = O ((log n/ǫ) · cv) with high probability. Proof. Fix any node v ∈ V . Note that X(v) ⊆ N (v, HS) and w(u, v) = wS(u, v) ≥ ǫ/(cλ log n) for every node u ∈ X(v). By equation 52, we havePu∈X(v) wS(u, v) = δX (v) for every node v ∈ V . Thus, we get: X(v) ≤ (cλ log n/ǫ) · δX(v) = O ((log n/ǫ) · δX (v)) (53) 22 Lemmas 4.14 and 4.15 imply that with high probability, we have: Y (v) ∩ HS ≤ max (c log n, (cλ log n/ǫ)(1 + ǫ)δY (v)) (54) Since deg(v, HS ) = X(v) + Y (v) ∩ N (v, HS), the lemma follows if we add equations 53 and 54, and recall that δX(v) + δY (v) ≤ cv (see equation 51). = O ((log n/ǫ) · δY (v)) Lemma 4.17. For every node v ∈ V , we have W S Proof. Lemmas 4.14 and 4.15 imply that with high probability, we have: v ≤ cv with high probability. Xu∈Y (v)∩N (v,HS ) wS(u, v) ≤ max (2ǫ/λ, (1 + ǫ)δY (v)) Since the node-set N (v, HS ) is partitioned into X(v) and Y (v) ∩ N (v, HS ), we get: W S v = Xu∈X(v) wS (u, v) + Xu∈Y (v)∩N (v,HS ) wS(u, v) ≤ (1 + ǫ) · δX (v) + max(2ǫ/λ, (1 + ǫ)δY (v)) ≤ (1 + ǫ) · (δX (v) + δY (v)) + 2ǫ/λ ≤ (1 + ǫ) · (cv/γ) + (2ǫ/λ) · cv ≤ (1 + ǫ) · (cv/γ) + 2ǫ · (cv/γ) ≤ cv (55) (56) (57) (58) (59) Equation 56 follows from equations 52 and 55, and it holds with high probability. Equation 57 follows from equation 51 and the fact that cv ≥ 1. Equation 58 holds since γ < λ (see Theorem 4.1). Equation 59 holds since γ > 1 + 3ǫ (see Theorem 4.1). Lemma 4.18. For every node v ∈ S ∩ T , we have W S Proof. Fix any node v ∈ S ∩ T . Since v ∈ S, we have N (v, E) = N (v, ES ). Since v ∈ T , we have v ≥ (1 − ǫ) · (cv/λ). Wv =Pu∈N (v,ES) w(u, v) ≥ cv/λ. SincePu∈N (v,ES) w(u, v) = δX (v) + δY (v), we get: δX (v) + δY (v) ≥ cv/λ We also recall that by equation 52 we have: We now consider two possible cases, based on the value of δY (v). wS(u, v) = δX(v) Xu∈X(v) (60) (61) Case 1. We have δY (v) ≤ ǫ/λ. Since cv ≥ 1, in this case, we have δX (v) ≥ cv/λ − δY (v) ≥ cv(1 − ǫ)/λ. By equation 61, we infer that W S of the lemma for Case 1. Case 2. We have δY (v) > ǫ/λ. In this case, Lemma 4.15 implies that with high probability we have: v ≥Pu∈X(v) wS (u, v) = δX (v) ≥ cv(1 − ǫ)/λ. This concludes the proof Pu∈Y (v)∩N (v,HS ) wS(u, v) ≥ δY (v)/(1 + ǫ). Since the node-set N (v, HS) is partitioned into X(v) and Y (v) ∩ N (v, HS), we get: W S(u, v) = Xu∈X(v) wS(u, v) + Xu∈Y (v)∩N (v,HS ) wS (u, v) ≥ δX (v) + δY (v)/(1 + ǫ) ≥ (δX (v) + δY (v))/(1 + ǫ) ≥ (cv/λ) · (1/(1 + ǫ)) ≥ (1 − ǫ) · (cv/λ) This concludes the proof of the lemma for Case 2. Lemma 4.6 follows from Lemmas 4.16, 4.17, 4.18, and the fact that cv = O(log n) for all v ∈ S. 23 4.4 Proof of Lemma 4.7 We maintain the fractional b-matching {w(e)} as per Theorem 4.1. This requires O(log n) amortized update time, and starting from an empty graph, t edge insertions/deletions in G lead to O(t log n) many changes in the edge-weights {w(e)}. Thus, we can easily maintain the edge-set E∗ = {e ∈ E : w(e) = 1} in O(log n) amortized update time. Specifically, we store the edge-set E∗ as a doubly linked list. For every edge (u, v) ∈ E∗, we maintain a pointer that points to the position of (u, v) in this linked list. For every edge (u, v) ∈ E \ E∗, the corresponding pointer is set to NULL. An edge (u, v) is inserted into/deleted from the set E∗ only when its weight w(e) is changed. Thus, maintaining the linked list for E∗ does not incur any additional overhead in the update time. Next, we show to maintain the edge-set HS by independently sampling each edge e ∈ ES with proba- bility pe. This probability is completely determined by the weight w(e). So we need to resample the edge each time its weight changes. Thus, the amortized update time for maintaining HS is also O(log n). Similar to the case of the edge-set E∗, we store the edge-set HS as a doubly linked list. Next, we show how to maintain the maximal b-matching MS in HS. Every edge e ∈ HS has at least one endpoint in S, and each node v ∈ S has deg(v, HS ) = O(log2 n) with high probability (see Lemma 4.6). Exploiting this fact, for each node v ∈ B, we can maintain the set of its free (unmatched) neighbors Fv(S) = {u ∈ N (v, HS) : u is unmatched in MS} in O(log2 n) amortized time per update in HS, with high probability. This is done as follows. Since v ∈ B, the onus of maintaining the set Fv(S) falls squarely upon the nodes in N (v, HS ) ⊆ S. Specifically, each small node u ∈ S maintains a "status-bit" indicating if it is free or not. Whenever a matched small node u changes its status-bit, it communicates this information to its neighbors in N (u, HS) ∩ B in O(deg(u, HS)) = O(log2 n) time. Using the lists {Fv(S)}, v ∈ B, and the status-bits of the small nodes, after each edge insertion/deletion in HS, we can update the maximal b-matching MS in O(log2 n) worst case time, with high probability. Since each edge insertion/deletion in G, on average, leads to O(log n) edge insertions/deletions in HS, we spend O(log3 n) amortized update time, with high probability, for maintaining the matching MS. Finally, we show how to maintain the set HB. The edges (u, v) ∈ EB with both endpoints u, v ∈ B are sampled independently with probability w(u, v). This requires O(log n) amortized update time. Next, each small node v ∈ S randomly selects some neighbors u ∈ N (v, EB) and adds the corresponding edges (u, v) to the set HB, ensuring that Pr[(u, v) ∈ HB] = w(u, v) for all u ∈ N (v, EB) and that deg(v, HB) ≤ cv. The random choices made by the different small nodes are mutually independent, which implies equation 42. But, for a given node v ∈ S the random variables {ZB(u, v)}, u ∈ N (v, EB), are completely correlated. They are determined as follows. fine ai(v) = w(v, vi) if vi ∈ N (v, EB) and zero otherwise. We also define Ai(v) = Pi In the beginning, we pick a number ηv uniformly at random from the interval [0, 1), and, in a pre- defined manner, label the set of big nodes as B = {v1, . . . , vB}. For each i ∈ {1, . . . , B}, we de- j=1 aj(v) for each i ∈ {1, . . . , B} and set A0(v) = 0. At any given point in time, we define N (v, HB) = {vi ∈ B : Ai−1(v) ≤ k + ηv < Ai(v) for some nonnegative integer k < cv}. Under this scheme, for every node vi ∈ B, we have Pr[vi ∈ N (v, HB)] = Ai(v) − Ai−1(v) = ai(v). Thus, we get Pr[vi ∈ N (v, HB)] = w(v, vi) for all vi ∈ N (v, EB), and Pr[vi ∈ N (v, HB)] = 0 for all vi 6= N (v, EB). Also note that deg(v, HB) ≤ ⌈Pvi∈N (v,EB) w(v, vi)⌉ ≤ ⌈Wv⌉ ≤ ⌈cv/(γ)⌉ ≤ cv. Hence, equations 40, 41 are satisfied. We maintain the sums {Ai(v)}, i, and the set N (v, HB) using a balanced binary tree data structure, as described below. We store the ordered sequence of B numbers a1(v), . . . , aB(v) in the leaves of a balanced binary tree from left to right. Let xi denote the leaf node that stores the value ai(v). Further, at each internal node x of the balanced binary tree, we store the sum Sx = Pi:xi∈T (x) ai(v), where T (x) denotes the set of nodes in the subtree rooted at x. This data structure can support the following operations. INCREMENT(i, δ): This asks us to set ai(v) ← ai(v) + δ, where δ is any real number. To perform this 24 update, we first change the value stored at the leaf node xi. Then starting from the node xi, we traverse up to the root of the tree. At each internal node x in this path from xi to the root, we set Sx ← Sx + δ. The Sx values at every other internal node remains unchanged. Since the tree has depth O(log n), the total time required to update the data structure is also O(log n). RETURN-INDEX(y): Given a number 0 ≤ y < cv, this asks us to return an index i (if it exists) such that Ai−1(v) ≤ y < Ai(v). We can answer this query in O(log n) time by doing binary search. Specifically, we perform the following operations. We initialize a counter C ← 0 and start our binary search at the root of the tree. At an intermediate stage of the binary search, we are at some internal node x and we know that y < C + Sx. Let x(l) and x(r) respectively be the left and right child of x. Note that Sx = Sx(l) + Sx(r). If y < C + Sx(l), then we move to the node x(l). Otherwise, we set C ← C + Sx(l) and move to the node x(r). We continue this process until we reach a leaf node, which gives us the required answer. The total time taken by the procedure is O(log n). We use the above data structure to maintain the sets N (v, HB), v ∈ S. Whenever the weight of an edge (u, v), v ∈ S, changes, we can update the set N (v, HB) by making one call to the INCREMENT(i, δ), and cv calls to RETURN-INDEX(y), one for each y = k + ηv, where k < cv is a nonnegative integer. Since cv = O(log n), the total time required is O(log2 n) per change in the edge-weights {w(e)}. Since each edge insertion/deletion in G, on average, leads to O(log n) changes in the edge-weights {w(e)}, the overall amortized update time for maintaining the edge-set HB is O(log3 n). Similar to the edge-sets E∗ and HS, we store the edge-set HB as a doubly linked list. Each edge (u, v) ∈ HB maintains a pointer to its position in this list. Each edge (u, v) ∈ E \HB sets the corresponding pointer to NULL. It is easy to check that this does not incur any additional overhead in the update time. This concludes the proof of the lemma. 5 Conclusion and Open Problems In this paper, we introduced a dynamic version of the primal-dual method. Applying this framework, we obtained the first nontrivial dynamic algorithms for the set cover and b-matching problems. Specifically, we presented a dynamic algorithm for set cover that maintains a O(f 2)-approximation in O(f · log(m + n)) update time, where f is the maximum frequency of an element, m is the number of sets and n is the number of elements. On the other hand, for the b-matching problem, we presented a dynamic algorithm that maintains a O(1)-approximation in O(log3 n) update time. Our work leaves several interesting open questions. We conclude the paper by stating a couple of such problems. • Recall that in the static setting the set cover problem admits O(min(f, log n))-approximation in O(f · (m + n))-time. Can we match this approximation guarantee in the dynamic setting in O(f · poly log(m + n)) update time? As a first step, it will be interesting to design a dynamic algorithm for fractional hypergraph b-matching that maintains a O(f )-approximation and has an update time of O(f · poly log(m + n)). • Are there other well known problems (such as facility location, Steiner tree etc.) that can be solved in the dynamic setting using the primal-dual framework? References [1] K. J. Ahn and S. Guha. Near linear time approximation schemes for uncapacitated and capacitated b-matching problems in nonbipartite graphs. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, pages 239 -- 258, 2014. 25 [2] R. Bar-Yehuda and S. Even. A linear time approximation algorithm for the weighted vertex cover problem. Journal of Algorithms, 2:198 -- 203, 1981. [3] S. Baswana, M. Gupta, and S. Sen. Fully dynamic maximal matching in O(log n) update time. In 52nd IEEE Symposium on Foundations of Computer Science, pages 383 -- 392, 2011. [4] S. Bhattacharya, M. Henzinger, and G. F. Italiano. Deterministic fully dynamic data structures for In Procs. 26th Annual ACM-SIAM Symposium on Discrete Algorithms vertex cover and matching. (SODA 2015), pages 785 -- 804, 2015. [5] N. Buchbinder and J. Naor. The design of competitive online algorithms via a primal-dual approach. Foundations and Trends in Theoretical Computer Science, 3(2-3):93 -- 263, 2009. [6] G. B. Dantzig, L. R. Ford, and D. R. Fulkerson. A primal-dual algorithm for linear programs. In H. W. Kuhn and A. W. Tucker, editors, Linear Inequalities and Related Systems, pages 171 -- 181. Princeton University Press, Princeton, NJ, 1956. [7] D. Eppstein, Z. Galil, and G. F. Italiano. Dynamic graph algorithms. In M. J. Atallah and M. Blanton, editors, Algorithms and Theory of Computation Handbook, 2nd Edition, Vol. 1, pages 9.1 -- 9.28. CRC Press, 2009. [8] U. Feige. A threshold of ln n for approximating set cover. Journal of the ACM, 45:634 -- 652, 1998. [9] H. N. Gabow. An efficient reduction technique for degree-constrained subgraph and bidirected network flow problems. In Proceedings of the 15th Annual ACM Symposium on Theory of Computing, 25-27 April, 1983, Boston, Massachusetts, USA, pages 448 -- 456, 1983. [10] M. Goemans and D. P. Williamson. A general approximation technique for constrained forest prob- lems. SIAM J. Comput., 24:296 -- 317, 1992. [11] M. X. Goemans and D. P. Williamson. The primal-dual method for approximation algorithms and its In D. S. Hochbaum, editor, Approximation algorithms for application to network design problems. NP-hard problems, pages 144 -- 191. PWS Publishing Company, 1997. [12] M. Gupta and R. Peng. Fully dynamic (1 + ǫ)-approximate matchings. In 54th IEEE Symposium on Foundations of Computer Science, pages 548 -- 557, 2013. [13] D. S. Johnson. Approximation algorithms for combinatorial problems. Journal of Computer and System Sciences, 9:256 -- 278, 1974. [14] S. Khot and O. Regev. Vertex cover might be hard to approximate to within 2− ǫ. Journal of Computer and System Sciences, 74, 2008. [15] S. Korman. On the Use of Randomization in the Online Set Cover Problem. Weizmann Institute of Science, 2004. [16] H. W. Kuhn. The Hungarian method for the assignment problem. Naval Research Logistics Quarterly, 2:83 -- 97, 1955. [17] O. Neiman and S. Solomon. Simple deterministic algorithms for fully dynamic maximal matching. In 45th ACM Symposium on Theory of Computing, pages 745 -- 754, 2013. [18] K. Onak and R. Rubinfeld. Maintaining a large matching and a small vertex cover. In 42nd ACM Symposium on Theory of Computing, pages 457 -- 464, 2010. [19] V. V. Vazirani. Approximation Algorithms. Springer-Verlag, New York, NY, USA, 2001. 26
1311.2542
4
1311
2015-08-25T21:08:59
Toward a unified theory of sparse dimensionality reduction in Euclidean space
[ "cs.DS", "cs.CG", "cs.IT", "cs.IT", "math.PR", "stat.ML" ]
Let $\Phi\in\mathbb{R}^{m\times n}$ be a sparse Johnson-Lindenstrauss transform [KN14] with $s$ non-zeroes per column. For a subset $T$ of the unit sphere, $\varepsilon\in(0,1/2)$ given, we study settings for $m,s$ required to ensure $$ \mathop{\mathbb{E}}_\Phi \sup_{x\in T} \left|\|\Phi x\|_2^2 - 1 \right| < \varepsilon , $$ i.e. so that $\Phi$ preserves the norm of every $x\in T$ simultaneously and multiplicatively up to $1+\varepsilon$. We introduce a new complexity parameter, which depends on the geometry of $T$, and show that it suffices to choose $s$ and $m$ such that this parameter is small. Our result is a sparse analog of Gordon's theorem, which was concerned with a dense $\Phi$ having i.i.d. Gaussian entries. We qualitatively unify several results related to the Johnson-Lindenstrauss lemma, subspace embeddings, and Fourier-based restricted isometries. Our work also implies new results in using the sparse Johnson-Lindenstrauss transform in numerical linear algebra, classical and model-based compressed sensing, manifold learning, and constrained least squares problems such as the Lasso.
cs.DS
cs
TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION IN EUCLIDEAN SPACE JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON Abstract. Let Φ ∈ Rm×n be a sparse Johnson-Lindenstrauss transform [KN14] with s non-zeroes per column. For a subset T of the unit sphere, ε ∈ (0, 1/2) given, we study settings for m, s required to ensure E Φ sup x∈T (cid:12) (cid:12)kΦxk2 2 − 1(cid:12) (cid:12) < ε, i.e. so that Φ preserves the norm of every x ∈ T simultaneously and mul- tiplicatively up to 1 + ε. We introduce a new complexity parameter, which depends on the geometry of T , and show that it suffices to choose s and m such that this parameter is small. Our result is a sparse analog of Gordon’s theo- rem, which was concerned with a dense Φ having i.i.d. Gaussian entries. We qualitatively unify several results related to the Johnson-Lindenstrauss lemma, subspace embeddings, and Fourier-based restricted isometries. Our work also implies new results in using the sparse Johnson-Lindenstrauss transform in nu- merical linear algebra, classical and model-based compressed sensing, manifold learning, and constrained least squares problems such as the Lasso. Contents Introduction 1. 1.1. Applications 2. Preliminaries 3. Overview of proof of main theorem 4. The case of a linear subspace 5. The type-2 case 5.1. Application to k-sparse vectors 6. Sketching constrained least squares programs 6.1. Unconstrained case 6.2. ℓ2,1-constrained case 7. Proof of the main theorem 8. Example applications of main theorem 8.1. Linear subspace 8.2. k-sparse vectors 8.3. Flat vectors 8.4. Finite collection of subspaces 8.5. Possibly infinite collection of subspaces 8.6. Manifolds 9. Discussion References Appendix A. Tools from probability theory Appendix B. Tools from convex analysis Appendix C. Sketching least squares programs with an FJLT 2 5 9 11 12 16 19 20 22 23 27 32 33 33 33 34 36 37 44 45 51 53 54 J.B. partially supported by NSF grant DMS-1301619. S.D. partially supported by SFB grant 1060 of the Deutsche Forschungsgemeinschaft (DFG). J.N. supported by NSF grant IIS-1447471 and CAREER award CCF-1350670, ONR grant N00014-14-1-0632, and a Google Faculty Research Award. Part of this work done while supported by NSF grants CCF-0832797 and DMS-1128155. 1 2 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON 1. Introduction Dimensionality reduction is a ubiquitous tool across a wide array of disciplines: machine learning [WDL+09], high-dimensional computational geometry [Ind01], privacy [BBDS12], compressed sensing [CT05], spectral graph theory [SS11], inte- rior point methods for linear programming [LS13], numerical linear algebra [Sar06], computational learning theory [BB05, BBV06], manifold learning [HWB07, Cla08], motif-finding in computational biology [BT02], astronomy [CM12], and several oth- ers. Across all these disciplines one is typically faced with data that is not only massive, but each data item itself is represented as a very high-dimensional vec- tor. For example, when learning spam classifiers a data point is an email, and it is represented as a high-dimensional vector indexed by dictionary words [WDL+09]. In astronomy a data point could be a star, represented as a vector of light intensi- ties measured over various points sampled in time [KZM02, VJ11]. Dimensionality reduction techniques in such applications provide the following benefits: • Smaller storage consumption. • Speedup during data analysis. • Cheaper signal acquisition. • Cheaper transmission of data across computing clusters. The technical guarantees required from a dimensionality reduction routine are application-specific, but typically such methods must reduce dimension while still preserving point geometry, e.g. inter-point distances and angles. That is, one has some point set X ⊂ Rn with n very large, and we would like a dimensionality- reducing map f : X → Rm, m ≪ n, such that ∀x, y ∈ X, (1 − ε)kx − yk ≤ kf (x) − f (y)k ≤ (1 + ε)kx − yk (1.1) for some norm k·k. Note also that for unit vectors x, y, cos(∠(x, y)) = (1/2)(kxk2 2 + kyk2 2), and thus f also preserves angles with additive error if it preserves Euclidean norms of points in X ∪ (X − X). above, is the Johnson-Lindenstrauss (JL) lemma [JL84]. 2 −kx− yk2 A powerful tool for achieving Eq. (1.1), used in nearly all the applications cited Theorem 1 (JL lemma). For any subset X of Euclidean space and 0 < ε < 1/2, 2 with m = O(ε−2 log X) providing Eq. (1.1) for k·k = k·k2. there exists f : X → ℓm This bound on m is nearly tight: for any n ≥ 1 Alon exhibited a point set X ⊂ ℓn 2 , X = n + 1, such that any such JL map f must have m = Ω(ε−2(log n)/ log(1/ε)) [Alo03]. In fact, all known proofs of the JL lemma provide linear f , and the JL lemma is tight up to a constant factor in m when f must be linear [LN14]. Un- fortunately, for actual applications such worst-case understanding is unsatisfying. Rather we could ask: if given a distortion parameter ε and point set X as input (or a succinct description of it if X is large or even infinite, as in some applications), what is the best target dimension m = m(X, ε) such that a JL map exists for X with this particular ε? That is, in practice we are more interested in moving beyond worst case analysis and being as efficient as possible for our particular data X. Unfortunately the previous question seems fairly difficult. For the related ques- tion of computing the optimal distortion for embedding X into a line (i.e. m = 1), it is computationally hard to approximate the optimal distortion even up to a mul- tiplicative factor polynomial in X [BCIS05]. In practice, however, typically f can- not be chosen arbitrarily as a function of X anyway. For example, when employing certain learning algorithms such as stochastic gradient descent on dimensionality- reduced data, it is at least required that f is differentiable on Rn (where X ⊂ Rn) [WDL+09]. For several applications it is also crucial that f is linear, e.g. in nu- merical linear algebra [Sar06] and compressed sensing [CT05, Don06]. In one-pass TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 3 streaming applications [CW09] and data structural problems such as nearest neigh- bor search [HIM12], it is further required that f is chosen randomly without know- ing X. For any particular X, a random f drawn from some distribution must satisfy the JL guarantee with good probability. In streaming applications this is because X is not fully known up front, but is gradually observed in a stream. In data structure applications this is because f must preserve distances to some future query points, which are not known at the time the data structure is constructed. Due to the considerations discussed, in practice typically f is chosen as a random linear map drawn from some distribution with a small number of parameters (in some cases simply the parameter m). For example, popular choices of f include a random matrix with independent Gaussian [HIM12] or Rademacher [Ach03] entries. While worst case bounds inform us how to set parameters to obtain the JL guarantee for worst case X, we typically can obtain better parameters by exploiting prior knowledge about X. Henceforth we only discuss linear f , so we write f (x) = Φx for Φ ∈ Rm×n. Furthermore by linearity, rather than preserving Euclidean distances in X it is equivalent to discuss preserving norms of all vectors in T = {(x−y)/kx−yk2 : x, y ∈ X} ⊂ Sn−1, the set of all normalized difference vectors amongst points in X. Thus up to changing ε by roughly a factor of 2, Eq. (1.1) is equivalent to sup x∈T(cid:12)(cid:12)(cid:12)kΦxk2 − 1(cid:12)(cid:12)(cid:12) < ε. x∈T(cid:12)(cid:12)(cid:12)kΦxk2 − 1(cid:12)(cid:12)(cid:12) < ε. sup E Φ (1.2) (1.3) Furthermore, since we consider Φ chosen at random, we more specifically want Instance-wise understanding for achieving Eq. (1.3) was first provided by Gordon [Gor88], who proved that a random Φ with i.i.d. Gaussian entries satisfies Eq. (1.3) as long as m & (g2(T ) + 1)/ε2, where we write A & B if A ≥ CB for a universal constant C > 0. Denoting by g a standard n-dimensional Gaussian vector, the parameter g(T ) is defined as the Gaussian mean width g(T ) def= E g sup x∈Thg, xi. One can think of g(T ) as describing the ℓ2-geometric complexity of T . It is always true that g2(T ) . log T, and thus Gordon’s theorem implies the JL lemma. In fact for all T we know from applications, such as for the restricted isometry property from compressed sensing [CT05] or subspace embeddings from numerical linear algebra [Sar06], the best bound on m is a corollary of Gordon’s theorem. Later works extended Gordon’s theorem to other distributions for Φ, such as Φ having independent subgaussian entries (e.g. Rademachers) [KM05, MPTJ07, Dir14]. Although Gordon’s theorem gives a good understanding for m in most scenar- ios, it suffers from the fact that it analyzes a dense random Φ, which means that performing the dimensionality reduction x 7→ Φx is dense matrix-vector multiplica- tion, and is thus slow. For example, in some numerical linear algebra applications (such as least squares regression [Sar06]), multiplying a dense unstructured Φ with the input turns out to be slower than obtaining the solution of the original, high- dimensional problem! In compressed sensing, certain iterative recovery algorithms such as CoSamp [NT09] and Iterative Hard Thresholding [BD08] involve repeated multiplications by Φ and Φ∗, the conjugate transpose of Φ, and thus Φ supporting fast matrix-vector multiply are desirable in such applications as well. The first work to provide Φ with small m supporting faster multiplication is the Fast Johnson-Lindenstrauss Transform (FJLT) of [AC09] for finite T . The value of m was still O(ε−2 log T), with the time to multiply Φx being O(n log n + m3). [AL09] later gave an improved construction with time O(n log n + m2+γ) for any 4 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON small constant γ > 0. Most recently several works gave nearly linear embedding time in n, independent of m, at the expense of increasing m by a (log n)c factor [AL13, KW11, NPW14]. In all these works Φ is the product of some number of very sparse matrices and Fourier matrices, with the speed coming from the Fast Fourier Transform (FFT) [CT65]. It is also known that this FFT-based approach can be used to obtain fast RIP matrices for compressed sensing [CT06, RV08, CGV13] and fast oblivious subspace embeddings for numerical linear algebra applications [Sar06] (see also [Tro11, LDFU13] for refined analyses in the latter case). Another line of work, initiated in [Ach03] and greatly advanced in [DKS10], sought fast embedding time by making Φ sparse. If Φ is drawn from a distribution over matrices having at most s non-zeroes per column, then Φx can be computed in time s · kxk0. After some initial improvements [KN10, BOR10], the best known achievable value of s to date for the JL lemma while still maintaining m . ε−2 log T is the sparse Johnson-Lindenstrauss Transform (SJLT) of [KN14], achieving s . ε−1 log T . εm. Furthermore, an example of a set T exists which requires this bound on s up to O(log(1/ε)) for any linear JL map [NN13b]. Note however that, again, this is an understanding of the worst-case parameter settings over all T . In summary, while Gordon’s theorem gives us a good understanding of instance- wise bounds on T for achieving good dimensionality reduction, it only does so for dense, slow Φ. Meanwhile, our understanding for efficient Φ, such as the SJLT with small s, has not moved beyond the worst case. In some very specific examples of T we do have good bounds for settings of s, m that suffice, such as T the unit norm vectors in a d-dimensional subspace [CW13, MM13, NN13a], or all elements of T having small ℓ∞ norm [Mat08, DKS10, KN10, BOR10]. However, our understand- ing for general T is non-existent. This brings us to the main question addressed in this work, where Sn−1 denotes the ℓ2-unit sphere {x ∈ Rn : kxk2 = 1}. Question 2. Let T ⊆ Sn−1 and Φ be the SJLT. What relationship must s, m satisfy, in terms of the geometry of T , to ensure (1.3)? We also note that while the FFT-based and sparse Φ approaches seem orthogonal at first glance, the two are actually connected, as pointed out before [AC09, Mat08, NPW14]. The FJLT sets Φ = SP where P is some random preconditioning matrix that makes T “nice” with high probability, and S is a random sparse matrix. We point out that although the SJLT is not the same as the matrix S typically used in the FFT-based literature, one could replace S with the SJLT and hope for similar algorithmic outcome if s is small: nearly linear embedding time. The answer to the analog of Question 2 for a standard Gaussian matrix depends only on the ℓ2-metric structure of T . Indeed, since both ℓ2-distances and Gaussian matrices are invariant under orthogonal transformations, so is (1.3) in this case. This is reflected in Gordon’s theorem, where the embedding dimension m is gov- erned by the Gaussian width, which is invariant under orthogonal transformations. We stress that in sharp contrast, a resolution of Question 2 cannot solely depend on the ℓ2-metric structure of T . Indeed, we require that Φ be sparse in a particu- lar basis and is therefore not invariant under orthogonal transformations. Thus an answer to Question 2 must be more nuanced (see our main theorem, Theorem 3). Our Main Contribution: We provide a general theorem which answers Ques- tion 2. Specifically, for every T ⊆ Sn−1 analyzed in previous work that we apply our general theorem to here, we either (1) qualitatively recover or improve the pre- vious best known result, or (2) prove the first non-trivial result for dimensionality reduction with sparse Φ. We say “qualitatively” since applying our general theorem to these applications loses a factor of logc(n/ε) in m and logc(n/ε)/ε in s. TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 5 In particular for (2), our work is the first to imply that non-trivially sparse dimensionality reducing linear maps can be applied for gain in model-based com- pressed sensing [BCDH10], manifold learning [TdSL00, DG13], and constrained least squares problems such as the popular Lasso [Tib96]. Specifically, we prove the following theorem. Theorem 3 (Main Theorem). Let T ⊂ Sn−1 and Φ be an SJLT with column sparsity s. Define the complexity parameter κ(T ) def= κs,m(T ) = max q≤ m s log sn 1 √qs(cid:16) E η(cid:16) E g sup x∈T n Xj=1 ηjgjxj(cid:17)q(cid:17)1/qo, where (gj) are i.i.d. standard Gaussian and (ηj ) i.i.d. Bernoulli with mean qs/(m log s). If m & (log m)3(log n)5 · s & (log m)6(log n)4 · (g2(T ) + 1) ε2 1 ε2 . Then (1.3) holds as long as s, m furthermore satisfy the condition (log m)2(log n)5/2κ(T ) < ε. (1.4) The complexity parameter κ(T ) may seem daunting at first, but Section 8 shows it can be controlled quite easily for all the T we have come across in applications. Our theorem implies s, m < ∗ log T suffices in general, and s < ∗ B if A ≤ B · ε−2(log n)c. A summary of our bounds is in Figure 1. 1.1. Applications. Here we describe various T and their importance in certain applications. Then we state the consequences that arise from our theorem. In order to highlight the qualitative understanding arising from our work, we introduce the notation A < Finite T: This is the setting T < ∞, for which the SJLT satisfies Eq. (1.3) with s . ε−1 log T, m . ε−2 log T [KN14]. If also T ⊂ Bℓn ∞(α), i.e. kxk∞ ≤ α for all x ∈ T , [Mat08] showed it is possible to achieve m . ε−2 log T with a Φ that has an expected O(ε−2(α log T)2) non-zeroes per column. ∗ 1 + (α log T)2, m < ∗ log T in the latter case, qualitatively matching the above. Linear subspace: Here T = {x ∈ E : kxk2 = 1} for some d-dimensional lin- ear subspace E ⊂ Rn, for which achieving Eq. (1.3) with m . d/ε2 is possible [AHK06, CW13]. A distribution satisfying Eq. (1.3) for any d-dimensional subspace E is known as an oblivious subspace embedding (OSE). The paper [Sar06] pioneered the use of OSE’s for speeding up approximate algorithms for numerical linear alge- bra problems such as low-rank approximation and least-squares regression. More applications have since been found to approximating leverage scores [DMIMW12], k-means clustering [BZMD11, CEM+14], canonical correlation analysis [ABTZ13], support vector machines [PBMID13], ℓp-regression [CDMI+13, WZ13], ridge re- gression [LDFU13], streaming approximation of eigenvalues [AN13], and speeding up interior point methods for linear programming [LS13]. In many of these appli- cations there is some input A ∈ Rn×d, n ≫ d, and the subspace E is for example the column space of A. Often an exact solution requires computing the singular value decomposition (SVD) of A, but using OSE’s the running time is reduced to that for computing ΦA, plus computing the SVD of the smaller matrix ΦA. The work [CW13] showed s = 1 with small m is sufficient, yielding algorithms for least squares regression and low-rank approximation whose running times are linear in the number of non-zero entries in A for sufficiently lopsided rectangular matrices. 6 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON ∗ 1 and m < Our theorem implies that s < ∗ d suffices to satisfy Eq. (1.3), which is qualitatively correct. Furthermore, a subset of our techniques reveals that if the maximum incoherence max1≤i≤n kPEeik2 is at most poly(ε/ log n), then s = 1 suffices (Theorem 5). This was not known in previous work. A random d- dimensional subspace has incoherencepd/n w.h.p. for d & log n by the JL lemma, and thus is very incoherent if n ≫ d. Closed convex cones: For A ∈ Rn×d, b ∈ Rn, and C ⊆ Rd a closed convex set, consider the constrained least squares problem of minimizing kAx − bk2 2 subject to x ∈ C. A popular choice is the Lasso [Tib96], in which the constraint set C = {x ∈ Rd : kxk1 ≤ R} encourages sparsity of x. Let x∗ be an optimal solution, and let TC(x) be the tangent cone of C at some point x ∈ Rd (see Appendix B for a definition). Suppose we wish to accelerate approximately solving the constrained least squares problem by instead computing a minimizer x of kΦAx− Φbk2 2 subject to x ∈ C. The work [PW14] showed that to guarantee kAx − bk2 2 ≤ (1 + ε)kAx∗ − bk2 2, it suffices that Φ satisfy two conditions, one of which is Eq. (1.2) for T = ATC(x∗) ∩ Sn−1. The paper [PW14] then analyzed dense random matrices for sketching constrained least squares problems. For example, for the Lasso if we are promised that the optimal solution x∗ is k-sparse, [PW14] shows that it suffices to set m & k log d, 1 ε2 max j=1,...,d 2 kAjk2 σ2 min,k where Aj is the jth column of A and σmin,k the smallest ℓ1-restricted eigenvalue of A: σmin,k = inf kyk2=1, kyk1≤2√k kAyk2. Our work also applies to such T (and we further show the SJLT with small s, m satisfies the second condition required for approximate constrained least squares; see Theorem 16). For example for the Lasso, we show that again it suffices that ∗ max but where we only require from s that j=1,...,d m > 2 kAjk2 σ2 min,k k log d A2 ij σ2 min,k k s > ∗ max 1≤i≤n 1≤j≤d That is, the sparsity of Φ need only depend on the largest entry in A as opposed to the largest column norm in A. The former can be much smaller. Unions of subspaces: Define T = ∪θ∈ΘEθ ∩ Sn−1, where Θ is some index set and each Eθ ⊂ Rn is a d-dimensional linear subspace. A case of particular interest is when θ ∈ Θ ranges over all k-subsets of {1, . . . , n}, and Eθ is the subspace spanned by {ej}j∈θ (so d = k). Then T is simply the set of all k-sparse unit vectors of unit def= {x ∈ Rn : kxk2 = 1,kxk0 ≤ k} for k · k0 denoting support Euclidean norm: Sn,k size. Φ satisfying (1.2) is then referred to as having the restricted isometry property (RIP) of order k with restricted isometry constant εk = ε [CT05]. Such Φ are known k k log(n/k), and furthermore it is known that ε2k < √2 − 1 to exist with m . ε−2 implies that any (approximately) k-sparse x ∈ Rn can be (approximately) recovered from Φx in polynomial time by solving a certain linear program [CT05, Can08]. Unfortunately it is known for ε = Θ(1) that any RIP matrix Φ with such small m must have s & m [NN13b]. Related is the case of vectors sparse in some other basis, i.e. T = {Dx ∈ Rn : kDxk2 = 1,kxk0 ≤ k} for some so-called “dictionary” D (i.e. the subspaces are acted on by D), or when T only allows for some subset TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 7 ∗ d+logΘ, s< ∗ log Θ or m< ∗ d+logΘ, s< Our main theorem also implies RIP matrices with s, m < of all (cid:0)n k(cid:1) sparsity patterns in model-based compressed sensing [BCDH10] (so that Θ <(cid:0)n k(cid:1)). ∗ k log(n/k). More gen- erally when a dictionary D is involved such that the subspaces span({Dej}j∈θ) are all α-incoherent (as defined above), the sparsity can be further improved to ∗ 1 + (αk log(n/k))2. That is, to satisfy the RIP with dictionaries yielding incoher- s < ent subspaces, we can keep m qualitatively the same while making s much smaller. For the general problem of unions of d-dimensional subspaces, our theorem implies ∗ 1+(α log Θ)2. Previ- one can either set m< ous work required m to depend on the product of d and (log Θ)c instead of the sum [NN13a], including a nice recent improvement by Cohen [Coh14], and is thus unsuit- ∗ k2 rows able for the application to the set of k-sparse vectors (RIP matrices with < are already attainable via simpler methods using incoherence; e.g. see [BDF+11, Proposition 1]). Iterative recovery algorithms such as CoSamp can also be used in model-based sparse recovery [BCDH10], which again involves multiplications by Φ, Φ∗, and thus sparse Φ is relevant for faster recovery. Our theorem thus shows, for the first time, that the benefit of model-based sparse recovery is not just a smaller m, but rather that the measurement matrix Φ can be made much sparser if the model is simple (i.e. Θ is small). For example, in the block-sparse model one wants to (approximately) recover a signal x ∈ Rn based on m linear measurements, where x is (approximately) k-block-sparse. That is, the n coordinates are partitioned into n/b blocks of size b each, and each block is either “on” (at least one coordinate in that block non-zero), or “off” (all non-zero). A k-block-sparse signal has at most k/b(cid:1)) . (k/b) log(n/k). Then k/b blocks on (thus kxk0 ≤ k). Thus s< as long as b = ω(log(n/k)), our results imply non-trivial column-sparsity s ≪ m. Ours is the first result yielding non-trivial sparsity in a model-RIP Φ for any model with a number of measurements qualitatively matching the optimal bound (which is on the order of m . k + (k/b) log(n/k) [ADR14]). We remark that for model- based RIP1, where one wants to approximately preserve ℓ1-norms of k-block-sparse vectors, which is useful for ℓ1/ℓ1 recovery, [IR13] have shown a much better spar- sity bound of O(⌈logb(n/k)⌉) non-zeroes per column in their measurement matrix. However, they have also shown that any model-based RIP1 matrix for block-sparse signals must satisfy the higher lower bound of m & k + (k/ log b) log(n/k) (which is tight). ∗ log Θ = log((cid:0)n/b Previous work also considered T = HSn,k, where H is any bounded orthonormal system, i.e. H ∈ Rn×n is orthogonal and maxi,j Hij = O(1/√n) (e.g. the Fourier matrix). Work of [CT06, RV08, CGV13] shows Φ can then be a sampling matrix (one non-zero per row) with m . ε−2k log(n)(log k)3. Since randomly flipping the signs of every column in an RIP matrix yields JL [KW11], this also gives a good implementation of an FJLT. Our theorem recovers a similar statement, but using the SJLT instead of a sampling matrix, where we show m < ∗ 1 suffice for ∗ k and s < orthogonal H satisfying the weaker requirement maxi,j Hij = O(1/√k). Smooth manifolds: Suppose we are given several images of a human face, but with varying lighting and angle of rotation. Or perhaps the input is many sample handwritten images of letters. In these examples, although input data is high- dimensional (n is the number of pixels), we imagine all possible inputs come from a set of low intrinsic dimension. That is, they lie on a d-dimensional manifold M ⊂ Rn where d ≪ n. The goal is then, given a large number of manifold examples, to learn the parameters of M to allow for nonlinear dimensionality reduction (reducing just to the few parameters of interest). This idea, and the first successful algorithm (ISOMAP) to learn a manifold from sampled points is due to [TdSL00]. Going back to the example of human faces, [TdSL00] shows that different images of a human 8 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON face can be well-represented by a 3-dimensional manifold, where the parameters are brightness, left-right angle of rotation, and up-down angle of rotation. Since [TdSL00], several more algorithms have been developed to handle more general classes of manifolds than ISOMAP [RS00, DG13]. ), for smooth F : Bℓd Baraniuk and Wakin [BW09] proposed using dimensionality-reducing maps to first map M to ΦM and then learn the parameters of interest in the reduced space (for improved speed). Sharper analyses were later given in [Cla08, EW13, Dir14]. Of interest are both that (1) any C1 curve in M should have length approximately preserved in ΦM, and (2) Φ should be a manifold embedding, in the sense that all C1 curves γ′ ∈ ΦM should satisfy that the preimage of γ′ (in M) is a C1 curve in M. Then by (1) and (2), geodesic distances are preserved by Φ. To be concrete, let M ⊂ Rn be a d-dimensional manifold obtained as the image 2 → Rn (BX is the unit ball of X). We assume M = F (Bℓd kF (x)−F (y)k2 ≃ kx−yk2 (where A ≃ B denotes that both A . B and A & B), and that the map sending x ∈ M to the tangent plane at x, Ex, is Lipschitz from dM to ρFin. Here ρM is geodesic distance on M, and ρFin(Ex, Ey) = kPEx − PEykℓn 2 →ℓn is the Finsler distance, where PE is the orthogonal projection onto E. We want Φ satisfying (1 − ε)γ ≤ Φ(γ) ≤ (1 + ε)γ for all C1 curves γ ⊂ M. Here · is curve length. To obtain this, it suffices that Φ satisfy Eq. (1.2) for T =Sx∈M Ex∩Sn−1 [Dir14], an infinite union of subspaces. Using this observation, [Dir14] showed this property is satisfied for s = m . d/ε2 with a dense matrix of subgaussian entries. For F as given above, preservation of geodesic distances is also satisfied for this m. 2 2 Our main theorem implies that to preserve curve lengths one can set m < ∗ d for ∗ 1 + (αd)2, where α is the largest incoherence of any tangent space Ex for x ∈ M. s < ∗ d is possible for any α ≪ 1/√d. Furthermore, That is, non-trivial sparsity with m < we show that this is optimal by constructing a manifold with maximum incoherence of a tangent space approximately 1/√d such that any linear map Φ preserving curve lengths with m > ∗ d (see Remark 20). We also show that Φ is a ∗ d, s > manifold embedding with large probability if the weaker condition m > ∗ 1 is satisfied. Combining these observations, we see that for the SJLT to preserve geodesic distances it suffices to set m < ∗ d must have s > ∗ d and s < ∗ 1 + (αd)2. As seen above, not only does our answer to Question 2 qualitatively explain all known results, but it gives new results not known before with implications in numerical linear algebra, compressed sensing (model-based, and with incoherent dictionaries), constrained least squares, and manifold learning. We also believe it is possible for future work to sharpen our analyses to give asymptotically correct parameters for all the applications; see the discussion in Section 9. We now end the introduction with an outline for the remainder. Section 2 defines the notation for the rest of the paper. Section 3 provides an overview of the proof of our main theorem, Theorem 3. Section 4 is a warmup that applies a subset of the proof ideas for Theorem 3 to the special case where T = E ∩ Sn−1, E a linear subspace of dimension d. In fact the proof of our main theorem reduces the case of general T to several linear subspaces of varying dimensions, and thus this case serves as a useful warmup. Section 5 applies a different subset of our proof ideas to the special case where the norm · T defined by yT = supx∈T hx, yi has a small type-2 constant, which is relevant for analyzing the FFT-based approaches to RIP matrices. Section 6 shows how similar ideas can be applied to constrained least squares problems, such as Lasso. Section 7 states and proves our most general theorem for arbitrary T . Section 8 shows how to apply Theorem 3 to obtain good TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 9 our m log T log T d k log(n/k) k log(n/k) 2 2 kAj k σ2 min,k maxj d + log Θ d + log Θ set T to preserve T < ∞ T < ∞, ∀x ∈ Tkxk∞ ≤ α E, dim(E) ≤ d Sn,k HSn,k tangent cone for Lasso Θ < ∞ Θ < ∞ ∀E ∈ Θ, dim(E) ≤ d ∀E ∈ Θ, dim(E) ≤ d max1≤j≤n E∈Θ kPE ejk2 ≤ α Θ infinite ∀E ∈ Θ, dim(E) ≤ d M a smooth manifold ⌈α log Θ⌉2 — see appendix d see appendix (non-trivial) 1 + (αd)2 similar to this work d previous m previous s ref our s log T ⌈α log T⌉2 k log(n/k) 1 k maxi,j 1 A 2 ij min,k σ2 log Θ log T log T d k log(n/k) k log(n/k) log T ⌈α log T⌉2 k log(n/k) 1 1 k same as here d · (log Θ)6 s = m (log Θ)3 [JL84] [Mat08] [NN13a] [CT05] [RV08] [PW14] [NN13a] — [Dir14] [Dir14] — m d Figure 1. The m, s that suffice when using the SJLT with vari- ous T as a consequence of our main theorem, compared with the best known bounds from previous work. All bounds shown hide poly(ε−1 log n) factors. One row is blank in previous work due to no non-trivial results being previously known. For the case of the Lasso, we assume k is the sparsity of the true optimal solution. bounds for various T , albeit losing a logc(n/ε) factor in m and a logc(n/ε)/ε factor in s as mentioned above. Finally, Section 9 discusses avenues for future work. In the appendix, in Appendix A for the benefit of the reader we review many probabilistic tools that are used throughout this work . Appendix B reviews some introductory material related to convex analysis, which is helpful for understanding Section 6 on constrained least squares problems. In Appendix C we also give a direct analysis for using the FJLT for sketching constrained least squares programs, providing quantitative benefits over some analyses in [PW14]. 2. Preliminaries We fix some notation that we will be used throughout this paper. For a positive integer t, we set [t] = {1, . . . , t}. For a, b ∈ R, a . b denotes a ≤ Cb for some universal constant C > 0, and a ≃ b signifies that both a . b and b . a hold. For any x ∈ Rn and 1 ≤ p ≤ ∞, we let kxkp denote its ℓp-norm. To any set S ⊂ Rn we associate a semi-norm · S defined by zS = supx∈S hz, xi. Note that zS = zconv(S), where conv(S) is the closed convex hull of S, i.e., the closure of the set of all convex combinations of elements in S. We use (ei)1≤i≤n and (eij )1≤i≤m,1≤j≤n to denote the standard basis in Rn and Rm×n, respectively. If η = (ηi)i≥1 is a sequence of random variables, we let (Ωη, Pη) denote the probability space on which it is defined. We use Eη and Lp η to denote the associated expected value and Lp-space, respectively. If ζ is another sequence of random variables, then k · kLp η-norm and afterwards the Lq ζ-norm. We reserve the symbol g to denote a sequence g = (gi)i≥1 of i.i.d. standard Gaussian random variables; unless stated otherwise, the covariance matrix is the identity. means that we first take the Lp η,Lq ζ If A is an m × n matrix, then we use kAk or kAkℓn 2 to denote its operator norm. Moreover we let Tr be the trace operator and use kAkF = (Tr(A∗A))1/2 to denote the Frobenius norm. If ρ cor- responds to a (semi-)norm k · kX , then we let ρX (x, y) = kx − ykX denote the In the remainder, we reserve the letter ρ to denote (semi-)metrics. 2 →ℓm 10 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON 2 is the Euclidean metric and dℓn associated (semi-)metric. Also, we use dρ(S) = supx,y∈S ρ(x, y) to denote the di- ameter of a set S with respect to ρ and write dX instead of dρX for brevity. So, for example, ρℓn 2 (S) the ℓ2-diameter of S. From here on, T is always a fixed subset of Sn−1 = {x ∈ Rn : kxk = 1}, and ε ∈ (0, 1/2) the parameter appearing in (1.3). We make use of chaining results in the remainder, so we define some relevant quantities. For a bounded set S ⊂ Rn, g(S) = Eg supx∈S hg, xi is the Gaussian mean width of S, where g ∈ Rn is a Gaussian vector with identity covariance matrix. For a (semi-)metric ρ on Rn, Talagrand’s γ2-functional is defined by γ2(S, ρ) = inf {Sr}∞ r=0 sup x∈S 2r/2 · ρ(x, Sr) (2.1) ∞Xr=0 where ρ(x, Sr) is the distance from x to Sr, and the infimum is taken over all collections {Sr}∞r=0, S0 ⊂ S1 ⊂ . . . ⊆ S, with S0 = 1,Sr ≤ 22r . If ρ corresponds to a (semi-)norm k · kX, then we usually write γ2(S,k · kX) instead of γ2(S, ρX ). It is known that for any bounded S ⊂ Rn, g(S) and γ2(S,k·k2) differ multiplicatively by at most a universal constant [Fer75, Tal05]. Whenever γ2 appears without a specified norm, we imply use of ℓ2 or ℓ2 → ℓ2 operator norm. We frequently use the entropy integral estimate (see [Tal05]) γ2(S, ρ) .Z ∞ 0 log1/2 N (S, ρ, u)du. (2.2) Here N (S, ρ, u) denotes the minimum number of ρ-balls of radius u centered at points in S required to cover S. If ρ corresponds to a (semi-)norm k · kX , then we write N (S,k · kX , u) instead of N (S, ρX , u). Let us now introduce the sparse Johnson-Lindenstrauss transform in detail. Let σij : Ωσ → {−1, 1} be independent Rademacher random variables, i.e., P(σij = 1) = P(σij = −1) = 1/2. We consider random variables δij : Ωδ → {0, 1} with the following properties: • For fixed j the δij are negatively correlated, i.e. Yt=1 ∀1 ≤ i1 < i2 < . . . < ik ≤ m, E(cid:16) k m(cid:17)k E δit,j =(cid:16) s Yt=1 • For any fixed j there are exactly s nonzero δij, i.e., Pm i=1 δij = s; • The vectors (δij)m i=1 are independent across different 1 ≤ j ≤ n. δit,j(cid:17) ≤ k ; (2.3) We emphasize that the σij and δij are independent, as they are defined on different probability spaces. The sparse Johnson-Lindenstrauss transform Φ with column sparsity s, or SJLT for short, is defined by 1 √s σij δij. Φij = (2.4) The work [KN14] gives two implementations of such a Φ satisfying the above con- ditions. In one example, the columns are independent, and in each column we choose exactly s locations uniformly at random, without replacement, to specify the δij. The other example is essentially the CountSketch of [CCFC04]. In this implementation, the rows of Φ are partitioned arbitrarily into s groups of size m/s each. Then each column of Φ is chosen independently, where in each column and for each block we pick a random row in that block to be non-zero for that column (the rest are zero). We say that Φ is an ε-restricted isometry on T if Eq. (1.2) holds. We define εΦ,T = sup x∈T kΦxk2 2 − 1 TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 11 sup σ A∈A(cid:12)(cid:12)(cid:12)kAσk2 as the restricted isometry constant of Φ on T . In the following we will be interested in estimating εΦ,T . For this purpose, we use the following Lp-bound for the supre- mum of a second order Rademacher chaos from [KMR14] (see [Dir15, Theorem 6.5] for the refinement stated here). Theorem 4. Let A ⊂ Rm×n and let σ1, . . . , σn be independent Rademacher random variables. For any 1 ≤ p < ∞ (cid:16) E 2 − EkAσk2 (2.5) For u ∈ Rn and v ∈ Rm, let u⊗ v : Rm → Rn be the operator (u⊗ v)w = hv, wiu.   ··· −x(δm,·)− 2 (A,k · kℓ2→ℓ2 ) + dF (A)γ2(A,k · kℓ2→ℓ2) + √pdF (A)dℓ2→ℓ2 (A) + pd2 Then, for any x ∈ Rn we can write Φx = Aδ,xσ, where  −x(δ1,·)−  ··· −x(δ2,·)− ··· δijxjei ⊗ eij = p(cid:17)1/p ℓ2→ℓ2 (A). Xj=1 Xi=1 2(cid:12)(cid:12)(cid:12) Aδ,x := 1 √s 1 √s 0 ... 0 . γ2 (2.6) 0 ... 0 0 0 ... m n . for x(δi,·) j = δijxj . Note that EkΦxk2 2 for all x ∈ Rn and therefore sup x∈T kΦxk2 2 − kxk2 2 = kxk2 x∈T kAδ,xσk2 2 = sup 2 − EkAδ,xσk2 2. Associated with δ = (δij) we define a random norm on Rn by 1≤i≤m(cid:16) n Xj=1 With this definition, we have for any x, y ∈ T , kxkδ = 1 √s max δijx2 j(cid:17)1/2 . (2.7) kAδ,x − Aδ,yk = kx − ykδ, kAδ,x − Aδ,ykF = kx − yk2. (2.8) Therefore, (2.5) implies that 2 − kxk2 . γ2 2 (T,k · kδ) + γ2(T,k · kδ) + √pdδ(T ) + pd2 δ(T ). (2.9) γp 2 (T,k · kδ))1/p Taking Lp(Ωδ)-norms on both sides yields (cid:16) E σ (cid:16) E δ,σ sup x∈T(cid:12)(cid:12)(cid:12)kΦxk2 x∈T(cid:12)(cid:12)(cid:12)kΦxk2 sup 2(cid:12)(cid:12)(cid:12) p(cid:17)1/p 2(cid:12)(cid:12)(cid:12) p(cid:17)1/p 2 − kxk2 . (E δ γ2p 2 (T,k · kδ))1/p + (E δ + √p(E dp δ (T ))1/p. (2.10) Thus, to find a bound for the expected value of the restricted isometry constant of Φ on T , it suffices to estimate Eδ γ2 δ(T ). If we can find good bounds on (Eδ γp δ (T ))1/p for all p ≥ 1, then we in addition obtain a high probability bound for the restricted isometry constant. Unless explicitly stated otherwise, from here on Φ always denotes the SJLT with 2 (T,k · kδ))1/p and (E dp 2 (T,k · kδ) and Eδ d2 δ (T ))1/p + p(E d2p s non-zeroes per column. 3. Overview of proof of main theorem Here we give an overview of the proof of Theorem 3. To illustrate the ideas going into our proof, it is simplest to first consider the case where T is the set of all unit 12 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON vectors in a d-dimensional linear subspace E ⊂ Rn. By Eq. (2.10) for p = 1 we have to bound for example Eδ γ2(T,k · kδ). Standard estimates give, up to log d, γ2(T,k · kδ) ≤ γ2(BE,k · kδ) ≪ sup t>0 t[log N (BE,k · kδ, t)]1/2. (3.1) for BE the unit ball of E. Let U ∈ Rn×d have columns forming an orthonormal basis for E. Then dual Sudakov minoration [BLM89, Proposition 4.2], [PTJ86] states that sup t>0 t[log N (BE,k · kδ, t)]1/2 ≤ E g kU gkδ (3.2) for a Gaussian vector g. From this point onward one can arrive at a result us- ing the non-commutative Khintchine inequality [LP86, LPP91] and other standard Gaussian concentration arguments (see appendix). Unfortunately, Eq. (3.2) is very specific to unit balls of linear subspaces and has no analog for a general set T . At this point we use a statement about the duality of entropy numbers [BPSTJ89, Proposition 4]. This is the principle that for two symmetric convex bodies K and D, N (K, D) and N (D◦, aK◦) are roughly comparable for some constant a (N (K, D) is the number of translates of D needed to cover K). Although it has been an open conjecture for over 40 years as to whether this holds in the general case [Pie72, p. 38], the work [BPSTJ89, Proposition 4] shows that these quantities are comparable up to logarithmic factors as well as a factor depending on the type-2 constant of the norm defined by D (i.e. the norm whose unit vectors are those on the boundary of D). In our case, this lets us relate i=1BJi ), · T ,√st/8), losing small factors. log N ( T ,k · kδ, t) with log N (conv(∪m Here T is the convex hull of T ∪ −T , and BJi is the unit ball of span{ej : δij = 1}. We next use Maurey’s lemma, which is a tool for bounding covering numbers of the set of convex combinations of vectors in various spaces. This lets us relate kPi∈A BJi ,·T , ǫ), log N (conv(∪m where A ⊂ [m] has size k . 1/ǫ2 (see Lemma 18). For a fixed A, we bucket j ∈ [n] according to Pi∈A δij and define Uα = {j ∈ [n] : Pi∈A δij ≃ 2α}. Abusing notation, we also let Uα denote the coordinate subspace spanned by j ∈ Uα. This leads to (see Eq. (7.11)) i=1BJi),·T , ǫ) to quantities of the form log N ( 1 log N(cid:16) 1 kXi∈A BJi, · T , ǫ(cid:17) .Xα log N(cid:16)BUα, · T ,r k 2α ǫ log m(cid:17) (3.3) Finally we are in a position to apply dual Sudakov minoration to the right hand side of Eq. (3.3), after which point we apply various concentration arguments to yield our main theorem. 4. The case of a linear subspace Let E ⊂ Rn be a d-dimensional linear subspace, T = E ∩ Sn−1, BE the unit ℓ2-ball of E. We use PE to denote the orthogonal projection onto E. The values kPEejk2, j = 1, . . . , n, are typically referred to as the leverage scores of E in the numerical linear algebra literature. We denote the maximum leverage score by which is sometimes referred to as the incoherence µ(E) of E. µ(E) = max 1≤j≤nkPEejk2, In our proof we make use of the well-known Gaussian concentration of Lipschitz functions [Pis86, Corollary 2.3]: if g is an n-dimensional standard Gaussian vector and φ : Rn → R is L-Lipschitz from ℓn 2 to R, then for all p ≥ 1 kφ(g) − E φ(g)kLp g . L√p. (4.1) TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 13 Theorem 5. For any p ≥ log m and any 0 < ǫ < 1, + (d + log m) log2(d/ǫ) (E γ2p 2 (T,k · kδ))1/p . ǫ2 + m p log2(d/ǫ) log m s µ(E)2 (4.2) and (E d2p δ (T ))1/p . d m + p s µ(E)2. As a consequence, if η ≤ 1/m and m & ((d + log m) min{log2(d/ε), log2(m)} + d log(η−1))/ε2 s & (log(m) log(η−1) min{log2(d/ε), log2(m)} + log2(η−1))µ(E)2/ε2 then Eq. (1.2) holds with probability at least 1 − η. Proof. By dual Sudakov minoration (Lemma 29 in Appendix A) (4.3) (4.4) log N (BE,k · kδ, t) . with U ∈ Rn×d having columns {fk}d k=1 forming an orthonormal basis for E and g a random Gaussian vector. Let U (i) be U but where each row j is multiplied by δij. Then by Eq. (2.7) and taking ℓ = log m, for all t > 0, t , Eg kU gkδ E g kU gkδ = = ≤ ≤ . d E g E g max max Xk=1 2i1/2 1≤i≤mh n δij(cid:12)(cid:12)(cid:12) Xj=1 1≤i≤mkU (i)gk2 1 √s 1 √s √s(cid:16) max 1 √s(cid:16) max √s(cid:16) max gk hfk, eji(cid:12)(cid:12)(cid:12) 1≤i≤m(cid:12)(cid:12)(cid:12)kU (i)gk2 − E g kU (i)gk2(cid:12)(cid:12)(cid:12)(cid:17) g kU (i)gk2 + E 1≤i≤m kU (i)kF +(cid:16) m g kU (i)gk2(cid:12)(cid:12)(cid:12) g(cid:12)(cid:12)(cid:12)kU (i)gk2 − E ℓ(cid:17)1/ℓ(cid:17) Xi=1 1≤i≤m kU (i)kF + √ℓ · max 2(cid:17) 1≤i≤mkU (i)kℓd 1≤i≤m 2→ℓn max 1 1 E E g (4.5) where Eq. (4.5) used Gaussian concentration of Lipschitz functions (cf. Eq. (4.1)), noting that g 7→ kU (i)gk2 is kU (i)k-Lipschitz. Since k · kδ ≤ (1/√s)k · k2, we can use for small t the bound (cf. Eq. (A.6)) log N (T,k · kδ, t) ≤ log N (BE,k · k2, t√s) (4.6) 2)1/2 for PE 2 j=1 δijkPEejk2 < d · log(cid:16)1 + t√s(cid:17) Using Eq. (4.6) for small t and noting kU (i)kF = (Pn the orthogonal projection onto E, Eq. (2.2) yields for t∗ = (ǫ/d)/ log(d/ǫ) γ2(T,k · kδ) .Z t∗ . √dt∗h log(cid:16) 1 dt +Z 1/√s √d ·h log(cid:16)2 + Eg kU gkδ t∗√s(cid:17)i1/2 t∗√s(cid:17) g kU gkδ log(cid:16) 1 1≤i≤mh n ·h max 2i1/2 Xj=1 δijkPEejk2 +plog m max t√s(cid:17)i1/2 log(d/ǫ) . ǫ + √s + E dt t∗ 1 t 0 1≤i≤mkU (i)kℓd 2→ℓn 2i (4.7) 14 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON As a consequence, (E δ γ2p 2 (T,k · kδ))1/p . ǫ2 + log2(d/ǫ) s We estimate the first non-trivial term on the right hand side. Since p ≥ log m, (cid:16) E δ max 1≤i≤mh n Xj=1 δijkPEejk2 2ip(cid:17)1/p 2(cid:17)1/pi (4.8) δ δ 2ip(cid:17)1/p max max 2→ℓn ℓd δijkPEejk2 1≤i≤mh n h(cid:16) E Xj=1 + log(m)(cid:16) E 1≤i≤mkU (i)k2p ≤(cid:16) m 2(cid:12)(cid:12)(cid:12) δ (cid:12)(cid:12)(cid:12) p(cid:17)1/p Xj=1 Xi=1 δijkPEejk2 δ h n 1≤i≤m(cid:16) E Xj=1 δijkPEejk2 ≤ e · max E n 2ip(cid:17)1/p Note that for fixed i, the (δij )1≤j≤n are i.i.d. variables of mean s/m and therefore E n Xj=1 δijkPEejk2 2 = s m n Xj=1 hPEej, eji = s m Tr(PE) = sd m . Let (rj )1≤j≤n be a vector of independent Rademachers. By symmetrization (Eq. (A.4)) and Khintchine’s inequality (Eq. (A.2)), n Xj=1 (cid:13)(cid:13)(cid:13) δijkPEejk2 δ ≤ 2(cid:13)(cid:13)(cid:13)Lp ≤ . ≤ ds m ds m ds m ds m n δ n 2(cid:13)(cid:13)(cid:13)Lp +(cid:13)(cid:13)(cid:13) Xj=1 (δij − E δij )kPEejk2 + 2(cid:13)(cid:13)(cid:13) Xj=1 rj δijkPEejk2 + √p(cid:13)(cid:13)(cid:13)(cid:16) n Xj=1 1≤j≤n kPEejk2 ·(cid:13)(cid:13)(cid:13) + √p · max 2(cid:13)(cid:13)(cid:13)Lp 2(cid:17)1/2(cid:13)(cid:13)(cid:13)Lp Xj=1 δijkPEejk4 δ,r n δ Solving this quadratic inequality yields δijkPEejk2 1/2 Lp δ 2(cid:13)(cid:13)(cid:13) We conclude that n (cid:13)(cid:13)(cid:13) Xj=1 1≤i≤mh n Xj=1 max (cid:16) E δ δijkPEejk2 . ds m + p · max 1≤j≤nkPEejk2 2 2(cid:13)(cid:13)(cid:13)Lp δ δijkPEejk2 2ip(cid:17)1/p . ds m + p max j kPEejk2 2 (4.9) (4.10) We now estimate the last term on the right hand side of Eq. (4.8). As p ≥ log m, (cid:16) E δ max 1≤i≤m kU (i)k2p ℓd 2→ℓn 2(cid:17)1/p If uj denotes the jth row of U , then . max 2(cid:17)1/p 1≤i≤m(cid:16) EkU (i)k2p 1≤i≤m(cid:16) Ek(U (i))∗U (i)kp ℓd 2→ℓn = max ℓd 2→ℓd . 2(cid:17)1/p (U (i))∗U (i) = δijuju∗j . n Xj=1 TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 15 By symmetrization and the non-commutative Khintchine inequality (cf. Eq. (A.3)), n Xj=1 (cid:13)(cid:13)(cid:13) δij uju∗j(cid:13)(cid:13)(cid:13)Lp δ ≤ ≤ . ≤ s m s m s m s m n δ n δ,r s m I(cid:13)(cid:13)(cid:13)Lp +(cid:13)(cid:13)(cid:13) Xj=1 δij uju∗j − rjδij uju∗j(cid:13)(cid:13)(cid:13)Lp + 2(cid:13)(cid:13)(cid:13) Xj=1 + √p(cid:13)(cid:13)(cid:13) 2uju∗j(cid:13)(cid:13)(cid:13) Xj=1 1≤j≤n kPEejk2 ·(cid:13)(cid:13)(cid:13) + √p max Xj=1 δijkujk2 n n 1/2 Lp/2 δ 1/2 Lp δ δijuju∗j(cid:13)(cid:13)(cid:13) Solving this quadratic inequality, we find and as a consequence, n δ s m . Xj=1 δijuju∗j(cid:13)(cid:13)(cid:13)Lp (cid:13)(cid:13)(cid:13) 2(cid:17)1/p 1≤i≤mkU (i)k2p ℓd 2→ℓn max (cid:16) E δ + p · max 1≤j≤nkPEejk2 2 . s m + p · max 1≤j≤n kPEejk2 2 Applying this estimate together with Eq. (4.10) in Eq. (4.8) yields the asserted estimate in Eq. (4.2). For the second assertion, note by Cauchy-Schwarz that dδ(T ) = = ≤ 1 √s 1 √s 1 √s sup sup δijx2 max 1≤i≤m max 1≤i≤m x∈Th n ji1/2 Xj=1 δij(cid:16) d x∈Th n hx, fkihfk, eji(cid:17)2i1/2 Xk=1 Xj=1 1≤i≤mh n 2i1/2 Xj=1 δijkPEejk2 s(cid:16) E 1≤i≤mh n Xj=1 2ip(cid:17)1/p δijkPEejk2 max max 1 . δ Therefore, (E δ d2p δ (T ))1/p ≤ and Eq. (4.3) immediately follows from Eq. (4.10). To prove the final assertion, we combine (2.10), Eq. (4.2) and Eq. (4.3) to obtain (cid:16) E δ,σ sup x∈T(cid:12)(cid:12)(cid:12)kΦxk2 − kxk2(cid:12)(cid:12)(cid:12) . ǫ2 + p(cid:17)1/p (d + log m) log2(d/ǫ) m + p log2(d/ǫ) log m s max 1≤j≤nkPEejk2 2 +hǫ2 + (d + log m) log2(d/ǫ) p log2(d/ǫ) log m + + + m p2 s pd m 1≤j≤n kPEejk2 2i1/2 1≤j≤n kPEejk2 Now apply Lemma 27 of Appendix A to obtain, for any w ≥ log m, Pδ,σ(cid:16)εΦ,T & ǫ2 + 1≤j≤nkPEejk2 1≤j≤n kPEejk2 (d + log m) log2(d/ǫ) 2 +h pd w log2(d/ǫ) log m p2 s max max max max m m + + s s 2 . 2i1/2 16 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON m + s max max w2 s w2 s + m + + (d + log m) log2(d/ǫ) w log2(d/ǫ) log m wd m +hǫ2 + max 1≤j≤nkPEejk2 2 +h wd 1≤j≤nkPEejk2 2i1/2 2i1/2(cid:17) ≤ e−w. Now set w = log(η−1), choose ǫ = ε/C (with C a large enough absolute constant) and ǫ = d/m, and use the assumptions on m and s to conclude P(εΦ,T ≥ ε) ≤ η. (cid:3) Theorem 5 recovers a similar result in [NN13a] but via a different method, less logarithmic factors in the setting of m, and the revelation that s can be taken smaller if all the leverage scores kPEejk2 are small (note if kPEejk2 ≪ (log d · log m)−1 for all j, we may take s = 1, though this is not true in general). Our dependence on 1/ε in s is quadratic instead of the linear dependence in [NN13a], but as stated earlier, in most applications of OSE’s ε is taken a constant. 1≤j≤n kPEejk2 Remark 6. As stated, one consequence of the above is we can set s = 1, and m to nearly linear in d as long as µ is at most inverse polylogarithmic in d. It is worth noting that if d & log n, then a random d-dimensional subspace E has µ(E) .pd/n by the JL lemma, and thus most subspaces do have even much lower coherence. Note that the latter bound is sharp. Indeed, let E be any d-dimensional subspace and let U ∈ Rn×d have orthonormal columns such that E is the column space of U . Then max v∈E,kvk2=1 max 1≤j≤nhv, eji F = d, is the maximum ℓ2 norm of a row uj of U . Since U has n rows and kUk2 there exists a j such that kujk2 ≥pd/n and in particular µ(E) ≥pd/n. It is also worth noting that [AMT10, Theorem 3.3] observed that if H ∈ Rn×n is a bounded orthonormal system (i.e. H is orthogonal and maxi,j Hij = O(1/√n), and D is a diagonal matrix with independent Rademacher entries, then HDE has incoherence µ . pd(log n)/n with probability 1 − 1/poly(n). They then showed that incoherence µ implies that a sampling matrix S ∈ Rm×n suffices to achieve Eq. (1.3) with m . nµ2 log m/ε2. Putting these two facts together implies SHD gives Eq. (1.3) with m . d(log n)(log m)/ε2. Eq. (4.4) combined with [AMT10, Theorem 3.3] implies a statement of a similar flavor but with an arguably stronger implication for applications: ΦHD with s = 1 satisfies Eq. (1.3) for T = E ∩ Sn−1 without increasing m as long as n & d(log(d/ε))c/ε2. 5. The type-2 case Recall that the type-2 constant T2(k · k) of a semi-norm k · k is defined as the best constant (if it exists) such that the inequality holds, for all finite systems of vectors {xα} and i.i.d. standard Gaussian (gα). Given T ⊂ Sn−1, define the semi-norm xT = sup E g(cid:13)(cid:13)(cid:13)Xα kxαk2(cid:17)1/2 gαxα(cid:13)(cid:13)(cid:13) ≤ T2(cid:16)Xα y∈T hx, yi (5.1) It will be convenient to use the following notation. For i = 1, . . . , m we let Ji be the set of ‘active’ indices, i.e., Ji = {j = 1, . . . , n : δij = 1}. We can then write kxkδ = 1 √s max 1≤i≤mkPJixk2, (5.2) where we abuse notation and let PJi denote orthogonal projection onto the coordi- nate subspace specified by Ji. T2(k · k)(log n)3(log m)1/2 g(cid:13)(cid:13)(cid:13) Xj=1 xjej : Xj∈Ji ×(cid:16) max BJi =nXj∈Ji x∈T(cid:16) n δijhx, eji2(cid:17)1/2 Xj=1 δij gjhx, eji(cid:12)(cid:12)(cid:12) g(cid:12)(cid:12)(cid:12) 2(cid:17)1/2 x∈T(cid:16) E Xj=1 δij gjejE(cid:12)(cid:12)(cid:12) ≤ g(cid:12)(cid:12)(cid:12)Dx, 1 Xj=1 √s sup x∈T sup sup E n n dδ(T ) = = . 1 √s 1 √s 1 √s max 1≤i≤m max 1≤i≤m max 1≤i≤m TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 17 Lemma 7. Let k·k be any semi-norm satisfying xT ≤ kxk for all x ∈ Rn. Then, γ2(T,k · kδ) . 1 √s n E gjδijej(cid:13)(cid:13)(cid:13) + (log m)1/2dk·k(cid:16) m [i=1 where T2(k · k) is the type-2 constant and for 1 ≤ i ≤ m, j ≤ 1o. 1≤i≤m x2 BJi(cid:17)(cid:17), Note also that dδ(T ) can be bounded as max 1≤i≤m n Xj=1 E g(cid:13)(cid:13)(cid:13) δijgjej(cid:13)(cid:13)(cid:13). (5.3) Remark 8. Replacing · T by a stronger norm k · k ≥ · T in this lemma may reduce the type-2 constant. The application to k-sparse vectors will illustrate this. Proof of Lemma 7. By Eq. (2.2), to bound γ2(T,k · kδ) it suffices to evaluate the covering numbers N (T,k · kδ, t) for t < d∗δ (T )/√s, where we set 1≤i≤mkPJixk2. d∗δ(T ) = √sdδ(T ) = sup x∈T max For large values of t we use duality for covering numbers. It will be convenient to work with T = conv(T ∪ (−T )), which is closed, bounded, convex and symmetric. Clearly, and in the notation of Appendix A, N (T,k · kδ, t) ≤ N ( T ,k · kδ, t) xT = sup y∈T∪{−T} hx, yi = sup y∈ T hx, yi = kxk T ◦. Here T ◦ denotes the polar (see Appendix B for a definition). Lemma 30, applied i=1{x ∈ Rn : s−1/2kPJixk2 ≤ 1}, ε = t and θ = d∗δ(T )/√s, with U = T , V = ∩m implies d∗δ (T ) conv(cid:16) m [i=1 where A . T2(k · kδ)2 . log m (by (5.2)) and we used that t√s (cid:17)A log N(cid:16) 1 BJi(cid:17), · T , √s j ≤ 1o = {x ∈ Rn : kPJixk2 ≤ 1}◦. log N ( T ,k · kδ, t) ≤(cid:16) log xjej : Xj∈Ji BJi =nXj∈Ji x2 Hence, t 8(cid:17) log N ( T ,k · kδ, t) .(cid:16) log d∗δ(T ) t√s (cid:17)(log m) log N(cid:16)conv(cid:16) m [i=1 BJi(cid:17),k · k, 1 8 √st(cid:17) (5.4) To estimate the right hand side we use the following consequence of Maurey’s lemma (Lemma 31 of Appendix A). 18 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON Claim 9. Fix 0 < R < ∞. Let k · k be a semi-norm on Rn and Ω ⊂ {x ∈ Rn : kxk ≤ R}. Then for 0 < ǫ < R, ǫ[log N (conv(Ω),k · k, ǫ)]1/2 .(cid:16) log ǫ′[log N (Ω,k · k, ǫ′)]1/2 (5.5) T2(k · k) max ǫ≤ǫ′≤R ǫ(cid:17)3/2 R Proof. It suffices to prove the result for R = 1, the general case then follows by considering R−1Ω. For each positive integer k, let Ωk ⊂ Ω be a finite set satisfying Ωk ≤ N (Ω,k · k, 2−k) inf y∈Ωk kx − yk < 2−k for all x ∈ Ω and with (5.6) (5.7) It follows from Eq. (5.6) that Given x ∈ Ω, denote xk ∈ Ωk a sequence s.t. kx−xkk < 2−k. Then, setting y0 = x0, yk = xk − xk−1, we obtain yk ∈ Ωk − Ωk−1 and kykk < 2−k + 2−k+1 = 3 · 2−k conv( Ωk) + Bk·k(0, ǫ) yk(cid:13)(cid:13)(cid:13) < ǫ (cid:13)(cid:13)(cid:13)x − Xǫ/2<2−k≤1 conv(Ω) ⊂ Xǫ/2<2−k≤1 Ωk =ny ∈ Ωk − Ωk−1 : kyk < 3 · 2−ko (y1 + . . . + yℓk )(cid:13)(cid:13)(cid:13) . T2(k · k) (cid:13)(cid:13)(cid:13)z − (5.8) By Maurey’s lemma, given z ∈ conv( Ωk) and a positive integer ℓk, there are points y1, . . . , yℓ ∈ Ωk such that 1 ℓk √ℓk · 3 · 2−k (5.9) 1 Taking ℓk ≃ T2(k·k)24−kǫ−2 log2(1/ǫ), we obtain a point zk ∈ Ω′k = 1 such that ℓk ( Ωk+. . .+ Ωk) Moreover kz − zkk < ǫ 2 log(1/ǫ) log Ω′k ≤ ℓk log Ωk . T2(k · k)24−kǫ−2 log2(1/ǫ) logN (Ω,k · k, 2−k) Since {k : ǫ/2 < 2−k ≤ 1} ≤ log(2/ǫ), we obtain from the preceding, log N (conv(Ω),k · k, ǫ) . log2(1/ǫ)T2(k · k)2ǫ−2 Xǫ/2<2−k≤1 4−k log N (Ω,k · k, 2−k) and Eq. (5.5) follows. This proves the claim. (cid:3) Observe that d∗δ(T ) = sup x∈T = sup x∈T max 1≤i≤mkPJixk2 2 max 1≤i≤mhx, PJi yi = d·T(cid:16) m [i=1 BJi(cid:17) sup y∈Bℓn i=1BJi) for brevity. Applying Claim 9 with Ω = ∪m BJi(cid:17) ≤ dk·k(cid:16) m [i=1 Write dk·k := dk·k(∪m ǫ = t√s, and the dominating semi-norm k · k ≥ · T to the right hand side of Eq. (5.4), we find t√sh log N ( T ,k · kδ, t)i1/2 (log m)1/2T2(k · k)· ≤(cid:16) log t√s(cid:17)2 i=1BJi , dk·k TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 19 Using the dual Sudakov inequality (Lemma 29 of Appendix A) we arrive at BJi ,k · k, t′(cid:17)i1/2i. (5.10) 1 ≤ dk·k h max t√s≤t′≤dk·k h log N ( T ,k · kδ, t)i1/2 t′h log N(cid:16) m [i=1 t√s(cid:17)2 g(cid:13)(cid:13)(cid:13)Xj∈Ji N (T,k · kδ, t) ≤ N (dδ(T )Bk·kδ ,k · kδ, t) ≤(cid:16)1 + t√s(cid:16) log h max 1≤i≤m E (log m)1/2T2(k · k)· gjej(cid:13)(cid:13)(cid:13) + dk·k(log m)1/2i. ≤(cid:16)1 + t√s (cid:17)n 2d∗δ(T ) We now apply Eq. (5.11) for (sn)−1/2dk·k ≤ t < s−1/2dk·k and the estimate (cf. Eq. (A.6)) (5.11) 2dk·k t√s (cid:17)n for 0 < t < (sn)−1/2dk·k, respectively, in Eq. (2.2). A straightforward computation, similar to Eq. (4.7), yields the result. (cid:3) 5.1. Application to k-sparse vectors. Let kxk0 denote the number of non-zero entries of x and set Sn,k = {x ∈ Rn : kxk2 = 1,kxk0 ≤ k}. Theorem 10. Let A ∈ Rn×n be orthogonal and denote T = A(Sn,k) Let η ≤ 1/m. If and maxAij < (k log n)−1/2 m & k(log n)8(log m)/ε2 s & (log n)7(log m)(log η−1)/ε2, (5.12) (5.13) then with probability at least 1 − η we have 2 ≤ kΦxk2 (1 − ε)kxk2 2 ≤ (1 + ε)kxk2 2 Proof. We apply Eq. (2.10) and estimate (Eδ γ2p δ (T ) for p ≥ log m. We trivially estimate Eδ d2p δ (T ) ≤ 1/s. To bound the γ2-functional, note that T ⊂ K, where 2 ∩ K = Bℓn 2 (T,k · kδ))1/p and Eδ d2p for all x ∈ T. √kA(Bℓn 1 ). (5.14) The polar body of K is given by K◦ = Bℓn 2 + A(Bℓn ∞ ) 1 √k and one can readily calculate that T2( · K ) . √log n and d·K (∪m We apply Lemma 7 with k · k = · K. Note that for every 1 ≤ i ≤ m, g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Xj 1≤ℓ≤n(cid:16)Xj gjδijAjℓ(cid:12)(cid:12)(cid:12) ≤pk log n max √k E E g max 1≤ℓ≤n(cid:12)(cid:12)(cid:12)Xj gjδijek(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)K ≤ (log n)7/2 log m +r k and therefore the lemma implies that γ2(T,k · kδ) 1 √s ≤ s (log n)4(log m)1/2 i=1BJi) ≤ 1. jℓ(cid:17)1/2 δijA2 max 1≤i≤m,1≤ℓ≤n(cid:16)Xj δijA2 jℓ(cid:17)1/2 . 20 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON As a consequence, as p ≥ log m, (E δ γ2p 2 (T,k · kδ))1/p 1 ≤ s (log n)7(log m)2 + k s (log n)8(log m) max 1≤i≤m(cid:16) E δ max 1≤ℓ≤n(cid:16)Xj δij A2 jℓ(cid:17)p(cid:17)1/p . (5.15) Since E δij = s/m and A is orthogonal, we obtain using symmetrization and Khint- chine’s inequality, By solving this quadratic inequality, we find (cid:16) E δ max s m δijA2 1≤ℓ≤n(cid:16)Xj +(cid:16) E ≤ + √p(cid:16) E + √p max s m ≤ r s m ≤ δ E δ max max jℓ(cid:17)p(cid:17)1/p 1≤ℓ≤n(cid:16)Xj 1≤ℓ≤n(cid:16)Xj j,ℓ Ajℓ(cid:16) E jℓ(cid:17)p(cid:17)1/p 2(cid:12)(cid:12)(cid:12) p(cid:17)1/p s m . δ k m (cid:16) E δ,σ . δijA2 δ sup max 1≤ℓ≤n(cid:16)Xj (cid:16) E x∈T(cid:12)(cid:12)(cid:12)kΦxk2 +(cid:16) 1 1 s s 2 − kxk2 (log n)7(log m)2 + (log n)7(log m)2 + +r p s + p s . Combine this bound with Eq. (5.15) and Eq. (2.10) to arrive at rjδij A2 δijA4 jℓ(cid:17)p(cid:17)1/p jℓ(cid:17)p/2(cid:17)1/p max 1≤ℓ≤n(cid:16)Xj δijA2 jℓ(cid:17)p(cid:17)1/(2p) . + p max j,ℓ A2 jℓ ≤ s m + p k log n . (log n)8(log m) + p s (log n)7(log m) k m (log n)8(log m) + p s (log n)7(log m)(cid:17)1/2 Since p ≥ log m was arbitrary, the result now follows from Lemma 27. 6. Sketching constrained least squares programs (cid:3) Let us now apply the previous results to constrained least squares minimization. We refer to Appendix B for any unexplained terminology. Consider A ∈ Rn×d and a sketching matrix Φ ∈ Rm×n. Define f (x) = kAx − bk2 2 and g(x) = kΦAx − Φbk2 2. Let C ⊂ Rd be any closed convex set. Let x∗ be a minimizer of the constrained least squares program and let x be a minimizer of the associated sketched program min f (x) subject to min g(x) subject to x ∈ C x ∈ C. (6.1) (6.2) Before giving our analysis, we define two quantities introduced in [PW14]. Given K ⊂ Rd and u ∈ Sn−1 we set Z1(A, Φ,K) = Z2(A, Φ,K, u) = 2 inf v∈AK∩Sn−1 kΦvk2 v∈AK∩Sn−1 hΦu, Φvi − hu, vi. sup TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 21 We denote the tangent cone of C at a point x by TC(x) (see Appendix B for a definition). The first statement in the following lemma is [PW14, Lemma 1]. For the convenience of the reader we provide a proof, which is in essence the same as in [PW14], with the second case (when x∗ is a global minimizer) being a slight modification of the proof there. In what follows we assume Ax∗ 6= b, since otherwise f (x) = f (x∗) = 0. Lemma 11. Define u = (Ax∗ − b)/kAx∗ − bk2 and set Z1 = Z1(A, Φ, TC(x∗)) and Z2 = Z2(A, Φ, TC(x∗), u). Then, If x∗ is a global minimizer of f , then f (x) ≤(cid:16)1 + f (x) ≤(cid:16)1 + Z2 f (x∗). Z1(cid:17)2 1(cid:17)f (x∗). Z 2 2 Z 2 Proof. Set e = x − x∗ ∈ TC(x∗) and w = b − Ax∗. By optimality of x∗, for any x ∈ C, kAek2E ≤ Z2. (6.3) h∇f (x∗), x − x∗i = hAx∗ − b, A(x − x∗)i ≥ 0. In particular, taking x = x gives hw, Aei ≤ 0. As a consequence, kAek2 E ≤D w Ae kwk2 By optimality of x, for any x ∈ C, h∇g(x), x − xi = hΦAx − Φb, ΦA(x − x)i ≥ 0. kAek2 E −D w kwk2 D w kwk2 Φ∗ΦAe Φ∗ΦAe , , , Taking x = x∗ yields 0 ≥ hΦAx − Φb, ΦAei = h−Φw, ΦAei + kΦAek2 2. Therefore, by (6.3), Z1kAek2 2 ≤ kΦAek2 2 ≤ hΦw, ΦAei ≤ Z2kwk2kAek2. In other words, and by Cauchy-Schwarz, kAek2 ≤ Z2 Z1kwk2 kAx − bk2 2 = kwk2 2 + kAek2 2 − 2hw, Aei ≤ kwk2 2(cid:16)1 + . Z2 Z1(cid:17)2 If x∗ is a global minimizer of f , then ∇f (x∗) = 0 and therefore hw, Aei = 0 (a similar observation to [Sar06, Theorem 12]). This yields the second assertion. (cid:3) Clearly, if Φ satisfies (1.2) for T = ATC(x∗) ∩ Sn−1 then Z1 ≥ 1 − ε. We do not immediately obtain an upper bound for Z2, however, as u is in general not in ATC(x∗) ∩ Sn−1. We mend this using the observation in Lemma 13. For its proof we recall a chaining result from [Dir15]. Let (T, ρ) be a semi-metric space. Recall that a real-valued process (Xt)t∈T is called subgaussian if for all s, t ∈ T , P(Xt − Xs ≥ wρ(t, s)) ≤ 2 exp(−w2) (w ≥ 0). The following result is a special case of [Dir15, Theorem 3.2]. Lemma 12. If (Xt)t∈T is subgaussian, then for any t0 ∈ T and 1 ≤ p < ∞, t∈T Xt − Xt0p(cid:17)1/p (cid:16) E sup . γ2(T, ρ) + √pdρ(T ). 22 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON In particular, if T contains n elements, then t∈T Xt − Xt0p(cid:17)1/p (cid:16) E sup Lemma 13. Fix u ∈ Bℓn . (√p + (log n)1/2)dρ(T ). 2 , T ⊂ Rn and let Φ be the SJLT. Set Z = sup v∈T hΦu, Φvi − hu, vi. For any p ≥ 1, ( E δ,σ Z p)1/p .(cid:16)r p s + 1(cid:17)(cid:16)(E δ 2 (T,k · kδ))1/p + √p(E γp δ dp δ (T ))1/p(cid:17). Proof. With the notation (2.6) we have Φx = Aδ,xσ for any x ∈ Rn. Since Eσ Φ∗Φ = I we find Z = sup v∈T hu, (Φ∗Φ − I)vi = sup v∈T σ∗A∗δ,uAδ,vσ − E σ (σ∗A∗δ,uAδ,vσ). Let σ′ be an independent copy of σ. By decoupling (see (A.5)), (E σ Z p)1/p ≤ 4( E σ,σ′ sup v∈T σ∗A∗δ,uAδ,vσ′p)1/p. For any v1, v2 ∈ T , Hoeffding’s inequality implies that for all w ≥ 0 Pσ′ (σ∗A∗δ,uAδ,v1σ′ − σ∗A∗δ,uAδ,v2σ′ ≥ √wkσ∗A∗δ,uk2 kAδ,v1 − Aδ,v2kℓ2→ℓ2) ≤ 2e−w and therefore v 7→ σ∗A∗δ,uAδ,vσ′ is a subgaussian process. By Lemma 12 (and (2.8)), Taking the Lp(Ωσ)-norm on both sides and using Lemma 28 of Appendix A we find Z p)1/p . (E (E σ (E σ′ sup v∈T σ∗A∗δ,uAδ,vσ′p)1/p . kAδ,uσk2γ2(T,k · kδ) + √pkAδ,uσk2dδ(T ). 2)1/p(cid:16)γ2(T,k · kδ) + √pdδ(T )(cid:17) σ kAδ,uσkp . (√pkAδ,uk + kAδ,ukF )(cid:16)γ2(T,k · kδ) + √pdδ(T )(cid:17) ≤(cid:16)r p + 1(cid:17)(cid:16)γ2(T,k · kδ) + √pdδ(T )(cid:17). s Now take the Lp(Ωδ)-norm on both sides to obtain the result. (cid:3) 6.1. Unconstrained case. We first consider unconstrained least squares mini- mization, i.e., the constraint set is C = Rd. Theorem 14. Let Col(A) be the column space of A and let µ(A) = max 1≤j≤nkPCol(A)ejk2 be its largest leverage score. Set C = Rd and let x∗ and x be minimizers of (6.1) and (6.2), respectively. Let r(A) be the rank of A. Suppose that m & ε−1((log η−1)(r(A) + log m)(log m)2 + (log η−1)2r(A)) s & ε−1µ(A)2((log η−1)2 + (log η−1)(log m)3) + ε−1/2µ(A)((log η−1)3/2 + (log η−1)(log m)3/2) and η ≤ 1 m . Then, with probability at least 1 − η, f (x) ≤ (1 − ε)−2f (x∗). (6.4) TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 23 + √s µ(A)i. Proof. Set Z1 = Z1(A, Φ, TC(x∗)) and Z2 = Z2(A, Φ, TC(x∗), u). Observe that TC(x∗) = Rd. Applying Theorem 5 for the r(A)-dimensional subspace E = Col(A) immediately yields that Z1 ≥ 1 − √ε with probability at least 1 − η. Setting T = ATC(x∗) ∩ Sn−1 = Col(A) ∩ Sn−1 in Lemma 13 and subsequently using (4.2) and (4.3) yields, for any p ≥ log(m), + 1(cid:17)(cid:16)(E 2 (T,k · kδ))1/p + √p(E γp + 1(cid:17)h (pr(A) + log1/2(m)) log(m) 2 )1/p .(cid:16)r p .(cid:16)r p √m ( E δ,σ Z p dp s s δ δ √p log3/2(m) δ (T ))1/p(cid:17) +r pr(A) p √s µ(A) + m Applying Lemma 27 (and setting w = log(η−1) in (A.1)) shows that Z2 ≤ √ε with probability at least 1 − η. The second statement in Lemma 11 now implies that with probability at least 1 − 2η, f (x) ≤(cid:16)1 + (1 − √ε)2(cid:17)f (x∗) ≤ (1 − ε)−2f (x∗). ε To see the last inequality, note that it is equivalent to −ε + 4ε3/2 − 3ε2 − 2ε5/2 + 2ε3 ≤ 0. Clearly this is satisfied for ε small enough (since then −ε is the leading term). In fact, one can verify by calculus that this holds for ε ≤ 1/10, which we may assume without loss of generality. (cid:3) If Φ is a full random sign matrix (i.e., s = m) then it follows from our proof that (6.4) holds with probability at least 1 − η if m & ε−1(r(A) + log(η−1)). This bound on m is new, and was also recently shown in [Woo14]. Previous works [Sar06, KN14] allowed either m & ε−2(r(A) + log(η−1)) or m & ε−1r(A) log(η−1). Theorem 14 substantially improves s while maintaining m up to logarithmic factors. 6.2. ℓ2,1-constrained case. Throughout this section, we set d = bD. For x = (xB1 , . . . , xBb ) ∈ Rd consisting of b blocks, each of dimension D, we define its ℓ2,1-norm by kxk2,1 := kxkℓb 2 ) = 1(ℓD The corresponding dual norm is kxk2,∞ := kxkℓb 2 ) = max ∞(ℓD b kxBℓk2. Xℓ=1 1≤ℓ≤bkxBℓk2. (6.5) In this section we study the effect of sketching on the ℓ2,1-constrained least squares program 2 min kAx − bk2 subject to which is Eq. (6.1) for C = {x ∈ Rd : kxk2,1 ≤ R}. In the statistics literature, this is called the group Lasso (with non-overlapping groups of equal size). The ℓ2,1-constraint encourages a block sparse solution, i.e., a solution which has few blocks containing non-zero entries. We refer to e.g. [BvdG11] for more information. In the special case D = 1 the program reduces to kxk2,1 ≤ R, minkAx − bk2 2 subject to kxk1 ≤ R, which is the well-known Lasso [Tib96]. 24 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON To formulate our results we consider two norms on Rn×d, given by and A := max 1≤ℓ≤b(cid:16) n kAkℓ2,1→ℓ∞ = max 1≤j≤n Ajk2(cid:17)1/2 Xj=1 Xk∈Bℓ 1≤ℓ≤bk(Ajk)k∈Bℓk2. max (6.6) Lemma 15. Let A ∈ Rn×d and consider any set K ⊂ Rd. If p ≥ log m, then (E δ γ2p 2 (AK ∩ Sn−1,k · kδ))1/p . αh x∈K : kAxk2=1kxk2 sup where α = (log n)6(log m)2(log b)2. 2,1i(cid:16) 1 s (log b + p)kAk2 ℓ2,1→ℓ∞ + 1 mA2(cid:17). Proof. We deduce the assertion from Lemma 7. By Holder’s inequality, sup y∈AK∩Sn−1hx, yi = sup v∈K : kAvk2=1hA∗x, vi ≤ kA∗xk2,∞ sup v∈K : kAvk2=1kvk2,1. We define kxk to be the expression on the right hand side. Observe that for any sequence (xk)k≥1 in Rn, E max = E g g(cid:13)(cid:13)(cid:13)Xk≥1 gkA∗xk(cid:13)(cid:13)(cid:13)2,∞ gk(A∗xk)Bℓ(cid:13)(cid:13)(cid:13)2 1≤ℓ≤b(cid:16)Xk≥1 k(A∗xk)Bℓk2 2,∞(cid:17)1/2 kA∗xkk2 1≤ℓ≤b(cid:13)(cid:13)(cid:13)Xk≥1 ≤ (log b)1/2 max ≤ (log b)1/2(cid:16)Xk≥1 and therefore T2(k · k) ≤ (log b)1/2. Similarly, 1≤ℓ≤b(cid:13)(cid:13)(cid:13)(cid:16) n gjδijAjk(cid:17)k∈Bℓ(cid:13)(cid:13)(cid:13)2 Xj=1 1≤ℓ≤b(cid:16) n Xj=1 ≤ (log b)1/2 max gjδijA∗ej(cid:13)(cid:13)(cid:13)2,∞ δijk(Ajk)k∈Bℓk2 g(cid:13)(cid:13)(cid:13) Xj=1 = E g max E n 2(cid:17)1/2 Finally, . (6.7) 2(cid:17)1/2 sup x∈BJi kA∗xk2,∞ and for any 1 ≤ i ≤ m and x ∈ BJi, kA∗xk2,∞ = max sup BJi(cid:17) = v∈K : kAvk2=1kvk2,1 max 1≤i≤m dk·k(cid:16) m [i=1 1≤ℓ≤b(cid:13)(cid:13)(cid:13) Xj=1 Xj=1 xj δijk(Ajk)k∈Bℓk2 ≤ max xj δij(Ajk)k∈Bℓ(cid:13)(cid:13)(cid:13)2 ≤ max 1≤ℓ≤b n n 2(cid:17)1/2 We now apply Lemma 7 for T = AK ∩ Sn−1 and subsequently take Lp(Ωδ)-norms to conclude that for any p ≥ log m, δijk(Ajk)k∈Bℓk2 1≤ℓ≤b(cid:16) n Xj=1 . (E γ2p 2 (AK ∩ Sn−1,k · kδ))1/p TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 25 . α sh sup x∈K : kAxk2=1kxk2 2,1i max 1≤i≤m(cid:16) E δ max 1≤ℓ≤b(cid:16) n Xj=1 δijk(Ajk)k∈Bℓk2 2(cid:17)p(cid:17)1/p . (6.8) Since E δij = s metrization (see Eq. (A.4)) for (rj) a vector of independent Rademachers j=1 is independent for any fixed i, we obtain by sym- m and (δij )n By Khintchine’s inequality, E r max 1≤ℓ≤b(cid:16) n Xj=1 rjδijk(Ajk)k∈Bℓk2 2(cid:17)p(cid:17)1/p . (cid:16) E δ max 1≤ℓ≤b(cid:16) n Xj=1 s m ≤ max 1≤ℓ≤b (cid:16) E δ E r 2(cid:17)p(cid:17)1/p 2 + 2(cid:16) E δ n k(Ajk)k∈Bℓk2 δijk(Ajk)k∈Bℓk2 Xj=1 1≤ℓ≤b(cid:16) n Xj=1 . ((log b)1/2 + p1/2)(cid:16) E ≤ ((log b)1/2 + p1/2)(cid:16) E max δ max 2(cid:17)p(cid:17)1/p rjδijk(Ajk)k∈Bℓk2 1≤ℓ≤b(cid:16) n Xj=1 1≤ℓ≤b(cid:16) n Xj=1 × max 1≤ℓ≤b max δ 2(cid:17)p/2(cid:17)1/p 2(cid:17)p(cid:17)1/(2p) δijk(Ajk)k∈Bℓk4 δijk(Ajk)k∈Bℓk2 1≤j≤n k(Ajk)k∈Bℓk2. max Putting the last two displays together we find a quadratic inequality. By solving it, we arrive at δijk(Ajk)k∈Bℓk2 2(cid:17)p(cid:17)1/p (cid:16) E δ max 1≤ℓ≤b(cid:16) n Xj=1 1≤ℓ≤bXj s m max . k(Ajk)k∈Bℓk2 2 + (log b + p) max 1≤ℓ≤b max 1≤j≤n k(Ajk)k∈Bℓk2 2. (6.9) Combining this estimate with (6.8) yields the assertion. Theorem 16. Let C ⊂ Rd be a closed convex set and let α = (log n)6(log m)2(log b)2. Let x∗ and x be minimizers of (6.1) and (6.2), respectively. Set (cid:3) d2,1 = sup x∈TC(x∗) : kAxk2,1=1kxk2,1. Suppose that m & ε−2 log(η−1)(α + log(η−1) log b)A2d2 s & ε−2 log(η−1)(log b + log(η−1))(α + log(η−1) log b)kAk2 m . Then, with probability at least 1 − η, 2,1, and η ≤ 1 ℓ2,1→ℓ∞ d2 2,1, f (x) ≤ (1 − ε)−2f (x∗). Proof. Set T = ATC(x∗)∩Sn−1, Z1 = Z1(A, Φ, TC(x∗)) and Z2 = Z2(A, Φ, TC(x∗), u). We apply Eq. (5.3), Eq. (6.7) and Eq. (6.9) to find for any p ≥ log m, (E d2p δ (T ))1/p ≤ 1 sh sup x∈TC(x∗) : kAxk2,1=1kxk2 2,1i(cid:16) E δ (cid:16) max 1≤i≤m n Xj=1 E g(cid:13)(cid:13)(cid:13) gjδijA∗ej(cid:13)(cid:13)(cid:13)2,∞(cid:17)2p(cid:17)1/p 26 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON 1 s (log b)h ≤ ≤ (log b)h sup x∈TC(x∗) : kAxk2,1=1kxk2 x∈TC(x∗) : kAxk2,1=1kxk2 sup δ max δijk(Ajk)k∈Bℓk2 1≤ℓ≤b(cid:16) n 2,1i(cid:16) E Xj=1 2,1i(cid:16) 1 (log b + p)kAk2 mA2 + 2(cid:17)p(cid:17)1/p ℓ2,1→ℓ∞(cid:17). 1 s (6.10) By Eq. (2.10), Lemma 15 and Eq. (6.10) αF (log b + p) + s F p log b 2 (T,k · kδ))1/p + √p(E dp γp m (cid:17)1/2 +(cid:16) Ep log b 2,1, F = A2d2 ℓ2,1→ℓ∞ d2 m s 2,1. δ (T ))1/p + p(E d2p δ (T ))1/p (log b + p) + F p log b m (cid:17)1/2 , Similarly, using Lemma 13 (with Z(u) := Z2(A, Φ, TC(x∗), u)) we find (cid:16) E δ,σ sup 2(cid:12)(cid:12)(cid:12) 2 − kxk2 x∈T(cid:12)(cid:12)(cid:12)kΦxk2 p(cid:17)1/p γ2p 2 (T,k · kδ))1/p + (E +(cid:16) αE (log b + p) + . (E δ αE s αF m . Ep log b δ (log b + p) + + s where we write E = kAk2 + 1(cid:17)(cid:16)(E + 1(cid:17)h(cid:16) αE s δ Z p ( E δ,σ s 2 )1/p .(cid:16)r p .(cid:16)r p s dp δ (T ))1/p(cid:17) δ (log b + p) + 2 (T,k · kδ))1/p + √p(E γp m (cid:17)1/2 +(cid:16) Ep log b αF m (cid:17)1/2i. Now apply Lemma 27 (with w = log(η−1)) to conclude that with probability at least 1 − η we have Z2 ≤ ε and Z1 ≥ 1 − ε under the assumptions on m and s. Lemma 11 now implies that (log b + p) + F p log b s f (x) ≤(cid:16)1 + ε 1 − ε(cid:17)2 f (x∗) = (1 − ε)−2f (x∗). (cid:3) Corollary 17. Set C = {x ∈ Rd : kxk2,1 ≤ R}. Suppose that x∗ is k-block sparse and kx∗k2,1 = R. Define kyk2=1, kyk2,1≤2√k kAyk2. σmin,k = inf Set α = (log n)6(log m)2(log b)2. Assume that m & ε−2 log(η−1)(α + log(η−1) log b)A2kσ−2 s & ε−2 log(η−1)(log(η−1) + log b)(α + log(η−1) log b)kAk2 min,k, ℓ2,1→ℓ∞kσ−2 min,k, and η ≤ 1 m . Then with probability at least 1 − η f (x) ≤ (1 − ε)−2f (x∗). Proof. As calculated in Example 33 of Appendix B, every x ∈ TC(x∗) satisfies kxk2 2. If moreover kAxk2 = 1, then 2,1 ≤ 4kkxk2 In other words, min,k ≤ kxk−2 σ2 2 ≤ 4kkxk−2 2,1. 2,1 ≤ 4kσ−2 min,k. sup x∈TC(x∗) : kAxk2=1kxk2 TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 27 (cid:3) For a dense random sign matrix Φ, it follows from [PW14, Theorem 1] that the result in Corollary 17 holds under the condition m & ε−2(A2kσ−2 min,k + log(η−1)). Thus, our result shows that one can substantially increase the sparsity in the matrix Φ, while maintaining the embedding dimension m (up to logarithmic factors). Let us now specialize our results to the case D = 1, which corresponds to the Lasso. In this case, if we let Ak denote the columns of A, A = max 1≤k≤d kAkk2, the maximum column of A. We can alternatively interpret this as the norm kAkℓ1→ℓ2 . Moreover, the norm kAkℓ2,1→ℓ∞ reduces to kAkℓ1→ℓ∞ = max 1≤j≤n max 1≤k≤d Ajk, the largest entry of the matrix. The first norm can be significantly larger than the second. For example, if A is filled with ±1 entries, then kAkℓ1→ℓ2 = √n, kAkℓ1→ℓ∞ = 1. A similar result for the fast J-L transform, but with a worse dependence of m on the matrix A, was obtained in [PW14]. For completeness, we will show in Appendix C that the fast J-L transform in fact satisfies similar results as Theorem 16 and Corollary 17, with the essentially the same dependence of m on A. 7. Proof of the main theorem After having seen instantiations of various subsets of our ideas for specific appli- cations (linear subspaces, ·T of small type-2 constant, and closed convex cones), we now prove the main theorem of this work, Theorem 3. Our starting point is the observation that inequality Eq. (5.4), i.e., log N ( T ,k·kδ, t) .(cid:16) log dδ(T ) t (cid:17)(log m) log N(cid:16)conv(cid:16) m [i=1 BJi(cid:17), · T , 1 8 √st(cid:17) (7.1) holds in full generality. We will need the following replacement of Claim 9. Lemma 18. Let ǫ > 0. Then log N(cid:16)conv(cid:16) m [i=1 BJi(cid:17), · T , ǫ(cid:17) 1 ǫ2 log m + (log 1/ǫ) max . k. 1 ǫ2 max A=k log N(cid:16) 1 kXi∈A BJi, · T , ǫ(cid:17) (7.2) Proof. Set ρT (x, y) = x − yT and let ρℓ2(x, y) = kx − yk2. By Maurey’s lemma (Lemma 31 for k · k2), given x ∈ conv(BJi : 1 ≤ i ≤ m), there is a k . 1/ǫ2 and a set A ⊂ {1, . . . , m}, A = k, such that ρT (x, conv(BJi ; i ∈ A)) ≤ ρℓ2 (x, conv(BJi; i ∈ A)) ≤ ǫ Now, let us take an element y ∈ conv(BJi; i ∈ A), A . 1/ǫ2. Thus (7.3) y = λiyi k Xi=1 28 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON with yi ∈ BJi, λi ≥ 0,Pi λi = 1, k . 1/ǫ2. Firstly, we may dismiss the coefficients λi < ǫ3. Indeed, let S = {i : λi < ǫ3} and set y =Pi∈S λiyi. Then, λi ≤ kǫ3 . ǫ. Consider now the λi with ǫ3 ≤ λi ≤ 1. For ℓ = 0, 1, . . . , ℓ∗, ℓ∗ ≃ log(1/ǫ), denote kyk2 ≤Xi∈S Aℓ =n1 ≤ i ≤ k : 2−ℓAℓ ·(cid:16) 1 ℓ∗Xℓ=0 y = 1 2ℓ ≥ λi > Aℓ Xi∈Aℓ 1 2ℓ+1o y′i(cid:17) + y and write (7.4) (7.5) (7.6) (7.7) (7.8) BJi such that BJi 1 1 ℓ∗ 1 and BJi y′i ∈ λi ≤ 2 where y′i = λi2ℓyi ∈ BJi . Note that Xℓ=0 2−ℓAℓ < 2Xi kℓ Xi∈Aℓ Aℓ Xi∈Aℓ kℓ Pi∈Aℓ where kℓ = Aℓ . 1/ǫ2. Take finite sets ξℓ ⊂ 1 kℓ Xi∈Aℓ ρT (z, ξℓ) < ǫ for all z ∈ BJi , · T , ǫ(cid:17) ξℓ = N(cid:16) 1 kℓ Xi∈Aℓ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) y′i − zℓ(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T Aℓ Xi∈Aℓ ℓ∗Xℓ=0 Xℓ=0 Let zℓ ∈ ξℓ satisfy y − zT . 2−ℓAℓzℓ. By (7.4), (7.5) and set z = < ǫ 1 ℓ∗ 2−ℓAℓǫ + ǫ . ǫ To summarize, we can find an ǫ-net for conv(∪1≤i≤mBJi) with respect to · T as as follows. For every A ⊂ [m] with A = k, k . 1/ǫ2, we select ξA above. Then, 1 , . . . , ξA ℓ∗ ℓ∗ Xℓ=0 2−ℓAℓξA ℓ [k∈[m] : k.1/ǫ2 [A⊂[m],A=k k(cid:19) ℓ∗ N(cid:16) 1 kℓ Xi∈Aℓ Yℓ=0 k (cid:17)kh max ǫ2 m(cid:16) em BJi, · T , ǫ(cid:17) A=k N(cid:16) 1 kXi∈A k≤1/ǫ2 max 1 is an ǫ-net of cardinality at most max k.1/ǫ2 1 ǫ2 m(cid:18)m . max k.1/ǫ2 This yields the result. BJi, · T , ǫ(cid:17)ilog(1/ǫ) . (cid:3) TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 29 Next, we analyze further the set (1/k)Pi∈A BJi for some k . 1/ǫ2 (ǫ > 0 will be fixed later). The elements of (1/k)Pi∈A BJi are of the form n y = 1 k Xj=1(cid:16)Xi∈A x(i) j 2 ≤ 1, δijx(i) j (cid:17)ej for all i. with Therefore, by Cauchy-Schwarz, 1 1 ≤ δijx(i) kyk2 = Xj∈Ji k(cid:16) n Xj=1(cid:12)(cid:12)(cid:12)Xi∈A kh n Xj=1(cid:16)Xi∈A Define for α = 1, . . . , log(min{k, s}) the set j (cid:12)(cid:12)(cid:12) δij(cid:17)Xi∈A Uα = Uα(δ) =n1 ≤ j ≤ n : 2α ≤Xi∈A U0 = U0(δ) =n1 ≤ j ≤ n :Xi∈A δij < 2α+1(cid:17) ≤(1, if 2α ≤ 2esk minn2−α sk δ(cid:16)2α ≤Xi∈A def = P m τk,α Estimate for fixed j and define 2(cid:17)1/2 j 2i1/2 x(i) δij < 2α+1o δij < 2o. m , 2−2αo, if 2α > 2esk m , (7.9) (7.10) where the first term in the min is a consequence of Markov’s inequality, and the second term follows by using that τk,α ≤ P(cid:16) k Xj=1 ζj ≥ 2α(cid:17), whenever ζ1, . . . , ζk are i.i.d. Bernoulli random variables with mean s/m (see (7.19) for bounding Bernoulli moments). Hence, Uα is a random set of intensity τk,α, i.e., Pδ(j ∈ Uα(δ)) = τk,α. Write according to the preceding yα, with yα = Xj∈Uα yjej kyαk2 . xj ej y =Xα and 2α/2 1 √k : Pj∈Uα xj2 ≤ 1}, 2α/2BUα. 1 √k Hence, denoting BUα := {Pj∈Uα kXi∈A 1 Therefore, we deduce that log N(cid:16) 1 kXi∈A BJi ⊂Xα BJi , · T , ǫ(cid:17) .Xα =Xα ǫ log N(cid:16) 1 2α/2BUα, · T , √k log N(cid:16)BUα, · T ,r k log m(cid:17) log m(cid:17) 2α ǫ (7.11) 30 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON By the dual Sudakov inequality (Lemma 29 of Appendix A), th log N (BUα , · T , t)i1/2 .Xα (cid:16) 2α BJi, · T , ǫ(cid:17)i1/2 . E g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα k (cid:17)1/2(cid:16) log m ǫ (cid:17) E gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T It follows that and, by Lemma 18 h log N(cid:16) 1 kXi∈A h logN(cid:16)conv(cid:16) m [i=1 BJi(cid:17), · T , ǫ(cid:17)i1/2 ǫ(cid:17)1/2 ǫ (cid:16) log log m 1 k 1 ǫ ≤ max k. 1 ǫ2 (log m)1/2 + A=khXα r 2α Applying Eq. (7.12) to Eq. (7.1), taking ǫ ≃ √st, gives √st(cid:17)1/2 (log m)3/2(cid:16) log ǫ2 nXα r 2α t log1/2 N ( T ,k·kδ, t) . √s(cid:16) log 1 √s max A=k k. 1 log m + k 1 1 E E g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Ti (7.12) 1 √st(cid:17)· g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)To. Using this bound for large t and the elementary bound in Eq. (A.6) for small t in Eq. (2.2), we obtain γ2(T,k · kδ) . 1 √s (log n)3/2 log m + 1 √s (log m)3/2(log n)2· max k≤m max A=kn Xα,2α≤kr 2α g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T E max k≤m max A=k Xα,2α≤2esk/mr 2α k We split the sum over α into three different parts. Firstly, gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)To gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj=1 n γ2(T,k · k2). (7.13) (7.14) Next, by setting we obtain max k≤m max A=k UA =nj ∈ [n] : Xα,2esk/m<2α≤10 log nr 2α k . (log n)1/2 max k≤m max A=k 1 √k E E E k m m g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα .r s .r s δijo, m ≤Xi∈A gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈UA gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T 2esk E TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 31 ≤ (log n)1/2h max m/s≤k≤m 1 √k max A=k + max k≤m/s E g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈UA 1 √k max A=k gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈UA E gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Ti. Note that the first term on the right hand side is bounded by max m/s≤k≤m max A=k 1 √k E g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈UA gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T .r s m γ2(T,k · k2). (7.15) To bound the second term, we take expectations with respect to δ and find for sk(cid:17) pk = k log(cid:16) m δ h max k≤m/s E 1 √k max A=k . max k≤m/s max A=k E g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈UA gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Ti g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈UA δ(cid:16) E √k(cid:16) E 1 gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T(cid:17)pk(cid:17)1/pk . (7.16) By Eq. (7.10), for any A ⊂ [m] with A = k, UA is a random set of intensity at most esk/m = sq/(m log s), where we set q = ek(log s). If we now let η1, . . . , ηn be i.i.d. {0, 1}-valued random variables with expectation qs/(m log s), then the random set U defined by P(j ∈ U ) = P(ηj = 1) has a higher intensity than UA and therefore, . E E n E 1 k max s log s max k≤m max A=k δh max k≤m/s q≤ m 1 √k g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈UA gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Ti g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) √q(cid:16) E η(cid:16) E A=k Xα,10 log n<2α≤kr 2α . (log s)1/2 max Finally, consider the α with 2α > 10 log n. Since · T ≤ k · k2, ηjgjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T(cid:17)q(cid:17)1/q Xj=1 g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T A=k Xα,10 log n<2α≤kr 2α A=k Xα,10 log n<2α≤kr 2α g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Ti A=k Xα,10 log n<2α≤kr 2α ζj(cid:12)(cid:12)(cid:12) k (cid:16) E(cid:12)(cid:12)(cid:12) qk(cid:17)1/(2qk) Xj=1 where qk ≃ k log(m/k) and the ζj are i.i.d. {0, 1}-valued with mean 2−2α Pj ζj is binomially distributed, we find using that 2α > 10 log n, By Eq. (7.10), the intensity of Uα is bounded by 2−2α δ h max k Uα1/2. and therefore, ≤ max k≤m ≤ max k≤m k≤m max max max k E E n , . n1/qk 2−αqk . 2−αk(log m) and therefore qk tqk e− 9 ζ ≤(cid:16) n ζj(cid:13)(cid:13)(cid:13)L (cid:13)(cid:13)(cid:13)Xj 10 2αt(cid:17)1/qk Xt=1 A=k Xα,10 log n<2α≤kr 2α δ h max k≤m max k E E g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Xj∈Uα gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)Ti . (log m)3/2. (7.17) (7.18) . Since (7.19) (7.20) 32 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON By combining Eq. (7.13), Eq. (7.14), Eq. (7.15), Eq. (7.17), and Eq. (7.20) we obtain E γ2(T,k · kδ) . (log m)3/2(log n)5/2γ2(T,k · k2) √m (log m)2(log n)5/2 max q≤ m s log s + 1 √s((log m)3(log n)2+ g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) η(cid:16) E √q(cid:16) E Xj=1 1 n ηj gjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T(cid:17)q(cid:17)1/q), (7.21) with ηj i.i.d. Bernoulli with mean qs/(m log s). From our proof it is clear that E γ2 the right hand side of Eq. (7.21). Using Eq. (2.10) (for p = 1), we conclude that 2(T,k · kδ) can be bounded by the square of provided that m, s satisfy E sup x∈T(cid:12)(cid:12)(cid:12)kΦxk2 2 − 1(cid:12)(cid:12)(cid:12) < ε m & (log m)3(log n)5 γ2 s & (log m)6(log n)4 1 ε2 2 (T,k · k2) ε2 (7.22) (7.23) and (7.24) = (log m)2(log n)5/2 max q≤ m s log sn 1 g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) η(cid:16) E √qs(cid:16) E n Xj=1 ηjgjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T(cid:17)q(cid:17)1/qo < ε. (7.24) This completes the proof. 8. Example applications of main theorem In this section we use our main theorem to give explicit conditions under which E sup x∈T(cid:12)(cid:12)(cid:12)kΦxk2 2 − 1(cid:12)(cid:12)(cid:12) < ε for several interesting sets T ⊂ Sn−1. This amounts to computing an upper bound for the parameters γ2(T,k · k2) and s log sn 1 κ(T ) = max q≤ m (8.1) n Xj=1 ηjgjej(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)T(cid:17)q(cid:17)1/qo. g(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) η(cid:16) E √qs(cid:16) E We focus on the latter two and refer to [Dir14] for details on how to estimate γ2(T,k · k2). Note, however, that γ2(T,k · k2) . (m log s)1/2κ(T ). Indeed, take q = m s log s in Eq. (8.1) and note that the ηj are identically equal to 1 in this case. This gives κ(T ) ≥ (m log s)−1/2g(T ) ≃ (m log s)−1/2γ2(T,k · k2). Thus, if we ignore logarithmic factors, it suffices to bound κ(T ). TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 33 8.1. Linear subspace. In the application from Section 4 with T the unit ball of 2 , we have γ2(T,k · k2) ≃ √d and a d-dimensional linear subspace E of ℓn 2ηj(cid:13)(cid:13)(cid:13) (7.24) . (log m)2(log n)5/2 1 √s with ηj ∈ {0, 1} i.i.d. of mean qs/(m log s). Using Khintchine’s inequality, √q(cid:13)(cid:13)(cid:13)Xj kPEejk2 max s log s q≤ m (8.2) Lq η 1/2 1 and therefore m log s η < dqs 2(cid:13)(cid:13)(cid:13)Lq ηjkPEejk2 (cid:13)(cid:13)(cid:13)Xj (7.24) . (log m)2(log n)5/2(cid:16)r d m + q max j kPEejk2 2 + 1 √s max j kPEejk2(cid:17) Eq. (7.22) and Eq. (7.23) then give conditions m & d(log n)5(log m)4/ε2 s & (log n)4(log m)6/ε2 + (log n)5(log m)4 max j kPEejk2 2/ε2 (8.3) (8.4) (8.5) (8.6) (8.7) (8.8) 8.2. k-sparse vectors. Consider next the application from Section 5.1, replacing T by K given by Eq. (5.14). Thus γ2(K) . √k log n and Eq. (7.24) is bounded by max s log sn 1 q≤ m √q(cid:13)(cid:13)(cid:13) max i (cid:16)Xj ηjAij2(cid:17)(cid:13)(cid:13)(cid:13) 1/2 ηo Lq . qs m log s + q max i,j Aij2 √k(log m)2(log n)3 1 √s and Hence i (cid:13)(cid:13)(cid:13) max (Xj ηjAij2)(cid:13)(cid:13)(cid:13)Lq (7.24) . (log m)2(log n)3r k m η + (log m)2(log n)3r k s max i,j Aij (8.9) We then arrive at the conditions provided that m & k(log n)6(log m)4/ε2 s & (log n)4(log m)6/ε2 max i,j Aij < k−1/2(log n)−1 (8.10) (8.11) (8.12) (compare with Eq. (5.13)-(5.12)). 8.3. Flat vectors. Let T ⊆ Sn−1 be finite with kxk∞ ≤ α for all x ∈ T . Then by a similar calculation as in (4.10), n g sup Xi=1 x∈T(cid:12)(cid:12)(cid:12) (cid:16) E η(cid:16) E ηigixi(cid:12)(cid:12)(cid:12)(cid:17)q(cid:17)1/q .plog T ·(cid:13)(cid:13)(cid:13) sup .r qs log T Since γ2(T,k · k2) .plog T we find the conditions x∈T m n 1/2 Lq η ηix2 i(cid:13)(cid:13)(cid:13) Xi=1 + (α log T)√q m & (log T)(log m)4(log n)5/ε2 s & (α log T)2(log m)4(log n)5/ε2 + (log m)6(log n)4/ε2, which is qualitatively similar to [Mat08, Theorem 4.1]. (8.13) (8.14) (8.15) (8.16) 34 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON 8.4. Finite collection of subspaces. Let Θ be a finite collection of d-dimensional subspaces E ⊂ Rn with Θ = N . Define T = [E∈Θ {x ∈ E : kxk2 = 1}. α = sup E∈Θ j kPEejk2. max In this case, γ2(T,k·k2) . √d +√log N . For the duration of the next two sections, we define Recall that maxj kPEejk2 is referred to as the incoherence of E, and thuspd/n ≤ α ≤ 1 (cf. Remark 6) is the maximum incoherence in Θ. 8.4.1. Collection of incoherent subspaces. To estimate κ(T ), consider the collection A of operators A = Pj(PEej) ⊗ ej, E ∈ Θ. Fix η and define Rηx = Pj ηj xjej. Then applying [KMR14, Theorem 3.5] to ARη, Clearly ηjkPEejk2 By [RV07] (see the formulation in [Tro08, Proposition 7]), g g . dF (ARη) + γ2(ARη,k · k). (cid:13)(cid:13)(cid:13) max E∈Θ kXj ηjgjPEejk(cid:13)(cid:13)(cid:13)L1 =(cid:13)(cid:13)(cid:13) max A∈A kARηgk(cid:13)(cid:13)(cid:13)L1 2(cid:17)1/2 kAk ≤ 1, kARηkF =(cid:16)Xj + √ · kAk, ≤ 3√p(cid:16) EkARηkp 1,2(cid:17)1/p η kARηkp(cid:17)1/p (cid:16) E 1 → ℓ2 ηkkPEekk2 ≤ α. 1≤k≤n kARηekk2 = max kARηk1,2 = max 1≤k≤n m log s , it follows that . where E ηj = and we assume p ≥ 2 log n. Here k ·k1,2 is the ℓn Taking = qs n norm, hence (8.17) (8.18) (8.19) (8.20) (8.21) (8.22) To estimate κ(T ), we need to bound k(8.17)kLq . α√p +(cid:16) qs η kARηkp(cid:17)1/p m log s(cid:17)1/2 (cid:16) E 2(cid:17)(cid:13)(cid:13)(cid:13) η ≤(cid:13)(cid:13)(cid:13) max E (cid:16)Xj ηjkPEejk2 {z √(8.20) + kγ2(ARη)kLq {z } j kPEejk2 m log s 2 = dqs (8.21) η 1/2 Lq η } First, by Eq. (8.3) and denoting q1 = q + log N , (8.20) . d + q1 max + (q + log N )α2 Estimate trivially and hence, applying Eq. (8.19) with p = q + 2 log n + log N γ2(ARη) ≤plog N · max EkARηkp(cid:17)1/p A (8.21) .plog N ·(cid:16) max A∈A kARηk .plog N ·n(q + log n + log N )α2 + qs m log so1/2 (8.23) TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 35 Collecting our estimates we find κ(T ) . max q≤ m s log s 1 √qs((cid:16) dqs m log s(cid:17)1/2 + α√q +plog N ·h(√q +plog n +plog N )α +(cid:16) qs m log s (cid:17)1/2 (√log n√log N + log N )α .(cid:16) d + log N √s + m log s(cid:17)1/2i) Hence in this application (assuming log N ≥ log n), m (cid:17)1/2 (7.24) < (log m)2(log n)5/2n(cid:16) d + log N + α log N √s o and the conditions on m, s become m & (log m)4(log n)5(d + log N )ε−2 s & ((log m)6(log n)4 + (α log N )2(log m)4(log n)5)ε−2 (8.24) (8.25) (8.26) (8.27) Notice that s depends only on Θ and not on the dimension d. Thus this bound is of interest when log Θ is small compared with d. 8.4.2. Collection of coherent subspaces. We can also obtain a bound on s that does not improve for small α, but has linear dependence on log N . Here we will not rely on [RV07]. As described in Section 1, this setting has applications to model-based compressed sensing. For example, for approximate recovery of block-sparse signals using the notation of Section 1, our bounds will show that a measurement matrix Φ may have m < ∗ k log(n/k) and allow for efficient recovery. This is non-trivial if the number of blocks satisfies b > ∗ kb + k log(n/k), s < One may indeed trivially bound ∗ log(n/k). since certainly kARηk ≤ kAk ≤ 1. Hence leading to the following bound on κ(T ) max s log s q≤ m 1 √qsns dqs m log s Instead of (8.26), (8.27), one may impose the conditions γ2(ARη) .plog N (8.21) .plog N + (√q +plog N )α +plog No .r d ε2 + (log m)3(log n)5 log N ε2 + (log m)4(log n)5 log N ε2 ε2 m m & (log m)4(log n)5 d s & (log m)6(log n)4 1 +r log N s (8.28) (8.29) We remark that previous work [NN13a] which achieved m ≈ d/ε2 for small s had worse dependence on log N : In fact, Conjecture 14 of [NN13a] if true would imply that the correct dependence on N in both m and s should be log N (which is optimal due to known lower bounds for the Johnson-Lindenstrauss lemma, i.e., the special case d = 1). We thus have shown that this implication is indeed true. in particular s & (log N )3, m & (log N )6. 36 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON 8.5. Possibly infinite collection of subspaces. Assume next Θ is an arbitrary family of linear d-dimensional subspaces E ⊂ Rn, equipped with the Finsler metric Let for which (cf. [Dir14]) ρFin(E, E′) = kPE − P ′Ek. T = [E∈Θ γ2(T,k · k2) . √d + γ2(Θ, ρFin). {x ∈ E : kxk2 = 1} (8.30) (8.31) (8.32) (8.33) (8.34) (8.35) (8.36) (8.37) Fix some parameter ε0 > 0 and let Θ1 ⊂ Θ be a finite subset such that Let further {x ∈ E′ : kxk2 = 1} Θ1 ≤ N (Θ, ρFin, ε0) ρFin(E, Θ1) ≤ ε0 for any E ∈ Θ T1 = [E′∈Θ1 x = PE′ x + (PEx − PE′ x) = x1 + x2 T2 = [E,F∈Θ {x ∈ BE + BF : kxk2 ≤ ε0} Let x ∈ T, x ∈ E, E ∈ Θ and ρFin(E, E′) ≤ ε0 for some E′ ∈ Θ1. Hence where x1 ∈ T1 and x2 ∈ BE + BE′, kx2k2 ≤ ε0. Hence x2 ∈ T2 with For t < ε0, we estimate N (T2,k · k2, t). Let Θt ⊂ Θ satisfy t Θt ≤ N(cid:16)Θ, ρFin, ρFin(E, Θt) ≤ 4(cid:17) for all E ∈ Θ t 4 By Eq. (A.6), for each E′ ∈ Θt we can find ξE′ ⊂ BE′ such that 1 t log ξE′ . d log ρℓ2(x, ξE′ ) ≤ t for all x ∈ BE′ ξt = [E′,F ′∈Θt (ξE′ − ξF ′ ) Denote for which by construction Also, for x ∈ T2, x = y + z ∈ BE + BF and E′, F ′ ∈ Θt satisfying t log ξt . log N(cid:16)Θ, ρFin, ρFin(E, E′) ≤ 4(cid:17) + d log , ρFin(F, F ′) ≤ t 4 t 4 1 t , we have while Therefore kx − (PE′ y + PF ′ z)k2 ≤ t 2 , ρℓ2(PE′ y, ξE′) ≤ t 4 , ρℓ2 (PF ′ z, ξF ′) ≤ t 4 ρℓ2(x, ξt) ≤ t TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 37 and we get for t < ε0 (otherwise (8.38) = 0) log N (T2,k · k2, t) . log N(cid:16)Θ, ρFin, t 4(cid:17) + d log 1 t (8.38) Using the decomposition Eq. (8.33) and the bound Eq. (8.25) for the contribution of T1, we find + m κ(T ) .n(cid:16) d + log N (Θ, ρFin, ε0) (cid:17)1/2 x∈T2(cid:12)(cid:12)(cid:12) √qs(cid:16) E η(cid:16) E s log sn 1 with (ηj ) ∈ {0, 1} i.i.d. of mean Lipschitz functions (Eq. (4.1)), and Dudley’s inequality Eq. (2.2)[Dud67] α log N (Θ, ρFin, ε0) Xj=1 o ηjgjxj(cid:12)(cid:12)(cid:12)(cid:17)q(cid:17)1/qo + max m log s . q≤ m √s sup qs n g Estimate by the contraction principle [Kah68], the Gaussian concentration for (8.39) (8.40) 1 x∈T2(cid:12)(cid:12)(cid:12) √q(cid:13)(cid:13)(cid:13) sup n Xj=1 ηjgjxj(cid:12)(cid:12)(cid:12)(cid:13)(cid:13)(cid:13)L1 η ≤ g,Lq n g n 1 gjxj(cid:12)(cid:12)(cid:12)(cid:13)(cid:13)(cid:13)Lq Xj=1 gjxj(cid:12)(cid:12)(cid:12)(cid:13)(cid:13)(cid:13)L1 x∈T2(cid:12)(cid:12)(cid:12) √q(cid:13)(cid:13)(cid:13) sup x∈T2(cid:12)(cid:12)(cid:12) .(cid:13)(cid:13)(cid:13) sup Xj=1 .Z ε0 [log N (T2,k · k2, t)]1/2dt [log N (Θ, ρFin, t)]1/2dt + √dε0rlog .Z ε0 0 0 g where in the final step we used Eq. (8.38). Summarizing, the conditions on m and s are as follows (for any ε0 > 0) m & ε−2(log m)3(log n)5γ2 2 (Θ, ρFin) + ε−2(log m)4(log n)5[d + log N (Θ, ρFin, ε0)] s & ε−2(log m)6(log n)4 + ε−2(log m)4(log n)5[α log N (Θ, ρFin, ε0)]2 , 1 ε0 (8.41) (8.42) (8.43) 1 + ε−2(log m)4(log n)5ε2 0(cid:16) log + ε−2(log m)4(log n)5hZ ε0 ε0(cid:17)d [log N (Θ, ρFin, t)]1/2dti2 0 If Θ = N < ∞, then log N (Θ, ρFin, t) ≤ log N and (8.42), (8.43) turn into (8.26), (8.27) for ε0 → 0. 8.6. Manifolds. Let M ⊂ Rn be a d-dimensional manifold obtained as the image 2 → Rn. More precisely, we assume that M = F (Bℓd kF (x) − F (y)k2 ≃ kx − yk2 and the Gauss map, which sends x ∈ M to Ex, the tangent plane at x, is Lipschitz from the geodesic distance ρM to ρFin. Following [Dir14], we want to ensure that the sparse matrix Φ satisfies ), for a smooth map F : Bℓd 2 (8.44) for any C1-curve γ ⊂ M, where · denotes curve length. Note that Eq. (8.44) is equivalent to requiring (8.45) (1 − ε)γ ≤ Φ(γ) ≤ (1 + ε)γ 1 − ε ≤ kΦ(v)k2 ≤ 1 + ε for any tangent vector v of M at a point x ∈ M. Denote by Θ = {Ex : x ∈ M} 38 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON the tangent bundle of M, to which we apply the estimates on m, s obtained above. By assumption, ρFin(Ex, Ey) . ρM(x, y) ≃ kF −1(x) − F −1(y)k2, so that for 0 ≤ t ≤ 1/2 by Eq. (A.6), log N (Θ, ρFin, t) . log N (M,k · k2, ct) ≃ log N (Bℓd 2 ,k · k2, t) . d log In this application We assume α = max x∈M max v∈Ex kvk2=1 max 1≤j≤n hv, eji α ≪ 1 √d 1 t . (8.46) (8.47) to make the below of interest (otherwise apply the result of [Dir14]). Taking ε0 = α√d in (8.42), (8.43), it follows that Eq. (8.44) may be ensured under parameter conditions α√d(cid:17) m & ε−2(log m)4(log n)5d · log(cid:16) 1 (8.48) (8.50) (8.51) s & ε−2(log m)6(log n)4 + ε−2(log m)4(log n)7(αd)2 (8.49) Thus for α = o(1/√d), the condition on s becomes non-trivial. Recall from Re- mark 6 that α ≥ pd/n and therefore the log(1/(α√d)) term in Eq. (8.48) is at most log n. 2 → L(Rd, Rn), Remark 19. Returning to the assumptions on F , consider DF : Bℓd the space of linear operators from Rd to Rn. The first statement means that uniformly for x ∈ Bℓd 2 , c−1kξk2 ≤ kDF (x)ξk2 ≤ ckξk2 for ξ ∈ Rd The second statement follows from requiring kDF (x) − DF (y)k2→2 ≤ ckx − yk2 for x, y ∈ Bℓd 2 Indeed, since Ex = DF (x)(Rd), Ey = DF (y)(Rd), it follows from Eq. (8.51) 2 (u, Ey) . kx − yk2 ρℓn inf u∈Ex kuk2=1 implying ρFin(Ex, Ey) = kPEx − PEyk2→2 . kx − yk2. If α ≥ 1/√d, then necessarily s ≫ d in Eq. (8.49) (up to polylog- Remark 20. arithmic factors). Thus the manifold case is very different from the case of linear subspaces. We sketch a construction to demonstrate this. Let n > d10. Denote by 0 ≤ ϕ ≤ 1 a smooth bump function on R such that ϕ(t) = t for 1 4 ≤ t ≤ 1 2 , supp(ϕ) ⊂ [0, 1] (8.52) By the lower bound in Eq. (A.6), there is a collection {aβ}1≤β≤2d of 2d points in (0, 1/2) def= B1/2 ⊂ Rd such that Bℓd 2 kaβ′ − aβk2 > 1 10 for β′ 6= β TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 39 and let (ηβ )1≤β≤2d be any collection of unit vectors in Rn. f : Rd → Rn defined by Consider the map f (x) = ϕ(104kx − aβk2 2)ηβ (8.53) 2d Xβ=1 Thus by construction, the summands in Eq. (8.53) are disjointly supported func- tions of x. Clearly Df (x)ξ = 2 · 104Xβ ϕ′(104kx − aβk2 2)hx − aβ, ξi ηβ (8.54) kDf (x)k2→2 ≤ C implying that and kDf (x) − Df (y)k2→2 ≤ Ckx − yk2 Next, let θ1, . . . , θd ∈ Rn be orthogonal vectors such that and define the map kθjk2 = 1,kθjk∞ = 1 √n (8.55) (8.56) In view of Eq. (8.55), F satisfies conditions (8.50),(8.51). Also, by (8.54),(8.56) F : Bℓd 2 ⊂ Rd → R2n = Rn × Rn F (x) =(cid:16) d xjθj, f (x)(cid:17) Xj=1 kξk2=1kDF (x)ξk∞ .r d max n α . sup x∈Bℓd 2 + max β kηβk∞ (8.57) Let M = F (Bℓd 2 ). Fix some 1 ≤ β ≤ 2d and let for 1/200 ≤ t ≤ 1/(100√2) γ(t) = F (aβ + te1) =(cid:16) d Xj=1 aβ,jθj + tθ1, 104t2ηβ(cid:17) where we used Eq. (8.52). Thus γ is a C1-curve in M and γ′(cid:16) 1 200(cid:17) = (θ1, 100ηβ) Let Φ be a sparse m × 2n matrix for which Eq. (8.44) holds. Then Φ has to satisfy in particular (1 − ε)(1 + 104)1/2 ≤ kΦ(θ1, 100ηβ)k2 ≤ (1 + ε)(1 + 104)1/2 and hence kΦ(θ1, 100ηβ)k2 < 103 for all 1 ≤ β ≤ 2d (8.59) Choose k such that 2d >(cid:18)n and let (ηβ ) be the collection of 2k(cid:0)n √kXj∈I k(cid:19)2k, i.e. k ≃ k(cid:1) vectors in Rn of the form ±ej with I ⊂ {1, . . . , n},I = k log n η = d 1 (8.58) (8.60) 40 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON By Eq. (8.59), Φ needs to satisfy kΦ(0, η)k2 ≤ 20 (8.61) for all vectors η of the form Eq. (8.60). But if m < n/d, Eq. (8.61) implies that s ≥ k/400 & d/ log n. On the other hand, Eq. (8.57) gives √k ≃ r log n α .r d + n d 1 1 3 ij x2 P Φ (8.63) ijx2 j ≥ XK⊂I 1 − 2−sr , cmo def= r1 with probability (with respect to Φ) at least (cid:12)(cid:12)(cid:12)n1 ≤ i ≤ m :X Φ2 8.6.1. Geodesic distances. In this section we show that not only do sparse maps preserve curve lengths on manifolds, but in fact they preserve geodesic distances. Lemma 21. Fix x ∈ Rn such that xj ≥ 1 for j ∈ J ⊂ {1, . . . , n},J = r. Then (8.62) so(cid:12)(cid:12)(cid:12) > minn sr Proof. Fix I ⊂ {1, . . . , m}, I ≤ r1 and assume Pj Φ2 j < 1/s for i /∈ I. This means that for any j ∈ J, S = def={i; Φij 6= 0} ⊂ I. The probability (with respect to Φ) that {i; Φij 6= 0} ⊂ I (with j fixed) is (by Eq. (2.3)) (S = K) = XK⊂I EYi∈K δij m(cid:17)s K=s(cid:16) s ≤ XK⊂I ≤(cid:18)I s(cid:19) ·(cid:16) s m(cid:17)s ≤(cid:16) e · I m (cid:17)s so ⊂ I j ≥ n1 ≤ i ≤ m;X Φ2 is bounded by ((eI/m)s)r ≤ (er1/m)sr. Taking a union bound over all I ⊂ {1, . . . , m},I ≤ r1 gives by the choice of r1 m (cid:17)sr r1 (cid:17)r1(cid:16) er1 Since for different j the events are independent, it follows the probability that (cid:18) m I(cid:19) ·(cid:16) er1 m (cid:17)sr ≤(cid:16) e2r1 m (cid:17)2sr/3 ≤(cid:16) em < 2−sr K=s K=s 1 ij x2 (cid:3) (8.65) For the following lemma recall that for a ∈ Rn and (σj) a Rademacher vector (8.64) 1 P . σ(cid:16)(cid:12)(cid:12)(cid:12)Xj ajσj(cid:12)(cid:12)(cid:12) < 2kak2(cid:17) < 4 5 This is a consequence of the Paley-Zygmund inequality, see e.g. [Ber97, Theorem 3.6]. Lemma 22. Let x ∈ Rn satisfy the assumption of Lemma 21. Then P Φ(cid:16)kΦxk2 < 1 2√s(cid:17) < 2−cr1 TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 41 1 4 5 ijx2 2√s(cid:17) < Proof. We may assume that P Φ2 j ≥ 1/s for i in a subset I ⊂ {1, . . . , m}, I ≥ r1. Exploiting the random signs of Φij , we find by Eq. (8.64) for each i ∈ I Φijxj(cid:12)(cid:12)(cid:12) < P(cid:16)(cid:12)(cid:12)(cid:12)Xj (8.66) (cid:16) 4 5(cid:17)I < 2−cr1, If kΦxk2 < 1/(2√s), then Pj Φij xj < 1/(2√s) for all i, in particular for all i ∈ I. By Eq. (8.66) the probability for this event is at most proving Eq. (8.65). Corollary 23. Let ξ ⊂ Rn be a set of vectors x with following properties: J = Jx′ ⊂ {1, . . . , n}, J ≥ r so that x′j ≥ 1 for j ∈ J. Moreover (a) Each x ∈ ξ has a decomposition x = x′ + x′′, x′ ∈ ξ′ and there is a set (cid:3) (8.67) (8.68) (8.69) . (b) kx′′k2 < 1 10n ξ′ < 2c min{sr,m} for all x ∈ ξ Then 1 4√s with probability at least 1 − 2−c min{sr,m}. Proof. Write kΦxk2 > kΦxk2 ≥ kΦx′k2 − kΦx′′k2 ≥ kΦx′k2 − √n · kx′′k2 ≥ kΦx′k2 − 1 10√n since clearly kΦk2 ≤ √n. Next, Lemma 22 and a union bound will ensure that kΦx′k2 ≥ 1/(2√s) for all x′ ∈ ξ′ with the desired probability. (cid:3) Lemma 24. Let s ≥ c(log n)2. Let ξ ⊂ Rn be a finite set of unit vectors satisfying (8.70) log ξ < cm Then with probability at least 1 − e−cs for some constant c > 0, Φ satisfies (8.71) Proof. Given x ∈ Rn, let x∗ be the decreasing rearrangement of xi. Let K = c log n. We partition ξ as for x ∈ ξ. kΦxk > e−c(log n)2 where ξ−1 = ∅, and for ℓ ≥ 0 satisfying 2ℓK 2 < m, (ξℓ\(ξ0 ∪ ξ1 ∪ . . . ∪ ξℓ−1)) ξ =[ℓ ξℓ = {x ∈ ξ : x∗m/(2ℓK 2) > n−K+2ℓ} For the vectors x ∈ ξ0, apply Corollary 23 with x = x′, r = m/K 2 (after rescaling by n−K). Since csr > cm > log ξ ≥ log ξ0, (8.68) holds and by Eq. (8.69), we ensure that kΦxk2 > n−K/(4√s) for all x ∈ ξ0. Consider the set ξ′ℓ = ξℓ\(ξ0 ∪ ξ1 ∪ . . . ∪ ξℓ−1). Thus each x ∈ ξ′ℓ has a decompo- sition x = y + z where y is obtained by considering the m/(2ℓ−1K 2) largest coordinates of x and kzk∞ ≤ x∗m/(2ℓ−1K 2) ≤ n−K+2ℓ−2 since x /∈ ξℓ−1. 42 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON Note also that y ∈ [S⊂{1,...,n} S= m 2ℓ−1K2 BXS , with XS = {ej : j ∈ S}. Let fS ⊂ BXS be a finite subset such that dist(y, fS) < n−K for all y ∈ BXS m 2ℓ−1K 2 log nK = m log n 2ℓ−1K log fS . Hence y = x′ + w with x′ ∈[S fS, kwk2 < n−K Apply Corollary 23 to the set nK−2ℓξ′ℓ, considering the decomposition (8.72) (8.73) nK−2ℓx = nK−2ℓx′ + nK−2ℓ(w + z) satisfying by Eq. (8.73) knK−2ℓ(w + z)k2 < n−2ℓ + nK−2ℓkzk∞ 1 < n−2ℓ + n−2 < 10n which is condition (8.67). Also nK−2ℓx′ ∈ ξ′, where by Eq. (8.72) (and choice of s, K) log ξ′ ≤ log(cid:18) m/(2ℓ−1K 2)(cid:19) + m log n 2ℓ−1K m log n 2ℓ−1K . n < c minn sm 2ℓK 2 , mo, which is condition (8.68) with r = m/(2ℓK 2). Let Jx be the set of r = m/(2ℓK 2) largest coordinates of x (which are also the r largest coordinates of y). Hence, for j ∈ Jx nK−2ℓx′j ≥ nK−2ℓyj − nK−2ℓwj = nK−2ℓxj − nK−2ℓwj > nK−2ℓn−K+2ℓ − nK−2ℓn−K > 1 2 since x ∈ ξℓ. By Eq. (8.69) kΦxk > n−K+2ℓ · 1 4√s for all x ∈ ξℓ with probability at least 1 − e−c min{m,sr} ≥ 1 − e−cs, since m/(2ℓK 2) ≥ 1. (cid:3) Let M ⊂ Rn be a d-dimensional manifold obtained as a bi-Lipschitz image of the unit ball Bℓd , i.e. F : Bℓd 2 2 → M satisfies kF (x) − F (y)k2 ≃ kx − yk2. (8.74) 2 → L(Rd, Rn) (i.e. We assume moreover F is smooth, more specifically DF : Bℓd linear maps from Rd to Rn under operator norm) is Lipschitz, i.e., kDF (x) − DF (y)kℓd Lemma 25. Let M be as above. Assume 2→ℓn 2 m & d(log n)2 s & (log n)2 . kx − yk2 (8.75) (8.76) TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 43 Then with probability at least 1− e−cs for some constant c > 0, ΦM is bi-Lipschitz, and more specifically kΦ(x) − Φ(y)k2 ≥ e−c(log n)2 (8.77) Proof. We treat separately the pairs x, y ∈ M which are at a “large” and “small” distance from each other. Fix ε1 > 0 and ε2 > ε1 to be specified later. Let Aε1 ⊂ M be an ε1-net for M. By Eq. (8.74) and Eq. (A.6), we can assume that · kx − yk2 for x, y ∈ M log Aε1 . d log(1/ε1). Assume that x, y ∈ M, kx − yk2 > ε2. Take x1, y1 ∈ Aε1 s.t. kx − x1k2 < ε1, ky − y1k2 < ε1. Since Φ is linear kΦ(x) − Φ(y)k2 ≥ kΦ(x1 − y1)k2 − 2√nε1 Apply Lemma 24 to the set ξ =n x1 − y1 : x1, y1 ∈ Aε1o. kx1 − y1k2 m & d log(1/ε1) > c log Aε1 Assuming we ensure Φ to satisfy > e−c(log n)2 for x1, y1 ∈ Aε1 . (cid:13)(cid:13)(cid:13)Φ(cid:16) x1 − y1 kx1 − y1k2(cid:17)(cid:13)(cid:13)(cid:13)2 Therefore, if x, y ∈ M, kx − yk2 > ε2 kΦ(x) − Φ(y)k2 ≥ e−c(log n)2 e−c(log n)2 choosing ε2 = 5√nec(log n)2 · kx1 − y1k2 − 2√n · kx − yk2 1 2 ≥ ε1. This takes care of large distances. ε1 ε2 · kx − yk2 In order to deal with small distances, we first ensure that kΦ(v)k > e−c(log n)2 for any unit tangent vector v of M Consider Tε1 = [x1∈Aε1nv ∈ Tx1 : kvk = 1o (8.78) (8.79) (8.80) (8.81) Under the assumption (8.78) on m (and making an ε1-discretization of each {v ∈ Tx1 : kvk2 = 1}), another application of Lemma 24 will ensure that (8.80) holds for all v ∈ Tε1 . Next, if x ∈ M, x1 ∈ Aε1 , kx − x1k2 < ε1, it follows from Eq. (8.75) that kDF (x) − DF (x1)kℓ2→ℓ2 . ε1 and hence ρFin(Tx, Tx1) . ε1. Therefore, if v ∈ Tx, kvk2 = 1, there is v1 ∈ Tε1 s.t. kv − v1k2 . ε1. Therefore kΦ(v)k2 ≥ kΦ(v1)k2 − √nε1 ≥ e−c(log n)2 − √nε1 > 1 2 e−c(log n)2 since ε1 < n−1/2e−c(log n)2 /2. Thus Φ satisfies (8.80). Assume x, y ∈ M, kx − yk2 < ε2. Let u = F −1(x), w = F −1(y) ∈ Bℓd 2 . By Eq. (8.74), ku − wk2 ≃ kx − yk2. Write y − x = F (w) − F (u) =Z 1 =Z 1 0 0 Hence, again invoking Eq. (8.75), kF (w) − F (u) − DF (u)(w − u)k2 ∂tF (tw + (1 − t)u)dt DF (tw + (1 − t)u)(w − u)dt. 44 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON t kDF (tw + (1 − t)u) − DF (u)kℓ2→ℓ2 ≤ kw − uk2 · sup . ku − wk2 2. (8.82) Denote By Eq. (8.82) and using kΦk ≤ √n, kw − uk2(cid:17) ∈ Tu. v = DF (u)(cid:16) w − u ky − x − ku − wk2vk2 < cε2kx − yk2 kΦ(y) − Φ(x) − ku − wk2Φ(v)k2 < c√nε2kx − yk2 − c√nε2kx − yk2 kΦ(x) − Φ(y)k2 ≥ ku − wk2e−c(log n)2 ≥(cid:16)ce−c(log n)2 & e−c(log n)2 − c√nε2(cid:17)kx − yk2 kx − yk2 and by (8.80) provided ε2 < c 1 √n e−c(log n)2 (8.83) Thus we may take log(1/ε1), log(1/ε2) ≃ (log n)2 and condition (8.78) will hold for m & d(log n)2. (cid:3) Theorem 26. Let M be as above and m, s satisfy (8.76). Assume moreover that m, s satisfy the appropriate conditions to ensure that 1 − ε ≤ kΦ(v)k2 ≤ 1 + ε (8.84) for all unit tangent vectors v of M. Then with probability at least 1− e−cs for some constant c > 0, Φ preserves geodesic distances up to factor 1 + ε. Proof. By (8.84), (1− ε)γ < Φ(γ) < (1 + ε)γ for any C1-curve γ in M. Let ρM refer to the geodesic distance in M. Clearly ρΦ(M)(Φ(x), Φ(y)) ≤ (1 + ε)ρM(x, y) (8.85) from the above. We need to show the reverse inequality. Let γ1 be a C1-curve in Φ(M) joining Φ(x), Φ(y) such that ρΦ(M)(Φ(x), Φ(y)) = γ1. Since Φ satisfies (8.77), ΦM : M → Φ(M) is bi-Lipschitz and hence a diffeomorphism (since Φ is also smooth). It follows that γ = Φ−1γ1 is a C1-curve joining x and y and ρM(x, y) ≤ γ ≤ (1 + ε)Φ(γ) = (1 + ε)γ1 = (1 + ε)ρΦ(M)(Φ(x), Φ(y)). (cid:3) 9. Discussion We have provided a general theorem which captures sparse dimensionality reduc- tion in Euclidean space and qualitatively unifies much of what we know in specific applications. There is still much room though for quantitative improvement. We here list some known quantitative shortcomings of our bounds and discuss some avenues for improvement in future work. First, our dependence on 1/ε in s in all our theorems is, up to logarithmic factors, quadratic. Meanwhile the works [KN14, NN13a] show that the correct dependence in the case of small m should be linear. Part of the reason for this discrepancy may be our use of the chaining result of [KMR14]. Specifically, chaining is a technique TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 45 that in general converts tail bounds into bounds on the expected supremum of stochastic processes (see [Tal05] for details). Perhaps one could generalize the tail bound of [KN14] to give a broad understanding of the decay behavior for the error random variable in the SJLT as a function of s, m then feed such a quantity into a chaining argument to improve our use of [KMR14]. Another place where we lost logarithmic factors is in our use of the duality of entropy numbers [BPSTJ89, Proposition 4] in Eq. (5.4). It is believed that in general if K, D are symmetric convex bodies and N (K, D) is the number of translations of D needed to cover K then N (D◦, aK◦) . N (K, D) . N (D◦, a−1K◦) for some universal constant a > 0. This is known as Pietsch’s duality conjecture [Pie72, p. 38], and unfortunately resolving it has been a challenging open problem in convex geometry for over 40 years. We have also lost logarithmic factors in our use of dual Sudakov minoration, which bounds supt>0 t[log N (BE,k · kX , t)]1/2 by a constant times Eg kPEgkX for any norm k · kX even though what we actually wish to bound is the γ2 functional. Passing from this functional via Eq. (2.2) to supt>0 t[log N (BE,k · kX , t)]1/2 costs us logarithmic factors. The majorizing measures theory (see [Tal05]) shows that the loss can be avoided when k·kX is the ℓ2 norm; it would be interesting to explore how the loss can be avoided in our case. Finally, note that the SJLT Φ considered in this work is a randomly signed adjacency matrix of a random bipartite graph with m vertices in the left bipartition, n in the right, and with all right vertices having equal degree s. Sasha Sodin has asked in personal communication whether taking a random signing of the adjacency matrix of a random biregular graph (degree s on the right and degree ns/m on the left) can yield improved bounds on s, m for some T of interest. We leave this as an interesting open question. Acknowledgement. We would like to thank Huy L. Nguyen for pointing out the second statement in Lemma 11. Part of this work was done during a visit of the second-named author to Harvard University. He wishes to thank the Theory of Computation group for its hospitality. References [ABTZ13] Haim Avron, Christos Boutsidis, Sivan Toledo, and Anastasios Zouzias. Efficient dimensionality reduction for canonical correlation analysis. In Proceedings of the 30th International Conference on Ma- chine Learning (ICML), 2013. [AC09] Nir Ailon and Bernard Chazelle. The Fast Johnson–Lindenstrauss Transform and approximate nearest neighbors. SIAM J. Comput., 39(1):302–322, 2009. [Ach03] Dimitris Achlioptas. Database-friendly random projections: Johnson- Lindenstrauss with binary coins. J. Comput. Syst. Sci., 66(4):671– 687, 2003. [ADR14] Ula¸s Ayaz, Sjoerd Dirksen, and Holger Rauhut. Uniform recovery of fusion frame structured sparse signals. CoRR, abs/1407.7680, 2014. [AHK06] Sanjeev Arora, Elad Hazan, and Satyen Kale. A fast random sampling In APPROX-RANDOM, pages algorithm for sparsifying matrices. 272–279, 2006. [AL09] Nir Ailon and Edo Liberty. Fast dimension reduction using Rade- macher series on dual BCH codes. Discrete Comput. Geom., 42(4):615–630, 2009. 46 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON [AL13] Nir Ailon and Edo Liberty. An almost optimal unrestricted fast Johnson-Lindenstrauss transform. ACM Transactions on Algorithms, 9(3):21, 2013. [Alo03] Noga Alon. Problems and results in extremal combinatorics–i. Dis- crete Mathematics, 273(1-3):31–53, 2003. [AMT10] Haim Avron, Petar Maymounkov, and Sivan Toledo. Blendenpik: Supercharging LAPACK’s least-squares solver. SIAM J. Scientific Computing, 32(3):1217–1236, 2010. [AN13] Alexandr Andoni and Huy L. Nguyen. Eigenvalues of a matrix in the streaming model. In Proceedings of the 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1729–1737, 2013. [BB05] Maria-Florina Balcan and Avrim Blum. A pac-style model for learn- ing from labeled and unlabeled data. In Learning Theory, 18th Annual Conference on Learning Theory, COLT 2005, Bertinoro, Italy, June 27-30, 2005, Proceedings, pages 111–126, 2005. [BBDS12] Jeremiah Blocki, Avrim Blum, Anupam Datta, and Or Sheffet. The johnson-lindenstrauss transform itself preserves differential privacy. In 53rd Annual IEEE Symposium on Foundations of Computer Sci- ence, FOCS 2012, New Brunswick, NJ, USA, October 20-23, 2012, pages 410–419, 2012. [BBV06] Maria-Florina Balcan, Avrim Blum, and Santosh Vempala. Kernels as features: On kernels, margins, and low-dimensional mappings. Ma- chine Learning, 65(1):79–94, 2006. [BCDH10] Richard G. Baraniuk, Volkan Cevher, Marco F. Duarte, and Chinmay Hegde. Model-based compressive sensing. IEEE Trans. Inf. Theory, 56:1982–2001, 2010. [BCIS05] Mihai Badoiu, Julia Chuzhoy, Piotr Indyk, and Anastasios Sidiropou- los. Low-distortion embeddings of general metrics into the line. In Proceedings of the 37th Annual ACM Symposium on Theory of Com- puting, Baltimore, MD, USA, May 22-24, 2005, pages 225–233, 2005. [BD08] Thomas Blumensath and Mike E. Davies. Iterative hard thresholding for compressed sensing. J. Fourier Anal. Appl., 14:629–654, 2008. [BDF+11] Jean Bourgain, Stephen Dilworth, Kevin Ford, Sergei Konyagin, and Denka Kutzarova. Explicit constructions of RIP matrices and related problems. Duke J. Math., 159(1):145–185, 2011. [Ber97] Bonnie Berger. The fourth moment method. SIAM J. Comput., 26(4):1188–1207, 1997. [BLM89] Jean Bourgain, Joram Lindenstrauss, and Vitali D. Milman. Approx- imation of zonoids by zonotopes. Acta Math., 162:73–141, 1989. [BOR10] Vladimir Braverman, Rafail Ostrovsky, and Yuval Rabani. Rade- macher chaos, random Eulerian graphs and the sparse Johnson- Lindenstrauss transform. CoRR, abs/1011.2590, 2010. [BPSTJ89] Jean Bourgain, Alain Pajor, Stanis law J. Szarek, and Nicole Tomczak-Jaegermann. On the duality problem for entropy numbers of operators. Geometric Aspects of Functional Analysis, 1376:50–163, 1989. [BT02] Jeremy Buhler and Martin Tompa. Finding motifs using random projections. Journal of Computational Biology, 9(2):225–242, 2002. [BvdG11] Peter Buhlmann and Sara van de Geer. dimensional data. Springer, Heidelberg, 2011. Statistics for high- [BW09] Richard G. Baraniuk and Michael B. Wakin. Random projections of smooth manifolds. Foundations of Computational Mathematics, TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 47 9(1):51–77, 2009. [BZMD11] Christos Boutsidis, Anastasios Zouzias, Michael W. Mahoney, and Petros Drineas. Stochastic dimensionality reduction for k-means clus- tering. CoRR, abs/1110.2897, 2011. [Can08] Emmanuel Cand`es. The restricted isometry property and its impli- cations for compressed sensing. Comptes Rendes Mathematique, 346 (9-10): 589–592, 2008. [Car85] Bernd Carl. Inequalities of Bernstein-Jackson-type and the degree of compactness operators in Banach spaces. Ann. Inst. Fourier (Greno- ble), 35(3):79–118, 1985. [CCFC04] Moses Charikar, Kevin Chen, and Martin Farach-Colton. Finding frequent items in data streams. Theor. Comput. Sci., 312(1):3–15, 2004. [CDMI+13] Kenneth L. Clarkson, Petros Drineas, Malik Magdon-Ismail, Michael W. Mahoney, Xiangrui Meng, and David P. Woodruff. The Fast Cauchy Transform and faster robust linear regression. In Pro- ceedings of the 24th Annual ACM-SIAM Symposium on Discrete Al- gorithms (SODA), pages 466–477, 2013. [CEM+14] Michael Cohen, Sam Elder, Cameron Musco, Christopher Musco, and Madalina Persu. Dimensionality reduction for k-means clustering and low rank approximation. CoRR, abs/1410.6801, 2014. [CGV13] Mahdi Cheraghchi, Venkatesan Guruswami, and Ameya Velingker. Restricted isometry of Fourier matrices and list decodability of ran- dom linear codes. SIAM J. Comput., 42(5):1888–1914, 2013. [Cla08] Kenneth L. Clarkson. Tighter bounds for random projections of man- ifolds. In Proceedings of the 24th ACM Symposium on Computational Geometry, College Park, MD, USA, June 9-11, 2008, pages 39–48, 2008. [CM12] Pedro Contreras and Fionn Murtagh. Fast, linear time hierarchical clustering using the Baire metric. J. Classification, 29(2):118–143, 2012. [Coh14] Michael B. Cohen. Personal communication, 2014. [CT65] James W. Cooley and John M. Tukey. An algorithm for the machine calculation of complex Fourier series. Math. Comput., 19:297–301, 1965. [CT05] Emmanuel Cand`es and Terence Tao. Decoding by linear program- ming. IEEE Trans. Inf. Theory, 51(12):4203–4215, 2005. [CT06] Emmanuel J. Cand`es and Terence Tao. Near-optimal signal recov- ery from random projections: universal encoding strategies? IEEE Trans. Inform. Theory, 52:5406–5425, 2006. [CW09] Kenneth L. Clarkson and David P. Woodruff. Numerical linear alge- bra in the streaming model. In Proceedings of the 41st Annual ACM Symposium on Theory of Computing, STOC 2009, Bethesda, MD, USA, May 31 - June 2, 2009, pages 205–214, 2009. [CW13] Kenneth L. Clarkson and David P. Woodruff. Low rank approxima- tion and regression in input sparsity time. In Proceedings of the 45th ACM Symposium on Theory of Computing (STOC), pages 81–90, 2013. [DG13] David L. Donoho and Carrie Grimes. Hessian eigenmaps: Locally linear embedding techniques for high-dimensional data. Proc. Natl. Acad. Sci., 100(10):5591–5596, 2013. 48 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON [Dir14] Sjoerd Dirksen. Dimensionality reduction with subgaussian matrices: a unified theory. CoRR, abs/1402.3973, 2014. [Dir15] Sjoerd Dirksen. Tail bounds via generic chaining. Electron. J. Probab., 20:no. 53, 1–29, 2015. [DKS10] Anirban Dasgupta, Ravi Kumar, and Tam´as Sarl´os. A sparse Johnson-Lindenstrauss transform. In Proceedings of the 42nd ACM Symposium on Theory of Computing (STOC), pages 341–350, 2010. [DMIMW12] Petros Drineas, Malik Magdon-Ismail, Michael Mahoney, and David Woodruff. Fast approximation of matrix coherence and statistical leverage. Journal of Machine Learning Research, 13:3475–3506, 2012. IEEE Trans. Inf. Theory, [Don06] David Donoho. Compressed sensing. 52(4):1289–1306, 2006. [Dud67] Richard M. Dudley. The sizes of compact subsets of Hilbert space and continuity of Gaussian processes. J. Functional Analysis, 1:290–330, 1967. [EW13] Armin Eftekhari and Michael B Wakin. New analysis of manifold em- beddings and signal recovery from compressive measurements. CoRR, abs/1306.4748, 2013. [Fer75] Xavier Fernique. Regularit´e des trajectoires des fonctions al´eatoires gaussiennes. Lecture Notes in Math., 480:1–96, 1975. [Fig76] T. Figiel. On the moduli of convexity and smoothness. Studia Math., 56(2):121–155, 1976. [FR13] Simon Foucart and Holger Rauhut. A Mathematical Introduction to Compressive Sensing. Birkhauser, Boston, 2013. [GMPTJ07] O. Gu´edon, S. Mendelson, A. Pajor, and N. Tomczak-Jaegermann. Subspaces and orthogonal decompositions generated by bounded or- thogonal systems. Positivity, 11(2):269–283, 2007. [GMPTJ08] O. Gu´edon, S. Mendelson, A. Pajor, and N. Tomczak-Jaegermann. Majorizing measures and proportional subsets of bounded orthonor- mal systems. Rev. Mat. Iberoam., 24(3):1075–1095, 2008. [Gor88] Yehoram Gordon. On Milman’s inequality and random subspaces which escape through a mesh in Rn. Geometric Aspects of Functional Analysis, pages 84–106, 1988. [HIM12] Sariel Har-Peled, Piotr Indyk, and Rajeev Motwani. Approximate nearest neighbor: Towards removing the curse of dimensionality. The- ory of Computing, 8(1):321–350, 2012. [HUL01] Jean-Baptiste Hiriart-Urruty and Claude Lemar´echal. Fundamentals of convex analysis. Springer-Verlag, Berlin, 2001. [HWB07] C. Hegde, M. Wakin, and R. Baraniuk. Random projections for man- ifold learning. In Advances in neural information processing systems, pages 641–648, 2007. [Ind01] Piotr Indyk. Algorithmic applications of low-distortion geometric embeddings. In Proceedings of the 42nd Annual Symposium on Foun- dations of Computer Science (FOCS), pages 10–33, 2001. [IR13] Piotr Indyk and Ilya Razenshteyn. On model-based RIP-1 matrices. In Proceedings of the 40th International Colloquium on Automata, Languages and Programming (ICALP), pages 564–575, 2013. [JL84] William B. Johnson and Joram Lindenstrauss. Extensions of Lip- schitz mappings into a Hilbert space. Contemporary Mathematics, 26:189–206, 1984. [Kah68] Jean-Pierre Kahane. Some Random Series of Functions. Heath Math. Monographs. Cambridge University Press, 1968. TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 49 [KM05] Bo’az Klartag and Shahar Mendelson. Empirical processes and ran- dom projections. J. Funct. Anal., 225(1):229–245, 2005. [KMR14] F. Krahmer, S. Mendelson, and Holger Rauhut. Suprema of chaos processes and the restricted isometry property. Comm. Pure Appl. Math., 67(11):1877–1904, 2014. [KN10] Daniel M. Kane and Jelani Nelson. A derandomized sparse Johnson- Lindenstrauss transform. CoRR, abs/1006.3585, 2010. [KN14] Daniel M. Kane and Jelani Nelson. Sparser Johnson-Lindenstrauss transforms. Journal of the ACM, 61(1):4, 2014. [KW11] Felix Krahmer and Rachel Ward. New and improved Johnson- Lindenstrauss embeddings via the Restricted Isometry Property. SIAM J. Math. Anal., 43(3):1269–1281, 2011. [KZM02] Geza Kov´acs, Shay Zucker, and Tsevi Mazeh. A box-fitting algo- rithm in the search for periodic transits. Astronomy and Astrophysics, 391:369–377, 2002. [LDFU13] Yichao Lu, Paramveer Dhillon, Dean Foster, and Lyle Ungar. Faster ridge regression via the subsampled randomized Hadamard trans- form. In Proceedings of the 26th Annual Conference on Advances in Neural Information Processing Systems (NIPS), 2013. [LN14] Kasper Green Larsen and Jelani Nelson. The Johnson-Lindenstrauss lemma is optimal for linear dimensionality reduction, 2014. Manu- script. [LP86] Fran¸cois Lust-Piquard. In´egalit´es de Khintchine dans Cp (1 < p < [LPP91] Fran¸cois Lust-Piquard and Gilles Pisier. Noncommutative Khintchine ∞). C. R. Math. Acad. Sci. Paris, 303(7):289–292, 1986. and Paley inequalities. Ark. Mat., 29(2):241–260, 1991. [LS13] Yin Tat Lee and Aaron Sidford. Matching the universal barrier with- out paying the costs : Solving linear programs with o(sqrt(rank)) linear system solves. CoRR, abs/1312.6677, 2013. [Mat08] Jir´ı Matousek. On variants of the Johnson-Lindenstrauss lemma. Random Struct. Algorithms, 33(2):142–156, 2008. [MM13] Xiangrui Meng and Michael W. Mahoney. Low-distortion subspace embeddings in input-sparsity time and applications to robust linear regression. In Proceedings of the 45th ACM Symposium on Theory of Computing (STOC), pages 91–100, 2013. [MPTJ07] S. Mendelson, A. Pajor, and N. Tomczak-Jaegermann. Reconstruc- tion and subgaussian operators in asymptotic geometric analysis. Geom. Funct. Anal., 17(4):1248–1282, 2007. [MV97] Reinhold Meise and Dietmar Vogt. Introduction to Functional Anal- ysis. Oxford Graduate Texts in Mathematics (Book 2). Oxford Uni- versity Press, 1997. [NN13a] Jelani Nelson and Huy L. Nguyen. OSNAP: Faster numerical linear algebra algorithms via sparser subspace embeddings. In Proceedings of the 54th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 117–126, 2013. [NN13b] Jelani Nelson and Huy L. Nguyen. Sparsity lower bounds for dimensionality-reducing maps. In Proceedings of the 45th ACM Sym- posium on Theory of Computing (STOC), pages 101–110, 2013. [NPW14] Jelani Nelson, Eric Price, and Mary Wootters. New constructions of RIP matrices with fast multiplication and fewer rows. In Proceedings of the 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), 2014. 50 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON [NT09] Deanna Needell and Joel A. Tropp. CoSaMP: Iterative signal recovery from incomplete and inaccurate samples. Appl. Comput. Harmon. Anal., 26:301–332, 2009. [PBMID13] Saurabh Paul, Christos Boutsidis, Malik Magdon-Ismail, and Petros Drineas. Random projections for support vector machines. In Pro- ceedings of the 16th International Conference on Artificial Intelligence and Statistics (AISTATS), pages 498–506, 2013. [Pie72] Albrecht Pietsch. Theorie der Operatorenideale (Zusammenfassung). Friedrich-Schiller-Universitat Jena, 1972. [Pis86] Gilles Pisier. Probabilistic methods in the geometry of Banach spaces. Probability and Analysis, Lecture Notes in Math., 1206:167–241, 1986. [Pis81] Gilles Pisier. Remarques sur un r´esultat non public de B. Maurey. S´eminaire d’analyse fonctionnelle, Exp. V., 1980/81. [PTJ86] Alain Pajor and Nicole Tomczak-Jaegermann. Subspaces of small codimension of finite dimensional Banach spaces. Proc. Amer. Math. Soc., 97:637–642, 1986. [PW14] M. Pilanci and M. Wainwright. Randomized sketches of convex pro- grams with sharp guarantees. arXiv, abs/1404.7203, 2014. [Roc70] R. Rockafellar. Convex Analysis. Princeton University Press, 1970. [RS00] Sam T. Roweis and Lawrence K. Saul. Nonlinear dimensionality re- duction by locally linear embedding. Science, 290:2323–2326, 2000. [RV07] Mark Rudelson and Roman Vershynin. Sampling from large matrices: An approach through geometric functional analysis. Journal of the ACM, 54(4), 2007. [RV08] Mark Rudelson and Roman Vershynin. On sparse reconstruction from Fourier and Gaussian measurements. Communications on Pure and Applied Mathematics, 61(8):1025–1045, 2008. [Sar06] Tam´as Sarl´os. Improved approximation algorithms for large matrices via random projections. In Proceedings of the 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 143– 152, 2006. [SS11] Daniel A. Spielman and Nikhil Srivastava. Graph sparsification by effective resistances. SIAM J. Comput., 40(6):1913–1926, 2011. [Tal05] Michel Talagrand. The generic chaining: upper and lower bounds of stochastic processes. Springer Verlag, 2005. [TdSL00] Joshua B. Tenenbaum, Vin de Silva, and John C. Langford. A global geometric framework for nonlinear dimensionality reduction. Science, 290(5500):2319–2323, 2000. [Tib96] Robert Tibshirani. Regression shrinkage and selection via the Lasso. Journal of the Royal Statistical Society, Series B, 58(1):267–288, 1996. [Tro08] Joel A. Tropp. The random paving property for uniformly bounded matrices. Studia Math., 185:67–82, 2008. [Tro11] Joel A. Tropp. Improved analysis of the subsampled randomized hadamard transform. Adv. Adapt. Data Anal., 3(1–2):115–126, 2011. [VJ11] Andrew Vanderburg and John Asher Johnson. A technique for ex- tracting highly precise photometry for the two-wheeled Kepler mis- sion. CoRR, abs/1408.3853, 2011. [WDL+09] Kilian Q. Weinberger, Anirban Dasgupta, John Langford, Alexan- der J. Smola, and Josh Attenberg. Feature hashing for large scale multitask learning. In Proceedings of the 26th Annual International Conference on Machine Learning (ICML), pages 1113–1120, 2009. TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 51 [Woo14] David P. Woodruff. Personal communication, 2014. [WZ13] David P. Woodruff and Qin Zhang. Subspace embeddings and ℓp regression using exponential random variables. In Proceedings of the 26th Conference on Learning Theory (COLT), 2013. Appendix A. Tools from probability theory We collect some useful tools from probability theory that are used throughout the text. For further reference we record an easy consequence of Markov’s inequality. Lemma 27. If ξ is a real-valued random variable satisfying (Eξp)1/p ≤ a1p2 + a2p3/2 + a3p + a4p1/2 + a5, for all p ≥ p0, for some 0 ≤ a1, a2, a3, a4, a5 < ∞, then P(ξ ≥ e(a1w2 + a2w3/2 + a3w + a4√w + a5)) ≤ exp(−w) (w ≥ p0). (A.1) Let us call σ = (σi)n i=1 a Rademacher vector if its entries are independent Rade- macher random variables. Khintchine’s inequality states that for any 1 ≤ p < ∞ (A.2) σ hσ, xip)1/p ≤ Cpkxk2 (E (x ∈ Rn), p n Xi=1 Sp(cid:17)1/p where Cp ≤ √p. The noncommutative Khintchine inequality [LP86, LPP91] says that for any A1, . . . , An ∈ Rm×n and 1 ≤ p < ∞ AiA∗i(cid:17)1/2(cid:13)(cid:13)(cid:13)Spo, A∗i Ai(cid:17)1/2(cid:13)(cid:13)(cid:13)Sp ,(cid:13)(cid:13)(cid:13)(cid:16)Xi (cid:16) E(cid:13)(cid:13)(cid:13) AiA∗i(cid:17)1/2(cid:13)(cid:13)(cid:13)o (A.3) A∗i Ai(cid:17)1/2(cid:13)(cid:13)(cid:13),(cid:13)(cid:13)(cid:13)(cid:16)Xi (cid:16) E(cid:13)(cid:13)(cid:13) ≤ C√p maxn(cid:13)(cid:13)(cid:13)(cid:16)Xi ≤ C√p maxn(cid:13)(cid:13)(cid:13)(cid:16)Xi where k · kSp is the p-th Schatten norm. In particular, if p ≥ max{log m, log n}, then σiAi(cid:13)(cid:13)(cid:13) σiAi(cid:13)(cid:13)(cid:13) Xi=1 as k·k ≤ k·kSp ≤ ek·k in this case. Khintchine’s inequality and its noncommutative if ζ1, . . . , ζn are version are frequently used in combination with symmetrization: X-valued random variables and σ is a Rademacher vector, then for any 1 ≤ p < ∞, (A.4) p(cid:17)1/p E n n . Xi=1 ζ (cid:13)(cid:13)(cid:13) (cid:16) E ζi − E ζi(cid:13)(cid:13)(cid:13) p X(cid:17)1/p ≤(cid:16) E ζ n Xi=1 σ(cid:13)(cid:13)(cid:13) p σiζi(cid:13)(cid:13)(cid:13) X(cid:17)1/p The following decoupling inequality is elementary to prove (see e.g. [FR13, Theorem 8.11]). Let M ⊂ Rn×n, let σ be an n-dimensional Rademacher vector and σ′ an independent copy. Then, for any 1 ≤ p < ∞ (E σ sup M∈Mσ∗M σ − E(σ∗M σ)p)1/p ≤ 4( E σ,σ′ sup M∈M(σ′)∗M σp)1/p. (A.5) A special case of this bound, combined with Khintchine’s inequality, implies the following. Lemma 28. Let A ∈ Rm×n and let σ be an n-dimensional Rademacher vector. For any p ≥ 1, Proof. By decoupling, (E kAσkp 2)1/p ≤ kAkF + 2p2pkAk. (E kAσkp 2)2/p ≤ (E ≤ 4( E σ σ∗A∗Aσ − E σ∗A∗Aσp/2)2/p + E(σ∗A∗Aσ) σ,σ′ (σ′)∗A∗Aσp/2)2/p + kAk2 F 52 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON and therefore Khintchine’s inequality implies that (E kAσkp σ kA∗Aσkp/2 σ kAσkp Solving this quadratic inequality yields the claim. 2)2/p ≤ 4pp/2(E ≤ 2p2pkAk(E 2 )2/p + kAk2 2)1/p + kAk2 F . F (cid:3) To conclude we collect some tools to estimate covering numbers. Given two closed sets U, V ⊂ Rn, we let the covering number N (U, V ) be the minimal number of translates of V needed to cover U . If V is closed, convex and symmetric, then we can associate with it a semi-norm In this case it is customary to write kxkV = inf{t > 0 : x ∈ tV }. N (U,k · kV , ε) := N (U, εV ) (ε > 0). Conversely, if k · k is a semi-norm, then V = {x ∈ Rn : kxk ≤ 1} is closed, convex and symmetric, and k · kV = k · k. As a first tool we state two elementary bounds that follow from volumetric comparision. If k · k is any semi-norm on Rn and Bk·k is the associated unit ball, (A.6) 2 (0 < ε ≤ 1). (cid:16) 1 ε(cid:17)n ≤ N (Bk·k,k · k, ε) ≤(cid:16)1 + ε(cid:17)n The following is known as Sudakov minoration or the dual Sudakov inequality [BLM89, Proposition 4.2], [PTJ86]. Eq. (B.1) in Appendix B gives a definition of the polar V ◦. Lemma 29. Let V ⊂ Rn be closed, convex and symmetric and let g be a standard Gaussian vector. Then, sup ε>0 ε[log N (Bℓn 2 ,k · kV , ε)]1/2 . E sup x∈V ◦hg, xi. We will also use the following duality for covering numbers from [BPSTJ89, Proposition 4]. Lemma 30. Let U, V ⊂ Rn be closed, bounded, convex and symmetric. For every θ ≥ ε, with r ≤ (27T2(k · kV ))2(1 + log(θ/ε)). N (U,k · kV , ε) ≤ N (U,k · kV , θ)[N (V ◦,k · kU ◦ , ε/8)]r, Finally, we state Maurey’s lemma [Pis81, Car85] and its usual proof. Lemma 31. Let k · k be a semi-norm and T2(k · k) be its type-2 constant. Let Ω be a set of points x each with kxk ≤ 1. Then for any z ∈ conv(Ω) and any integer ℓ > 0 there exist y1, . . . , yℓ ∈ Ω with 1 Xi=1 ℓ Proof. Write z =Pi λixi for 0 < λi ≤ 1, Pi λi = 1, xi ∈ Ω. Let y = (y1, . . . , yℓ) have i.i.d. entries from the distribution in which yj = xj with probability λj . Let σ be a Rademacher vector and let g be a Gaussian vector. By symmetrization, yi(cid:13)(cid:13)(cid:13) ≤ (cid:13)(cid:13)(cid:13)z − T2(k · k) √ℓ ℓ 1 ℓ ℓ Xi=1 E y(cid:13)(cid:13)(cid:13)z − yi(cid:13)(cid:13)(cid:13) ≤ = 2 ℓ 2 ℓ E σ,y(cid:13)(cid:13)(cid:13) σ,y(cid:13)(cid:13)(cid:13) E ℓ ℓ σiyi(cid:13)(cid:13)(cid:13) Xi=1 σigiyi(cid:13)(cid:13)(cid:13) . Xi=1 E g ℓ Xi=1 1 ℓ E y,g(cid:13)(cid:13)(cid:13) giyi(cid:13)(cid:13)(cid:13) ≤ T2(k · k) √ℓ . TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 53 (cid:3) Appendix B. Tools from convex analysis In this appendix we recall some basic facts from convex analysis. More details can be found in e.g. [HUL01, Roc70]. For any set S ⊂ Rn we let conv(S) denote the closed convex hull of S, i.e., the closure of the set of all convex combinations of elements in S. The polar of a set S is S◦ = {y ∈ Rn : hx, yi ≤ 1 for all x ∈ S}, (B.1) which is always closed and convex. A set K is called a cone if αK ⊂ K for all α > 0. It is called a convex cone if it is, in addition, convex. We use cone(S) to denote the closed convex cone generated by a set S. The polar K◦ of a convex cone K can be written as K◦ = {y ∈ Rn : hx, yi ≤ 0 for all x ∈ K} and is always a closed convex cone. The bipolar theorem states that K◦◦ is equal to the closure K of K (cf. [MV97, Theorem 6.11]). Let C be a closed convex set in Rn. The tangent cone TC(x) to C at x ∈ C is the closed cone generated by C − {x}, i.e., TC(x) = cone{d ∈ Rn : d = y − x, y ∈ C}. Clearly, if x is in the interior of C, then TC(x) = Rn. The normal cone NC(x) to C at x ∈ C is given by NC(x) = {s ∈ Rn : hs, y − xi ≤ 0 ∀y ∈ C}. It is easy to see that (NC(x))◦ = TC(x). Since TC(x) is closed, the bipolar theorem implies that (TC(x))◦ = NC(x). If f : Rn → R is any function, then a vector ξ ∈ Rn is called a subgradient of f at x ∈ dom(f ) if for any y ∈ dom(f ) f (y) ≥ f (x) + hξ, y − xi. (B.2) The set of all subgradients of f at x is called the subdifferential of f at x and denoted by ∂f (x). If f : Rn → R∪{∞} is a proper convex function (i.e., f (x) < ∞ for some x ∈ Rn), then the descent cone D(f, x) of f at x ∈ Rn is defined by D(f, x) = [t>0 {d ∈ Rn : f (x + td) ≤ f (x)}. The descent cone is always a convex cone, but it may not be closed. Theorem 32. [Roc70, Theorem 23.7] Let f : Rn → R be a proper convex function. Suppose that the subdifferential ∂f (x) is nonempty and does not contain 0. Then, D(f, x)◦ = cone(∂f (x)) = [t≥0 t∂f (x). Let k · k be any norm on Rn and set C = {x ∈ Rn : kxk ≤ R}. Then, for any x ∈ C with kxk = R, TC(x) is equal to the descent cone of k · k at x. By Theorem 32 and the bipolar theorem this implies that TC(x) = [cone(∂k · k(x))]◦. (B.3) Let k · k∗ denote the dual norm of k · k, i.e., kyk∗ = sup kxk≤1hx, yi. 54 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON It is easy to verify from the definition (B.2) that ∂k · k(x) =({y ∈ Rn : kyk∗ ≤ 1}, if x = 0, {y ∈ Rn : kyk∗ ≤ 1 and hy, xi = kxk}, otherwise. Using these tools, we can readily calculate the tangent cone to an ℓ2,1-ball. Example 33. Consider the ℓ2,1-norm defined in (6.5) and its dual norm, the ℓ2,∞- norm. Set C = {x ∈ RbD : kxk2,1 ≤ R}. Suppose that x 6= 0 and let S ⊂ [b] be the indices corresponding to nonzero blocks of x. For z ∈ RbD, let zS be the vector (zS)Bi =(zBi 0 if i ∈ S if i ∈ Sc. Then, ∂k · k2,1(x) = {z ∈ RbD : kzk2,∞ ≤ 1 and hz, xi = kxk2,1} = {z ∈ RbD : kzSck2,∞ ≤ 1 and zBi = xBi /kxBik2 for all i ∈ S}. If x ∈ RbD satisfies kxk2,1 = R, then by (B.3), =ny ∈ RbD : Xi∈SD xBi kxBik2 TC(x) = {y ∈ RbD : hz, yi ≤ 0 for all z ∈ ∂k · k2,1(x)} , yBiE + kySck2,1 ≤ 0o. kyk2,1 = kySk2,1 + kySck2,1 ≤ 2kySk2,1 ≤ 2pS kyk2. In particular, any y ∈ TC(x) satisfies Appendix C. Sketching least squares programs with an FJLT In this appendix we study sketching of least squares programs using a fast Johnson-Lindenstrauss transform (FJLT). We show in Theorem 40 that for ℓ2,1- constrained least squares minimization, one can achieve the same sketching dimen- sion as in the sparse case (cf. Section 6.2). We first recall the definition of the FJLT. Let F be the discrete Fourier transform. Let θ1, . . . , θn : Ωθ → {0, 1} be independent random selectors satisfying Pθ(θi = 1) = m/n. Let σ1, . . . , σn : Ωσ → {−1, 1} be independent Rademacher random variables. The FJLT is defined by Ψ = ΘF Dσ, where Θ = pn/m diag((θi)n i=1) and Dσ = diag((σi)n i=1). Here diag((xi)) denotes the diagonal matrix with the elements of the sequence (xi) on its diagonal. To prove Theorem 40 we apply Lemma 11 using a suitable upper bound for Z2 and lower bound for Z1. To obtain the latter, we use the following chaining estimate. Let T be some index set. For a given set (xt,i)t∈T,1≤i≤n in R, we define a semi-metric ρx on T by and the denote the associated radius by ρx(t, s) = max 1≤i≤nxt,i − xs,i dx(T ) = sup t∈T max 1≤i≤nxt,i. For every 1 ≤ i ≤ n we fix a probability space (Ωi,Fi, Pi) and let (Ω,F , P) denote the associated product space. The following observation was proven in the special case p = 1 in [GMPTJ07, Theorem 1.2]. TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 55 Lemma 34. Fix 1 ≤ p < ∞. For every t ∈ T and 1 ≤ i ≤ n let Xt,i ∈ L2p(Ωi). Then, n Xi=1 t∈T(cid:12)(cid:12)(cid:12) (cid:16) E sup X 2 t,i − E X 2 . (E γ2p 2 (T, ρX ))1/p + sup (E γp 2 (T, ρX))1/p E X 2 t,i(cid:17)1/2 + √p sup (E dp X (T ))1/p + p(E d2p X (T ))1/p. Proof. Let (ri)i≥1 be a Rademacher sequence. By symmetrization, t,i − E X 2 X 2 ≤ 2(cid:16) E E By Hoeffding’s inequality, we have for any s, t ∈ T , t,i − X 2 t,i − X 2 ri(X 2 (X 2 r n . sup riX 2 Xi=1 t,i(cid:12)(cid:12)(cid:12) p(cid:17)1/p t∈T(cid:12)(cid:12)(cid:12) s,i)2(cid:17)1/2(cid:17) ≤ exp(−u2/2). (C.1) E X 2 t,i(cid:12)(cid:12)(cid:12) p(cid:17)1/p t∈T(cid:16) n Xi=1 t∈T(cid:16) n t,i(cid:17)1/2 Xi=1 t,i(cid:12)(cid:12)(cid:12) p(cid:17)1/p s,i) ≥ u(cid:16) n Xi=1 s,i)2(cid:17)1/2 ≤ t∈T(cid:16) n √2 sup Xi=1 X 2 t,i(cid:17)1/2 ρX (t, s) t,i)t∈T is subgaussian with respect to the semi-metric t,i − X 2 i=1 riX 2 ρ∗(s, t) = √2 sup t∈T(cid:16) n Xi=1 X 2 t,i(cid:17)1/2 ρX (s, t). n Xi=1 t∈T(cid:12)(cid:12)(cid:12) (cid:16) E sup Pr(cid:16) n Xi=1 (cid:16) n Xi=1 we conclude that (Pn Since (X 2 By Lemma 12, dX (T ) X 2 γ2(T, ρX) + √p sup t∈T(cid:16) n Xi=1 t,i(cid:17)1/2 t,i(cid:12)(cid:12)(cid:12) 1/2(cid:16)γ2(T, ρX ) + √pdX (T )(cid:17) t,i(cid:17)1/2(cid:16)γ2(T, ρX ) + √pdX (T )(cid:17). E X 2 (cid:16) E r n sup n X 2 + sup . sup riX 2 ≤ sup t,i(cid:12)(cid:12)(cid:12) t∈T(cid:12)(cid:12)(cid:12) p(cid:17)1/p Xi=1 t∈T(cid:16) n t,i(cid:17)1/2 Xi=1 t∈T(cid:12)(cid:12)(cid:12) Xi=1 t,i − E X 2 X 2 t∈T(cid:16) n Xi=1 t,i(cid:12)(cid:12)(cid:12) p(cid:17)1/p t,i(cid:12)(cid:12)(cid:12) t,i − E X 2 X 2 t,i(cid:17)1/2(cid:16)(E γp n n t∈T(cid:12)(cid:12)(cid:12) (cid:16) E sup Xi=1 t,i − E X 2 X 2 t∈T(cid:12)(cid:12)(cid:12) .(cid:16) E sup Xi=1 t∈T(cid:16) n Xi=1 E X 2 + sup Taking Lp-norms on both sides, using (C.1) and applying Holder’s inequality yields p(cid:17)1/2p(cid:16)(E γ2p 2 (T, ρX))1/p + √p(E dp 2 (T, ρX))1/2p + √p(E d2p X (T ))1/p(cid:17). X (T ))1/2p(cid:17) Solving this quadratic inequality yields the result. (cid:3) 56 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON To estimate the γ2-functional occuring in Lemma 34 we use a covering number estimate from [GMPTJ08]. Recall the following definitions. Let E be a Banach space and let E∗ denote its dual space. The modulus of convexity of E is defined by 1 δE(ε) = infn1 − We say that E is uniformly convex if δE(ε) > 0 for all ε > 0 and that E is uniformly convex of power type 2 with constant λ if δE(ε) ≥ ε2/(8λ2) for all ε > 0. The following observation is due to Figiel [Fig76, Proposition 24]. 2kx + yk, kxk = 1, kyk = 1, kx − yk > εo (0 ≤ ε ≤ 2). Lemma 35. Suppose that E is a p-convex and q-concave Banach lattice for some 2√p−1}. Then, δE(ε) ≥ 1 < p ≤ q < ∞. Set r = max{2, q} and K = max{2, r−1K−rεr for all 0 ≤ ε ≤ 2. Using the Holder-Minkowski inequalities one readily checks that ℓ2,p = ℓp(ℓ2) is p-convex and 2-concave if 1 < p ≤ 2. Therefore, δℓ2,p(ε) ≥ 1 Lemma 36. [GMPTJ08, Lemma 1] Let E be uniformly convex of power type 2 with constant λ. Let T2(E∗) be the type 2 constant of E∗. Consider v1, . . . , vN ∈ E∗ and define an associated semi-metric on E by 8 (p − 1)ε2. ρv(x, y) = max 1≤i≤N hvi, x − yi. Set ν = max1≤i≤N kvikE∗ and let U ⊂ BE. Then, for all t > 0, log1/2(2N (U, ρv, t)) . νλ2T2(E∗) log1/2(N )t−1. We can now estimate the parameter Z1. (C.2) (C.3) Lemma 37. Set d = bD. Let Ψ be the FJLT, fix A ∈ Rn×d and let K ⊂ Rd. Consider the norm A defined in (6.6) and set β = (log2(η−1) + log(b) + log(n)) log(n) log3(b) log2(d). (C.4) (C.5) sup 2,1i, x∈K :kAxk2=1kxk2 If m & βε−2A2h 2 ≤ kΨxk2 then with probability at least 1 − η we have 2 ≤ (1 + ε)kxk2 2, (1 − ε)kxk2 In particular, Z1(A, Ψ,K) ≥ 1 − ε. Proof. Let Fi denote the i-th row of F . Since 2 = kxk2 2, 2 = kDσxk2 θ kΨxk2 E for all x ∈ AK ∩ Sn−1. for all x ∈ Rn, we have n = m sup sup x∈AK∩Sn−1(cid:12)(cid:12)(cid:12)kΨxk2 2(cid:12)(cid:12)(cid:12) 2 − kxk2 θiDr n x∈AK∩Sn−1(cid:12)(cid:12)(cid:12) Xi=1 θiDr n x∈K∩A−1(Sn−1)(cid:12)(cid:12)(cid:12) Xi=1 We apply Lemma 34 (with Xx,i := hθip n x∈AK∩Sn−1(cid:12)(cid:12)(cid:12)kΨxk2 2(cid:12)(cid:12)(cid:12) p(cid:17)1/p 2 − kxk2 (cid:16) E sup sup = n θ θ m θiDr n DσFi, xE2(cid:12)(cid:12)(cid:12) DσFi, xE2 − E θiDr n A∗DσFi, xE2 m m A∗DσFi, xi) to find − E m θ A∗DσFi, xE2(cid:12)(cid:12)(cid:12). TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 57 ≤ (E θ ≤ γ2 γp 2 (K ∩ A−1(Sn−1), ρX ))1/p d2p dp X (K ∩ A−1(Sn−1))1/p + p(E X (K ∩ A−1(Sn−1))1/p γ2p 2 (K ∩ A−1(Sn−1), ρX ))1/p + (E + √p(E 2 (K ∩ A−1(Sn−1), ρv) + γ2(K ∩ A−1(Sn−1), ρv) + √pdv(K ∩ A−1(Sn−1)) + pd2 v(K ∩ A−1(Sn−1)), θ θ θ where we have set vi =p n m A∗DσFi, defined ρv as in (C.2) and used that ρX ≤ ρv uniformly. Set d2,1 = dk·k2,1(K ∩ A−1(Sn−1)) and ν := max1≤i≤n kvik2,∞. Clearly (C.6) dv(K ∩ A−1(Sn−1)) ≤ d2,1ν. We estimate the γ2-functional by an entropy integral γ2(K ∩ A−1(Sn−1), ρv) .Z t∗ 0 N (K ∩ A−1(Sn−1), ρv, t) +Z ∞ t∗ N (K ∩ A−1(Sn−1), ρv, t) dt. The first integral we estimate using the volumetric bound 2,p and E∗ = ℓd N (K ∩ A−1(Sn−1), ρv, t) ≤ N (K ∩ A−1(Sn−1), νk · k2,1, t) ≤(cid:16)1 + For the second integral we set p = log(b)/(log(b) − 1) and apply Lemma 36 with E = ℓd 2,p′, where p′ = log(b). Note that k · k2,∞ ≤ k · k2,p′ ≤ ek · k2,∞ and therefore T2(E∗) ≤ e log1/2(b). Also, by the remark after Lemma 35 we have λ2 = (p − 1)−1 = log(b) − 1. By (C.3), , ρv, t)) ≤ log1/2(N (Bℓd , ρv, t)) . ν log3/2(b) log1/2(n)t−1. log1/2(N (Bℓd (cid:17)d 2νd2,1 (C.7) 2,p 2,1 t . Since K ∩ A−1(Sn−1) ⊂ d2,1Bℓd 2,1 , we arrive at γ2(K ∩ A−1(Sn−1), ρv) 0 . √dZ t∗ log1/2(cid:16)1 + √dt∗ log1/2(e + 2et−1 ≤ Take t∗ = d−1/2νd2,1 to obtain γ2(K ∩ A−1(Sn−1), ρv) 2νd2,1 t (cid:17) dt +Z νd2,1 t∗ νd2,1 log1/2(n) log3/2(b)t−1 dt ∗ νd2,1) + νd2,1 log1/2(n) log3/2(b) log(t−1 ∗ νd2,1). . νd2,1 log1/2(e + 2e√d) + νd2,1 log1/2(n) log3/2(b) log(√d) . νd2,1 log1/2(n) log3/2(b) log(d). In conclusion, (cid:16) E θ sup 2 − kxk2 x∈AK∩Sn−1(cid:12)(cid:12)(cid:12)kΨxk2 p(cid:17)1/p + √pνd2,1 + pν2d2 . ν2d2 2(cid:12)(cid:12)(cid:12) 2,1. 2,1 log(n) log3(b) log2(d) + νd2,1 log1/2(n) log3/2(b) log(d) Since √nFij ≤ 1, Khintchine’s inequality implies that νp)1/p (E σ = = (E σ 1 √m √m(cid:16) E 1 σ max 1≤i≤n max 1≤i≤n √nkA∗DσFikp 2,∞)1/p 1≤ℓ≤b(cid:16) Xk∈Bℓ(cid:12)(cid:12)(cid:12) Xj=1 max n σjAjk√nFij(cid:12)(cid:12)(cid:12) 2(cid:17)p/2(cid:17)1/p (C.8) (C.9) 58 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON 1 √m 1 √m ≤ ≤ (√p + log1/2(b) + log1/2(n)) max 1≤i≤n (√p + log1/2(b) + log1/2(n)) max Ajk√nFij2(cid:17)1/2 n max 1≤ℓ≤b(cid:16) Xk∈Bℓ Xj=1 Xj=1 Ajk2(cid:17)1/2 n 1≤ℓ≤b(cid:16) Xk∈Bℓ . (C.10) Taking Lp(Ωσ)-norms in (C.9) and using (C.10), we conclude that (cid:16) E θ,σ sup x∈AK∩Sn−1(cid:12)(cid:12)(cid:12)kΨxk2 . 1 m 2 − kxk2 2(cid:12)(cid:12)(cid:12) p(cid:17)1/p + 2,1 log(n) log3(b) log2(d) (√p + log1/2(b) + log1/2(n))2A2d2 1 √m + √p (√p + log1/2(b) + log1/2(n))Ad2,1 log1/2(n) log3/2(b) log(d) 1 √m (√p + log1/2(b) + log1/2(n))2A2d2 (√p + log1/2(b) + log1/2(n))Ad2,1 1 m 2,1. + p The result now follows from Lemma 27 and taking w = log(η−1) in (A.1). (cid:3) To prove an upper bound for Z2 we use the following variation of Lemma 34. Note that the element u below does not need to be in the index set T . Lemma 38. For every t ∈ T and 1 ≤ i ≤ n let Xt,i ∈ L2p(Ωi). Fix also Xu,i ∈ Lp(Ωi). For any 1 ≤ p < ∞, n t∈T(cid:12)(cid:12)(cid:12) (cid:16) E sup Xi=1 .(cid:16)√p(cid:16) E max Xt,iXu,i − E(Xt,iXu,i)(cid:12)(cid:12)(cid:12) 1≤i≤nXu,i2p(cid:17)1/(2p) ∗(cid:16)(E γ2p p(cid:17)1/p +(cid:16) n Xi=1 E X 2 u,i(cid:17)1/2(cid:17) 2 (T, ρX))1/(2p) + √p(E d2p X (T ))1/(2p)(cid:17). (C.11) Proof. Let (ri) be a Rademacher sequence. By Hoeffding’s inequality, we have for any s, t ∈ T and w ≥ 0, Pr(cid:16) n Xi=1 Since ri(Xt,iXu,i − Xs,iXu,i) ≥ w(cid:16) n Xi=1 (cid:16) n (Xt,iXu,i − Xs,iXu,i)2(cid:17)1/2 Xi=1 (Xt,iXu,i − Xs,iXu,i)2(cid:17)1/2(cid:17) ≤ e−w2/2. ≤(cid:16) n Xi=1 u,i(cid:17)1/2 ρX (t, s), X 2 i=1 riXt,iXu,i)t∈T is subgaussian with respect to the semi- we conclude that (Pn metric ρX (s, t). n X 2 ρ∗(s, t) =(cid:16) n u,i(cid:17)1/2 Xi=1 .(cid:16) n riXt,iXu,i(cid:12)(cid:12)(cid:12) u,i(cid:17)1/2 p(cid:17)1/p Xi=1 Xi=1 Xt,iXu,i − E(Xt,iXu,i)(cid:12)(cid:12)(cid:12) p(cid:17)1/p X 2 By Lemma 12, r sup t∈T(cid:12)(cid:12)(cid:12) (cid:16) E t∈T(cid:12)(cid:12)(cid:12) (cid:16) E sup Xi=1 n Using symmetrization (A.4), this implies that γ2(T, ρX ) + √pdX (T ). TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 59 X (T ))1/(2p)(cid:17). E X 2 u,i. n Xi=1 E X 2 u,i(cid:17)1/2 . By symmetrization and Khintchine’s inequality, n r n n sup X 2 X 2 riXt,iXu,i(cid:12)(cid:12)(cid:12) t∈T(cid:12)(cid:12)(cid:12) p(cid:17)1/p ≤ 2(cid:16) E E Xi=1 .(cid:16) E(cid:16) n u,i(cid:17)p(cid:17)1/(2p)(cid:16)(E γ2p 2 (T, ρX ))1/(2p) + √p(E d2p Xi=1 (cid:16) E(cid:16) n u,i(cid:17)p(cid:17)1/p Xi=1 u,i(cid:12)(cid:12)(cid:12) ≤(cid:16) E(cid:12)(cid:12)(cid:12) Xi=1 X 2 u,i − E X 2 u,i(cid:12)(cid:12)(cid:12) r(cid:12)(cid:12)(cid:12) p(cid:17)1/p ≤ 2(cid:16) E E Xi=1 u,i(cid:12)(cid:12)(cid:12) ≤ 2√p(cid:16) E(cid:12)(cid:12)(cid:12) p/2(cid:17)1/p Xi=1 1≤i≤nXu,i2p(cid:17)1/(2p)(cid:16) E(cid:16) n ≤ 2√p(cid:16) E max Xi=1 u,i(cid:17)p(cid:17)1/(2p) u,i(cid:17)p(cid:17)1/(2p) +(cid:16) n Xi=1 p(cid:17)1/p Xi=1 Xi=1 ≤ 2√p(cid:16) E max 1≤i≤nXu,i2p(cid:17)1/(2p) (cid:16) E(cid:16) n Xi=1 Xi=1 E X 2 u,i E X 2 u,i E X 2 u,i riX 2 X 2 X 4 X 2 + + + n + n n n Solving this quadratic inequality yields (cid:3) Lemma 39. Let Ψ be the FJLT, let A ∈ Rn×d, K ⊂ Rd and u ∈ Sn−1. Let A be as in (6.6) and β as in (C.4). If m & βε−2A2h sup 2,1i, x∈K :kAxk2=1kxk2 then Z2(A, Ψ,K, u) ≤ ε with probability at least 1 − η. Proof. If Ψi denotes the i-th row of Ψ, then we can write n Z2(A, Ψ,K, u) = Set vi =p n with Xx,i := hθip n we know that sup Xi=1 x∈K∩A−1(Sn−1)(cid:12)(cid:12)(cid:12) m A∗DσFi, xi and Xu,i := hθip n m A∗DσFi and let ρv be the semi-metric in (C.2). We apply Lemma 38 m DσFi, ui. By (C.6) and (C.8) hA∗Ψi, xihΨi, ui − E(hA∗Ψi, xihΨi, ui)(cid:12)(cid:12)(cid:12). d2p X (T ))1/(2p) ≤ d2,1ν (E θ γ2p 2 (T, ρX ))1/(2p) . d2,1ν log1/2(n) log3/2(b) log(d). (E θ Moreover, n Xi=1 E θ u,i = kDσuk2 X 2 2 = 1, (E θ max 1≤i≤nXu,i2p)1/(2p) ≤ max mhFi, Dσui. 1≤i≤nr n Applying these estimates in (C.11) and taking Lp(Ωσ)-norms yields Z p ( E θ,σ 2 )1/p .(cid:16)r p m(cid:16) E ∗ (E σ σ max 1≤i≤n √nhFi, Dσui2p(cid:17)1/(2p) + 1(cid:17) ν2p)1/(2p)d2,1(cid:16) log1/2(n) log3/2(b) log(d) + √p(cid:17). 60 JEAN BOURGAIN, SJOERD DIRKSEN, AND JELANI NELSON By Khintchine’s inequality, (cid:16) E σ max 1≤i≤n √nhFi, Dσui2p(cid:17)1/(2p) and by (C.10) . (√p + log1/2(n)) max 1≤i≤n(cid:16) n Xj=1 . √p + log1/2(n). nF 2 ij u2 j(cid:17)1/2 (E ν2p)1/(2p) . 1 √m (√p + log1/2(b) + log1/2(n))A. Combining these estimates and using Lemma 27 yields the result. (cid:3) Combining Lemmas 11, 37, and 39 yields the following result. Theorem 40. Set d = bD. Let Ψ be the FJLT, A ∈ Rn×d and let C be a closed convex set in Rd. Set β as in (C.4). Let x∗ and x be the minimizers of (6.1) and (6.2), respectively. If m & βε−2A2h then, with probability at least 1 − η, 2,1i, x∈TC(x∗) : kAxk2=1kxk2 sup f (x) ≤ (1 − ε)−2f (x∗). The proof of Corollary 17 immediately yields the following consequence. Corollary 41. Set d = bD. Let Ψ be the FJLT, A ∈ Rn×d and let C = {x ∈ Rd : kxk2,1 ≤ R}. Define σmin,k = inf kyk2=1, kyk2,1≤2√k kAyk2. Suppose that x∗ is k-block sparse and kx∗k2,1 = R. If min,k, m & βε−2A2kσ−2 then, with probability at least 1 − η, f (x) ≤ (1 − ε)−2f (x∗). Observe that the condition on m in Theorem 40 and Corollary 41 is, up to different log-factors, the same as the condition for the SJLT in Theorem 16 and Corollary 17. In the special case D = 1, which corresponds to the Lasso, the result in Corol- lary 41 gives a qualitative improvement over [PW14, Corollary 3]. Recall from the discussion following Corollary 17 that in this case A = max 1≤k≤d kAkk2, σmin,k = inf kyk2=1, kyk1≤2√k kAyk2. In [PW14, Corollary 3] the condition m & ε−2 log(η−1) + ε−2 minn log2(d)(cid:16)A2kσ−2 min,k(cid:17)2 , k log(d) log4(n) σ4 max,k σ4 min,ko, TOWARD A UNIFIED THEORY OF SPARSE DIMENSIONALITY REDUCTION 61 kyk2=1, kyk1≤2√k kAyk2. In terms of the depen- was obtained, where σmax,k = sup dence on A this bound is worse than our result. We note, however, that the bound contains fewer log-factors and in particular the dependence on η is better. Institute for Advanced Study, Princeton, NJ 08540 E-mail address: [email protected] RWTH Aachen University, 52062 Aachen, Germany E-mail address: [email protected] Harvard University, Cambridge, MA 02138 E-mail address: [email protected]
1512.04515
1
1512
2015-12-14T20:53:15
Breaking the Variance: Approximating the Hamming Distance in $\tilde O(1/\epsilon)$ Time Per Alignment
[ "cs.DS" ]
The algorithmic tasks of computing the Hamming distance between a given pattern of length $m$ and each location in a text of length $n$ is one of the most fundamental algorithmic tasks in string algorithms. Unfortunately, there is evidence that for a text $T$ of size $n$ and a pattern $P$ of size $m$, one cannot compute the exact Hamming distance for all locations in $T$ in time which is less than $\tilde O(n\sqrt m)$. However, Karloff~\cite{karloff} showed that if one is willing to suffer a $1\pm\epsilon$ approximation, then it is possible to solve the problem with high probability, in $\tilde O(\frac n {\epsilon^2})$ time. Due to related lower bounds for computing the Hamming distance of two strings in the one-way communication complexity model, it is strongly believed that obtaining an algorithm for solving the approximation version cannot be done much faster as a function of $\frac 1 \epsilon$. We show here that this belief is false by introducing a new $\tilde O(\frac{n}{\epsilon})$ time algorithm that succeeds with high probability. The main idea behind our algorithm, which is common in sparse recovery problems, is to reduce the variance of a specific randomized experiment by (approximately) separating heavy hitters from non-heavy hitters. However, while known sparse recovery techniques work very well on vectors, they do not seem to apply here, where we are dealing with mismatches between pairs of characters. We introduce two main algorithmic ingredients. The first is a new sparse recovery method that applies for pair inputs (such as in our setting). The second is a new construction of hash/projection functions, which allows to count the number of projections that induce mismatches between two characters exponentially faster than brute force. We expect that these algorithmic techniques will be of independent interest.
cs.DS
cs
Breaking the Variance: Approximating the Hamming Distance in O(1/ǫ) Time Per Alignment Tsvi Kopelowitz∗ Ely Porat† April 11, 2021 Abstract The algorithmic tasks of computing the Hamming distance between a given pattern of length m and each location in a text of length n is one of the most fundamental algorithmic tasks in string algorithms. Unfortunately, there is evidence that for a text T of size n and a pattern P of size m, one cannot compute the exact Hamming distance for all locations in T in time which is less than O(n√m). However, Karloff [30] showed that if one is willing to suffer a 1 ± ǫ approximation, then it is possible to solve the problem with high probability, in O( n ǫ2 ) time. Due to related lower bounds for computing the Hamming distance of two strings in the one-way communication complexity model, it is strongly believed that obtaining an algorithm for solving the approximation version cannot be done much faster as a function of 1 ǫ . We show here that this belief is false by introducing a new O( n ǫ ) time algorithm that succeeds with high probability. The main idea behind our algorithm, which is common in sparse recovery problems, is to reduce the variance of a specific randomized experiment by (approximately) separating heavy hitters from non-heavy hitters. However, while known sparse recovery techniques work very well on vectors, they do not seem to apply here, where we are dealing with mismatches between pairs of characters. We introduce two main algorithmic ingredients. The first is a new sparse recovery method that applies for pair inputs (such as in our setting). The second is a new construction of hash/projection functions, which allows to count the number of projections that induce mismatches between two characters exponentially faster than brute force. We expect that these algorithmic techniques will be of independent interest. ∗University of Michigan. Supported by NSF Grants CCF-1217338, CNS-1318294, and CCF-1514383. †Bar-Ilan University. 1 Introduction One of the most fundamental family of problems in string algorithms is to compute the distance between a given pattern P of length m and each location in given larger text T of length n both, over alphabet Σ, under some string distance metric (See [31, 22, 2, 32, 8, 6, 3, 7, 37, 13, 35, 33, 9, 12, 39, 34, 20, 11, 16, 19, 18, 17, 5, 4, 38]). The most important distance metric in this setting is the Hamming Distance of two strings, which is the number of aligned character mismatches between the strings. Let HAM(X, Y ) denote the Hamming distance of two strings X and Y . Abrahamson [1] showed an algorithm whose runtime is O(n√m). The task of obtaining a faster upper bound seems to be very challenging, and indeed there is a folklore matching conditional lower bound for combinatorial algorithms based on the hardness of combinatorial boolean matrix multiplication (see [15]). However, for constant sized alphabets the runtime can be reduced to O(n) using a constant number of convolution computations (which are implemented via the FFT algorithm) [22]. This naturally lead to approximation algorithms for computing the Hamming distance in this setting, which is the problem that we consider here and is defined as follows. Denote Tj = T [j, . . . , j + m − 1]. In the pattern-to-text approximate Hamming distance problem the input is a parameter ǫ > 0, T , and P . The goal is to compute for all locations i ∈ [1, n − m + 1] a value δi such that (1 − ǫ)HAM(Ti, P ) ≤ δi ≤ (1 + ǫ)HAM(Ti, P ). For simplicity we assume without loss of generality that Σ is the set of integers {1, 2, . . . ,Σ}. Karloff in [30] utilized the efficiency of the algorithm for constant sized alphabets to introduce a beautiful randomized algorithm for solving the pattern-to-text approximate Hamming distance problem, by utilizing projections of Σ to binary alphabets. Karloff's algorithm runs in O( n ǫ2 ) time, and is correct with high probability. Communication complexity lower bounds. One of the downsides of Karloff's algorithm is the dependence on 1 ǫ2 . In particular, if one is interested in a one percent approximation guarantee, then this term becomes 10000! However, many believe that beating the runtime of Karloff's algorithm is not possible, mainly since there exist qualitatively related lower bounds for estimating the Hamming distance of two equal length strings (for a single alignment). In particular, Woodruff [40] and later Jayram, Kumar and Sivakumar [28] showed that obtaining a (1 ± ǫ) approximation for two strings in the one-way communication complexity model requires sending Ω(1/ǫ2) bits of information. This lower bound implies a lower bound for the sketch size of the Hamming distance and some other streaming problems. Our results here show that this intuition is flawed, by introducing an O( n that succeeds with high probability. ǫ ) time algorithm The challenge -- beating the variance. The main idea of Karloff's algorithm is to project Σ to a binary alphabet, and compute the Hamming distance for each location of the projected text and the projected pattern. For a given location denote by d the Hamming distance of the pattern at this location. While the projected Hamming distance is expected to be d 2 , the variance of the projected distance could be as high as Ω(d2) (see Section 3 for a detailed calculation). In order to overcome this high variance Karloff's algorithm makes use of O( 1 ǫ2 ) projections. More detail is given in Section 3. The first step in obtaining a more efficient algorithm is to somehow reduce the number of projections that an algorithm would use. One line of attack would be to somehow reduce the variance. Indeed, such approaches have been considered in other problems [29], and even for the problem considered here, Atallah, Grigorescu, and Wu in [10] managed to slightly reduce the 1 variance in some cases. They do this by computing the exact contribution to the Hamming distance of the k most frequent characters in the pattern and approximating the contribution of the rest of the characters. This reduces the variance to O(d min(m m k , d) for each projection, and by repeating the process k times the variance of the average result becomes d min( m k , d)/k. This approach is only useful when the Hamming distance is high -- at least m k . However our goal here is to obtain an even faster algorithm, and so we devise a new method for reducing the variance. 1.1 Our results and techniques. Our main result is the first significant improvement on this problem in the last over 20 years. We present a new randomized algorithm that solves the pattern-to-text approximate Hamming distance with high probability (at least 1 − n−Ω(1)) that runs in worst-case O( n ǫ ) time. This is summarized in the following Theorem. Theorem 1.1. There exists an algorithm that with high probability solves the pattern-to-text ap- proximate Hamming distance problem and runs in O( n ǫ log 1 ǫ log n log m log Σ) time. Furthermore, we introduce two exciting novel techniques in our algorithms. Intuition. The main intuition (which may not reveal the technical challenges) is to reduce the variance of the estimation produced by a single projection, by removing pairs of characters with a large contribution to the Hamming distance. In particular, for Hamming distance d we would like to remove pairs that contribute at least ǫd. Such pairs are called heavy hitter pairs and there are at most 1 ǫ such pairs at each location. Unfortunately, it is not clear how to detect the heavy hitter pairs for each location within the time bounds that we are aiming for. A common method for quickly approximating the heavy hitters in a given vector is sparse recovery [24, 25, 36, 23, 14, 21, 26, 27]. The idea is to approximate the heavy hitters of a vector, while suffering from some extra noise in the form of some additional points in the vector, but not more than O( 1 ǫ ) points. However, since in our setting the heavy hitters are pairs of elements (as opposed to single elements in a vector), there are structural constraints that make known sparse recovery techniques irrelevant here. Approximating heavy hitter pairs. To overcome these structural constraints, we introduce an algorithm that utilizes a specially constructed small set of projections. We roughly show that with high probability the L2 distance of the approximate heavy hitter pairs and the actual heavy hitter pairs is small. This in turn allows us to obtain a linear time algorithm which estimates the Hamming distance with variance at most O(ǫd2), and so O( 1 ǫ ) repetitions suffice. This construction can be found in Section 5. ǫ ) pairs in the approximation with each of the O( 1 Computing all of the projections quickly. While the approximation of the heavy hitter pairs implies that the number of repetitions can be low, the algorithm that we use will still need to project the O( 1 ǫ ) projections. Doing this directly will cost O( 1 ǫ2 ) time per location which is too high. To overcome this, we make use of the way in which our algorithm uses the projected outcomes of the approximating pairs, by constructing a specially tailored set of projections. This construction may be of independent interest, and is detailed in Section 6. Given k we construct k hash functions h1, ...hk into the binary alphabet, such that given x 6= y we can count for how many functions hi we have hi(x) = hi(y) in O(log k) time, rather than O(k) time. 2 2 Preliminaries For a given location j, consider the alignment of Tj with P . This alignment naturally defines an alignment matrix D = Dj = {du,v}u,v∈Σ, such that for u 6= v we have du,v = {0 ≤ i ≤ m − 1 : T [j + i] = u∧ P [i] = v} and 0 otherwise. In words, du,v is the contribution of the pair (u, v) to the Hamming distance of Tj and P . Clearly, the Hamming distance is d =Pu,v∈Σ du,v. We emphasize that computing or representing the alignment matrix explicitly is too costly in our setting. Local versus global operations. The operations that our algorithm performs during the com- putation of the Hamming distance at some location j can be partitioned into two types. The first type are local operations which are independent of the computations performed for other locations in T . The second type are global operations, which in order to be done efficiently may consider the alignments at other locations in T . In particular, all of the global operations in our algorithm can be reduced to computing the number of times that a 1 in a projection of Tj to a binary alphabet aligns with a 1 in a projection of P to a binary alphabet (the projection function is not required to be the same for Tj and P ). Such a computation will make use of the following Theorem. Theorem 2.1. Given a binary text T of size n and a binary pattern P of size m, there exists an O(n log m) time algorithm that computes for all locations i in T the number of times that a 1 in Ti is aligned with a 1 in P . The algorithm for Theorem 2.1 is implemented via a single convolution (using the FFT) in O(n log m) time, and so can charge an O(log m) time cost to each location for each global opera- tion. We emphasize that the efficiency of the algorithm in Theorem 2.1 is only relevant when the projections to binary alphabets are the same for all locations j, which indeed will be the case in our algorithm. Simplifying assumptions. With the goal of easing the presentation of our algorithm, we focus on estimating the Hamming distance between Tj and P , and show that the number of global and local operations that our algorithm performs for this location is O(1/ǫ). In particular, we will use D throughout to refer to the alignment matrix Dj, omitting the subscript j. We also emphasize that since we are interested in algorithms that succeed with high probability (at least 1 − 1 nΘ(1) ) then it suffices to show that with high probability the algorithm succeeds at location j. Furthermore, since we are ignoring poly -- log factors, we will only show that the algorithm succeeds with probability which is strictly larger than 1 2 by at least some constant. The median of the estimations of Θ(log n) independent executions of the algorithm guarantees success with high probability. 3 Karloff 's Algorithm Karloff in [30] presented an algorithm for solving pattern-to-text approximate Hamming distance that runs in O( n ǫ2 ) time, and is correct with high probability. We present an overview of (a simplified version of) Karloff's algorithm as understanding it is helpful for the setup of the new algorithm presented here. The pseudo-code for the algorithm is given in Figure 1. The only global operation is to compute the Hamming distance in line 4, which happens O( 1 ǫ2 ) ǫ2 ) time. 2 , and since each hash function times for a total of O( 1 For any xi as computed in line 4, the expected value of xi is E[xi] = d is 4-wise independent, the variance is ǫ2 log m) time. The rest of the operations are all local and cost O( 1 3 Karloff(Tj, P, ǫ) 1 k ← O( 1 ǫ2 ) 2 construct a p.w.i set of 4-wise independent hash functions h1, h2, . . . , hk : Σ → {0, 1}. 3 for i = 1 to k 4 5 X ∗ = 2 Pk 6 return X ∗ do compute xi = HAM(hi(Tj), hi(P )). i=1 xi k Figure 1: Karloff's Algorithm. ǫ Approx-Hamm-Distance(Tj, P, ǫ) 1 k ← 8b 2 Construct-D′(Tj, P, ǫ) 3 construct a p.w.i set of 4-wise independent hash functions h1, h2, . . . , hk : Σ → {0, 1}. 4 X ∗ =Pk i=1(cid:18)HAM(hi(Tj), hi(P )) + 1 u,v(cid:19) /(k/2) 2P u,v 2P u,v 5 return X ∗ u,v − 1 d′ hi(u)6=hi(v) hi(u)=hi(v) d′ Figure 2: The new Algorithm. V [xi] =Xu<v =Xu<v =Xu<v =Xu<v 1 2 V [αu,v(du,v + dv,u)] =Xu<v E"(cid:18)αu,v(du,v + dv,u) − Pr [αu,v = 1] ·(cid:18) 1 (du,v + dv,u)2 = Xu<v 1 4 2 du,v<ǫd dv,u<ǫd (du,v + dv,u)(cid:19)2 Eh(αu,v(du,v + dv,u) − E [(αu,v)(du,v + dv,u)])2i (du,v + dv,u)(cid:19)2# + Pr [αu,v = 0] ·(cid:18)− + Xu<v du,v≥ǫd∨dv,u≥ǫd 1 2 (du,v + dv,u)(cid:19)2 (du,v + dv,u)2 4 (du,v + dv,u)2 4 < ǫd2 4 + 1 4 Xu<v du,v≥ǫd∨dv,u≥ǫd (du,v + dv,u)2. (1) The challenge here is that the variance can be very large -- up to roughly Ω(d2), and so in order to overcome it Karloff suggested using O( 1 ǫ2 ) pair-wise independent projections to the binary alphabet, and then by applying the Chebyshev inequality the probability that the average of the projected distances is an acceptable approximation of d is large enough. 4 4 New Algorithm The reason why Karloff used O( 1 ǫ2 ) different projections was because the variance of a single pro- jection is high. As can be seen in Equation 1, the high variance is due to the at most 1 ǫ entries in the alignment matrix D that are larger than ǫd. Such entries are called heavy hitters. If we could somehow separate those heavy hitters from the rest of D, and, say, compute their values directly, then the remaining non-heavy hitter entries would have a low variance (O(ǫd2)) in which case O( 1 ǫ ) projections would suffice. However, it is not clear how to find these heavy hitters efficiently. So instead, we use a different strategy. We say that a matrix D′ = {d′ 1. Pu,v∈Σ(du,v − d′ 2. The number of non-zero entries in D′ is at most 3 ǫ . u,v)2 ≤ bǫd2 for constant b = 213+212+1 214 < 0.752. u,v}u,v∈Σ, is a sparse approximate matrix if: Notice that the matrix in which all entries that correspond to a heavy hitter pair (u, v) have the value du,v and all other entries are zero is a sparse approximate matrix, which matches the intuition described above. As we shall show, the only properties of such a matrix that we require are the ones which define a sparse approximate matrix. Our algorithm will make use of sparse approximate matrices by constructing a (possibly differ- ent) matrix for each location in T . However, as explained in Section 2 the discussion here focuses on only one location j, and so we make use of only one sparse approximate matrix D′. We emphasize that representing D′ explicitly is too costly since it is too large. Instead, we use an implicit repre- sentation of D′ by considering only the non-zero entries. In Section 5 we show an algorithm that with high probability will construct an implicitly represented matrix D′ with the desired properties in O( 1 ǫ ) time, by proving the following lemma. Lemma 4.1. There exists an algorithm that with high probability computes a sparse approximate matrix D′ for location j in T such that the number of global and local operations performed by the algorithm is O( 1 log Σ). ǫ log n log m ǫ log 1 Given Lemma 4.1, the pseudo-code of the algorithm is given in Figure 2. We will now bound the expected value and variance of X ∗. Fix hi. Let αu,v = 1 if hi(u) 6= hi(v) and 0 otherwise, and let xi = HAM(hi(Tj), hi(P )) + 1 2 − αu,v] = 0. Recall that each function hi is 4-wise independent. Then the expected value and variance of xi, under the random choice of hi, is E[xi] = d 2Phi(u)=hi(v) d′ u,v. Notice that E[ 1 u,v − 1 2 and 2Phi(u)6=hi(v) d′ v,u)(cid:21) v,u) − E(cid:20)(αu,v)(du,v + dv,u) + ( v,u) − v,u)(cid:19)2 2(cid:18) 1 (du,v + dv,u)(cid:19)2# + Pr [αu,v = 0] ·(cid:18) 1 v,u) − u,v + d′ (d′ (d′ 1 2 1 2 2 2 (du,v + dv,u)(cid:19)2# 5 V (cid:20)αu,v(du,v + dv,u) + ( E"(cid:18)αu,v(du,v + dv,u) + ( E"(cid:18)αu,v(du,v + dv,u) + ( V [xi] = Xu<v = Xu<v = Xu<v = Xu<v"Pr [αu,v = 1] ·(cid:18) 1 = Xu<v" 1 2(cid:18) 1 (du,v + dv,u) − 1 2 2 2 1 2 − αu,v)(d′ u,v + d′ 1 2 − αu,v)(d′ u,v + d′ 1 2 − αu,v)(d′ u,v + d′ (du,v + dv,u) − 1 2 (d′ u,v + d′ (d′ u,v + d′ v,u)(cid:19)2 1 + 1 2 − αu,v)(d′ u,v + d′ v,u)(cid:21)(cid:19)2# u,v + d′ v,u) − 1 2 (du,v + dv,u)(cid:19)2# 1 4(cid:0)(du,v − d′ (du,v − d′ 1 2 = Xu<v =Xu,v u,v) + (dv,u − d′ v,u)(cid:1)2 1 4 ≤ Xu<v (2(du,v − d′ u,v)2 + 2(dv,u − d′ v,u)2) u,v)2 < 0.752 2 ǫd2 = 0.376ǫd2. i=1 xi/(k/2)] = 4 k = 4bǫd2 8b/ǫ = ǫ2d2 V [Pk k2 Pk Pr[X ∗ − E[X ∗] > ǫd] < 1 there is still a bottleneck in the runtime of the algorithm from computing 1 1 2Phi(u)6=hi(v) d′ Thus, given (an implicit) D′, we obtain an estimation of d that has low variance. Recall that the hash functions are pair-wise independent among themselves. Therefore, E[X ∗] = d and V [X ∗] = i=1 V [xi] = 4V [xi] 2 . Therefore, by Chebyshev's inequality, 2 . While D′ can be used to decrease the variance of the estimation, u,v − ǫ2 ) time, which is too costly for our goals (since this computation would need to be repeated O(n) times). We overcome this challenge by introducing a special construction of O( 1 ǫ ) projections to a binary alphabet, where each projection is 4-wise-independent, and the projection functions are pair-wise- independent among themselves. The special construction will have the property that computing ǫ ) projections. This can be done directly in O( 1 2Phi(u)=hi(v) d′ u,v for all of the O( 1 k Xi=1   1 2 Xhi(u)=hi(v) d′ u,v − 1 2 Xhi(u)6=hi(v) d′ u,v  can be done in O( 1 in Section 6. ǫ ) time. This construction is summarized in the following lemma, which is proven Lemma 4.2. There exists an algorithm for constructing h1, . . . , hk in line 3 of Approx-Hamming- Distance, so that executing line 4 of Approx-Hamming-Distance takes O( 1 ǫ log k) time. Thus, the total runtime of the algorithm is O( 1 ǫ ) time per location, for a total of O( n ǫ ) time for all locations. 5 Computing D′ In order to construct a sparse approximate matrix D′ we would intuitively like to Intuition. estimate the at most 1 ǫ heavy hitters of D which are the entries of D that are at least ǫd. One idea for obtaining this estimation is to project the alphabet Σ to a smaller alphabet, with the hopes that heavy hitters before the projection can be established from the heavy hitters after the projection. However, this specific task seems out of grasp, since the projections introduce too much noise. To overcome this challenge, we use several specially constructed projections so that together with the proper algorithm we are able to estimate O( 1 ǫ ) entries of D, which will suffice in order to bound u,v)2. We emphasize that while our algorithm may in fact not estimate all of the heavy hitters, this bound is still obtained with high probability. Pu,v∈Σ(du,v − d′ The projections. We consider O(log 1 ǫ ) 4-wise independent projections as follows1. The ith projection, for i = 0, . . . , log 1 ǫ , is defined by two projection functions τi : Σ → [ℓi] and πi : Σ → [ri], 2iǫ . Notice that for all i we have ℓi · ri = 322 where ℓi = 32 · 2i and ri = 32 ǫ . We assume without loss of generality that 322 is a power of 2. For each i, the text Tj is projected with τi while the pattern ǫ P is projected with πi. We then compute for each pair (x, y) ∈ [ℓi] × [ri] the number of times that 1Notice that these projections are the same for all locations in T and not just for location j. This enables the use of Theorem 2.1 for global operations in our setting. 6 u,v ← ∞ ri ← 32 repeat Θ(log n) times 2iǫ if ℓi ≥ ri do ℓi ← 32 · 2i Construct-D′(Tj, P, ǫ) 1 implicitly initialize all d′ 2 for i = 0 to log 1 ǫ 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 implicitly set all d′ for every d′ do d′ then pick a random 4-wise independent projection τi : Σ → [ℓi] else pick a random 4-wise independent projection πi : Σ → [ri] πi(·) = τi(·) mod ri τi(·) = πi(·) mod ℓi for every pair (x, y) ∈ [ℓi] × [ri] where no (σ, σ) is in the preimage of (x, y) do cx,y ← number of times that x in τi(Tj) is aligned with y in πi(P ) if there exists (u, v) in preimage of (x, y) where du,v > cx,y 2 u,v ← min(d′ then d′ u,v ← 0 u,v is not one of the 3 u,v, cx,y) ǫ largest values in D′ u,v = ∞ to d′ u,v > 0 such that d′ u,v ← 0 Figure 3: Constructing D' ǫ ǫ x in the projected text is aligned with y in the projected pattern using a single global convolution. Since the number of such pairs is O( 1 ) time for each i via global operations, for a total of O( log m log 1 ǫ ) this can be computed in O( log m ǫ ) for all i. Intuitively, we would like to claim that for a pair of characters u 6= v the number of times that τi(u) in the projected text aligns with πi(v) in the projected pattern is a close enough estimation of du,v. However, if we allow τi and πi to be any random projection functions then we will be introducing new mismatches via the projection, since it is likely that for a projected pair (x, y) where x 6= y there exists some character σ ∈ Σ such that (x, y) = (πi(σ), τi(σ)), and the task of distinguishing projections of matching pairs from projections of mismatching pairs seems to be too difficult within the allowed time. One method for overcoming this problem would be to only consider the number of mismatches for projected pairs as long as they are not of the form (πi(σ), τi(σ)) for any σ ∈ Σ. Then we would hope that repeating the entire process with enough choices of πi and τi will guarantee that all of the appropriate pairs of different characters are projected enough times to a pair that is not of this form. However, for each σ ∈ Σ, (πi(σ), τi(σ) is a uniformly random point in [li]× [ri], which is a universe of size O( 1 ǫ ) random points in this universe with high probability each point appears at least once (this is the coupon collector problem). If Σ = Ω( 1 Instead, we do the following. Assume that ℓi ≥ ri. The other case of ℓi < ri is dealt with by reversing the roles of πi and τi. We first pick a random τi, and then set πi(σ) = τi(σ) mod ri. Recall that both τi and ri are powers of 2. The following lemma bounds the probability that a pair the projection of a given pair of different characters (u, v) is discarded. ǫ ) then with high probability we will fail to recover any pair in the preimage. ǫ ). Given O( 1 ǫ log 1 ǫ log 1 Lemma 5.1. If ri ≤ ℓi, then for a given pair of different characters (u, v) the probability that this pair is projected to a pair of the form (τi(σ), πi(σ)) for some σ ∈ Σ is at most 1 32 . 7 Proof. Pr[∃σ∈Σ : τi(u) = τi(σ) ∧ πi(v) = πi(σ)] ≤ Pr[∃σ∈Σ : πi(u) = πi(σ) ∧ πi(v) = πi(σ)] ≤ Pr[πi(u) = πi(v)] = 1 ri ≤ 1 32 Therefore, repeating the entire process with O(log n) choices of πi and τi will guarantee that with high probability every pair of different characters is projected Ω(log n) times to a pair that is not of this form (we will need this Ω(log n) repetition later). The Algorithm. The pseudo-code for the algorithm is given in Figure 3. In lines 6-10 we create the projection functions, and then in lines 11-12 we compute cx,y for each projected pair (x, y) that is not of the form (πi(σ), τi(σ)) for any σ ∈ Σ, where cx,y is the exact number of alignments of this projected pair. We then use a bit-tester scheme using error-correcting codes (see [23]) in line 13 in order to establish if there is a pair (u, v) in the preimage of (x, y) that contributed more than half of cx,y. If so, then in line 14 we use cx,y to estimate du,v, unless a smaller estimator was encountered before. Finally, the algorithm filters away all but the largest 3 ǫ entries in D′, thereby guaranteeing that D′ is sparse enough. Projected-noise. Consider a pair (u, v). For a given πi and τi let (u′,v′)6=(u,v):τi(u)=τi(u′)∧πi(v)=πi(v′) X du′,v′ be the projected-noise for (u, v). We would like to bound the amount of projected-noise for a pair (u, v), since if it is less than du,v then the bit-tester in line 13 will identify the pair (u, v) from the projected noise.In the following analysis we focus on a specific choice of i, τi, πi, and a pair (u, v). The analysis is partitioned into two cases. In the first case we consider pairs (u′, v′) of the form either (u, v′) or (u′, v). In the second case we consider the remaining possible forms. The first case. We focus on pairs of the form either (u, v′) or (u′, v). Let w(u) =Pv′∈Σ du,v′, and let w(v) =Pu′∈Σ du′,v. Notice that for any pair (u, v′) the probability that πi(v) = πi(v′) is 1 ilarly, for any pair (u′, v) the probability that τi(u) = τi(u′) is 1 ℓi . Sim- ri du,v′] = . Therefore, E[P v′6=v πi(v′)=πi(v) . Thus the expected amount of projected noise from pairs of w(u) ri and E[P u′6=u πi(u′)=πi(u) du′,v] = w(v) ℓi + w(v) ℓi . Recall that ℓi · ri = 322 the form (u, v′) or (u′, v) is w(u) ri minimized when ℓi =q ǫw(u) ǫ . This expected projected noise is √ǫw(u)w(v) . However, our algorithm is restricted to values of ℓi and ri that are powers of 2. Within these limited options for ℓi and ri the new minimized expected amount of projected noise is at most twice the minimum over all options for ℓi and ri, and hence the expected amount of noise due to this type of pair is at most √ǫw(u)w(v) 322w(v) , and will then be w(u) 16 + w(v) ℓi = ri . 8 8 The second case. We now focus on the remaining cases. Recall that the projections are 4- wise independent. Furthermore, recall that our algorithm ignores projected pairs of the form (τi(σ), πi(σ)) for any σ ∈ Σ. Therefore, we can ignore the case u = v′ since otherwise if τi(u) = τi(u′) and πi(v) = πi(v′) then (τi(u), πi(v)) = (τi(v′), πi(v′)) and the algorithm skips this projected pair. Similarly, we can ignore the case u′ = v. Therefore, the only case that remains is that all four of u, u′, v, v′ are distinct. Since the projections are 4-wise independent, it must be that Pr[τi(u) = τi(u′) ∧ πi(v) = πi(v′)] = 1 ℓi · 1 ri = ǫ 210 . Thus the expected amount of such noise due to this type of pair is at most ǫd 210 . 4 + ǫd 29 . Bounding the noise. Now, via Markov's inequality, with probability at least 1 2 the amount of 29 . Since each pair (u, v) is not projected into a pair of the noise on (u, v) is at most form πi(σ), τi(σ)) for any σ ∈ Σ at least Ω(log n) times, and we pick the smallest estimation out of all choices of projections, then with high probability the total amount of noise on (u, v) is at most √ǫw(u)w(v) √ǫw(u)w(v) + ǫd 4 4 + ǫd √ǫw(u)w(v) u,v ≤ du,v + The amount of noise on (u, v) can have two types of estimations for values of du,v. The first type of estimation comes from the case in which the noise on (u, v) is smaller than du,v. In this case the bit-tester will find (u, v) and so d′ 29 . In other words, this estimation overestimates the contribution of du,v by at most the amount of noise on (u, v). The second type of estimation comes from the case in which the noise on (u, v) is at least du,v and so d′ u,v = 0. This case will only concern us if (u, v) is a heavy hitter pair (in which case we may give this pair an estimation √ǫw(u)w(v) 29 ≥ du,v, or of 0). This case implies that the bit-tester failed to find (u, v), and so d′ u,v = 0 ≥ du,v − Filtering. The last part of the algorithm for constructing D′ filters all but the largest 3 ǫ estima- tors. We will now show that this filtering does not affect the estimation of any heavy hitter pair. If the estimator in D′ for a heavy hitter pair was 0 prior to the filtering, then the estimator after the filtering is clearly unchanged. What needs to be proven is that if the estimator in D′ for a heavy hitter was larger than 0 prior to the filtering, then with high probability that estimator will be one of the 3 ǫ largest entries, and so it remains unchanged due to the filtering. For the rest of the discussion here we assume that the values in D′ are the values prior to the filtering. √ǫw(u)w(v) + ǫd 29 . + ǫd 4 4 By a simple counting argument, there are at most 2 ǫ 2 d. The following lemma will help us complete the proof. Lemma 5.2. With high probability, there are at most 1 are estimated in D′ with value at least ǫd. ǫ entries in D with a value that is at least ǫ entries in D with value less than ǫ 2 that √ǫw(u)w(v) Proof. Recall that there are two cases that contribute noise. With high probability the first case 29 . Let S be the set of pairs for which the 4 , which is required (but not sufficient) in order for their contributes noise from the first case is more than ǫd estimation to be at least ǫd. Then and the second case contributes ǫd 4 ≤ X(u,v)∈S pǫw(u)w(v) 4 4 (cid:19)2 S(cid:18) ǫd Therefore, S ≤ 1 ǫ . !2 = X(u,v)∈S ǫw(u)w(v) 16 = ǫ 16 Xu,v∈Σ w(u)w(v) = ǫd2 16 . 9 Corollary 5.1. Prior to filtering there are at most 3 Finally, notice that a heavy hitter pair (u, v) such that d′ this entry cannot be filtered away. ǫ entries in D′ with value at least ǫd is at most. u,v ≥ ǫd, and so u,v > 0 must have d′ Bounding the variance. Notice that there are at most 3 ǫ non-zero entries in D′ and at most 1 ǫ heavy hitters, and recall that some heavy hitter pairs may be estimated in D′ with 0. Finally, with high probability we have (du,v − d′ Xu,v∈Σ u,v)2 = Xu,v∈Σ (du,v)2 + Xu,v∈Σ du,v≥ǫd∨d′ u,v6=0 du,v<ǫd d′ u,v=0 (du,v − d′ u,v)2 ǫd2 2 ≤ ǫd2 2 ≤ ǫd2 2 ≤ ǫd2 2 ≤ + Xu,v∈Σ du,v≥ǫd∨d′ u,v6=0 pǫ · w(u) · w(v) 4 + ǫd 29!2 u,v6=0 du,v≥ǫd∨d′ + Xu,v∈Σ +  Xu,v∈Σ + ǫd2 4 + ǫd2 214 ≤ du,v≥ǫd∨d′ u,v6=0 2 pǫ · w(u) · w(v)   ǫ · w(u) · w(v) 213 + 212 + 1 4 ǫd2 = bǫd2 214 !2 + Xu,v∈Σ du,v≥ǫd∨d′ u,v6=0 28(cid:19)2 (cid:18) ǫd + 4ǫd2 216 6 Constructing the Projections We now turn our focus towards constructing the projections in line 4 from Figure 2, so that the computation in line 5 will take O( 1 ǫ ) time. In particular, we will show that computing k Xi=1   1 2 Xu,v hi(u)=hi(v) d′ u,v − 1 2 Xu,v hi(u)6=hi(v) d′ u,v  can be done in O( 1 ǫ log k) time. To start off, notice that it suffices to know for each d′ u,v > 0 the number βu,v = {1 ≤ i ≤ k : hi(u) = hi(v)}, since   Xu,v Xi=1 k hi(u)=hi(v) d′ u,v − Xu,v hi(u)6=hi(v) d′ u,v  = Xd′ u,v >0 (βu,v − (k − βu,v))d′ u,v. Once we show how to construct the hash functions h1, . . . , hk so that we can compute βu,v for d′ u,v 6= 0 in O(log k) time, then we are done. 10 The construction. Assume without loss of generality that k is a power of 2. Consider 2 log k base hash functions f1, . . . f2 log k : Σ → [0, 1] where each base hash function is picked independently from a 4-wise independent family of hash functions. We partition the base hash functions to log k pairs, and consider all possible combinations of picking 1 function from each pair. Each combination of log k functions defines a different projection hash function hi by considering the xor of the outputs of the log k functions. The number of projection hash functions is exactly the number of combinations of base hash functions in our construction, which is (2)log k = k, as required. We now argue that each projection hash function hi is 4-wise independent, and that the projec- tion hash functions are pair-wise independent among themselves. Since hi is the xor of log k 4-wise independent base functions, hi is 4-wise independent as well. Moreover, for each hi 6= hj, there must be at least one pair of base functions in which hi uses one base function and hj uses the other base function. Since these base functions are independent, hi and hj must be independent as well. Computing βu,v. Set (u, v). Build a balanced binary tree over the log k pairs of base functions and compute f1(u), f2(u), . . . f2 log k(u) and f1(v), f2(v), . . . f2 log k(v). For each node w in the bal- anced binary tree let tw be the number of pairs of base functions at the leaves of the subtree of w. For each such tw pairs of base functions, we consider all 2tw combinations of picking one base function from each pair. Each such combination defines a projection function local to w by taking the xor of the outputs of the base hash functions for that combination. Let ew be the number of such local projections for which the projection on u and the projection on v are equal, while dw is the number of such projections for which the projection on u and the projection on v are not equal. If ℓ and r are the left and right children of w, respectively, then ew = eℓ · er + dℓ · dr and dw = eℓ · dr + dℓ · er. Finally, since the root of the balanced binary tree root covers all of the log k pairs of base functions, then βu,v = eroot. Thus using a direct bottom up approach we can compute βu,v in O(log k) time. References [1] K. Abrahamson. Generalized string matching. In SIAM J. Computing 16 (6), page 10391051, 1987. [2] A. Amir, O. Lipsky, E. Porat, and J. Umanski. Approximate matching in the l1 metric. In CPM, pages 91 -- 103, 2005. [3] Amihood Amir, Yonatan Aumann, Gary Benson, Avivit Levy, Ohad Lipsky, Ely Porat, Steven Skiena, and Uzi Vishne. Pattern matching with address errors: rearrangement distances. In Proceedings of the Seventeenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2006, Miami, Florida, USA, January 22-26, 2006, pages 1221 -- 1229, 2006. [4] Amihood Amir, Yonatan Aumann, Piotr Indyk, Avivit Levy, and Ely Porat. Efficient com- putations of l1 and linfinity rearrangement distances. In String Processing and Information Retrieval, 14th International Symposium, SPIRE 2007, Santiago, Chile, October 29-31, 2007, Proceedings, pages 39 -- 49, 2007. [5] Amihood Amir, Yonatan Aumann, Oren Kapah, Avivit Levy, and Ely Porat. Approximate In Combinatorial Pattern Matching, 19th Annual string matching with address bit errors. Symposium, CPM 2008, Pisa, Italy, June 18-20, 2008, Proceedings, pages 118 -- 129, 2008. 11 [6] Amihood Amir, Estrella Eisenberg, and Ely Porat. Swap and mismatch edit distance. In Algorithms - ESA 2004, 12th Annual European Symposium, Bergen, Norway, September 14- 17, 2004, Proceedings, pages 16 -- 27, 2004. [7] Amihood Amir, Tzvika Hartman, Oren Kapah, Avivit Levy, and Ely Porat. On the cost of interchange rearrangement in strings. In Algorithms - ESA 2007, 15th Annual European Symposium, Eilat, Israel, October 8-10, 2007, Proceedings, pages 99 -- 110, 2007. [8] Amihood Amir, Moshe Lewenstein, and Ely Porat. Approximate swapped matching. In Foundations of Software Technology and Theoretical Computer Science, 20th Conference, FST TCS 2000 New Delhi, India, December 13-15, 2000, Proceedings., pages 302 -- 311, 2000. [9] Alexandr Andoni, Robert Krauthgamer, and Krzysztof Onak. Polylogarithmic approximation for edit distance and the asymmetric query complexity. In 51th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2010, October 23-26, 2010, Las Vegas, Nevada, USA, pages 377 -- 386, 2010. [10] Mikhail J. Atallah, Elena Grigorescu, and Yi Wu. A lower-variance randomized algorithm for approximate string matching. Inf. Process. Lett., 113(18):690 -- 692, 2013. [11] A. Backurs and P. Indyk. Edit distance cannot be computed in strongly subquadratic time (unless SETH is false). In Accepted to 56th IEEE Symposium on Foundations of Computer Science (FOCS), 2015. [12] Ziv Bar-Yossef, T. S. Jayram, Robert Krauthgamer, and Ravi Kumar. Approximating edit distance efficiently. In 45th Symposium on Foundations of Computer Science (FOCS 2004), 17-19 October 2004, Rome, Italy, Proceedings, pages 550 -- 559, 2004. [13] Ayelet Butman, Noa Lewenstein, Benny Porat, and Ely Porat. Jump-matching with errors. In String Processing and Information Retrieval, 14th International Symposium, SPIRE 2007, Santiago, Chile, October 29-31, 2007, Proceedings, pages 98 -- 106, 2007. [14] Moses Charikar, Kevin Chen, and Martin Farach-Colton. Finding frequent items in data streams. In Automata, Languages and Programming, 29th International Colloquium, ICALP 2002, Malaga, Spain, July 8-13, 2002, Proceedings, pages 693 -- 703, 2002. [15] Raphael Clifford. Matrix multiplication and pattern matching under hamming http://www.cs.bris.ac.uk/Research/Algorithms/events/BAD09/BAD09/Talks/ norm. BAD09-Hammingnotes.pdf. Retrieved August 2015. [16] Raphael Clifford, Klim Efremenko, Benny Porat, Ely Porat, and Amir Rothschild. Mismatch sampling. Information and Computation, 214:112 -- 118, 2012. [17] Raphael Clifford, Klim Efremenko, Ely Porat, and Amir Rothschild. From coding theory to efficient pattern matching. pages 778 -- 784, 2009. [18] Raphael Clifford, Klim Efremenko, Ely Porat, and Amir Rothschild. Pattern matching with don't cares and few errors. Journal of Computer System Science, 76(2):115 -- 124, 2010. [19] Raphael Clifford and Ely Porat. A filtering algorithm for k -mismatch with don't care s. Information Processing Letters, 110(22):1021 -- 1025, 2010. 12 [20] Graham Cormode and S. Muthukrishnan. The string edit distance matching problem with In Proceedings of the Thirteenth Annual ACM-SIAM Symposium on Discrete Algo- moves. rithms, January 6-8, 2002, San Francisco, CA, USA., pages 667 -- 676, 2002. [21] Graham Cormode and S. Muthukrishnan. An improved data stream summary: The count- min sketch and its applications. In LATIN 2004: Theoretical Informatics, 6th Latin American Symposium, Buenos Aires, Argentina, April 5-8, 2004, Proceedings, pages 29 -- 38, 2004. [22] M.J. Fischer and M.S. Paterson. String matching and other products. r.m. karp (ed.), com- plexity of computation. In SIAMAMS Proceedings, vol. 7,, page 113125, 1974. [23] A. C. Gilbert, Y. Li, E. Porat, and M. J. Strauss. Approximate sparse recovery: optimizing time and measurements. In STOC, pages 475 -- 484, 2010. [24] A. C. Gilbert, Y. Li, E. Porat, and M. J. Strauss. For-all sparse recovery in near-optimal time. In ICALP (1), pages 538 -- 550, 2014. [25] A. C. Gilbert, H. Q. Ngo, E. Porat, A. Rudra, and M. J. Strauss. L2/l2-foreach sparse recovery with low risk. In ICALP (1), pages 461 -- 472, 2013. [26] Anna C. Gilbert, Martin J. Strauss, Joel A. Tropp, and Roman Vershynin. One sketch for all: fast algorithms for compressed sensing. In Proceedings of the 39th Annual ACM Symposium on Theory of Computing, San Diego, California, USA, June 11-13, 2007, pages 237 -- 246, 2007. [27] Piotr Indyk and Milan Ruzic. Near-optimal sparse recovery in the L1 norm. In 49th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2008, October 25-28, 2008, Philadelphia, PA, USA, pages 199 -- 207, 2008. [28] T. S. Jayram, Ravi Kumar, and D. Sivakumar. The one-way communication complexity of hamming distance. Theory of Computing, 4(1):129 -- 135, 2008. [29] Daniel M. Kane, Jelani Nelson, Ely Porat, and David P. Woodruff. Fast moment estimation in data streams in optimal space. In Proceedings of the 43rd ACM Symposium on Theory of Computing, STOC 2011, San Jose, CA, USA, 6-8 June 2011, pages 745 -- 754, 2011. [30] H. Karloff. Fast algorithms for approximately counting mismatches. In Inf. Process. Lett. 48 (2), pages 53 -- 60, 1993. [31] Vladimir Levenshtein. Binary codes capable of correcting spurious insertions and deletions of ones. In Probl. Inf. Transmission 1, page 817, 1965. [32] O. Lipsky and E. Porat. Approximated pattern matching with the l1, l2 and linfinit metrics. In SPIRE, pages 212 -- 223, 2008. [33] R. Lowrance and R. A. Wagner. An extension of the string-to-string correction problem. J. of the ACM, pages 177 -- 183, 1975. [34] Benny Porat and Ely Porat. Exact and approximate pattern matching in the streaming model. In 50th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2009, October 25-27, 2009, Atlanta, Georgia, USA, pages 315 -- 323, 2009. 13 [35] Benny Porat, Ely Porat, and Asaf Zur. Pattern matching with pair correlation distance. In String Processing and Information Retrieval, 15th International Symposium, SPIRE 2008, Melbourne, Australia, November 10-12, 2008. Proceedings, pages 249 -- 256, 2008. [36] E. Porat and M. J. Strauss. Sublinear time, measurement-optimal, sparse recovery for all. In SODA, pages 1215 -- 1227, 2012. [37] Ely Porat and Klim Efremenko. Approximating general metric distances between a pattern In Proceedings of the Nineteenth Annual ACM-SIAM Symposium on Discrete and a text. Algorithms, SODA 2008, San Francisco, California, USA, January 20-22, 2008, pages 419 -- 427, 2008. [38] Ely Porat and Ohad Lipsky. Improved sketching of hamming distance with error correcting. In Combinatorial Pattern Matching, 18th Annual Symposium, CPM 2007, London, Canada, July 9-11, 2007, Proceedings, pages 173 -- 182, 2007. [39] Ariel Shiftan and Ely Porat. Set intersection and sequence matching. In String Processing and Information Retrieval, 16th International Symposium, SPIRE 2009, Saariselka, Finland, August 25-27, 2009, Proceedings, pages 285 -- 294, 2009. [40] David P. Woodruff. Optimal space lower bounds for all frequency moments. In Proceedings of the Fifteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2004, New Orleans, Louisiana, USA, January 11-14, 2004, pages 167 -- 175, 2004. 14
1409.1399
2
1409
2015-11-23T11:00:33
Maximizing k-Submodular Functions and Beyond
[ "cs.DS", "cs.DM" ]
We consider the maximization problem in the value oracle model of functions defined on $k$-tuples of sets that are submodular in every orthant and $r$-wise monotone, where $k\geq 2$ and $1\leq r\leq k$. We give an analysis of a deterministic greedy algorithm that shows that any such function can be approximated to a factor of $1/(1+r)$. For $r=k$, we give an analysis of a randomised greedy algorithm that shows that any such function can be approximated to a factor of $1/(1+\sqrt{k/2})$. In the case of $k=r=2$, the considered functions correspond precisely to bisubmodular functions, in which case we obtain an approximation guarantee of $1/2$. We show that, as in the case of submodular functions, this result is the best possible in both the value query model, and under the assumption that $NP\neq RP$. Extending a result of Ando et al., we show that for any $k\geq 3$ submodularity in every orthant and pairwise monotonicity (i.e. $r=2$) precisely characterize $k$-submodular functions. Consequently, we obtain an approximation guarantee of $1/3$ (and thus independent of $k$) for the maximization problem of $k$-submodular functions.
cs.DS
cs
Maximizing k-Submodular Functions and Beyond∗ School of Computer and Communication Sciences, EPFL, Switzerland Justin Ward† [email protected] Stanislav Zivn´y‡ Department of Computer Science, University of Oxford, UK [email protected] Abstract We consider the maximization problem in the value oracle model of functions defined on k-tuples of sets that are submodular in every orthant and r-wise monotone, where k ≥ 2 and 1 ≤ r ≤ k. We give an analysis of a deterministic greedy algorithm that shows that any such function can be approximated to a factor of 1/(1 + r). For r = k, we give an analysis of a randomised greedy algorithm that shows that any such function can be approximated to a factor of 1/(1 +pk/2). In the case of k = r = 2, the considered functions correspond precisely to bisubmodular functions, in which case we obtain an approximation guarantee of 1/2. We show that, as in the case of submodular functions, this result is the best possible in both the value query model, and under the assumption that N P 6= RP . Extending a result of Ando et al., we show that for any k ≥ 3 submodularity in every orthant and pairwise monotonicity (i.e. r = 2) precisely characterize k-submodular functions. Consequently, we obtain an approximation guarantee of 1/3 (and thus independent of k) for the maximization problem of k-submodular functions. 1 Introduction Given a finite nonempty set U , a set function f : 2U → R+ defined on subsets of U is called submodular if for all S, T ⊆ U , f (S) + f (T ) ≥ f (S ∩ T ) + f (S ∪ T ). Submodular functions are a key concept in operations research and combinatorial optimization [29, 28, 38, 34, 10, 24, 19]. Examples of submodular functions include cut capacity functions, matroid rank functions, and entropy functions. Submodular functions are often considered to be a discrete analogue of convex functions [26]. ∗An extended abstract of this work appeared in the Proceedings of the 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), 2014 [41]. †J.W. was supported by EPSRC grants EP/J021814/1 and EP/D063191/1 (work performed while the author was at the University of Warwick, United Kingdom). ‡S.Z. was supported by a Royal Society University Research Fellowship. 1 Both minimizing and maximizing submodular functions have been considered extensively in the literature, in both constrained and unconstrained settings. Submodular function maximization is easily shown to be NP-hard [34] since it generalizes many standard NP-hard problems such as the maximum cut problem [12, 9]. In contrast, the problem of minimizing a submodular function can be solved efficiently with only polynomially many evaluations of the function [19] either by using the ellipsoid algorithm [13, 14], or by using one of several combinatorial algorithms that have been obtained in the last decade [33, 20, 17, 18, 30, 22]. Following a question by Lov´asz [26], a generalization of submodularity to biset functions has been introduced. Given a finite nonempty set U , a function f : 3U → R+ defined on pairs of disjoint subsets of U is called bisubmodular if for all pairs (S1, S2) and (T1, T2) of disjoint subsets of U , f (S1, S2) + f (T1, T2) ≥ f ((S1, S2) ⊓ (T1, T2)) + f ((S1, S2) ⊔ (T1, T2)), where we define and (S1, S2) ⊓ (T1, T2) = (S1 ∩ T1, S2 ∩ T2), (S1, S2) ⊔ (T1, T2) = ((S1 ∪ T1) \ (S2 ∪ T2), (S2 ∪ T2) \ (S1 ∪ T1)). Bisubmodular functions were originally studied in the context of rank functions of delta-matroids [4, 6]. Bisubmodularity also arises in bicooperative games [3] as well as variants of sensor placement problems and coupled feature selection problems [35]. The minimization problem for bisubmodular functions using the ellipsoid method was solved in [32]. More recently, combinatorial [11] and strongly combinatorial [27] algorithms for maximizing bisubmodular functions have been developed. In this paper, we study the natural generalization of submodular and bisubmodular functions: given a natural number k ≥ 1 and a finite nonempty set U , a function f : (k + 1)U → R+ defined on k-tuples of pairwise disjoint subsets of U is called k-submodular if for all k-tuples S = (S1, . . . , Sk) and T = (T1, . . . , Tk) of pairwise disjoint subsets of U , f (S) + f (T ) ≥ f (S ⊓ T ) + f (S ⊔ T ), where we define and S ⊓ T = (S1 ∩ T1, . . . , Sk ∩ Tk), S ⊔ T = ((S1 ∪ T1) \[i∈{2,...,k} (Si ∪ Ti), . . . , (Sk ∪ Tk) \[i∈{1,...,k−1} (Si ∪ Ti)). Under this definition, 1-submodularity corresponds exactly to the standard notion of submodularity for set functions, and similarly 2-submodularity corresponds to bisubmodularity. (We note that Ando has used the term k-submodular to study a different class of functions [1].) 2 1.1 Related work The terminology for k-submodular functions was first introduced in [15] but the concept has been studied previously in [7]. The concept of k-submodularity is a special case of strong tree submod- ularity [23] with the tree being a star on k + 1 vertices. To the best of our knowledge, it is not known whether the ellipsoid method can be employed for minimizing k-submodular functions for k ≥ 3 (some partial results can be found in [15]), let alone whether there is a (fully) combinatorial algorithm for minimizing k-submodular functions for k ≥ 3. However, it has recently been shown that explicitly given k-submodular functions can be minimized in polynomial time [36]1, and these results have proved useful in the design of fixed-parameter algorithms [40]. Some results on maximizing special cases of bisubmodular functions have appeared in Singh, Guillory, and Bilmes [35], who showed that simple bisubmodular function can be represented as a matroid constraint and a single submodular function, thus enabling the use of existing algorithms in some special cases. Unfortunately they show that this approach may require that the submodular function take negative values and so the approach does not work in general. (We note that our definition of bisubmodularity corresponds to directed bisubmodularity in [35].) A different generalization of bisubmodularity, called skew bisubmodularity, has proved impor- tant in classifying finite-valued CSPs on domains with three elements [16]; this result was then generalized by a complexity classification of finite-valued CSPs on domains of arbitrary size [37]. Explicitly given skew bisubmodular functions can be minimized efficiently by results of Thapper and Zivn´y [36]. The general question of whether all bisubmodular, and, more generally, k-submodular functions can be approximately maximized was left open. 1.2 Contributions Following the question by Lov´asz [26] of whether there are generalizations of submodularity that preserve some nice properties such as efficient optimization algorithms, we consider the class of functions that are submodular in every orthant and r-wise monotone (the precise definition is given in Section 2), which includes as special cases bisubmodular and k-submodular functions. Specifically, we consider the problem of maximizing bisubmodular and, more generally, k- submodular functions in the value oracle model. We provide the first approximation guarantees for maximizing a general bisubmodular or k-submodular function. In Section 3, we prove that for any k ≥ 2, k-submodular functions are precisely the k-set functions that are submodular in every orthant and pairwise monotone, thus extending the result from [2] that showed this result for k = 2. In Section 4, we show that the naive random algorithm that simply returns a random partition of the ground set U is 1/4-approximation for maximizing any bisubmodular function and a 1/k- approximation for maximizing a k-submodular function with k ≥ 3. We also show that our analysis is tight. In Section 5, we show that a simple greedy algorithm for maximizing k-set functions that are submodular in every orthant and r-wise monotone for some 1 ≤ r ≤ k achieves a factor of 1/(1 + r). We also show that our analysis is tight. Consequently, this algorithm achieves a factor of 1/3 for maximizing k-submodular functions. 1In fact, results in [36] imply that much larger classes of functions can be minimized in polynomial time, including as one special case functions that are (strong) tree submodular, which in turn includes k-submodular functions. 3 In Section 6, we develop a randomized greedy algorithm for maximizing k-set functions that are submodular in every orthant and k-wise monotone. The algorithm is inspired by the algorithm of Buchbinder et al. [5] for unconstrained submodular maximization. We show that this algorithm approximates any such k-set function to a factor of 1/(1 +pk/2). Finally, in Section 7, we relate our results on bisubmodular functions and existing results on submodular functions via a known embedding of submodular functions into bisubmodular functions. Using this embedding we can translate inapproximability results for submodular function into analogous results for bisubmodular functions. Moreover, we show that the algorithm of Buchbinder et al. [5] may be viewed as a special case of our algorithm applied to this embedding. Recently, Iwata, Tanigawa, and Yoshida [21] have independently obtained a 1/k-approximation algorithm for maximizing k-submodular functions. Here we improve this factor to 1/3, while also considering several other algorithms and generalizations of k-submodular functions. 2 Preliminaries We denote by R+ the set of all non-negative real numbers. Let U be a ground set containing n elements and k ≥ 1 be a fixed integer. We consider functions that assign a value in R+ to each partial assignment of the values {1, . . . , k} to the elements of U . We can represent each such partial assignments as vectors x in {0, . . . , k}U , where we have xe = 0 if element e ∈ U is not assigned any value in {1, . . . , k}, and otherwise have xe equal to the value assigned to e. It will be useful to consider the partial assignment obtained from another (possibly partial) assignment x by “forgetting” the values assigned to all elements except for some specified set S ⊆ U . We = xe, for all e ∈ S and represent this as the vector x(cid:12)(cid:12)S whose coordinates are given by (cid:0)x(cid:12)(cid:12)S(cid:1)e (cid:0)x(cid:12)(cid:12)S(cid:1)e = 0 for all e ∈ U \ S. Note that x(cid:12)(cid:12)S is similar to the projection of x onto S, but we here these coordinates from the resulting vector. In particular, this means that x(cid:12)(cid:12)S and x both have n require that all coordinates e 6∈ S be set to 0, while the standard notion of projection would remove coordinates. In order to relate our results to existing work on submodular functions, we shall also use terminology from set functions. In this setting, we consider k-set functions, which assign a value to each tuple of k disjoint sets S = (S1, . . . , Sk), where Si ⊆ U and Si ∩ Sj = ∅ for all i 6= j. It is straightforward to check that the two notions are equivalent by having e ∈ Si if and only if xe = i. Then, we have xe = 0 if and only if e does not appear in any of the sets S1, . . . , Sk. The solution space over which we optimize our functions is thus the set of partitions of some subset U′ ⊆ U into k disjoint sets, where in our vector notation U′ is equivalent to the set of coordinates in x that are non-zero. We shall refer to a partition of the entire ground set U as an orthant of U , and use the word partial solution to refer to a partition of some subset of U , to emphasize that they may not necessarily assign every element in U to a set. Given a partial solution s and an orthant t, we say that s is in orthant t if s = t(cid:12)(cid:12)A for some set A ⊆ U . That is, s is in orthant t if and only if s agrees with t on all non-zero values. Consider the operations min0 and max0 given by min0(s, t) def = (0, min(s, t), s 6= 0, t 6= 0, s 6= t otherwise 4 and max0(s, t) def= (0, max(s, t), s 6= 0, t 6= 0, s 6= t otherwise, where min(s, t) (respectively, max(s, t)) returns the smaller (respectively, the larger) of s and t with respect to the usual order on the integers. Then, for vectors s and t in {0, . . . , k}U we let min0(s, t) (respectively, max0(s, t)) denote the vector obtained from applying min0 (respectively, max0) to s and t coordinate-wise. Using these operations we can define the general class of k-submodular functions: Definition 1. Given a natural number k ≥ 1 and a finite nonempty set U , a function f : {0, . . . , k}U → R+ is called k-submodular if for all s and t in {0, . . . , k}U , f (s) + f (t) ≥ f (min0(s, t)) + f (max0(s, t)). (1) Note that if s and t are both orthants, then we have min0(s, t) = max0(s, t) = id0(s, t), where the operation id0 on each coordinate of s and t is given by id0(s, t) = s = t if s = t, and id0(s, t) = 0 otherwise. Thus, if f is a k-submodular function, we have f (s) + f (t) ≥ 2f (id0(s, t)) (2) for any two orthants s and t of U . Example 2. The well-known Max-Cut problem demonstrates that maximizing (1-)submodular functions is NP-hard, even if the objective function is given explicitly [12]. We show that the same hardness result holds for any k ≥ 1. Consider the function f (u,v) : {0, . . . , k}{u,v} → R+ given by2 f (u,v)(xu, xv) = Jxu 6= xvK. It is easy to check that f (u,v) is k-submodular. Given a graph (V, E) with V = {1, . . . , n}, we consider the function f (x) =P{i,j}∈E f (i,j)(xi, xj). Because f is a positive combination of k-submodular functions, it is also k-submodular. Moreover, maximizing f amounts to solving the Max-k-Cut problem, which is NP-hard [31]. While concise, Definition 1 gives little intuition in the traditional setting of set functions. We now consider this setting in order to provide some intuition. Consider two partial solutions S = (S1, . . . , Sk) and T = (T1, . . . , Tk) and let s and t be the vectors in {0, . . . , k}U representing S and T , respectively. Consider some element e ∈ U . We have min0(se, te) = i 6= 0 precisely when se = te = i 6= 0. Thus, the vector min0(s, t) in Definition 1 corresponds exactly to the coordinate- wise intersection (S1 ∩ T1, . . . , Sk ∩ Tk) of S and T . Similarly, max0(se, te) = i 6= 0 precisely when either se = te 6= 0 or when one of se, te is i 6= 0 and the other is 0. Thus, the vector max0(s, t) corresponds exactly to the coordinate-wise union of S and T after we have removed any element e occurring in two different sets in S and T . That is, if we set X−i =Sj6=i (Sj ∪ Tj), then max0(s, t) corresponds to ((S1 ∪ T1) \ X−1, . . . , (Sk ∪ Tk) \ X−k). The removal of X−i from the ith union effectively enforces the condition that no element occurs in two different sets in the resulting partial solution. 2Here and throughout, we employ the Iverson bracket notation JpK to denote a value that is 1 when statement p is true and 0 when p is false. 5 The following equivalences, first observed by Cohen et al. [7], allow us to relate k-submodular functions to existing families of set functions. When k = 2, Definition 1 requires that f (S1, S2) + f (T1, T2) ≥ f (S1 ∩ T1, S2 ∩ T2) + f ((S1 ∪ T1) \ (S2 ∪ T2), (S2 ∪ T2) \ (S1 ∪ T2)), which agrees exactly with the definition of bisubmodular functions given in [10]. When k = 1, there is only a single set in each partial solution, and hence a single non-zero value in each corresponding vector, and so X−1 = ∅. Thus, Definition 1 requires that f (S1) + f (T1) ≥ f (S1 ∩ T1) + f (S1 ∪ T1), which agrees exactly with the standard definition of submodular functions [29]. It is well-known that for standard set functions submodularity is equivalent to the property of diminishing marginal returns. Let f : 2U → R+ be a set function on U and define the marginal value of e with respect to S as fe(S) def= f (S ∪ {e}) − f (S) for all S ⊆ U and e 6∈ S. Then, f is submodular if and only if fe(A) ≥ fe(B) for all A ⊆ B and e 6∈ B. We shall see that marginal returns also play an important role in characterizing k-submodular functions. In this setting, however, we must specify not only which element we are adding to the solution, but which set in the partition it is being added to. For a k-set function function f : {0, . . . , k}U → R+, an element e ∈ U , and a value i ∈ {1, . . . , k}, we define the marginal value fi,e(S) by fi,e(S) def= f (S1, . . . , Si−1, Si∪{e}, Si+1, . . . , Sk) − f (S1, . . . , Sk) for any partial solution S = (S1, . . . , Sk) such that e 6∈ Si for any i. Equivalently, in vector notation, we have def fi,e(s) = f (s + i · 1e) − f (s), where s is any partial solution satisfying se = 0, and 1e denotes the unit vector that is 1 in coordinate e and 0 in all other coordinates. Definition 3. Let k ≥ 1, and 1 ≤ r ≤ k. We say that a function f : {0, . . . , k}U → R+ is: • submodular in every orthant, if for any two partial solutions a and b in the same orthant of U , f (a) + f (b) ≥ f (min0(a, b)) + f (max0(a, b)). • r-wise monotone, if for any element e, any partial solution s with se = 0, and any set of r distinct values I ∈(cid:0){1,...,k} (cid:1): r fi,e(s) ≥ 0. Xi∈I We remark that the case of k = r = 1 corresponds to monotone submodular functions. In the case of k = r = 2, Ando, Fujishige, and Naito [2] have shown that these two properties give an exact characterization of the class of bisubmodular functions. In Section 3, we extend their result by showing that submodularity in every orthant and pairwise monotonicity in fact precisely characterize k-submodular functions for all k ≥ 2. 6 Let us now give some justification for the terminology “submodular in every orthant.” Let x be an orthant of U . Given a k-submodular function f , we call set function h : 2U → R+ defined for any S ⊆ U by h(S) def = f (x(cid:12)(cid:12)S) the function induced by x and f . In the language of set functions, the function h is obtained by first assigning each element e in U to a single set Xi (where i = xe). Then, h(S) is simply the value of f (S ∩ X1, . . . , S ∩ Xk). We now show f is k-submodular in an orthant (in the sense of Definition 3) if an only if the function h induced by this orthant and f is submodular. Lemma 4. Let (X1, . . . , Xk) be an orthant of U , with vector representation x. Then, f is k- submodular in the orthant x if and only if the function h induced by x and f is submodular. Proof. Let A and B be two subsets of U , with associated partial solutions a = x(cid:12)(cid:12)A and b = x(cid:12)(cid:12)B in orthant x. Then, note that e ∈ A ∩ B if and only min(ae, be) is non-zero, and e ∈ A ∪ B if and only if max(ae, be) is non-zero. Moreover, since a and b agree on all non-zero coordinates, we have min0(a, b) = min(a, b) and max0(a, b) = max(a, b). Hence, h(A ∪ B) = f (x(cid:12)(cid:12)A∪B) = f (max(x(cid:12)(cid:12)A, x(cid:12)(cid:12)B)) = f (max0(x(cid:12)(cid:12)A, x(cid:12)(cid:12)B)) = f (max0(a, b)), h(A ∩ B) = f (x(cid:12)(cid:12)A∩B) = f (min(x(cid:12)(cid:12)A, x(cid:12)(cid:12)B)) = f (min0(x(cid:12)(cid:12)A, x(cid:12)(cid:12)B)) = f (min0(a, b)). Thus, we have h(A) + h(B) ≥ h(A ∩ B) + h(A ∪ B) for any A, B ⊆ U if and only if for the associated partial solutions a, b in orthant x. f (a) + f (b) ≥ f (min0(a, b)) + f (max0(a, b)) Many of our proofs will use this connection between the standard notion of submodularity and the k-set functions in Definition 1. Specifically, we shall make use of the following result from Lee, Sviridenko, and Vondr´ak [25], which we restate here. Lemma 5 ([25, Lemma 1.1]). Let f be a non-negative submodular function on U . Let S, C ⊆ U and let {Tℓ}t ℓ=1 be a collection of subsets of C \ S such that each element of C \ S appears in exactly p of these subsets. Then t Xℓ=1 [f (S ∪ Tℓ) − f (S)] ≥ p[f (S ∪ C) − f (S)]. In fact, the following weaker statement will be sufficient for our purposes: Corollary 6 (of Lemma 5). Let f be a non-negative submodular function on U . Let S, C ⊆ U and let {Tℓ}t ℓ=1 be a collection of subsets of C \ S such that each element of C \ S appears in exactly p of these subsets. Then t Xℓ=1 f (S ∪ Tℓ) ≥ pf (S ∪ C). 7 Proof. Add Pt ℓ=1 f (S) to each side of the inequality in Lemma 5. This gives t Xℓ=1 t f (S ∪ Tℓ) ≥ p · f (S ∪ C) − p · f (S) + Xℓ=1 = p · f (S ∪ C) + (t − p) · f (S) ≥ p · f (S ∪ C), f (S) since p ≤ t. 3 Characterization of k-Submodularity Theorem 7. Let f : {0, . . . , k}U → R+ be a k-set function, where k ≥ 2. Then, f is k-submodular if and only if f is submodular in every orthant and pairwise monotone. In order to prove Theorem 7, we shall make use of the following lemma, which allows us to generalize pairwise monotonicity to solutions that disagree on the placement of multiple elements e. Lemma 8. Let k ≥ 2 and suppose that f : {0, . . . , k}U → R+ is submodular in every orthant and pairwise monotone. Let a and b in {0, . . . , k}U satisfy 0 6= ae 6= be 6= 0 for all e ∈ I and ae = be for all e ∈ U \ I, and define c = a(cid:12)(cid:12)U\I = b(cid:12)(cid:12)U\I . Then, f (a) + f (b) ≥ 2f (c). Proof. The proof is by induction on the size of I. In the case that I = 0, the claim is trivial. Suppose, then, that I = p > 0 and so I contains at least 1 element e. We can represent a and b as a = c + x, and b = c + y where x and y are vectors in {0, . . . , 1}U satisfying 0 6= xe 6= ye 6= 0 for all e ∈ I, and xe = ye = 0 for all e ∈ U \ I. Let e ∈ I be some element on which a and b disagree. We define ¯x = x(cid:12)(cid:12)I\{e} , and z = ¯x + ¯y. Then, we have f (a) + f (b) = f (c + x) + f (c + y) = [f (c + x) + f (c + z)] + [f (c + y) + f (c + z)]− 2f (c + z). (3) The solutions c + x and c + z disagree on precisely the single element e in I and are non-zero for this element. Thus, by the induction hypothesis , ¯y = y(cid:12)(cid:12){e} (4) Similarly, c + y and c + z disagree on precisely those p − 1 elements in I \ {e} and are non-zero for these elements. Thus, by the induction hypothesis f (c + x) + f (c + z) ≥ 2f (c + ¯x). Combining (3), (4), and (5) we obtain f (c + y) + f (c + z) ≥ 2f (c + ¯y). f (a) + f (b) ≥ 2f (c + ¯x) + 2f (c + ¯y) − 2f (c + z). (5) (6) Now, we note that c + ¯x and c + ¯y are both in the orthant c + z. Thus, from submodularity in every orthant, f (c + ¯x) + f (c + ¯y) ≥ f (min0(c + ¯x, c + ¯y)) + f (max0(c + ¯x, c + ¯y)) = f (c) + f (c + z). (7) Combining (6) and (7) we obtain f (a) + f (b) ≥ 2f (c) + 2f (c + z) − 2f (c + z) = 2f (c). 8 We now return to the proof of the Theorem 7. Proof of Theorem 7. We begin by showing that necessity of the two properties. Suppose that f is k-submodular. Then, submodularity in every orthant follows directly from (1). For pairwise monotonicity, let s satisfy se = 0. Consider any pair of distinct values i, j from {1, . . . , k}, and let si = s + i · 1e and sj = s + j · 1e. Then, fi,e(s) + fj,e(s) = f (si) − f (s) + f (sj) − f (s) ≥ f (min0(si, sj)) + f (max0(si, sj)) − 2f (s) = f (s) + f (s) − 2f (s). We now show that submodularity in every orthant and pairwise monotonicity imply k-sub- modularity. Let f be a function that is submodular in every orthant and pairwise monotone, and consider two arbitrary vectors x and y in {0, . . . , k}U . Let I be the set of all elements e ∈ U for which xe 6= 0, ye 6= 0 and xe 6= ye. We can write f (x) + f (y) = f (x) + f (y(cid:12)(cid:12)U\I ) + f (y) + f (max0(x, y)) − f (y(cid:12)(cid:12)U\I ) − f (max0(x, y)). We note that x and y(cid:12)(cid:12)U\I are in the same orthant, since they agree on all non-zero coordinates. Thus, f (x) + f (y(cid:12)(cid:12)U\I ) ≥ f (min0(x, y(cid:12)(cid:12)U\I )) + f (max0(x, y(cid:12)(cid:12)U\I )) = f (min0(x, y)) + f (max0(x, y) + x(cid:12)(cid:12)I ), where in the final equation we have used the fact that for all e ∈ I, xe 6= 0, ye 6= 0 and xe 6= ye and so min0(xi, yi) = max0(xi, yi) = 0. Similarly, we have y and max0(x, y) in the same orthant, and so (8) (9) (10) f (y) + f (max0(x, y)) ≥ f (min0(y, max0(x, y))) + f (max0(y, max0(x, y))) Combining (8), (9), and (10), we obtain = f (y(cid:12)(cid:12)U\I ) + f (max0(x, y) + y(cid:12)(cid:12)I ). f (x) + f (y) ≥ f (min0(x, y)) + f (max0(x, y) + x(cid:12)(cid:12)I ) + f (max0(x, y) + y(cid:12)(cid:12)I ) − f (max0(x, y)). (11) Finally, from Lemma 8 we have: Combining (11) and (12) then gives f (max0(x, y) + x(cid:12)(cid:12)I ) + f (max0(x, y) + y(cid:12)(cid:12)I) ≥ 2f (max0(x, y). (12) f (x) + f (y) ≥ f (min0(x, y)) + f (max0(x, y)). We now provide an example of a natural class of k-set functions which are submodular in every orthant and k-wise monotone but not k-submodular. 9 Example 9. Let f (u,v) : {0, . . . , k}{u,v} → R+ be given by: f (u,v)(xu, xv) = i=1Jxu < iK = k−xu i=1Ji < xvK = xv−1 k k xu = xv = 0 , xu 6= 0, xv = 0 , xu = 0, xv 6= 0 otherwise. 0, 1 1 kPk kPk   Jxu < xvK, The function f (u,v) has the following intuitive interpretation: we begin with the valued constraint Jxu < xvK, where xu and xv range over {1, . . . , k}. This gives a function that is defined on all orthants. We extend the function to partial assignments by setting f (u,v)(0, 0) = 0, and otherwise assigning f (u,v)(xu, 0) and f (u,v)(0, xv) the probability that xu > i and i > xv, respectively, when i is chosen uniformly at random from {1, . . . , k}. The function f (u,v) arises in the following graph layout problem: we are given a directed graph G = (V, E) and a number k, and we wish to partition V into k layers so that as many directed edges as possible travel from a lower- to a higher-numbered layer. This problem is equivalent to maximizing the function f (x) : {0, . . . , k}V → R+ given by f (x) =P(u,v)∈E f (u,v)(xu, xv) Although this function allows some vertices to remain unassigned, k-wise monotonicity implies that there is always a maximizer of f that is an orthant. We now show that f (u,v) is submodular in every orthant and k-wise monotone. Fix an orthant (xu = i, xv = j), where i, j ∈ {1, . . . , k}, and let h be the submodular function induced by f (u,v) and this orthant. If i ≥ j, we have hu(∅) = h({u}) − h(∅) = k − i k hu({v}) = h({u, v}) − h({v}) = − j − 1 k while if i < j (and hence i ≤ j − 1), we have: hv(∅) = h({v}) − h(∅) = j − 1 k hv({u}) = h({u, v}) − h(∅) = − k − i k , hu(∅) = h({u}) − h(∅) = k − i k hv(∅) = h({v}) − h(∅) = hu({v}) = h({u, v}) − h({v}) = 1 − In all cases, we observe that the marginals of h are decreasing, and so h is a submodular function. (0, 0) is non-negative for (0, 0) ≥ 0 for all e ∈ {u, v}. For the remaining marginals, In order to show that f (u,v) is k-wise monotone, we note that f (u,v) hv({u}) = h({u, v}) − h(∅) = 1 − = i,e i,e . i = 1 − k j − 1 k ≤ 1 − i k j − 1 k ≥ i k k − i k i k k i=1 f (u,v) all values of i and e, and so Pk suppose that j 6= 0. Then, for we have  Xi=1 Ji < jK −  Xi=1 Jj < iK − Xi=1 Xi=1 f (u,v) i,u (0, j) = f (u,v) i,v (j, 0) = k k k k k Xi=1 Ji < jK − Xi=1 Jj < iK − k Xp=1 Xp=1 k Jp < jK = 0, Jj < pK = 0. 1 k 1 k j Xp=1 Xp=1 j Jp < jK  = Jj < pK  = 10 4 The Naive Random Algorithm We now consider the performance of the naive random algorithm for maximizing a k-submodular function f : {0, . . . , k}U → R+. Note that pairwise monotonicity of f , guaranteed by Theorem 7, implies that any partial solution S ∈ {0, . . . , k}U can be extended greedily to an orthant of U without any loss in the value of f , since for every element e 6∈ S, we must have fi,e(S) ≥ 0 for some i ∈ {1, . . . , k}. Thus, we may assume without loss of generality that f takes its maximum value on some orthant o. We now consider the expected performance of a random algorithm that simply selects an orthant of U uniformly at random. Theorem 10. Let f : {0, . . . , k}U → R+ be a k-submodular function attaining its maximum value on orthant o, and let x be an orthant of U selected uniformly at random. Then, E[f (x)] ≥ 1 4 f (o) if k = 2, and E[f (x)] ≥ 1 k f (o) if k ≥ 3. We present the analysis for the case in which k ≥ 3 first, as it is simpler and will aid in motivating some of the constructions used for the case k = 2. 4.1 Analysis for k ≥ 3 Let h : 2U → R+ be the submodular function induced by o and f . For each e ∈ U we consider a fixed permutation πe on the set {1, . . . , k} with the property that πe(oe) = oe and πe(z) 6= z for all z ∈ {1, . . . , k} \ {oe}.3 Then, we denote by π(x) the vector (πe(xe))e∈U . Let P (A) be the set of orthants of U that agree with o on exactly those coordinates e ∈ A. The following lemma allows us to relate the sum of the values of all partitions in P (A) to the value of o. Lemma 11. For each set A ⊆ U , f (x) ≥ (k − 1)n−Ah(A). Xx∈P (A) Proof. Consider the sum Px∈P (A) f (π(x)). Because πe(xe) = oe if and only if xe = oe already, we have π(x) ∈ P (A) if and only if x ∈ P (A). Then, because each πe is a bijection, we have Xx∈P (A) f (x) = Xx∈P (A) f (π(x)), and so, f (x) = Xx∈P (A) 1 2  Xx∈P (A) f (x) + Xx∈P (A) f (π(x))  = 1 2 Xx∈P (A) [f (x) + f (π(x))] . (13) Now, we note that x and π(x) are both orthants. Thus, from (2) we have 3Such a permutation can be obtained by taking, for example, πe(oe) = oe, πe(oe − 1) = oe + 1, and π(z) = z + 1 mod k for all other z ∈ {1, . . . , k}. f (x) + f (π(x)) ≥ 2id0(x, π(x)). 11 Consider an arbitrary coordinate e ∈ U . hence id0(xe, πe(xe)) = xe. id0(xe, πe(xe)) = 0. Thus, If e ∈ A we have xe = oe and so πe(xe) = xe and If e 6∈ A, then we have xe 6= oe and so πe(xe) 6= xe and hence Combining this with (13) we have, f (x) = Xx∈P (A) 1 2 Xx∈P (A) 2id0(x, π(x)) = 2f (o(cid:12)(cid:12)A) = 2h(A). [f (x) + f (π(x))] ≥ Xx∈P (A) h(A) = (k − 1)n−Ah(A), since there are precisely k − 1 choices i 6= oe for xe for each of the n − A coordinates e 6∈ A. We now complete the proof of Theorem 10 in the case k ≥ 3. We formulate the expectation as E[f (x)] = 1 kn n Xi=0 XA∈(U i ) Xx∈P (A) f (x). Using Lemma 11 we obtain n Xi=0 XA∈(U i ) Xx∈P (A) f (x) ≥ n Xi=0 XA∈(U i ) (k − 1)n−ih(A). (14) Consider a fixed value i ∈ {0, . . . , n}. Each element e ∈ U appears in exactly (cid:0)n−1 A ∈(cid:0)U i(cid:1). Because h is submodular, Corollary 6 then implies that i − 1(cid:19)h(U ) =(cid:18)n − 1 h(A) ≥(cid:18)n − 1 i − 1(cid:19)f (o). XA∈(U i ) i−1(cid:1) of the (cid:0)n i(cid:1) sets (15) Combining (14) and (15) with our formulation of E[f (x)] we obtain: E[f (x)] ≥ = = = = = n−1 i − 1(cid:19)(k − 1)n−if (o) Xi=0(cid:18)n − 1 i − 1(cid:19)(k − 1)−(i−1)f (o) Xi=0(cid:18)n − 1 i (cid:19)(k − 1)−if (o) k − 1(cid:19)n−1 ·(cid:18)1 + · f (o) (k − 1)n−1 · f (o) · kn−1 1 n Xi=0(cid:18)n − 1 1 kn (k − 1)n−1 n kn (k − 1)n−1 kn (k − 1)n−1 kn kn (k − 1)n−1 1 k · f (o). 12 4.2 Analysis for k = 2 Now we consider the case in which f is a bisubmodular function, i.e. the case of k = 2. In the previous analysis of k-submodular functions for k ≥ 3 we used a bijection πe on {1, . . . , k} with the property that πe(oe) = oe and πe(z) 6= z for all z 6= oe. However, when k = 2, no such bijection exists and we must adopt a different approach. Suppose again that f attains its maximum on orthant o ∈ {1, 2}U . For a value v ∈ {1, 2} we let ¯v def= (v mod 2) + 1 (i.e. the other value in {1, 2}). Then, for any disjoint subsets A and B of U we define the (partial) solution T (A, B) by T (A, B)i =  oi, ¯oi, 0, i ∈ A i ∈ B otherwise . It will simplify our analysis to work with with symmetrized values, which depend only on the sizes of the sets A and B chosen. We define Fi,j =(cid:18)n i(cid:19)−1(cid:18)n − i j (cid:19)−1 XA∈(U i ) XB∈(U \A j ) [f (T (A, B))]. Then, Fi,j gives the average value of f over all partial solutions on i + j elements that agree with o on exactly i and disagree with it on exactly j elements. In particular, we have Fn,0 = f (o), and Fi,n−i =(cid:0)n Lemma 12. For all i such that 0 ≤ i ≤ n, i(cid:1)−1PA∈(U i ) f (T (A, U \ A)). Our next lemma relates these two values. Fi,n−i ≥ i(i − 1) n(n − 1) Fn,0. (16) Proof. We prove 2 separate inequalities which together imply the lemma. First, we shall show that for all 1 ≤ i ≤ n − 1, (17) Fi,n−i ≥ Fi−1,n−i−1. We do this by showing that a related inequality holds for arbitrary sets of the appropriate size, and then average over all possible sets to obtain (17). Fix 1 ≤ i ≤ n − 1 and let A be any subset of U of size i + 1. Set B = U \ A and let x and y any two distinct elements in A. Consider the solutions T (A − x, B + x) and T (A − y, B + y)4. They are both orthants and agree on all elements except x and y. Thus, from (2), the inequality f (T (A − x, B + x)) + f (T (A − y, B + y)) ≥ 2id0(T (A − x, B + x), T (A − y, B + y)) = 2f (T (A − x − y, B)) holds for any such choice of A, x, and y, where A = i + 1 and B = U \ A = n− i− 1. Averaging the resulting inequalities over all possible choices for A, B = U \ A, x, and y and dividing both sides by 2 then gives (17). 4Here, we employ the shorthand A + x for A ∪ {x} and A − x for A \ {x}. 13 Next, we show that for any 1 ≤ i ≤ n − 1, Fi−1,n−i−1 ≥ i − 1 i + 1 Fi+1,n−i−1. (18) Again fix i ≥ 1, let A be any subset of U of size i + 1 and set B = U \ A. Let h be the submodular function induced by the orthant T (A, B) and f . Note then, that we can express h as h(X) = T (A ∩ X, B ∩ X)). We consider the sum: XC∈(A 2) [f (T (A \ C, B)) − T (∅, B)] = XC∈(A 2) [h(U \ C) − h(B)] Each element of A appears in exactly (cid:0)A−1 2 (cid:1) = (cid:0)i 2(cid:1) of the sets U \ C above (one for each way to choose a two element set C from the remaining A − 1 elements). Applying Corollary 6 we then obtain h(U \ C) ≥(cid:18)i 2(cid:19)h(U ) =(cid:18)i 2(cid:19)T (A, B). XC∈(A 2) Altogether, we obtain the inequality f (T \ C, B) ≥(cid:18)i 2(cid:19)T (A, B), XC∈(A 2) valid for any choice of A, with A = i + 1, and B = U \ A = n − i − 1. Averaging the resulting inequalities over all possible choices for A, we obtain (cid:18)i + 1 2 (cid:19)Fi−1,n−i−1 ≥(cid:18)i 2(cid:19)Fi+1,n−i−1, which is equivalent to (18). Combining (17) and (18) then gives the symmetrized inequality Fi,n−i ≥ i − 1 i + 1 Fi+1,n−i−1. (19) The desired inequality (16) then follows from reverse induction on i. If i = n, then (16) is trivial. For the inductive step, we suppose that 1 ≤ i ≤ n − 1. Then, applying (19) followed by the induction hypothesis gives Fi,n−i ≥ i − 1 i + 1 Fi+1,n−i−1 ≥ i − 1 i + 1 · (i + 1)i n(n − 1) Fn,0 = i(i − 1) n(n − 1) Fn,0. If i = 0, we cannot apply (19). In this case, however, (16) follows directly from non-negativity of f . We now complete the proof of Theorem 10 in the case that k = 2. We can formulate the expectation in terms of our symmetric notation as E[f (x)] = 2−n n Xi=0 XA∈(U i ) T (A, U \ A) = 2−n 14 n Xi=0(cid:18)n i(cid:19)Fi,n−i. Then, we have 2−n n Xi=0(cid:18)n i(cid:19)Fi,n−i ≥ 2−n ≥ 2−n Fn,0 n n n = 2−n i(cid:19)Fi,n−i i(cid:19) i(i − 1) n(n − 1) i − 2(cid:19)Fn,0 i (cid:19)Fn,0 Xi=2(cid:18)n Xi=2(cid:18)n Xi=2(cid:18)n − 2 Xi=0(cid:18)n − 2 = 2−n · 2n−2Fn,0 = = 2−n f (o), n−2 1 4 where the first inequality follows from non-negativity of f (and hence of F ) and the second inequality follows from Lemma 12. Example 13. As a tight example for k = 2, we consider the function f (u,v) defined as in Example 9 for the special case in which k = 2. Then, the resulting function is submodular in every orthant and 2-wise monotone and hence must be bisubmodular. Moreover, the probability that a random orthant will set xu = 1, and xv = 2 is 1 4 , and the function has value 0 for all other orthants. Thus, E[f (u,v)(x)] = 1 4 , whereas the maximum value is 1. This example is easily extended to ground sets U = {u} ∪ V of arbitrary size, by setting f (x) = Pv∈V f (u,v)(xu, xv). This function is also bisubmodular as it is a positive combination of bisubmodular functions. Moreover, the assignment setting xu = 1 and xv = 2 for all v ∈ V has value V , but by linearity of expectation a uniform random assignment has expected value only 4V . Example 14. As a tight example for k ≥ 3, we consider the single-argument k-submodular function f (e) : {0, . . . , k}{e} given by f (xe) = Jxe = 1K. It is easy to verify that this function is indeed k- submodular. Moreover, a uniform random assignment sets xe = 1 with probability only 1 k , and so E[f (e)(xe)] = 1 k . Similar to the previous example, we can generalize to an arbitrary ground set U by setting f (x) = Pe∈U f (e)(xe). We note also that the value 1 in the definition of each f (e) can be replaced by any value p ∈ {1, . . . , k}. 1 5 A Deterministic Greedy Algorithm In this section we consider a deterministic greedy algorithm for maximizing a k-set function f : {0, . . . , k}U → R+, that is submodular in every orthant and r-wise monotone for some 1 ≤ r ≤ k, where k ≥ 2. As a special case, we obtain an approximation algorithm for k-submodular functions. The algorithm begins with the initial solution s = 0 and considers elements of the ground set U in some arbitrary order, permanently setting se = i for each element e, based on the increase that this gives in f . Specifically, the algorithm sets se to the value i that yields the largest marginal 15 Deterministic Greedy s ← 0 for each e ∈ U do for i = 1 to k do yi ← fi,e(s) y = max(y1, . . . , yk) Let q be the smallest value from {1, . . . , k} so that yi = y. se ← q return s increase fi,e(S) in f with respect to the current solution s. If there is more than one option we set se the smallest such i giving the maximal increase. Theorem 15. Let s be the solution produced by the deterministic greedy algorithm on some instance f : {0, . . . , k}U → R+ that is submodular in every orthant and r-wise monotone for some 1 ≤ r ≤ k, and let o be the optimal solution for this instance. Then, (1 + r)f (s) ≥ f (o). Proof. Our analysis considers 2 sequences of n solutions. First let, s(j) be the algorithm’s solution after j elements of U have been considered, and let U (j) be the set of elements that have been considered. Let o(j) = o(cid:12)(cid:12)U\U (j) + s(j) be a partial solution that agrees with s(j) on the placement of the elements considered by the greedy algorithm in its first j phases and with o on the placement of all other elements. Note that in particular we have o(0) = o and o(n) = s. Our analysis of the greedy algorithm will bound the loss in f (o(j)) incurred at the each stage by the improvement in s(j) made by the algorithm. In Lemma 16, we show that for every 0 ≤ j ≤ n, f (o(j))− f (o(j+1)) ≤ r[f (s(j+1)) − f (s(j))]. Summing this inequality from j = 0 to n − 1, we obtain n−1 Xj=0hf (o(j)) − f (o(j+1))i ≤ r n−1 Xj=0hf (s(j+1)) − f (s(j))i . Telescoping the summations on each side, we then have f (o(0)) − f (o(n)) ≤ rhf (s(n)) − f (s(0))i . The theorem then follows immediately from the facts o(0) = o, o(n) = s(n) = s, and s(0) ≥ 0. It remains to show the following inequality. Lemma 16. For 0 ≤ j ≤ n − 1, f (o(j)) − f (o(j+1)) ≤ rhf (s(j+1)) − f (s(j))i . 16 Proof. Let e be the element considered in the (j + 1)th phase of the algorithm. We define the solution t = o(cid:12)(cid:12)U\U (j+1) + s(j), and let ai = fi,e(t) for 1 ≤ i ≤ k. Then, we note that for any value i, t + i · 1e and s(j) + i · 1e are in the same orthant. For some value i, let h be the submodular function induced by this orthant and f . Then h must be submodular, and so yi = fi,e(s(j)) = he(U (j)) ≥ he(U \ {e}) = fi,e(t) = ai. Suppose that in the optimal solution we have oe = p but the greedy algorithm sets se ← q. Then, we observe that f (o(j)) = f (t) + fp,e(t) and f (o(j+1)) = f (t) + fq,e(t), and so Similarly, f (o(j)) − f (o(j+1)) = fp,e(t) − fq,e(t) = ap − aq. f (s(j+1)) − f (s(j)) = fp,e(s(j)) = yj. By r-wise monotonicity, for any I ⊆ {1, . . . , k} with I = r we have Pℓ∈I aℓ ≥ 0 and thus −aq ≤ Pℓ∈I\{q} aℓ. Therefore, ap − aq ≤ ap +Pℓ∈I\{q} aℓ ≤ r · yq as ai ≤ yi for every 1 ≤ i ≤ k and yq = max(y1, . . . , yk). Combining Theorem 7 and Theorem 15 gives us the following. Corollary 17. Let s be the solution produced by the deterministic greedy algorithm for some k- submodular function f : {0, . . . , k}U → R+, and let o be an optimal solution for this instance. Then, 1 3 f (s) ≥ f (o). The following is a tight example for Theorem 15. Example 18. Let 0 ≤ r ≤ k and consider the function f (u,v) : {0, . . . , k}{u,v} → R+ given by f (u,v)(xu, xv) = 1 r+1 Jxu 6= 1 ∧ xv = 2K. We shall first show that f (u,v) is submodular in every orthant and r-wise monotone. Fix an orthant (xu = i, xv = j) with j 6= 2, and let h be the function induced by f (u,v) and this r+1 Jxu 6= 0K + r orthant. Then, the marginals of h are given by: hu(∅) = h({u}) − h(∅) = 1 r+1 hu({v}) = h({u, v}) − h({v}) = 1 r+1 hv(∅) = h({v}) − h(∅) = 0 hv({u}) = h({u, v}) − h({u}) = 0. Now, fix an orthant (xu = i, xv = 2), and let h be the function induced by f (u,v) and this orthant. We have hu(∅) = h({u}) − h(∅) = 1 r+1 hv(∅) = h({v}) − h(∅) = r r+1 hu({v}) = h({u, v}) − h({v}) = 1 r+1 Ji 6= 1K. In all cases, the marginals of h are decreasing, and so f (u,v) is submodular in every orthant. We now show that f (u,v) is r-wise monotone. The marginals of f (u,v) are non-negative, except the one r+1Ji = 1K hv({u}) = h({u, v}) − h({u}) = r r+1 − r 17 obtained by setting xu from 0 to 1 in the case that xv = 2. Thus, the only non-trivial case is that in which xv = 2, and I is a set of r distinct values with 1 ∈ I. In this case, Xi∈I [f (u,v) i,u (0, 2)] = f (u,v)(1, 2) − f (u,v)(0, 2) + Xi∈I\{1} [f (u,v)(i, 2) − f (u,v)(0, 2)] = 1 r + 1 − r r + 1 + (r − 1) · 1 r + 1 = 0. i,u (0, 0) = 1 Now, we analyze the performance of the deterministic greedy algorithm on f (u,v). We suppose, without loss of generality, that the algorithm considers u before v. When u is considered, we have s = 0 and f (u,v) r+1 for all i ∈ {1, . . . , k}, and so the algorithm sets su = 1. In the next iteration, we have f (u,v) (1, 0) = 0 for all values i ∈ {1, . . . , k}, and so the algorithm set sv = 1 and returns s = (1, 1). We then have f (u,v)(s) = 1 r+1 , but f (u,v)(2, 2) = 1. As in previous examples, we can easily obtain a function over ground sets of arbitrary size by summing the values of several different functions f (u,v). i,v 6 A Randomized Greedy Algorithm In this section we consider the performance of a simple randomized greedy algorithm for maximizing a k-set function that is submodular in every orthant and k-wise monotone. Our algorithm is inspired by the algorithm of Buchbinder et al. [5] for unconstrained submodular maximization. It begins with the initial solution s = 0 and considers elements of the ground set U in some arbitrary order, permanently setting se to some value i ∈ {1, . . . , k}, based on the marginal increase in f that this yields. Specifically, the algorithm randomly sets se = i with probability proportional to the resulting marginal increase fi,e(s) in f with respect to the current solution s. If fi,e(s) < 0, we set se = i with probability 0. Note that Theorem 7 shows that we cannot have fi,e(s) < 0 for all i, but it may be the case that fi,e(s) = 0 for all i. In this case, we set se = 1. Randomized Greedy s ← 0 for each e ∈ U do for i = 1 to k do i=1 yi yi ← max(0, fi,e(s)) β =Pk if β 6= 0 then Let q ∈ {1, . . . , k} be chosen randomly, with Pr[i = ℓ] = xℓ se ← q se ← 1 else return s β for all ℓ ∈ {1, . . . , k}. Theorem 19. Let f : {0, . . . , k}U be a k-set function that is submodular in every orthant and k-wise monotone, where k ≥ 2. Let o be orthant of U that maximizes f and let s be the orthant 18 produced by the randomized greedy algorithm. Then, 1 +r k 2! E[f (s)] ≥ f (o). Proof. As in the analysis of the deterministic greedy algorithm, we considers 2 sequences of n solutions. Let s(j), and o(j) be defined as in the proof of Theorem 15, and note that s (and hence each s(j)) is now a random variable depending on the random choices made by the algorithm. In Lemma 20, we bound the expected decrease E[f (o(j)) − f (o(j+1))] relative to the increase E[f (s(j+1)) − f (s(j))] in each iteration. Specifically, we show that E[f (s(j+1)) − f (s(j))] for all j. Summing the resulting inequalities for j = 0 to n, we then obtain E[f (o(j)) − f (o(j+1))] ≤ r k 2 n Xj=0 E[f (o(j)) − f (o(j+1))] ≤r k 2 n Xj=0 E[f (s(j+1)) − f (s(j))], which simplifies to (20) E[f (o(0))] − E[f (o(n))] ≤r k E[f (s(n))]. 2 (cid:16)E[f (s(n))] − E[f (s(0))](cid:17) ≤r k 2 The theorem then follows from the definitions o(0) = o, and s(n) = o(n) = s. We now show that inequality (20) must hold. Lemma 20. For any 0 ≤ j ≤ n, E[f (o(j)) − f (o(j+1))] ≤r k 2 E[f (s(j+1)) − f (s(j))]. Proof. Let e be the element of U considered by the randomized greedy algorithm in the (j + 1)th phase, and let U (j) and o(j) be defined as in the proof of Theorems 19 and 15. We condition on an arbitrary, fixed value for both s(j), o(j), and consider the expectation over choices the algorithm makes for e. Because our result will hold for an arbitrary s(j) or o(j) it then extends to the expectation over the first j choices made by the algorithm. As in the proof of Lemma 16, we define the solution t = o(cid:12)(cid:12)U (j−1) + s(j−1), and set ai = fi,e(t) for 1 ≤ j ≤ k. Let the values yi be defined as in the algorithm. Then, as in the proof of Lemma 16, submodularity of f in every orthant implies that Moreover, r-wise monotonicity of f implies that ai ≤ yi for every i ∈ {1, . . . , k}. ai ≥ 0 for all I ∈(cid:18){1, . . . , k} r (cid:19). Xi∈I 19 (21) (22) Finally, by the construction of Algorithm 6, we have yi ≥ 0 for each 1 ≤ i ≤ k. Now, let suppose that in the optimal solution oe = p but the greedy algorithm sets se ← q. Then, we have f (o(j)) = f (t) + fp,e(t) and f (o(j+1)) = f (t) + fq,e(t), and so, as in the proof of Lemma 16, and f (o(j)) − f (o(j+1)) = fp,e(t) − fq,e(t) = ap − aq, f (s(j+1)) − f (s(j)) = fq,e(s(j)) = yq. For any given value q, the probability that the greedy algorithm makes such a choice is precisely yq/β, and so E[f (s(j+1)) − f (s(j))] = y2 i , 1 β Xi and E[f (o(j)) − f (o(j+1))] = 1 β Xi yi(ap − ai) = 1 β Xi6=p yi(ap − ai). In order to prove the lemma it is thus sufficient to show that yj(ap − ai) ≤r k 2 Xi Xi6=p y2 i . (23) For any value of y1, . . . , yk, the left hand side of (23) is upper bounded by the optimal value of the following linear program in a1, . . . , ak, whose constraints are given by (21) and (22): yi(ap − ai) maximize Xi6=p subject to ai ≤ yi, ai ≥ 0, Xi∈I for 1 ≤ i ≤ k for all I ∈(cid:18){1, . . . , k} r (cid:19) We consider an optimal, extreme-point solution a∗1, . . . , a∗k for this program. We first note that by increasing ap we cannot violate the final constraint and can only increase the objective, and so we may assume that a∗p = yp. Of the remaining k constraints, k − 1 must be tight, of which k − 2 must be of the first type. Hence, for all i except at most 1 value ℓ 6= p, we in fact have a∗i = yi. This accounts for k − 1 total tight constraints. The final tight constraint must imply either a∗ℓ = yℓ or Pi a∗i = 0. Because a∗i = yi for all i 6= ℓ, the latter is equivalent to a∗ℓ = −Pi6=ℓ yi. Moreover, because yi ≥ 0 for all i, setting a∗ℓ = −Pi6=ℓ yi always gives an objective value at least as large as for all i 6= ℓ, and a∗ℓ = −Pi6=ℓ yi, where ℓ is some value distinct from p. setting a∗ℓ = yℓ. Thus, we can characterize the optimal solution to this linear program by a∗i = yi 20 Returning to (23), we have Xi6=p yi(a∗p − a∗i ) yi(yp − yi) + yℓ yi(ap − ai) ≤Xi6=p = Xi6=p,ℓ = 2yℓyp + Xi6=p,ℓ yp +Xi6=ℓ [yℓyi + ypyi − y2 i ], yi  for any y1, . . . , yk ≥ 0. In order to prove (23) it then suffices to show that 0 ≤ αXi y2 i − 2yℓyp − Xi6=p,ℓ [yℓyi + ypyi − y2 i ], (24) where α =q k as the following sum of squares: 2 . This follows directly from the fact that the right hand side of (24) can be written (yℓ − yp)2 + Xj6=o,ℓ r α − 1 k − 2 yℓ −r α + 1 2 yi!2 + Xj6=o,ℓ r α − 1 k − 2 yp −r α + 1 2 yi!2 . (25) In order to verify that this is the case, we note that (yℓ − yp)2 = y2 ℓ − 2yℓyp + y2 p and r α − 1 k − 2 yℓ −r α + 1 2 yi!2 = = = = = = α − 1 k − 2 α − 1 k − 2 α − 1 k − 2 α − 1 k − 2 α − 1 k − 2 α − 1 k − 2 yℓyi + y2 y2 ℓ − 2s (α − 1)(α + 1) 2(k − 2) ℓ − 2s α2 − 1 2(k − 2) ℓ − 2s k 2 − 1 2(k − 2) ℓ − 2s k−2 2(k − 2) ℓ − 2r 1 yℓyi + 4 y2 ℓ − yℓyi + 2 y2 i , α + 1 α + 1 yℓyi + yℓyi + y2 y2 y2 2 2 yℓyi + α + 1 2 y2 i α + 1 2 α + 1 2 α + 1 2 y2 i y2 i y2 i y2 i and, similarly, r α − 1 k − 2 yp −rα + 1 2 yi!2 = α − 1 k − 2 y2 p − ypyi + α + 1 2 y2 i 21 Thus, (25) is equal to = y2 = y2 y2 ℓ − 2yℓyp + y2 2 α + 1 ℓ − 2yℓyp + y2 ℓ − 2yℓyp + y2 ℓ + αy2 y2 ℓ − yℓyi + p + Xi6=p,ℓ(cid:20) α − 1 k − 2 p + (α − 1)y2 p + (α − 1)y2 p − 2yℓyp + α Xi6=p,ℓ i − 2yℓyp − Xi6=p,ℓ(cid:2)yℓyi + ypyi − y2 i(cid:3) . ℓ + (α − 1)y2 ℓ + (α − 1)y2 i − Xi6=p,ℓ(cid:2)yℓyi + ypyi − y2 y2 i(cid:3) y2 = αy2 = αXi y2 i(cid:21) + Xi6=p,ℓ(cid:20) α − 1 k − 2 α + 1 y2 2 p − Xi6=p,ℓ(cid:20)yℓyi − p − Xi6=p,ℓ(cid:2)yℓyi + ypyi − (α + 1)y2 i(cid:3) α + 1 2 y2 p − ypyi + i(cid:21) − Xi6=p,ℓ(cid:20)ypyi − y2 i(cid:21) α + 1 2 y2 i(cid:21) The guarantees we obtain for the randomized greedy algorithm are better than for the deter- ministic greedy algorithm on r-wise monotone k-set functions only when k is small or r is large. While we do not have a tight example for the randomized greedy algorithm on r-wise monotone k-set functions for every fixed value of r and k, the following example confirms that the random- ized algorithm can indeed perform worse than the deterministic algorithm for k-submodular (i.e. pairwise monotone) functions, once k grows large enough. This behavior is somewhat unintuitive, as the randomized greedy algorithm has an expected approximation ratio of 1/2 for bisubmodular functions, while the deterministic greedy algorithm has an approximation ratio of only 1/3. Example 21. Consider the weighted set-coverage function f (u,v) : {0, . . . , k}{u,v} → R+ given as follows. We have a universe {a, b} where a has weight 1 and b has weight γ = 1√k−1 . Additionally, we have sets S1 = {a} and Si = {b} for every 2 ≤ i ≤ k, and Ti = {b}, for every 1 ≤ i ≤ k. The value of f (u,v)(xu, xv) is then simply the total weight of all elements in Su ∪ Tv. The function induced by f (u,v) and any orthant is then a weighted set coverage function, and so is submodular. Moreover, all marginals of f (u,v) are non-negative and so f (u,v) is trivially r-wise monotone for any r. We now consider the performance of the randomized greedy algorithm on f (u,v). We suppose, without loss of generality, that the greedy algorithm considers u before v. Initially we have s = 0, and in the first phase, the algorithm sets su ← 1 with probability 1+(k−1)γ and for each 2 ≤ i ≤ k, sets su ← i with probability 1+(k−1)γ . In the next step, the algorithm considers v. We note that all the sets Ti are identical, and so the algorithm’s particular choice in this phase does not affect the final value of the function. The solution s produced by the algorithm has value 1 + γ if su = 1 and γ otherwise. Thus, the expected value of solution produced by the algorithm is: 1 γ 1 + γ + (k − 1)γ2 1 + (k − 1)γ = 2 + γ 1 + (k − 1)γ . The optimal value of f (u,v) is 1 + γ and so the expected approximation ratio of the randomized greedy algorithm on f (u,v) is α = 2 + γ 1 + (k − 1)γ · 1 1 + γ = 2 + γ 1 + (k − 1)γ + γ + (k − 1)γ2 = 2 + γ 2 + kγ . 22 In particular, for all k ≥ 21, we have α < 1/3. For large k, α is approximately 1/(cid:18)1 +q k appendix, we show that the randomized greedy algorithm does indeed attain a similar, improved ratio for k-submodular functions. 4(cid:19). In the 7 Conclusion In the preceding sections we have considered the problem of maximizing k-submodular functions by both a random partition and two simple simple greedy algorithms. In the case of maximizing a bisubmodular function, we obtained the same approximation ratios as those already known in the submodular case: 1/4 for the naive random solution [9] and 1/2 via a randomized greedy approach [5]. We can make this correspondence more explicit by considering the following embedding of a submodular function into a bisubmodular function. Given a submodular function g : 2U → R+, we consider the biset function f : 3U → R+ defined by f (S, T ) def= g(S) + g(U \ T ) − g(U ). (26) This embedding has been studied by Fujishige and Iwata, who show that the function f is bisub- modular and has the following property: if (S, T ) is a minimizer (maximizer) of f then both S and U \ T are minimizers (maximizers) of g [11]. Thus, exact 2-submodular function minimization (maximization) is a generalization of 1-submodular function minimization (maximization). We can in fact show a stronger result: that this embedding preserves approximability. Suppose that some algorithm gives a α-approximation for bisubmodular maximization. Then, consider an arbitrary submodular function g and let f be the embedding of g defined as in (26). Let O = (O1, O2) be a maximizer f , and suppose that the algorithm returns a solution S = (S1, S2). Then, since f is pairwise monotone, we can greedily extend S to a partition S′ = (S′1, S′2) of U . Similarly, we can assume without loss of generality that O is a partition of U . Then, we have f (U \ S′2) = f (S′1) and f (U \ O2) = f (O2), and so 1 2(cid:0)g(S′1) + g(U \ S′1)(cid:1) 2(cid:0)f (S′1, S′2) + g(U )(cid:1) (αf (O1, O2) + g(U )) g(S′1) = = ≥ = 1 1 2 1 2 1 2 (αg(O1) + αg(U \ O2) + (1 − α)g(U )) (αg(O1) + αg(U \ O2)) ≥ = αg(O1). Since O1 is a maximizer of g, the resulting algorithm is an α-approximation for maximizing g. Hence, the 1/2 + ǫ inapproximability results of [9, 8] hold for bisubmodular maximization as well, in both the value oracle setting and under the assumption that N P 6= RP . The embedding (26) also allows us to provide new intuition for the performance of the ran- domized greedy algorithm for submodular maximization considered by Buchbinder et al. [5]. This algorithm maintains 2 solutions, S1 and S2 which are initially ∅ and U . At each step, it considers 23 an element e, and either adds e to S1 or removes e from S2, with probability proportional to the resulting increase in the submodular function in either case. In comparison, we consider the case in which we embed a submodular function g into a bisub- modular function f using (26) and then run the greedy algorithm of Section 6 on f . Suppose at some step we have a current solution T = (T1, T2) and we consider element e, and define S1 = T1 and S2 = U \ T2. The algorithm will add e to either T1 or T2 with probability proportional to the result- ing increase in f . In the first case, this increase is precisely g(T1 + e) − g(T1) = g(S1 + e) − g(S1), and adding e to T1 corresponds to adding e to S1. In the second case this increase is precisely g(U \ T2) − g(U \ (T2 + e)) = g(S2) − g(S2 − e) and adding e to T1 corresponds to removing e from S1. Thus, the operation of the algorithm of Buchbinder et al. [5] may be viewed as that of the natural, straightforward randomized greedy algorithm presented in Section 6, viewed through the lens of the embedding (26). An interesting open question is whether the symmetry gap technique from [39, 8] can be gen- eralized to obtain hardness results for k-submodular maximization for k ≥ 3, and, more generally, for maximizing k-set functions that are submodular in every orthant and r-wise monotone for some 1 ≤ r ≤ k. Acknowledgments We are grateful to Maxim Sviridenko for many insightful conversations. References [1] Kazutoshi Ando. K-submodular functions and convexity of their Lov´asz extension. Discrete Applied Mathematics, 122(1-3):1–12, 2002. [2] Kazutoshi Ando, Satoru Fujishige, and Takeshi Naitoh. A characterization of bisubmodular functions. Discrete Mathematics, 148(1-3):299–303, 1996. [3] Jes´us M. Bilbao, Julio R. Fern´andez, Nieves Jim´enez, and Jorge J. L´opez. Survey of bicoopera- tive games. In Altannar Chinchuluun, Panos M. Pardalos, Athanasios Migdalas, and Leonidas Pitsoulis, editors, Pareto Optimality, Game Theory and Equilibria. Springer, 2008. [4] Andr´e Bouchet. Greedy algorithm and symmetric matroids. Mathematical Programming, 38(2):147–159, 1987. [5] Niv Buchbinder, Moran Feldman, Joseph Naor, and Roy Schwartz. A tight linear time (1/2)- approximation for unconstrained submodular maximization. In Proceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science (FOCS’12), pages 649–658. IEEE, 2012. [6] Ramaswamy Chandrasekaran and Santosh N. Kabadi. Pseudomatroids. Discrete Mathematics, 71(3):205–217, 1988. [7] David A. Cohen, Martin C. Cooper, Peter G. Jeavons, and Andrei A. Krokhin. The Complexity of Soft Constraint Satisfaction. Artificial Intelligence, 170(11):983–1016, 2006. 24 [8] Shahar Dobzinski and Jan Vondr´ak. From query complexity to computational complexity. In Proceedings of the 44th Annual ACM Symposium on Theory of Computing (STOC’12), pages 1107–1116. ACM, 2012. [9] Uriel Feige, Vahab S. Mirrokni, and Jan Vondr´ak. Maximizing Non-monotone Submodular Functions. SIAM Journal on Computing, 40(4):1133–1153, 2011. [10] Satoru Fujishige. Submodular Functions and Optimization, volume 58 of Annals of Discrete Mathematics. North-Holland, Amsterdam, 2nd edition, 2005. [11] Satoru Fujishige and Satoru Iwata. Bisubmodular Function Minimization. SIAM Journal on Discrete Mathematics, 19(4):1065–1073, 2005. [12] Michael R. Garey and David S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman, 1979. [13] M. Grotschel, L. Lovasz, and A. Schrijver. The ellipsoid method and its consequences in combinatorial optimization. Combinatorica, 1(2):169–198, 1981. [14] M. Grotschel, L. Lovasz, and A. Schrijver. Geometric Algorithms and Combinatorial Opti- mization, volume 2 of Algorithms and Combinatorics. Springer, 1988. [15] Anna Huber and Vladimir Kolmogorov. Towards Minimizing k-Submodular Functions. In Proceedings of the 2nd International Symposium on Combinatorial Optimization (ISCO’12), volume 7422 of Lecture Notes in Computer Science, pages 451–462. Springer, 2012. [16] Anna Huber, Andrei Krokhin, and Robert Powell. Skew bisubmodularity and valued CSPs. SIAM Journal on Computing, 43(3):1064–1084, 2014. [17] S. Iwata. A fully combinatorial algorithm for submodular function minimization. Journal of Combinatorial Theory, Series B, 84(2):203–212, 2002. [18] S. Iwata. A faster scaling algorithm for minimizing submodular functions. SIAM Journal on Computing, 32(4):833–840, 2003. [19] Satoru Iwata. Submodular Function Minimization. Mathematical Programming, 112(1):45–64, 2008. [20] Satoru Iwata, Lisa Fleischer, and Satoru Fujishige. A combinatorial strongly polynomial algo- rithm for minimizing submodular functions. Journal of the ACM, 48(4):761–777, 2001. [21] Satoru Iwata, Shin ichi Tanigawa, and Yuichi Yoshida. Bisubmodular function maximization and extensions. Technical Report METR 2013-16, The University of Tokyo, 2013. [22] Satoru Iwata and James B. Orlin. A Simple Combinatorial Algorithm for Submodular Func- In Proceedings of the 20th Annual ACM-SIAM Symposium on Discrete tion Minimization. Algorithms (SODA’09), pages 1230–1237, 2009. [23] Vladimir Kolmogorov. Submodularity on a tree: Unifying L♯-convex and bisubmodular func- tions. In Proceedings of the 36th International Symposium on Mathematical Foundations of Computer Science (MFCS’11), volume 6907 of Lecture Notes in Computer Science, pages 400–411. Springer, 2011. 25 [24] Bernhard Korte and Jens Vygen. Combinatorial Optimization, volume 21 of Algorithms and Combinatorics. Springer, 4th edition, 2007. [25] Jon Lee, Maxim Sviridenko, and Jan Vondr´ak. Submodular Maximization over Multiple Ma- troids via Generalized Exchange Properties. Mathematics of Operations Research, 35(4):795– 806, 2010. [26] L´aszl´o Lov´asz. Submodular Functions and Convexity. In A. Bachem, M. Grotschel, and B. Korte, editors, Mathematical Programming – The State of the Art, pages 235–257, Berlin, 1983. Springer. [27] S. Thomas McCormick and Satoru Fujishige. Strongly polynomial and fully combinatorial algorithms for bisubmodular function minimization. Mathematical Programming, 122(1):87– 120, 2010. [28] H. Narayanan. Submodular Functions and Electrical Networks. North-Holland, Amsterdam, 1997. [29] George L. Nemhauser and Laurence A. Wolsey. Integer and Combinatorial Optimization. John Wiley & Sons, 1988. [30] James B. Orlin. A faster strongly polynomial time algorithm for submodular function mini- mization. Mathematical Programming, 118(2):237–251, 2009. [31] Christos H. Papadimitriou and Mihalis Yannakakis. Optimization, Approximation, and Com- plexity Classes. Journal of Computer and System Sciences, 43(3):425–440, 1991. [32] Liqun Qi. Directed submodularity, ditroids and directed submodular flows. Mathematical Programming, 42(1-3):579–599, 1988. [33] Alexander Schrijver. A Combinatorial Algorithm Minimizing Submodular Functions in Strongly Polynomial Time. Journal of Combinatorial Theory, Series B, 80(2):346–355, 2000. [34] Alexander Schrijver. Combinatorial Optimization: Polyhedra and Efficiency, volume 24 of Algorithms and Combinatorics. Springer, 2003. [35] Ajit P. Singh, Andrew Guillory, and Jeff Bilmes. On bisubmodular maximization. In Pro- ceedings of the 15th International Conference on Artificial Intelligence and Statistics (AIS- TATS’12), volume 22 of JLMR Workshop and Conference Proceedings, pages 1055–1063, 2012. [36] Johan Thapper and Stanislav Zivn´y. The power of linear programming for valued CSPs. In Proceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science (FOCS’12), pages 669–678. IEEE, 2012. [37] Johan Thapper and Stanislav Zivn´y. The complexity of finite-valued CSPs. In Proceedings of the 45th ACM Symposium on the Theory of Computing (STOC’13), pages 695–704. ACM, 2013. [38] Donald Topkis. Supermodularity and Complementarity. Princeton University Press, 1998. 26 [39] Jan Vondr´ak. Symmetry and Approximability of Submodular Maximization Problems. In Proceedings of the 50th IEEE Symposium on Foundations of Computer Science (FOCS ’09), pages 651–670. IEEE Computer Society, 2009. [40] Magnus Wahlstrom. Half-integrality, LP-branching and FPT Algorithms. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’14), pages 1762–1781. SIAM, 2014. [41] Justin Ward and Stanislav Zivn´y. Maximizing bisubmodular and k-submodular functions. In Proceedings of the 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’14), pages 1468–1481. SIAM, 2014. A Improved Analysis of Algorithm 6 for k-Submodular Functions In the case that f is in fact pairwise monotone (and, hence, k-submodular), we can prove the following stronger form of Lemma 20. Lemma 22. Suppose that f is k-submodular. Then, for any 0 ≤ j ≤ n, E[f (o(j)) − f (o(j+1))] ≤ α E[f (s(j+1)) − f (s(j))]. where α = max(1,q k−1 4 ). Proof. Using the same notation as in the proof of Lemma 20, we shall now show Xi6=p yi(ap − ai) ≤ αXi y2 i , (27) 4 ). As in the proof of Lemma 20, we note that for any value of y1, . . . , yk, the left hand side of (27) is upper bounded by the optimal value of a linear program in a1, . . . , ak. where α = max(1,q k−1 Now, however, because f is pairwise monotone, we replace the (22) with(cid:0)k of ai + aℓ ≥ 0. This gives the program maximize Xi6=p subject to ai ≤ yi yj(ap − ai) 2(cid:1) constraints of the form ai + aℓ ≥ 0 1 ≤ i ≤ k ∀{i, ℓ} ∈(cid:18){1, . . . , k} 2 (cid:19). Consider an optimal solution for this program. We note that increasing ap cannot violate any constraint ap + aℓ ≥ 0, and will increase the objective. Thus, we may assume that a∗p = yp ≥ 0. We now consider 2 cases. First, suppose that we have a∗ℓ = −t < 0 for some ℓ ∈ {1, . . . , k} and some value t > 0. Because a∗i + a∗ℓ ≥ 0 for all i 6= ℓ, there can be at most one such ℓ. Moreover, we must have a∗i ≥ t for all i 6= ℓ. For any value i 6∈ {ℓ, p}, we note that decreasing a∗i can only increase the objective of 27 our linear program. Thus, in this case, we may assume that a∗i = t for all i 6∈ {ℓ, p}, aℓ = −t and ap = yp. We can then rewrite our objective as: yiyp + t Xi6=p yℓ − Xj6=ℓ,p yj  . (28) Because t > 0, we must have yℓ ≥ Pj6=ℓ,p yj (otherwise, we could increase (28) by decreasing t). Moreover, we must have t ≤ yp, since otherwise we would have a∗p + a∗ℓ = yp − t < 0. Hence, we have: Xi6=p yiyp + t yℓ − Xj6=ℓ,p yj  ≤Xi6=p and we have proved (27) with α = 1. yiyp + ypyℓ − yp Xj6=ℓ,p yj = 2ypyℓ ≤ y2 p + y2 ℓ ≤Xi y2 i , Next, suppose that ai ≥ 0 for all i ∈ {1, . . . , k}. Then, the objective of our program satisfies Xi6=p = yi yiyp yiap yi(ap − ai) ≤Xi6=p =Xi6=p 2√k − 1 · 2√k − 1ypXi6=p 2 2√k − 1 p + yi Xi6=p   2√k − 1 p + (k − 1)Xi6=p √k − 1 2 Xi (k − 1)y2 (k − 1)y2 y2 i , ≤ ≤ = 1 1 1 y2 i  where the second inequality follows from a2 + b2 ≥ 2ab for any real numbers a and b, and third inequality follows from the Cauchy-Schwarz inequality. Thus, we have proved (27) with α = q k−1 By replacing Lemma 20 with Lemma 22, in the proof of Theorem 19, we obtain the following 4 . result. Theorem 23. Let f : {0, . . . , k}U be a k-submodular set function. Let o be an orthant of U that maximizes f and let s be the orthant of U produced by the randomized greedy algorithm. Then, for α = max(1,q k−1 4 ). (1 + α) E[f (s)] ≥ f (o), 28
1411.2647
4
1411
2019-01-21T23:03:26
Asynchronous Approximation of a Single Component of the Solution to a Linear System
[ "cs.DS" ]
We present a distributed asynchronous algorithm for approximating a single component of the solution to a system of linear equations $Ax = b$, where $A$ is a positive definite real matrix, and $b \in \mathbb{R}^n$. This is equivalent to solving for $x_i$ in $x = Gx + z$ for some $G$ and $z$ such that the spectral radius of $G$ is less than 1. Our algorithm relies on the Neumann series characterization of the component $x_i$, and is based on residual updates. We analyze our algorithm within the context of a cloud computation model, in which the computation is split into small update tasks performed by small processors with shared access to a distributed file system. We prove a robust asymptotic convergence result when the spectral radius $\rho(|G|) < 1$, regardless of the precise order and frequency in which the update tasks are performed. We provide convergence rate bounds which depend on the order of update tasks performed, analyzing both deterministic update rules via counting weighted random walks, as well as probabilistic update rules via concentration bounds. The probabilistic analysis requires analyzing the product of random matrices which are drawn from distributions that are time and path dependent. We specifically consider the setting where $n$ is large, yet $G$ is sparse, e.g., each row has at most $d$ nonzero entries. This is motivated by applications in which $G$ is derived from the edge structure of an underlying graph. Our results prove that if the local neighborhood of the graph does not grow too quickly as a function of $n$, our algorithm can provide significant reduction in computation cost as opposed to any algorithm which computes the global solution vector $x$. Our algorithm obtains an $\epsilon \|x\|_2$ additive approximation for $x_i$ in constant time with respect to the size of the matrix when the maximum row sparsity $d = O(1)$ and $1/(1-\|G\|_2) = O(1)$.
cs.DS
cs
1 Asynchronous Approximation of a Single Component of the Solution to a Linear System Asuman Ozdaglar, Devavrat Shah, and Christina Lee Yu Abstract -- We present a distributed asynchronous algorithm for approximating a single component of the solution to a system of linear equations Ax = b, where A is a positive definite real matrix and b ∈ Rn. This can equivalently be formulated as solving for xi in x = Gx + z for some G and z such that the spectral radius of G is less than 1. Our algorithm relies on the Neumann series characterization of the component xi, and is based on residual updates. We analyze our algorithm within the context of a cloud computation model motivated by frameworks such as Apache Spark, in which the computation is split into small update tasks performed by small processors with shared access to a distributed file system. We prove a robust asymptotic convergence result when the spectral radius ρ(G) < 1, regardless of the precise order and frequency in which the update tasks are performed. We provide convergence rate bounds which depend on the order of update tasks performed, analyzing both deterministic update rules via counting weighted random walks, as well as probabilistic update rules via concentration bounds. The probabilistic analysis requires analyzing the product of random matrices which are drawn from distributions that are time and path dependent. We specifically consider the setting where n is large, yet G is sparse, e.g., each row has at most d nonzero entries. This is motivated by applications in which G is derived from the edge structure of an underlying graph. Our results prove that if the local neighborhood of the graph does not grow too quickly as a function of n, our algorithm can provide significant reduction in computation cost as opposed to any algorithm which computes the global solution vector x. Our algorithm obtains an (cid:107)x(cid:107)2 additive approximation for xi in constant time with respect to the size of the matrix when the maximum row sparsity d = O(1) and 1/(1 − (cid:107)G(cid:107)2) = O(1), where (cid:107)G(cid:107)2 is the induced matrix operator 2-norm. Index Terms -- linear system of equations, local computation, asynchronous randomized algorithms, distributed algorithms ! 1 INTRODUCTION I MAGINE that you are a small restaurant owner in a city. You would like to obtain a quantitative estimate of how your popularity and reputation compare to your competi- tors within a 5 mile radius of you. You may want to compare the significance of the associated websites of your restaurant and other similar restaurants within the webgraph. This can be measured by PageRank, a quantity used by Google to rank search results. PageRank is defined as the solution to x = α1/n + (1− α)P T x, where P is the adjacency matrix of the webgraph, α is a given parameter, 1 is the vector of all ones, and n is the dimension. Alternatively, you may want to compare the social influence of the restaurants' associated Facebook pages, which can be computed via the Bonacich centrality. Bonacich centrality is defined as the solution to x = (I − αG)−11, where G is the adjacency matrix of the social network, and α is a given parameter. Both PageRank and Bonacich centrality can be formulated as the solution to a system of linear equations, where the dimension is as large as the webpages in the webgraph or the number of Facebook pages, which is an overwhelming computational expense for our hypothetical small restaurant owner. In this paper, we investigate the question: can we obtain estimates of a few coordinates of the solution vector without the expense of approximating the entire solution vector? We consider approximating the ith component of the • Asuman Ozdaglar and Devavrat Shah are professors at Massachusetts Institute of Technology in the Electrical Engineering and Computer Science Department. • Christina Lee Yu is an assistant professor at Cornell University in the School of Operations Research and Information Engineering. e-mail: [email protected]. solution to a linear system of equations Ax = b, where A is a positive definite n × n real matrix, and b is a vector in Rn. Positive definite matrices include symmetric diagonally dominant matrices, such as the Laplacian, and also our motivating examples of network centralities, PageRank and Bonacich centrality. Note that A or G may not be symmetric. When A is positive definite, there exists a choice of G and z such that the problem is equivalent to approximating the ith component of the solution to x = Gx + z, and the spectral radius of G, denoted ρ(G), is less than 1. For PageRank, ρ(G) is a constant, bounded by the teleportation probability, independent of the underlying graph. For Bonacich central- ity, ρ(G) can be chosen to be less than 1 by a proper choice of the "discount factor" for any graph. We consider a setting with large n and sparse G, i.e., the number of nonzero entries in every row of G is at most d. This form of sparsity arises when the matrix is derived from an underlying bounded degree graph. We will also discuss how we can relax this constraint to graphs for which the local neighborhood size does not grow too quickly. Solving large systems of linear equations is a problem of great interest due to its relevance to a variety of applications across science and engineering, such as solving large scale optimization problems, approximating solutions to partial differential equations, and modeling network centralities. Due to the large scale of these systems, it becomes useful to have an algorithm which can approximate only a few components of the solution without computing over the entire matrix. Such an algorithm would also lead to efficient ranking and comparison methods. As solving a system of linear equations is fundamentally a problem which involves the full matrix, computing a single component of the solu- tion is non-trivial. In this era of big data, the classic computation model has changed significantly to accomodate for computation which is too large to compute within a single processor's memory. We will consider a distributed cloud computation model inspired by frameworks such as Mapreduce [1] or its open source implementation Hadoop [2] or its memory efficient open-source implementation Spark [3], in which there are many processors with small constant size memory, yet they have access through the cloud to a distributed file system (DFS) which stores the information regarding the entire matrix. Our algorithm will consist of a sequence of small tasks which can be assigned to different processors to compute asynchronously. We will measure the cost of our algorithm via the amount of computational resources consumed, e.g. number of tasks, DFS accesses, and memory consumed. 1.1 Problem Statement and Notation Given an index i ∈ [n], a vector z ∈ Rn, and a matrix G ∈ Rn×n such that ρ(G) < 1, the goal is to solve for xi, the i-th component of the solution vector to x = Gx+z. Throughout the paper, we associate a graph to the matrix G, and we will provide our analysis as a function of properties of the graph. Let G(G) = (V,E) denote the directed graph where V = [n], and (u, v) ∈ E if and only if Guv (cid:54)= 0. Each coordinate of vector x corresponds to a vertex in V. Let Nu(t) ⊂ V denote the vertices with path length t from vertex u, specifically v ∈ Nu(t) if there exists a path from u to v of length t, allowing for loops and repeated visits to vertices. We denote the immediate neighbors of vertex u by Nu, i.e., v ∈ Nu if Guv (cid:54)= 0. The sparsity assumption on G means that Nu ≤ d for all u. We summarize notation used in the paper: the spectral radius of G ρ(G) (cid:107)r(cid:107)0 (cid:107)r(cid:107)p (cid:107)G(cid:107)p E Nu Nu(t) d r(t) x(t) i G the matrix s.t. Gij = Gij the sparsity of vector r the vector p-norm for p ≥ 1 the induced matrix operator norm {(u, v) s.t. Guv (cid:54)= 0} {v ∈ [n] s.t. Guv (cid:54)= 0} vertices with path length t from u the maximum degree, maxu Nu residual (GT )tei estimate zT(cid:80)t−1 k=0(GT )kei 1.2 Equivalence of Ax = b and x = Gx + z Given a system of linear equations of the form Ax = b, there are many methods for choosing G and z such that the equation is equivalent to the form given by x = Gx + z with ρ(G) < 1 [4]. The Jacobi and Richardson methods are suitable for our setting because they have additional properties that G is as sparse as A, and Gij can be computed as a simple function of Aij and Aii. Given (A, b), there may be many ways to choose (G, z) to satisfy the condition that ρ(G) < 1. Finding the optimal choice1 of (G, z) given (A, b) is beyond the scope of this paper. 1. By optimal, we would like to minimize ρ(G), which maximizes the convergence rate of the algorithm. 2 Corollary 1.1. If A is positive definite or diagonally dominant, we can use standard methods (e.g. Jacobi or Richardson), to choose (G, z) such that ρ(G) < 1, and the solution x which satisfies x = Gx + z will also satisfy Ax = b. The Jacobi method chooses G = −D−1(A − D) and z = D−1b, where D is a diagonal matrix such that Duu = Auu. The Richardson method chooses G = I − γA and z = γb for any γ such that 0 ≤ γ ≤ min(cid:107)x(cid:107)2=1(2xT Ax)/(xT AT Ax). If A is symmetric, then using the Richardson method with an optimal choice of γ results in a choice of G such that ρ(G) = (cid:107)G(cid:107)2 = (κ(A)− 1)/(κ(A) + 1), where κ(A) denotes the condition number of A. 1.3 Contributions and Summary of Results We introduce novel algorithms and corresponding analyses for estimating xi for a single component i of the solution vector to x = Gx + z. Our algorithm can be implemented in a fully distributed, asynchronous computation model suit- able for Mapreduce / Hadoop or Spark (discussed in Section 2). For large yet sparse systems (n large but d is bounded or grows very slowly with n), the computational cost of our algorithms are significantly less than global algorithm which incur the cost of computing the full solution vector x. In addition our algorithms improve upon Monte Carlo methods for single component analysis which exhibit high variance and slow convergence. series representation of the solution, i.e. x =(cid:80)∞ Algorithm. Our algorithm relies upon the Neumann k=0 Gkz, (cid:80)∞ k=0 Gkz = zT(cid:80)∞ k=0(GT )kei, (1) xi = eT i where ei denotes the standard basis vector which takes value 1 at coordinate i and 0 elsewhere. We can interpret the term zT (GT )kei to be the weighted sum of all walks of length k from vertex i on the graph defined by G. Since we focus on approximating only xi, we can compute the k lower order terms of the summation by summing weighted walks within the k-radius neighborhood of vertex i, as opposed to the entire graph. This introduces a locality in computation that we can exploit if the neighborhoods of vertex i do not grow quickly. Our algorithm is an iterative residual based method in which every task corresponds to updating one coordinate of the residual vector. Let us define residual vectors r(t) = (GT )tei. For any t ∈ Z, expression (1) can be rearranged as k=0 r(k) +(cid:0)zT(cid:80)∞ k=0(GT )k(cid:1) (GT )tei xi = zT(cid:80)t−1 = zT(cid:80)t−1 k=0 r(k) + xT r(t). (2) zT(cid:80)t−1 At iteration t, the algorithm estimates according to x(t) i = k=0 r(k), and the estimation error will be xT r(t). The synchronous implementation of the algorithm updates the estimate by adding the value of the residual vector in each iteration and updating the residual by multiplying by GT . The algorithm terminates when (cid:107)r(t)(cid:107)2 < , which guarantees that x(t) i − xi ≤ (cid:107)x(cid:107)2. Asynchronous Implementation. The asynchronous im- plementation of the algorithm updates one coordinate of the residual vector at a time. Updating coordinate u corre- sponds to adding ru to xi, and multiplying ru by the uth row of G and adding that to the residual vector r. These updates can be interpreted as accumulating weights of walks over the graph, beginning with short length walks. Every update task maintains an invariant xi = xi + rT x, where xi denotes the estimate, and r denotes the residual vector. The invariant property characterizes the error at every iteration, which is used to prove the algorithm always converges when ρ( G) < 1, where G = G, i.e. Gij = Gij for all i, j. The convergence holds regardless of the order in which coordinates are updated, as long as each coordinate is updated infinitely often. It is robust to asynchronous updates in which the computation corresponding to dif- ferent tasks may interweave in the order they update the residual vector in the DFS. The conditions are given in terms of matrix G rather than G, since the asynchronous implementation may sum walks of different lengths simul- taneously. We use Gl to obtain a worst case bound on the total contribution of any set of walks of length longer than l. We do not require uniform bounds on communication delays or clock rates, as often needed for similar results in asynchronous computation (see [5]). Computational Cost. Our algorithm requires O(n + E) space in the distributed file system, and a single update task requires O(Nu) DFS accesses, where u is the coordinate being updated. The convergence rate of our algorithm can be analyzed via the evolution of the residual vector r, which is a function of the particular order, or sequence, of tasks in which the coordinates are updated. The sparsity pattern of the residual vector will grow according to an expanding local neighborhood around vertex i in the graph defined by G, allowing us to upper bound the number of update tasks needed by the computation as a function of the size of this neighborhood. We analyze different implementations of our algorithm, corresponding to variants for choosing the order for updating coordinates of the residual vector. We provide our bounds as a function of the maximum degree of the graph, denoted by d, but we can extend the results to other graphs in which we have an upper bound for how the size of the local neighborhood grows. As a baseline, we compute the cost of a synchronous distributed implementation in which the tasks coordinate between iterations to update the residual vector according to r(t) = Gr(t−1), which involves (cid:107)r(t)(cid:107)0 individual coordinate update tasks. We prove that the synchronous implementa- tion attains error less than (cid:107)x(cid:107)2 with at most O(min(ln(d)/ ln((cid:107)G(cid:107)2), n ln()/ ln((cid:107)G(cid:107)2))) update tasks. This calculation assumes that the computation is synchronized across iterations. We analyze the asynchronous implementation in which the update tasks do not coordinate different iterations of computation, but rather update the same residual vector r in the DFS. Rather than multiplying by matrix G in each iteration, every individual update task corresponds to applying a local update involving a single row of the matrix G. When the coordinates update sequentially in the order imposed by the expanding local neighborhoods of vertex i, the convergence rate is very similar to the synchronous implementation, requiring at most O(min(ln(d)/ ln((cid:107) G(cid:107)2), n ln()/ ln((cid:107) G(cid:107)2))) 3 update tasks until the error is less than (cid:107)x(cid:107)2. This update rule ensures that first all coordinates in Ni(1) are updated, followed by all coordinates in Ni(2), where the coordinates within the same neighborhood can be updated in any order. The order of updates can be coordinated by a designated master processor which manages a shared task queue for all other processors. This update order ensures that short walks get counted in the estimate earlier. The bound depends on G due to using a worst case upper bound for the weight of all walks of length longer than a certain value. Compared to the synchronous implementation, this analysis is weaker when G may have positive or negative entries, since (cid:107)G(cid:107)2 ≤ (cid:107) G(cid:107)2. We can alternatively employ randomness to sample the next coordinate to update, enabling every processor to gen- erate the next update task without any coordination cost among other tasks. The algorithm adaptively samples the next coordinate to update according to a distribution which depends on the current residual vector. When the sequence of coordinate updates are sampled uniformly amongst co- ordinates with nonzero residual values, we can guarantee that with probability at least 1 − δ, the error contracts by a time varying factor in each step, and the algorithm involves at most (cid:113) O(min(( √ δ/5)−d/(1−(cid:107)G(cid:107)2),−n ln( δ)/(1 − (cid:107)G(cid:107)2))) update tasks until the error is less than (cid:107)x(cid:107)2. We term this 'uniform censored sampling', since we censored the coor- dinates according to whether the residual value is nonzero, and we sample uniformly otherwise. Establishing the con- vergence rate requires bounding the Lyapunov exponent for a product of random matrices drawn from time and path dependent distributions. This is inherently different from previous analyses of randomized coordinate updates, which sample from a history independent distribution. We developed a new analysis for 'uniform censored sampling' updates. We can compare with the bounds for the synchronous implementation by considering that 1−(cid:107)G(cid:107)2 ≈ − ln((cid:107)G(cid:107)2) when (cid:107)G(cid:107)2 ≈ 1. The randomized update implementation scales exponentially with d, whereas the other two bounds only scale polynomially with d. The gap is due to the fact that the synchronous and deterministic asynchronous im- plementations update in an order which ensures that short walks are counted earlier. Intuitively, we expect that the weight of the walks decays exponentially due to the weight being a product over values in G which converge even- tually to zero. Therefore, by sampling uniformly amongst all coordinates with nonzero residuals, the algorithm may choose to update coordinates which are farther away from vertex i before it finishes updating coordinates within a closer neighborhood of i. As a result of a single update task, the contributions added in the process corresponding to updates of the residuals along neighbors will will be approximately "exponentially less significant", and yet the coordinates still carry an equal weight in determining the 4 next coordinate to update. This leads to the exponentially slower convergence as a function of d. This can be remedied by emphasizing coordinates with larger residuals, which we explore heuristically through simulations. The right hand expressions within the convergence rate bounds across the different implementations are essentially the same, and provide a comparison of our algorithm to standard linear iterative methods, which also converge at the same rate. The left hand expressions provide a local analysis utilizing the sparsity of G. They show that the number of tasks required by our algorithm to reach a specified precision is constant with respect to n as long as d = O(1) and 1/(1 − (cid:107)G(cid:107)2) ≈ −1/ ln((cid:107)G(cid:107)2) = O(1). The analysis shows that as long as the local neighborhood does not grow too quickly, i.e., the network is large and sparse enough, and the spectral properties are well behaved, i.e., (cid:107)G(cid:107)2 is bounded away from 1, there is a n0 such that for all n ≥ n0, our algorithm obtains an estimate of xi with fewer computational tasks than any centralized algorithm, by the simple fact that the required tasks of our algorithm is upper bounded by an expression which is independent of n, and any centralized algorithm will scale at least as the size of the solution vector. involving a network of distributed processors computing simultaneously, whereas our model involves a shared global memory through a distributed file system (DFS) and vari- able number of processors computing in parallel. The cost of our algorithm is considered in terms of computational resources consumed, i.e., the number of tasks and DFS accesses, whereas they consider the number of parallel com- putations until convergence, where each of the n processors are computing at every time step. Our algorithm relies on residual based updates, maintaining an invariant that allows us to precisely characterize the error as a function of the residual vector. These differences lead to very different proof techniques for proving both eventual convergence as well as convergence rate bounds. There has also been work on distributed and asyn- chronous algorithms from an optimization standpoint [12], [13]. Minimizing the objective function (cid:107)Ax − b(cid:107)2 2 can be written as a distributed optimization task, where each com- putational node u ∈ [n] aims to minimize (eT u Ax − bu)2 while seeking consensus such that all nodes converge to the same solution vector x. Again these algorithms focus on the global computation task of the full solution vector x rather than estimating a single component. 1.4 Related Work There are not many existing methods which have explored single component approximations of the solution vector. Most standard techniques such as Gaussian elimination, factorization or decomposition, gradient methods, and lin- ear iterative methods all compute the full solution vector, and thus the computation involves all coordinates and all entries in the matrix [4], [6]. Most of the methods are either stationary linear iterative methods (e.g. Jacobi, Gauss-Seidel, successive over-relaxations) or optimization algorithms for minimizing 1 2. For example, Kacz- marz, Gauss-Seidel, or Gauss-Southwell are all variations of either coordinate descent or gradient descent [7]. 2 xT Ax− bT x or (cid:107)Ax− b(cid:107)2 Stationary linear iterative methods use updates of the form xt+1 = Gxt + z to recursively approximate leading terms of the Neumann series. The error after t iterations is given by Gt(x−x0), thus the number of iterations to achieve (cid:107)xt − x(cid:107)2 ≤ (cid:107)x(cid:107)2 is ln()/ ln((cid:107)G(cid:107)2). For any t, xt will be at least as dense as z, and there is no reason to assume z is sparse; a single update step could cost nd multiplications. These methods do not exploit sparsity of G and the locality of computing a single component. There are nearly linear time2 approximation algorithms for sparse and symmetric diagonally dominant matrices A (i.e. graph Laplacians), however they involve global struc- tures over the graph, such as graph sparsifiers or spanning trees, and the goal is to estimate the entire solution vector [8], [9], [10], [11]. Asynchronous distributed algorithms. In their seminal work, Bertsekas and Tsitsiklis [5] analyzed the asynchronous implementation of stationary linear iterative methods for solving for the full vector x, where they assign each of n processor to compute updates corresponding to a spe- cific coordinate. They use a different computation model 2. O(m logc n log −1), where m is the number of nonzero entries in A, and c ∈ R+ is a fixed constant. Local algorithms. Methods for computing a single com- ponent can be categorized into either Monte Carlo meth- ods which sample random walks, or deterministic iterative methods. The Ulam von Neumann algorithm is a Monte Carlo method which obtains an estimate for a single compo- nent xi by sampling random walks starting at the vertex i. It interprets the Neumann series representation of the solution x as a sum over weighted walks on G(G), and obtains an estimate by sampling random walks starting from vertex i over G(G) and appropriately reweighting to obtain an unbiased estimator [14], [15], [16], [17]. The challenge is to control the variance of this estimator. The classic choice for the sampling matrix requires (cid:107)G(cid:107)∞ < 1, though there are modifications which propose other sampling matrices or use correlated sampling to reduce the variance [18], [19]. The scope of this algorithm is limited, as Ji, Mascagni, and Li proved that there is a class of matrices such that ρ(G) < 1, (cid:107)G(cid:107)∞ > 1, and there does not exist any sampling matrix such that the variance of the corresponding estimator is finite [20]. In contrast, our algorithm exploits the sparsity of G and provides a convergent solution when ρ(G) < 1 and convergence rates when (cid:107)G(cid:107)2 < 1. Single component approximation of the leading eigenvector for a stochastic matrix has been studied using Monte Carlo random walk sampling methods [21]. written as a series of matrix powers, exp(G) =(cid:80)∞ [22] propose an iterative method for approximating a single column of the matrix exponential, which can also be k! Gk, similar to the Neumann series in (1). The algorithm essen- tially runs coordinate descent to compute the solution to a linear system of the form Ax = ei, where A is constructed in such a way that the solution x is an approximation for exp(G). They provide convergence guarantees for (cid:107)G(cid:107)1 ≤ 1 for the Gauss-Southwell and Gauss-Seidel iterations. This method has been independently studied for the specific setting of computing Pagerank, Andersen et al. proposed an iterative method which relies on the conditions that G k=0 1 is a nonnegative scaled stochastic matrix, z is entry-wise positive and bounded strictly away from zero, and the solu- tion x is a probability vector (i.e., consisting of nonnegative entries that sum to 1) [23]. There has been subsequent follow up work which builds upon an earlier version of our paper to design bidirectional local algorithms that combine both iterative algorithms and Monte Carlo methods [24], [25]. 5 Relationships to our algorithm. Our asynchronous algo- rithm is an iterative method and can be interpreted as using coordinate descent with randomized coordinate selection to solve for (GT )−1ei, and then taking the inner product of the result with z to obtain xi. Our algorithm is different from the global algorithms as it specifically targets approximating a single component using local computations. It is also different from the Monte Carlo methods which tend to have high variance and thus slow convergence. It is most simi- lar to the algorithms proposed by [22], [23], however our algorithm has a different choice of termination conditions, and different rules for choosing a coordinate update order, utilizing probabilistic sampling. This not only requires very different analysis, but also allows for the algorithm to be im- plemented in an asynchronous distributed manner without coordination between tasks. The model assumptions and analysis are also different, as [22], [23] focus on stochastic matrices. The analysis of [23] proves a linear decrease in the error, yet we prove that the second moment of our error contracts by a time dependent factor in each iteration, and thus our algorithm converges to the correct solution with a tighter convergence rate. We provide analysis of convergence considering the sparsity pattern of the matrix, and we show that any arbitrary coor- dinate selection rule converges as long as each coordinate is updated infinitely often. In contrast [22], [23] only guarantee convergence for specific coordinate update orders. The use of randomization in subsampling matrices as part of a subroutine in iterative methods has previously been used in the context of other global matrix algorithms, such as the randomized Kaczmarz method and stochastic iterative projection [26], [27], [28], [29], [30]. The randomized Kaczmarz method is used in the context of solving overde- termined systems of equations, subsampling rows to reduce the dimension of the computation matrix in each iteration. Stochastic iterative methods involve sampling a sparse ap- proximation of matrix G to reduce the computation in each iteration while maintaining convergence. 2 DISTRIBUTED COMPUTATION MODEL In the modern world of large scale computation, as the re- quirement for computational resources and memory storage increases, distributed cloud computing systems have be- come the norm for computation that involves handling large amounts of data. Since the computing power and memory of any single processor is limited, large distributed file sys- tems (DFS), e.g. Hadoop-Distributed-File-System (HDFS), collect together many storage disks with a master node which handles I/O requests, allowing clients to access the information in the distributed file system in a similar way of accessing files from the local disk. An algorithm can be parallelized by separating it into small tasks that can each be computed by a single processor through accessing the DFS. Fig. 1. Model of Parallel Computation with Distributed File System. The access time of I/O requests to the distributed file system is much longer than accessing files in a processor's own local memory, so we would like to minimize the number of DFS accesses in addition to the computing resources consumed, i.e. total number of tasks performed. In this paper, we will assume the computation model as described in Figure 1. There is a large distributed file system, which all the processors have access to. There is a collection of processors (CPUs) each with a small fixed size local memory. One CPU is designated the master CPU, and it manages the task queue as well as the termination and output of the algorithm. The remaining processors are designated worker CPUs, and they perform tasks assigned to them from the task queue. The cost will be counted in terms of the amount of computing resources that the entire computation consumes, e.g. the number of tasks performed, DFS accesses per task, and storage used in the DFS. In many cloud computation systems, the computing resources are shared across many jobs that are running on the cloud, therefore, the task queue may include tasks corresponding to unrelated jobs as well. 3 ALGORITHM INTUITION Given a vector z and matrix G such that ρ(G) < 1, our goal is to approximate the ith component of the solution vector x to x = Gx + z. Classic stationary linear iterative methods use updates of the form x(t+1) = Gx(t) + z to iteratively approximate leading terms of the Neumann series. The matrix-vector multiplication can be performed in a distributed manner by splitting it into update tasks, where each task updates a single coordinate u according to u ←(cid:80) x(t+1) v∈Nu Guvx(t) v + zu for some u ∈ {1, 2, . . . n}. These tasks are added to the task queue and assigned to different processors to compute. Since z can be fully dense, the vectors x(t) will be at least as dense as z, thus computing x(t+1) from x(t) involves n individual coordinate update tasks. In our problem, since we are specifically interested in a single component i, we instead define a residual-based update method which maintains sparsity of the intermediate vector involved in zGrො𝑥𝑖𝑟22𝑟0Distributed File System: Size O(n2), Slow access timeWorker CPUsLocal memory:Size O(1),Fast access timeManages task queue,termination, outputTask queueMaster CPU the computation. We will first present a synchronous dis- tributed version of the algorithm. In section 4, we will present the asynchronous distributed implementation of the algorithm, and argue that even when the updates are performed asynchronously, the algorithm still converges to the correct solution. Both implementations require at most O(n + E) space in the DFS to store the matrix G, vector z, and any intermediate values involved in the computation. According to the Neumann series representation of x, k=0 Gkz = zT(cid:80)∞ (cid:80)∞ xi = eT i k=0(GT )kei. (3) Consider defining the residual vector at iteration k as r(k) = (GT )kei. Observe that the sparsity pattern of (GT )kei is given by Ni(k), the set of vertices for which there is a path of length k from vertex i. We can rewrite xi as a function of the residual vectors xi = zT(cid:80)t−1 k=0 r(k) + xT r(t). Let x(t) i denote our estimate of xi at iteration t. We can iteratively approximate xi with the low order terms of the Neumann series using the following updates: i ← x(t) x(t+1) r(t+1) ← GT r(t), i + zT r(t), (4) (5) and initializing with x(0) i = 0, and r(0) = ei. Since the spar- sity of r(t) is at most the size of the t-radius neighborhood of vertex i, denoted Ni(t), the computation involved in one iteration can be split into Ni(t) single coordinate update tasks, corresponding to updating each coordinate u ∈ Ni(t). A task updating coordinate u executes the following steps: 1) ADD Guur(t) 2) ADD zur(t) 3) u to r(t+1) , u to x(t+1) u , i For each v ∈ Nu, ADD Guvr(t) u to r(t+1) u . i Each update task uses at most O(Nu) DFS accesses, and does not require more than constant space in the local memory. The processor can only store the value of r(t) u , u for v ∈ Nu, and sequentially access and compute Guvr(t) requiring Nu DFS accesses, but only O(1) memory for stored information across computations. We initialize the estimate and residual vectors for the (t + 1)th iteration with r(t+1) = 0 and x(t+1) = x(t) . The processors still need to pay a synchronization cost due to coordinating the iterations of computation. This results in delays as tasks for a new iteration must wait until every update task from the previous iteration completes. Termination can be determined by imposing a condition on the residual vector which is checked after each itera- tion of computation, such as terminating when (cid:107)r(cid:107)2 < . In section 5, we will prove convergence rate bounds for the synchronous implementation and discuss the gains the algorithm attains from a coordinate-based computation as opposed to computing the full vector. i 4 ASYNCHRONOUS UPDATES The method described above requires coordination amongst the tasks to track each iteration of the algorithm. This may cause unnecessary delays due to enforcing that the tasks 6 must be completed in a specific order. In this section, we in- troduce an asynchronous implementation of the algorithm, in which the update tasks may be performed in arbitrary order, and we do not need to wait for previous tasks to complete before beginning to compute a new task. In section 6, we prove that the algorithm always converges, and we establish convergence rate bounds for different coordinate update rules. 4.1 Individual Update Tasks In the asynchronous implementation, since we no longer keep track of any iterations of the algorithm, we will simply store a single instance of the residual vector r in the DFS. When the different tasks update their corresponding coordi- nates, they will read and write their updates to the residual vector stored on the DFS. The algorithm is initialized in the same way with r = ei and xi = 0. A task to update residual coordinate u involves three steps: 1) READ ru, and SET ru to Guuru, 2) ADD ruzu to xi, 3) For each v ∈ Nu, ADD Guvru to rv. The value of ru used in steps 2 and 3 is the original value read from the DFS in step 1. For each task, the worker processor makes O(Nu) DFS accesses. The computation is the same as individual tasks in the synchronous implemen- tation, except without keeping track of the residual vector across distinct iterations. Thus, even when the sequence of coordinate updates is the same, the residual vector in the asynchronous implementation will evolve differently. If v ∈ Nu, and v is updated after u, when the asynchronous implementation of the algorithm updates coordinate v, it will use the previously updated value in which the task corresponding to coordinate u added Gvuru to the value of rv. In section 6.1, we introduce an interpretation of the algorithm as summing weighted walks in the graph. The synchronous implementation sums the walk in a breadth first manner, i.e. all walks of length t are summed in the tth iteration, whereas the asynchronous implementation may sum walks of different lengths in a single update. For the purposes of analyzing the convergence rate bounds, we consider that the three steps involved in a single update task are performed together as a single unit of computation, i.e., that the different steps involved in a single update task are executed together, and do not interleave with other tasks. We let x(t) denote the estimate after t i update tasks have completed, and we let r(t) denote the residual vector after t update tasks have completed. This property can be enforced through read and write locks, which would prevent another task from simultaneously changing the value of ru while a particular task is in the middle of computation involving ru. This allows us to clearly track the value of the residual vector after each update task, lending to convergence rate bounds. However, we will be able to prove asymptotic conver- gence with much weaker conditions, in which only step 1 of the update task needs to be considered a single unit executed together. Since addition operations are exchange- able, the correctness of the algorithm still holds even when the addition operations in step 2 and 3 of the update task may interleave with other operations on the data from other tasks. Step 1 needs to be executed together because we need to make sure that another task does not add value to ru in between the time that we first read ru and write Guuru, since we would then accidentally override the added value. Alternatively, we would not want another task to read the same value of ru and begin repeating the same update that we have already begun. We will show in Lemma 6.1 that the invariant xi − xi = rT x holds before and after any update task. 4.2 Coordinate Update Rule In the asynchronous implementation, we are given more flexibility to choose the order in which the coordinates are updated. We could update in the same order as the syn- chronous implementation, in which we round robin update coordinates according to a breadth first traversal over the graph (yet allowing for loops and repeated visits to vertices), i.e., updating first all coordinates in Ni(1), followed by Ni(2). Similarly we can iterate round robin updates for all coordinates with nonzero residual vector values. This can be coordinated by designating one processor as the "master", whose job is to add tasks to the the task queue. In settings where we would like to elimination coor- dination between tasks from a master processor, we can use randomization to generate the tasks or coordinate up- date order. To approximate the round robin procedure, we could probabilistically choose the next update coordinate by sampling uniformly randomly from all coordinates with nonzero residual values, which we term the 'uniform cen- sored sampling' procedure. As each processor finishes a task, it can generate the next task by sampling a new update coordinate. This can be facilitated by storing the value of (cid:107)r(cid:107)0 as well as a list of coordinates with nonzero valued residuals, and the update tasks can easily be modified to maintain the value of (cid:107)r(cid:107)0 and list of relevant coordinates. As our algorithm is derived from residual based updates, and the estimation error is given by rT x, this suggests that we may make more progress if we focus on updating coordi- nates with large residual values. For example, we can choose to always update the coordinate with the largest residual value. This can be implemented by maintaining a priority queue with the residual values. We could also sample a coordinate probabilistically proportional to some function of the residual, e.g., proportional to ru, or r2 u. This may be more difficult to implement without iterating through the residual vector to generate each sample, though it is still possible to implement in our distributed computation model with a larger number of DFS accesses. 4.3 Termination The termination conditions can be chosen depending on the desired accuracy and the value of the residual vector. The error is given by rT x, but since we do not know the value of x, we can design the termination condition as a function of r. For example, terminating when (cid:107)r(cid:107)2 <  results in an additive error bound of at most (cid:107)x(cid:107)2. The individual update tasks can be modified to additionally keep track of 2, (cid:107)r(cid:107)1, or (cid:107)r(cid:107)∞ without incurring much overhead, since (cid:107)r(cid:107)2 7 these quantities are additive across coordinates, and each update task changes at most d + 1 coordinates of r. We are motivated by network analysis settings in high dimension, such as computing Pagerank or Bonacich cen- trality when n is large. As n grows to infinity for some large graph, (cid:107)x(cid:107)2 is in fact normalized, bounded, and doesn't scale with n for these three example network centralities. Most of the mass is contained in a few components, im- plying that an additive error bound of (cid:107)x(cid:107)2 approximately guarantees a multiplicative error for large weight compo- nents, and an additive error for small weight components. Therefore, we will present many of our results assuming the algorithm uses a termination condition of (cid:107)r(cid:107)2 < . 5 SYNCHRONOUS ANALYSIS In order to compare the convergence rate bounds for the asynchronous implementation, we first analyze the syn- chronous implementation. We will count the number of tasks and multiplications that the synchronous implemen- tation uses. This analysis will help us to appreciate and identify the gains the algorithm makes due to sparsity and local computation. Theorem 5.1. If ρ(G) < 1, the synchronous implementation of the algorithm converges, and estimation error decays as x(t) i − xi = r(t)x ≤ (cid:107)G(cid:107)t 2(cid:107)x(cid:107)2. The total number of update tasks the algorithm performs in t iterations is (cid:16)(cid:80)t−1 k=0 Ni(k)(cid:17) O = O(cid:0)min(cid:0)dt, nt(cid:1)(cid:1) , where Ni(k) is the set of vertices which are within a k-radius neighborhood of vertex i, and d = maxu Nu. The number of DFS accesses per task is bounded above by d. Corollary 5.2 follows from the proof of Theorem 5.1, and highlights that if the graph is sparse, or the size of the neigh- borhood grows slowly, then the complexity of the algorithm can scale much better than computing the entire solution vector, which would cost O(n ln()/ ln((cid:107)G(cid:107)2)) update tasks. Corollary 5.2. If we terminate the algorithm when (cid:107)r(t)(cid:107)2 < , then xi − xi ≤ (cid:107)x(cid:107)2, and the total number of update tasks performed is bounded by (cid:17)(cid:17) . (cid:16) (cid:16) O min ln(d)/ ln((cid:107)G(cid:107)2), n ln() ln((cid:107)G(cid:107)2) The number of DFS accesses per task is bounded above by d = maxu Nu. Proof of Theorem 5.1. The initial vectors and update rules are chosen to satisfy the invariant that for all t, xi = x(t) i + xT r(t). The error in the estimate at iteration t is given by xT r(t) = xT (Gt)T ei. When ρ(G) < 1, the error converges to zero, and thus the algorithm converges. It follows that the error is bounded by xi − xi = r(t)T x ≤ (cid:107)r(t)(cid:107)2(cid:107)x(cid:107)2. (6) When the algorithm terminates at (cid:107)r(t)(cid:107)2 ≤ , the error is bounded by (cid:107)x(cid:107)2, and after t iterations, the error is bounded by (cid:107)(GT )tei(cid:107)2(cid:107)x(cid:107)2 ≤ (cid:107)G(cid:107)t 2(cid:107)x(cid:107)2. Since each row of G has at most d nonzero entries, (cid:107)r(t)(cid:107)0 ≤ min(dt, n). The number of coordinate update tasks in each iteration is at most (cid:107)r(t)(cid:107)0 ≤ Ni(k) ≤ min (dt, nt) . Therefore, we can upper bound the total number of tasks in t iterations by by quickly as a function of the local neighborhood. If G cor- responds to a scaled adjacency matrix of an unweighted undirected graph, then it is known that (cid:16)(cid:80)t−1 k=0 Ni(k)(cid:17) O = O(cid:0)min(cid:0)dt, nt(cid:1)(cid:1) . Since (cid:107)r(t)(cid:107)2 decays as (cid:107)G(cid:107)t 2, the algorithm terminates at (cid:107)r(cid:107)2 <  within at most ln()/ ln((cid:107)G(cid:107)2) iterations, upper bounding the tasks performed by (cid:16) (cid:16) O min ln(d)/ ln((cid:107)G(cid:107)2), n ln() ln((cid:107)G(cid:107)2) (cid:17)(cid:17) . When G is nonsymmetric, ρ(G) < 1, yet (cid:107)G(cid:107)2 ≥ 1, the algorithm still converges asymptotically, though our rate bounds no longer hold. We suspect that in this case, a similar convergence rate holds as a function of ρ(G), due to Gelfand's spectral radius formula, which states that ρ(M ) = limk→∞ (cid:107)M k(cid:107)1/k . The precise rate depends on the 2 convergence of this limit. The right hand expression in the theorem comes from bounding the number of coordinate updates in each it- eration by n, which holds even in the nonsparse setting. This bound obtains the same result as standard linear it- erative methods. The analysis of our algorithm highlights as O((cid:80)t−1 the improvement of our local algorithm over a general global vector computation. The number of tasks grows k=0 Ni(k)), which for some graphs may be sig- (cid:80)t nificantly less than O(nt). For a bounded degree graph, k=0 Ni(k) = O(dt), which may be much less than O(nt) in the case when d is fixed, and n is very large (recall that t is on the order of ln()/ ln((cid:107)G(cid:107)2)). The bounded degree condition is used in our analysis to cleanly bound Ni(t), however our results naturally extend to other graphs given bounds on Ni(t). For power law graphs, we can use a bound on the growth of the local neighborhood size for average vertices to obtain non-trivial convergence rate re- sults. For graphs in which the size of the neighborhood only grows polynomially, then the local algorithm would gain significant savings over the global algorithm. This results in conditions under which our algorithm achieves an approxi- mation for xi in constant time with respect to the size of the matrix for large n, e.g. d = O(1) and −1/ ln((cid:107)G(cid:107)2) = O(1). We can visualize the algorithm in terms of computation over G(G). Multiplying r(t) by GT corresponds to a message passing operation from each of the nonzero coordinates of r(t) along their adjacent edges in the graph. The sparsity of r(t) grows according to the set of length t walks over the graph that originate from vertex i. The termination con- dition guarantees that the algorithm only involves vertices that are within distance ln()/ ln((cid:107)G(cid:107)2) from the vertex i. We define the matrix GNi(t) such that GNi(t)(a, b) = G(a, b) if (a, b) ∈ Ni(t) × Ni(t), and is zero otherwise. It follows that (cid:107)r(t)(cid:107)2 = (cid:107)eT = (cid:107)eT i Gt(cid:107)2 = (cid:107)eT i Gt (7) (8) It is possible that for some choices of i and t, (cid:107)GNi(t)(cid:107)2 < (cid:107)G(cid:107)2, in which case the algorithm would converge more Ni(t)(cid:107)2 ≤ (cid:107)GNi(t)(cid:107)t 2. i (cid:81)t k=1 GNi(k)(cid:107)2 8 (cid:16) (cid:112) (cid:17) ≤ ρ(G) ≤ dmax. max dmax daverage, (9) In this case, we would only expect (cid:107)GNi(t)(cid:107)2 to be smaller than (cid:107)G(cid:107)2 if the local degree distribution of the neighbor- hood around vertex i is different from the global degree distribution. 6 ASYNCHRONOUS ANALYSIS It is not as straightforward to analyze the asynchronous implementation of the algorithm, since we can no longer write the residual vector as a simple expression of G and the iteration number. However, we can show that each coordinate update task preserves an invariant which relates the estimate xi and residual r to the true solution xi. Lemma 6.1 (Invariant). The update tasks in the asynchronous implementation maintain the invariant that for all t, xi = xi + rT x. Proof of Lemma 6.1. Recall that x = z+Gx. We prove that the invariant holds by using induction. First verify that before any computation has begun, the invariant is satisfied by the initialized values, xi + rT x = 0 + eT i x = xi. Let rold denote the residual vector before an update task, and let rnew denote the residual vector after an update task. Then a single update task corresponds to the following steps: i + rold u zu, xnew i = xold rnew u = Guurold u , rnew v = rold Assuming that xi = xold u ,∀v ∈ Nu. v + Guvrold i + (cid:104)roldx(cid:105), it follows that i − (cid:104)roldx(cid:105) i + (cid:104)rnewx(cid:105) − xold xnew = rold = eT u zu + xu(Guu − 1)rold u (z + Gx − x)rold u = 0. u +(cid:80) v∈Nu xvGuvrold u , It follows from Lemma 6.1 that we can choose ter- mination conditions based upon the value of the resid- ual vector which would directly lead to upper bounds on the estimation error. For example, if (cid:107)r(cid:107)2 ≤ , then xi − xi ≤ (cid:107)x(cid:107)2. The proofs for Theorems presented in the subsequent sections for the asynchronous algorithm can be found in sections 9, 10, and 11. 6.1 Counting Weighted Walks Alternatively, we can take the perspective that the algorithm is computing xi by collecting a sum of weighted walks over the graph G(G) beginning at vertex i. The estimate xi corresponds to the sum of all weighted walks which are already "counted", and the residual vector represents all yet uncounted walks. As long as step 1 of the coordinate update task is atomic, we can ensure that every walk is accounted for exactly once, either in xi, or in the residual vector. Let G denote the matrix where Gij = Gij. Theorem 6.2 uses the perspective of counting weighted walks to show that as long as ρ( G) < 1, the algorithm converges to xi as long as each coordinate is chosen infinitely often, regardless of the sequence in which the updates are performed. Theorem 6.2. If ρ( G) < 1, the estimate xi from the asyn- chronous implementation of our algorithm converges to xi for any sequence of coordinate updates, as long as each coordinate is updated infinitely often. j has weight (cid:81) The solution xi can be expressed as a weighted sum over all walks over the graph G(G) beginning at vertex i, where a walk beginning at vertex i and ending at vertex e∈walk Gezj. The updates ensure that we never double count a walk, and all uncounted walks are included in the residual vector r. For any l, there is a finite time Sl after which all random walks of length less than or equal to l have been counted and included into xi. This allows us to upper bound xi − xi as a function of Gl+1, which converges to zero when ρ( G) < 1. If ρ( G) ≥ 1, then the original Neumann series stated in (1) is only conditionally convergent. By the Reimann series theorem, the terms can be rearranged in such a way that the new series diverges, and rearranging the terms in the series corresponds to updating the coordinates in different orders, e.g., depth first as opposed to breadth first. This is the same conditions for asymptotic convergence as provided for the asynchronous linear iterative updates, which is also shown to be tight [5]. This theorem and proof can be extended to show that the algorithm converges asymptotically even given communication delays, as long as the messages reach their destination in finite time. In fact our proof for the asymptotic convergence trans- our the asynchronous coordinate update algorithm used the lates directly into a convergence rate bound as well. implementation Theorem 6.3. Suppose of sequence (u0, u1, u2, u3, . . . ), where each coordinate updates infinitely often. Define Sr as the time after which the estimate vector has counted and included all walks of length up to r: Sl = min{t ≥ Sl−1 : Ni(l) ⊂ {uSl−1 , uSl−1+1, . . . ut−1}}. Then the estimation error of the the algorithm after Sl updates is bounded by(cid:12)(cid:12)(cid:12)xi − x(Sl) i (cid:12)(cid:12)(cid:12) ≤ xT ( GT )l+1ei ≤ (cid:107) G(cid:107)l+1 2 (cid:107)x(cid:107)2. Based upon the update sequence we can compute bounds on Sl, or the time after which all walks of length l have definitely been counted. We can analyze the basic co- ordinate update rule which follows the same pattern as the synchronous implementation, in which we update accord- ing to the neighborhoods of i. The update sequence would be given by (Ni(0), Ni(1), Ni(2), . . . ). Although the update order may be the same as the synchronous algorithm, the computation is not the same due to the accumulation of the residual vector across update tasks. It follows that due to the k=0 Ni(k). If the graph is bounded degree with max degree d, such that Ni(k) ≤ dk, then Sl ≤ dl+1, resulting in the following corollary. update order, Sl = (cid:80)l 9 our the asynchronous algorithm used the implementation Corollary 6.4. Suppose of sequence (Ni(0), Ni(1), Ni(2), . . . ). Then the estimation error of the al- gorithm after dt+1 update tasks is bounded by 2 (cid:107)x(cid:107)2. xi − xi ≤ (cid:107) G(cid:107)l+1 coordinate update It follows that the error is less than (cid:107)x(cid:107)2 for t ≥ dln()/ ln((cid:107) G(cid:107)2). This matches the convergence rate bound for the syn- chronous algorithm when G is nonnegative, which is rea- sonable for some applications in which G is derived from network data. It also follows directly from Theorem 6.3 that if every coordinate updates at least once within every B timesteps, then the error decays with rate (cid:107) G(cid:107)t/B , which is comparable to the bounded delay model and analysis for the asynchronous linear iterative algorithm [5]. Corollary 6.5. Suppose the asynchronous implementation of our algorithm used a coordinate update sequence in which Sl ≤ lB for some B > 0. Then the estimation error of the the algorithm after lB updates is bounded by 2 2 (cid:107)x(cid:107)2. xi − xi ≤ (cid:107) G(cid:107)l+1 It the less B ln()/ ln((cid:107) G(cid:107)2). follows error that is than (cid:107)x(cid:107)2 t ≥ for 6.2 Probabilistic Update Order When the coordinates are sampled probabilistically, we can no longer guarantee that a certain set of coordinates are updated within a fixed interval. In this section, we instead provide a probabilistic analysis of the error by analyzing the evolution of the 2-norm of the residual vector in expectation. We will assume that each coordinate update task is atomic, such that if the sequence of coordinate updates is given by (u0, u1, u2, . . . ), the residual vector after t updates will be equivalent to the following computation: (I − G)) (cid:16)(cid:81)t−1 s=0(I − eus eT (cid:17)T r = ei. us The precise expression depends on the detailed order of updates, and thus the convergence rate may depend upon the rule that the algorithm chooses to determine the order of updating coordinates. We provide an analysis for 'uniform censored sampling', in which coordinates with nonzero valued current residuals are chosen with equal probability, according to P(u) = u (cid:54)=0) I(r(t) (cid:107)r(t)(cid:107)0 , (10) where r(t) denotes the current residual after t updates. We have suppressed the dependence of P on r(t) for simpler notation. Since the distribution P chooses uniformly among the nonzero coordinates of r(t), in expectation the update step corresponds to multiplying a scaled version of matrix G to vector r(t). We can prove that in addition (cid:107)r(t)(cid:107)2 contracts with high probability due to the choice of distribution P. With high probability, the number of multiplications the asynchronous algorithm uses is bounded by a similar ex- pression as the bound given for the synchronous algorithm. Theorem 6.6. If (cid:107)G(cid:107)2 < 1, with probability 1, the asynchronous implementation which updates coordinates according to P even- tually terminates at (cid:107)r(cid:107)2 <  and produces an estimate xi such that xi − xi ≤ (cid:107)x(cid:107)2. With probability greater than 1 − δ, the total number of update tasks bounded by (cid:32) (cid:32)(cid:18) (cid:113) O min  δ/2 (cid:19)−d/(1−(cid:107)G(cid:107)2) (cid:33)(cid:33) . √ −n ln( δ) 1−(cid:107)G(cid:107)2 , The number of DFS accesses per task is bounded above by d = maxu Nu. In order to prove this result, we first show that (cid:104) r(t+1)(cid:12)(cid:12)(cid:12) r(t)(cid:105) EP (cid:16) I −(cid:16) I−GT (cid:107)r(t)(cid:107)0 (cid:17)(cid:17) = r(t). (11) This implies that in expectation, the error contracts in each update task by at least (1 − (1 − (cid:107)G(cid:107)2)/ min(td, n)). We use this to prove an upper bound on the expected L2-norm of the residual vector after t update tasks, and we apply Markov's inequality to prove that the algorithm terminates with high probability within a certain number of multipli- cations. There is additional technical detail in the formal proof, as it needs to handle the fact the (cid:107)r(t)(cid:107)0 is dependent on the full history of the previous iterations. We first analyze the algorithm for a modified distribution, where the scaling factor grows deterministically according to min(td, n) as opposed to (cid:107)r(t)(cid:107)0, and we use a coupling argument to show that the upper bound on the termination time of the algorithm using the modified distribution translates to the original distribution P. This establishes an upper bound on the Lyapunov exponent for a product of random matrices drawn from a time-dependent distribution. This bound grows exponentially in d, while the corre- sponding bound in Corollary 5.2 grows only polynomially in d. The rate of convergence of the asynchronous variant is slower by a factor of d/ ln(d) because the provable contrac- tion of the error in each iteration is now spread out among the nonzero coordinates of the current iterate. Our convergence rate bounds only apply when the algo- rithm samples uniformly among nonzero coordinates of the residual vector r(t), according to the distribution P defined by 10. However, this may not be the distribution which op- timizes the convergence rate. Choosing a distribution which is not uniform amongst the nonzero coordinates is anal- ogous to multiplying the residual vector by a reweighted matrix G in expectation, where each row of G corresponds to a row of G weighted by the probability of choosing that row in the new distribution. This is challenging to analyze, as the weights for each row may be dependent upon the entire history of update tasks. Analysis would requires char- acterizing the Lyapunov exponent of a product of random matrices, where each matrix is sampled from a different distribution, dependent upon the entire history, making it difficult to directly analyze the algorithm in expectation. Under stronger conditions (e.g. only nonnegative entries in G, z), we can show monotonic decrease in the error, and hence bound convergence rates for other sampling distributions with standard techniques. 7 SIMULATIONS We implemented our algorithm on synthetic data to illus- trate the convergence rates of different coordinate update 10 order rules. In each of these examples, we sample a random graph and let the matrix A denote the edge adjacency matrix of the graph. A scalar α is chosen small enough such that (cid:107)αA(cid:107)2 ≤ (cid:107)αA(cid:107)∞ ≤ 0.9. The goal is to compute the Bonacich centrality of a fixed vertex in the graph, given by the component of the solution vector x to x = αAx + 1. The first graph is sampled from a Erdos-Renyi model with 1000 vertices, each edge being present independently with probability 0.0276. The second graph is sampled from a configuration model with 500 vertices and a power law degree distribution, P(degree d) ∝ d−1.5. We implement the synchronous implementation of our algorithm, and the asynchronous implementation algorithm with five choices of update rules. Round robin refers to the update rule which follows the expanding neighbor- hoods of vertex i, i.e., updating according to the sequence (Ni(0), Ni(1), Ni(2), . . . ). We implement the uniform cen- sored sampling rule, which samples uniformly amongst nonzero valued residual coordinates. We explore sampling rules which depend on the value of the residuals, choos- ing the coordinate proportional to ru, r2 u, or chosen as argmaxuru. We compare with the standard linear iterative method, which uses updates of the form xt+1 = αAxt + z to recursively approximate leading terms of the Neumann series, computing the full solution vector x. It is a global al- gorithm, as each iteration may involve multiplying a matrix with a dense vector, and thus simulations show it performs more poorly than our local algorithms. This insight should hold for other global algorithms as well, and the discrepancy will increase as the size of the graph increases. Figures 2(a) and 2(b) show the percentage error of each algorithm with respect to the number of multiplications the algorithm has computed, for the Erdos Renyi graph and the power law graph respectively. Our simulations indicate that choosing coordinates with large values of ru improves the convergence of the algorithm. The algorithm which always chooses the largest coordinate to update seems to perform the best. This is consistent with our intuition, as the residual vector r is directly related to the estimation error. By updating coordinates with large values of ru, we make more progress in reducing the error. Establishing theoretical analysis of this observation remains a challenging problem, as the sampling distribution for update task t depends in a complex manner upon the full sample path of updates up to iteration t, as opposed to a simple scaling of the matrix as in uniform sampling. It is not obvious how to establish bounds for a product of random matrices drawn from a complex path dependent distribution. We also observe that the our algorithm exhibits larger gains in the beginning of the algorithm, but the gains becomes less significant as the algorithm progresses. This could be a result of our algorithm exploiting the small size of the the local neighborhood in the beginning of the algo- rithm. As the size of the neighborhood grows in include all coordinates, our algorithm no longer enjoys sparse residual vectors, and thus the computational savings slows down. We also provide results from using the Ulam-von- Neumann (UvN) Monte Carlo approach which samples random walks according to a transition probability matrix designed as Puv = αAuv. All walks begin at the target ver- tex i, and the probability of the random walk terminating at 11 (a) Erdos-Renyi network. Fig. 3. Sample paths of 10 different instances of the Ulam von Neumann algorithm for computing Bonacich centrality of a vertex in a network. converges more quickly when coordinates are chosen ac- cording to the Gauss-Southwell method (those with largest residuals first) rather than random selection [31]. We hope that our work will initiate studies of sparsity- preserving iterative methods in asynchronous and dis- tributed settings from an algorithmic perspective. Our meth- ods could be used as subroutines in other methods in which there is a need for local or asynchronous matrix computation. It is unclear whether our algorithm achieves an optimal convergence rate. There is a wealth of literature which studies acceleration or preconditioning techniques for classic linear system solvers, and it would be interesting to see whether these acceleration techniques could be used to speed up the convergence of our local algorithm. (b) Power law degree network. Fig. 2. Comparing different implementations for computing Bonacich centrality of a vertex in a network. vertex u is 1 − α(cid:80) 1 v Auv 1−α(cid:80) (cid:80)∞ v Auv. A random walk which terminates , such that the at vertex u is given the weight expected weight of a random walk is equal to the desired Bonacich centrality xi = eT k=0(αA)k1. The algorithm i samples many random walks and averages the weights to approximate xi. In Figure 7, the left and right plots each show 10 sample paths obtained by the UvN algorithm for the Erdos-Renyi and power law graphs respectively. Each curve represents one instance of the algorithm. Whereas the iterative algorithms converged by about 5000 multiplica- tions, the UvN algorithm has high variance and does not converge even after 100000 random walk steps. 8 FUTURE DIRECTIONS It is an open problem to investigate the optimal choice of the probability distribution for sampling coordinates used within the asynchronous method, as simulations indicate that some distributions exhibit faster convergence rates. This is related to recent work which investigates weighted sampling for the randomized Kaczmarz method, although their methods depend on weighting according to the matrix G rather than the values in the intermediate vectors of the algorithm. As our algorithm is also related to coordinate de- scent, there is related work showing that coordinate descent 9 PROOF OF THEOREMS 6.2 AND 6.3 Proof of Theorems 6.2 and 6.3. Let Wk(i) denote the set of length k walks beginning from vertex i, i.e., a sequence of vertices w = (w0, w1, w2, . . . wk) such that w0 = i and (cid:81)k−1 (ws, ws+1) ∈ E for all s ∈ {0, 1, . . . k − 1}. Then xi = eT i (cid:81)k−1 (cid:80)∞ k=0 Gkz =(cid:80)∞ = zi +(cid:80)∞ = zi +(cid:80) (cid:80)∞ = zi +(cid:80) w∈Wk(i) s=0 Gwsws+1zwk , w∈Wk(j) k=0 w∈Wk(i) Gij Gijxj. s=0 Gwsws+1 zwk , (12) (cid:80) (cid:81)k−1 (cid:80) s=0 Gwsws+1zwk , k=0 (cid:80) k=1 j∈Ni j∈Ni (cid:17) s=0 Gvsvs+1 (cid:16)(cid:81)l−1 This shows that due to the form of the weights over each walk, we can express the weighted sum of all walks whose first edge is (i, j) by Gijxj. Similarly, this argument extends recursively to show that the weighted sum of all walks whose first l + 1 vertices are given by (v0, v1, v2, . . . vl) is xvl , since xvl captures the equivalent to sum and weights of the remaining unfinished portion of the walks. In other words, the weighted sum of walks with a certain prefix is equal to the product of the weights from the prefix portion of the walk multiplied with the sum of the weights for all walks that could continue from the endpoint of the prefix walk. The value of the residual vector ru contains the product of the weights along the prefix portion of the walks that end at vertex u, thus explaining why rT x is equivalent to the weight of all yet uncounted walks. 200040006000800010000No. of Multiplications00.10.20.30.40.50.6Percentage ErrorError vs. Multiplicationsstandard linear iterativesynchronousasynch: round robinasynch: uniform among nonzeroasynch: proportional to r(u)asynch: proportional to r(u)2asynch: maximum r(u)0200040006000800010000No. of Multiplications00.10.20.30.40.50.6Percentage ErrorError vs. Multiplicationsstandard linear iterativesynchronousasynch: round robinasynch: uniform among nonzeroasynch: proportional to r(u)asynch: proportional to r(u)2asynch: maximum r(u)0510# Random Walk steps10400.10.20.30.40.50.6Percentage ErrorPower law networkUlam von Neumann Algorithm0510# Random Walk steps10400.10.20.30.40.50.6Percentage ErrorErdos Renyi network We use this perspective to interpret the single coordinate updates in the algorithm to argue that there is conservation of computation, i.e., we never double count a walk, and all uncounted walks are included in the residual mass vector r. The update in our algorithm can be interpreted through (12), as the first term zu captures the walks that end at vertex u, and each term within the summation Guwxw counts the walks which take the next edge (u, w). Each time that a coordinate u is updated, the step 2. ADD ruzu to xi, corresponds to counting the walks which end at vertex u, and whose weight is contained within ru. We also need to count the walks which have the same prefix, but do not yet terminate at vertex u, which is captured by multiplying ru by each of its adjacent vertices Guw and adding that to rw: 1. 3. SET ru to Guuru, For each v ∈ Nu, ADD Guvru to rv. We proceed to argue that for any l, there is a finite time t after which all random walks of length less than or equal to l have been counted and included into the estimate xi. Given a coordinate update sequence (u0, u1, u2, u3, . . . ), we require that each coordinate appears infinitely often. We can assume that u0 = i, since at iteration 0 all the mass is at vertex i, thus it is the only vertex to update. Let S1 denote the earliest time after which all of the neighbors of vertex i have been updated at least once: S1 = min{t ≥ 1 : Ni(1) ⊂ {u0, u1, . . . ut−1}}. This guarantees that x(S1) includes the weights from all the length one walks from vertex i. We proceed to let S2 denote the earliest time which all vertices within a 2-neighborhood of vertex i have updated once after time S1: i S2 = min{t ≥ S1 : Ni(2) ⊂ {uS1, uS1+1, . . . ut−1}}. i This now guarantees that x(S2) includes the weights from all the length one and two walks from vertex i. We can iteratively define Sr as the time after which the estimate vector has counted and included all walks of length up to r: Sl = min{t ≥ Sl−1 : Ni(l) ⊂ {uSl−1 , uSl−1+1, . . . ut−1}}. Since each coordinate appears infinitely often in the se- quence, Sl is well defined and finite for all l. Finally we upper bound the error by using a loose upper bound on the weights of all walks with length larger than l. By the invariant, it follows that xi = x(Sl) i + r(Sl)T x, which is the sum of all counted or included walks in x(Sl) , and the remaining weight of uncounted walks in r(Sl)T x. The weighted sum of all walks of length at most l from vertex i k=0(GT )kei. Thus the error, or weight of uncounted walks, must be bounded by the corresponding weighted sum of the absolute values of the walks of length larger than l: i k=l+1( GT )kei. is expressed by zT(cid:80)l −zT(cid:80)∞ (cid:12)(cid:12)(cid:12)xi − x(Sl) It follows that i k=l+1( GT )kei ≤ r(Sl)T x ≤ zT(cid:80)∞ (cid:12)(cid:12)(cid:12) ≤ zT(cid:80)∞ which converges to zero as long as ρ( G) < 1. k=0( GT )k( GT )l+1ei = xT ( GT )l+1ei, 12 10 PROOF OF THEOREM 6.6 We provide an analysis for 'uniform censored sampling', in which coordinates with nonzero valued current residuals are chosen with equal probability, according to P(u) = u (cid:54)=0) I(r(t) (cid:107)r(t)(cid:107)0 , (13) where r(t) denotes the current residual after t updates. Proof of Theorem 6.6. Since the algorithm terminates when (cid:107)r(t)(cid:107)2 ≤ , it follows from Lemma 6.1 that x(t) i − xi = r(t)T x ≤ (cid:107)x(cid:107)2. Recall that the algorithm chooses a co- ordinate in each iteration according to the distribution P, as specified in (10). To simplify the analysis, we introduce another probability distribution P, which has a fixed size support of min(td, n) rather than (cid:107)r(t)(cid:107)0. We first analyze the convergence of a modified algorithm which samples coordinates according to P. Then we translate the results back to the original algorithm. Observe that for any t ∈ Z+, there exists a function Ct : Rn → {0, 1}n, which satisfies the properties that for any v ∈ Rn and u = Ct(v), if vi (cid:54)= 0, then ui = 1, and if (cid:107)v(cid:107)0 ≤ td, then (cid:107)u(cid:107)0 = min(td, n). In words, Ct(v) is a function which takes a vector of sparsity at most td, and maps it to a binary valued vector which preserves the sparsity pattern of v, yet adds extra entries of 1 in order that the sparsity of the output is exactly min(td, n). We define the distribution P to choose uniformly at random among the nonzero coordinates of Ct r(t)(cid:17) , according to: (cid:16) P(u) = u St(r(t)) eT min(td,n) , (14) where we have suppressed the dependence of P on t and r(t) for simpler notation. This is a valid probability distribu- tion since for all t, (cid:107)r(t)(cid:107)0 ≤ td. We first analyze the asyn- chronous algorithm which samples coordinates accoridng to P. Lemma 11.1 shows that in expectation, the error contracts in each iteration by (1 − (1 − (cid:107)G(cid:107)2)/ min(td, n)). Lemma 10.1 provides an upper bound on the expected L2-norm of the residual vector r(t). Then we apply Markov's inequality to prove that the algorithm terminates with high probability within a certain number of multiplications. In order to extend the proofs from P to P, we define a coupling between two implementations of the algorithm, one which sample coordinates according to P, and the other which samples coordinates according to P. We prove that in this joint probability space, the implementation which uses distribution P always terminates in number of iterations less than or equal to the corresponding termination time of the implementation using P. Therefore, computing an upper bound on the number of multiplications required under P is also an upper bound for the algorithm which uses P. Lemma 10.1. If (cid:107)G(cid:107)2 < 1, d ≥ 4, and n ≥ 8, E P 2t−2(1−(cid:107)G(cid:107)2)/d, 4e−2(t−1)(1−(cid:107)G(cid:107)2)/n(cid:17) . By Markov's inequality, P((cid:107)r(t)(cid:107)2 ≥ ) ≤ δ for 2] ≤ δ2. Therefore, we can directly apply Lemma (cid:105) ≤ min (cid:104)(cid:13)(cid:13)rt(cid:13)(cid:13)2 E P [(cid:107)r(t)(cid:107)2 (cid:16) 2 10.1 to show that if (cid:107)G(cid:107)2 < 1, d ≥ 4, and n ≥ 8, the algorithm terminates with probability at least 1 − δ for (cid:16)(cid:0) 2 δ2 (cid:1)d/2(1−(cid:107)G(cid:107)2) , 1 + 2(1−(cid:107)G(cid:107)2) ln(cid:0) 4 n δ2 (cid:1)(cid:17) . t ≥ min Since we are concerned with asymptotic performance, the conditions d ≥ 4 and n ≥ 8 are insignificant. To bound the total number of multiplications, we multiply the number of iterations by the maximum degree d. Finally, we complete the proof by translating the anal- ysis for P to P. Let us consider implementation A, which samples coordinates from P, and implementation B, which samples coordinates from P. Let RA denote the sequence of residual vectors r(t) derived from implementation A, and let RB denote the sequence of residual vectors r(t) derived from implementation B. The length of the sequence is the number of iterations until the algorithm terminates. We define a joint distribution such that P(RA, RB) = P(RA)P(RBRA). Let P(RA) be described by the algorithm sampling co- ordinates from P. The sequence RA can be sampled by separately considering the transitions when non-zero val- ued coordinates are chosen, and the length of the repeat in between each of these transitions. Given the current iteration t and the sparsity of vector r(t), we can specify the distribution for the number of iterations until the next transition. If we denote τt = min{s : s > t and r(s) (cid:54)= r(t)}, then P(τt > kr(t)) =(cid:81)k (cid:16) 1 − (cid:107)r(t)(cid:107)0 min((t+q)d,n) q=1 . (15) (cid:17) Conditioned on the event that a non-zero valued coordinate is chosen at a particular iteration t, the distribution over the chosen coordinate is the same as P. For all t, r(t+1) (cid:54)= r(t) if and only if the algorithm chooses a non-zero valued coordinate of r(t) at iteration t, which ac- cording to P, occurs with probability 1−(cid:107)r(t)(cid:107)0/ min(td, n). Therefore, given the sequence RA, we can identify in which iterations coordinates with non-zero values were chosen. Let P(RBRA) be the indicator function which is one only if RB is the subsequence of RA corresponding to the iterations in which a non-zero valued coordinate was chosen. We can verify that this joint distribution is constructed such that the marginals correctly correspond to the proba- bility of the sequence of residual vectors derived from the respective implementations. For every (RA, RB) such that P(RBRA) = 1, it also follows that RA ≥ RB, since RB is a subsequence. For every q, {(RA, RB) : RA ≤ q} ⊂ {(RA, RB) : RB ≤ q} =⇒ P(RA ≤ q) ≤ P(RB ≤ q). (16) (17) Therefore, we can conclude that since the probability of the set of realizations such that implementation A terminates within the specified bound is larger than 1 − δ, it also fol- lows that implementation B terminates within the specified bound with probability larger than 1 − δ. Therefore, since we have proved Theorem 6.6 for implementation A, the result also extends to implementation B, i.e., our original algorithm. 13 . u u (cid:104) E P r(t), min(td,n) min(td,n) (cid:17)(cid:17) . = ≤ min P(u)eur(t) u . (a) E P (b) (cid:104) (cid:13)(cid:13)(cid:13)E P = r(t) − (I − GT )(cid:80) (18) By design of P, we know that P(u) = 1/ min(td, n) for all u such that r(t) Proof of Lemma 11.1. We will use induction to get an expres- sion for E P . Recall that r(0) = ei. Since there is only a single coordinate to choose from, r(1) is also predetermined, and is given by r(1) = GT ei. 11 PROOF OF LEMMA 10.1 I −(cid:16) I−GT (cid:16) First we prove Lemma 11.1, which shows that a single update task is equivalent in expectation to multiplying the residual vector by the matrix (cid:16) I −(cid:16) I−GT (cid:17)(cid:17) Lemma 11.1. If (cid:107)G(cid:107)2 < 1, for all t, t−(1−(cid:107)G(cid:107)2)/d, e−(t−1)(1−(cid:107)G(cid:107)2)/n(cid:17) (cid:16) r(t+1)(cid:12)(cid:12)(cid:12) r(t)(cid:105) r(t)(cid:105)(cid:13)(cid:13)(cid:13)2 (cid:104) r(t)(cid:105) (cid:104) r(t+1)(cid:12)(cid:12)(cid:12) r(t)(cid:105) (cid:80) u (cid:54)= 0. Therefore, P(u)eur(t) r(t+1)(cid:12)(cid:12)(cid:12) r(t)(cid:105) (cid:16) (cid:104) (cid:104) r(t)T(cid:105) i G(cid:81)t−1 r(t)(cid:105)(cid:13)(cid:13)(cid:13)2 (cid:104) 1 −(cid:16) 1−(cid:107)G(cid:107)2 (cid:17)(cid:17) (cid:16) (cid:81)t−1 (cid:16)−(cid:80)t−1 (cid:17) ≤ (cid:107)G(cid:107)2 (cid:16) (cid:16)−(cid:80)t−1 ≤ (cid:107)G(cid:107)2 exp ≤ (cid:107)G(cid:107)2 min n (22) (cid:80)t−1 Since (cid:107)G(cid:107)2 < 1 by assumption, and using the property that (cid:13)(cid:13)(cid:13)E P min(td,n) I −(cid:16) I−GT (cid:17)(cid:17) I −(cid:16) I−G (cid:16) Using the initial conditons r(1) = GT ei and the law of iterated expectation, it follows that t−(1−(cid:107)G(cid:107)2)/d, e−(t−1)(1−(cid:107)G(cid:107)2)/n(cid:17) We substitute this into (18) to show that E P Therefore, (cid:16)−(cid:80)t−1 1 k > ln(t), it follows that min(kd,n) 1−(cid:107)G(cid:107)2 min(kd,n) u = r(t) min(td,n) . (cid:104) r(t)(cid:105)(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)E P , 1−(cid:107)G(cid:107)2 ≤ min . (21) (cid:17)(cid:17) k=1 min(kd,n) r(t). (20) 1−(cid:107)G(cid:107)2 k=1 kd , (cid:17) , exp k=1 = eT E P (cid:16) k=1 exp (19) k=1 k=1 = u . (cid:17)(cid:17) . E P Proof of Lemma 10.1. Observe that = E P We use Lemma 11.1 to prove Lemma 10.1. 2 (cid:104) (cid:21) (cid:20)(cid:13)(cid:13)(cid:13)r(t+1)(cid:13)(cid:13)(cid:13)2 (cid:21) (cid:20)(cid:13)(cid:13)(cid:13)r(t+1) − E P (cid:13)(cid:13)(cid:13)E P r(t+1)(cid:105)(cid:13)(cid:13)(cid:13)2 (cid:104) (cid:12)(cid:12)(cid:12)(cid:12) r(t) (cid:20)(cid:13)(cid:13)(cid:13)r(t+1) − E P (cid:21) r(t+1)(cid:105)(cid:13)(cid:13)(cid:13)2 (cid:104) (cid:12)(cid:12)(cid:12)(cid:12) r(t) (cid:20)(cid:13)(cid:13)(cid:13)r(t+1)(cid:13)(cid:13)(cid:13)2 (cid:21) −(cid:13)(cid:13)(cid:13)E P r(t+1)(cid:12)(cid:12)(cid:12) r(t)(cid:105)(cid:13)(cid:13)(cid:13)2 (cid:104) r(t+1)(cid:105)(cid:13)(cid:13)(cid:13)2 + = E P 2 2 2 2 2 E P and , (23) . (24) substitute (36) and the first expression in Lemma 11.1b into (23) to show that E P [(cid:107)r(t+1)(cid:107)2 2] ≤ atE P [(cid:107)r(t)(cid:107)2 2] + bt, (cid:16) (cid:17) at = (1+(cid:107)G(cid:107)2)2 min(td,n) 1 + 1 min(td,n) , for and Therefore, E P [(cid:107)r(t+1)(cid:107)2 (cid:16)(cid:81)t (cid:16)(cid:81)t Qk = = bt = (t + 1)−2(1−(cid:107)G(cid:107)2)/d. k=1 Qk for 2] ≤(cid:80)t (cid:17) m=k+1 am bk (cid:16) (1+(cid:107)G(cid:107)2)2 min(md,n) m=k+1 · (k + 1)−2(1−(cid:107)G(cid:107)2)/d. 1 + 1 min(md,n) 14 (37) (38) (39) (40) (41) (cid:17)(cid:17) The ratio between subsequent terms can be upper bounded by (cid:17)(cid:16) k+1 (cid:17)−2(1−(cid:107)G(cid:107)2)/d . (27) Qk Qk+1 ≤ (1+(cid:107)G(cid:107)2)2 min((k+1)d,n) 1 + 1 min((k+1)d,n) k+2 (cid:16) Based on the update equation r(t+1) = r(t) − (I − GT )eur(t) u , 2 (cid:21) we can compute that E P (cid:12)(cid:12)(cid:12)(cid:12) r(t) (cid:20)(cid:13)(cid:13)(cid:13)r(t+1)(cid:13)(cid:13)(cid:13)2 =(cid:80) = r(t)T r(t) −(cid:16)(cid:80) +(cid:80) − r(t)T (I − GT ) P(u)r(t)2 u u u By the design, P(u)r(t) (cid:17) P(u)(r(t) − (I − GT )eur(t) u eT u P(u)eur(t) u )T (r(t) − (I − GT )eur(t) u ), (cid:16)(cid:80) (cid:17) (I − G)r(t) (cid:2)(I − G)(I − GT )(cid:3) P(u)r(t) u u u (25) uu . E P u u = r(t) P(u)eur(t) u = r(t)2 (cid:80) (cid:2)(I − G)(I − GT )(cid:3) u / min(td, n), so that u = r(t) min(td,n) . u u / min(td, n), (cid:80) Similarly, since P(u)r(t)2 P(u)r(t)2 u uu = r(t)T Dr(t) min(td,n) , where D is defined to be a diagonal matrix such that u (26) Duu = k G2 uk. (28) Therefore, we substitute (26) and (27) into (25) to show that E P I − 2I−G−GT −D r(t). (29) We substitute (29) and Lemma 11.1a into (24) to show that (cid:17) , 2 2 uu min(td,n) I − 2I−G−GT −D (I − G)(I − GT ) = 1 − 2Guu +(cid:80) (cid:104) (cid:12)(cid:12)(cid:12)(cid:12) r(t) (cid:20)(cid:13)(cid:13)(cid:13)r(t+1)(cid:13)(cid:13)(cid:13)2 (cid:20)(cid:13)(cid:13)(cid:13)r(t+1) − E P = r(t)T(cid:16) − r(t)T(cid:16) = r(t)T(cid:16) ≤(cid:13)(cid:13)(cid:13) (cid:105) (cid:21) = r(t)T(cid:16) (cid:12)(cid:12)(cid:12)(cid:12) r(t) (cid:21) r(t+1)(cid:105)(cid:13)(cid:13)(cid:13)2 (cid:104) (cid:17) I −(cid:16) I−GT (cid:17)(cid:17)(cid:16) I −(cid:16) I−G (cid:17) (cid:13)(cid:13)(cid:13)r(t)(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)2 min(td,n) − (I−G)(I−GT ) (cid:13)(cid:13)(cid:13)GT x (cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)GT(cid:13)(cid:13)(cid:13)2 (cid:113)(cid:80) ≥(cid:113) uu ≤(cid:80) Duu = 1 − 2Guu +(cid:80) min(td,n) − (I−G)(I−GT ) eT u GGT eu = uk ≤ (cid:107)G(cid:107)2 = max (cid:107)x(cid:107)2=1 (cid:107)G(cid:107)2 = 2, and min(td,n)2 min(td,n)2 k G2 k G2 min(td,n) min(td,n) r(t) uk. D D 2 . min(td,n) r(t), (cid:17)(cid:17) r(t), (30) (31) (32) (33) (34) (35) k G2 uk ≤ 1 + 2(cid:107)G(cid:107)2 + (cid:107)G(cid:107)2 = (1 + (cid:107)G(cid:107)2)2. Substitute (35) into (30) to show that 2 (cid:20)(cid:13)(cid:13)(cid:13)r(t+1) − E P (cid:16) ≤ (1+(cid:107)G(cid:107)2)2 min(td,n) E P (cid:104) r(t+1)(cid:105)(cid:13)(cid:13)(cid:13)2 2 (cid:12)(cid:12)(cid:12)(cid:12) r(t) (cid:21) (cid:17)(cid:13)(cid:13)(cid:13)r(t)(cid:13)(cid:13)(cid:13)2 2 By definition, for all u, 1 + 1 min(td,n) . (36) We will use the two expressions given in Lemma 11.1b to get different upper bounds on E P [(cid:107)r(t+1)(cid:107)2 2], and then take the minimum. The first bound is most relevant in the sparse setting when n is large and d and (cid:107)G(cid:107)2 are small. We Therefore, G2 (42) (43) (44) (cid:0)1 + 1 For k ≥ 1, d ≥ 4, and n ≥ 8, (cid:21) It follows that E P (cid:20)(cid:13)(cid:13)(cid:13)r(t+1)(cid:13)(cid:13)(cid:13)2 ≤ 4 Qk+1 Qk 8 8 2 (cid:1)(cid:0) 2 (cid:80)t 3 (cid:1)2/4 (cid:0) 1 < 1 2 . (cid:1)t−k ≤ Qt ≤ 2(t + 1)−2(1−(cid:107)G(cid:107)2)/d. k=1 2 E P [(cid:107)r(t+1)(cid:107)2 (45) We similarly obtain another bound by using the second expression of Lemma 11.1b. This bound applies in settings when the residual vector r(t) is no longer sparse. By Lemma 11.1b, 2] ≤ atE P [(cid:107)r(t)(cid:107)2 (cid:16) t = e−2t(1−(cid:107)G(cid:107)2)/n. Therefore, E P [(cid:107)r(t+1)(cid:107)2 (cid:16)(cid:81)t (cid:80)t k=1 Q(cid:48) e−2k(1−(cid:107)G(cid:107)2)/n. Q(cid:48) k = The ratio between subsequent terms can be upper bounded by 2] + b(cid:48) t, (cid:17)(cid:17) (1+(cid:107)G(cid:107)2)2 min(md,n) 2] ≤ for b(cid:48) min(md,n) k for m=k+1 1 + 1 Q(cid:48) Q(cid:48) k k+1 ≤ (1+(cid:107)G(cid:107)2)2e2(1−(cid:107)G(cid:107)2 ))/n min((k+1)d,n) 1 + 1 min((k+1)d,n) For k ≥ 1, d ≥ 4, and n ≥ 8, (cid:0) 3 (cid:80)t It follows that E P [(cid:107)r(t+1)(cid:107)2 2] ≤ Q(cid:48) Q(cid:48) Q(cid:48) k=1 k+1 t k 4 ≤ 9e2(1−(cid:107)G(cid:107)2)/n < 3 4 . 16 (cid:1)t−k ≤ 4e−2t(1−(cid:107)G(cid:107)2)/n. (cid:17) . (46) (47) (cid:16) ACKNOWLEDGMENTS This work is supported in parts by ARO under MURI award W911NF-11-1-00365, by AFOSR under MURI award FA9550-09-1-0538, by ONR under the Basic Research Chal- lenge No. N000141210997, by DARPA under grant W911NF- 16-1-055, and by NSF under grants CNS-1161964, CMMI- 1462158, CMMI-1634259 and a Graduate Fellowship. 15 [24] N. Shyamkumar, S. Banerjee, and P. Lofgren, "Sublinear estimation of a single element in sparse linear systems," in Communication, Control, and Computing (Allerton), 2016 54th Annual Allerton Confer- ence on. IEEE, 2016, pp. 856 -- 860. [25] C. E. Lee, A. Ozdaglar, and D. Shah, "Asynchronous approxima- tion of a single component of the solution to a linear system," arXiv preprint arXiv:1411.2647, 2014. [26] T. Strohmer and R. Vershynin, "A randomized kaczmarz algo- rithm with exponential convergence," Journal of Fourier Analysis and Applications, vol. 15, no. 2, pp. 262 -- 278, 2009. [27] K. Sabelfeld and N. Loshchina, "Stochastic iterative projection methods for large linear systems," Monte Carlo Methods and Ap- plications, vol. 16, no. 3-4, pp. 343 -- 359, 2010. [28] K. Sabelfeld, "Stochastic algorithms in linear algebra-beyond the markov chains and von neumann-ulam scheme," in Numerical Methods and Applications. Springer, 2011, pp. 14 -- 28. [29] K. Sabelfeld and N. Mozartova, "Sparsified randomization algo- rithms for large systems of linear equations and a new version of the random walk on boundary method," Monte Carlo Methods and Applications, vol. 15, no. 3, pp. 257 -- 284, 2009. [30] M. Wang and D. P. Bertsekas, "Stabilization of stochastic iterative methods for singular and nearly singular linear systems," Mathe- matics of Operations Research, vol. 39, no. 1, pp. 1 -- 30, 2013. [31] J. Nutini, M. Schmidt, I. H. Laradji, M. Friedlander, and H. Koepke, "Coordinate descent converges faster with the gauss-southwell rule than random selection," in Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ser. [Online]. Available: http://dl.acm.org/citation.cfm?id=3045118.3045292 JMLR.org, 2015, pp. 1632 -- 1641. ICML'15. REFERENCES [1] J. Dean and S. Ghemawat, "Mapreduce: simplified data processing on large clusters," Communications of the ACM, vol. 51, no. 1, pp. 107 -- 113, 2008. [2] D. Borthakur, "The hadoop distributed file system: Architecture and design," Hadoop Project Website, vol. 11, no. 2007, p. 21, 2007. [3] M. Zaharia, M. Chowdhury, M. J. Franklin, S. Shenker, and I. Stoica, "Spark: Cluster computing with working sets." HotCloud, vol. 10, no. 10-10, p. 95, 2010. J. R. Westlake, A handbook of numerical matrix inversion and solution of linear equations. Wiley New York, 1968, vol. 767. [5] D. P. Bertsekas and J. N. Tsitsiklis, Parallel and distributed computa- [4] tion: numerical methods. Prentice-Hall, Inc., 1989. [7] [9] [6] G. H. Golub and C. F. Van Loan, Matrix computations / Gene H. Golub, Charles F. Van Loan., ser. Johns Hopkins studies in the mathematical sciences. Baltimore : The Johns Hopkins University Press, 2013., 2013. S. J. Wright, "Coordinate descent algorithms," Mathematical Pro- gramming, vol. 151, no. 1, pp. 3 -- 34, 2015. [8] D. A. Spielman and S.-H. Teng, "Nearly linear time algorithms for preconditioning and solving symmetric, diagonally dominant linear systems," SIAM Journal on Matrix Analysis and Applications, vol. 35, no. 3, pp. 835 -- 885, 2014. I. Koutis, G. L. Miller, and R. Peng, "A nearly-m log n time solver for sdd linear systems," in Foundations of Computer Science (FOCS), 2011 IEEE 52nd Annual Symposium on. IEEE, 2011, pp. 590 -- 598. [10] J. A. Kelner, L. Orecchia, A. Sidford, and Z. A. Zhu, "A simple, combinatorial algorithm for solving sdd systems in nearly-linear time," in Proceedings of the forty-fifth annual ACM symposium on Theory of computing. ACM, 2013, pp. 911 -- 920. [11] N. K. Vishnoi et al., "Lx= b, laplacian solvers and their algorithmic applications," Foundations and Trends R(cid:13) in Theoretical Computer Science, vol. 8, no. 1 -- 2, pp. 1 -- 141, 2013. [12] J. Liu, S. Mou, and A. S. Morse, "An asynchronous distributed algorithm for solving a linear algebraic equation," in Decision and Control (CDC), 2013 IEEE 52nd Annual Conference on. IEEE, 2013, pp. 5409 -- 5414. [13] S. Mou, J. Liu, and A. S. Morse, "A distributed algorithm for solving a linear algebraic equation," IEEE Transactions on Automatic Control, vol. 60, no. 11, pp. 2863 -- 2878, 2015. [14] G. E. Forsythe and R. A. Leibler, "Matrix inversion by a monte carlo method," Mathematical Tables and Other Aids to Computation, pp. 127 -- 129, 1950. [15] W. Wasow, "A note on the inversion of matrices by random walks," Mathematical Tables and Other Aids to Computation, pp. 78 -- 81, 1952. [16] J. Curtiss, A theoretical comparison of the efficiencies of two classical methods and a monte carlo method for computing one component of the solution of a set of linear algebraic equations. Courant Institute of Mathematical Sciences, New York University, 1954. [17] I. Dimov, S. Maire, and J. M. Sellier, "A new walk on equations monte carlo method for solving systems of linear algebraic equa- tions," Applied Mathematical Modelling, vol. 39, no. 15, pp. 4494 -- 4510, 2015. [18] J. H. Halton, "A retrospective and prospective survey of the monte carlo method," Siam review, vol. 12, no. 1, pp. 1 -- 63, 1970. [19] -- -- , "Sequential monte carlo techniques for the solution of linear systems," Journal of Scientific Computing, vol. 9, no. 2, pp. 213 -- 257, 1994. [20] H. Ji, M. Mascagni, and Y. Li, "Convergence analysis of markov chain monte carlo linear solvers using ulam -- von neumann al- gorithm," SIAM Journal on Numerical Analysis, vol. 51, no. 4, pp. 2107 -- 2122, 2013. [21] C. E. Lee, A. Ozdaglar, and D. Shah, "Computing the stationary distribution locally," in Advances in Neural Information Processing Systems 26, C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K. Weinberger, Eds. Curran Associates, Inc., 2013, pp. 1376 -- 1384. [Online]. Available: http://papers.nips.cc/paper/ 5009-computing-the-stationary-distribution-locally.pdf [22] D. F. Gleich and K. Kloster, "Sublinear column-wise actions of the matrix exponential on social networks," Internet Mathematics, vol. 11, no. 4-5, pp. 352 -- 384, 2015. [23] R. Andersen, C. Borgs, J. Chayes, J. Hopcraft, V. S. Mirrokni, and S.-H. Teng, "Local computation of PageRank contributions," in Algorithms and Models for the Web-Graph. Springer, 2007, pp. 150 -- 165.
1807.05374
2
1807
2018-07-19T10:30:01
Matching and MIS for Uniformly Sparse Graphs in the Low-Memory MPC Model
[ "cs.DS" ]
The Massively Parallel Computation (MPC) model serves as a common abstraction of many modern large-scale parallel computation frameworks and has recently gained a lot of importance, especially in the context of classic graph problems. Unsatisfactorily, all current $\text{poly} (\log \log n)$-round MPC algorithms seem to get fundamentally stuck at the linear-memory barrier: their efficiency crucially relies on each machine having space at least linear in the number $n$ of nodes. As this might not only be prohibitively large, but also allows for easy if not trivial solutions for sparse graphs, we are interested in the low-memory MPC model, where the space per machine is restricted to be strongly sublinear, that is, $n^{\delta}$ for any $0<\delta<1$. We devise a degree reduction technique that reduces maximal matching and maximal independent set in graphs with arboricity $\lambda$ to the corresponding problems in graphs with maximum degree $\text{poly}(\lambda)$ in $O(\log^2 \log n)$ rounds. This gives rise to $O\left(\log^2\log n + T(\text{poly} \lambda)\right)$-round algorithms, where $T(\Delta)$ is the $\Delta$-dependency in the round complexity of maximal matching and maximal independent set in graphs with maximum degree $\Delta$. A concurrent work by Ghaffari and Uitto shows that $T(\Delta)=O(\sqrt{\log \Delta})$. For graphs with arboricity $\lambda=\text{poly}(\log n)$, this almost exponentially improves over Luby's $O(\log n)$-round PRAM algorithm [STOC'85, JALG'86], and constitutes the first $\text{poly} (\log \log n)$-round maximal matching algorithm in the low-memory MPC model, thus breaking the linear-memory barrier. Previously, the only known subpolylogarithmic algorithm, due to Lattanzi et al. [SPAA'11], required strongly superlinear, that is, $n^{1+\Omega(1)}$, memory per machine.
cs.DS
cs
Matching and MIS for Uniformly Sparse Graphs in the Low-Memory MPC Model Sebastian Brandt ETH Zurich [email protected] Manuela Fischer ETH Zurich [email protected] Jara Uitto∗ ETH Zurich & University of Freiburg [email protected] Abstract The Massively Parallel Computation (MPC) model serves as a common abstraction of many modern large-scale parallel computation frameworks and has recently gained a lot of importance, especially in the context of classic graph problems. Unsatisfactorily, all current poly(log log n)-round MPC algorithms seem to get fundamentally stuck at the linear-memory barrier: their efficiency crucially relies on each machine having space at least linear in the number n of nodes. As this might not only be prohibitively large, but also allows for easy if not trivial solutions for sparse graphs, we are interested in the low-memory MPC model, where the space per machine is restricted to be strongly sublinear, that is, nδ for any 0 < δ < 1. We study maximal matching and maximal independent set in this low-memory MPC model. Our key ingredient is a degree reduction technique that reduces these problems in graphs with arboricity λ to the corresponding problems in graphs with maximum degree poly(λ) in O(log2 log n) rounds. This gives rise to O(cid:0)log2 log n + T (poly λ)(cid:1)-round algorithms, where T (∆) is the ∆-dependency in the round complexity of maximal matching and maximal independent set in graphs with maximum degree ∆. A direct simulation of the LOCAL algorithms by Barenboim et al. [FOCS'12] and Ghaffari [SODA'16] leads to T (∆) = O(log ∆), and a concurrent work by Ghaffari and Uitto shows that T (∆) = O( log ∆). For graphs with arboricity λ = poly(log n), this almost exponentially improves over Luby's O(log n)-round PRAM algorithm [STOC'85, JALG'86], and constitutes the first poly(log log n)- round maximal matching algorithm in the low-memory MPC model, thus breaking the linear- memory barrier. Previously, the only known subpolylogarithmic algorithm, due to Lattanzi et al. [SPAA'11], required strongly superlinear, that is, n1+Ω(1), memory per machine. Moreover, our maximal matching algorithm can be employed to obtain a (1 + ε)-approximate maximum cardinality matching, a (2 + ε)-approximate maximum weighted matching, as well as a 2-approximate minimum vertex cover in essentially the same number of rounds. √ 8 1 0 2 l u J 9 1 ] S D . s c [ 2 v 4 7 3 5 0 . 7 0 8 1 : v i X r a ∗supported by ERC Grant No. 336495 (ACDC) 1 Introduction Due to the prevalence of huge networks, scalable algorithms for fundamental graph problems recently have gained a lot of importance in the area of parallel computing. The Massively Parallel Computation (MPC) model [KSV10, GSZ11, BKS14, ANOY14, BKS17, CŁM+18] constitutes a common abstraction of several popular large-scale computation frameworks-such as MapReduce [DG08], Dryad [IBY+07], Spark [ZCF+10], and Hadoop [Whi12]-and thus serves as the basis for the systematic study of mas- sively parallel algorithms. While classic parallel (e.g., PRAM) or distributed (e.g., LOCAL) algorithms can usually be imple- mented straightforwardly in MPC in the same number of rounds [KSV10,GSZ11], the additional power of local computation (compared to PRAM) or of global communication (compared to LOCAL) could potentially be exploited to obtain faster MPC algorithms. Czumaj et al. [CŁM+18] thus ask: "Are the MPC parallel round bounds "inherited" from the PRAM model tight? In particular, which problems can be solved in significantly smaller number of MPC rounds than what the [...] PRAM model suggest[s]?" Surprisingly, for maximal matching, one of the most central graph problems in parallel and distributed computing that goes back to the very beginning of the area, the answer to this question is not known. In fact, even worse, our understanding of the maximal matching problem in the MPC model is rather bleak. Indeed, the only subpolylogarithmic1 algorithm by Lattanzi, Moseley, Suri, and Vassilvitskii [LMSV11] requires the memory per machine to be substantially superlinear in the number n of nodes in the graph. This is not only prohibitively large and hence impractical for massive graphs, but also allows an easy or even trivial solution for sparse graphs, which both are often assumed to be the case for many practical graphs [KSV10, CŁM+18]. When the local memory is restricted to be (nearly) linear in n, the round complexity of Lattanzi et al.'s algorithm drastically degrades, falling back to the trivial bound attained by the simulation of the O(log n)-round PRAM algorithm due to Luby [Lub85] and, independently, Alon, Babai, and Itai [ABI86]. For other classic problems, such as Maximal Independent Set (MIS) or approximate maximum matching, we have a slightly better understanding. There, the local memory can be reduced to be (cid:101)O(n) while still having poly(log log n)-round algorithms [ABB+17, CŁM+18, GGK+18]. Yet, all these algorithms fail to go (substantially) below linear space without an (almost) exponential blow-up in the running time. It is thus natural to ask whether there is a fundamental reason why the known techniques get stuck at the linear-memory barrier and study the low-memory MPC model with strongly sublinear space to address this question. Low-Memory MPC Model for Graph Problems: We have M machines with local memory of S = O(cid:0)nδ(cid:1) words each, for some 0 < δ ≤ 12. A graph with n nodes, m edges, and maximum degree (nearly) linear in the input, i.e., M · S = (cid:101)Θ(m). The computation proceeds in rounds consisting of local ∆ is distributed arbitrarily across the machines. We assume the total memory in the system to be computation in all machines in parallel, followed by global communication between the machines. We require that the total size of sent and received messages of a machine in every communication phase does not exceed its local memory capacity. The main interest lies in minimizing the number of rounds, aiming for poly(log log n). 1We are aware of an O( √ log n)-round low-memory MPC algorithm by Ghaffari and Uitto in a concurrent work [GU18]. However, only algorithms that are significantly faster than their PRAM counterparts-that is, smaller than any polynomial in log n, and ideally at most a polynomial in log log n-are considered efficient. 2Note that we do not require δ to be a constant. For the sake of simplicity of presentation, we decided to omit the (cid:1), in the analysis of the running time of our algorithms. δ-dependency, which is a multiplicative factor of O(cid:0) 1 δ 1 In this low-memory MPC model, the best known algorithms usually stem from straight forward simulations of PRAM and LOCAL algorithms, thus requiring at least polylogarithmic rounds. In the special case of trees, [BFU18] managed to beat this bound by providing an O(log3 log n)-round al- gorithm for MIS. The authors left it as a main open question whether there is a low-memory MPC algorithm for general graphs in poly(log log n) rounds. We make a step towards answering this question by devising a degree reduction technique that reduces the problems of maximal matching and maximal independent set in a graph with arboricity λ to the corresponding problems in graphs with maximum degree poly(λ) in O(cid:0)log2 log n(cid:1) rounds. the respective problems in graphs with maximum degree O(cid:0)max{λ20, log20 n}(cid:1)5. Theorem 1.1. There is an O (log log∆ n · log logλ ∆)-round low-memory MPC algorithm that w.h.p.3 reduces maximal matching and maximal independent set in graphs with arboricity λ = o(poly(n))4 to This improves over the degree reduction algorithm by Barenboim, Elkin, Pettie, and Schnei- der [BEPS12, Theorem 7.2], which runs in O(logλ ∆) rounds in the LOCAL model and can be straight- forwardly implemented in the low-memory MPC model. √ log ∆ + √ √ log ∆ + log log log n(cid:1) and O(cid:0)√ Our degree reduction technique, combined with the state-of-the-art algorithms for maximal match- ing and maximal independent set, gives rise to a number of low-memory MPC algorithms, as overviewed next. Throughout, we state our running times based on a concurrent work by Ghaffari and Uitto [GU18], in which they prove that maximal matching and maximal independent set can be solved in O(cid:0)√ proving over O (log ∆ + log log log n) and O(cid:0)log ∆ + Theorem 1.2. There is an O(cid:0)√ This improves over the O(cid:0)log λ + log log n(cid:1) low-memory MPC rounds, respectively, im- log log n(cid:1), respectively, which can be obtained log λ + log log n · log log ∆(cid:1)-round low-memory MPC algorithm that log n(cid:1)-round LOCAL algorithm by [BEPS12] and the O( by a sped up simulation [ASS+18] of state-of-the-art LOCAL algorithms [BEPS12, Gha16]. We apply these algorithms by Ghaffari and Uitto as a black box. By using earlier results, the term O( log λ) in the running times of our theorem statements would get replaced by O(log λ). w.h.p. computes a maximal matching in a graph with arboricity λ. log ∆+ log log log n)-round algorithm by [GU18]. We get the first poly(log log n)-round algorithm-and hence an almost exponential improvement over the state of the art, for linear as well as strongly sublin- ear space per machine-for all graphs with arboricity λ = poly(log n). This family of uniformly sparse graphs, also known as sparse everywhere graphs, includes but is not restricted to graphs with maximum degree poly(log n), minor-closed graphs (e.g., planar graphs and graphs with bounded treewidth), and preferential attachment graphs, and thus arguably contains most graphs of practical relevance [GG06, OSSW18]. The previously known poly(log log n)-round MPC algorithms either only worked in the special case of poly(log n)-degree graphs [GU18], or required the local memory to be strongly superlinear [LMSV11]. To the best of our knowledge, all poly(log log n)-round MPC matching approximation algorithms for general graphs (even if we allow linear memory) [CŁM+18,ABB+17,GGK+18] heavily make use of subsampling, inevitably leading to a loss of information. It is thus unlikely that these techniques are applicable for maximal matching, at least not without a factor Ω(log n) overhead. In fact, the problem of finding a maximal matching seems to be more difficult than finding a (1 + ε)-approximate maximum matching. Indeed, currently, an O(1)-approximation can be found almost exponentially faster than a maximal matching, and the approximation ratio can be easily improved from any constant to 1 + ε using a reduction of McGregor [McG05]. √ √ 3As usual, w.h.p. stands for with high probability, and means with probability at least 1− n−c for any constant c ≥ 1. 4With o(poly(n)) we mean subpolynomial in n, i.e., o(nc) for any constant c > 0. Note that for λ = poly(n), our results for MIS and maximal matching follow directly, without any need for degree reduction. 5The purpose of the choice of all the constants in this work is merely to simplify presentation. 2 w.h.p. computes a maximal independent set in a graph with arboricity λ. Our result becomes particularly instructive when viewed in this context. It is not only the first maximal matching algorithm that breaks the linear-memory barrier for a large range of graphs, but it also enriches the bleak pool of techniques for maximal matching in the presence of low memory by one particularly simple technique. log λ + log log n · log log ∆(cid:1)-round low-memory MPC algorithm that log n(cid:1)-round algorithm that is obtained by simulating log log n(cid:1)-round algorithm in the Theorem 1.3. There is an O(cid:0)√ This algorithm improves over the O(cid:0)log λ + the LOCAL algorithm of [BEPS12,Gha16] and over the O(cid:0)√ degree graphs [GU18] and trees [BFU18], or required the local memory to be (cid:101)Ω(n) [GGK+18]. Corollary 1.4. There is an O(cid:0)√ concurent work by Ghaffari and Uitto [GU18]. Moreover, for graphs with arboricity λ = poly(log n), our algorithm is the first poly(log log n)-round low-memory MPC algorithm. The previously known poly(log log n)-round MPC algorithms for MIS either only worked in the special case of poly(log n)- log λ + log log n · log log ∆(cid:1)-round low-memory MPC algorithm that As a maximal matching automatically provides 2-approximations for maximum matching and min- imum vertex cover, Theorem 1.2 directly implies the following result. log ∆ + √ √ w.h.p. computes a 2-approximate maximum matching and a 2-approximate minimum vertex cover in a graph with arboricity λ. This is the first constant-approximation MPC algorithm for matching and vertex cover-except for the LOCAL and PRAM simulations by [BEPS12] and [Lub85, ABI86], respectively, as well as the concurrent work in [GU18]-that work with low memory. All the other algorithms require the space per machine to be either (cid:101)Ω(n) [LMSV11, CŁM+18, ABB+17, GGK+18] or even strongly su- perlinear [LMSV11, AK17]. Corollary 1.4 generalizes the range of graphs that admit an efficient constant-approximation for matching and vertex cover in the low-memory MPC model from graphs with maximum degree poly(log n) [GU18] to uniformly sparse graphs with arboricity λ = poly(log n). McGregor's reduction [McG05] allows us to further improve the approximation to 1 + ε. (cid:16)(cid:0) 1 (cid:1)O(1/ε) ·(cid:0)√ log λ + log log n · log log ∆(cid:1)(cid:17) Corollary 1.5. There is an O algorithm that w.h.p. computes a (1 + ε)-approximate maximum matching, for any ε > 0. ε -round low-memory MPC Due to a reduction by to Lotker, Patt-Shamir, and Rosén [LPSR09], our constant-approximate matching algorithm can be employed to find a (2 + ε)-approximate maximum weighted matching. log λ + log log n · log log ∆(cid:1)(cid:1)-round low-memory MPC algorithm ε ·(cid:0)√ Corollary 1.6. There is an O(cid:0) 1 that w.h.p. computes a (2 + ε)-approximate maximum weighted matching, for any ε > 0. Concurrent Work In this section, we briefly discuss an independent and concurrent work by Behnezhad, Derakhshan, Ha- jiaghayi, and Karp [BDHK18]. The authors there arrive at the same results, with the same round com- plexities and the same memory requirements. As in our work, their key ingredient is a degree reduction technique that reduces the maximum degree of a graph from ∆ to poly(λ, log n) in O(log log ∆·log log n) rounds. While our degree reduction algorithm is based on (a variant of) the H-partition that partitions the vertices according to their degrees, the authors in [BDHK18] show how to implement (and speed up) the LOCAL degree reduction algorithm by Barenboim, Elkin, Pettie, and Schneider [BEPS12, The- orem 7.2] in the low-memory MPC model. Note that both algorithms do not require knowledge of the arboricity λ, as further discussed in Remark 2.2. 3 2 Algorithm Outline and Roadmap In the low-memory setting, one is inevitably confronted with the challenge of locality: as the space of a machine is strongly sublinear, it will never be able to see a significant fraction of the nodes, regardless of how sparse the graph is. Further building on the ideas by [BFU18], we cope with this imposed locality by adopting local techniques-mainly inspired by the LOCAL model [Lin92]-and enhancing them with the additional power of global communication, in order to achieve an improvement in the round complexity compared to the LOCAL algorithms while still being able to guarantee applicability in the presence of strongly sublinear memory. The main observation behind our algorithms is the following: If the maximum degree in the graph is small, LOCAL algorithms can be simulated efficiently in the low-memory MPC model. Our method thus basically boils down to reducing the maximum degree of the input graph, as described in Theorem 1.1, and correspondingly consists of two parts: a degree reduction part followed by a LOCAL simulation part. In the degree reduction part, which constitutes the key ingredient of our algorithm, we want to find a partial solution (that is, either a matching or an independent set) so that the remainder graph-i.e., the graph after the removal of this partial solution (that is, after removing all matched nodes or after removing the independent set nodes along with all their neighbors)-has smaller degree. Lemma 2.1. There are O (log log n · log log ∆)-round low-memory MPC algorithms that compute a matching and an independent set in a graph with arboricity λ = o(poly(n)) so that the remainder graph w.h.p. has maximum degree O (max{λ, log n})20(cid:17) (cid:16) . Note that this directly implies Theorem 1.1. Next, we show how Theorems 1.2 and 1.3 follow from Lemma 2.1 as well as from an efficient simulation of LOCAL algorithms due to [GU18]. √ Proof of Theorems 1.2 and 1.3. If λ, and hence ∆, is at least polynomial in n, we directly apply the algorithm by [GU18], which runs in O( log n) rounds. Otherwise, we first apply the algorithm of Lemma 2.1 to obtain a partial solution that reduces the degree in the remainder graph to ∆(cid:48) = O(λ20) if λ ≥ log n, or to ∆(cid:48) = O(log20 n) if λ ≤ log n. It runs in O(log log n · log log ∆) log ∆(cid:48) + rounds. We then apply the algorithm by [GU18] on the remainder graph. This takes O( √ √ log log n) = O( √ log log n) = O( log log n) rounds. log ∆ + log λ + √ √ √ Remark 2.2. While our algorithms, at first sight, seem to need to know λ, we can employ the standard technique [KSV13] of running the algorithm with doubly-exponentially increasing estimates for λ. Our degree reduction algorithm in Lemma 2.1 consists of several phases, each reducing the maximum degree by a polynomial factor, as long as the degree is still large enough. Lemma 2.3. There are O (log log n)-round low-memory MPC algorithms that compute a matching and an independent set, respectively, in a graph with arboricity λ = o(poly(n)) and maximum degree ∆ = Ω (max{λ, log n})20(cid:17) so that the remainder graph w.h.p. has maximum degree O(∆0.4). (cid:16) We first show that indeed iterated applications of this polynomial degree reduction lead to the desired degree reduction in Lemma 2.1. Proof of Lemma 2.1. We iteratively apply the polynomial degree reduction from Lemma 2.3, observing that as long as the maximum degree is still in Ω(λ20) and Ω(log20 n), we reduce the maximum degree by a polynomial factor from ∆ to O(∆0.4) in each phase, resulting in at most O(log log ∆) phases. It remains to show that such a polynomial degree reduction, as claimed in Lemma 2.3, indeed is possible. This is done in two parts. First, in Section 3, we provide a centralized algorithm for a polynomial degree reduction, and then, in Section 4, we show how to implement this centralized algorithm efficiently in the low-memory MPC model. 4 3 A Centralized Degree Reduction Algorithm In this section, we present a centralized algorithm for the polynomial degree reduction as stated in Lemma 2.3. For details on how this algorithm can be implemented in the low-memory MPC model, we refer to Section 4. In Section 3.1, we give a formal description of the (centralized) algorithm. Then, in Section 3.2, we prove that this algorithm indeed leads to a polynomial degree reduction. 3.1 Algorithm Description In the following, we set d = ∆1/10, and observe that d = Ω(λ2) as well as d = Ω(log2 n), due to the assumptions on ∆ in the lemma statement. We present an algorithm that reduces the maximum degree to O(d4). This algorithm consists of three phases: a partition phase, in which the vertices are partitioned into layers so that every node has at most d neighbors in higher-index layers, a mark-and- propose phase in which a random set of candidates is proposed independently in every layer, and a selection phase in which a valid subset of the candidate set is selected as partial solution by resolving potential conflicts across layers. Partition Phase: We compute an H-partition, that is, a partition of the vertices into layers so that every vertex has at most d neighbors in layers with higher (or equal) index [NW61, NW64, BE10]. in(cid:83)(cid:96) Definition 3.1 (H-Partition). An H-partition with out-degree d, defined for any d > 2λ, is a partition of the vertices into (cid:96) layers L1, . . . , L(cid:96) with the property that a vertex v ∈ Li has at most d neighbors j=i Lj. We call i the layer index of v if v ∈ Li. For neighbors u ∈ Li and v ∈ Lj for i < j, we call v a parent of u and u a child of v. If we think of the edges as being directed from children to parents, this gives rise to a partial orientation of the edges, with no orientation of the edges connecting vertices in the same layer. Note that, for d > 2λ, such a partition can be computed easily by the following sequential greedy Iteratively, for i ≥ 1, put all remaining nodes with algorithm, also known as peeling algorithm: remaining degree at most d into layer i, and remove them from the graph. Mark-and-Propose Phase: We first mark a random set of candidates (either edges or vertices) and then propose a subset of these marked candidates for the partial solution as follows. In the case of maximal matching, every node first marks an outgoing edge chosen uniformly at random and then proposes one of its incoming marked edges, if any, uniformly at random. In the case of maximal independent set, every node marks itself independently with probability p = d−2. Then, if a node is marked and none of its neighbors in the same layer is marked, this node is proposed. Note that whether a marked node gets proposed only depends on nodes in the same layer, thus on neighbors with respect to unoriented edges. Selection Phase: The set of proposed candidates might not be a valid solution, meaning that it might have some conflicts (i.e., two incident edges or two neighboring vertices). In the selection phase, possible conflicts are resolved (deterministically) by picking an appropriate subset of the proposed candidates, as follows. Iteratively, for i = (cid:96), . . . , 1, all (remaining) proposed candidates in layer i are added to the partial solution and then removed from the graph. In the case of maximal matching, we add all (remaining) proposed edges directed to a node in layer i to the matching and remove both their endpoints from the graph. In the case of maximal independent set, we add all (remaining) proposed nodes in layer i to the independent set and remove them along with their neighbors from the graph. 5 Figure 1: Illustration of the mark-and-propose and the selection phase for matching in (a) and independent set in (b). Blue indicates marked but not proposed, green stands for (marked and) proposed but not selected, and red means (marked and proposed and) selected. Note that we omitted all (but a few) irrelevant edges from the figure; the partition into layers thus might not correspond to a valid H-partition. (a) An (oriented) edge e = (u, v) that is selected to be added to the matching cannot have an incident edge that is also selected: an unoriented incident edge cannot be marked as only oriented edges are marked; an oriented edge with the same starting point u cannot be marked as u marks only one outgoing edge; an oriented edge with the same endpoint v cannot be proposed as v proposes only one incoming edge; all other oriented edges f are either processed before (in the case of an outgoing edge from v) or after (in the case of an incoming edge to u) edge e in the selection phase. In the former case, the selection of f would lead to the removal of e before e is processed; e thus would not be selected. In the latter case, the edge f is removed immediately after e is selected (and thus before f is processed), and thus cannot be selected. (b) If two neighboring nodes are marked, none of them will be proposed, and consequently, none of them will be selected. A node v that is selected to be added to the independent set cannot have a neighbor that is also selected: a neighbor in the same layer cannot be marked as otherwise v would not be proposed; a neighbor in a lower-index layer is removed from the graph when v joins the independent set, and hence before it potentially could be selected; a selected neighbor in a higher-index layer would lead to v's immediate removal from the graph; when v's layer is processed, v is not part of the graph anymore, and thus could not be selected. 3.2 Proof of Correctness It is easy to see that the selected solution is a valid partial solution, that is, that there are no conflicts. It remains to be shown that the degree indeed drops to O(d4). As the out-degree is bounded by d, it is enough to show the following. Lemma 3.2. Every vertex with in-degree at least d4 gets removed or all but d4 of its incoming edges get removed, with high probability. Proof of Lemma 3.2 for matching. Let v be a node with degree at least d4. First, observe that if at least one incoming edge of v is proposed, then an edge incident to v (not necessarily incoming) will be selected to be added to the matching. This is because the only reason why v would not select a proposed incoming edge is that v has already been removed from the graph, and this happens only if its proposed edge has been selected to be added to the matching in a previous step. It thus remains to show that every vertex v with in-degree at least d4 with high probability will have at least one incoming edge that has been proposed by the respective child. As every incoming edge of v is proposed independently with probability at least 1/d, the probability of v not having a proposed incoming edge is at most (1 − 1/d)d4 ≤ e−d3 = e−Ω(log6 n) = o . A union bound over all vertices with degree at least d4 concludes the proof. (cid:16) 1 (cid:17) poly(n) 6 euvv Proof of Lemma 3.2 for independent set. Let v be a vertex in layer i that is still in the graph and has at least d4 children after all layers with index ≥ i have been processed. We show that then at least one of these children will be selected to join the independent set with high probability. Note that this then concludes the proof, as in all the cases either v will be removed from the graph or will not have high in-degree anymore. Moreover, observe that such a child u of v (that is still there after having processed layers ≥ i) will be selected to join the independent set iff it is proposed. This is because if it did not join even though it is proposed, then a parent of u would had been selected to join the independent set, in which case u would not have been part of the graph anymore, at latest after i has been processed, thus would not count towards v's high degree at that point. Every such child u of v is marked independently with probability p = d−2. The probability of u being proposed and hence joining the independent set is at least p(1− p)d, as it has at most d neighbors in its layer, and it is proposed iff it is marked and none of its neighbors in the same layer is marked. Vertex v thus in expectation has at least µ := d4p(1 − p)d ≥ d2e−2/d = Ω(d2) children that join the independent set. (cid:17) Since whether a node u proposes and hence joins the independent set depends on at most d other nodes (namely u's neighbors in the same layer), it thus follows from a variant of the Chernoff bounds for bounded dependence, e.g., from Theorem 2.1 in [Pem01], that the probability of v having, say, 0.5µ neighbors that join the independent set is at most e−Ω(µ/d) = e−Ω(d) ≤ e−Ω(log2 n) = o . A union bound over all vertices v with degree at least d4 concludes the proof. (cid:16) 1 poly(n) 4 Implementation of the Degree Reduction Algorithm in MPC In this section, we show how to simulate the centralized degree reduction algorithm from Section 3 in the low-memory MPC model. In Section 4.1, we show how to implement the partition phase efficiently in the low-memory MPC model. Then, in Section 4.2, we describe how to perform the simulation of the mark-and-propose as well as the selection phase. Together with the correctness proof established in Section 3.2, this will conclude the proof of Lemma 2.3. The main idea behind the simulation is to use the well-known graph exponentiation technique [LW10], which can be summarized as follows: Suppose that every node knows its 2i−1-hop neighborhood in iteration i− 1. Then, in iteration i, each node can inform the nodes in its 2i−1-hop neighborhood of the topology of its 2i−1-hop neighborhood. Hence, every node can learn of its 2i-hop neighborhood in iteration i, allowing it to simulate any 2i-round LOCAL algorithm in 0 rounds. Using this exponentiation technique, in principle, every t-round LOCAL algorithm can be simulated in O(log t) MPC rounds. We have to be careful about the memory restrictions though. In iteration i of the exponentiation process, we need to store a copy of the 2i-hop neighborhood of every node. If the neighborhood contains more than nδ edges, we violate the local memory constraint. Similarly, the total memory of (cid:101)Θ(m) might not be enough to store each of these copies, even if every single copy fits to a machine. In order to deal with these issues, the key observation is that a large fraction of the nodes in the graph are contained in the first layers of the H-partition. In particular, we show that if we focus on the graph remaining after (cid:96)/2 iterations of peeling, we can perform roughly log (cid:96) exponentiation steps without violating the memory constraints. Hence, we can perform 2i steps of the degree reduction process in roughly i communication rounds. In case the maximum degree ∆ is larger than the local memory S = O(nδ), one needs to pay attention to how the graph is distributed. One explicit way is to split high-degree nodes into many copies and distribute the copies among many machines. For the communication between the copies, one can imagine a (virtual) balanced tree of depth 1/δ rooted at one of the copies. Through this tree, the copies can exchange information in O(1/δ) communication rounds. For the sake of simplicity, our write-up assumes that ∆ (cid:28) nδ. 7 4.1 Partition Phase We first prove some properties of the H-partition constructed by the greedy peeling algorithm that will be useful for an efficient implementation in the low-memory MPC model. (cid:1)i−1. d (cid:12)(cid:12)(cid:12)(cid:83)(cid:96) (cid:17) n (i) For all 0 ≤ i ≤ (cid:96), the number Lemma 4.1. The H-partition with out-degree d, constructed by the greedy peeling algorithm, satisfies the following properties. In other words, if we remove all nodes in layer i from the set of nodes in layers ≥ i, then the number of nodes drops by a factor of 2λ (cid:12)(cid:12)(cid:12) of nodes in layers with index ≥ i is at most n(cid:0) 2λ (cid:12)(cid:12)(cid:12)(cid:83)(cid:96) (cid:12)(cid:12)(cid:12) for all 0 ≤ i ≤ (cid:96). (cid:12)(cid:12)(cid:12) ≤ 2λ (cid:1)i−1 nodes in the graph Hi Proof. We prove (i) by induction, thus assume that there are ni ≤ n(cid:0) 2λ induced by vertices in layers ≥ i. Towards a contradiction, suppose that there are ni+1 > n(cid:0) 2λ (cid:1)i nodes in layers ≥ i + 1. By construction, all these nodes must have had degree larger than d in Hi, as otherwise they would have been added to layer i. This results in an average degree of more than ni+1d = 2λ in Hi, which contradicts the well-known upper bound of 2λ on the average degree in a graph that has arboricty at most λ. Note that (ii) is a direct consequence of (i). ni d (ii) There are at most (cid:96) = O j=i+1 Lj d j=i Lj log d λ layers. (cid:16) j=i Lj (cid:12)(cid:12)(cid:12)(cid:83)(cid:96) d , i.e., d In the following, we describe how to compute the H-partition with parameter d = ∆1/10 in the low-memory MPC model6. Throughout this section, we assume that ∆ ≥ (2λ)20, i.e., that d ≥ (2λ)2. Observe that if ∆2 > nδ, then the H-partition with parameter d = ∆1/10 consists of O(logd/λ n) = O(log∆ n) = O(1/δ) layers, in which case the arguments in this section imply that going through the layers one by one will easily yield at least as good runtimes as for the more difficult case of ∆2 ≤ nδ. Hence, throughout this section, we assume that ∆2 ≤ nδ. The goal of the algorithm for computing the H-partition is that each node (or, more formally, the machine storing the node) knows in which layer of the H-partition it is contained. The algorithm proceeds in iterations, where each iteration consists of two parts: first, the output, i.e., the layer index, is determined for a large fraction of the nodes, and second, these nodes are removed for the remainder of the computation. The latter ensures that the remaining small fraction of nodes can use essentially all of the total available memory in the next iteration, resulting in a larger memory budget per node. However, there is a caveat: When the memory budget per node exceeds Θ(nδ), i.e., the memory capacity of a single machine, then it is not sufficient anymore to merely argue that the used memory of all nodes together does not exceed the total memory of all machines together7. We circumvent this issue by starting the above process repeatedly from anew (in the remaining graph) each time the memory requirement per node reaches the memory capacity of a single machine. As we will see, the number of repetitions, called phases, is bounded by O(1/δ). 6Note that it is easy to learn the maximum degree, and hence d, in O(1) rounds of communications. 7Furthermore, in the "shuffle" step of every MPC round [KSV10], we assume that the nodes are stored in the machines in a balanced way, i.e., as long as a single node fits onto a single machine and the total memory is not exceeded, the underlying system takes care of load-balancing. 8 In the following, we examine the phases and iterations in more detail. Algorithm Details: Let k be the largest integer s.t. ∆2k+1 ≤ nδ (which implies that k ≥ 0). The algorithm consists of phases and each phase consists of k + 1 iterations. Next, we describe our implementation of the graph exponentiation in more detail. • In each iteration i = 0, 1, . . . , k, we do the following. – Let Gi = G(0) be the graph at the beginning of iteration i. Each node connects its current 1-hop neighborhood to a clique by adding virtual edges to Gi; if i = 0, omit this step. Perform 20 repetitions of the following process if i ≥ 1, and 60 repetitions if i = 0: i ∗ In repetition 0 ≤ j ≤ 19 (resp. 0 ≤ j ≤ 59), each node computes its layer index in the H-partition of G(j) (with parameter d) or determines that its layer index is strictly larger than 2i, upon which all nodes in layer at most 2i (and all its incident edges) are removed from the graph, resulting in a graph G(j+1) . i i Set Gi+1 = G(20) i (resp. Gi+1 = G(60) i if i = 0). At the end of the phase remove all added edges. The algorithm terminates when each node knows its layer. i i Note that each time a node is removed from the graph, the whole layer that contains this node is removed, and each time such a layer is removed, all layers with smaller index are removed at the same time or before. By the definition of the H-partition, if we remove the (cid:96) layers with smallest index from a graph, then there is a 1-to-1 correspondence between the layers of the resulting graph and the layers with layer index at least (cid:96) + 1 of the original graph. More specifically, layer (cid:96)(cid:48) of the resulting graph contains exactly the same nodes as layer (cid:96) + (cid:96)(cid:48) of the original graph. Hence, if a node knows its layer index in some G(j) , it can easily compute its layer index in our original input graph G, by keeping track of the number of deleted layers, which is uniquely defined by i, j and the number of the phase. We implicitly assume that each node performs this computation upon determining its layer index in some G(j) Implementation in the MPC Model: Let us take a look at one iteration. and in the following only consider how to determine the layer index in the current graph. Connecting the 1-hop neighborhoods to cliques is done by adding the edges that are missing. Edges that are added by multiple nodes are only added once (since the edge in question is stored by the machines that contain an endpoint of the edge, this is straightforward to realize). Note that during a phase, the 1-hop neighborhoods of the nodes grow in each iteration (if not too many close-by nodes are removed from the graph); more specifically, after i iterations of connecting 1-hop neighborhoods to cliques, the new 1-hop neighborhood of a node contains exactly the nodes that were contained in its 2i-hop neighborhood at the beginning of the phase (and were not removed so far). In iteration i, the layer of a node is computed as follows: First each node locally gathers the topology of its 2i-hop neighborhood (without any added edges).8 Since this step is performed after connecting the 2i−1-hop neighborhood of each node to a clique (by repeatedly connecting 1-hop neighborhoods to cliques), i.e., after connecting each node to any other node in its 2i-hop neighborhood, only 1 round of communication is required for gathering the topology. Moreover, since a node that knows the topology of its 2i-hop neighborhood can simulate any (2i − 1)-round distributed process locally, it follows from the definition of the H-partition, that knowledge of the topology of the 2i-hop neighborhood is sufficient for a node to determine whether its layer index is at most 2i and, if this is the case, in exactly which layer it is contained. Thus, the only tasks remaining are to bound the runtime of our algorithm and to show that the memory restrictions of our model are not violated by the algorithm. 8Note that it is easy to keep track of which edges are original and which are added, incurring only a small constant memory overhead; later we will also argue why storing the added edges does not violate our memory constraints. 9 Runtime: It is easy to see that every iteration takes O(1) rounds. Thus, in order to bound the runtime of our algorithm, it is sufficient to bound the number of iterations by O(1/δ · log log n). By Lemma 4.1 (ii) the number of layers in the H-partition of our original input graph G is O(logd/λ n), which is O(log∆ n) since d/(2λ) ≥ √ d = ∆1/20. Consider an arbitrary phase. According to the algorithm description, in iteration i ≥ 1, all nodes in the 20· 2i lowest layers are removed from the current graph. Hence, ignoring iteration 0, the number of removed layers doubles in each iteration, and we obtain that the number of layers removed in the k + 1 iterations of our phase is Ω(2k). By the definition of k, we have ∆2k+1+1 > nδ, which implies 2k > 1/3 · δ · log∆ n. Combining this inequality with the observations about the total number of layers and the number of layers removed per phase, we see that the algorithm terminates after O(1/δ) phases. Since there are k + 1 = O(log log n) iterations per phase, the bound on the number of iterations follows. Memory Footprint: As during the course of the algorithm edges are added and nodes collect the topology of certain neighborhoods, we have to show that adding these edges and collecting these neighborhoods does not violate our memory constraints of O(nδ) per machine. As a first step towards this end, the following lemma bounds the number of nodes contained in graph Gi. Lemma 4.2. Consider an arbitrary phase. Graph Gi from that phase contains at most n(cid:48)/(∆2i) nodes, for all i ≥ 1, where n(cid:48) = n/∆. Proof. By Lemma 4.1 (i), removing the nodes in the layer with smallest index from the current graph decreases the number of nodes by a factor of at least d/(2λ) ≥ d1/2 = ∆1/20. We show the lemma statement by induction. Since in iteration 0 the nodes in the 60 layers with smallest index are removed, we know that G1 contains at most n/(∆3) = n(cid:48)/(∆21) nodes. Now assume that Gi contains at most n(cid:48)/(∆2i) nodes, for an arbitrary i ≥ 1. According to the design of our algorithm, Gi+1 is obtained from Gi by removing the nodes in the 20 · 2i layers with smallest index. Combining this fact with our observation about the decrease in the number of nodes per removed layer, we obtain that Gi+1 contains at most n(cid:48)/(∆2i) · 1/(∆2i) = n(cid:48)/(∆2i+1) nodes. Using Lemma 4.2, we now show that the memory constraints of the low-memory MPC model are not violated by our algorithm. Consider an arbitrary phase and an arbitrary iteration i during that phase. If i = 0, then no edges are added and each node already knows the topology of its 2i-hop neighborhood, so no additional memory is required. Hence, assume that i ≥ 1. Due to Lemma 4.2, the number of nodes considered in iteration i is at most n(cid:48)/(∆2i), where, again, n(cid:48) = n/∆. After the initial step of connecting 1-hop neighborhoods to cliques in iteration i, each remaining node is connected to all nodes that were contained in its 2i-hop neighborhood in the original graph G (and were not removed so far). Hence, each remaining node is connected to at most O(∆2i) other nodes, resulting in a memory requirement of O(∆2i) per node, or O(n/∆) in total. Similarly, when collecting the topology of its 2i-hop neighborhood, each node has to store O(∆2i · ∆) edges, which requires at most O(∆2i · ∆) memory, resulting in a total memory requirement of O(n). Hence, the described algorithm does not exceed the total memory available in the low-memory MPC model. Moreover, due to the choice of k, the memory requirement of each single node does not exceed the memory capacity of a single machine. 10 4.2 Simulation of the Mark-and-Propose and Selection Phase For the simulation of the mark-and-propose and selection phase, we rely heavily on the approach of Section 4.1. Recall that nodes were removed in chunks consisting of several consecutive layers and that before a node v was removed, v was directly connected to all nodes contained in a large neighborhood around v by adding the respective edges. For the simulation, we go through these chunks in the reverse order in which they were removed. Note that in which chunk a node is contained is uniquely determined by the layer index of the node. As each node computes its layer index during the construction of the H-partition, each node can easily determine in which part of the simulation it will actively participate. However, there is a problem we need to address: For communication, we would like the edges that we added during the construction of the H-partition to be available also for the simulation. Unfortunately, during the course of the construction, we removed added edges again to free memory for the adding of other edges. Fortunately, there is a conceptually simple way to circumvent this problem: in the construction of the H-partition, add a pre-processing step in the beginning, in which we remove the lowest c·log(1/δ·log log n) layers (where c is a sufficiently large constant) one by one in log(1/δ·log log n) rounds, which increases the available memory (compared to the number of (remaining) nodes) by a factor of Ω(1/δ · log log n), by Lemma 4.1. Since the algorithm for constructing the H-partition consist of O(1/δ · log log n) iterations, this implies that we can store all edges that we add during the further course of the construction simultaneously without violating the memory restriction, by an argument similar to the analogous statement for the old construction of the H-partition. Similarly, also the number of added edges incident to one particular node does not exceed the memory capacity of a single machine. In the following, we assume that this pre-processing step took place and all edges added during the construction of the H-partition are also available for the simulation. Matching Algorithm: As mentioned above, we process the chunks one by one, in decreasing order w.r.t. the indices of the contained layers. After processing a chunk, we want each node contained in the chunk to know the output of all incident edges according to the centralized matching algorithm. In the following, we describe how to process a chunk, after some preliminary "global" steps. The mark-and-propose phase of the algorithm is straightworward to implement in the low-memory MPC model: each node (in each chunk at the same time) performs the marking of an outgoing edge as specified in the algorithm description.9 The proposing is performed for all nodes before going through the chunks sequentially: each node proposes one of its marked incoming edges (it there is at least one) uniformly at random. Note that proposes an edge does not necessarily indicate that this edge will be added to the matching; more specifically, an edge proposed by some node v will be added to the matching iff the edge that v marked is not selected to be added to the matching.10 After this mark-and-propose phase, the processing of the chunks begins. Consider an arbitrary chunk. Let i be the iteration (in some phase) in which this chunk was removed in the construction of the H-partition, i.e., the chunk consists of 2i layers. Each node in the chunk collects the topology of its 2i-hop neighborhood in the chunk including the information contained therein about proposed edges. Due to the edges added during the construction of the H-partition, this can be achieved in a constant number of rounds, and by an analogous argument to the one at the end of Section 4.1, collecting the indicated information does not violate the memory restrictions of our model. Lemma 4.3 shows that the information contained in the 2i-hop neighborhood of a node is sufficient for the node to determine the output for each incident edge in the centralized matching algorithm. 9Note that, formally, the algorithm for construction the H-partition only returns the layer index for each node; however, from this information each node can easily determine which edges are outgoing, unoriented, or incoming according to the partial orientation induced by the H-partition. 10In other words, only proposed edges can go into the matching and whether such an edge indeed goes into the matching can be determined by going through the layers in decreasing order and only adding a proposed edge if there is no conflict. 11 Lemma 4.3. The information about which edges are proposed in the 2i-hop neighborhood of a node v uniquely determines the output of all edges incident to v according to the centralized matching algorithm. Proof. From the design of the centralized matching algorithm, it follows that an edge is part of the matching iff 1) the edge is proposed and 2) either the higher-layer endpoint of the edge has no outgoing edges or the outgoing edge marked by the higher-layer endpoint is not part of the matching. Hence, in order to check whether an incident edge is in the matching, node v only has to consider the unique directed chain of proposed edges (in the chunk) starting in v. Clearly, the information which of the edges in this chain are proposed uniquely defines the output of the first edge in the chain, from which v can infer the output of all other incident edges. Since the number of edges in the chain is bounded by 2i − 1 as the chain is directed, the lemma statement follows. It thus follows from the bound on the number of iterations that the simulation of the selection phase for the matching algorithm can be performed in O(1/δ · log log n) rounds of communication. Independent Set Algorithm: The simulation of the independent set algorithm proceeds analogously to the case of the matching algorithm. First, each node performs the marking and proposing in a distributed fashion in a constant number of rounds. Then, the chunks are processed one by one, as above, where during the processing of a chunk removed in iteration i, each node contained in the chunk collects its 2i-hop neighborhood, including the information about which nodes are proposed, and then computes its own output locally. By analogous arguments to the ones presented in the case of the matching algorithm, the algorithm adheres to the memory constraints of our model and the total number of communication rounds is O(1/δ · log log n). The only part of the argumentation where a bit of care is required is the analogue of Lemma 4.3: In the case of the independent set algorithm the output of a node v may depend on each of its parents since each of those could be part of the independent set, which would prevent v from joining the independent set. However, all nodes in the chunk that can be reached from v via a directed chain of edges are contained in v's 2i-hop neighborhood; therefore, collecting the own 2i-hop neighborhood is sufficient for determining one's output. Note that at the end of processing a chunk, if we follow the above implementation, we have to spend an extra round for removing the neighbors of all selected independent set nodes since these may be contained in another chunk. References [ABB+17] Sepehr Assadi, MohammadHossein Bateni, Aaron Bernstein, Vahab Mirrokni, and Cliff Stein. Coresets Meet EDCS: Algorithms for Matching and Vertex Cover on Massive Graphs. arXiv preprint: 1711.03076, 2017. [ABI86] [AK17] Noga Alon, László Babai, and Alon Itai. A Fast and Simple Randomized Parallel Algorithm for the Maximal Independent Set Problem. Journal of Algorithms, 7(4):567–583, 1986. Sepehr Assadi and Sanjeev Khanna. Randomized Composable Coresets for Matching and Vertex Cover. In the Proceedings of the Symposium on Parallel Algorithms and Architectures (SPAA), pages 3–12, 2017. [ANOY14] Alexandr Andoni, Aleksandar Nikolov, Krzysztof Onak, and Grigory Yaroslavtsev. Parallel algorithms for geometric graph problems. In Proceedings of the Symposium on Theory of Computing (STOC), pages 574–583, 2014. [ASS+18] Alexandr Andoni, Clifford Stein, Zhao Song, Zhengyu Wang, and Peilin Zhong. Parallel Graph Connectivity in Log Diameter Rounds. arXiv preprint arxiv:1805.03055, 2018. 12 [BDHK18] Soheil Behnezhad, Mahsa Derakhshan, MohammadTaghi Hajiaghayi, and Richard M. Karp. Massively Parallel Symmetry Breaking on Sparse Graphs: MIS and Maximal Match- ing. arXiv preprint arXiv:1807.06701, 2018. [BE10] Leonid Barenboim and Michael Elkin. Sublogarithmic Distributed MIS Algorithm for Sparse Graphs Using Nash-Williams Decomposition. Distributed Computing, 22(5-6):363– 379, 2010. [BEPS12] Leonid Barenboim, Michael Elkin, Seth Pettie, and Johannes Schneider. The Locality of Distributed Symmetry Breaking. In the Proceedings of the Symposium on Foundations of Computer Science (FOCS), pages 321–330. IEEE, 2012. [BFU18] [BKS14] [BKS17] Sebastian Brandt, Manuela Fischer, and Jara Uitto. Breaking the Linear-Memory Barrier in MPC: Fast MIS on Trees with nε Memory per Machine. arXiv preprint arXiv:1802.06748, 2018. Paul Beame, Paraschos Koutris, and Dan Suciu. Skew in Parallel Query Processing. pages 212–223, 2014. Paul Beame, Paraschos Koutris, and Dan Suciu. Communication Steps for Parallel Query Processing. Journal of the ACM (JACM), 64(6):40, 2017. [CŁM+18] Artur Czumaj, Jakub Łącki, Aleksander Mądry, Slobodan Mitrović, Krzysztof Onak, and Piotr Sankowski. Round Compression for Parallel Matching Algorithms. In Proceedings of the Symposium on Theory of Computing (STOC), pages 471–484, 2018. [DG08] [GG06] Jeffrey Dean and Sanjay Ghemawat. MapReduce: Simplified Data Processing on Large Clusters. Communications of the ACM, 51(1):107–113, 2008. Gaurav Goel and Jens Gustedt. Bounded Arboricity to Determine the Local Structure of Sparse Graphs. In International Workshop on Graph-Theoretic Concepts in Computer Science, pages 159–167. Springer, 2006. [GGK+18] Mohsen Ghaffari, Themis Gouleakis, Christian Konrad, Slobodan Mitrović, and Ronitt Rubinfeld. Improved Massively Parallel Computation Algorithms for MIS, Matching, and Vertex Cover. In Proceedings of the International Symposium on Principles of Distributed Computing (PODC), page to appear, 2018. [Gha16] Mohsen Ghaffari. An Improved Distributed Algorithm for Maximal Independent Set. In the Proceedings of ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 270–277, 2016. [GSZ11] Michael T. Goodrich, Nodari Sitchinava, and Qin Zhang. Sorting, Searching, and Simula- tion in the MapReduce Framework. pages 374–383, 2011. [GU18] Mohsen Ghaffari and Jara Uitto. Sparsifying Distributed Algorithms with Ramifications in Massively Parallel Computation and Centralized Local Computation. Personal commu- nication, 2018. [IBY+07] Michael Isard, Mihai Budiu, Yuan Yu, Andrew Birrell, and Dennis Fetterly. Dryad: Dis- tributed Data-Parallel Programs from Sequential Building Blocks. volume 41, pages 59–72, 2007. 13 [KSV10] Howard Karloff, Siddharth Suri, and Sergei Vassilvitskii. A Model of Computation for MapReduce. In the Proceedings of ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 938–948, 2010. [KSV13] Amos Korman, Jean-Sébastien Sereni, and Laurent Viennot. Toward More Localized Local Algorithms: Removing Assumptions Concerning Global Knowledge. Distributed Comput- ing, 26(5-6):289–308, 2013. [Lin92] Nathan Linial. Locality in Distributed Graph Algorithms. SIAM Journal on Computing, 21(1):193–201, 1992. [LMSV11] Silvio Lattanzi, Benjamin Moseley, Siddharth Suri, and Sergei Vassilvitskii. Filtering: a Method for Solving Graph Problems in MapReduce. In the Proceedings of the Symposium on Parallel Algorithms and Architectures (SPAA), pages 85–94, 2011. [LPSR09] Zvi Lotker, Boaz Patt-Shamir, and Adi Rosén. Distributed Approximate Matching. SIAM Journal on Computing, 39(2):445–460, 2009. [Lub85] Michael Luby. A Simple Parallel Algorithm for the Maximal Independent Set Problem. In Proceedings of the Symposium on Theory of Computing (STOC), pages 1–10, 1985. [LW10] Christoph Lenzen and Roger Wattenhofer. Brief Announcement: Exponential Speed-Up of Local Algorithms Using Non-Local Communication. In Proceedings of the International Symposium on Principles of Distributed Computing (PODC), pages 295–296, 2010. [McG05] Andrew McGregor. Finding Graph Matchings in Data Streams. In Approximation, Ran- domization and Combinatorial Optimization. Algorithms and Techniques, pages 170–181. Springer, 2005. [NW61] [NW64] Crispin St. J. Nash-Williams. Edge-Disjoint Spanning Trees of Finite Graphs. Journal of the London Mathematical Society, 1(1):445–450, 1961. Crispin St. J. Nash-Williams. Decomposition of Finite Graphs into Forests. Journal of the London Mathematical Society, 1(1):12–12, 1964. [OSSW18] Krzysztof Onak, Baruch Schieber, Shay Solomon, and Nicole Wein. Fully Dynamic MIS in Uniformly Sparse Graphs. In the Proceedings of the International Colloquium on Automata, Languages and Programming (ICALP), pages 92:1–92:14, 2018. [Pem01] Sriram V. Pemmaraju. Equitable Coloring Extends Chernoff-Hoeffding Bounds. In Ap- proximation, Randomization, and Combinatorial Optimization: Algorithms and Techniques, pages 285–296. Springer, 2001. [Whi12] Tom White. Hadoop: The Definitive Guide. 2012. [ZCF+10] Matei Zaharia, Mosharaf Chowdhury, Michael J. Franklin, Scott Shenker, and Ion Stoica. Spark: Cluster Computing with Working Sets. HotCloud, 10:95, 2010. 14
1901.03689
1
1901
2019-01-11T18:50:21
Depth First Search in the Semi-streaming Model
[ "cs.DS" ]
Depth first search (DFS) tree is a fundamental data structure for solving various graph problems. The classical DFS algorithm requires $O(m+n)$ time for a graph having $n$ vertices and $m$ edges. In the streaming model, an algorithm is allowed several passes (preferably single) over the input graph having a restriction on the size of local space used. Trivially, a DFS tree can be computed using a single pass using $O(m)$ space. In the semi-streaming model allowing $O(n)$ space, it can be computed in $O(n)$ passes, where each pass adds one vertex to the DFS tree. However, it remains an open problem to compute a DFS tree using $o(n)$ passes using $o(m)$ space even in any relaxed streaming environment. We present the first semi-streaming algorithms that compute a DFS tree of an undirected graph in $o(n)$ passes using $o(m)$ space. We first describe an extremely simple algorithm that requires at most $\lceil n/k\rceil$ passes using $O(nk)$ space, where $k$ is any positive integer. We then improve this algorithm by using more involved techniques to reduce the number of passes to $\lceil h/k\rceil$ under similar space constraints, where $h$ is the height of the computed DFS tree. In particular, this algorithm improves the bounds for the case where the computed DFS tree is shallow (having $o(n)$ height). Moreover, this algorithm is presented as a framework that allows the flexibility of using any algorithm to maintain a DFS tree of a stored sparser subgraph as a black box, which may be of independent interest. Both these algorithms essentially demonstrate the existence of a trade-off between the space and number of passes required for computing a DFS tree. Furthermore, we evaluate these algorithms experimentally which reveals their exceptional performance in practice. For both random and real graphs, they require merely a few passes even when allowed just $O(n)$ space.
cs.DS
cs
Depth First Search in the Semi-streaming Model Shahbaz Khan∗ Shashank K. Mehta Faculty of Computer Science University of Vienna, Austria [email protected] Dept. of Computer Science and Engineering Indian Institute of Technology Kanpur, India [email protected] Abstract Depth first search (DFS) tree is a fundamental data structure for solving various graph problems. The classical algorithm for building a DFS tree requires O(m + n) time for a given undirected graph G having n vertices and m edges. In the streaming model, an algorithm is allowed several passes (preferably single) over the input graph having a restriction on the size of local space used. Now, a DFS tree of a graph can be trivially computed using a single pass if O(m) space is allowed. In the semi-streaming model allowing O(n) space, it can be computed in O(n) passes over the input stream, where each pass adds one vertex to the DFS tree. However, it remains an open problem to compute a DFS tree using o(n) passes using o(m) space even in any relaxed streaming environment. √ √ n, we can compute a DFS tree in We present the first semi-streaming algorithms that compute a DFS tree of an undirected graph in o(n) passes using o(m) space. We first describe an extremely simple algorithm that requires at most (cid:100)n/k(cid:101) passes to compute a DFS tree using O(nk) space, where k is any positive integer. For example √ using k = n) space. We then improve this n passes using O(n algorithm by using more involved techniques to reduce the number of passes to (cid:100)h/k(cid:101) under similar space constraints, where h is the height of the computed DFS tree. In particular, this algorithm improves the bounds for the case where the computed DFS tree is shallow (having o(n) height). Moreover, this algo- rithm is presented in form of a framework that allows the flexibility of using any algorithm to maintain a DFS tree of a stored sparser subgraph as a black box, which may be of an independent interest. Both these algorithms essentially demonstrate the existence of a trade-off between the space and number of passes required for computing a DFS tree. Furthermore, we evaluate these algorithms experimentally which reveals their exceptional performance in practice. For both random and real graphs, they require merely a few passes even when allowed just O(n) space. Keywords: Depth First Search, DFS, Semi-Streaming, Streaming, Algorithm. ∗This research work was supported by the European Research Council under the European Union's Seventh Framework Programme (FP/2007-2013) / ERC Grant Agreement no. 340506. 1 1 Introduction Depth first search (DFS) is a well known graph traversal technique. Right from the seminal work of Tar- jan [51], DFS traversal has played an important role in the design of efficient algorithms for many fundamental graph problems, namely, bi-connected components, strongly connected components, topological sorting [54], dominators in directed graph [52], etc. Even in undirected graphs, DFS traversal have various applications including computing connected components, cycle detection, edge and vertex connectivity [22] (via articu- lation points and bridges), bipartite matching [35], planarity testing [36] etc. In this paper, we address the problem of computing a DFS tree in the semi-streaming environment. The streaming model [3, 26, 31] is a popular model for computation on large data sets wherein a lot of algorithms have been developed [28, 34, 31, 37] to address significant problems in this model. The model requires the entire input data to be accessed as a stream, typically in a single pass over the input, allowing very small amount of storage (poly log in input size). A streaming algorithm must judiciously choose the data to be saved in the small space, so that the computation can be completed successfully. In the context of graph problems, this model is adopted in the following fashion. For a given graph G = (V, E) having n vertices, an input stream sends the graph edges in E using an arbitrary order only once, and the allowed size of local storage is O(poly log n). The algorithm iteratively asks for the next edge and performs some computation. After the stream is over, the final computation is performed and the result is reported. At no time during the entire process should the total size of stored data exceed O(poly log n). In general only statistical properties of the graph are computable under this model, making it impractical for use in more complicated graph problems [24, 32]. A prominent exception for the above claim is the problem of counting triangles (3-cycles) in a graph [6]. Consequently, several relaxed models have been proposed with a goal to solve more complex graph problems. One such model is called semi-streaming model [48, 25] which relaxes the storage size to O(n poly log n). Several significant problems have been studied under this model (surveys in [49, 59, 47]). Moreover, even though it is preferred to allow only a single pass over the input stream, several hardness results [34, 16, 25, 14, 33] have reported the limitations of using a single pass (or even O(1) passes). This has led to the development of various multi-pass algorithms [25, 24, 46, 2, 39, 38] in this model. Further, several streaming algorithms maintaining approximate distances [24, 7, 19] are also known to require O(n1+) space (for some constant  > 0) relaxing the requirement of O(n poly log n) space. Now, a DFS tree of a graph can be computed in a single pass if O(m) space is allowed. If the space is restricted to O(n), it can be trivially computed using O(n) passes over the input stream, where each pass adds one vertex to the tree. This can also be easily improved to O(h) passes, where h is the height of the computed DFS tree. Despite most applications of DFS trees in undirected graphs being efficiently solved in the semi-streaming environment [56, 25, 24, 4, 5, 23, 41], due to its fundamental nature DFS is considered a long standing open problem [23, 49, 50] even for undirected graphs. Moreover, computing a DFS tree in O(poly log n) passes is considered hard [23]. To the best of our knowledge, it remains an open problem to compute a DFS tree using o(n) passes even in any relaxed streaming environment. In our results, we borrow some key ideas from recent sequential algorithms [10, 8] for maintaining dynamic DFS of undirected graphs. Recently, similar ideas were also used by Khan [40] who presented a semi- streaming algorithm that uses using O(n) space for maintaining dynamic DFS of an undirected graph, requiring O(log2 n) passes per update. 1.1 Our Results We present the first semi-streaming algorithms to compute a DFS tree on an undirected graph in o(n) passes. Our first result can be described using the following theorem. Theorem 1.1. Given an undirected graph G = (V, E), the DFS tree of the graph can be computed by a semi-streaming algorithm in at most n/k passes using O(nk) space, requiring O(mα(m, n)) time per pass. As described earlier, a simple algorithm can compute the DFS tree in O(h) passes, where h is the height of the DFS tree. Thus, for the graphs having a DFS tree with height h = o(n) (see Appendix B for details), we improve our result for such graphs in the following theorem. Theorem 1.2. Given an undirected graph G, a DFS tree of G can be computed by a semi-streaming algorithm using (cid:100)h/k(cid:101) passes using O(nk) space requiring amortized O(m + nk) time per pass for any integer k ≤ h, 2 where h is the height of the computed DFS tree.1 Since typically the space allowed in the semi-streaming model is O(n poly log n), the improvement in upper bounds of the problem by our results is considerably small (upto poly log n factors). Recently, Elkin [20] presented the first o(n) pass algorithm for computing Shortest Paths Trees. Using O(nk) local space, it computes the shortest path tree from a given source in O(n/k) passes for unweighted graphs, and in O(n log n/k) passes for weighted graphs. The significance of such results, despite improving the upper bounds by only small factors, is substantial because they address fundamental problems. The lack of any progress for such fundamental problems despite several decades of research on streaming algorithms further highlights the significance of such results. Moreover, allowing O(n1+) space (as in [24, 7, 19]) such results improves the upper bound significantly by O(n) factors. Furthermore, they demonstrate the existence of a trade-off between the space and number of passes required for computing such fundamental structures. Our final algorithm is presented in form of a framework, which can use any algorithm for maintaining a DFS tree of a stored sparser subgraph, provided that it satisfies the property of monotonic fall. Such a framework allows more flexibility and is hopefully much easier to extend to better algorithms for computing a DFS tree or other problems requiring a computation of DFS tree. Hence we believe our framework would be of independent interest. We also augment our theoretical analysis with the experimental evaluation of our proposed algorithms. For both random and real graphs, the algorithms require merely a few passes even when the allowed space is just O(n). The exceptional performance and surprising observations of our experiments on random graphs might also be of independent interest. 1.2 Overview We now briefly describe the outline of our paper. In Section 2 we establish the terminology and notations used in the remainder of the paper. In order to present the main ideas behind our approach in a simple and comprehensible manner, we present the algorithm in four stages. Firstly in Section 3, we describe the basic algorithm to build a DFS tree in n passes, which adds a new vertex to the DFS tree in every pass over the input stream. Secondly in Section 3.1, we improve this algorithm to compute a DFS tree in h passes, where h is the height of the final DFS tree. This algorithm essentially computes all the vertices in the next level of the currently built DFS tree simultaneously, building the DFS tree by one level in each pass over the input stream. Thus, in the ith pass every vertex on the ith level of the DFS tree is computed. Thirdly in Section 4, we describe an advanced algorithm which uses O(nk) space to add a path of length at least k to the DFS tree in every pass over the input stream. Thus, the complete DFS tree can be computed in (cid:100)n/k(cid:101) passes. Finally, in Section 5, we improve the algorithm to simultaneously add all the subtrees constituting the next k levels of the final DFS tree starting from the leaves of the current tree T . Thus, k levels are added to the DFS tree in each pass over the input stream, computing the DFS tree in (cid:100)h/k(cid:101) passes. As described earlier, our final algorithm is presented in form of a framework which uses as a black box, any algorithm to maintain a DFS tree of a stored sparser subgraph, satisfying certain properties. In the interest of completeness, one such algorithm is described in the Appendix C. Lastly in Section 6, we present the results of the experimental evaluation of these algorithms. The details of this evaluation are deferred to Appendix D. In our advanced algorithms, we employ two interesting properties of a DFS tree, namely, the components property [8] and the min-height property. These simple properties of any DFS tree prove crucial in building the DFS efficiently in the streaming environment. 2 Preliminaries Let G = (V, E) be an undirected connected graph having n vertices and m edges. The DFS traversal of G starting from any vertex r ∈ V produces a spanning tree rooted at r called a DFS tree, in O(m + n) time. For any rooted spanning tree of G, a non-tree edge of the graph is called a back edge if one of its endpoints is an ancestor of the other in the tree, else it is called a cross edge. A necessary and sufficient condition for any rooted spanning tree to be a DFS tree is that every non-tree edge is a back edge. 1 Note that there can be many DFS trees of a graph having varying heights, say hmin to hmax. Our algorithm does not guarantee the computation of DFS tree having minimum height hmin, rather it simply computes a valid DFS tree with height h, where hmin ≤ h ≤ hmax. 3 In order to handle disconnected graphs, we add a dummy vertex r to the graph and connect it to all vertices. Our algorithm computes a DFS tree rooted at r in this augmented graph, where each child subtree of r is a DFS tree of a connected component in the DFS forest of the original graph. The following notations will be used throughout the paper. • T : The DFS tree of G incrementally computed by our algorithm. • par(w) : Parent of w in T . • T (x) : The subtree of T rooted at vertex x. • root(T (cid:48)) : Root of a subtree T (cid:48) of T , i.e., root(cid:0)T (x)(cid:1) = x. • level(v) : Level of vertex v in T , where level(root(T )) = 0 and level(v) = level(par(v)) + 1. In this paper we will discuss algorithms to compute a DFS tree T for the input graph G in the semi- streaming model. In all the cases T will be built iteratively starting from an empty tree. At any time during the algorithm, we shall refer to the vertices that are not a part of the DFS tree T as unvisited and denote them by V (cid:48), i.e., V (cid:48) = V \ T . Similarly, we refer to the subgraph induced by the unvisited vertices, G(cid:48) = G(V (cid:48)), as the unvisited graph. Unless stated otherwise, we shall refer to a connected component of the unvisited graph G(cid:48) as simply a component. For any component C, the set of edges and vertices in the component will be denoted by EC and VC. Further, each component C maintains a spanning tree of the component that shall be referred as TC. We refer to a path p in a DFS tree T as an ancestor-descendant path if one of its endpoints is an ancestor of the other in T . Since the DFS tree grows downwards from the root, a vertex u is said to be higher than vertex v if level(u) < level(v). Similarly, among two edges incident on an ancestor-descendant path p, an edge (x, y) is higher than edge (u, v) if y, v ∈ p and level(y) < level(v). We shall now describe two invariants such that any algorithm computing DFS tree incrementally satis- fying these invariants at every stage of the algorithm, ensures the absence of cross edges in T and hence the correctness of the final DFS tree T . Invariants: I1 : All non-tree edges among vertices in T are back edges, and I2 : For any component C of the unvisited graph, all the edges from C to the partially built DFS tree T are incident on a single ancestor-descendant path of T . We shall also use the components property by Baswana et al. [8], described as follows. Figure 1: Edges e(cid:48)1 and e(cid:48)2 can be ignored during the DFS traversal (reproduced from [8]). Lemma 2.1 (Components Property [8]). Consider a partially completed DFS traversal where T is the partially built DFS tree. Let the connected components of G(cid:48) be C1, .., Ck. Consider any two edges ei and e(cid:48)i from Ci that are incident respectively on a vertex xi and some ancestor (not necessarily proper) w of xi in T . Then it is sufficient to consider only ei during the DFS traversal, i.e., the edge e(cid:48)i can be safely ignored. Ignoring e(cid:48)i during the DFS traversal, as stated in the components property, is justified because e(cid:48)i will appear as a back edge in the resulting DFS tree (refer to Figure 1). For each component Ci, the edge ei can be found using a single pass over all the graph edges. 4 rwx1x2C1C2e1e01e2e02 3 Simple Algorithms We shall first briefly describe the trivial algorithm to compute a DFS tree of a (directed) graph using n passes. Since we are limited to have only O(n poly log n) space, we cannot store the adjacency list of the vertices in the graph. Recall that in the standard DFS algorithm [51], after visiting a vertex v, we choose any unvisited neighbour of v and visit it. If no neighbour of v is unvisited, the traversal retreats back to the parent of v and look for its unvisited neighbour, and so on. In the streaming model, we can use the same algorithm. However, we do not store the adjacency list of a vertex. To find the unvisited neighbour of each vertex, we perform a complete pass over the edges in E. The algorithm only stores the partially built DFS tree and the status of each vertex (whether it is visited/added to T ). Thus, for each vertex v (except r) one pass is performed to add v to T and another is performed before retreating to the parent of v. Hence, it takes 2(n − 1) passes to complete the algorithm since T is initialized with the root r. Since, this procedure essentially simulates the standard DFS algorithm [51], it clearly satisfies the invariants I1 and I2. This procedure can be easily transformed to require only n − 1 passes by avoiding an extra pass for retreating from each vertex v. In each pass we find an edge e (from the stream) from the unvisited vertices, V (cid:48), to the lowest vertex on the ancestor-descendant path connecting r and v, i.e., closest to v. Hence e would be an edge from the lowest (maximum level) ancestor of v (not necessarily proper) having at least one unvisited neighbour. Recall that if v does not have an unvisited neighbour we move to processing its parent, and so on until we find an ancestor having an unvisited neighbour. We can thus directly add the edge e to T . Hence, retreating from a vertex would not require an additional pass and the overall procedure can be completed in n − 1 passes, each pass adding a new vertex to T . Moreover, this also requires O(1) processing time per edge and extra O(n) time at the end of the pass, to find the relevant ancestor. Refer to Procedure Compute-DFS in Appendix E for the pseudocode of the procedure. Thus, we get the following result. Theorem 3.1. Given a directed/undirected graph G, a DFS tree of G can be computed by a semi-streaming algorithm in n passes using O(n) space, using O(m) time per pass. 3.1 Improved algorithm We shall now describe how this simple algorithm can be improved to compute a DFS tree of an undirected graph in h passes, where h is the height of the computed DFS tree. The main idea behind this approach is that each component of the unvisited graph G(cid:48) will constitute a separate subtree of the final DFS tree. Hence each such subtree can be computed independent of each other in parallel (this idea was also used by [40]). Using one pass over edges in E, the components of the unvisited graph G(cid:48) can be found by using Union- Find algorithm [53, 55] on the edges E(cid:48) of G(cid:48). Now, using the components property we know that it is sufficient to add the lowest edge from each component to the DFS tree T . At the end of the pass, for each component C we find the edge (xC, yC) incident from the lowest vertex xC ∈ T to some vertex yC ∈ VC and add it to T . Note that in the next pass, for each component of C \ {yC} the lowest edge connecting it to T would necessarily be incident on yC as C was connected. Hence, instead of lowest edge incident on T , we store ey from y ∈ V (cid:48) only if ey is incident on some leaf of T . Refer to Procedure Compute-DFS-Improved in Appendix E for the pseudocode of the algorithm. To prove the correctness of the algorithm, we shall prove using induction that the invariants I1 and I2 hold over the passes performed on E. Since T is initialized as an isolated vertex r, both invariants trivially hold. Now, let the invariants hold at the beginning of a pass. Using I2, each component C can have edges to a single ancestor-descendant path from r to xC. Thus, adding the edge (xC, yC) for each component C, would not violate I1 at the end of the pass, given that I1 holds at the beginning of the pass. Additionally, from each component C we add a single vertex yC as a child of xC to T . Hence for any component of C \ {yC}, the edges to T can only be to ancestors of yC (using I2 of previous pass), and an edge necessarily to yC, satisfying I2 at the end of the pass. Hence, using induction both I1 and I2 are satisfied proving the correctness of our algorithm. Further, since each component C in any ith pass necessarily has an edge to a leaf xC of T , the new vertex yC is added to the ith level of T . This also implies that every vertex at ith level of the final DFS tree is added during the ith pass. Hence, after h passes we get a DFS tree of the whole graph as h is the height of the 5 computed DFS tree. Now, the total time2 required to compute the connected components is O(mα(m, n)). And computing an edge from each unvisited vertex to a leaf in T requires O(1) time using O(n) space. Thus, we have the following theorem. Theorem 3.2. Given an undirected graph G, a DFS tree of G can be computed by a semi-streaming algorithm in h passes using O(n) space, where h is the height of the computed DFS tree, using O(mα(m, n)) time per pass. 4 Computing DFS in sublinear number of passes Since a DFS tree may have O(n) height, we cannot hope to compute a DFS tree in sublinear number of passes using the previously described simple algorithms. The main difference between the advanced approaches and the simple algorithms is that, in each pass instead of adding a single vertex (say y) to the DFS tree, we shall be adding an entire path (starting from y) to the DFS tree. The DFS traversal gives the flexibility to chose the next vertex to be visited as long as the DFS property is satisfied, i.e., invariants I1 and I2 are maintained. Hence in each pass we do the following for every component C in G(cid:48). Instead of finding a single edge (xC, yC) (see Section 3.1), we find a path P starting from yC in C and attach this entire path P to T (instead of only yC). Suppose this splits the component C into components C1, C2, . . . of C \ P . Now, each Ci would have an edge to at least one vertex on P (instead of necessarily the leaf xC in Section 3.1) since C was a connected component. Hence in this algorithm for each Ci, we find the vertex yi which is the lowest vertex of T (or P ) to which an edge from Ci is incident. Observe that yi is unique since all the neighbours of Ci in T are along one path from the root to a leaf. Using the components property, the selection of yi as the parent of the root of the subtree to be computed for Ci ensures that invariant I2 continues to hold. Thus, in each pass from every component of the unvisited graph, we shall extract a path and add it to the DFS tree T . This approach thus allows T to grow by more than one vertex in each pass which is essential for completing the tree in o(n) passes. If in each pass we add a path of length at least k from each component of G(cid:48), then the tree will grow by at least k vertices in each pass, requiring overall (cid:100)n/k(cid:101) passes to completely build the DFS tree. We shall now present an important property of any DFS tree of an undirected graph, which ensures that in each pass we can find a path of length at least k ≥ m/n (refer to Appendix A for proof). Lemma 4.1 (Min-Height Property). Given a connected undirected graph G having m edges, any DFS tree of G from any root vertex necessarily has a height h ≥ m/n. 4.1 Algorithm We shall now describe our algorithm to compute a DFS tree of the input graph in o(n) passes. Let the maximum space allowed for computation in the semi-streaming model be O(nk). The algorithm is a recursive procedure that computes a DFS tree of a component C from a root rC. For each component C we maintain a spanning tree TC of C. Initially we can perform a single pass over E to compute a spanning tree of the connected graph G (recall the assumption in Section 2) using the Union-Find algorithm. For the remaining components, its spanning tree would already have been computed and passed as an input to the algorithm. We initiate a pass over the edge in E and store the first VC · k edges (if possible) from the component C in the memory as the subgraph E(cid:48)C. Before proceeding with the remaining stream, we use any algorithm for computing a DFS tree T (cid:48)C rooted at rC in the subgraph containing edges from TC and E(cid:48)C. Note that adding TC to E(cid:48)C is important to ensure that subgraph induced by TC ∪ E(cid:48)C is connected. In case the pass was completed before E(cid:48)C exceeded storing VC · k edges, T (cid:48)C is indeed a DFS tree of C and we directly add it to T . Otherwise, we find the longest path P from T (cid:48)C starting from rC, i.e., path from rC to the farthest leaf. The path P is then added to T . Now, we need to compute the connected components of C\P and the new corresponding root for each such component. We use the Union-Find algorithm to compute these components, say C1, ..., Cf , and compute the lowest edge ei from each Ci on the path P . Clearly, there exist such an edge as C was connected. In order to find these components and edges, we need to consider all the edges in EC, which can be done by 2 The Union-Find algorithm [53, 55] requires O(mα(m, n)) time, where α(m, n) is the inverse Ackermann function 6 first considering E(cid:48)C and then each edge from C in the remainder of input stream of the pass. Refer to Procedure Compute-DFS-Fast in Appendix E for the pseudocode of the algorithm. Using the components property, choosing the new root yi corresponding to the lowest edge ei ensures that the invariant I2 and hence I1 is satisfied. Now, in case EC < VC · k, the entire DFS tree of C is constructed and added to T in a single pass. Otherwise, in each pass we add the longest path P from T (cid:48)C to the final DFS tree T . Since E(cid:48)C = VC · k and E(cid:48)C ∪ TC is a single connected component, the min-height property ensures that the height of any such T (cid:48)C (and hence P ) is at least k. Since in each pass, except the last, we add at least k new vertices to T , this algorithm terminates in at most (cid:100)n/k(cid:101) passes. Now, the total time required to find the components of the unvisited graph is again O(mα(m, n)). The remaining operations clearly require O(EC) time for a component C, requiring overall O(m) time. Thus, we get the following theorem. Theorem 1.1. Given an undirected graph G, a DFS tree of G can be computed by a semi-streaming algorithm in at most (cid:100)n/k(cid:101) passes using O(nk) space, requiring O(mα(m, n)) time per pass. Remark 4.1. Since, Procedure Compute-DFS-Fast adds an ancestor-descendant path for each component of G(cid:48), it might seem that the analysis of the algorithm is not tight for computing DFS trees with o(n) height. However, there exist a sequence of input edges where Procedure Compute-DFS-Fast indeed takes Θ(n/k) passes for computing a DFS tree with height o(n) (see Appendix B). 5 Final algorithm We shall now further improve the algorithm so that the required number of passes reduces to (cid:100)h/k(cid:101) while it continues to use O(nk) space, where h is the height of the computed DFS tree and k is any positive integer. To understand the main intuition behind our approach, let us recall the previously described algorithms. We first described a simple algorithm (in Section 3) in which every pass over the input stream adds one new vertex as the child of some leaf of T , which was improved (in Section 3.1) to simultaneously adding all vertices which are children of the leaves of T in the final DFS tree. We then presented another algorithm (in Section 4) in which every pass over the input stream adds one ancestor-descendant path of length k or more, from each component of G(cid:48) to T . We shall now improve it by adding all the subtrees constituting the next k levels of the final DFS tree starting from the leaves of the current tree T (or fewer than k levels if the corresponding component of G(cid:48) is exhausted). Now, consider any component C of G(cid:48). Let rC ∈ C be a vertex having an edge e to a leaf of the partially built DFS tree T . The computation of T can be completed by computing a DFS tree of C from the root rC, which can be directly attached to T using e. However, computing the entire DFS tree of C may not be possible in a single pass over the input stream, due to the limited storage space available. Thus, using O(n · k) space we compute a special spanning tree TC for each component C of G(cid:48) in parallel, such that the top k levels of TC is same as the top k levels of some DFS tree of C. As a result, in the ith pass all vertices on the levels (i − 1) · k + 1 to i · k of the final DFS tree are added to T . This essentially adds a tree T (cid:48)C representing the top k levels of TC for each component C of G(cid:48). This ensures that our algorithm will terminate in (cid:100)h/k(cid:101) passes, where h is the height of the final DFS tree. Further, this special tree TC also ensures an additional property, i.e., there is a one to one correspondence between the set of trees of TC \ T (cid:48)C and the components of C \ T (cid:48)C. In fact, each tree of TC \ T (cid:48)C is a spanning tree of the corresponding component. This property directly provides the spanning trees of the components of G(cid:48) in the next pass. Special spanning tree TC We shall now describe the properties of this special tree TC (and hence T (cid:48)C) which is computed in a single pass over the input stream. For T (cid:48)C to be added to the DFS tree T of the graph, a necessary and sufficient condition is that T (cid:48)C satisfies the invariants I1 and I2 at the end of the pass. To achieve this we maintain TC to be a spanning tree of C, such that these invariants are maintained by the corresponding T (cid:48)C throughout the pass as the edges are processed. Let SC be the set of edges already visited during the current pass, which have both endpoints in C. In order to satisfy I1, no edge in SC should be a cross edge in T (cid:48)C, i.e., no edge having both endpoints in the top k levels of TC is a cross edge. In order to satisfy I2, no edge in SC from any component C(cid:48) ∈ C \ T (cid:48)C to C \ C(cid:48) should be a cross edge in TC. Hence, using the additional property of TC, each edge from a tree τ in TC \ T (cid:48)C to TC \ τ is necessarily a back edge. This is captured 7 by the two conditions of invariant IT given below. Hence IT should hold after processing each edge in the pass. Observe that any spanning tree, TC, trivially satisfies IT at the beginning of the pass as SC = ∅. Invariant IT : TC is a spanning tree of C with the top k levels being T (cid:48)C such that: IT1 : All non-tree edges of SC having both endpoints in T (cid:48)C, are back edges. IT2 : For each tree τ in TC \ T (cid:48)C, all the edges of SC from τ to TC \ τ are back edges. Thus, IT is the local invariant maintained by TC during the pass, so that the global invariants I1 and I2 are maintained throughout the algorithm. Now, in order to compute TC (and hence T (cid:48)C) satisfying the above invariant, we store a subset of SC along with TC. Let HC denote the (spanning) subgraph of G formed by TC along with these additional edges. Note that all the edges of SC cannot be stored in HC due to space limitation of O(nk). Since each pass starts with the spanning tree TC of C and SC = ∅, initially HC = TC. As the successive edges of the stream are processed, HC is updated if the input edge belongs to the component C. We now formally describe HC and its properties. Spanning subgraph HC As described earlier, at the beginning of a pass for every component C of G(cid:48), HC = TC. Now, the role of HC is to facilitate the maintenance of the invariant IT . In order to satisfy IT1 and IT2, we store in HC all the edges in SC that are incident on at least one vertex of T (cid:48)C. Therefore, HC is the spanning tree TC along with every edge in SC which has at least one endpoint in T (cid:48)C. Thus, HC satisfies the following invariant throughout the algorithm. Invariant IH : HC comprises of TC and all edges from SC that are incident on at least one vertex of T (cid:48)C. We shall now describe a few properties of HC and then in the following section show that maintaining IH for HC is indeed sufficient to maintain the invariant IT as the stream is processed. The following properties of HC are crucial to establish the correctness of our procedure to maintain TC and HC and establish a bound on total space required by HC (see Appendix A for proofs). Lemma 5.1. TC is a valid DFS tree of HC. Lemma 5.2. The total number of edges in HC, for all the components C of G(cid:48), is O(nk). 5.1 Processing of Edges We now describe how TC and HC are maintained while processing the edges of the input stream such that IT and IH are satisfied. Since our algorithm maintains the invariants I1 and I2 (because of IT ), we know that any edge whose both endpoints are not in some component C of G(cid:48), is either a back edge or already a tree edge in T . Thus, we shall only discuss the processing of an edge (x, y) having both endpoints in C (now added to SC), where level(x) ≤ level(y). 1. If x ∈ T (cid:48)C then the edge is added to HC to ensure IH . In addition, if (x, y) is a cross edge in TC it violates either IT1 (if y ∈ T (cid:48)C) or IT2 (if y /∈ T (cid:48)C). Thus, TC is required to be restructured to ensure that IT is satisfied. 2. If x /∈ T (cid:48)C and if x and y belong to different trees in TC \ T (cid:48)C, then it violates IT2. Again in such a case, TC is required to be restructured to ensure that IT is satisfied. Note that after restructuring TC we need to update HC such that IH is satisfied. Consequently any non-tree edge in HC that was incident on a vertex in original T (cid:48)C, has to be removed from HC if none of its endpoints are in T (cid:48)C after restructuring TC, i.e., one or both of its endpoints have moved out of T (cid:48)C. But the problem arises if a vertex moves into T (cid:48)C during restructuring. There might have been edges incident on such a vertex in SC and which were not stored in HC. In this case we need these edges in HC to satisfy IH , 8 which is not possible without visiting SC again. This problem can be avoided if our restructuring procedure ensures that no new vertex enters T (cid:48)C. This can be ensured if the restructuring procedure follows the property of monotonic fall, i.e., the level of a vertex is never decreased by the procedure. Let e be the new edge of component C in the input stream. We shall show that in order to preserve the invariants IT and IH it is sufficient that the restructuring procedure maintains the property of monotonic fall and ensures that the restructured TC is a DFS tree of HC + e. Lemma 5.3. On insertion of an edge e, any restructuring procedure which updates TC to be a valid DFS tree of HC + e ensuring monotonic fall, satisfies the invariants IT and IH . Proof. The property of monotonic fall ensures that the vertex set of new T (cid:48)C is a subset of the vertex set of the previous T (cid:48)C. Using IH we know that any edge of SC which is not present in HC must have both its endpoints outside T (cid:48)C. Hence, monotonic fall guarantees that IH continues to hold with respect to the new T (cid:48)C for the edges in SC \ {e}. Additionally, we save e in the new HC if at least one of its endpoints belong to the new T (cid:48)C, ensuring that IH holds for the entire SC. Since the restructuring procedure ensures that the updated TC is a DFS tree of HC, the invariant IT1 trivially holds as a result of IH . In order to prove the invariant IT2, consider any edge e(cid:48) ∈ SC from a tree τ ∈ TC \ T (cid:48)C to TC \ τ . Clearly, it will satisfy IT2 if e(cid:48) ∈ HC, as TC is a DFS tree of HC + e. In case e(cid:48) /∈ HC, it must be internal to some tree τ(cid:48) in the original TC \ T (cid:48)C (using IT2 in the original TC). We shall now show that such an edge will remain internal to some tree in the updated TC \ T (cid:48)C as well, thereby not violating IT2 . Clearly the endpoints of e(cid:48) cannot be in the updated T (cid:48)C due to the property of monotonic fall. Assume that the endpoints of e(cid:48) belong to different trees of updated TC \ T (cid:48)C. Now, consider the edges e1, ..., et on the tree path in τ(cid:48) connecting the endpoints of e(cid:48). Since the entire tree path is in τ(cid:48), the endpoints of each ei are not in original T (cid:48)C, ensuring that they are also not in the updated T (cid:48)C (by monotonic fall). Since the endpoints of e(cid:48) (and hence the endpoints of the path e1, ..., et) are in different trees in updated TC \ T (cid:48)C, there must exist some ei which also has endpoints belonging to different trees of updated TC \ T (cid:48)C. This makes ei a cross edge of the updated TC. Since ei is a tree edge of original TC, it belongs to HC and hence ei being a cross edge implies that the updated TC is not a DFS tree of HC +e, which is a contradiction. Hence e(cid:48) has both its endpoints in the same tree of the updated Tc \ T (cid:48)C, ensuring that IT2 holds after the restructuring procedure. Hence, any procedure to restructure a DFS tree TC of the subgraph HC on insertion of a cross edge e, that upholds the property of monotonic fall and returns a new TC which is a DFS tree of HC + e, can be used as a black box in our algorithm. One such algorithm is the incremental DFS algorithm by Baswana and Khan [10], which precisely fulfils our requirement. They proved the total update time of the algorithm to be O(n2). They also showed that any algorithm maintaining incremental DFS abiding monotonic fall would require Ω(n2) time even for sparse graphs, if it explicitly maintains the DFS tree. If the height of the DFS tree is known to be h, these bounds reduces to O(nh + ne) and Ω(nh + ne) respectively, where ne is the number of edges processed by the algorithm. Refer to Appendix C for a brief description of the algorithm. 5.2 Algorithm We now describe the details of our final algorithm which uses Procedure Maintain-DFS [10] (described in Appendix C) for restructuring the DFS tree when a cross edge is inserted. Similar to the algorithm in Section 4, for each component C of G(cid:48), a rooted spanning tree TC of the component is required as an input to the procedure having the root rC. Initially T = ∅ and G(cid:48) = G has a single component C, as G is connected (recall the assumption in Section 2). Hence for the first pass, we compute a spanning tree TC of G using the Union-Find algorithm. Subsequently in each pass we directly get a spanning tree TC(cid:48) for each component C(cid:48) of the new G(cid:48), which is the corresponding tree in TC \ T (cid:48)C, where C is the component containing C(cid:48) in the previous pass. Also, observe that the use of these trees as the new TC ensures that the level of no vertex ever rises in the context of the entire tree T . This implies that the level of any vertex starting with the initial spanning tree TG never rises, i.e., the entire algorithm satisfies the property of monotonic fall. We will use this fact crucially in the analysis of the time complexity. As described earlier, we process the edges of the stream by updating the TC and HC maintaining IT and IH respectively. In case the edge is internal to some tree in TC \ T (cid:48)C (i.e., have both endpoint in the 9 same tree in TC \ T (cid:48)C), we simply ignore the edge. Otherwise, we add it to HC to satisfy IH . Further, Procedure Maintain-DFS maintains TC to be a DFS tree of HC, which restructures TC if the processed edge is added to HC and is a cross edge in TC. Now, in case TC is updated we also update the subgraph HC, by removing the extra non-tree edges having both endpoints in TC \ T (cid:48)C. After the pass is completed, we attach T (cid:48)C (the top k levels of TC) to T . Now, IT2 ensures that each tree of TC \ T (cid:48)C forms the (rooted) spanning tree of the components of the new G(cid:48), and hence can be used for the next pass. Refer to Procedure Compute- DFS-Faster in Appendix E for the pseudocode of the algorithm. 5.3 Correctness and Analysis The correctness of our algorithm follows from Lemma 5.3, which ensures that invariants IH and IT (and hence I1 and I2) are maintained as a result of using Procedure Maintain-DFS which ensures monotonic fall of vertices. The total space used by our algorithm and the restructuring procedure is dominated by the cumulative size of HC for all components C of G(cid:48), which is O(nk) using Lemma 5.2. Now, in every pass of the algorithm, a DFS tree for each component C of height k is attached to T . These trees collectively constitute the next k levels of the final DFS tree T . Therefore, the entire tree T is computed in (cid:100)h/k(cid:101) passes. Let us now analyse the time complexity of our algorithm. In the first pass O(mα(m, n)) time is required to compute the spanning tree TC using the Union-Find algorithm. Also, in each pass O(m) time is required to process the input stream. Further, in order to update HC we are required to delete edges having both endpoints out of T (cid:48)C. Hence, whenever a vertex falls below the kth level, the edges incident on it are checked for deletion from HC (if the other endpoint is also not in T (cid:48)C). Total time required for this is v∈V deg(v)) = O(m) per pass. Now, Appendix C describes the details of Procedure Maintain-DFS which maintains the DFS tree in total O(nh + ne) time, where ne = O(mh/k), for processing the entire input stream in each pass. Finally, we need to efficiently answer the query whether an edge is internal to some tree in TC \ T (cid:48)C. For this we maintain for each vertex x its ancestor at level k as rep[x], i.e., rep[x] is the root of the tree in TC \ T (cid:48)C that contains x. If level(x) < k, then rep[x] = x. For an edge (x, y) comparing the rep[x] and rep[y] efficiently answers the required query in O(1) time. However, whenever TC is updated we need to update rep[v] for each vertex v in the modified part of TC, requiring O(1) time per vertex in the modified part of TC. We shall bound the total work done to update rep[x] of such a vertex x throughout the algorithm to O(nh) as follows. Consider the potential function Φ =(cid:80) O((cid:80) v∈V level(v). Whenever some part of TC is updated, each vertex x in the modified TC necessarily incurs a fall in its level (due to monotonic fall). Thus, the cost of updating rep[x] throughout the algorithm is proportional to the number of times x descends in the tree, hence increases the value of Φ by at least one unit. Hence, updating rep[x] for all x in the modified part of TC can be accounted by the corresponding increase in the value of Φ. Clearly, the maximum value of Φ is O(nh), since the level of each vertex is always less than h, where h is the height of the computed DFS tree. Thus, the total work done to update rep[x] for all x ∈ V is O(nh). This proves our main theorem described in Section 1.1 which is stated as follows. Theorem 1.2. Given an undirected graph G, a DFS tree of G can be computed by a semi-streaming algorithm using (cid:100)h/k(cid:101) passes using O(nk) space requiring amortized O(m + nk) time per pass for any integer k ≤ h, where h is the height of the computed DFS tree. Remark: Note that the time complexity of our algorithm is indeed tight for our framework. Since our algorithm requires (cid:100)h/k(cid:101) passes and any restructuring procedure following monotonic fall requires Ω(nh+ne) time, each pass would require Ω(m + nk) time. 6 Experimental Evaluation Most streaming algorithms deal with only O(n) space, for which our advanced algorithms improve over the simple algorithms theoretically by just constant factors. However, their empirical performance demonstrates their significance in the real world applications. The evaluation of our algorithms on random and real graphs shows that in practice these algorithms require merely a few passes even when allowed to store just 5n edges. The results of our analysis can be summarized as follows (for details refer to Appendix D). 10 The two advanced algorithms kPath (Algorithm Compute-DFS-Fast in Section 4) and kLev (Algo- rithm Compute-DFS-Faster in Section 5 with an additional heuristic) perform much better than the rest even when O(n) space is allowed. For both random and real graphs, kPath performs slightly worse as the density of the graph increases. On the other hand kLev performs slightly better only in random graphs with the increasing density. The effect of the space parameter is very large on kPath from k = 1 to small constants, requiring very few passes even for k = 5 and k = 10. However, kLev seems to work very well even for k = 1 and has a negligible effect of increasing the value of k. Overall, the results suggest using kPath if nk space is allowed for k being a small constant such as 5 or 10. However, if the space restrictions are extremely tight it is better to use kLev. 7 Conclusion We presented the first o(n) pass semi-streaming algorithm for computing a DFS tree for an undirected graph, breaking the long standing presumed barrier of n passes. In our streaming model we assume that O(nk) local space is available for computation, where k is any natural number. Our algorithm computes a DFS tree in (cid:100)n/k(cid:101) passes. We improve our algorithm to require only (cid:100)h/k(cid:101) passes without any additional space requirement, where h is the height of the final tree. This improvement becomes significant for graphs having shallow DFS trees. Moreover, our algorithm is described as a framework using a restructuring algorithm as a black box. This allows more flexibility to extend our algorithm for solving other problems requiring a computation of DFS tree in the streaming environment. Recently, in a major breakthrough Elkin [20] presented the first o(n) pass algorithm for computing Shortest Paths Tree from a single source. Using O(nk) local space, it computes the shortest path tree from a given source in O(n/k) passes for unweighted graphs and in O(n log n/k) passes for weighted graphs. Despite the fact that these breakthroughs provide only minor improvements (typically poly log n factors), they are significant steps to pave a path in better understanding of such fundamental problems in the streaming environment. These simple improvements come after decades of the emergence of streaming algorithms for graph problems, where such problems were considered implicitly hard in the semi-streaming environment. We thus believe that our result is a significant improvement over the known algorithm for computing a DFS tree in the streaming environment, and it can be a useful step in more involved algorithms that require the computation of a DFS tree. Moreover, the experimental evaluation of our algorithms revealed exceptional performance of the ad- vanced algorithms kPath and kLev (greatly affected by the additional heuristic). Thus, it would be interesting to further study these algorithms theoretically which seem to work extremely well in practice. References [1] Hamsterster full network dataset -- KONECT, September 2016. [2] Kook Jin Ahn and Sudipto Guha. Linear programming in the semi-streaming model with application to the maximum matching problem. Inf. Comput., 222:59 -- 79, 2013. [3] Noga Alon, Yossi Matias, and Mario Szegedy. The space complexity of approximating the frequency moments. Journal of Computer and System Sciences, 58(1):137 -- 147, 1999. [4] Giorgio Ausiello, Donatella Firmani, and Luigi Laura. Datastream computation of graph biconnectivity: Articulation points, bridges, and biconnected components. In Theoretical Computer Science, 11th Italian Conference, ICTCS 2009, Cremona, Italy, September 28-30, 2009, Proceedings., pages 26 -- 29, 2009. [5] Giorgio Ausiello, Donatella Firmani, and Luigi Laura. Real-time monitoring of undirected networks: Articulation points, bridges, and connected and biconnected components. Networks, 59(3):275 -- 288, 2012. [6] Ziv Bar-Yossef, Ravi Kumar, and D. Sivakumar. Reductions in streaming algorithms, with an applica- tion to counting triangles in graphs. In Proceedings of the Thirteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '02, pages 623 -- 632, 2002. 11 [7] Surender Baswana. Streaming algorithm for graph spanners - single pass and constant processing time per edge. Inf. Process. Lett., 106(3):110 -- 114, 2008. [8] Surender Baswana, Shreejit Ray Chaudhury, Keerti Choudhary, and Shahbaz Khan. Dynamic DFS in undirected graphs: breaking the O(m) barrier. In ACM-SIAM Symposium on Discrete Algorithms, SODA, pages 730 -- 739, 2016. [9] Surender Baswana, Ayush Goel, and Shahbaz Khan. Incremental DFS algorithms: a theoretical and experimental study. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 53 -- 72, 2018. [10] Surender Baswana and Shahbaz Khan. Incremental algorithm for maintaining a DFS tree for undirected graphs. Algorithmica, 79(2):466 -- 483, 2017. [11] Thijs Beuming, Lucy Skrabanek, Masha Y. Niv, Piali Mukherjee, and Harel Weinstein. PDZBase: A protein -- protein interaction database for PDZ-domains. Bioinformatics, 21(6):827 -- 828, 2005. [12] Mari´an Bogun´a, Romualdo Pastor-Satorras, Albert D´ıaz-Guilera, and Alex Arenas. Models of social networks based on social distance attachment. Phys. Rev. E, 70:056122, Nov 2004. [13] B´ela Bollob´as. The evolution of random graphs. Transactions of the American Mathematical Society, 286 (1):257 -- 274, 1984. [14] Glencora Borradaile, Claire Mathieu, and Theresa Migler. Lower bounds for testing digraph connectivity with one-pass streaming algorithms. CoRR, abs/1404.1323, 2014. [15] D. E. Boyce, K. S. Chon, M. E. Ferris, Y. J. Lee, K-T. Lin, and R. W. Eash. Implementation and evaluation of combined models of urban travel and location on a sketch planning network. Chicago Area Transportation Study, pages xii + 169, 1985. [16] Adam L. Buchsbaum, Raffaele Giancarlo, and Jeffery Westbrook. On finding common neighborhoods in massive graphs. Theor. Comput. Sci., 299(1-3):707 -- 718, 2003. [17] Eunjoon Cho, Seth A. Myers, and Jure Leskovec. Friendship and mobility: User movement in location- based social networks. In Proc. Int. Conf. on Knowledge Discovery and Data Mining, pages 1082 -- 1090, 2011. [18] R. W. Eash, K. S. Chon, Y. J. Lee, and D. E. Boyce. Equilibrium traffic assignment on an aggregated highway network for sketch planning. Transportation Research Record, 994:30 -- 37, 1983. [19] Michael Elkin. Streaming and fully dynamic centralized algorithms for constructing and maintaining sparse spanners. ACM Trans. Algorithms, 7(2):20:1 -- 20:17, 2011. [20] Michael Elkin. Distributed exact shortest paths in sublinear time. In Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2017, Montreal, QC, Canada, June 19-23, 2017, pages 757 -- 770, 2017. [21] P. Erdos and A R´enyi. On the evolution of random graphs. In Publication of the Mathematical Institute of the Hungarian Academy of Sciences, pages 17 -- 61, 1960. [22] Shimon Even and Robert Endre Tarjan. Network flow and testing graph connectivity. SIAM J. Comput., 4(4):507 -- 518, 1975. [23] Martin Farach-Colton, Tsan-sheng Hsu, Meng Li, and Meng-Tsung Tsai. Finding articulation points of large graphs in linear time. In Algorithms and Data Structures, WADS, pages 363 -- 372, Cham, 2015. Springer International Publishing. [24] Joan Feigenbaum, Sampath Kannan, Andrew McGregor, Siddharth Suri, and Jian Zhang. Graph distances in the streaming model: The value of space. In Proceedings of the Sixteenth Annual ACM- SIAM Symposium on Discrete Algorithms, SODA '05, pages 745 -- 754, 2005. 12 [25] Joan Feigenbaum, Sampath Kannan, Andrew McGregor, Siddharth Suri, and Jian Zhang. On graph problems in a semi-streaming model. Theor. Comput. Sci., 348(2):207 -- 216, December 2005. [26] Joan Feigenbaum, Sampath Kannan, Martin J. Strauss, and Mahesh Viswanathan. An approximate l1-difference algorithm for massive data streams. SIAM J. Comput., 32(1):131 -- 151, January 2003. [27] Christiane Fellbaum, editor. WordNet: an Electronic Lexical Database. MIT Press, 1998. [28] Philippe Flajolet and G. Nigel Martin. Probabilistic counting algorithms for data base applications. Journal of Computer and System Sciences, 31(2):182 -- 209, 1985. [29] Alan M. Frieze and Michal Karonski. Introduction to Random Graphs. Cambridge University Press, 2015. [30] Pablo M. Gleiser and Leon Danon. Community structure in jazz. Advances in Complex Systems, 6(4):565 -- 573, 2003. [31] Sudipto Guha, Nick Koudas, and Kyuseok Shim. Data-streams and histograms. In Proceedings of the Thirty-third Annual ACM Symposium on Theory of Computing, STOC '01, pages 471 -- 475, 2001. [32] Venkatesan Guruswami and Krzysztof Onak. Superlinear lower bounds for multipass graph processing. Algorithmica, 76(3):654 -- 683, Nov 2016. [33] Venkatesan Guruswami and Krzysztof Onak. Superlinear lower bounds for multipass graph processing. Algorithmica, 76(3):654 -- 683, 2016. [34] Monika Rauch Henzinger, Prabhakar Raghavan, and Sridhar Rajagopalan. Computing on data streams. In External Memory Algorithms, Proceedings of a DIMACS Workshop, New Brunswick, New Jersey, USA, May 20-22, 1998, pages 107 -- 118, 1998. [35] John E. Hopcroft and Richard M. Karp. An n5/2 algorithm for maximum matchings in bipartite graphs. SIAM J. Comput., 2(4):225 -- 231, 1973. [36] John E. Hopcroft and Robert Endre Tarjan. Efficient planarity testing. J. ACM, 21(4):549 -- 568, 1974. [37] Piotr Indyk. Stable distributions, pseudorandom generators, embeddings, and data stream computation. J. ACM, 53(3):307 -- 323, May 2006. [38] Sagar Kale and Sumedh Tirodkar. Maximum matching in two, three, and a few more passes over graph streams. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM 2017, August 16-18, 2017, Berkeley, CA, USA, pages 15:1 -- 15:21, 2017. [39] Michael Kapralov. Better bounds for matchings in the streaming model. In Proceedings of the Twenty- Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2013, New Orleans, Louisiana, USA, January 6-8, 2013, pages 1679 -- 1697, 2013. [40] Shahbaz Khan. Near optimal parallel algorithms for dynamic DFS in undirected graphs. In Proceedings of the 29th ACM Symposium on Parallelism in Algorithms and Architectures, SPAA 2017, Washington DC, USA, July 24-26, 2017, pages 283 -- 292, 2017. [41] Lasse Kliemann. Engineering a bipartite matching algorithm in the semi-streaming model. In Algorithm Engineering - Selected Results and Surveys, pages 352 -- 378. Springer International Publishing, 2016. [42] Donald E. Knuth. The Art of Computer Programming, Volume 4, Fascicle 0: Introduction to Combi- natorial and Boolean Functions. Addison-Wesley, 2008. [43] J´erome Kunegis. KONECT - The Koblenz Network Collection. http://konect.uni-koblenz.de/ networks/, October 2016. [44] Jure Leskovec, Jon Kleinberg, and Christos Faloutsos. Graph evolution: Densification and shrinking diameters. ACM Trans. Knowledge Discovery from Data, 1(1):1 -- 40, 2007. 13 [45] Julian McAuley and Jure Leskovec. Learning to discover social circles in ego networks. In Advances in Neural Information Processing Systems, pages 548 -- 556. 2012. [46] Andrew McGregor. Finding graph matchings in data streams. In Approximation, Randomization and Combinatorial Optimization, Algorithms and Techniques, 8th International Workshop on Approxima- tion Algorithms for Combinatorial Optimization Problems, APPROX 2005 and 9th InternationalWork- shop on Randomization and Computation, RANDOM 2005, Berkeley, CA, USA, August 22-24, 2005, Proceedings, pages 170 -- 181, 2005. [47] Andrew McGregor. Graph stream algorithms: A survey. SIGMOD Rec., 43(1):9 -- 20, May 2014. [48] Shan Muthukrishnan. Data streams: Algorithms and applications. Foundations and Trends in Theo- retical Computer Science, 1(2):117 -- 236, 2005. [49] Thomas C. O'Connell. A survey of graph algorithms under extended streaming models of computation. In Fundamental Problems in Computing: Essays in Honor of Professor Daniel J. Rosenkrantz, pages 455 -- 476, 2009. [50] Jan Matthias Ruhl. Efficient algorithms for new computational models. PhD Thesis, Department of Computer Science, MIT, Cambridge, MA, 2003. [51] Robert Endre Tarjan. Depth-first search and linear graph algorithms. SIAM J. Comput., 1(2):146 -- 160, 1972. [52] Robert Endre Tarjan. Finding dominators in directed graphs. SIAM J. Comput., 3(1):62 -- 89, 1974. [53] Robert Endre Tarjan. Efficiency of a good but not linear set union algorithm. J. ACM, 22(2):215 -- 225, April 1975. [54] Robert Endre Tarjan. Edge-disjoint spanning trees and depth-first search. Acta Inf., 6:171 -- 185, 1976. [55] Robert Endre Tarjan and Jan van Leeuwen. Worst-case analysis of set union algorithms. J. ACM, 31(2):245 -- 281, 1984. [56] Jeffery Westbrook and Robert Endre Tarjan. Maintaining bridge-connected and biconnected components on-line. Algorithmica, 7(5&6):433 -- 464, 1992. [57] Jaewon Yang and Jure Leskovec. Defining and evaluating network communities based on ground-truth. In Proc. ACM SIGKDD Workshop on Mining Data Semantics, page 3. ACM, 2012. [58] R. Zafarani and H. Liu. Social computing data repository at ASU, 2009. [59] Jian Zhang. A survey on streaming algorithms for massive graphs. In Managing and Mining Graph Data, pages 393 -- 420. Springer US, 2010. A Omitted Proofs Lemma 4.1 (Min-Height Property). Given a connected undirected graph G having m edges, any DFS tree of G from any root vertex necessarily has a height h ≥ m/n. Proof. We know that each non-tree edge in a DFS tree of an undirected graph is a back edge. We shall associate each edge to its lower endpoint. Thus, in a DFS tree each vertex will be associated to a tree edge to its parent and back edges only to its ancestors. Now, each vertex can have only h ancestors as the height of the DFS tree is h, Hence each vertex has only h edges associated to it resulting in less than nh edges, i.e. m ≤ nh or h ≥ m/n. Note that it is important for the graph to be connected otherwise from some root the corresponding component and hence its DFS tree can be much smaller. Lemma 5.1. TC is a valid DFS tree of HC. 14 Proof. In order to prove this claim it is sufficient to prove that all the non-tree edges stored in HC are back edges in TC, i.e., the endpoints of every such edge share an ancestor-descendant relationship. Now, invariant IT1 ensures that any edge in SC having both endpoints in T (cid:48)C is a back edge. And invariant IT2 ensures that any edge between a vertex in T (cid:48)C and TC \ T (cid:48)C is a back edge. Hence, all the non-tree edges incident on T (cid:48)C (and hence all non-tree edges in HC) are back edges, proving our lemma. Lemma 5.2. The total number of edges in HC, for all the components C of G(cid:48), are O(nk). Proof. The size of HC can be analysed using invariant IH as follows. The number of tree edges in TC (and hence in HC) is O(VC). The non-tree edges stored by HC have at least one endpoint in T (cid:48)C. Using Lemma 5.1 we know that all these edges are back edges. To bound the number of such edges let us associate each non-tree edge to its lower endpoint. Hence each vertex will be associated to at most k non-tree edges to its k ancestors in T (cid:48)C (recall that T (cid:48)C is the top k levels of TC). Thus, HC stores O(VC) tree edges and C∈G(cid:48) VC ≤ n, the total number of edges in O(VC · k) non-tree edges, i.e., total O(VC · k) edges. Since(cid:80) HC is O(nk). B Tightness of analysis of Procedure Compute-DFS-Fast We now describe a worst case example proving the tightness of the analysis of Procedure Compute-DFS- Fast. To prove this we present a sequence of edges in the input stream, such that in each pass the algorithm extracts the longest path of the DFS tree, which is computed using the first O(nk) edges of the input stream that are internal to the component. We shall show that Procedure Compute-DFS-Fast will require Θ(n/k) passes to build the DFS tree for such a graph where the height of the tree is o(n). Note that the amortized time required by the algorithm in every pass is clearly optimal upto O(α(m, n)) factors, hence the focus here is merely on the number of passes. Figure 2: Example to prove the tightness of analysis of Procedure Compute-DFS-Fast. Consider the tree shown in Figure 2 (i). At the beginning of every pass of the algorithm, the unvisited graph will be connected and the vertices will be classified into four sets A, B, C and D, depending on a parameter k > k to be fixed later on. The set A = {a1,··· , ak(cid:48)} consists of k(cid:48) = k + 3 vertices connected in the form of a path. The vertex a1 is also the root of the DFS tree of the component. The set C = {c1, ..., ck} is also connected in the form of a path. The set of vertices D = {d1, ..., dn} are connected to all the vertices in C, where n = n/2. The set B = {b1, ..., bl} contains the remaining vertices of the component each having an edge to a1. The value of k is chosen so that the total number of edges described above becomes exactly the number of edges that can be stored by the procedure, i.e., Θ(nk). This graph of Θ(nk) edges will henceforth be called as the partial graph for the pass. The value of k(cid:48) = k + 3 ensures that the longest path from root a1 to a leaf, is the path connecting a1 to the leaf ak(cid:48). Clearly, the only DFS tree possible for the partial graph is shown in Figure 2. Note that the subtree T (c1) may be computed differently with possibly one vertex of D between every two vertices of C, but the corresponding analysis remains same. 15 a1a2ak0b1blc1ckd1dn(i)a1a2ak0b1blc1ckd1dn(ii)a1a2a3ak0b1b2b3bk0b01blc1ckd1dn(iii) Now, the Θ(nk) edges described above would appear first in the input edge sequence, and hence would be stored by Procedure Compute-DFS-Fast in the first pass, to compute the DFS tree shown in Figure 2 (i). As a result the path connecting a1 with ak(cid:48) is added to T . The next edges in the stream connect b1 to a2, c1 and all the vertices in B \ {b1}, as shown in Figure 2 (ii). This makes sure that the unvisited graph remains connected after the end of this pass, and the lowest edge from this component on T is from b1, making it the root of the DFS tree of the unvisited component. The corresponding spanning tree computed for the next pass is shown in Figure 2 (iii). Notice its similarity with Figure 2 (i), where A(cid:48) = {b1, ..., bk(cid:48)} and B(cid:48) = {b(cid:48)1 = bk(cid:48)+1, ..., bl}. Hence, the above construction can be repeated for each pass adding a path of length k(cid:48) in every pass. Also, note that the number of edges in the partial graph would have now decreased as the size of B has decreased (by k(cid:48) vertices). Hence we may have to add a vertex from B to C (by accordingly placing the corresponding edges next in the stream) to ensure Θ(nk) edges in the partial graph. But C will grow much slower as compared to the number of passes, as each addition to C adds O(n) edges to the partial graph, whereas each pass reduces O(k(cid:48)) edges from the partial graph. Hence the construction can continue for Θ(n/k) passes, where the size of T grows by O(1) in each pass resulting in a DFS tree of height O(n/k). Thus, we get the following lemma. Lemma B.1. There exists a sequence of edges for which Procedure Compute-DFS-Fast takes Θ(n/k) passes to compute a DFS tree of height o(n). tree is very easy. Simply order (cid:0)n (cid:1) edges of the graph by the indices of its endpoint having a lower index. Remark B.1. Showing the tightness of the number of passes without any restriction on the height of the 2 Every pass would consider all the edges of O(k) vertices with the lowest index, which will result in the final DFS tree being a single path of length n, computed in O(n/k) passes. However, such an example does not highlight the importance of Procedure Compute-DFS-Faster which computes a DFS tree in O(h/k) passes, where h is the height of the DFS tree. C Restructuring procedure [10] We now briefly describe the restructuring procedure by Baswana and Khan [10]. For the sake of simplicity, here we only describe how restructuring a DFS tree TC of HC is performed on insertion of a cross edge is achieved abiding monotonic fall, i.e., the DFS tree is restructured such that the level of each vertex only increases. Hence, we will not describe the various optimizations used to achieve the tight bound on total update time. The procedure essentially adds the given cross edge into the DFS tree, restructuring it accordingly. In particular it reverses only a single path in the tree (see Figure 3). However, this results in some back edges of the tree to become cross edges. These edges can be efficiently identified and removed from the graph and inserted back to the graph iteratively following the same procedure. Let us now describe the procedure in detail. A pool of edges EC is initialized with the inserted edge e. Then the edges in EC are processed until it becomes empty. For each edge (x, y) ∈ EC where level(x) ≥ level(y), it is first removed from EC and checked whether it is a cross edge. This can be easily verified if both x and y are different from their lowest common ancestor (LCA) w. In case of a back edge, the edge is simply ignored processing of EC continues. Otherwise, let v be the ancestor of y (not necessarily proper) that is a child of w. Since (x, y) is a cross edge, both w and v would surely exist. The DFS tree TC is then restructured by removing the edge (w, v) and adding the edge (x, y). As a result the entire tree path from y to v would now hang from y which was earlier hanging from v, reversing the parent child relation for all the edges on this path. However, as a result of this restructuring several edges of HC may now become cross edges. In order to maintain TC as the DFS tree of HC, these cross edges are collected from HC and added to the pool of edges EC, which are then iteratively processed using the same procedure. Thus, the algorithm maintains the following invariant. Invariant: TC is a DFS tree of HC \ EC. Hence, when the list EC is empty, TC is a valid DFS tree of HC. Refer to Procedure Maintain-DFS for the pseudocode of the restructuring procedure. Now, observe that since level(x) ≥ level(y) the level of vertices can only increase as a result of the path reversal described above, ensuring monotonic fall. This also ensures the termination of the algorithm as the vertices cannot fall beyond the level n. Moreover, the analysis [10] of the procedure ensures that the total work done to restructure TC (including maintenance of LCA structures 16 Figure 3: Rerooting the tree TC(v) at y and hanging it from x. Notice that some back edges may become cross edges (shown dotted) due to this rerooting (reproduced from [10]). etc.) can be associated to constant times the fall in level of vertices (similar to Φ described in Section 5). Since the each vertex can only fall by h levels, the total fall of vertices is bounded by O(nh), where h is the height of the final DFS tree. Further, recall that Procedure Compute-DFS-Faster also satisfied monotonic fall. Hence, the total time taken by Procedure Maintain-DFS to restructure TC throughout the algorithm across all passes is O(nh). However, we also need to account for the O(1) time required to process an input edge whenever the procedure is invoked. This requires total O(ne) time, where ne is the number of input edges processed by the procedure in all the passes of the algorithm, which results in the following theorem. Theorem C.1. Given an undirected graph G, its DFS tree can be rebuild after insertion of cross edges by a procedure abiding monotonic fall requiring total O(nh + ne) time across all invocations of the procedure, where h is the height of the computed DFS tree and ne is the number of input edges processed. Remark C.1. Baswana and Khan [10] showed that any algorithm maintaining a DFS tree incrementally abiding monotonic fall, necessarily requires Ω(n2) time to maintain the tree explicitly even for sparse graphs. However, if we present the bound in terms of the height h of the DFS tree, the corresponding bound reduces to Ω(m + nh) as every algorithm requires Ω(1) time to process each of the m input edges. In the streaming environment, where multiple passes over input stream are performed, this bound naturally extends to Ω(ne + nh), where ne is the number of edges processed during all the passes over the input stream. D Experimental Evaluation We now perform an experimental evaluation of the algorithms to understand their significance in practice. The main criterion of evaluation is the number of passes required to completely build the DFS tree, instead of the time taken. This makes the evaluation independent of the computing platform, programming environ- ment, and code efficiency, resulting in easier reproduction and verification of this study. For random graphs, the results of each experiment are averaged over several test cases to get the expected behaviour. A related experimental study was performed by Baswana et al. [9] which analysed different incremental DFS algorithms on random and real graphs. For random graphs, they also presented simple single pass algorithms to build a DFS tree using O(n log n) space. Moreover, they also presented the following property which shall be used to describe some results during the course of our evaluation. 17 vvuuyyxxwwT4T4T3T3T2T2T1T1T(u)T(u)T(v) Procedure Maintain-DFS(TC,e): Maintains the DFS tree TC on insertion an edge e abiding monotonic fall making TC a valid DFS tree of HC. 1 EC ← {e}; 2 while EC (cid:54)= ∅ do /* where level(x) ≥ level(y) */ /* (x, y) is a cross edge */ 3 4 5 6 7 8 9 10 11 (x, y) ← Extract an edge from EC ; w ← LCA of x and y in TC; if w (cid:54)= x and w (cid:54)= y then v ← Ancestor of y whose parent in TC is w; Remove the edge (w, v) from TC; Reverse the parent-child relationship of edges on path from y to v in TC; Add the edge (x, y) to TC; ER ← The cross edges from HC \ EC in the tree TC; EC ← EC ∪ ER; end 12 13 end Theorem D.1 (DFS Height Property[9]). The depth of a DFS tree of a random graph G(n, m), with m = cn log n is at least n − n/c with high probability. We shall also be using the following properties regarding the thresholds of the phase transition phe- nomenon of Random Graphs to describe the performance of algorithms. Theorem D.2 (Connectivity Threshold[29]). Graph G(n, m) with m = n probability at least 1 − e−c, for any constant c > 0. Theorem D.3 (Giant Component Threshold[29]). Graph G(n, m) with m = cn 2 for any constant c > 0, the graph contains a single giant component having O(n) vertices and O(m) edges while the residual components have at most the size O(log n). 2 (log n + c) is connected with D.1 Datasets In our experiments we considered the following two types of datasets. • Random Graphs: The initial graph is the star graph, formed by adding an edge from a dummy vertex r to each vertex (recall Section 2). The update sequence is generated based on Erdos R´enyi G(n, m) model [13, 21] by choosing the first m edges of a random permutation of all the edges in the graph. • Real graphs: We use several publicly available undirected graphs from real world. We derived these graphs from the KONECT dataset [43]. These datasets are of different types, namely, online social networks (HM [1], Apgp [12], BrightK [17], LMocha [58], FlickrE [45], Gowalla [17]), human networks (AJazz [30], ArxAP [44], Dblp [57]), recommendation networks (Douban [58], Amazon [57]), infrastructure (CU [42], CH [18, 15]), autonomous systems (AsCaida [44]), lexical words (Wordnet [27]) and protein base (Mpdz [11]). D.2 Algorithms During the course of these experiments, we modified the algorithms described previously using some obvious heuristics to improve their empirical performance. The analyzed algorithms are as follows. • Simple Algorithm (Simp): This algorithm refers to Procedure Compute-DFS described in Section 3, which adds one new vertex to the DFS tree during each pass, requiring exactly n passes irrespective of the data set. However, notice that after having found a new vertex u, the residual pass is wasted. This can be used to possibly find the next neighbour v of u if an edge (u, v) exists in the residual pass, and then possibly the neighbour w of v, and so on. Hence, using this additional heuristic the algorithm 18 now possibly adds more vertices in each pass, requiring less than n passes. The algorithm without using the additional heuristic shall be referred to as SimpO. • Improved Algorithm (Imprv): This algorithm refers to Procedure Compute-DFS-Improved de- scribed in Section 3.1, where in the ith pass all the vertices in the ith level of the final DFS tree are added. Thus, this algorithm requires exactly h passes, where h is the height of the computed DFS tree. • K Path Algorithm (kPath): This algorithm refers to Procedure Compute-DFS-Fast described in Section 4, where by using nk edges each pass adds a path of length at least k to the DFS tree, for each component of the unvisited graph. For a component of n(cid:48) vertices, the algorithm essentially computes an auxiliary DFS tree using the first n(cid:48)k edges of the pass and adds the longest path of this tree to the final DFS tree. • K Level Algorithm (kLev): This algorithm refers to Procedure Compute-DFS-Faster described in Section 5, where in each pass by using nk edges a spanning tree is computed whose top k levels are the next k levels of the final DFS tree. This requires exactly h/k passes, where h is the height of the final DFS tree. However, it is evident from the algorithm that if some vertex and all its ancestors are not modified during a pass, it will remain so in the final DFS tree. Hence, we use an additional heuristic which also adds such unmodified vertices at the end of the pass to the DFS tree. The algorithm without using the additional heuristic shall be referred to as kLevO. D.3 Experiments on Random Graphs We first compare in Figure 4, the expected number of passes taken by different algorithms for random graphs having n log n edges, for different values of n up to 1000. The number of passes required by SimpO clearly matches the number of vertices as expected. The performance of Simp is strikingly better than SimpO demonstrating the significance of the additional heuristic. The variation of Imprv essentially shows the expected height of the DFS tree for n log n edges. The advanced algorithms are evaluated using nk edges, for k = 10. The algorithm kPath performs extremely well, showing the presence of deep DFS tree of a random graph even with 10n edges (as expected from DFS height property), and thereafter splitting into small components. It requires the minimum number of passes (recall that kPath and kLev uses an additional pass to determine the components) for the values of n having k > log n/2, after which it still requires merely 3 passes. Notice that this is against the expectation because when nk ≥ m, or k ≥ log n, the algorithm should require minimum passes. The number of passes taken by kLevO for a given value of n is indeed close to 1/k times the number of passes taken by Imprv, as expected by the theoretical bounds. However, the performance of kLev is remarkably better as compared to kLevO demonstrating the significance of the additional heuristic. Apparently, the whole of DFS tree is fixed within a few passes, after which kLevO merely adds the top k levels to the final DFS tree in each pass. Thus, the role of the additional heuristic is very significant, which is adversely affected as n becomes larger with respect to k. Henceforth, we shall evaluate only Simp and kLev ignoring SimpO and kLevO as they do not seem to reveal any extra information. Following are the most surprising observations of this experiment: Observation 1. The advanced algorithms perform extremely well for n from 1 to 1000, (a) kPath requires the 2 passes (minimum) until k ≤ log n/2 and 3 passes henceforth. (b) kLev requires merely 3 passes which gradually increase to 4. graphs having 1000 vertices, for different values of m up to (cid:0)n (cid:1). The number of passes required by Simp We now compare in Figure 5, the expected number of passes taken by different algorithms for random 2 decreases sharply as the graph becomes denser. This can be explained by the additional heuristic of Simp, which has more opportunities to add vertices during a single pass in denser graphs. However, the performance of Imprv worsens sharply as the graph becomes denser. This is because the height of a DFS tree and hence the number of passes increases sharply with the density by the DFS height property. The advanced algorithms are evaluated using nk edges, for k = 5 and 10. Notably, the performance of kPath worsens with the increase in density despite the fact that it exploits the depth of the auxiliary DFS tree to extract the longest path. However, recall that this auxiliary DFS tree is made using just the first n(cid:48)k edges for a component of size n(cid:48), which is clearly independent of the density of the graph. Moreover, the resulting components formed after having removed the longest path would be less in number and larger in size as the density of the graph 19 Figure 4: For various algorithms, the plot shows the number of passes required to build a DFS tree of a random graph with m = n log n edges for different values of n. The advanced algorithms are allowed to store 10n edges. increases, justifying more number of passes required by kPath. However, notice that k = 10 performs better than k = 5, as k clearly affects the depth of the auxiliary DFS tree and hence the length of the path added during a pass. Also, note that the passes required by kPath are minimum till little earlier than m = nk, as noticed in Observation 1 (a). After this, instead of increasing gradually (as its an expected value) with density as normally expected, the number of passes increases like a staircase having steps at 3, 4 and so on. However, after around 100,000 edges, the number of passes increases gradually for both values of k to its final value, not adhering to the staircase structure. Finally, kLev also has a surprising performance sharply rising up to 4 passes for around 1000 edges after which it decreases gradually to settle at 3 passes. This is despite the fact that the depth of the DFS tree is sharply increasing (see Imprv), implying that the performance is again dominated by the additional heuristic. Moreover, it also seems to be unaffected by the different values of k. Following are the key observations of this experiment: Observation 2. Performance of the advanced algorithms for varying density is as follows (a) Passes required by kPath increase in steps abruptly from the 2 (minimum) to 3 earlier than m = nk, and further such transitions occur at threshold densities which increase with k. However, after around 100N edges, the staircase structure is not visible for both values of k. (b) Passes required by kLev increase sharply to 4 until m = n edges, and then decrease gradually to 3, which 20 random graph with for n = 1000 for different values of m up to(cid:0)n (cid:1). The advanced algorithms are allowed Figure 5: For various algorithms, the plot shows the number of passes required to build a DFS tree of a to store (1) 5n edges, and (2) 10n edges. is independent of k. 2 2 n and(cid:0)n (cid:1). This experiment thus allows us to closely examine the behaviour of the two Finally, we examine in Figure 6, the variation of performance of kPath and kLev for random graphs √ having 1000 vertices. We consider different values of k up to n and three different densities of the graph, namely, n log n, n algorithms with increasing values of k as noticed in the previous experiment. The variation of the number of passes required by kPath is very interesting as it starts from a large value which sharply falls as k increases. The initial value increases only slightly with the density, but the eventual fall to the minimum value is delayed with the increasing density. This sharp decline can be easily explained by the sharp increase in depth of the DFS tree of the auxiliary graph containing nk edges. However, again instead of a gradual fall, the passes decrease as a staircase with steps at 4 and 3 passes. Further, with the increase in density the size of a step (range of k for that value) increases. Also, only in case of very high density, the descent is gradual instead of abrupt, though still following the staircase structure. In all cases, the minimum passes are required only when m < nk, not when m = nk as theoretically expected. The impact of density seemingly affects the size of the residual components after the longest path is removed. This adversely affects the performance of kPath. On the other hand, kLev seems to be much less affected by the variation in k. But still, the number of passes required decreases as a staircase in steps, with the increase in k. However, the 21 Figure 6: For various algorithms, the plot shows the number of passes required to build a DFS tree of a random graph with for n = 1000 for different densities (1) n log n, (2) n space parameter k (allowing local nk space) is varied up to n. 2 √ n, and (3)(cid:0)n (cid:1). The value of the increase in density clearly improves its performance where higher density reduces the passes to 3 for smaller values of k. For larger values of k, the number passes reach the minimum value, when k is larger than the expected height at the given density. Thus, the performance of kPath improves significantly with increasing k and slowly with decreasing density of the graph. On the other hand, the performance of kLev (especially its additional heuristic) is affected very little by these variations, improving marginally by the increase in both k and density. The key observations of this experiment are as follows. Observation 3. On increasing space, the advanced algorithms perform as a staircase (a) Passes required by kPath decrease in steps, with threshold and size of step increasing with the increase in density. The descent between steps is abrupt, except for highest density. (b) Passes required by kLev slowly decrease in steps at much higher values of k, which increases with the increase in density. Inferences from Observations The property of the phase transition of random graphs, seemingly explains some thresholds and the existence of steps and abrupt changes in the performance of kLev and kPath. The threshold for emergence of a 22 giant component around n/2 to n edges coincides with the worst performance of kLev in Observation 2(b). This explains why prior to it when each component is very small, kLev performs better on each component individually. The threshold for connectivity seemingly explains the performance of kPath in Observation 1(a). At this point despite nk > m, the presence of a much greater density in the giant component would result in n(cid:48)k < m(cid:48), requiring an extra pass. The remaining observations essentially deal with the surprising performance of kPath and the impact of the additional heuristic on kLev. Also, it demonstrates the variation of the performance in the form a staircase, with different thresholds for each step. Further, for higher densities the staircase structure is much relaxed and gradual. Among these variations we have only been able to understand the transition of kPath to minimum passes when m < nk. The remaining features of this exceptional performance of kPath and kLev would require further examination of the properties of random graphs, which is beyond the scope of this paper. These seem to be important future directions for understanding the behaviour of these algorithms. D.4 Experiments on Real Graphs We now evaluate the algorithms on real graphs in Table 1. We evaluate the advanced algorithms for different values of the space parameter, namely, k = 1, 2, 5 and 10. The evaluated real graphs are selected to cover a wide range of number of vertices and different graph densities. The density of a graph is estimated by comparing m n and n. This allows us to better predict the performance of these algorithms for even larger graphs. Dataset n m m n Simp Imprv 107 242 CU Mpdz AJazz CH HM Apgp ArxAP AsCaida BrightK 58.2K LMocha FlickrE Wordnet Douban Gowalla Dblp Amazon 2.18 49 1.14 212 2.74K 13.85 198 1.3K 0.88 1.47K 6.86 2.43K 16.6K 10.7K 24.3K 2.28 198K 10.55 18.8K 26.5K 53.4K 2.02 3.68 214K 104K 2.19M 21.07 106K 2.32M 21.87 146K 4.50 2.11 155K 197K 4.83 317K 1.05M 3.31 335K 2.76 657K 327K 950K 926K 32 23 26 181 154 53 8 1.46K 753 1.31K 8.15K 858 9.36K 6.49K 24.7K 979 43.3K 10.3K 40K 66.4K 55K 51.7K 96.9K 23.7K 145K 11.5K 134K 45.3K 214K 42.3K 204K 80.1K kPath n 4 7 20 5 37 35 197 36 193 688 599 238 215 472 378 245 2n 4 3 14 2 13 12 37 8 13 22 33 51 7 30 35 76 5n 2 2 5 2 4 2 9 2 2 6 6 5 2 4 2 2 10n 2 2 3 2 2 2 4 2 2 4 9 2 2 2 2 2 kLev n 3 3 3 2 4 4 5 4 5 4 5 6 4 6 6 6 2n 3 3 3 2 4 4 5 4 5 4 5 6 4 6 6 6 5n 3 3 3 2 4 4 5 4 5 4 5 6 4 6 6 6 10n 3 3 3 2 4 4 5 4 5 4 5 6 4 6 6 6 Table 1: Comparison of number of passes required by different algorithms on real graphs. Overall the performance of all the algorithms follow similar pattern as in case of random graphs. The prominent high density graphs are AJazz, ArxAP, LMocha and FlickrE. The performance of Simp is close n but improves with the increase in the density of the graph. However, the performance of Imprv decreases with the increase in graph density as the height of the DFS tree increases, even worse than Simp for extremely high density (see AJazz). The performance of the advance algorithms kPath and kLev is again much better than the rest even for k = 1, except for extremely sparse graphs (see CH) where kLev and Imprv are comparable. The performance of kPath sharply improves with the value of k to reach minimum value 2. The prominent exception being FlickrE where strangely the number of passes increases for k = 10. Also, the performance is inversely affected by the increasing density, where kPath requires minimum passes even for k = 5 when density is less. The performance of kLev again seems unaffected by the value of k. Also, it does not require minimum number of passes (2) even for very small graphs, except extremely sparse graph (CH) where the height of DFS tree is also very less. While for random graphs, the performance of kLev improved marginally with density, it does not seems the case with real graphs with no clear pattern emerging. Eventually for 23 k = 10, kPath performs marginally better than kLev for most graphs. However, for smaller values of k it can perform very bad as compared to kLev. D.5 Results The two algorithms kPath and kLev perform much better than the rest even when O(n) space is allowed. For both random and real graphs, kPath performs slightly worse as the density of the graph increases. On the other hand kLev performs slightly better only in random graphs with the increasing density. The effect of the space parameter is very large on kPath from k = 1 to small constants, requiring very few passes even for k = 5 and k = 10. However, kLev seems to work very well even for k = 1 and has a negligible effect of increasing the value of k. Overall, the results suggest using kPath if nk space is allowed for k being a small constant such as 5 or 10. However, if the space restrictions are extremely tight it is better to use kLev. Also, note that the superior performance of the kLev seems to be greatly attributed to the additional heuristic. Further, kPath performs much better than expected. Thus, it would be interesting to theoretically study these algorithms which seem to work extremely well in practice. E Pseudocodes Procedure Compute-DFS(r): Computes a DFS tree of the component C rooted at the vertex rc ∈ C. 1 Initialize T ← {r}, v ← r; 2 while T has < n vertices do 3 /* T does not span all the vertices */ /* Initiate a pass over edges in E */ for edges in E do For each vertex x ∈ T , store its edge ex = (x, y) to some y /∈ T (if any); 4 5 6 7 8 9 end end while ev is not valid edge do v ← par(v) ; Add ev to T ; v ← v(cid:48); /* say ev = (v, v(cid:48)), where v ∈ T and v(cid:48) /∈ T */ Procedure Compute-DFS-Improved(r): Computes a DFS tree of the component C rooted at the vertex rc ∈ C. 1 Initialize T ← {r}; 2 while T has < n vertices do 3 /* T does not span all the vertices */ /* Initiate a pass over edges in E */ for edges in E do 4 5 6 7 8 9 Compute the components C1, ..., Cf of G(cid:48) using Union-Find algorithm; For each vertex y /∈ T , store its edge ey to some leaf of T (if any); end foreach component C ∈ C1, ..., Cf do (xC, yC) ← Any valid edge ey, where y ∈ C; Add (xC, yC) to T ; end 10 11 end 24 Procedure Compute-DFS-Fast(C,TC,rC): Computes a DFS tree of the component C rooted at the vertex rC ∈ C. 1 E(cid:48)C ← ∅; /* Initiate a pass over E, for all components in parallel 2 while E(cid:48)C ≤ VCk or Stream is over do /* process first VCk edges of C */ */ if next edge e belongs to C then E(cid:48)C ← E(cid:48)C ∪ {e}; 3 4 end 5 if par(rC) (cid:54)= φ then Add (rC, par(rC)) to T ; 6 T (cid:48)C ← DFS tree of TC ∪ E(cid:48)C from root rC; 7 if E(cid:48)C ≤ VC · k then Add T (cid:48)C to T ; 8 else 9 P ← Path from rC to lowest vertex in T (cid:48)C; Add P to T ; /* pass over E was completed */ 10 11 12 13 14 15 16 17 end 18 19 end /* Continue the pass for all components in parallel forall edges in E(cid:48)C followed by the remaining pass over E do Compute the components C1, ..., Cf of C \ P using Union-Find algorithm; /* This essentially computes TC1, ..., TCf Find lowest edge ei from each component Ci to P ; */ */ end foreach Component Ci of C \ P do par(yi) ← xi ; Compute-DFS-Fast(Ci,TCi,yi); /* Let ei = (xi, yi), where yi ∈ Ci */ Procedure Compute-DFS-Faster(C,TC,rC): Computes a DFS tree of the component C whose spanning tree TC is rooted at the vertex rC ∈ C. 1 Initialize HC ← TC; 2 foreach edge (x, y) in E if (x, y) ∈ EC do */ /* edges in the input stream from C */ /* Initiate a pass over E, for all components in parallel 3 4 5 if x and y are within the same tree in TC \ T (cid:48)C then Continue; Add (x, y) to HC; Maintain-DFS(TC, (x, y)); Remove excess edges from HC ; 6 7 end 8 T (cid:48)C ← Top k levels of TC ; 9 if par(rC) (cid:54)= φ then Add (rC, par(rC)) to T ; 10 Add T (cid:48)C to T ; 11 foreach tree τ ∈ TC \ T (cid:48)C do v ← root(τ ); /* Let Cv be component containing v in C \ T (cid:48)C par(v) ← Parent of v in TC; Compute-DFS-Faster(Cv,TC(v),v): 12 13 14 15 end /* non-tree edges in TC \ T (cid:48)C */ /* vertices v with 0 ≤ level ≤ k − 1 */ */ 25
1908.01956
1
1908
2019-08-06T04:56:46
Parallel Batch-Dynamic Graphs: Algorithms and Lower Bounds
[ "cs.DS" ]
In this paper we study the problem of dynamically maintaining graph properties under batches of edge insertions and deletions in the massively parallel model of computation. In this setting, the graph is stored on a number of machines, each having space strongly sublinear with respect to the number of vertices, that is, $n^\epsilon$ for some constant $0 < \epsilon < 1$. Our goal is to handle batches of updates and queries where the data for each batch fits onto one machine in constant rounds of parallel computation, as well as to reduce the total communication between the machines. This objective corresponds to the gradual buildup of databases over time, while the goal of obtaining constant rounds of communication for problems in the static setting has been elusive for problems as simple as undirected graph connectivity. We give an algorithm for dynamic graph connectivity in this setting with constant communication rounds and communication cost almost linear in terms of the batch size. Our techniques combine a new graph contraction technique, an independent random sample extractor from correlated samples, as well as distributed data structures supporting parallel updates and queries in batches. We also illustrate the power of dynamic algorithms in the MPC model by showing that the batched version of the adaptive connectivity problem is $\mathsf{P}$-complete in the centralized setting, but sub-linear sized batches can be handled in a constant number of rounds. Due to the wide applicability of our approaches, we believe it represents a practically-motivated workaround to the current difficulties in designing more efficient massively parallel static graph algorithms.
cs.DS
cs
Parallel Batch-Dynamic Graphs: Algorithms and Lower Bounds David Durfee LinkedIn Laxman Dhulipala CMU Janardhan Kulkarni Microsoft Research [email protected] [email protected] [email protected] Richard Peng Georgia Tech Saurabh Sawlani Georgia Tech [email protected] [email protected] Xiaorui Sun University of Illinois at Chicago [email protected] Abstract In this paper we study the problem of dynamically maintaining graph properties under batches of edge insertions and deletions in the massively parallel model of computation. In this setting, the graph is stored on a number of machines, each having space strongly sublinear with respect to the number of vertices, that is, nǫ for some constant 0 < ǫ < 1. Our goal is to handle batches of updates and queries where the data for each batch fits onto one machine in constant rounds of parallel computation, as well as to reduce the total communication between the machines. This objective corresponds to the gradual buildup of databases over time, while the goal of obtaining constant rounds of communication for problems in the static setting has been elusive for problems as simple as undirected graph connectivity. We give an algorithm for dynamic graph connectivity in this setting with constant communi- cation rounds and communication cost almost linear in terms of the batch size. Our techniques combine a new graph contraction technique, an independent random sample extractor from cor- related samples, as well as distributed data structures supporting parallel updates and queries in batches. We also illustrate the power of dynamic algorithms in the MPC model by showing that the batched version of the adaptive connectivity problem is P-complete in the centralized setting, but sub-linear sized batches can be handled in a constant number of rounds. Due to the wide applicability of our approaches, we believe it represents a practically-motivated workaround to the current difficulties in designing more efficient massively parallel static graph algorithms. 9 1 0 2 g u A 6 ] S D . s c [ 1 v 6 5 9 1 0 . 8 0 9 1 : v i X r a 1 Introduction Parallel computation frameworks and storage systems, such as MapReduce, Hadoop and Spark, have been proven to be highly effective methods for representing and analyzing the massive datasets that appear in the world today. Due to the importance of this new class of systems, models of parallel computation capturing the power of such systems have been increasingly studied in re- cent years, with the Massively Parallel Computation (MPC) model [KSV10] now serving as the canonical model. In recent years the MPC model has seen the development of algorithms for fun- damental problems, including clustering [EIM11, BMV+12, BBLM14, YV18], connectivity prob- lems [RMCS13, KLM+14, ASS+18, ASW19, ASZ19], optimization [MKSK13, EN15, BENW16], dynamic programming [IMS17, BBD+18], to name several as well as many other fundamental graph and optimization problems [BKV12, ANOY14, KMVV15, AG18, AK17, Ass17, ASS+18, BFU18, C LM+18, LMW18, Ona18, ABB+19, ACK19, AKZ19, BDE+19, BHH19, GKMS18, GKU19, GU19, HSS19]. Perhaps the main goal in these algorithms has been solving the problems in a constant number of communication rounds while minimizing the total communication in a round. Obtaining low round-complexity is well motivated due to the high cost of a communication round in practice, which is often between minutes and hours [KSV10]. Furthermore, since communication between processors tends to be much more costly than local computation, ensuring low communication per- round is also an important criteria for evaluating algorithms in the MPC model [SASU13, BKS13]. Perhaps surprisingly, many natural problems such as dynamic programming [IMS17] and sub- modular maximization [BENW16] can in fact be solved or approximated in a constant number of communication rounds in MPC model. However, despite considerable effort, we are still far from obtaining constant-round algorithms for many natural problems in the MPC setting where the space-per-machine is restricted to be sublinear in the number of vertices in the graph (this setting is arguably the most reasonable modeling choice, since real-world graphs can have tril- lions of vertices). For example, no constant round algorithms are known for a problem as simple as connectivity in an undirected graph, where the current best bound is O(log n) rounds in gen- eral [KSV10, RMCS13, KLM+14, ASS+18, LMW18, ASW19]. Other examples include a O(√log n) round algorithm for approximate graph matching [Ona18, GU19], and a O(√log log n)-round algo- rithm for (∆+1) vertex coloring [CFG+19]. Even distinguishing between a single cycle of size n and two cycles of size n/2 has been conjectured to require Ω(log n) rounds [KSV10, RMCS13, KLM+14, RVW18, YV18, GKU19, IM19]. Based on this conjecture, recent studies have shown that several other graph related problems, such as maximum matching, vertex cover, maximum independent set and single-linkage clustering cannot be solved in a constant number of rounds [YV18, GKU19]. On the other hand, most large-scale databases are not formed by a single atomic snapshot, but form rather gradually through an accretion of updates. Real world examples of this include the construction of social networks [LZY10], the accumulation of log files [HI15], or even the gradual change of the Internet itself [DG08, KTF09, MAB+10]. In each of these examples, the database is gradually formed over a period of months, if not years, of updates, each of which is significantly smaller than the whole database. It is often the case that the updates are grouped together, and are periodically processed by the database as a batch. Furthermore, it is not uncommon to periodically re-index the data structure to handle a large number of queries between sets of updates. In this paper, motivated by the gradual change in real-world datasets through batches of up- dates, we consider the problem of maintaining graph properties in dynamically changing graphs in the MPC model. Our objective is to maintain the graph property for batches of updates, while achieving a constant number of rounds of computation in addition to also minimizing the total communication between machines in a given round. Specifically, we initiate the study of parallel batch-dynamic graph problems in MPC, in which 1 an update contains a number of mixed edge insertions and deletions. We believe that batch- dynamic algorithms in MPC capture the aforementioned real world examples of gradually changing databases, and provide an efficient distributed solution when the size of the update is large compared to single update dynamic algorithms. We note that a similar model for dynamic graph problems in MPC was recently studied by Italiano et al. [ILMP19]. However, they focus on the scenario where every update only contains a single edge insertion or deletion. Parallel batch-dynamic algorithms were also recently studied in the shared-memory setting by Tseng et al. [TDB19] for the forest- connectivity problem and Acar et al. [AABD19] for dynamic graph connectivity. However, the depth of these algorithms is at least Ω(log n), and it is not immediately clear whether these results can be extended to low (constant) round-complexity batch-dynamic algorithms in the MPC setting. We also study the power of dynamic algorithms in the MPC setting by considering a natural "semi-online" version of the connectivity problem which we call adaptive connectivity. We show that the adaptive connectivity problem is P-complete, and therefore in some sense inherently sequential, at least in the centralized setting. In contrast to this lower bound in the centralized setting, we show that in the MPC model there is a batch-dynamic algorithm that can process adaptive batches with size proportional to the space per-machine in a constant number of rounds. Note that such an algorithm in the centralized setting (even one that ran in slightly sublinear depth per batch) would imply an algorithm for the Circuit Value Problem with polynomial speedup, thus solving a longstanding open problem in the parallel complexity landscape. 1.1 Our Results Since graph connectivity proves to be an effective representative for the aforementioned difficulty of graph problems in the MPC model, the focus of this paper is studying graph connectivity and adaptive graph connectivity in the batch-dynamic MPC model. Graph Connectivity The dynamic connectivity problem is to determine if a given pair of vertices belongs to same connected component in the graph as the graph undergoes (batches of) edge insertions and deletions. The dynamic connectivity algorithm developed in this paper is based on a hierarchical partitioning scheme that requires a more intricate incorporation of sketching based data structures for the sequential setting. Not only does our scheme allow us to achieve a constant number of rounds, but it also allows us to achieve a total communication bound that is linear with respect to the batch size with only an additional no(1) factor. Theorem 1.1. In the MPC model with memory per machine s = eO(nǫ) we can maintain a dynamic undirected graph on m edges which, for constants δ, α, and integer k such that k·nα+δ·polylog(n) ≤ s, can handle the following operations with high probability: 1. A batch of up to k edge insertions/deletions, using O(1/(δα)) rounds. 2. Query up to k pairs of vertices for 1-edge-connectivity, using O(1/α) rounds. Furthermore, the total communication for handling a batch of k operations is eO(knα+δ), and the total space used across all machines is eO(m). Adaptive Connectivity and Lower-Bounds in the Batch-Dynamic MPC Model In the adaptive connectivity problem, we are given a sequence of query/update pairs. The problem is to process each query/update pair in order, where each query determines whether or not a given pair 2 of vertices belongs to the same connected component of the graph, and applies the corresponding dynamic update to the graph if the query succeeds. We obtain the following corollary by applying our batch-dynamic connectivity algorithm, Theorem 1.1. Corollary 1.2. In the MPC model with memory per machine s = eO(nǫ) we can maintain a dynamic undirected graph on m edges which for constants δ, α, and integer k such that k·nα+δ·polylog(n) ≤ s can handle the following operation with high probability: 1. An adaptive batch of up to k (query, edge insertions/deletions) pairs, using O(1/(δα)) rounds. Furthermore, the total communication for handling a batch of k operations is eO(knα+δ), and the total space used across all machines is eO(m). We also provide a lower-bound for the adaptive connectivity problem in the centralized setting, showing that the problem is P-complete under NC1 reduction. P-completeness is a standard notion of parallel hardness [KRS90, GHR+95, BM96]. As a consequence of our reduction, we show that the adaptive connectivity algorithm does not admit a parallel algorithm in the centralized setting with polynomial speedup, unless the (Topologically-Ordered) Circuit Value Problem admits a parallel algorithm with polynomial speedup, which is a long-standing open problem in parallel complexity literature. Theorem 1.3. The adaptive connectivity problem is P-complete under NC1 reductions. By observing that our reduction, and the NC1 reductions proving the hardness for the Circuit Value Problem can be done in O(1) rounds of MPC, we have the following corollary in the MPC setting. Corollary 1.4. In the MPC model with memory per machine s = eO(nǫ) for some constant ǫ, if adaptive connectivity on a sequence of size O(n) can be solved in O(k) rounds, then every problem in P can be solved in O(k) rounds. 1.2 Batch-Dynamic MPC Model In this section, we first introduce the massively parallel computation (MPC) model, followed by the batch-dynamic MPC model which is the main focus of this paper. Massively Parallel Computation (MPC) Model. The Massively Parallel Computation (MPC) model is a widely accepted theoretical model for parallel computation [KSV10]. Here, the in- put graph G has n vertices and at most m edges at any given instant. We are given p proces- sors/machines, each with local memory for storage s = eΘ(m/p).1 Note that we usually assume m1−δ ≥ p ≥ mδ, for some δ > 0. This is because the model is relevant only when the number of machines and the local memory per machine are significantly smaller than the size of the input. The computation in the MPC model proceeds via rounds. Initially, the input data is distributed across the processors arbitrarily. During each round, each processor runs a polynomial-time al- gorithm on the data which it contains locally. Between rounds, each machine receives at most µ amount of data from other machines. The total data received by all machines between any two rounds is termed as the communication cost. Note that no computation can occur between rounds, and equivalently, no communication can occur during a round. 1Throughout this paper, eΘ and eO hide polylogarithmic terms in the size of the input. 3 The aim for our algorithms in this model is twofold. Firstly and most importantly, we want to minimize the number of rounds required for our algorithm, since this cost is the major bottleneck of massively parallel algorithms in practice. Ideally, we would want this number to be as low as O(1). Secondly, we want to decrease the maximum communication cost over all rounds, since the costs of communication between processors in practice are massive in comparison to local computation. Batch-Dynamic MPC Model. At a high-level, our model works as follows. Similar to recent works by Acar et al. [AABD19] and Tseng et al. [TDB19], we assume that the graph undergoes batches of insertions and deletions, and in the initial round of each computation, an update or query batch is distributed to an arbitrary machine. The underlying computational model used is the MPC model, and assume that space per machine is strongly sublinear with respect to the number of vertices of the graph, that is, O(nα) for some constant 0 < α < 1. More formally, we assume there are two kinds of operations in a batch: 1. Update: A set of edge insertions/deletions of size up to k. 2. Query: A set of graph property queries of size up to k. For every batch of updates, the algorithm needs to properly maintain the graph according to the edge insertions/deletions such that the algorithm can accurately answer a batch of queries at any instant. We believe that considering batches of updates and queries most closely relates to practice where often multiple updates occur in the examined network before another query is made. Furthermore, in the MPC model there is a distinction between a batch of updates and a single update, unlike the standard model, because it is possible for the batch update to be made in parallel, and handling batch updates or queries is as efficient as handling a single update or query, especially in terms of the number of communication rounds. We use two criteria to measure the efficiency of parallel dynamic algorithms: the number of com- munication rounds and the total communication between different machines. Note that massively parallel algorithms for static problems are often most concerned with communication rounds. In contrast, we also optimize the total communication in the dynamic setting, since the total commu- nication becomes a bottleneck for practice when overall data size is very huge, especially when the update is much smaller than the total information of the graph. Ideally, we want to handle batches of updates and queries in constant communication rounds and sublinear total communication with respect to the number of vertices in the graph. The key algorithmic difference between the dynamic model we introduce here and the MPC model is that we can decide how to partition the input into processors as updates occur to the graph. Dynamic problems in the MPC model were studied in the very recent paper by Italiano et al. [ILMP19]. Their result only explicitly considers the single update case. In the batch-dynamic scenario, the result of [ILMP19] generalizes but has higher dependencies on batch sizes in both number of rounds and total communication.Our incorporation of graph sketching, fast contraction, and batch search trees are all critical for obtaining our optimized dependencies on batch sizes. 1.3 Our Techniques In this section we give in-depth discussion of the primary techniques used to achieve the results presented in the previous section. 4 Connectivity Without loss of generality, we assume that the batch of updates is either only edge insertions or only edge deletions. For a mixed update batch with both insertions and deletions, we can simply handle the edge deletions first, and then the edge insertions. In case the same edge is being inserted and deleted, we simply eliminate both operations. Similar to previous results on dynamic connectivity [Fre85, GI92, HK99, HDLT01, AGM12, KKM13, GKKT15, NS17, Wul17, NSW17], we maintain a maximal spanning forest. This forest encodes the connectivity information in the graph, and more importantly, undergoes few changes per update to the graph. Specifically: 1. An insert can cause at most two trees in F to be joined to form a single tree. 2. A delete may split a tree into two, but if there exists another edge between these two resulting trees, they should then be connected together to ensure that the forest is maximal. Our dynamic trees data structure adapts the recently developed parallel batch-dynamic data structure for maintaining a maximal spanning forest in the shared-memory setting by Tseng et al. [TDB19] to the MPC model. Specifically, [TDB19] give a parallel batch-dynamic algorithm that runs in O(log n) depth w.h.p. to insert k new edges to the spanning forest, to remove k existing edges in the spanning forest, or to query the IDs of the spanning tree containing the given k vertices. We show that the data structure can be modified to achieve O(1/α) round-complexity and O(k·nα) communication for any small constant α satisfying k · nα · polylog(n) ≤ s in the MPC setting. In addition, if we associate with each vertex a key of length ℓkey, then we can query and update a batch of k key values in O(1/α) round-complexity and O(k · ℓkey·) communication. With a parallel batch-dynamic data structure to maintain a maximal spanning forest, a batch of edge insertions or edge queries for the dynamic connectivity problem can be handled in O(1/α) round-complexity and O(k· nα) communication for any constant α. Our strategy for insertions and queries is similar to the dynamic connectivity algorithm of Italiano et al. [ILMP19]: A set of edge queries can be handled by querying the IDs of the spanning tree of all the vertices involved. Two vertices are in the same connected component if and only if their IDs are equal. To process a batch of edge insertions, we maintain the maximal spanning forest by first identifying the set of edges in the given batch that join different spanning trees without creating cycles using ID queries, and then inserting these edges to the spanning forest, by linking their respective trees. Handling a set of edge deletions, however, is more complex. This is because if some spanning forest edges are removed, then we need to find replacement edges which are in the graph, but previously not in the spanning forest, that can be added to the spanning forest without creating cycles. To facilitate this, we incorporate developments in sketching based sequential data structures for dynamic connectivity [AGM12, KKM13]. To construct a sketch of parameter 0 < p < 1 for a graph, we first independently sample every edge of the graph with probability p, and then set the sketch for each vertex to be the XOR of the IDs for all the sampled edges which are incident to the vertex. A sketch has the property that for any subset of vertices, the XOR of the sketches of these vertices equals to the XOR of the IDs for all the sampled edges leaving the vertex subset. In particular, if there is only a single sampled edge leaving the vertex subset, then the XOR of the sketches of these vertices equals to the ID of the edge leaving the vertex subset. The high level idea of [AGM12, KKM13] is to use sketches for each current connected compo- nent to sample previous non-tree edges going out of the connected component using sketches with different parameters, and use these edges to merge connected components that are separated after 5 deleting some tree edges. We visualize this process by representing each connected component as a vertex in a multigraph, and finding a replacement non-tree edge between the two components as the process of merging these two vertices. At first glance, it seems like we can translate this approach to the MPC model by storing all the sketches for each connected component in a single machine. However, directly translating such a data structure leads to either polylog(n) commu- nication rounds or Ω(m) total communication per update batch. To see this, let us look at some intuitive ideas to adapt this data structure to the MPC model, and provide some insight into why they have certain limitations: 1. Sketch on the original graph: For this case, once we use the sketch to sample an edge going out of a given connected component, we only know the ID of the two vertices of the edge, but not the two connected components the edge connects. Obtaining the information about which connected components the endpoints belong to requires communication, because a single machine cannot store the connected component ID of each vertex in the graph. Hence, to contract all the connected components using sampled edges for each connected component, we need one round of communication. Since we may need to reconnect as many as k connected components (k is the number of deletions, i.e., the batch size), this approach could possibly require log k = Θ(log n) communication rounds. 2. Sketch on the contracted graph where every connected component is contracted to a single vertex: To do this, each edge needs to know which connected components its endpoints belong to. If we split a connected component into several new connected com- ponents after deleting some tree edges, the edges whose vertices previously belong to same connected component may now belong to different connected components. To let each edge know which connected components its endpoints belong to, we need to broadcast the map- ping between vertices and connected components to all the related edges. Hence, the total communication can be as large as Ω(m). To further illustrate this difficulty via an example, consider the scenario that the current maximal spanning forest is a path of n vertices, and a batch of k edge deletions break the path into k + 1 short paths. In this case, almost all the vertices change their connected component IDs. In order to find edges previously not in the maximal spanning forest to link these k + 1 path, every edge needs to know if the two vertices of the edge belong to same connected component or not, and to do this, the update of connected component ID for vertices of every edge requires Ω(m) communication. The high level idea of our solution is to speed up the "contraction" process such that constant iterations suffice to shrink all the connected components into a single vertex. To do this, sampling eO(1) edges leaving each connected component in each iterations (as previous work) is not enough, because of the existence of low conductance graph. Hence, we need to sample a much larger number of edges leaving each connected component. Following this intuition, we prove a fast contraction lemma which shows that picking nα edges out of each component finds all connecting non-tree edges between components within O(1/α) iterations. However, a complication that arises with the aforementioned fast contraction lemma is that it requires the edges leaving a component to be independently sampled. But the edges sampled by a single sketch are correlated. This correlation comes from the fact that a sketch outputs an edge leaving a connected component if and only if there is only one sampled edge leaving that connected component. To address this issue, we construct an independent sample extractor to identify enough edges that are eventually sampled independently based on the sketches and show that these edges are enough to simulate the independent sampling process required by the fast contraction lemma. 6 We discuss these two ideas in depth below. In the rest of this section, we assume without loss of generality that every current connected component is contracted into a single vertex, since the sampled edges are canceled under the XOR operation for sketches. Fast Contraction Lemma. We first define a random process for edge sampling (which we term ContractionSampling ) in Definition 1.5. The underlying motivation for such a definition is that the edges obtained from the sketch are not independently sampled. So, we tweak the sampling process via an independent sample extractor, which can then produce edges which obey the random process ContractionSampling . Before discussing this independent sample extractor, we will first outline how edges sampled using ContractionSampling suffice for fast contraction. Definition 1.5 (ContractionSampling process). The random process ContractionSampling for a multigraph G = (V, E) and an integer k is defined as follows: each vertex v independently draws tv samples Sv,1, Sv,2, . . . Sv,tv for some integer tv ≥ k such that 1. the outcome of each Sv,i can be an either an edge incident to v or ⊥; 2. for every edge e incident to vertex v, d G(v) (cid:19) . Pr[Sv,i = e] ≥ Ω(cid:18) k log2 n tvXi=1 We show that in each connected component, if we contract edges sampled by the Contrac- tionSampling process, the number of edges remaining reduces by a polynomial factor with high probability by taking k = poly(n). Lemma 1.6. Consider the following contraction scheme starting with a multigraph G(V, E) on n vertices and m < poly(n) (multi) edges: For a fixed integer k, 1. let E′ be a set of edges sampled by the ContractionSampling process; 2. contract vertices belonging to same connected component of graph G′ = (V, E′) into a new graph G⋆ = (V ⋆, E⋆) as follows: each vertex of V ⋆ represents a connected component in the sampled graph G′ = (V, E′), and there is an edge between two vertices x, y ∈ V ⋆ iff there is an edge in G between the components corresponding to x and y, with edge multiplicity equal to the sum of multiplicity of edges in G between the components corresponding to x and y. Then the resultant graph has at most eO(mk−1/3) (multi) edges with high probability. Based on Lemma 1.6, if we iteratively apply the ContractionSampling process with k = nα and shrink connected components using sampled edges into a single vertex, then every connected component of the multigraph becomes a singleton vertex in O(1/α) rounds with high probability. Lemma 1.6 can be shown using a straightforward argument for simple graphs. However, in the case of multigraphs (our graphs are multigraphs because there can be more than one edge between two components), this argument is not as easy. It is possible that for a connected component C1, a large number of edges leaving C1 will go to another connected component C2. Hence, in one round, the sampled nδ edges leaving C1 may all go to C2. From this perspective, we cannot use a simple degree-based counting argument to show that every connected component merges with at least nδ other connected components if it connected to at least nδ other connected components. To deal with parallel edges, and to prove that the contraction occurs in constant, rather than O(log n) rounds, we make use of a more combinatorial analysis. Before giving some intuition about this proof, we define some useful terminology. 7 Definition 1.7 (Conductance). Given a graph G(V, E) and a subset of vertices S ⊆ V , the conductance of S w.r.t. G is defined as φG(S) def= min S ′⊆S E(S′, S \ S′) minnPu∈S ′ d G(u),Pu∈S\S ′ d G(u)o . The conductance of a graph is a measure of how "well-knit" a graph is. Such graphs are of consequence to us because the more well-knit the graph is, the faster it contracts into a singleton vertex. We use the expander decomposition lemma from [ST11], which says that any connected multigraph G can be partitioned into such subgraphs. Lemma 1.8 ([ST11], Section 7.1.). Given a parameter k > 0, any graph G with n vertices and m edges can be partitioned into groups of vertices S1, S2, . . . such that • the conductance of each Si is at least 1/k; • the number of edges between the Si's is at most O(m log n/k). For each such "well-knit" subgraph H to collapse in one round of sampling, the sampled edges in H must form a spanning subgraph of H. One way to achieve this is to generate a spectral sparsifier of H [SS11] - which can be obtained by sampling each edge with a probability at least O(log n) times its effective resistance. The effective resistance of an edge is the amount of current that would pass through it when unit voltage difference is applied across its end points, which is a measure of how important it is to the subgraph being well-knit. As the last piece of the puzzle, we show that the edges sampled by the ContractionSampling process do satisfy the required sampling constraint to produce a spectral sparsifier of H. Since each such subgraph collapses, Lemma 1.8 also tells us that only a small fraction of edges are leftover in G, as claimed in Lemma 1.6. It is important to note that although we introduce sophisticated tools such as expander parti- tioning and spectral sparsifiers, these tools are only used in the proof and not in the actual algorithm to find replacement edges. From Sketches to Independent Samples. On a high level, our idea to achieve fast contraction is based on using O(k · polylog(n)) independent sketches. However, we cannot directly claim that these sketches simulate a ContractionSampling procedure, as required by the fast contraction lemma (Lemma 1.6). This is because ContractionSampling requires the edges being sampled independently. Instead, each sketch as given by [AGM12, KKM13] gives a set of edges are constructed as follows: 1. Pick each edge independently with probability p, where p is the parameter of the sketch. 2. For each vertex which has exact one sampled edge incident to it, output the sampled incident edge. The second step means the samples picked out of two vertices are correlated. Given a vertex v, let Ev be the random variable for the edge picked in Step 2 of above sketch construction process. Consider an example with two adjacent vertices v1 and v2. If the outcome of Ev1 is the edge v1v2, then the outcome of Ev2 cannot be an edge other than v1v2. Hence two random variables Ev1 and Ev2 are correlated. This issue is a direct side-effect of the faster contraction procedure. Previous uses of sketching only needs to find one edge leaving per component, which suffices for O(log n) rounds. However, 8 our goal is to terminate in a constant number of rounds. This means we need to claim much larger connected components among the sampled edges. For this purpose, we need independence because most results on independence between edges require some correlation between the edges picked. Instead, we show that each sketch still generates a large number of independent edge samples. That is, while all the samples generated by a copy of the sketch are dependent on each other, a sufficiently large subset of it is in fact, independent. Furthermore, observe that contractions can only make more progress when more edges are considered. So it suffices to show that this particular subset we choose makes enough progress. Formally, we prove the following lemma. Lemma 1.9. Given an integer k and a multigraph G of n vertices, O(k log3 n) independent sketches simulates a ContractionSampling process. Furthermore, for every edge sampled by the Contraction- Sampling process, there exists a sketch and a vertex such that the value of the sketch on the vertex is exactly the ID of that edge. Our starting observation is that for a bipartite graph, sketching process gives independent edge samples for vertices from the same side: For a bipartite graph (A, B), the process of sampling edges, and picking all edges incident to degree one vertices of A satisfies the property that all the edges picked are independent. To extend this observation to general graph, we consider a bipartition of the graph, (A, B), and view the random sampling of edges from the sketch as a two-step process: 1. First, we sample all edges within each bipartition (A, A) and (B, B). 2. Then we sample the (A, B) edges independently. After first step, we remove vertices from A that have some sampled edges incident to. The second step gives a set of edges, from which we keep ones incident to some degree one vertices from A. Based on the observation of bipartite graph, the edges kept in the second step are independent (condition on the outcome of the first step). To bound the probability of picking an edge crossing the bipartition, we will first lower bound the probability that the incident vertex from A remains after the first step, and then check that the second step on the bipartite graph is equivalent to an independent process on the involved edges. The overall lower bound on the probability of an edge picked then follows from combining the probability of an edge being picked in one of these processes with the probability that the corresponding vertices remain after the first step and the initial pruning of vertices. With this probability estimation, we show that O(k · polylogn) independent sketches are enough to boost the probability of picking the edge to the required lower bound by the ContractionSampling process. At the end, we show that O(log n) random bipartition of the graph is enough to make sure that every edge appears in at least one of the bipartition, and then Lemma 1.9 follows. Adaptive Connectivity and Lower-Bounds in the Batch-Dynamic MPC Model The adaptive connectivity problem is the "semi-online" version of the connectivity problem where the entire adaptive batch of operations is given to the algorithm in advance, but the algorithm must apply the query/update pairs in the batch in order, that is each pair on the graph defined by applying the prefix of updates before it. We note that the problem is closely related to offline dy- namic problems, for example for offline dynamic minimum spanning tree and connectivity [Epp94]. The main difference is that in the offline problem the updates (edge insertions/deletions) are not adaptive, and are therefore not conditionally run based on the queries. We also note here that every problem that admits a static NC algorithm also admits an NC algorithm for the offline variant of 9 the problem. The idea is to run, in parallel for each query, the static algorithm on the input graph unioned with the prefix of the updates occuring before the query. Assuming the static algorithm is in NC, this gives a NC offline algorithm (note that obtaining work-efficient parallel offline algorithms for problems like minimum spanning tree and connectivity is an interesting problem that we are not aware of any results for). Compared to this positive result in the setting without adaptivity, the situation is very different once the updates are allowed to adaptively depend on the results of the previous query, since the simple black-box reduction given for the offline setting above is no longer possible. In particular, we show the following lower bound for the adaptive connectivity problem which holds in the centralized setting: the adaptive connectivity problem is P-complete, that is unless P = NC, there is no NC algorithm for the problem. The adaptive connectivity problem is clearly in P since we can just run a sequential dynamic connectivity algorithm to solve it. To prove the hardness result, we give a low- depth reduction from the Circuit Value Problem (CVP), one of the canonical P-complete problems. The idea is to take the gates in the circuit in some topological-order (note that the version of CVP where the gates are topologically ordered is also P-complete), and transform the evaluation of the circuit into the execution of an adaptive sequence of connectivity queries. We give an NC1 reduction which evaluates a circuit using adaptive connectivity queries as follows. The reduction maintains that all gates that evaluate to true are contained in a single connected component connected to some root vertex, r. Then, to determine whether the next gate in the topological order, g = ga∧ gb, evaluates to true the reduction runs a connectivity query testing whether the vertices corresponding to ga and gb are connected in the current graph, and adds an edge (g, r), thereby including it in the connected component of true gates if the query is true. Similarly, we reduce evaluating g = ga ∨ gb gates to two queries, which check whether ga (gb) is reachable and add an edge from (g, r) in either case if so. A g = ¬ga gate is handled almost similarly, except that the query checks whether ga is disconnected from s. Given the topological ordering of the circuit, generating the sequence of adaptive queries can be done in O(log n) depth and therefore the reduction works in NC1. In contrast, in the MPC setting, we show that we can achieve O(1) rounds for adaptive batches with size proportional to the space per machine. Our algorithm for adaptive connectivity follows naturally from our batch-dynamic connectivity algorithm based on the following idea: we assume that every edge deletion in the batch actually occurs, and compute a set of replacement edges in G for the (speculatively) deleted edges. Computing the replacement edges can be done in the same round-complexity and communication cost as a static batch of deletions using Theorem 1.1. Since the number of replacement edges is at most O(k) = O(s), all of the replacements can be sent to a single machine, which then simulates the sequential adaptive algorithm on the graph induced by vertices affected by the batch in a single round. We note that the upper-bound in MPC does not contradict the P-completeness result, although achieving a similar result for the depth of adaptive connectivity in the centralized setting for batches of size O(s) = O(nǫ) would be extremely surprising since it would imply a polynomial-time algorithm for the (Topologically Ordered) Circuit Value Problem with sub-linear depth and therefore polynomial speedup. 1.4 Organization Section 2 describes the full version of the high level idea for graph connectivity. Section 3 contains a discussion of the data structure we used to handle batch-update in constant round. Section 4 gives a proof of our fast contraction lemma. Section 5 gives a proof of our independent sample extractor from sketches. Section 6 presents the algorithm for graph connectivity and the correctness proof. Lastly, we present our lower and upper bounds for the adaptive connectivity problem in Section 7. 10 2 1-Edge-Connectivity In this section we prove our result for 1-edge-connectivity, restated here: Theorem 1.1. In the MPC model with memory per machine s = eO(nǫ) we can maintain a dynamic undirected graph on m edges which, for constants δ, α, and integer k such that k·nα+δ·polylog(n) ≤ s, can handle the following operations with high probability: 1. A batch of up to k edge insertions/deletions, using O(1/(δα)) rounds. 2. Query up to k pairs of vertices for 1-edge-connectivity, using O(1/α) rounds. Furthermore, the total communication for handling a batch of k operations is eO(knα+δ), and the total space used across all machines is eO(m). Parallel Batch-Dynamic Data Structure. Similar to previous results on dynamic connectiv- ity [Fre85, GI92, HK99, HDLT01, AGM12, KKM13, GKKT15, NS17, Wul17, NSW17], our data structure is based on maintaining a maximal spanning forest, which we denote using F . Formally, we define it as follows. Definition 2.1 (Maximal spanning forest). Given a graph G, we call F a maximal spanning forest of G if F is a subgraph of G consisting of a spanning tree in every connected component of G. Note that this is more specific than a spanning forest, which is simply a spanning subgraph of G containing no cycles. This forest encodes the connectivity information in the graph, and more importantly, undergoes few changes per update to the graph. Specifically: 1. An insert can cause at most two trees in F to be joined to form a single tree. 2. A delete may split a tree into two, but if there exists another edge between these two resulting trees, they should then be connected together to ensure that the forest is maximal. Note that aside from identifying an edge between two trees formed when deleting an edge from some tree, all other operations are tree operations. Specifically, in the static case, these operations can be entirely encapsulated via tree data structures such as dynamic trees [ST83] or Top-Trees [AHLT05]. We start by ensuring that such building blocks also exist in the MPC setting. In Section 3, we show that a forest can also be maintained efficiently in O(1) rounds and low communication in the MPC model (Theorem 2.2). In this section, we build upon this data structure and show how to process updates and 1-edge-connectivity queries while maintaining a maximal spanning forest of G. Let T (v) indicate the tree (component) in F to which a vertex v belongs. We define the component ID of v as the as the ID of this T (v). We represent the trees in the forest using the following data structure. We describe the data structure in more detail in Section 3. Theorem 2.2. In the MPC model with memory per machine s = eO(nǫ) for some constant ǫ, for any constant 0 < α < 1 and a key length ℓkey such that nα · ℓkey ≤ s, we can maintain a dynamic forest F in space eO(n), with each vertex v augmented with a key x v of length ℓkey(x v is a summable element from a semi-group), • Link(u1v1, . . . , ukvk): Insert a batch of k edges into F . • Cut(u1v1, . . . , ukvk): Delete k edges from F . • ID(v1, . . . , vk): Given a batch of k vertices, return their component IDs in F . 11 • UpdateKey((v1,bx ′ 1), . . . , (vk,bx ′ • GetKey(v1, . . . , vk): For each i, return the value of ~x vi. • ComponentSum(v1 . . . , vk): Given a set of k vertices, compute for each vi, k)): For each i, update the value of ~x vi to ~x ′ i. Xw : w∈T (vi) x w under the provided semi-group operation. Moreover, all operations can be performed in O(1/α) rounds and • Link and Cut operations can be performed in eO(k · ℓkey · nα) communication per round, • ID can be performed in eO(k) communication per round, • UpdateKey, GetKey and ComponentSum operations can be performed in eO(k · ℓkey · nα) communication per round. Edge insertions and queries can be handled by above dynamic data structure: for a set of edge queries, we use the ID operation to query the ID of all the vertices. Two vertices are in the same connected component if and only if their IDs are same. For a batch of edge insertions, we maintain the spanning forest by first identifying all the inserted edges that join different connected components using ID operation, and then using the Link operations to put these edges into the forest. The process of handling a set of edge deletions is more complex. This is because, if some spanning forest edges are removed, then we need to find replacement edges in the graph which were previously not in the spanning forest, but can be added to maintain the desired spanning forest. To do this, we use the the augmentation of tree nodes with x u and the ComponentSum operation to accommodate each vertex storing "sketches" in order to find replacement edges upon deletions. Sketching Based Approach Overview. At the core of the Delete operation is an adaptation of the sketching based approach for finding replacement edges by Ahn et al. [AGM12] and Kapron et al. [KKM13]. Since we rely on these sketches heavily, we go into some detail about the approach here. Without loss of generality, we assume every edge has a unique O(log n)-bit ID, which is generated by a random function on the two vertices involved. For a vertex v, this scheme sets x v to the XOR of the edge IDs of all the edges incident to v (which we assume to be integers): x v For a subset of vertices S, we define ∂(S) as the set of edges with exactly one endpoint in S. Then, taking the total XOR over all the vertices in S gives (by associativity of XOR) Mv∈S x v =Mv∈S Me : e∼v e =Me∈E e = Me∈∂(S) e. So if there is only one edge leaving S, this XOR over all vertices in S returns precisely the ID of this edge. To address the case with multiple edges crossing a cut, Ahn et al. [AGM12] and Kapron et al. [KKM13] sampled multiple subsets of edges at different rates to ensure that no matter how def e. = Me : e∼v  Mv : v∈S,e∼v 12 many edges are actually crossing, with high probability one sample picks only one of them. This redundancy does not cause issues because the edge query procedures also serve as a way to remove false positives. We formally define the sketch as follows: Definition 2.3 (Graph Sketch from [AGM12, KKM13]). A sketch with parameter p of a graph G = (V, E) is defined as follows: 1. Every edge is sampled independently with probability p. Let E′ be the set of sampled edges. 2. For every vertex v ∈ V , let x v def= Me∈E ′ : e∼v e. We say a sketch generates edge e if there exists a vertex v such that x v = e. The variant of this sketching result that we will use is stated as follows in Lemma 2.4. Lemma 2.4 (Graph Sketch from [AGM12, KKM13]). Assume we maintain a sketch for each of p ∈ {1, 1/2, 1/4, . . . , 1/2⌈2 ln⌉−1}, and let ~x v denote the sketches on vertex v, • upon insertion/deletion of an edge, we can maintain all ~x v's in O(log2 n) update time; • for any subset of vertices S, from the value ~x v, Mv∈S we can compute O(log n) edge IDs so that for any edge e ∈ ∂(S), the probability that one of these IDs is e is at least 1/∂(S). Fast Contraction Lemma. As XOR is a semi-group operation, we can use these sketches in conjunction with the dynamic forest data structure given in Theorem 2.2 to check whether a tree resulting from an edge deletion has any outgoing edges. In particular, O(log n) copies of this sketch structure allow us to find a replacement edge with high probability after deleting a single edge in O(1/ǫ) rounds and O(nǫ) total communication. Our algorithm then essentially "contracts" these edges found, thus essentially reconnecting temporarily disconnected trees in F . However, a straightforward generalization of the above method to deleting a batch of k edges results in an overhead of Θ(log k), because it's possible that this random contraction process may take up to Θ(log k) rounds. Consider for example a length k path: if we pick O(1) random edges from each vertex, then each edge on the path is omitted by both of its endpoints with constant probability. So in the case of a path, we only reduce the number of remaining edges by a constant factor in expectation, leading to a total of about Θ(log k) rounds. With our assumption of s = O(nǫ) and queries arriving in batches of k ≤ s, this will lead to a round count that's up to Θ(log n). We address this with a natural modification motivated by the path example: instead of keeping O(log n) independent copies of the sketching data structures, we keep eO(nδ) copies, for some small constant δ, which enables us to sample nδ random edges leaving each connected component at any point. As this process only deals with edges leaving connected components, we can also view these connected components as individual vertices. The overall algorithm then becomes a repeated contraction process on a multi-graph: at each round, each vertex picks nδ random edges incident to it, and contracts the graph along all picked edges. Our key structural result is a lemma that shows that this process terminates in O(1/δ) rounds with high probability. To formally state the lemma, we first define a random process of sampling edges in a graph. 13 Definition 1.5 (ContractionSampling process). The random process ContractionSampling for a multigraph G = (V, E) and an integer k is defined as follows: each vertex v independently draws tv samples Sv,1, Sv,2, . . . Sv,tv for some integer tv ≥ k such that 1. the outcome of each Sv,i can be an either an edge incident to v or ⊥; 2. for every edge e incident to vertex v, Pr[Sv,i = e] ≥ Ω(cid:18) k log2 n d G(v) (cid:19) . tvXi=1 Below is our structural lemma, which we prove in Section 4. Lemma 1.6. Consider the following contraction scheme starting with a multigraph G(V, E) on n vertices and m < poly(n) (multi) edges: For a fixed integer k, 1. let E′ be a set of edges sampled by the ContractionSampling process; 2. contract vertices belonging to same connected component of graph G′ = (V, E′) into a new graph G⋆ = (V ⋆, E⋆) as follows: each vertex of V ⋆ represents a connected component in the sampled graph G′ = (V, E′), and there is an edge between two vertices x, y ∈ V ⋆ iff there is an edge in G between the components corresponding to x and y, with edge multiplicity equal to the sum of multiplicity of edges in G between the components corresponding to x and y. Then the resultant graph has at most eO(mk−1/3) (multi) edges with high probability. Independent Sample Extractor From Sketches. On a high level, our idea is to use O(k · polylog(n)) independent sketches to simulate the required ContractionSampling process, and then apply Lemma 1.6. However, we cannot do this naively, because ContractionSampling requires the edges being sampled independently, whereas the sketch from Lemma 2.4 does not satisfy this property. Recall that the sketch generated at a vertex v can correspond to an edge (say uv) if no other edge adjacent to v was sampled in the same sketch. Consider an example where two edges uv and uw are sampled by the graph. This means that no other edge from v or w can be sampled in that same sketch, implying the sampling process is not independent. We would like to remark that this is not an issue for previous sketching based connectivity [AGM12, KKM13]), because in [AGM12, KKM13], each time, any current con- algorithms (e.g. nected component only needs to find an arbitrary edge leaving the connected component. In this way, if most current connected components find an arbitrary edge leaving the component, then after contracting connected components using sampled edges, the total number of connected com- ponents reduce by at least a constant factor. In this way, after O(log n) iterations, each connected component shrinks into a single vertex. But in our case the contraction lemma requires edges being sampled independently. Hence, we cannot directly apply Lemma 1.6 on sketches. To get around this issue, we construct an independent edge sample extractor from the sketches and show that with high probability, this extractor will extract a set of independent edge samples that are equivalent to being sampled from a ContractionSampling random process, as required by Lemma 1.6. One key observation is that if the graph is bipartite, then sketch values on the vertices from one side of the bipartite graph are independent, because every edge sample is only related to one sketch value. The high level idea of our extractor is then to extract bipartite graphs from sketches, such that each edge appears in many bipartite graphs with high probability. For each sketch, consider the following random process: 14 1. For each vertex of the graph, randomly assign a color of red or yellow. Then we can construct a bipartite graph with red vertices on one side, yellow vertices on the other side, and an edge is in the bipartite graph if and only if the color of one endpoint is red, and the other endpoint is yellow. Note that this step is not related to the process of sketch construction. 2. Independently sample every edge not in the bipartite graph with probability same as the probability of sampling used in the sketch. 3. For each red vertex whose incident edges were not sampled in Step 2, independently sample every edge incident to the vertex in the bipartite graph with probability same as that used in the sketch. 4. Choose all the edges sampled in Step 3 which do not share a red vertex with any other sampled edge. We show that the edges obtained in Step 4 are sampled independently (conditioned on the outcome of Step 2). Another way to see this independence is to partition all the independent random variables in the process of generating all the sketches into two random processes R1 and R2 (based on the bipartite graph generated for each sketch) such that R1 and R2 are independent and simulate a required ContractionSampling process in the following sense: 1. After implementing the random process R1 and based on the outcome of R1, define a Con- tractionSampling process as required by Lemma 1.6. 2. The random process R2 simulates the defined ContractionSampling process in the following sense: there is a partition of the independent random variables of random process R2 into groups satisfying the following conditions: (a) There is a bijection between groups and random variables of the ContractionSampling process. (b) For each group, there exists a function of the random variables in the group such that the function is equivalent to the corresponding random variable of the ContractionSampling process. Furthermore, all the edges sampled by the defined ContractionSampling process are generated by the sketches (meaning that there exist a vertex and a sketch such that sketch on the vertex is the ID of the sampled edge). In this way, we argue that the edges generated by all the sketches contains a set of edges generated by a ContractionSampling process so that we can apply Lemma 1.6. More formally, we define the simulation between two random processes as follows. Definition 2.5. We say a set of independent random variables E1, E2, . . . , Et simulates another set of independent random variables F1, F2, . . . , Fℓ if there exists a set of random variables U ⊆ {E1, E2, . . . , Et} such that with constant probability, after fixing all the random variables of U , there are ℓ subsets T1, T2, . . . Tℓ ⊆ {E1, E2, . . . , Et} \ U (depending on the outcome of the random process for U ) satisfying 1. T1, . . . , Tℓ are mutually disjoint. 2. For every i ∈ [ℓ], there exist a random variable which is a function of random variables in Ti, denoted as fi(Ti), such that f (Ti) is same to the random variable Fi. 15 And we show that the process of generating O(k log3 n) sketches simulates the random process in the contraction lemma. Lemma 1.9. Given an integer k and a multigraph G of n vertices, O(k log3 n) independent sketches simulates a ContractionSampling process. Furthermore, for every edge sampled by the Contraction- Sampling process, there exists a sketch and a vertex such that the value of the sketch on the vertex is exactly the ID of that edge. 3 Batch-Dynamic Trees in MPC In this section we describe a simple batch-dynamic tree data structure in the MPC setting. Our data structure is based on a recently developed parallel batch-dynamic data structure in the shared- memory setting [TDB19]. Specifically, Tseng et al. give a parallel batch-dynamic tree that supports batches of k links, cuts, and queries for the representative of a vertex in O(k log(n/k + 1)) expected work and O(log n) depth w.h.p. Their batch-dynamic trees data structure represents each tree in the forest using an Euler-tour Tree (ETT) structure [HK99], in which each tree is represented as the cyclic sequence of its Euler tour, broken at an arbitrary point. The underlying sequence rep- resentation is a concurrent skip list implementation that supports batch join and split operations. Augmented trees are obtained by augmenting the underlying sequence representation. We show that the structure can be modified to achieve low round-complexity and communication in the MPC setting. We now define the batch-dynamic trees interface and describe how to extend the data structure into the MPC setting. The main difficulty encountered in the shared-memory setting is that nodes are stored in separate memory locations and refer to each other via pointers. Therefore, when traversing the skip list at some level i to find a node's ancestor at level i + 1, it requires traversing all nodes that occur before (or after) it at level i. We show that by changing the sampling probability to 1/nǫ, we can ensure that each level has size O(nǫ), each level can be stored within a single machine and thus this search can be done within a single round. The new sampling probability also ensures that the number of levels is O(1/ǫ) w.h.p. which is important for achieving our bounds. Batch-Dynamic Trees Interface. A batch-parallel dynamic trees data structure represents a forest G = (V, E) as it undergoes batches of links, cuts, and connectivity queries. A Link links two trees in the forest. A Cut deletes an edge from the forest, breaking one tree into two trees. A ID query returns a unique representative for the tree containing a vertex. Formally the data structure supports the following operations: • Link({{u1, v1} , . . . ,{uk, vk}}) takes an array of edges and adds them to the graph G. The input edges must not create a cycle in G. • Cut({{u1, v1} , . . . ,{uk, vk}}) takes an array of edges and removes them from the graph G. • ID({u1, . . . , uk}) takes an array of vertex ids and returns an array containing the represen- tative of each ui. The representative of a node, r(u) is a unique value s.t. r(u) = r(v) iff u and v are in the same tree. Furthermore, the trees can be augmented with values ranging over a domain D, and a commu- tative function f : D2 → D. The trees can be made to support queries for the sum according to f on arbitrary subtrees, but for the purposes of this paper queries over the entire tree suffice. The interface is extended with the following two primitives: 16 • UpdateKey({{u1, x1} , . . . ,{uk, xk}}) takes an array of vertex id, value pairs and updates the value for ui to xi. • GetKey({u1, . . . , uk}) takes an array of vertex ids and returns an array containing the value of each ui, xi. • ComponentSum({u1, . . . , uk}) takes an array of vertex ids and returns an array containing Pw:w∈T (ui) xw where T (ui) is the tree containing ui, xw is the value for node w, and the sum is computed according to f . We show the following theorem in this section. Let δ be a parameter controlling the size of the keys stored at each node and let α be a parameter controlling the size of the blocks stored internally within a single machine. Theorem 3.1. Let δ be a parameter controlling the keysize, and α be a constant controlling the blocksize s.t. δ + α < ǫ and 0 < α. Then, in the MPC model with memory per machine s = O(nǫ) there is an augmented batch-dynamic tree data structure in MPC that supports batches of up to k Link, Cut, ID, UpdateKey, GetKey, and ComponentSum operations in O(1/α) rounds per operation w.h.p. where k = O(nα). Furthermore, the batch operations cost • O(knδ) communication per round w.h.p. for UpdateKey, GetKey, and ComponentSum • O(knδnα) communication per round w.h.p. for Link and Cut and • O(k) communication per round for ID. 3.1 Augmented Batch-Dynamic Sequences in MPC In order to obtain Theorem 3.1, we first show how to implement augmented batch-dynamic se- quences in few rounds of MPC. In particular, we will show the following lemma. Note that achieving a similar bound on the round-complexity for large batches, e.g., batches of size O(n), would disprove the 2-cycle conjecture. We refer to [TDB19] for the precise definition of the sequence interface. Lemma 3.2. Let δ be a parameter controlling the keysize, and α be a constant controlling the blocksize s.t. δ + α < ǫ and 0 < α. Then, in the MPC model with memory per machine s = O(nǫ) there is an augmented batch-dynamic sequence data structure in MPC that supports batches of up to k Split, Join, ID, UpdateKey, GetKey, and SequenceSum operations in O(1/α) rounds per operation w.h.p. where k = O(nα). Furthermore, the batch operations cost • O(knδ) communication per round w.h.p. for UpdateKey, GetKey, and SequenceSum • O(knδnα) communication per round w.h.p. for Split and Join and • O(k) communication per round for ID. For the sake of simplicity we discuss the case where δ = 0 and 0 < α < ǫ (i.e. values that fit within a constant number of machine words), and describe how to generalize the idea to larger values at the end of the sub-section. Sequence Data Structure. As in Tseng et al. [TDB19] we use a skip list as the underlying sequence data structure. Instead of sampling nodes with constant probability to join the next level, 17 we sample them with probability 1/nα. It is easy to see that this ensures that the number of levels in the list is O(1/α) w.h.p. since α is a constant greater than 0. Furthermore, the largest number of nodes in some level i that "see" a node at level i + 1 as their left or right ancestor is O(nα log n) w.h.p. We say that the left (right) block of a node belonging to level i are all of its siblings to the left (right) before the next level i + 1 node. As previously discussed, in the MPC setting we should intuitively try to exploit the locality afforded by the MPC model to store the blocks (contiguous segments of a level) on a single machine. Since each block fits within a single machine w.h.p., operations within a block can be done in 1 round, and since there are O(1/α) levels, the total round complexity will be O(1/α) as desired. Since the ideas and data structure are similar to Tseng et al. [TDB19], we only provide the high-level details and refer the reader to their paper for pseudocode. Join. The join operation takes a batch of pairs of sequence elements to join, where each pair contains the rightmost element of one sequence and the leftmost element of another sequence. We process the levels one by one. Consider a join of (ri, li). We scan the blocks for ri and li to find their left and right ancestors, and join them. In the subsequent round, these ancestors take the place of (ri, li) and we recursively continue until all levels are processed. Observe that at each level, for each join we process we may create a new block, with O(nα) elements. In summary, the overall round-complexity of the operation is O(1/α) w.h.p., and the amount of communication needed is O(knα) w.h.p. Split. The split operation takes a batch of sequence elements at which to split the sequences they belong to by deleting the edge to the right of the element. We process the levels one by one. Consider a split at a node ei. On each level, we first find the left and right ancestors as in case of join. We then send all nodes splitting a given block to the machine storing that block, and split it in a single round. Then, we recurse on the next level. If the left and right ancestors of ei were connected, we call split on the left right ancestor at the next level. The overall round-complexity is O(1/α) w.h.p., and the amount of communication needed is O(knα) w.h.p. Augmentation and Other Operations. Each node in the skip list stores an augmented value which represents the sum of all augmented values of elements in the block for which it is a left ancestor. Note that these values are affected when performing splits and joins above, but are easily updated within the same round-complexity by computing the correct sum within any block that was modified and updating its left ancestor. SetKey operations, which take a batch of sequence elements and update the augmented values at these nodes can be handled similarly in the same round-complexity as join and split above. Note that this structure supports efficient range queries over the augmented value, but for the purposes of this paper, returning the augmented value for an entire sequence (SequenceSum) is sufficient, and this can clearly be done in O(1/α) rounds and O(k) communication. Similarly, returning a representative node (ID) for the sequence can be done in O(1/α) rounds w.h.p. and O(k) communication by finding the top-most level for the sequence containing the queried node, and returning the lexicographically first element in this block. Handling Large Values. Note that if the values have super-constant size, i.e. size O(nδ) for some δ s.t. δ + α < ǫ we can recover similar bounds as follows. Since the blocks have size O(nα) and each value has size O(nδ) the overall size of the block is O(nα+δ) = O(nǫ). Therefore blocks can still be stored within a single machine without changing the sampling parameter. Storing large values affects the bounds as follows. First, the communication cost of performing splits and joins grows by a factor of O(nδ) due to the increased block size. Second, the cost of getting, setting, and performing a component sum grows by a factor of O(nδ) as well, since k values are returned, each of size O(nδ). Therefore the communication cost of all operations other than finding a represntative increase by a multiplicative O(nδ) factor. Finally, note that the bounds on round-complexity are 18 not affected, since nodes are still sampled with probability 1/nα. 3.2 Augmented Batch-Dynamic Trees in MPC We now show how to implement augmented batch-dynamic trees in MPC, finishing the proof of Theorem 3.1. We focus on the case where δ = 0 (we are storing constant size words) and explain how the bounds are affected for larger δ. Forest Data Structure. We represent trees in the forest by storing the Euler tour of the tree in a sequence data structure. If the forest is augmented under some domain D and commutative function f : D2 → D, we apply this augmentation to the underlying sequences. Link. Given a batch of link operations (which are guaranteed to be acyclic) we update the forest structure as follows. Consider a link (ui, vi). We first perform a batch split operation on the underlying sequences at all ui, vi for 1 ≤ i ≤ k, which splits the Euler tours of the underlying trees at the nodes incident to a link. Next, we send all of the updates to a single machine to establish the order in which joins incident to a single vertex are carried out. Finally, we perform a batch join operation using the order found in the previous round to link together multiple joins incident to a single vertex. Since we perform a constant number of batch-sequence operations with batches of size O(k), the overall round complexity is O(1/α) w.h.p. by our bounds on sequences, and the overall communication is O(knα) w.h.p. Cut. Given a batch of cut operations, we update the forest structure as follows. Consider a cut (ui, vi). The idea is to splice this edge out of the Euler tour by splitting before and after (ui, vi) and (vi, ui) in the tour. The tour is then repaired by joining the neighbors of these nodes appropriately. In the case of batch cuts, we perform a batch split for the step above. For batch cuts, notice that many edges incident to a node could be deleted, and therefore we may need to traverse a sequence of deleted edges before finding the next neighbor to join. We handle this by sending all deleted edges and their neighbors to a single machine, which determines which nodes should be joined together to repair the tour. Finally, we repair the tours by performing a batch join operation. Since we perform a constant number of batch-sequence operations with batches of size O(k) the overall round complexity is O(1/α) w.h.p. by our bounds on sequences, and the overall communication is O(knα) w.h.p. Augmentation, Other Operations and Large Values. Note that the underlying sequences handle updating the augmented values, and that updating the augmented values at some nodes trivially maps to an set call on the underlying sequences. Therefore the bounds for GetKey and SetKey are identical to that of sequences. Similarly, the bounds for ID are identical to that of the sequence structure. For super-constant size values, the bounds are affected exactly as in the case for augmented sequences with large values. The communication costs for all operations other than ID grow by an O(nδ) factor and the round-complexity is unchanged. This completes the proof of Theorem 3.1. 4 Fast Contraction The aim of this section is to prove Lemma 1.6, which is pivotal in proving the correctness of the main algorithm from Section 2. Lemma 1.6 is important in proving that our algorithm can find replacement edges in the span- ning forest quickly in the event of a batch of edges being deleted. The proof idea is as follows. We first show that there exists a partitioning of the vertices such that the edges within the partitions collapse in a single iteration. 19 To do this, we first need to define a few terms relating to expansion criteria of a graph. Let d G(v) denote the degree of a vertex v in graph G. For edges in a partition to collapse in a single iteration, we need each partition to be sufficiently "well-knit". This property can be quantified using the notion of conductance. Definition 1.7 (Conductance). Given a graph G(V, E) and a subset of vertices S ⊆ V , the conductance of S w.r.t. G is defined as φG(S) def = min S ′⊆S E(S′, S \ S′) minnPu∈S ′ d G(u),Pu∈S\S ′ d G(u)o . The following lemma proves the existence of a partitioning such that each partition has high conductance. Lemma 1.8 ([ST11], Section 7.1.). Given a parameter k > 0, any graph G with n vertices and m edges can be partitioned into groups of vertices S1, S2, . . . such that • the conductance of each Si is at least 1/k; • the number of edges between the Si's is at most O(m log n/k). Now that we have a suitable partitioning, we want to find a strategy of picking edges in a decentralized fashion such that all edges within a partition collapse with high probability. One way to do this is to pick edges which form a spectral sparsifier of Si. The following lemma by Spielman and Srivastava [SS11] helps in this regard: we use more recent interpretations of it that take sampling dependencies into account. Lemma 4.1 ([SS11, Tro12, KLP16, KPPS17]). On a graph G, let E1 . . . Ek be independent random distributions over edges such that the total probability of an edge e being picked is at least Ω(log n) times its effective resistance, then a random sample from H = E1 + E2 + . . . + Ek is connected with high probability. Now we want to show that the random process ContractionSampling (Defintion 1.5) where each vertex draws k log2 n samples actually satisfies the property mentioned in Lemma 4.1, i.e., all edges are picked with probability at least their effective resistance. To show this, we first need the following inequality given by Cheeger. Lemma 4.2 ([AM85]). Given a graph G, for any subset of vertices S with conductance φ, we have λ2(cid:16)D −1/2 S LS D −1/2 S (cid:17) ≥ φ2, 1 2 where LS is the Laplacian matrix of the subgraph of G induced by S. DS is the diagonal matrix with degrees of vertices in S. Lemma 4.3. Let S be a subset of vertices of G such that φG(S) ≥ 1/2α1/3 for some α > 0. For an edge e = uv, where u, v ∈ S, the effective resistance of e measured in S, ERS (e), satisfies ERS (e) ≤ α(cid:18) 1 d G(u) + 1 d G(v)(cid:19) . 20 Proof. From Lemma 4.2, we get that LS (cid:23) 1 2 (φG(S))2 Π⊥~1S DS Π⊥~1S . Using this, along with the definition ERS(u, v) def = χT uv L† Sχuv, gives us that ERS(u, v) ≤ 1 2 (φG(S))−2(cid:18) 1 d S(u) + 1 d S(v)(cid:19) . (1) We have for any subset S′ ⊆ S that: E(S′, S \ S′) minnPu∈S ′ d G(u),Pu∈S\S ′ d G(u)o ≥ φG(S). Furthermore, for every vertex v ∈ S, we get d S(v) d G(v) ≥ φG(S), which when substituted into Equation 1 gives (φG(S))−3(cid:18) 1 Substituting for φG(S) ≥ 1/2α1/3 completes the proof. ERS (u, v) ≤ 1 2 d G(u) + 1 d G(v)(cid:19) . Now, we have enough ammunition to prove Lemma 1.6. Proof of Lemma 1.6. From Lemma 1.8, we know that our graph can be partitioned into expanders with conductance at least Ω(k−1/3 log1/3 n). Now, let S be one such partition and let e = uv be an edge contained in S. From the definition of the random process in Definition 1.5, we know that for an edge uv, the probability that it is sampled by either u or v is at least k log2 n(cid:18) 1 d G(u) + 1 d G(v)(cid:19) ≥ ERS (uv) · Ω(log n), where the inequality follows from Lemma 4.3. Since each such edge uv is chosen with probability greater than Ω(log n) times its effective resistance w.r.t. S, from Lemma 4.1, we know that the edges chosen within S are connected with high probability. Thus, we are left with the edges between the partitions, the number of which is bounded by O(m log4/3 n · k−1/3) edges, 5 Independent Sample Extractor From Sketches In this section, we prove Lemma 1.9, which shows how we extract independent edge samples from the sketches, which are inherently dependent. We start with the definition of an induced bipartite multigraph. Given a multigraph G = (V, E) of n vertices, we say B = (R, Y, EB) is an induced bipartite multigraph of G if V is partitioned into two disjoint vertex sets R and Y and an edge of G belongs to EB if and only if the edge contains one vertex from R and one vertex from Y . For a fixed multigraph G and an induced bipartite multigraph B of G, we conceptually divide the process of generating a sketch with parameter p into two phases: 21 Phase 1. Independently sample each edge not in the bipartite graph with probability p. Phase 2. Independently sample each edge in the bipartite graph with probability p. Lemma 5.1. Given a multigraph G = (V, E) and an induced bipartite multigraph B = (R, Y, EB) n , O(k log2 n) independent sketches simulate the following random of G, with probability at least 1− 1 process: Every vertex v ∈ R is associated with tv independent variables Sv,1, Sv,2, . . . Sv,tv for some integer tv ≥ k satisfying 1. The outcome of each Sv,i can be an edge incident to v or ⊥. 2. For every edge e incident to vertex v, Pr[Sv,i = e] ≥ 2k d G(v) . tvXi=1 Furthermore, for every edge sampled by the above random process, there exists a sketch and a vertex such that the value of the sketch on the vertex equals the edge ID. Proof. Assume for p ∈(cid:26) 1 2 , 1 4 , . . . , 1 2⌈log2 n⌉ + 1(cid:27) , that there are t = 8000k log n sketches corresponding to each p. Let pi denote the parameter of i-th sketch. Let m denote the number of edges in G. We use Ei,e1, Ei,e2, . . . , Ei,em to denote the random variables denoting edges being present in the i-th sketch. Hence, the random process of generating all the sketches corresponds to sampling random variables {Ei,ej}i∈[t],j∈[m]. Let U ⊆ {Ei,ej}i∈[t],j∈[m] be the set of random variables in Phase 1 of all the sketches. We define another random process based on the outcome of U as follows: For i-th sketch and any vertex v ∈ R, if no edge incident to vertex v was sampled in Phase 1 of the i-th sketch, then we define a new independent random variable Sv,i such that if e is in graph B and incident to vertex v, and Pr[Sv,i = e] = pi(1 − pi)d B (v)−1 Pr[Sv,i = ⊥] = 1 − pi(1 − pi)d B (v)−1 · d B(v). If at least one edge incident to vertex v was sampled in Phase 1 of the i-th sketch, then we do not define random variable Sv,i. Now, for an arbitrary v ∈ R, let def = pv 1 d G(v)⌉+1 . 2⌈log2 For a single sketch with parameter pv, the probability that no edge incident to v was sampled in Phase 1 is (1 − pv)d G(v)−d B (v) ≥ (1 − pv)d G(v) > 0.1. 22 Applying Chernoff bound, with probability 1 − 1 n3 , at least 80k random variables Sv,i are defined such that with probability pv(1 − pv)d B (v)−1, Sv,j equals exactly equals edge e for every e in B incident to v. Hence, for any edge e incident to v in graph B, we have XSv,i:Sv,i is defined Pr[Sv,i = e] ≥ 80k · pv(1 − pv)d B(v)−1 > 80k · pv(1 − pv)d G(v) ≥ 2k d G(v) . By union bound, with probability 1 − 1 random process. n , all the defined random variables Sv,j's form the required In the rest of this proof, we show that Phase 2 of each sketch simulates the generation of the defined random varibles {Sv,i}v∈R,i∈[t]. For every defined random variable Sv,i, we let Tv,i = {Ei,e : e ∈ B and is incident to vertex v} denote the random variable for the i-th sketch which corresponds to edges incident to vertex v in graph B. It is easy to verify that Tv,i ∩ U = ∅. Furthermore, all the Tv,i's are mutually disjoint. We define a function Ei,e′ = 1 and Ei,e = 1 Ei,e′ 6= 1. Since all the random variables in Tv,i are independent, we have if PEi,e′ ∈Tv,i ⊥ if PEi,e′ ∈Tv,i fv,i(Tv,i) =(e Pr[fv,i(Tv,i) = e] = pi(1 − pi)d B(v)−1 for any edge e incident to v in B, and Pr[fv,i(Tv,i) = ⊥] = 1 − pi(1 − pi)d B (v)−1 · d B(v). Then the lemma follows. Using the above lemma, we can now prove Lemma 1.9. Proof of Lemma 1.9. We repeat the following process 10 log n times: 1. Every vertex is independently assigned the color red with probability 1/2, or is assigned yellow otherwise. 2. Let R be the vertices with red color and Y be all the vertices with yellow color. Construct the induced bipartite multigraph B = (R, Y, EB), where EB contains all the edges of G with one red vertex and one yellow vertex. By Chernoff bound and union bound, with probability at least 1− 1 n , for every edge e and a vertex v contained by the edge e, there is a sampled bipartite multigraph B = (R, Y, EB) such that v ∈ R and e ∈ EB. Assuming every edge belongs to at least one sampled bipartite graph. For each sampled bipartite multigraph, we assign O(k log2 n) sketches. The lemma follows by applying Lemma 1.9 for every bipartite multigraph and its assigned sketches, 23 6 Connectivity Algorithms and Correctness We give the algorithms for batch edge queries, batch edge insertions, and batch edge deletions and prove the correctness in Section 6.1, Section 6.2 and Section 6.3 respectively. Putting together Lemmas 6.1, 6.3 and 6.2 then gives the overall result as stated in Theorem 1.1. Throughout this section, we will use the batch-dynamic tree data structure discussed in Section 3 to maintain 1. a maximal spanning forest F of the graph, 2. a key ~x v for every vertex v, where ~x v is a vector of eO(nδ) sketch values on vertex v, 3. an edge list data structure which can be used to check if an edge is in the graph given an edge ID. 6.1 Algorithm for Batch Edge Queries Since F is a maximal spanning tree, the query operations are directly provided by calling ID on all involved vertices. Pseudocode of this routine is in Algorithm 6.1. Query((u1, v1), (u2, v2), . . . , (uk, vk)) Input: Pairs of vertices (u1, v1), (u2, v2), . . . , (uk, vk) Output: For each 1 ≤ i ≤ k, yes if ui and vi are connected in G, and no otherwise. 1. Call ID(u1, v1, u2, v2, . . . , uk, vk). 2. For each i, output yes if ui and vi have the same component ID, and no otherwise. Algorithm 6.1: Querying the connectivity between a batch of vertex pairs Lemma 6.1. The algorithm Query (Algorithm 6.1) correctly answers connectivity queries and takes O(1/α) rounds, each with total communication at most eO(k). Proof. The correctness and performance bounds follow from the fact that F is a maximal spanning forest of F and from Theorem 2.2. 6.2 Algorithm for Batch Edge Insertions Given a batch of k edge insertions, we want to identify a subset of edges from the batch that are going to add to F to maintain the invariant that F is a maximal spanning forest. To do this, we use ID operation to find IDs of all the involved vertices in the edge insertion batch. Then we construct a graph Glocal which initially contains all the edges in the edge insertion batch, and then contracts vertices from same connected component of F to a single vertex. Since this graph contains k edges, we can put this graph into a single machine, and compute a spanning forest Flocal of Glocal. We maintain the maximal spanning forest F by adding edges in Flocal to F . We also maintain the edge list data structure by adding inserted edges to the list, and maintain the sketches for the involved vertices by the UpdateKey operation. Pseudocode of the batched insertion routine is in Algorithm 6.2. 24 Insert(u1v1, u2v2, . . . , ukvk) Input: new edges e1 = u1v1, e2 = u2v2, . . . , ek = ukvk. 1. Add all k edges to the edge list data structure. 2. Run GetKey(u1, v1, . . . , uk, vk). 3. For every sketch, sample every inserted edge with probability equal to the parameter of the sketch, and compute the updated key value for vertices ~x ′ u1, ~x ′ v1, . . . , ~x ′ uk , ~x ′ vk . 4. Run UpdateKey((u1, ~x ′ u1), (v1, ~x ′ 5. Run ID({u1, v1, u2, v2 . . . uk, vk}). 6. Using these IDs as vertex labels, construct a graph Glocal among the inserted edges, on a v1), . . . , (uk, ~x ′ uk ), (vk, ~x ′ vk )). local machine. 7. Find a maximal spanning forest Flocal of Glocal locally on this machine. 8. Run Link(E(Flocal)). Algorithm 6.2: Pseudocode for maintaining the data structure upon a batch of insertions. Lemma 6.2. The algorithm Insert in Algorithm 6.2 correctly maintains a maximal spanning forest of G and takes O(1/α) rounds, each with total communication at most eO(knα+δ). Proof. To show the correctness, notice that since we add only a forest on the components as a whole, there is never an edge added between two already connected components. Additionally, since the forest is spanning, we do not throw away any necessary edges. From Theorem 2.2, using GetKey, UpdateKey, ID and Link falls under the claimed bound for rounds and communication, whereas the rest of the steps are performed only locally. 6.3 Algorithm for Batch Edge Deletions Pseudocode of the batched deletion routine is in Algorithm 6.3. Lemma 6.3. The algorithm Delete (Algorithm 6.3) correctly maintains a maximal spanning forest of G and takes O(1/δα) rounds, each with total communication at most eO(knα+δ). Proof. Note that F remains a maximal spanning forest if the deleted edges are from outside of F . So, we only need to deal with the complementary case. Consider some tree T ∈ F , from which we deleted k − 1 edges. T is now separated into k trees, T1, T2, . . . , Tk. We need to show that the algorithm eventually contracts all Ti using the edges stored in the sketches. For this, note that the guarantees of Lemma 1.9 imply that from the eO(nδ) copies of sketches, we can sample edges leaving a group of Tis in ways that meet the requirements of Lemma 1.6. These trees will collapse into singleton vertices in O(1/δ) rounds with high probability by applying Lemma 1.6 iteratively. Thus the result is correct. Steps 1-6 only require O(1/α) rounds of communication, from Theorem 2.2. Step 7 loops O(1/δ) times, and its bottleneck is step 7b, the verification of the locations of the endpoints in the trees. 25 Delete(e1, e2, . . . , ek) Input: edges e1 = u1v1, e2 = u2v2, . . . , ek = ukvk that are currently present in the graph. 1. Update the global edge index structure. 2. Run GetKey(u1, v1, . . . , uk, vk). 3. For every sketch, compute the updated key value ~x ′ u1, v1, . . . , uk, vk by removing the IDs of edges e1, . . . , ek. uk ), (vk, ~x ′ 4. Run UpdateKey((u1, ~x ′ v1), . . . , (uk, ~x ′ u1), (v1, ~x ′ vk )). u1, ~x ′ v1, . . . , ~x ′ uk , ~x ′ vk for vertices 5. Run Cut for all edges that are in the spanning forest. Let u1 . . . ut be representative vertices from the resulting trees 6. Run ComponentSum({u1 . . . ut}) to extract the total XOR values from each of the trees. 7. Repeat O(1/δ) rounds: (a) From the XOR values of the current components, deduce a list of potential replace- ment edges, ER (b) Identify the subset of edges with endpoints between current components given by ID(u1) . . . ID(ut) using a call to Query. (c) Find TR, a maximal spanning forest of the valid replacement edges, via local compu- tation. (d) Link(E(TR)). (e) Update u1 . . . ut and their XOR values, either using another batch of queries, or by a local computation. Algorithm 6.3: Pseudocode for maintaining the data structure upon a batch of deletions. Once again by the guarantees of Theorem 2.2, this takes O(1/α) rounds for each iteration, and at Lastly, we call Link on the edges in ER across various iterations. Since at most k edges are deleted from F , there can only be at most k replacement edges, so the total communication caused most eO(knδ+α) communication per round. by these is eO(knα+δ). 7 Adaptive Connectivity The adaptive connectivity problem is a "semi-online" version of the dynamic connectivity, where we are given a sequence of query/update pairs, and each update (an edge insertion or deletion) is only applied if its corresponding query evaluates to true on the graph resulting from all operations before this pair. We say that the problem is semi-online because although the entire input is known in advance, the algorithm must answer each query taking into account all operations that occur before it. In this section, we show that this natural problem is P-complete under NC1 reductions. In 26 the context of MPC algorithms, our result implies that if there exists an O(1) round low-memory MPC algorithm solving the problem, then every problem in P can be solved in O(1) rounds in the low-memory MPC model. On the positive side, in Subsection 7.2 we give an upper-bound based on the batch-dynamic connectivity algorithm from Section 2, which shows that the adaptive connectivity problem can be solved in O(1) rounds for batches with size proportional to the space per machine. We first give a formal definition of the adaptive connectivity problem. Definition 7.1 (Adaptive Connectivity). The input to the Adaptive Connectivity problem is an input graph G on n vertices, and a sequence of query and update pairs: [(q1, u1), . . . , (qm, um)]. Each query, qi, is of the form Connected(u, v) or ¬Connected(u, v), and each update, ui, is either an edge insertion (Insert(e = (u, v))) or an edge deletion (Delete(e = (u, v))). The problem is to run each qi, i ∈ [1, m] on the graph Gi, and apply ui to Gi to produce Gi+1 if and only if qi = true. The output of the problem is qm. 7.1 A Lower Bound for Adaptive Connectivity We now prove our lower-bound, showing that the adaptive connectivity problem is P-complete. The idea is that we can use the adaptivity in the problem to encode a circuit evaluation problem, which are well known to be hard for P. Our reduction will be from the Circuit Value Problem, defined below: Definition 7.2 (Circuit Value Problem). The input to the Circuit Value Problem is an encoding of a circuit C consisting of binary-fanin ∧ (and) and ∨ (or) gates, and unary-fanin ¬ (not) gates, defined over n boolean inputs x1, . . . , xn with truth assignments. Additionally there is a single specified output gate, y. The problem is to evaluate C and emit the value of the output gate, y. Our reduction makes use of a topological ordering of the input circuit. A topological ordering of a DAG (e.g., circuit) is a numbering ρ of its vertices so that for every directed edge (u, v), ρ(u) < ρ(v). Although we can topologically order a DAG in NC2, there is no known NC1 algorithm for the problem, which would mean that our reduction would use a (stronger) NC2 reduction. To bypass this issue, we use the fact that the Topologically-Ordered Circuit Value Problem is still P- complete [GHR+95]. Therefore, in what follows we assume that the circuit value problem instance provided to the reduction is topologically ordered. Theorem 1.3. The adaptive connectivity problem is P-complete under NC1 reductions. Proof. The adaptive connectivity problem is clearly contained in P since a trivial O(poly(m)) work algorithm can first run a connectivity query using BFS or DFS on Gi to check whether the vertices are connected or not, and then apply the update ui depending on the result of the query. For hardness we give a reduction from the Topologically-Ordered Circuit Value Problem. We assume the circuit C, is equipped with the ability to query for the i-th gate in the specified topological order in O(1) time. Let n be the number of variables in the circuit, and k be the number of gates. The reduction builds the initial graph G on n + k + 1 vertices, where there are n vertices corresponding to the variables, k vertices corresponding to the gates, where gate gi corresponds to a vertex vi, and a single distinguished root vertex, r. In the initial graph, each variable that is set to true is connected to r. The reduction constructs a query/update sequence inductively as follows. Consider the i-th gate in the topological ordering of C. 27 • If the gate is of the form gi = ga ∧ gb, we append the following query/update pair to the sequence: (Connected(va, vb), Insert(r, vi)) That is, if the vertex corresponding to gate ga is connected to the vertex corresponding to gate gb in G, then add an edge between the root r and the vertex corresponding to the i-th gate. • Similarly, if the gate is gi = ga ∨ gb, we append the following query/update pairs to the sequence: (Connected(r, va), Insert(r, vi)) (Connected(r, vb), Insert(r, vi)) • Finally, if the gate is of the form gi = ¬ga, we append the following query/update pair to the sequence: (¬Connected(r, va), Insert(r, vi)) In this way a simple proof by induction shows that after executing all query/update pairs in the sequence, the connected component in G containing the root r contains all vertices (gates) that evaluate to true. By making the final query of the form (Connected(r, y), ) where y is the desired output gate, the output of the adaptive connectivity instance returns the answer to the to input circuit. It is easy to see that we can construct the query/update sequence in NC1 as we can access the i-th gate independently in parallel, and each gate can be made to emit exactly two update/query pairs (for ∧ and ¬ gates we can simply insert a second noop query/update pair). We have the following corollary in the MPC setting. Corollary 1.4. In the MPC model with memory per machine s = eO(nǫ) for some constant ǫ, if adaptive connectivity on a sequence of size O(n) can be solved in O(k) rounds, then every problem in P can be solved in O(k) rounds. Proof. The proof follows by observing that each of the NC1 reductions starting with the reduction from an arbitrary polynomial-time Turing machine, to the Topologically-Ordered Circuit Value Problem can be carried out in O(1) rounds of MPC. Therefore, by applying these reductions, we can transform any problem in P to an adaptive connectivity instance in O(1) rounds of MPC. Remark 7.3. We note that there are no known polynomial-time algorithms for the (Topologically- Ordered) Circuit Value Problem with depth O(n1−ǫ), i.e., achieving polynomial speedup, and that finding such an algorithm has been a longstanding open question in parallel complexity the- ory [VS86, Con94, Rei97]. A parallel algorithm for adaptive connectivity in the centralized set- ting achieving even slightly sub-linear depth, e.g., O(nǫ−c) depth to process adaptive batches of size O(nǫ) for any constants ǫ, c > 0 would imply by our reduction above an algorithm for the (Topologically-Ordered) Circuit Value Problem with depth O(n1−c), and therefore give an upper- bound with polynomial speedup. 28 Hardness for Other Adaptive Problems. Note that the reduction given above for adaptive connectivity immediately extends to problems related to connectivity, such as directed reachability, and shortest-path problems. For adaptive directed connectivity, when we add an (x, y) edge in the undirected case, we repeat the query twice and add both the x → y and y → x edges. For adaptive unweighted shortest paths, if the queries are of the form DistanceLessThan(u, v, d) then we reduce these queries to connectivity/reachability queries by setting d to an appropriately large value (in the reduction above, setting d to 2 suffices). 7.2 An Upper Bound for Adaptive Connectivity We now show that the static batch-parallel 1-Edge-Connectivity algorithm given in Theorem 1.1 can be used to solve the adaptive connectivity problem. The bounds on the largest batch sizes that the algorithm handle are identical to those in Theorem 1.1. Given an adaptive batch of size k, the idea is to first take all deletion updates in the batch, and "apply" them on G using a modified version of Theorem 1.1. Instead of permanently inserting the newly discovered replacement edges into G, we temporarily insert them to find all replacement edges that exist if all deletions in the adaptive batch actually occur. This can be done by first deleting the edges in the adaptive batch using Theorem 1.1, finding all replacement edges, and then undoing these operations to restore G. The algorithm them collects the adaptive batch, and all replacement edges (which have size at most equal to the size of the adaptive batch) on a single machine, and simulates the sequential adaptive algorithm on the contracted graph corresponding to vertices active in the batch in 1 round. The insertions and deletions that ensue from processing the adaptive batch can be applied in the same bounds as Theorem 1.1. Therefore, we have an algorithm for adaptive connectivity with the following bounds: Corollary 1.2. In the MPC model with memory per machine s = eO(nǫ) we can maintain a dynamic undirected graph on m edges which for constants δ, α, and integer k such that k·nα+δ·polylog(n) ≤ s can handle the following operation with high probability: 1. An adaptive batch of up to k (query, edge insertions/deletions) pairs, using O(1/(δα)) rounds. Furthermore, the total communication for handling a batch of k operations is eO(knα+δ), and the total space used across all machines is eO(m). References [AABD19] Umut A. Acar, Daniel Anderson, Guy E. Blelloch, and Laxman Dhulipala. Parallel batch-dynamic graph connectivity. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pages 381 -- 392, 2019. [ABB+19] Sepehr Assadi, MohammadHossein Bateni, Aaron Bernstein, Vahab Mirrokni, and Cliff Stein. Coresets meet edcs: algorithms for matching and vertex cover on massive graphs. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1616 -- 1635, 2019. [ACK19] [AG18] Sepehr Assadi, Yu Chen, and Sanjeev Khanna. Sublinear algorithms for (∆+ 1) vertex coloring. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 767 -- 786, 2019. Kook Jin Ahn and Sudipto Guha. Access to data and number of iterations: Dual primal algorithms for maximum matching under resource constraints. ACM Transactions on Parallel Computing (TOPC), 4(4):17, 2018. 29 [AGM12] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Analyzing graph structure via linear measurements. In ACM-SIAM symposium on Discrete Algorithms (SODA), pages 459 -- 467, 2012. [AHLT05] Stephen Alstrup, Jacob Holm, Kristian De Lichtenberg, and Mikkel Thorup. Maintain- ing information in fully dynamic trees with top trees. ACM Transactions on Algorithms, 1(2):243 -- 264, 2005. [AK17] [AKZ19] Sepehr Assadi and Sanjeev Khanna. Randomized composable coresets for matching and vertex cover. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pages 3 -- 12, 2017. Sepehr Assadi, Nikolai Karpov, and Qin Zhang. Distributed and streaming linear pro- gramming in low dimensions. In ACM Symposium on Principles of Database Systems (PODS), pages 236 -- 253, 2019. [AM85] Noga Alon and Vitali D Milman. λ1, isoperimetric inequalities for graphs, and super- concentrators. Journal of Combinatorial Theory, Series B, 38(1):73 -- 88, 1985. [ANOY14] Alexandr Andoni, Aleksandar Nikolov, Krzysztof Onak, and Grigory Yaroslavtsev. Par- allel algorithms for geometric graph problems. In ACM Symposium on Theory of Com- puting (STOC), pages 574 -- 583, 2014. [Ass17] Sepehr Assadi. Simple round compression for parallel vertex cover. arXiv preprint arXiv:1709.04599, 2017. [ASS+18] Alexandr Andoni, Zhao Song, Clifford Stein, Zhengyu Wang, and Peilin Zhong. Parallel In IEEE Symposium on Foundations of graph connectivity in log diameter rounds. Computer Science (FOCS), pages 674 -- 685, 2018. [ASW19] Sepehr Assadi, Xiaorui Sun, and Omri Weinstein. Massively parallel algorithms for finding well-connected components in sparse graphs. To appear in ACM Symposium on Principles of Distributed Computing (PODC), 2019. [ASZ19] Alexandr Andoni, Clifford Stein, and Peilin Zhong. Log diameter rounds algorithms for 2-vertex and 2-edge connectivity. arXiv preprint arXiv:1905.00850, 2019. [BBD+18] MohammadHossein Bateni, Soheil Behnezhad, Mahsa Derakhshan, MohammadTaghi Hajiaghayi, and Vahab Mirrokni. Massively parallel dynamic programming on trees. arXiv preprint arXiv:1809.03685, 2018. [BBLM14] MohammadHossein Bateni, Aditya Bhaskara, Silvio Lattanzi, and Vahab Mirrokni. Distributed balanced clustering via mapping coresets. In Advances in Neural Informa- tion Processing Systems, pages 2591 -- 2599, 2014. [BDE+19] Soheil Behnezhad, Laxman Dhulipala, Hossein Esfandiari, Jakub L¸acki, Vahab Mir- rokni, and Warren Schudy. Massively parallel computation via remote memory access. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pages 59 -- 68, 2019. [BENW16] Rafael da Ponte Barbosa, Alina Ene, Huy L Nguyen, and Justin Ward. A new frame- work for distributed submodular maximization. In 2016 IEEE 57th Annual Symposium on Foundations of Computer Science (FOCS), pages 645 -- 654. Ieee, 2016. 30 [BFU18] Sebastian Brandt, Manuela Fischer, and Jara Uitto. Matching and MIS for uniformly sparse graphs in the low-memory MPC model. arXiv preprint arXiv:1807.05374, 2018. [BHH19] Soheil Behnezhad, MohammadTaghi Hajiaghayi, and David G Harris. Exponentially faster massively parallel maximal matching. arXiv preprint arXiv:1901.03744, 2019. [BKS13] Paul Beame, Paraschos Koutris, and Dan Suciu. Communication steps for parallel query processing. In ACM Symposium on Principles of Database Systems (PODS), pages 273 -- 284, 2013. [BKV12] Bahman Bahmani, Ravi Kumar, and Sergei Vassilvitskii. Densest subgraph in stream- ing and mapreduce. Proceedings of the VLDB Endowment, 5(5):454 -- 465, 2012. [BM96] Guy E Blelloch and Bruce M Maggs. Parallel algorithms. ACM Computing Surveys (CSUR), 28(1):51 -- 54, 1996. [BMV+12] Bahman Bahmani, Benjamin Moseley, Andrea Vattani, Ravi Kumar, and Sergei Vas- silvitskii. Scalable k-means++. Proceedings of the VLDB Endowment, 5(7):622 -- 633, 2012. [CFG+19] Yi-Jun Chang, Manuela Fischer, Mohsen Ghaffari, Jara Uitto, and Yufan Zheng. The complexity of (∆ + 1) coloring in congested clique, massively parallel computation, and centralized local computation. To appear in the ACM Symposium on Principles of Distributed Computing (PODC), 2019. [C LM+18] Artur Czumaj, Jakub L¸acki, Aleksander M¸adry, Slobodan Mitrovi´c, Krzysztof Onak, and Piotr Sankowski. Round compression for parallel matching algorithms. In ACM Symposium on Theory of Computing (STOC), pages 471 -- 484, 2018. [Con94] [DG08] [EIM11] [EN15] [Epp94] [Fre85] Anne Condon. A theory of strict P-completeness. Computational Complexity, 4(3):220 -- 241, 1994. Jeffrey Dean and Sanjay Ghemawat. Mapreduce: simplified data processing on large clusters. Communications of the ACM, 51(1):107 -- 113, 2008. Alina Ene, Sungjin Im, and Benjamin Moseley. Fast clustering using mapreduce. In ACM International Conference on Knowledge Discovery and Data Mining (SIGKDD), pages 681 -- 689, 2011. Alina Ene and Huy Nguyen. Random coordinate descent methods for minimizing decomposable submodular functions. In International Conference on Machine Learning (ICML), pages 787 -- 795, 2015. David Eppstein. Offline algorithms for dynamic minimum spanning tree problems. Journal of Algorithms, 17(2):237 -- 250, 1994. Greg N. Frederickson. Data structures for on-line updating of minimum spanning trees, with applications. SIAM J. Comput., 14(4):781 -- 798, 1985. [GHR+95] Raymond Greenlaw, H James Hoover, Walter L Ruzzo, et al. Limits to parallel com- putation: P-completeness theory. Oxford University Press on Demand, 1995. [GI92] Z. Galil and G. Italiano. Fully dynamic algorithms for 2-edge connectivity. SIAM Journal on Computing, 21(6):1047 -- 1069, 1992. 31 [GKKT15] David Gibb, Bruce M. Kapron, Valerie King, and Nolan Thorn. Dynamic graph connectivity with improved worst case update time and sublinear space. CoRR, abs/1509.06464, 2015. Availabel at: http://arxiv.org/abs/1509.06464. [GKMS18] Buddhima Gamlath, Sagar Kale, Slobodan Mitrovi´c, and Ola Svensson. Weighted matchings via unweighted augmentations. arXiv preprint arXiv:1811.02760, 2018. [GKU19] Mohsen Ghaffari, Fabian Kuhn, and Jara Uitto. Conditional hardness results for mas- sively parallel computation from distributed lower bounds. To appear in IEEE Sympo- sium on Foundations of Computer Science (FOCS), 2019. [GU19] Mohsen Ghaffari and Jara Uitto. Sparsifying distributed algorithms with ramifications in massively parallel computation and centralized local computation. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1636 -- 1653, 2019. [HDLT01] Jacob Holm, Kristian De Lichtenberg, and Mikkel Thorup. Poly-logarithmic determin- istic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity. Journal of the ACM, 48(4):723 -- 760, 2001. Announced at STOC'98. [HI15] [HK99] [HSS19] Hemant Hingave and Rasika Ingle. An approach for mapreduce based log analysis using hadoop. In IEEE International Conference on Electronics and Communication Systems (ICECS), pages 1264 -- 1268, 2015. Monika Rauch Henzinger and Valerie King. Randomized fully dynamic graph algo- rithms with polylogarithmic time per operation. J. ACM, 46(4):502 -- 516, 1999. MohammadTaghi Hajiaghayi, Saeed Seddighin, and Xiaorui Sun. Massively parallel approximation algorithms for edit distance and longest common subsequence. In ACM- SIAM Symposium on Discrete Algorithms (SODA), pages 1654 -- 1672, 2019. [ILMP19] Giuseppe F Italiano, Silvio Lattanzi, Vahab S Mirrokni, and Nikos Parotsidis. Dynamic In ACM Symposium on algorithms for the massively parallel computation model. Parallelism in Algorithms and Architectures (SPAA), pages 49 -- 58, 2019. [IM19] [IMS17] Sungjin Im and Benjamin Moseley. A conditional lower bound on graph connectivity in mapreduce. CoRR, abs/1904.08954, 2019. Sungjin Im, Benjamin Moseley, and Xiaorui Sun. Efficient massively parallel methods for dynamic programming. In ACM Symposium on Theory of Computing (STOC), pages 798 -- 811, 2017. [KKM13] Bruce M. Kapron, Valerie King, and Ben Mountjoy. Dynamic graph connectivity in polylogarithmic worst case time. In Annual ACM-SIAM Symposium on Discrete Algo- rithms (SODA), 2013. [KLM+14] Raimondas Kiveris, Silvio Lattanzi, Vahab Mirrokni, Vibhor Rastogi, and Sergei Vas- silvitskii. Connected components in mapreduce and beyond. In ACM Symposium on Cloud Computing (SOCC), pages 1 -- 13, 2014. [KLP16] Ioannis Koutis, Alex Levin, and Richard Peng. Faster spectral sparsification and nu- merical algorithms for SDD matrices. ACM Trans. Algorithms, 12(2):17:1 -- 17:16, 2016. Available at http://arxiv.org/abs/1209.5821. 32 [KMVV15] Ravi Kumar, Benjamin Moseley, Sergei Vassilvitskii, and Andrea Vattani. Fast greedy algorithms in mapreduce and streaming. ACM Transactions on Parallel Computing (TOPC), 2(3):14, 2015. [KPPS17] Rasmus Kyng, Jakub Pachocki, Richard Peng, and Sushant Sachdeva. A framework for analyzing resparsification algorithms. In ACM-SIAM Symposium on Discrete Al- gorithms (SODA), pages 2032 -- 2043, 2017. [KRS90] Clyde P Kruskal, Larry Rudolph, and Marc Snir. A complexity theory of efficient parallel algorithms. Theoretical Computer Science, 71(1):95 -- 132, 1990. [KSV10] [KTF09] Howard Karloff, Siddharth Suri, and Sergei Vassilvitskii. A model of computation for mapreduce. In ACM-SIAM symposium on Discrete Algorithms (SODA), pages 938 -- 948, 2010. U Kang, Charalampos E Tsourakakis, and Christos Faloutsos. Pegasus: A peta-scale graph mining system implementation and observations. In IEEE International Con- ference on Data Mining (ICDM), pages 229 -- 238, 2009. [ LMW18] Jakub L¸acki, Vahab Mirrokni, and Micha l W lodarczyk. Connected components at scale via local contractions. arXiv preprint arXiv:1807.10727, 2018. [LZY10] Guojun Liu, Ming Zhang, and Fei Yan. Large-scale social network analysis based on mapreduce. In IEEE International Conference on Computational Aspects of Social Networks (CASoN), pages 487 -- 490, 2010. [MAB+10] Grzegorz Malewicz, Matthew H Austern, Aart JC Bik, James C Dehnert, Ilan Horn, Naty Leiser, and Grzegorz Czajkowski. Pregel: a system for large-scale graph pro- cessing. In ACM International Conference on Management of Data (SIGMOD), pages 135 -- 146, 2010. [MKSK13] Baharan Mirzasoleiman, Amin Karbasi, Rik Sarkar, and Andreas Krause. Distributed In Identifying representative elements in massive data. submodular maximization: Advances in Neural Information Processing Systems, pages 2049 -- 2057, 2013. [NS17] Danupon Nanongkai and Thatchaphol Saranurak. Dynamic spanning forest with worst- case update time: adaptive, las vegas, and O(n1/2−ǫ)-time. In Symposium on Theory of Computing (STOC), pages 1122 -- 1129, 2017. [NSW17] Danupon Nanongkai, Thatchaphol Saranurak, and Christian Wulff-Nilsen. Dynamic minimum spanning forest with subpolynomial worst-case update time. In Symposium on Foundations of Computer Science (FOCS), pages 950 -- 961, 2017. [Ona18] [Rei97] Krzysztof Onak. Round compression for parallel graph algorithms in strongly sublinear space. arXiv preprint arXiv:1807.08745, 2018. Klaus Reinhardt. Strict sequential P-completeness. In Symposium on Theoretical As- pects of Computer Science (STACS), pages 329 -- 338, 1997. [RMCS13] Vibhor Rastogi, Ashwin Machanavajjhala, Laukik Chitnis, and Anish Das Sarma. Find- ing connected components in map-reduce in logarithmic rounds. In IEEE Conference on Data Engineering (ICDE), pages 50 -- 61, 2013. 33 [RVW18] Tim Roughgarden, Sergei Vassilvitskii, and Joshua R Wang. Shuffles and circuits (on lower bounds for modern parallel computation). Journal of the ACM (JACM), 65(6):41, 2018. [SASU13] Anish Das Sarma, Foto N Afrati, Semih Salihoglu, and Jeffrey D Ullman. Upper and lower bounds on the cost of a map-reduce computation. In Proceedings of the VLDB Endowment, volume 6, pages 277 -- 288, 2013. [SS11] [ST83] [ST11] D. Spielman and N. Srivastava. tances. http://arxiv.org/abs/0803.0929. SIAM Journal on Computing, 40(6):1913 -- 1926, 2011. Graph sparsification by effective resis- Available at Daniel D. Sleator and Robert Endre Tarjan. A data structure for dynamic trees. J. Comput. Syst. Sci., 26(3):362 -- 391, June 1983. D. Spielman and S. Teng. Spectral sparsification of graphs. SIAM Journal on Com- puting, 40(4):981 -- 1025, 2011. Available at http://arxiv.org/abs/0808.4134. [TDB19] Thomas Tseng, Laxman Dhulipala, and Guy Blelloch. Batch-parallel Euler tour trees. Algorithm Engineering and Experiments (ALENEX), pages 92 -- 106, 2019. [Tro12] [VS86] [Wul17] [YV18] Joel A. Tropp. User-friendly tail bounds for sums of random matrices. Found. Comput. Math., 12(4):389 -- 434, August 2012. Available at http://arxiv.org/abs/1004.4389. Jeffrey Scott Vitter and Roger A. Simons. New classes for parallel complexity: A study of unification and other complete problems for P. IEEE Transactions on Computers, (5):403 -- 418, 1986. Christian Wulff-Nilsen. Fully-dynamic minimum spanning forest with improved worst- case update time. In ACM Symposium on Theory of Computing (STOC), pages 1130 -- 1143, 2017. Grigory Yaroslavtsev and Adithya Vadapalli. Massively parallel algorithms and hard- ness for single-linkage clustering under ℓp-distances. In International Conference on Machine Learning (ICML), 2018. 34
1004.5012
1
1004
2010-04-28T12:29:28
Bandwidth and Distortion Revisited
[ "cs.DS" ]
In this paper we merge recent developments on exact algorithms for finding an ordering of vertices of a given graph that minimizes bandwidth (the BANDWIDTH problem) and for finding an embedding of a given graph into a line that minimizes distortion (the DISTORTION problem). For both problems we develop algorithms that work in O(9.363^n) time and polynomial space. For BANDWIDTH, this improves O^*(10^n) algorithm by Feige and Kilian from 2000, for DISTORTION this is the first polynomial space exact algorithm that works in O(c^n) time we are aware of. As a byproduct, we enhance the O(5^{n+o(n)})-time and O^*(2^n)-space algorithm for DISTORTION by Fomin et al. to an algorithm working in O(4.383^n) time and space.
cs.DS
cs
Bandwidth and Distortion Revisited Marek Cygan Marcin Pilipczuk∗ Abstract In this paper we merge recent developments on exact algorithms for finding an ordering of vertices of a given graph that minimizes bandwidth (the BANDWIDTH problem) and for finding an embedding of a given graph into a line that minimizes distortion (the DISTOR- TION problem). For both problems we develop algorithms that work in O(9.363n) time and polynomial space. For BANDWIDTH, this improves O∗(10n) algorithm by Feige and Kilian from 2000, for DISTORTION this is the first polynomial space exact algorithm that works in O(cn) time we are aware of. As a coproduct, we enhance the O(5n+o(n)) -- time and O∗(2n) -- space algorithm for DISTORTION by Fomin et al. to an algorithm working in O(4.383n) time and space. 1 Introduction Recently the NP -- complete BANDWIDTH problem, together with a similar problem of embed- ding a graph into a real line with minimal distortion (called DISTORTION in this paper), attracted some attention from the side of exact (and therefore not polynomial) algorithms. Given a graph G with n vertices, an ordering is a bijective function π : V (G) → {1, 2, . . . , n}. Bandwidth of π is a maximal length of an edge, i.e., bw(π) = maxuv∈E(G) π(u) − π(v). The BANDWIDTH problem, given a graph G and a positive integer b, asks if there exists an ordering of bandwidth at most b. Given a graph G, an embedding of G into a real line is a function π : G → R. For ev- ery pair of distinct vertices u, v ∈ V (G) we define a distortion of u and v by dist(u, v) = π(u) − π(v)/dG(u, v), where dG denotes the distance in the graph G. A contraction and an expansion of π, denoted contr(π) and expan(π) respectively, are the minimal and maximal dis- tortion over all pairs of distinct vertices in V (G). The distortion of π, denoted dist(π), equals to expan(π)/contr(π). The DISTORTION problem, given a graph G and a positive real number d, asks if there exists an embedding with distortion at most d. Note that the distortion of an embed- ding does not change if we change π afinitely, and we can rescale π by 1/contr(π) and obtain π with contraction exactly 1. Therefore, in this paper, we limit ourselves only to embeddings with contraction at least 1 and we optimize the expansion of the embedding, that is, we try to construct embeddings with contraction at least 1 and with expansion at most d. The first non -- trivial exact algorithm for the BANDWIDTH problem was developed by Feige and Kilian in 2000 [6]. It works in polynomial space and O∗(10n) time. Recently we improved the time bound to O∗(5n) [4], O(4.83n) [3] and O∗(20n/2) [5]. However, the cost of the im- provements was exponential space complexity: O∗(2n), O∗(4n), O∗(20n/2) respectively. In ∗Dept. of Mathematics, Computer Science and Mechanics, University of Warsaw, Poland,{cygan,malcin}@mimuw.edu.pl 1 2009 Fomin et al. [9] adopted some ideas from [4] to the DISTORTION problem and obtained a O(5n+o(n)) -- time and O∗(2n) -- space algorithm. It is worth mentioning that the considered problems, although very similar form the exact computation point of view, differ from the point of parameterized computation. The BAND- WIDTH problem is hard for any level of the W hierarchy [2], whereas DISTORTION is fixed pa- rameter tractable where parameterized by d [8]. However, the FPT algorithm for DISTORTION works in O(nd4(2d + 1)2d) time, which does not reach the O(cn) complexity for d = Ω(n). In this paper we present a link between aforementioned results and develop O(9.363n) -- time and polynomial space algorithms for both BANDWIDTH and DISTORTION. First, we develop a O(4.383n) -- time and space algorithm for DISTORTION, using ideas both from O∗(20n/2) algo- rithm for BANDWIDTH1 [5] and O(5n+o(n)) algorithm for DISTORTION [9]. Then, we use an approach somehow similar to these of Feige and Kilian [6] to reduce space to polynomial, at the cost of time complexity, obtaining the aforementioned algorithms. We are not aware of any exact polynomial -- space algorithms that work in O(cn) time for DISTORTION or are faster than Feige and Kilian's algorithm for BANDWIDTH. In Section 2 we gather results on partial bucket functions: tool that was used in all previous In Section 3 we recall the O∗(20n/2) algo- algorithms for DISTORTION and BANDWIDTH. rithm [5] and show how to transform it into O(9.363n) -- time and polynomial space algorithm for BANDWIDTH. Section 4 is devoted to DISTORTION: first, we merge ideas from [4] and [9] to obtain an O∗(4.383n) -- time and space algorithm for DISTORTION. Then we apply the same trick as for BANDWIDTH to obtain an O(9.363n) -- time and polynomial space algorithm. In the following sections we assume that we are given a connected undirected graph G = (V, E) with n = V . Note that BANDWIDTH trivially decomposes into subproblems on con- nected components, whereas answer to DISTORTION is always negative for a disconnected graph. Proofs of results marked with ♣ are postponed to Appendix B. 2 Partial bucket functions In this section we gather results on partial bucket functions, a tool used in algorithms for both BANDWIDTH and DISTORTION. Most ideas here are based on the O∗(20n/2) algorithm for BANDWIDTH [5]. Definition 2.1. A partial bucket function is a pair (A, f ), such that A ⊆ V , f : A → Z and there exists ¯f : V → Z satisfying: 1. ¯f A = f ; 2. if uv ∈ E then ¯f (u) − ¯f (v) ≤ 1, in particular, if u, v ∈ A then f (u) − f (v) ≤ 1; 3. if uv ∈ E, u ∈ A and v /∈ A then ¯f (u) ≥ ¯f (v), i.e., ¯f (u) = ¯f (v) or ¯f (u) = ¯f (v) + 1. We say that such a function ¯f is a bucket extension of f . Definition 2.2. Assume we have two partial bucket functions (A, f ) and (A′, f ′) such that A′ = A ∪ {v}, v /∈ A and f ′A = f , we say that (A′, f ′) is a successor of (A, f ) with ver- tex v if there does not exist any uv ∈ E, u ∈ A such that f (u) < f ′(v). 1The complexity analysis of our algorithm, in particular the proof in Appendix A, proves that the algorithm from [5] works in O(4.383n) time and space too. However, we do not state it as a new result in this paper, since analysis based on this approach will be published in the journal version of [5]. 2 Lemma 2.3. Assume that A ⊆ V and f : A → Z. Moreover, let A ⊆ B ⊆ V , f ′ : B → Z and f ′A = f . Then one can find in polynomial time a bucket extension ¯f of f such that ¯f B = f ′ or state that such bucket extension does not exist. Proof. The case A = B = ∅ is trivial, so we may assume there exists some v0 ∈ B. W.l.o.g. we may assume f ′(v0) = 0. Therefore any valid bucket extension should satisfy ¯f (V ) ⊆ {−n, −n + 1, . . . , n}. We calculate for every v ∈ V \ A the value p(v) ⊆ {−n, −n + 1, . . . , n}, intuitively, the set of possible values for ¯f (v), by the following algorithm. Algorithm 2.1 Calculate values p(v) -- the sets of valid values for ¯f (v). 1: Set p(v) := {−n, −n + 1, . . . , n} for all v ∈ V \ B. 2: Set p(v) := {f ′(v)} for all v ∈ B \ A. 3: repeat 4: 5: 6: until some p(v) is empty or we do not change any p(v) in the inner loop 7: return True iff all p(v) remain nonempty. p(v) := p(v) ∩Tu∈N (v)∩A{f (u) − 1, f (u)} ∩Tu∈N (v)\ASi∈p(u){i − 1, i, i + 1} for all v ∈ V \ B do To prove that Algorithm 2.1 correctly checks if there exists a valid bucket extension ¯f note the following: 1. Let ¯f be a bucket extension of (A, f ) such that ¯f B = f ′. Then, at every step of the algorithm ¯f (v) ∈ p(v) for every v ∈ V \ A. 2. If the algorithm returns nonempty p(v) for every v ∈ V \ A, setting ¯f (v) = min p(v) con- structs a valid bucket extension of (A, f ). Moreover, since we start with p(v) = {f ′(v)} for v ∈ B \ A, we obtain ¯f B = f ′. Corollary 2.4. One can check in polynomial time whether a given pair (A, f ) is a partial bucket function. Moreover one can check whether (A′, f ′) is a successor of (A, f ) in polynomial time too. Proof. To check if (A, f ) is a partial bucket function we simply run the algorithm from Lemma 2.3 for B = A and f ′ = f . Conditions for being a successor of (A, f ) are trivial to check. Lemma 2.5. Let N ∈ Z+. Then there are at most 2N · 5n−1 triples (A, f, ¯f ) such that (A, f ) is a partial bucket function and ¯f is a bucket extension of f satisfying ¯f (V ) ⊆ {1, 2, . . . , N }. Proof. Note that if (A, f ) is a partial bucket function in the graph G and ¯f is a bucket extension, and G′ is a graph created from G by removing an edge, then (A, f ) and ¯f remain partial bucket function and its bucket extension in G′. Therefore we may assume that G is a tree, rooted at vr. There are 2N possibilities to choose the value of ¯f (vr) and whether vr ∈ A or vr /∈ A. We now construct all interesting triples (A, f, ¯f ) in a root -- to-leaves order in the graph G. If we are at a node v with its parent w, then f (v) ∈ {f (w) − 1, f (w), f (w) + 1}. However, if w ∈ A then we cannot both have f (v) = f (w) + 1 and v /∈ A. Similarly, if w /∈ A then we cannot both 3 have f (v) = f (w) − 1 and v ∈ A. Therefore we have 5 options to choose f (v) and whether v ∈ A or v /∈ A. Finally, we obtain at most 2N · 5n−1 triples (A, f, ¯f ). Lemma 2.6 (♣). Let (A, f ) be a partial bucket function. Then all bucket extensions of f can be generated with a polynomial delay, using polynomial space. The proof of the theorem below is an adjusted and improved proof of a bound of the number of states in the O∗(20n/2) algorithm for BANDWIDTH [5]. The proof can be found in Appendix A. Theorem 2.7. Let N ∈ Z+. There exists a constant c < 4.383 such that there are O(N · cn) partial bucket functions (A, f ) such that there exists a bucket extension ¯f satisfying ¯f (V ) ⊆ {1, 2, . . . , N }. Moreover, all such partial bucket functions can be generated in O∗(N · cn) time using polynomial space. 3 Poly-space algorithm for BANDWIDTH In this section we describe an O(9.363n)-time and polynomial-space algorithm solving BAND- WIDTH. As an input, the algorithm takes a graph G = (V, E) with V = n and an integer 1 ≤ b < n and decides, whether G has an ordering with bandwidth at most b. 3.1 Preliminaries First, let us recall some important observations made in [4]. An ordering π is called a b-ordering if bw(π) ≤ b. Let Pos = {1, 2, . . . , n} be the set of possible positions and for every posi- tion i ∈ Pos we define the segment it belongs to by segment(i) = ⌈ i b+1 ⌉ and the color of it by color(i) = (i − 1) mod (b + 1) + 1. By Seg = {1, 2, . . . , ⌈ n b+1 ⌉} we denote the set of possible segments, and by Col = {1, 2, . . . , b + 1} the set of possible colors. The pair (color(i), segment(i)) defines the position i uniquely. We order positions lexicographically by pairs (color(i), segment(i)), i.e., the color has higher order that the segment number, and call this order the color order of positions. By Posi we denote the set of the first i positions in the color order. Given some (maybe partial) ordering π, and v ∈ V for which π(v) is defined, by color(v) and segment(v) we understand color(π(v)) and segment(π(v)) respectively. Let us recall the crucial observation made in [4]. Lemma 3.1 ([4], Lemma 8). Let π be an ordering. It is a b-ordering iff, for every uv ∈ E, segment(u) − segment(v) ≤ 1 and if segment(u) + 1 = segment(v) then color(u) > color(v) (equivalently, π(u) is later in color order than π(v)). 3.2 O∗(20n/2) algorithm from [5] First let us recall the O∗(20n/2)-time and space algorithm from [5]. Definition 3.2. A state is a partial bucket assignment (A, f ) such that the multiset {f (v) : v ∈ A} is equal to the multiset {segment(i) : i ∈ PosA}. A state (A ∪ {v}, f ′) is a successor of a state (A, f ) with a vertex v /∈ A if (A ∪ {v}, f ′) as a partial bucket function is a successor of a partial bucket function (A, f ). Theorem 3.3 ([5], Lemmas 16 and 17). 1. Let π be a b-ordering. For 0 ≤ k ≤ n let Ak = {v ∈ V : π(v) ∈ Posk} and fk = segmentAk. Then every (Ak, fk) is a state and for every 0 ≤ k < n the state (Ak+1, fk+1) is a successor of the state (Ak, fk). 4 2. Assume we have states (Ak, fk) for 0 ≤ k ≤ n and for all 0 ≤ k < n the state (Ak+1, fk+1) is a successor of the state (Ak, fk) with the vertex vk+1. Let π be an ordering assigning vk to the k-th position in the color order. Then π is a b-ordering. The algorithm of [5] works as follows: we do a depth -- first search from the state (∅, ∅) and seek for a state (V, ·). At a state (A, f ) we generate in polynomial time all successors of this state and memoize visited states. Theorem 3.3 implies that we reach state (V, ·) iff there exists a b-ordering. Moreover, Theorem 2.7 (with N = n) implies that we visit at most O(4.383n) states; generating all successors of a given state can be done in polynomial time due to Corollary 2.4, so the algorithm works in O(4.383n) time and space. 3.3 The O(9.363n) -- time and polynomial space algorithm Lemma 3.4. Let (A, f ) and (B, g) be a pair of states such that A ⊆ B and gA = f . Let a = A and b = B. Then one can check in O∗(4b−a) -- time and polynomial space if there exists a sequence of states (A, f ) = (Aa, fa), (Aa+1, fa+1), . . . , (Ab, fb) = (B, g) such that (Ai+1, fi+1) is an successor of (Ai, fi) for a ≤ i < b. Proof. First note that a set Ai determines the function fi, since fi = gAi. Let m := b − a. If m = 1, we need to check only if (B, g) is a successor of (A, f ), what can be done in polyno- mial time. Otherwise, let k = ⌊ a+b 2 ⌋ and guess Ak: there are roughly 2m choices. Set fk = gAk. Recursively, check if there is a path of states from (A, f ) to (Ak, fk) and from (Ak, fk) to (B, g). The algorithm clearly works in polynomial space; now let us estimate the time it consumes. At one step, it does some polynomial computation and invokes roughly 2m+1 times itself recur- sively for b − a ∼ m/2. Therefore it works in O∗(4m) time. Let α = 0.5475. The algorithm works in the same fashion as in [5]: it seeks for a path of states (Ai, fi)n i=0 from (∅, ∅) to (V, ·) such that (Ai+1, fi+1) is a successor of (Ai, fi) for 0 ≤ i < n. However, since we are limited to polynomial space, we cannot do a simple search. Instead, we guess middle states on the path, similarly as in Lemma 3.4. The algorithm works as follows: 1. Let k := ⌊αn⌋ and guess the state (Ak, fk). By Theorem 2.7 with N = n, we can enumerate all partial bucket functions in O(4.383n). We enumerate them and drop those that are not states or have the size of the domain different than k. 2. Using Lemma 3.4, check if there is a path of states from (∅, ∅) to (Ak, fk). This phase works in time 4αn. In total, for all (Ak, fk), this phase works in time O(4.383n ·4αn) = O(9.363n). 3. Guess the state (V, fn): fn needs to be a bucket extension of the partial bucket function (Ak, fk). By Lemma 2.6, bucket extensions can be enumerated with polynomial delay; we simply drop those that are not states. By Lemma 2.5 with N = n, there will be at most O∗(5n) pairs of states (Ak, fk) and (V, fn). 4. Using Lemma 3.4, check if there is a path from the state (Ak, fk) to (V, fn). This phase works in time O∗(4(1−α)n). In total, for all (Ak, fk) and (V, fn), this phase works in time O∗(5n4(1−α)n) = O(9.363n). 5. Return true, if for any (Ak, fk) and (V, fn) both applications of Lemma 3.4 return success. Theorem 3.3 ensures that the algorithm is correct. In memory we keep only states (Ak, fk), (V, fn), recursion stack generated by the algorithm from Lemma 3.4 and state of generators of 5 states (Ak, fk) and (V, fn), so the algorithm works in polynomial space. Comments above prove that it consumes at most O(9.363n) time. 4 Algorithms for DISTORTION We consider algorithms that, given a connected graph G with n vertices, and positive real num- ber d decides if G can be embedded into a line with distortion at most d. First, let us recall the basis of the approach of Fomin et al. [9]. Recall that dG(u, v) denotes the distance between vertices u and v in the graph G. Definition 4.1. Given an embedding π : V → Z, we say that v pushes u iff dG(u, v) = π(u) − π(v). An embedding is called pushing, if V = {v1, v2, . . . , vn} and π(v1) < π(v2) < . . . < π(vn) then vi pushes vi+1 for all 1 ≤ i < n. Lemma 4.2 ([7]). If G can be embedded into the line with distortion d, then there is a pushing embedding of G into the line with distortion d. Every pushing embedding of G into the line has contraction at least 1. Moreover, let π be a pushing embedding of a connected graph G into the line with distortion at most d and let V = {v1, v2, . . . , vn} be such an ordering π that π(v1) < π(v2) < . . . < π(vn). Then π(vi+1) − π(vi) ≤ d for all 1 ≤ i < n. Therefore, we only consider pushing embeddings and hence assume that d is a positive inte- ger. Note that a pushing embedding of a connected graph of at least 2 vertices has contraction exactly 1, since dG(v1, v2) = π(u2) − π(u1). Therefore distortion equals expansion. As any connected graph with n vertices can be embedded into a line with distortion at most 2n − 1 [1], this decisive approach suffices to find the minimal distortion of G. We may assume that π(V ) ⊆ {1, 2, . . . , n(d + 1)}. Now, let us introduce the concept of segments, adjusted for the DISTORTION problem. Here the set of available positions is Pos = {1, 2, . . . , n(d + 1)} and a segment of a position i is segment(i) = ⌈ i d+1 ⌉, i.e., a j-th segment is an integer interval of the form {(j − 1)(d + 1) + 1, (j − 1)(d + 1) + 2, . . . , j(d + 1)}. The color of a position is color(i) = (i − 1)mod(d + 1) + 1. By Seg = {1, 2, . . . , n} we denote the set of possible segments and by Col = {1, 2, . . . , d + 1} the set of possible colors. The pair (color(i), segment(i)) defines the position i uniquely. We order the positions lexi- cographically by pairs (color(i), segment(i)) and call this order color order of positions. By Posi we denote the set of the first i positions in the color order and by Segi we denote the set of positions in the i-th segment. Given some, maybe partial, embedding π, by color(v) and segment(v) we denote color(π(v)) and segment(π(v)) respectively. Similarly as in the case of BANDWIDTH, the following equivalence holds (cf. Lemma 3.1). Lemma 4.3 (♣). Let π be a pushing embedding. Then π has distortion at most d iff for ev- ery uv ∈ E, segment(u) − segment(v) ≤ 1 and if segment(u) + 1 = segment(v) then color(u) > color(v), i.e., π(u) is later in the color order than π(v). Similarly as in [9], we solve the following extended case of DISTORTION as a subproblem. As an input to the subproblem, we are given an induced subgraph G[X] of G, an integer r (called the number of segments), a subset Z ⊆ X and a function ¯π : Z → Seg0 ∪ Segr+1. Given this input, we ask, if there exists a pushing embedding π : X → {−d, −d + 1, . . . , (r + 1)(d + 1)} with distortion at most d such that πZ = ¯π, π(X \ Z) ⊆ {1, 2, . . . , r(d + 1)}. Moreover, we demand that π does not leave any empty segment, i.e, for every 1 ≤ i ≤ r, π−1(Segi) 6= ∅. 6 Theorem 4.4. The extended DISTORTION problem can be solved in O(4.383X\ZnO(r)) time and space. If we are restricted to polynomial space, the extended DISTORTION problem can be solved in O(9.363X\ZnO(r log n)) time. Let n = X \ Z. The algorithm for Theorem 4.4 goes as follows. First, for each segment 1 ≤ i ≤ r we guess the vertex vi and position 1 ≤ pi ≤ r(d + 1) such that Seg(pi) = i. There are roughly O(nO(r)) possible guesses (if r > n the answer is immediately negative). We seek for embeddings π such that for every 1 ≤ i ≤ r position π(vi) = pi, and there is no vertex assigned to any position in the segment i with color earlier than color(pi), i.e., vi is the first vertex in the segment i. If there exists z ∈ Z such that ¯π(z) ≤ 0, then we require that v1 is pushed by such z that ¯π(z) is the largest nonpositive possible. Along the lines of the algorithm for BANDWIDTH [5] and algorithm for DISTORTION by Fomin et al. [9], we define state and a state successor as follows: Definition 4.5. A state is a triple (p, (A, f ), (H, h)) such that: 1. 0 ≤ p ≤ r(d + 1) is an integer, 2. (A, f ) is a partial bucket function, 3. H ⊆ A is a set of vertices such that H ∩ Segi is nonempty iff f −1(i) is nonempty, 4. h : H → Posp and if v ∈ H then f (v) = segment(h(v)), 5. if for any segment 1 ≤ i ≤ r, vertex vi ∈ H, then h(vi) = pi, 6. if for any segment 1 ≤ i ≤ r position pi ∈ Posi then vi ∈ A and f (vi) = i. Definition 4.6. We say that a state (p+1, (A2, f2), (H2, h2)) is a successor of a state (p, (A1, f1), (H1, h1)) iff: 1. A2 = A1 or A2 = A1 ∪ {v}, 2. if A2 = A1 then f2 = f1, H1 = H2 and h1 = h2, 3. if A2 = A1 ∪ {v}, then: (a) partial bucket function (A2, f2) is a successor of the partial bucket function (A1, f1) with the vertex v, such that f2(v) = segment(p + 1), 1 (segment(p + 1))) ∪ {v}, (b) H2 = (H1 \ f −1 (c) h2 = h1H1∩H2 ∪ (v, p + 1), (d) if H1 ∩ f −1 (e) for any z ∈ Z, dG(z, v) ≤ ¯π(z) − (p + 1) ≤ d · dG(z, v). 1 (segment(p + 1)) = {w}, then dG(v, w) = h2(v) − h1(w), Definition 4.7. We say that a state (r(d + 1), (V, f ), (H, h)) is a final state iff for each segment 1 ≤ i ≤ r we have {wi} = H ∩ Segi (i.e., H ∩ Segi is nonempty), wi pushes vi+1 for i < r and wr pushes first z ∈ Z such that ¯π(z) ∈ Segr+1 (if such z exists). The following equivalence holds: Lemma 4.8. Let π be a pushing embedding and a solution to the extended DISTORTION prob- lem with distortion at most d. Assume that π(vi) = pi and this is the first vertex in the segment i for every segment 1 ≤ i ≤ r, i.e., the initial guesses are correct with respect to the solution π. For each 1 ≤ p ≤ r(d + 1) we define (Ap, fp) and (Hp, hp) as follows: 1. Ap = π−1(Posp) and fp = segmentAp, 7 2. for each segment 1 ≤ i ≤ r we take wi as the vertex in π−1(Posp ∩ Segi) with the greatest color of position and take wi ∈ Hp, hp(wi) = π(wi); if π−1(Posp ∩ Segi) = ∅, we take Hp ∩ Segi = ∅. Then Sp = (p, (Ap, fp), (Hp, hp) is a state and Sp+1 = (p + 1, (Ap+1, fp+1), (Hp+1, hp+1)) is its successor if p < r(d + 1). Moreover, Sr(d+1) is a final state. Proof. First note that, similarly as in the case of BANDWIDTH, (Ap, fp) is a partial bucket func- tion and (Ap+1, fp+1) is a successor of (Ap, fp). Indeed, the conditions for a partial bucket function and its successor are implied by Lemma 4.3. The check that (Hp, hp) satisfies the conditions for being a state is straightforward. Let us now look at the conditions for the successor. The only nontrivial part is that if in Hp the vertex w is replaced by v in Hp+1, then dG(v, w) = hp+1(v) − hp(w). However, this is implied by the fact that π is a pushing embedding. To see that Sr(d+1) is a final state recall that π leaves no segment Segi, 1 ≤ i ≤ r, nonempty and it is a pushing embedding. Lemma 4.9. Assume that we have a sequence of states (Sp)r(d+1) , Sp = (p, (Ap, fp), (Hp, hp)) such that Sp+1 is a successor of Sp for 0 ≤ p < r(d + 1) and Sr(d+1) is a final state. Let hp. Then π is a solution to the extended DISTORTION problem with distortion at p=0 most d. Moreover, π(vi) = pi for all 1 ≤ i ≤ r. π = Sr(d+1) p=0 Proof. Note that the conditions for the final state imply that π leaves every segment from 1 to r nonempty. Moreover, the conditions for (Hp, hp) imply that π(vi) = pi and vi is the first vertex assigned in segment i. First we check if π is a pushing embedding. Let v and w be two vertices such that π(v) < π(w) and there is no u with π(v) < π(u) < π(w). If segment(v) = segment(w), then π(w) − π(v) = dG(v, w) is ensured by the state successor definition at step, where Sp+1 is a successor of the state Sp with the vertex w. Otherwise, if segment(v) + 1 = segment(w), then w = vsegment(v) or w is the first vertex of Z in segment r + 1 and the fact that v pushes w is implied by the condition of the final state. The possibility that segment(v) + 1 < segment(w) is forbidden since in the final state Hr(d+1) ∩ Segi 6= ∅ for 1 ≤ i ≤ r. Now we check if for each edge uv, π(u) − π(v) ≤ d. Assume not, let π(u) + d < π(v) and let Sk be a successor of the state Sk−1 with the vertex v. By the conditions for a partial bucket function (Ak, fk), segment(u) − segment(v) ≤ 1, so segment(u) + 1 = segment(v). However, by the conditions for a partial bucket function successor, color(u) > color(v), a contradiction, since consecutive positions of the same color are in distance d + 1. Let us now limit the number of states. There are at most O∗(4.383n) partial bucket functions. Integer p = O(rd) and hp keeps position of at most one vertex in each segment, so there are O(nO(r)) possible pairs (Hp, hp). Therefore, in total, we have O(4.383nnO(r)) states. Note that there at most n + 1 successors of a given state, since choosing A2 \ A1 defines the successor uniquely. Note that, as checking if a pair (A, f ) is a partial bucket function can be done in polynomial time, checking if a given triple is a state or checking if one state is a successor of the other can be done in polynomial time too. 8 To obtain the O(4.383nnO(r)) -- time and space algorithm, we simply seek a path of states as in Lemma 4.9, memoizing visited states. To limit the algorithm to the polynomial space, we do the same trick as in the O(9.363n) algorithm for BANDWIDTH. Lemma 4.10. Assume that we have states Sp = (p, (Ap, fp), (Hp, hp)) and Sq = (q, (Aq, fq), (Hq, hq)) such that p < q, Ap ⊆ Aq and fp = fqAp. Let m = Aq \ Aq. Then one can check if there exists a sequence of states Si = (i, (Ai, fi), (Hi, hi)) for i = p, p + 1, . . . , q such that the state Si+1 is a successor of the state numbered Si in time O(4mnO(r log m)). Proof. First, let us consider the case when m = 1. We guess index k, p < k ≤ q, such that Ak = Aq and fk = fq, but Ak−1 = Ap and fk−1 = fp. Note that then all states Si for p ≤ i ≤ q are defined uniquely: hi = hp for i < k and hi = hq for i ≥ k. We need only to check if all consecutive pairs of states are successors. Let now assume m > 1 and let s = Ap+⌊m/2⌋. Let us guess the state Sk such that Ak = s. We need Ap ⊆ Ak ⊆ Aq and fk = fqAk, so we have only roughly 2m possibilities for (Ak, fk) and O(dr) = O(nn) possibilities for the index k. As always, there are nO(r) possible guesses for (Hk, hk). We recursively check if there is a sequence of states from Sp to Sk and from Sk to Sq. Since at each step we divide m by 2, finally we obtain an O(4mnO(r log m)) time bound. Again we set α := 0.5475. 1. We guess the state Sk = (k, (Ak, fk), (Hk, hk)) such that Ak = ⌊αn⌋. By Theorem 2.7 with N = n, we can enumerate all partial bucket extensions in O(4.383n). We enumerate all partial bucket functions, guess p and (Hk, hk) and drop those combinations that are not states. Note that there are O(nO(r)) possible guesses for (Hk, hk) and dr ≤ n2 guesses for p. 2. Using Lemma 4.10, check if there is a path of states from (0, (∅, ∅), (∅, ∅)) to Sk. This In total, for all (Ak, fk), this phase works in time phase works in time 4αnnO(r log n). O∗(4.383n · 4αnnO(r log n)) = O(9.363nnO(r log n)). 3. Guess the final state Sr(d+1) = (r(d + 1), (V, fr(d+1)), (Hr(d+1), hr(d+1))): fr(d+1) needs to be a bucket extension of the partial bucket function (Ak, fk). By Lemma 2.6, bucket ex- tensions can be enumerated with polynomial delay. We guess hr(d+1) and simply drop those guesses that do not form states. By Lemma 2.5 with N = r, there will be at most O∗(5n) pairs of states (Ak, fk) and (V, fr(d+1)). We have nO(r) possibilities for hr(d+1). 4. Using Lemma 4.10, check if there is a path from the state Sk to Sr(d+1). This phase works in time 4(1−α)nnO(r log n). In total, for all Sk and Sr(d+1) this phase works in time O∗(5n4(1−α)nnO(r log n)) = O(9.363nnO(r log n)). Theorem 4.11. The DISTORTION problem can be solved in O(4.383n) time and space. If we are restricted to polynomial space, the extended DISTORTION problem can be solved in O(9.363n) time. Proof. We almost repeat the argument from [9]. First, we may guess the number of nonempty segments needed to embed G into a line with a pushing embedding π with distortion at most d. Denote this number by r, i.e., r = ⌈max{π(v) : v ∈ V (G)}/(d + 1)⌉. Note that the original 9 DISTORTION problem can be represented as an extended case with H = G and Z = ¯π = ∅ and with guessed r. If r < n/ log3(n), the thesis is straightforward by applying Theorem 4.4. Therefore, let us assume r ≥ n/ log3(n). As every segment from 1 to r contains at least one vertex in a required pushing embedding π, by simple counting argument, there needs to be a segment r/4 ≤ k ≤ 3r/4 such that there are at most 4n/r ≤ 4 log3(n) vertices assigned to segments k and k + 1 in total by π. We guess: segment number k, vertices assigned to segments k and k + 1 and values of π for these vertices. We discard any guess that already makes some edge between guessed vertices longer than d. As d, r = O(n), we have nO(log3 n) possible guesses. Let Y be the set of vertices assigned to segments k and k + 1 and look at any connected component C of G[V \Y ]. Note that if C has neighbours in both segment k and k+1, the answer is immediately negative. Moreover, as G was connected, C has a neighbour in segment k or k+1. Therefore we know, whether vertices from C should be assigned to segments 1, 2, . . . , k − 1 or k + 2, . . . , r. The problem now decomposes into two subproblems: graphs H1 and H2, such that H1 should be embedded into segments 1 to k and H2 should be embedded into segments k + 1 to r; moreover, we demand that the embeddings meet the guesses values of π on Y . The subproblems are in fact instances of extended DISTORTION problem and can be de- composed further in the same fashion until there are at most n/ log3(n) segments in one in- stance. The depth of this recurrence is O(log r) = O(log n), and each subproblem with at most n/ log3(n) can be solved by algorithm described in Theorem 4.4. Therefore, finally, we obtain an algorithm that works in O(4.383n) time and space and an algorithm that works in O(9.363n) time and polynomial space. References [1] Mihai Badoiu, Kedar Dhamdhere, Anupam Gupta, Yuri Rabinovich, Harald Racke, R. Ravi, and Anastasios Sidiropoulos. Approximation algorithms for low-distortion embeddings into low-dimensional spaces. In Proc. of SODA'05, pages 119 -- 128, 2005. [2] Hans L. Bodlaender, Michael R. Fellows, and Michael T. Hallett. Beyond NP-completeness for problems of bounded width: Hardness for the W hierarchy (extended abstract). In ACM Symposium on Theory of Computing, pages 449 -- 458, 1994. [3] M. Cygan and M. Pilipczuk. Even faster exact bandwidth. ACM Transactions on Algorithms (to appear). [4] M. Cygan and M. Pilipczuk. Faster exact bandwidth. In Proc. WG'08, pages 101 -- 109, 2008. [5] Marek Cygan and Marcin Pilipczuk. Exact and approximate bandwidth. In Proc. of ICALP'09, pages 304 -- 315, 2009. [6] Uriel Feige. Coping with the NP-hardness of the graph bandwidth problem. In Proc. SWAT'00, pages 10 -- 19, 2000. [7] Michael R. Fellows, Fedor V. Fomin, Daniel Lokshtanov, Elena Losievskaja, Frances A. Rosamond, and Saket Saurabh. Parameterized low-distortion embeddings - graph metrics into lines and trees. CoRR, abs/0804.3028, 2008. [8] Michael R. Fellows, Fedor V. Fomin, Daniel Lokshtanov, Elena Losievskaja, Frances A. Rosamond, and Saket Saurabh. Distortion is fixed parameter tractable. In Proc. of ICALP'09, pages 463 -- 474, 2009. [9] Fedor V. Fomin, Daniel Lokshtanov, and Saket Saurabh. An exact algorithm for minimum distortion embedding. In Proc. of WG'09, pages 112 -- 121, 2009. 10 A Bound on the number of partial bucket functions In this section we prove Theorem 2.7; namely, that for some constant c < 4.383 in a connected, undirected graph G = (V, E) with V = n there are at most O(N · cn) bucket functions, where we are allowed to assign values {1, 2, . . . , N } only. Let c = 4.383 − ε for some sufficiently small ε. We use c instead of simply constant 4.383 to hide polynomial factors at the end, i.e., to say O∗(cn) = O(4.383n). Let us start with the following observation. Lemma A.1. Let G′ = (V, E′) be a graph formed by removing one edge from the graph G in a way that G′ is still connected. If (A, f ) is a bucket function in G, then it is also a bucket function in G′. Therefore we can assume that G = (V, E) is a tree. Take any vertex vr with degree 1 and make it a root of G. In this proof we limit not the number of partial bucket functions, but the number of prototypes, defined below. It is quite clear that the number of prototypes is larger than the number of partial bucket extensions, and we prove that there are at most O(N cn) prototypes. Then we show that one can generate all prototypes in O∗(N cn) time and in polynomial space. This proves that all partial bucket extensions can be generated in O∗(N cn) time and polynomial space. Definition A.2. Assume we have a fixed subset B ⊆ V . A prototype is a pair (A, f ), where A ⊆ V , f : A ∪ B → Z, such that (A, f A) is a partial bucket function, and there exists a bucket extension ¯f that is an extension of f , not only f A. Lemma A.3. For any fixed B ⊆ V the number of partial bucket functions in not greater than the number of prototypes. Proof. Let us assign to every prototype (A, f ) the partial bucket function (A, f A). To prove our lemma we need to show that this assignment is surjective. Having a partial bucket func- tion (A, f ), take any its bucket extension ¯f and look at the pair (A, ¯f A∪B). This is clearly a prototype, and (A, f ) is assigned to it in the aforementioned assignment. Before we proceed to main estimations, we need a few calculations. Let α = 4.26, β = 3 and γ = 5.02. Lemma A.4. Proof. ∞ 2cn−1 + kc−k = ∞ Xk=1 1 c − 1(cid:17) + (c − 1)2 − c 2c (2k − 1)cn−k = cn(cid:16) 2 Xk=1 c(cid:16) 1 1 − x(cid:17)′(cid:12)(cid:12)(cid:12)x= 1 (k + 1)c−k = 1 c ∞ Xk=0 1 = c (c − 1)2 (A.1) c 11 = cn(cid:16)2 ∞ 2cn−1 + ∞ kc−k − Xk=1 = cn(cid:16) 2 c + ∞ (2k − 1)cn−k = Xk=1 c−k + 2c−1(cid:17) = Xk=1 c − 1(cid:17) (c − 1)2 − 2c 1 Corollary A.5. For our choice of values for α, γ and c we obtain 2cn−1 + ∞ (2k − 1)cn−k ≤ cn(cid:18)1 − max(cid:18) 6 Xk=1 αc2 , 15 γc3(cid:19)(cid:19) . Lemma A.6. 2kcn−k = cn 2c (c − 1)2 ∞ Xk=1 Proof. This is a straightforward corollary from Equation A.1. Corollary A.7. For our choice of values for β, γ and c we obtain ∞ Xk=1 2kcn−k ≤ cn(cid:18)1 − max(cid:18) 7 βc2 , 13 γc2(cid:19)(cid:19) . Let us proceed to the main estimations. Lemma A.8. Let G be a path of length n + 1 -- graph with V = {v0, v1, v2, . . . , vn}, E = {(vi, vi+1) : 0 ≤ i < n}. Let B = {v0}. Fix any j ∈ Z. Let T (n) be the number of prototypes (A, f ) satisfying v0 ∈ A and f (v0) = j. Then T (n) ≤ α · cn−1. Proof. Let us denote T (x) = 0 for x ≤ 0. This satisfies T (x) ≤ αcx−1. We use the induction and start with calculating T (1) and T (2) manually. If n = 1 we have f (v1) ∈ {j − 1, j, j + 1} if v1 ∈ A, and one prototype if v1 /∈ A, so T (1) = 4 < α. If n = 2, we consider several cases. If v1 ∈ A we have f (v1) ∈ {j − 1, j, j + 1} and T (1) possibilities for A \ {v0} and f A\{v0}. If A = {v0, v2}, f (v2) ∈ {j − 1, j, j + 1} due to the conditions for a partial bucket extension ¯f. There is also one state with A = {v0}, ending up with T (2) = 3 · 4 + 3 + 1 = 16 < αc. Let us recursively count interesting prototypes for n ≥ 3. There is exactly one prototype (A, f ) with A = {v0}. Otherwise let k(A) > 0 be the smallest positive integer satisfying vk(A) ∈ A. Let us count the number of prototypes (A, f ), such that k(A) = k for fixed k. For k = 1 we have f (v1) ∈ {j − 1, j, j + 1}, and, having fixed value f (v1), we have T (n − 1) ways to choose A \ {v0} and fA\{v0}. 12 For k > 1 we have j − k + 1 ≤ f (vk) ≤ j + k − 1, due to the conditions for a partial bucket extension ¯f, so we have (2k − 1) ways to choose f (vk) and T (n − k) ways to choose A \ {v0, v1, . . . , vk−1} and fA\{v0,v1,...,vk−1} if k < n and 1 way if k = n. Therefore we have for n ≥ 3: n−1 T (n) ≤ 1 + 3T (n − 1) + Xk=2 (2k − 1)T (n − k) + 2n − 1 ≤ ≤ 2n + 2T (n − 1) + ∞ (2k − 1)T (n − k) Xk=1 Note that for n ≥ 3 we have 2n ≤ 6 side grows significantly faster than the left side for n ≥ 3. Using Corollary A.5 we obtain: αc2 · αcn−1, as we have an equality for n = 3 and the right T (n) ≤ αcn−1 Lemma A.9. Let G be a path of length n + 1 -- graph with V = {v0, v1, v2, . . . , vn}, B = {v0} and E = {(vi, vi+1) : 0 ≤ i < n}. Fix any j ∈ Z. Let T ′(n) be the number of prototypes (A, f ) satisfying v0 /∈ A and f (v0) = j. Then T ′(n) ≤ βcn−1. Proof. Write the formula for T ′ using previously bounded T . We start with calculating T ′(1) and T ′(2) manually. If n = 1, if v1 ∈ A we have f (v1) ∈ {j, j + 1} and one prototype with A = ∅, so T ′(1) = 3 ≤ β. If n = 2, we have one prototype with A = ∅, four prototypes if A = {v2} (since then f (v2) ∈ {j − 1, j, j + 1, j + 2}) and 2 · T (1) prototypes if v1 ∈ A (since f (v1) ∈ {j, j + 1}). Therefore T ′(2) = 1 + 4 + 2 · 4 = 13 < βc. Let us assume n ≥ 3. There is exactly one prototype (A, f ) with A = ∅. Otherwise let k(A) > 0 be the smallest positive integer satisfying vk(A) ∈ A. Let us count the number of prototypes (A, f ) such that k(A) = k for fixed k. Note that, due to the conditions for a partial bucket extension ¯f , j − k + 1 ≤ f (vk) ≤ j + k; there are 2k ways to choose f (vk). There are T (n − k) ways to choose A \ {v0, v1, . . . , vk−1} and fA\{v0,v1,...,vk−1} for k < n and 1 way for k = n, leading us to inequality ∞ T ′(n) ≤ 1 + 2n + 2kT (n − k) Xk=1 Note that for n ≥ 3 we have 2n+1 ≤ 7 βc2 ·βcn−1, as we have equality for n = 3 and the right side grows significantly faster than the left side for n ≥ 3. Therefore, using Corollary A.7, we obtain T ′(n) ≤ βcn−1 13 Lemma A.10. Let G be a path of length n + 1 -- graph with V = {v0, v1, v2, . . . , vn}, B = {v0, vn} and E = {(vi, vi+1) : 0 ≤ i < n}. Fix any j ∈ Z. Let S(n) be the num- ber of prototypes (A, f ) satisfying v0 ∈ A and f (v0) = j. Then S(n) ≤ γcn−1. Moreover, at least 0.4S(n) of these prototypes (A, f ) satisfy vn /∈ A. Proof. As in the estimations of T (n), we use induction and write a recursive formula for S. Let S(x) = 0 for x ≤ 0. We start with calculating S(1), S(2) and S(3) manually. If n = 1, if v1 ∈ A we have f (v1) ∈ {j − 1, j, j + 1} and if v1 /∈ A we have f (v1) ∈ {j − 1, j}, thus S(1) = 5 ≤ γ and 2 = 0.4S(1) of these prototypes satisfy v1 /∈ A. If n = 2, we consider several cases, as in calculations of T (2). If v1 ∈ A, we have f (v1) ∈ {j − 1, j, j + 1} thus 3 · S(1) possibilities and out of them 3 · 2 possibilities sat- isfy v2 /∈ A. If A = {v0, v2} we have f (v2) ∈ {j − 1, j, j + 1}, 3 possibilities. If A = {v0} we have f (v2) ∈ {j − 2, j − 1, j, j + 1}, 4 possibilities. In total, S(2) = 15 + 3 + 4 = 22 ≤ γc and 3 · 2 + 4 > 0.4S(2) of these prototypes satisfy v2 /∈ A. If n = 3, we do similarly. If v1 ∈ A, we have f (v1) ∈ {j − 1, j, j + 1} thus 3 · S(2) possibilities and out of them 3 · 10 possibilities satisfy v3 /∈ A. If v1 /∈ A but v2 ∈ A we have f (v2) ∈ {j −1, j, j +1}, 3·S(1) possibilities and out of them 3·2 possibilities satisfy v3 /∈ A. If A = {v0, v3} we have f (v3) ∈ {j −2, j −1, j, j +1, j +2}, 5 possibilities. If A = {v0} we have f (v3) ∈ {j − 3, j − 2, j − 1, j, j + 1, j + 2}, 6 possibilities. In total S(3) = 3·22+ 3·5+ 5+ 6 = 92 ≤ γc2, and 3 · 10 + 3 · 2 + 6 = 42 > 0.4S(3) of these prototypes satisfy v3 /∈ A. Let us assume n ≥ 4. If A = {v0}, we have j − n ≤ f (vn) ≤ j + n − 1, 2n possible pro- totypes and all of them satisfy vn /∈ A. Otherwise let k(A) be the smallest positive integer such that vk(A) ∈ A. Let us once again count the number of prototypes (A, f ), such that k(A) = k for fixed k. As in the estimate of T (n), we have 3 possible values for f (vk) when k = 1 and (2k − 1) possible values when k > 1. For k < n there are S(n − k) possible ways to choose A \ {v0, v1, . . . , vk−1} and fA\{v0,v1,...,vk−1} and 1 way if k = n. Moreover for k < n at least 0.4S(n − k) of choices satisfy vn /∈ A. Therefore: S(n) = 2n − 1 + 2n + 2S(n − 1) + n−1 (2k − 1)S(n − k) Xk=1 And at least 2n + 0.4 2S(n − 1) + (2k − 1)S(n − k)! ≥ 0.4S(n) n−1 Xk=1 of these prototypes satisfy vn /∈ A. For n ≥ 4 we have 4n − 1 ≤ 15 A.5 we obtain: γc3 · γcn−1, so using Corollary S(n) ≤ γcn−1 14 Lemma A.11. Let G be a path of length n + 1 -- graph with V = {v0, v1, v2, . . . , vn}, B = {v0, vn} and E = {(vi, vi+1) : 0 ≤ i < n}. Fix any j ∈ Z. Let S′(n) be the num- ber of prototypes (A, f ) satisfying v0 /∈ A and f (v0) = j. Then S′(n) ≤ γcn−1. Moreover, at least 0.4S′(n) of these prototypes (A, f ) satisfy vn /∈ A. Proof. Similarly to the estimate of T ′, we write the formula bounding S′ with S and use already proved bounds for S. We start with calculating S′(1) and S′(2) manually. If n = 1 we have f (v1) ∈ {j, j + 1} if v1 ∈ A and f (v1) ∈ {j − 1, j, j + 1} if v1 /∈ A, thus S′(1) = 5 ≤ γ and 3 > 0.4S′(1) of these prototypes satisfy v1 /∈ A. If n = 2 we consider several cases. If v1 ∈ A we have f (v1) ∈ {j, j + 1}, thus 2 · S(1) possibilities and out of them 2 · 2 possibilities satisfy v2 /∈ A. If A = {v2} we have f (v2) ∈ {j − 1, j, j + 1, j + 2}, 4 possibilities. If A = ∅ we have f (v2) ∈ {j − 2, j − 1, j, j + 1, j + 2}, 5 possibilities. In total S′(2) = 2 · 5 + 4 + 5 = 19 ≤ γc, and 2 · 2 + 5 = 9 > 0.4′S(2) of these prototypes satisfy v2 /∈ A. Let us assume n ≥ 3. If A = ∅, we have j − n ≤ f (vn) ≤ j + n, 2n + 1 possible prototypes, all satisfying vn /∈ A. Otherwise let k(A) be the smallest positive integer such that vk(A) ∈ A. Let us once again count number of prototypes (A, f ), such that k(A) = k for fixed k. As in the estimate of T ′(n), we have 2k possible values for f (vk). For k < n there are S(n − k) possible ways to choose A \ {v0, v1, . . . , vk−1} and fA\{v0,v1,...,vk−1} and 1 way if k = n. Moreover, for k < n at least 0.4S(n − k) of choices satisfy vn /∈ A. Therefore: S′(n) ≤ 2n + 1 + 2n + 2kS(n − k) ∞ Xk=1 and at least ∞ 2n + 1 + 0.4 2kS(n − k) ≥ 0.4S′(n) Xk=1 of these prototypes satisfy vn /∈ A. For n ≥ 3 we have 4n + 1 ≤ 13 A.7 we obtain γc2 · γcn−1. Using Corollary S′(n) ≤ γcn−1 Let us proceed to the final lemma in this proof. By B0 ⊆ V we denote the root vr and the set of vertices with at least two children in G, i.e., vertices of degree at least 3. Recall that vr has degree 1. Lemma A.12. Let vr be the root of an n vertex graph G = (V, E) of degree 1 and let B = B0. Assume that G is not a path. Fix j ∈ Z. Then both the number of prototypes (A, f ) with f (vr) = j, vr ∈ A and the number of prototypes (A, f ) with f (vr) = j, vr /∈ A are at most δcn−2, where δ =p0.6α2 + 0.4β2. Proof. We prove it by induction over n = V . Let v be the closest to vr vertex that belongs to B0 different than vr (v exists as G is not a path) Let P be the path from v to vr, including v and vr and let P be the number of vertices on P . Due to Lemma A.10 and Lemma A.11, there are 15 at most γcP −2 ways to choose (A ∩ P, f (A∪B)∩P ), and at least 0.4 of these possibilities satisfy v /∈ A. Let us now fix one of such choices. Let G1, G2, . . . , Gk be the connected components of G with removed P . Let Vi be the set of vertices of Gi and Bi = B ∩ Vi. For each 1 ≤ i ≤ k, we bound the number of possible choices for (A ∩ Vi, f (A∪B)∩Vi). If Bi = ∅ (equivalently Gi is a path) then one can choose (A ∩ Vi, f (A∪B)∩Vi) on T (Vi) ≤ αcVi−1 or T ′(Vi) ≤ βcVi−1 ways, depending on whether v = v0 ∈ A or v = v0 /∈ A (we use here Lemma A.8 or Lemma A.9 for v0 = v and {v1, v2, . . . , vVi} = Vi). Otherwise, we use inductive assumption for Gi with added root v. In this case we have at most δcVi−1 possibilities to choose (A ∩ Vi, f (A∪B)∩Vi ). Let B = {1 ≤ i ≤ k : Bi = ∅}, and A = {1, 2, . . . , k} \ B. If v ∈ A, the number of choices for all graphs Gi is bounded by: Yi∈A δcVi−1! · Yi∈B αcVi−1! = δAαBcn−P −k If v /∈ A, the number of choices for all graphs Gi is bounded by: Yi∈A δcVi−1! · Yi∈B βcVi−1! = δAβBcn−P −k Therefore, as α ≥ β, the total number of prototypes for G is bounded by γcP −2δAcn−P −k(cid:16)0.6αB + 0.4βB(cid:17) = cn−2(cid:16)γc−kδA(cid:16)0.6αB + 0.4βB(cid:17)(cid:17) Note that δγ ≤ c2. If B ≤ 1 we have, using that k ≥ 2 and 0.6α + 0.4β ≤ δ ≤ c: γc−kδA(cid:16)0.6αB + 0.4βB(cid:17) ≤ γc−kδk ≤ δ. Otherwise, if B ≥ 2 we have, as β ≤ α ≤ c and δ ≤ c: γc−kδA(cid:16)0.6αB + 0.4βB(cid:17) ≤ γc−kδA(cid:16)0.6αB + 0.4αB−2β2(cid:17) = γc−kδAαB−2δ2 ≤ δ. Thus the bound is proven. Corollary A.13. The number of all prototypes satisfying f (vr) ∈ {1, 2, . . . , N } is at most N · max(α, δ) · cn−2 = O(N cn). To finish up the proof of theorem 2.7, we need to show the following lemma. Lemma A.14. Fix B = B0. All prototypes can be generated in polynomial space and in O∗(N cn) time. 16 Proof. We assume that G = (V, E) is a tree rooted at vr. Otherwise, we may take any spanning tree of G, generate all prototypes for this tree, and finally for each prototype in the spanning tree check if this is a prototype in the original graph G too. First we guess f (vr) and guess the set A. Then we go in the root -- to -- leaves order in G and guess values of f for vertices in A ∪ B. Whenever we encounter a vertex v ∈ A ∪ B we look at its closest predecessor w ∈ A ∪ B. Let d be the distance between v and w. We iterate over all possibilities f (v) ∈ {f (w) − d, f (w) − d + 1, . . . , f (w) + d}; however the following options are forbidden due to the conditions for the bucket extension: • if v ∈ A, w ∈ A and d > 1 then f (v) = f (w) − d and f (v) = f (w) + d are forbidden; • if v ∈ A and w /∈ A then f (v) = f (w) − d is forbidden; • if v /∈ A and w ∈ A then f (v) = f (w) + d is forbidden. Since every branch in our search ends up with a valid prototype, the algorithm takes O∗(N cn) time. In memory, we keep only the recursion stack of the search algorithm, and therefore we use polynomial space. B Omitted proofs Proof of Lemma 2.6. We construct all valid bucket extensions by a brute -- force search. We start with f ′ = f and B = A. At one step we have A ⊆ B ⊆ V , f ′ : B → V such that f ′A = f and there exists a bucket extension ¯f of (A, f ) such that ¯f B = f ′. We take any v ∈ V \ B such that there exists a neighbour w of v that belongs to B and try to assign f ′(v) = f ′(w) + ε, for each ε ∈ {−1, 0, 1}. At every step, we use the algorithm from Lemma 2.3 to check the condition if f ′ can be extended to a valid bucket extension of (A, f ). This check ensures that every branch in our search algorithm ends up with a bucket extension. Therefore we generate all bucket extensions with a polynomial delay and in polynomial space. Proof of Lemma 4.3. First, assume π has distortion at most d. Then for each uv ∈ E we have π(u) − π(v) ≤ d. Since segments are of size d + 1, this implies that segment(u) − segment(v) ≤ 1. Moreover, the distance between positions of the same color in consecu- tive segments is exactly d + 1, which implies that if segment(u) + 1 = segment(v) then color(u) > color(v). In the other direction, assume that for some u, v ∈ V we have k = dG(u, v) π(u) − π(v) > dk. Let u = u0, u1, . . . uk = v be the path of length k between u and v. Then, for some 0 ≤ i < k we have π(ui+1) − π(ui) > d. This implies that segment(ui+1) 6= segment(ui), w.l.o.g. assume that segment(ui) + 1 = segment(ui+1). However, since consecutive posi- tions of the same color are in distance d + 1, this implies that color(ui) ≤ color(ui+1), a contradiction. 17
1907.02053
1
1907
2019-07-03T17:44:41
Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm
[ "cs.DS" ]
In this paper, we propose HyperFlowCutter, an algorithm for balanced hypergraph bipartitioning. It is based on minimum S-T hyperedge cuts and maximum flows. It computes a sequence of bipartitions that optimize cut size and balance in the Pareto sense, being able to trade one for the other. HyperFlowCutter builds on the FlowCutter algorithm for partitioning graphs. We propose additional features, such as handling disconnected hypergraphs, novel methods for obtaining starting S,T pairs as well as an approach to refine a given partition with HyperFlowCutter. Our main contribution is ReBaHFC, a new algorithm which obtains an initial partition with the fast multilevel hypergraph partitioner PaToH and then improves it using HyperFlowCutter as a refinement algorithm. ReBaHFC is able to significantly improve the solution quality of PaToH at little additional running time. The solution quality is only marginally worse than that of the best-performing hypergraph partitioners KaHyPar and hMETIS, while being one order of magnitude faster. Thus ReBaHFC offers a new time-quality trade-off in the current spectrum of hypergraph partitioners. For the special case of perfectly balanced bipartitioning, only the much slower plain HyperFlowCutter yields slightly better solutions than ReBaHFC, while only PaToH is faster than ReBaHFC.
cs.DS
cs
Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm Lars Gottesbüren Institute of Theoretical Informatics, Karlsruhe Institute of Technology, Germany [email protected] Michael Hamann Institute of Theoretical Informatics, Karlsruhe Institute of Technology, Germany [email protected] Dorothea Wagner Institute of Theoretical Informatics, Karlsruhe Institute of Technology, Germany [email protected] Abstract In this paper, we propose HyperFlowCutter, an algorithm for balanced hypergraph bipartitioning. It is based on minimum S-T hyperedge cuts and maximum flows. It computes a sequence of bipartitions that optimize cut size and balance in the Pareto sense, being able to trade one for the other. HyperFlowCutter builds on the FlowCutter algorithm for partitioning graphs. We propose additional features, such as handling disconnected hypergraphs, novel methods for obtaining starting S, T pairs as well as an approach to refine a given partition with HyperFlowCutter. Our main contribution is ReBaHFC, a new algorithm which obtains an initial partition with the fast multilevel hypergraph partitioner PaToH and then improves it using HyperFlowCutter as a refinement algorithm. ReBaHFC is able to significantly improve the solution quality of PaToH at little additional running time. The solution quality is only marginally worse than that of the best-performing hypergraph partitioners KaHyPar and hMETIS, while being one order of magnitude faster. Thus ReBaHFC offers a new time-quality trade-off in the current spectrum of hypergraph partitioners. For the special case of perfectly balanced bipartitioning, only the much slower plain HyperFlowCutter yields slightly better solutions than ReBaHFC, while only PaToH is faster than ReBaHFC. 2012 ACM Subject Classification Mathematics of computing → Graph algorithms Keywords and phrases Hypergraph Partitioning, Maximum Flows, Algorithm Engineering Supplement Material Source code at https://github.com/kit-algo/HyperFlowCutter Funding This work was partially supported by the DFG under grants WA654/19-2 and WA654/22-2. The authors acknowledge support by the state of Baden-Württemberg through bwHPC. Acknowledgements We thank Ben Strasser, Tim Zeitz and Lukas Barth for helpful discussions. Introduction 1 Given a hypergraph H = (V, E), a hyperedge cut C ⊂ E is a set of hyperedges whose removal disconnects H. The balanced hypergraph bipartioning problem is to find a hyperedge cut of minimum cardinality whose removal separates H into two blocks of roughly equal size -- up to (1 + ε)V 2 . Hypergraph partitioning has applications in VLSI design, database sharding, and high performance computing, in particular load balancing and reducing communication for highly parallel computations as well as accelerating sparse matrix vector multiplications. This problem is NP-hard [34] and it is hard to approximate, even for graphs [12]. Therefore, practical algorithms use heuristics. Most of them are based on the multilevel framework [27]. In this paper we consider a different approach based on the max-flow min-cut duality. The basic idea has already been used in the Flow-Balanced-Bipartition algorithm (FBB) of Yang and Wong [50]. So far it has not been of further consideration due to being too 9 1 0 2 l u J 3 ] S D . s c [ 1 v 3 5 0 2 0 . 7 0 9 1 : v i X r a 2 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm slow compared to multilevel algorithms and too slow to solve current instances in feasible time. More recently, FlowCutter [26] (FC) for graph bipartitioning has been introduced independently of FBB. It is designed for computing very small node separators in road networks with a rather loose balance constraint; ε = 0.33 is recommended for the application of accelerating shortest path computations [20]. Based on similar ideas as FBB but equipped with more engineering, it computes both unbalanced and highly balanced bipartitions of high quality on the Walshaw graph partitioning benchmark [46]. Contribution. We present HyperFlowCutter, an algorithm which computes a series of hypergraph bipartitions with increasing balance, up to perfectly balanced solutions. With HyperFlowCutter, we extend FlowCutter to hypergraphs and contribute additional features. We provide a method to handle disconnected hypergraphs, which FlowCutter and FBB cannot handle. Our main contribution is ReBaHFC, an algorithm to refine a given partition using HyperFlowCutter. It is a natural extension of the max-flow based refinement of the k-way hypergraph partitioner KaHyPar [28]. We provide a thoroughly engineered implementation as well as an extensive experimental evaluation on the benchmark set of Heuer and Schlag [29], comparing HyperFlowCutter and ReBaHFC against the state-of-the- art hypergraph partitioning tools KaHyPar [29, 28], PaToH [13] and hMETIS [30, 31]. In our experiments we use the fast algorithm PaToH to obtain initial partitions for ReBaHFC. When using the quality preset of PaToH, ReBaHFC computes solutions for ε = 0.03, which are only slightly worse than those of the best-performing partitioners KaHyPar and hMETIS and significantly better than those of PaToH. ReBaHFC is only marginally slower than PaToH and thus, like PaToH, it is one order of magnitude faster than KaHyPar and hMETIS, when using the quality preset, and two orders of magnitude faster, when using the default preset. Furthermore, ReBaHFC with the PaToH default preset computes better solutions than PaToH with its quality preset. Thus ReBaHFC offers new time-quality trade-offs. For the special case of perfectly balanced bipartitioning, only the much slower plain HyperFlowCutter yields marginally better solutions than ReBaHFC, while only PaToH is faster than ReBaHFC. Outline. After discussing related work in Section 2 and presenting notation and preliminaries in Section 3, we introduce the core algorithm of HyperFlowCutter for S-T hyperedge cuts in Section 4.1. Then we show how to handle disconnected hypergraphs in Section 4.2, propose our refinement algorithm ReBaHFC in Section 4.3 and finally discuss the experimental evaluation in Section 5. 2 Related Work For an overview of the field of hypergraph partitioning we refer to survey articles [7, 39, 5]. The most common approach among hypergraph partitioning tools is the multilevel framework. Multilevel algorithms repeatedly contract vertices to obtain a hierarchy of coarser hypergraphs while trying to preserve the cut structure. On the coarsest hypergraph an initial partition is computed in some way. Then the contractions are reversed step-by-step and after every uncontraction a refinement algorithm tries to improve the solution. Most multilevel algorithms use a variant of the Fiduccia-Mattheyses (FM) [23] or Kernighan-Lin (KL) [32] local vertex moving heuristics. These algorithms move vertices between blocks, prioritized by cut improvement. The multilevel framework has been immensely successful because it provides a global view on the problem through local operations on the coarse levels. Furthermore, L. Gottesbüren, M. Hamann, D.Wagner 3 it allows a great deal of engineering and tuning, which have a drastic impact on solution quality. Even though this framework has been used since the 1990s, the implementations are still improving today. A selection of well-known multilevel hypergraph partitioners are PaToH [13] (scientific computing), hMETIS [30, 31] (VLSI design) KaHyPar [29, 28] (general purpose, n-level), Zoltan [19] (scientific computing, parallel), Zoltan-AlgD [45] (algebraic distances based coarsening, sequential), Mondriaan [48] (sparse matrices), MLPart [4] (circuit partitioning) and Parkway [47] (parallel). Compared to graph partitioning, the performance of local vertex moving suffers from the presence of large hyperedges with vertices scattered over multiple blocks, since many moves have zero cut improvement. On coarse levels of the multilevel hierarchy, this problem is alleviated since hyperedges contain fewer vertices. A second remedy are flow-based refinement algorithms. For graphs, Sanders and Schulz [42] extract a size-constrained corridor around the cut and compute a minimum cut within this corridor. If the cut is balanced, an improved solution was found, otherwise the step is repeated with a smaller corridor. Heuer et al. [28] extend their approach to hypergraphs by using Lawler networks [33]. The Lawler network of a hypergraph is a flow network such that minimum S-T hyperedge cuts can be computed via max-flow. In their Flow-Balanced-Bipartition algorithm (FBB), Yang and Wong [50] use incremental maximum flows on the Lawler network to compute ε-balanced hypergraph bipartitions. Liu and Wong [36] enhance FBB with a most-desirable-minimum-cut heuristic, which is inspired by the correspondence between S-T minimum cuts and closed node sets due to Picard and Queyranne [40]. It is similar to the most-balanced-minimum-cut heuristics used in the multilevel graph partitioning tool KaHiP [42] and KaHyPar-MF [28] as well as the avoid- augmenting-paths piercing heuristics of FlowCutter [26] and HyperFlowCutter. Li et al. [35] propose a push-relabel algorithm, which operates directly on the hypergraph. Furthermore they present heuristics rooted in VLSI design for choosing sets of initial seed vertices S and T as well as piercing vertices. The performance of their approach in other contexts than VLSI design remains unclear. For perfectly balanced graph partitioning, diffusion-based methods have been success- ful [37]. Furthermore Sanders and Schulz [43] propose an algorithm based on detecting negative cycles, which is used on top of their evolutionary partitioner. Delling and Wer- neck [18] provide an efficient implementation of an optimal branch-and-bound algorithm. Additionally there are metaheuristic approaches such as PROBE [14], as well as multilevel memetic algorithms due to Benlic and Hao [9, 10, 11]. 3 Preliminaries hyperedges of v by I(v) and its degree by deg(v) := I(v). Furthermore let p :=P is connected if its star expansion is connected. Let V [E0] :=S A hypergraph H = (V, E) consists of a set of n vertices V and a set of m hyperedges E, where a hyperedge e is a subset of the vertices V . A vertex v ∈ V is incident to hyperedge e ∈ E if v ∈ e. The vertices incident to e are called the pins of e. We denote the incident e∈E e denote the total number of pins in H. All hypergraphs in this paper are unweighted. H can be represented as a bipartite graph G = (V ∪ E,{(v, e) ∈ V × E v ∈ e}) with bipartite node set V ∪ E and an edge for every pin. This is also referred to as the star expansion of H. H e0∈E0 e0 denote the vertex set induced by the hyperedge set E0. To avoid confusion, we use the terms vertices, hyperedges and pins for hypergraphs, and we use the terms nodes and edges for graphs. 4 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm 3.1 Hypergraph Partitioning A bipartition of a hypergraph H is a partition (A, B) of the vertices V into two non-empty, disjoint sets (called blocks). The cut cut(A, B) := {e ∈ E e ∩ A 6= ∅ ∧ e ∩ B 6= ∅} consists of all hyperedges with pins in both blocks. The size of a cut is the number of cut hyperedges cut(A, B). Let ε ∈ [0, 1). A bipartition (A, B) is ε-balanced if max(A,B) ≤ d(1 + ε) n 2e. The balanced hypergraph bipartitioning problem is to find an ε-balanced bipartition (A, B) which minimizes the cut. The special case ε = 0 is called perfectly balanced bipartitioning. capacity constraint f(e) ≤ c(e) for all edges e, flow conservation P value of a flow f :=P 3.2 Maximum Flows A flow network N = (V,E, S, T, c) is a simple symmetric directed graph (V,E) with two non-empty terminal node sets S, T (cid:40) V, S ∩ T = ∅, the source and target node set, as well as a capacity function c : E 7→ R≥0. Any node that is not a source node and not a target node is a non-terminal node. A flow in N is a function f : E 7→ R subject to the (u,v)∈E f((u, v)) = 0 for all non-terminal nodes v and skew symmetry f((u, v)) = −f((v, u)) for all edges (u, v). The s∈S,(s,u)∈E f((s, u)) is the amount of flow leaving S. The residual capacity rf(e) := c(e)− f(e) is the additional amount of flow that can pass through e without violating the capacity constraint. The residual network with respect to f is the directed graph Nf = (V,Ef) where Ef := {e ∈ Erf(e) > 0}. A node v is source-reachable if there is a path from S to v in Nf, it is target-reachable if there is a path from v to T in Nf. We denote the source-reachable and target-reachable nodes by Sr and Tr, respectively. An augmenting path is an S-T path in Nf. The flow f is a maximum flow if f is maximal of all possible flows in N . This is the case iff there is no augmenting path in Nf. An S-T edge cut is a set of edges whose removal disconnects S and T. The value of a maximum flow equals the weight of a minimum-weight S-T edge cut [24]. The source-side cut consists of the edges from Sr to V \ Sr and the target-side cut consists of the edges from Tr to V \ Tr. The bipartition (Sr,V \ Sr) is induced by the source-side cut and (V \ Tr, Tr) is induced by the target-side cut. Note that V \ Sr \ Tr is not necessarily empty. 3.3 Hyperedge Cuts via Maximum Flows Lawler [33] uses maximum flows to compute minimum S-T hyperedge cuts without balance constraints. On the star expansion, the standard construction to model node capacities as edge capacities [1] is applied to the hyperedge-nodes. A hyperedge e is expanded into an in-node ei and an out-node eo joined by a directed bridge edge (ei, eo) with unit capacity. For every pin u ∈ e there are two directed external edges (u, ei), (eo, u) with infinite capacity. The transformed graph is called the Lawler network. A minimum S-T edge cut in the Lawler network consists only of bridge edges, which directly correspond to S-T cut hyperedges in H. Instead of using the Lawler network, we emulate max-flow algorithms directly on the hypergraph, using an approach first proposed by Pistorius and Minoux [41]. In the paper it is formulated for unit weight hyperedges and the Edmonds-Karp flow algorithm [22] but it can be easily extended to handle weighted hyperedges and emulate any flow algorithm. For every hyperedge e ∈ E, we store the pins sending and receiving flow via e. In this work, we consider only unit weight hyperedges and thus need to store only one pin flow-from(e) sending flow into e, and one pin flow-to(e) receiving flow from e. To keep the description simple, it relies on this assumption as well. Let u be a fixed vertex. The idea is to enumerate short paths of the form u → e ∈ I(u) → v ∈ e that correspond to paths in the residual Lawler network. This allows us to emulate algorithms for traversing the residual Lawler network directly on L. Gottesbüren, M. Hamann, D.Wagner 5 (a) Compute minimum S-T cuts. (b) Add Sr to S and choose a piercing vertex. (c) Mixed hyperedge (white square) with incidence relations (orange) and an isolated vertex (white disk). Figure 1 Flow augmentation and computing Sr, Tr in Fig.1a; adding Sr to S and piercing the source-side cut in Fig.1b. S in blue, Sr \ S in yellow, T in green, Tr \ T in red, V \ Sr,\Tr in white. the hypergraph, such as Breadth-First-Search or Depth-First-Search, as well as other types of local operations, e. g., the discharge and push operations in push-relabel algorithms [25]. For every hyperedge e ∈ I(u) we do the following. If e has no flow, we enumerate all pins v ∈ e. These paths correspond to (u, ei, eo, v) in the Lawler network. If e has flow and u = flow-to(e) we also enumerate all pins v ∈ e. However, these paths correspond to (u, eo, ei, v) in the Lawler network. If e has flow and u = flow-from(e), there is no path in the residual Lawler network starting at u that uses e. If e has flow and flow-from(e) 6= u 6= flow-to(e), we enumerate just one path (u, e, flow-from(e)), corresponding to (u, ei, flow-from(e)) in the Lawler network. If we can push flow from the vertex flow-from(e) to T, we can redirect the flow that the vertex flow-from(e) sends into e, and instead route flow coming from u to flow-to(e). Then u becomes the new flow-from(e). We use this approach in our implementation because it is significantly more efficient than the Lawler network in practice. In the last case we can avoid scanning all pins of e. In a preliminary experiment, computing flow directly on the hypergraph yielded a speedup of 15 over using the Lawler network, for a hypergraph with maximum hyperedge size of only 36. The speedup will be more extreme on hypergraphs with larger hyperedges. Via the Lawler network and the above emulation approach, the notions of flow, source- reachable vertices and source-side cuts translate naturally from graphs to hypergraphs. We use the notation and terminology already known from max-flows in graphs. 4 HyperFlowCutter In the following we outline the core HyperFlowCutter algorithm, which can only be used on connected hypergraphs. Then we discuss how to handle disconnected hypergraphs, and finally show how to improve an existing partition using HyperFlowCutter. 4.1 The Core Algorithm The idea of the core HyperFlowCutter algorithm is to solve a sequence of incremental S-T max-flow min-cut problems with monotonically increasing cut size and balance, until an ε-balanced bipartition is found. They are incremental in the sense that the terminals S, T of the current flow problem are subsets of the terminals in the next flow problem, which allows us to reuse previously computed flows. Given starting terminal sets Sinit, Tinit, we set S := Sinit, T := Tinit First, we compute a maximum S-T flow. We terminate if the bipartition (Sr, V \ Sr) induced by the source-side cut or (V \ Tr, Tr) induced by the target-side cut is ε-balanced. Otherwise, we add the SrTSTrTrTS=Srisolatedvertex 6 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm source-reachable vertices Sr to S, if Sr ≤ Tr, or we add Tr to T if Sr > Tr. Assume Sr ≤ Tr without loss of generality. Further, we add one or more vertices, called piercing vertices, to S. This step is called piercing the cut. It ensures that the next flow problem yields a different bipartition. Subsequently, we augment the previous flow to a max-flow that respects the new sources. We repeat these steps until an ε-balanced bipartition is found. Note that after adding Sr to S, the flow is still a maximum S-T flow, even though the added vertices are now exempt from flow conservation. Using the smaller side allows it to catch up with the larger side. In particular, this ensures that ε-balance is always possible, as neither side grows beyond dn/2e vertices. A hyperedge with pins in both S and T is mixed, all other hyperedges are non-mixed. We consider two options to find piercing vertices. The preferred option is to choose all pins e\ S \ T of a non-mixed hyperedge e in the source-side cut. Adding multiple vertices is faster in practice. This small detail is a major difference to FBB [50] and is necessary to make the running time feasible on the used benchmark set. If the source-side cut contains only mixed hyperedges, we choose a single non-terminal vertex incident to the source-side cut. We prefer piercing vertices which are not reachable from T, as these avoid augmenting paths in the next iteration, and thus the cut size does not increase. Avoiding augmenting paths has the highest precedence, followed by choosing hyperedges over single vertices. Ties are broken randomly. If the piercing vertices are not reachable from T, we do not recompute Tr and we skip flow augmentation, but we do recompute Sr. We experimented with other piercing methods, including trying to avoid mixed hyperedges, the distance-based piercing of FlowCutter, as well as piercing based on a machine learning technique named ensemble classification. We discuss ensemble classification again in the experimental section, although in a different context. None of these approaches yielded consistent or significant quality improvements over just avoiding augmenting paths and random tie-breaking, which is why we use only those. Asymptotic Complexity. The asymptotic running time of Core HyperFlowCutter is O(cp) where c is the cut size of the ε-balanced partition and p is the number of pins in the hypergraph. Roughly speaking, the term p stems from performing up to one hypergraph traversal per flow unit. Here we use that n ≤ p, m ≤ p holds for connected hypergraphs. Note that the running time is output-sensitive, however the factor c is rather pessimistic in practice, since the flow algorithm finds many augmenting paths in a single traversal. The original proof for FlowCutter [26] is applicable, but implementing the piercing step requires a little care. Selecting piercing vertices takes O(c) per iteration, and we have at most n ≤ p iterations. Selecting a non-mixed hyperedge for piercing takes O(c) time, by iterating over the cut hyperedges. Selecting single piercing vertices which avoid augmenting paths whenever possible, is slightly more involved, when restricted to O(c) time. For every cut hyperedge e we additionally track its pins that are not reachable from either side. This can be implemented with a linked list, from which we delete vertices once they get reachable from a side. An alternative implementation divides the memory storing the pins of e into three regions: the pins in Sr, in Tr or not reachable. Then we can check, whether e has pins that are not reachable from either side, and if so pick one. In practice, this adds significantly to the complexity of the implementation and the piercing step is never critical for running time, so our implementation simply scans all non-terminal boundary vertices. Our implementation has O(n + m) memory footprint by transferring and re-engineering the implementation details from [26]. This is dominated by the O(n + m + p) memory for storing the hypergraph. L. Gottesbüren, M. Hamann, D.Wagner 7 Isolated Vertices. We call a vertex v /∈ S ∪ T isolated if every incident hyperedge e ∈ I(v) is mixed. Figure 1c illustrates an isolated vertex. An isolated vertex cannot be reached from either S or T via hyperedges not in the cut. Mixed hyperedges remain in both the source-side cut and the target-side cut. Thus isolated vertices can be moved freely between the two blocks to increase balance. It never makes sense to permanently add them to a side, so we exclude them from the piercing step. Furthermore, this needs to be reflected when checking for ε-balance. For checking the bipartition (Sr, V \ Sr) we assume up to n/2 − Sr of the isolated vertices were part of Sr, analogously for Tr. Maximum Flow Algorithm. In our implementation, we adapt Dinic maximum flow al- gorithm [21] to operate directly on the hypergraph, as described in Section 3.3. Dinic algorithm has two alternating phases that are repeated until a maximum flow is found: com- puting hop distance labels of nodes, using Breadth-First-Search, and finding augmenting paths using Depth-First-Search, such that the distance labels always increase by one along the path. We interleave the first phase of Dinic algorithm with the computation of reachable vertices, in order to avoid duplicate hypergraph traversal. This intrusive optimization is important for improving the running time of flow augmentation in practice, as the part of the running time of the flow algorithm that cannot be charged towards computing reachable vertices is dominated by the part that can be. This is not possible with push-relabel algorithms [25], which is why they were ruled out after short experimentation. We experimented with the Edmonds-Karp flow algorithm [22], modified to augment flow along multiple vertex-disjoint paths in one Breadth-First-Search by propagating vertex labels through the layers. It is slightly slower than Dinic for plain HyperFlowCutter but unfeasible for the refinement variant of HyperFlowCutter, since there are fewer vertices to route flow through and thus the amount of flow augmented per Breadth-First-Search is limited by a few bottleneck vertices. 4.2 Disconnected Hypergraphs The HyperFlowCutter core algorithm is limited to connected hypergraphs since it computes S- T-cuts. An obvious approach for handling disconnected hypergraphs is connecting components artifically. We refrained from this because a component that intersects neither S nor T would be added to S or T in its entirety. Instead, we run the core algorithm up to ε = 0 on every connected component. The core algorithm computes multiple bipartitions with different balances. We systematically try all possible ways to combine the bipartitions of the components into a bipartition of H. This can be stated as a generalization of the well-known SubsetSum problem. Sub- setSum is a weakly NP-hard decision problem, which asks whether a subset of an input multiset of positive integers A = {a1, . . . , az}, the items, sums to an input target sum W. Finding a bipartition with zero cut is equivalent to SubsetSum, where the items are the sizes of the components and W is the minimum size of the smaller block. We are interested in any subset summing to at least W. Let A be sorted in increasing order and let Q(i, S) be a boolean variable, which is true iff a subset of the first i items sums to S. The standard pseudo-polynomial time dynamic program (DP) [15, Section 35.5] for SubsetSum computes solutions for all possible target sums. It fills the DP table Q by iterating through the items in increasing order and setting Q(i, S) to true if Q(i − 1, S − ai) or Q(i − 1, S) is true. For filling row i, only row i − 1 is required, so the memory footprint is not quadratic. We now turn to non-zero cut bipartitions by allowing to split items in different ways and associating costs with the splits. The core algorithm computes multiple bipartitions Pi on component Ci, at most one for every possible size of the smaller side. These correspond 8 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm directly to the different ways we can split items. The associated cost is the cut size. We modify the standard SubsetSum DP to minimize the added cuts instead of finding any subset, ensuring every component/item is split only one way in a solution, i. e., select a bipartition, and trying the smaller and larger side of the component bipartition for the smaller side of the bipartition of H. The worst case asymptotic running time of this DP is Pi−1 j=1 PiPj). O(Pz i=1 Section 8.2]. Then g =Pk−1 j=1 Cj for the smallest k such that Ck > 1 +Pk−1 We propose some optimizations to make the approach faster in practice. First we solve standard SubsetSum to check whether H has an ε-balanced bipartition with zero cut. For the gap-filler optimization, we find the largest g ∈ N such that for every x ∈ [0, g] there are connected components, whose sizes sum to x. Computing g is possible in O(n) time. Let C1, . . . , Cz be sorted by increasing size, which takes O(n) time using counting sort [15, j=1 Cj. It is never beneficial to split the components C1, . . . , Ck−1. For most hypergraphs we consider in our experiments, we do not invoke the DP because, due to gap-filler, we split only the largest component. For the hypergraphs on which we do invoke the DP, its running time is negligible. Nonetheless, it is easy to construct a worst case instance, where the quadratic running time is prohibitive. For a robust algorithm, we propose to sample bipartitions from every Pi so that the worst case running time falls below some input threshold. The samples should include balanced bipartitions to guarantee that a balanced partition on H can be combined from those on H[Ci]. i ⊂ Vi such that V 0 4.3 HyperFlowCutter as a Refinement and Balancing Algorithm Instead of partitioning from scratch, HyperFlowCutter can be used to refine an existing balanced bipartition π = (V1, V2), or repair the balance of an unbalanced bipartition. We i ≤ α · n for a relative block-size threshold fix two blocks of vertices V 0 parameter α ∈ [0, 0.5]. To obtain V 0 i we run Breadth-First-Search from the boundary vertices on the side of Vi until Vi − α · n vertices have been visited. The α · n vertices not visited by the Breadth-First-Search are set as V 0 1 , T = V 0 2. We call this algorithm ReBaHFC. This idea is equivalent to the way KaHyPar and KaHiP extract corridors around the cut for their flow-based refinement. Only the semantics of the size constraint are different to our approach. However, KaHyPar and KaHiP only compute one flow. If the associated bipartition is not balanced, a smaller flow network is derived. This is repeated until the bipartition is balanced. ReBaHFC does not need to repeatedly re-scale flow networks. i . Then we run HyperFlowCutter with S = V 0 In this work we only perform refinement as a post-processing step to a given partition, whereas KaHyPar and KaHiP employ flow-based refinement on the multilevel hierarchy. In a future work we hope to integrate HyperFlowCutter based refinement into KaHyPar. Using ReBaHFC could eliminate the significant overhead of repeated rescaling and improve solution quality -- in particular when the minimum cut is just short of being balanced. We use the fast multilevel partitioner PaToH [13] to obtain initial partitions. We briefly discuss properties of PaToH and differences between its presets. For coarsening, PaToH uses agglomerative clustering, based on the number of common hyperedges divided by cluster size. For initial partitioning, a portfolio of graph growing, bin packing and neighborhood expansion algorithms is used. For refinement PaToH uses a pass of FM [23] followed by a pass of KL [32], each initialized with boundary nodes. In order to improve cut size, Walshaw [49] proposed to iterate the multilevel scheme by contracting only nodes from the same block, which maintains the cut size, thus allowing refinement on coarse levels starting from a relatively high quality partition. The existing L. Gottesbüren, M. Hamann, D.Wagner 9 Table 1 Average and quantile speedups of the hybrid and interleaved execution strategies. hybrid interleaved avg min 0.4 2.21 3.88 0.55 0.1 0.96 1.0 0.25 median 1.29 1.07 1.14 1.38 0.75 1.55 1.74 0.9 2.57 2.66 max 49.66 175.47 partition serves as initial partition on the coarsest level. One iteration is called a V-cycle. Contraction can be stopped at different stages. The quality preset PaToH-Q, uses 3 full V- cycles and 3 shorter V-cycles as opposed to the single V-cycle of the default preset PaToH-D. To accelerate partitioning, both presets temporarily discard hyperedges which have more pins than some threshold. PaToH-D sets a lower threshold than PaToH-Q. 5 Experimental Evaluation We implemented HyperFlowCutter and ReBaHFC in C++17 and compiled our code using g++8 with flags -O3 -mtune=native -march=native. The source code is available on GitHub1. Experiments are performed sequentially on a cluster of Intel Xeon E5-2670 (Sandy Bridge) nodes with two Octa-Core processors clocked at 2.6 GHz with 64 GB RAM, 20 MB L3- and 8×256 KB L2-Cache, using only one core of a node. We use the benchmark set2 of Heuer and Schlag [29], which has been used to evaluate KaHyPar. It consists of 488 hypergraphs from four sources: the ISPD98 VLSI Circuit Benchmark Suite [3] (VLSI, 18 hypergraphs), the DAC 2012 Routability-Driven Placement Benchmark Suite [38] (DAC, 10), the SuiteSparse Matrix Collection [17] (SPM, 184) and the international SAT Competition 2014 [8] (Literal, Primal, Dual, 92 hypergraphs each). The set contains 173 disconnected hypergraphs, in particular all DAC instances are disconnected. Refer to [29] for more information on how the hypergraphs were derived. Unless mentioned otherwise, experiments are performed on the full benchmark set. In the following we describe the configuration of ReBaHFC and plain HyperFlowCutter, before comparing them to competing algorithms in Section 5.4. 5.1 General HyperFlowCutter Configuration To improve the solution quality of HyperFlowCutter, we run it q ∈ N times with different terminal pairs and take the minimum cut. To improve running time we run them simultan- eously, in an interleaved fashion, as already described in [26], so that the output-sensitive running time depends on the smallest found ε-balanced cut, not the largest. We always schedule the terminal pair with the currently smallest cut to progress. Table 1 shows the average and some quantile speedups when interleaving the execution of 20 random terminal vertex pairs, instead of running them one after another; repeated for 5 random seeds. Because consecutive execution exhibits more memory locality, we also tested a hybrid strategy where the instance with the currently smallest cut is allowed to make multiple progress iterations. Interleaving outperforms consecutive execution by a factor of 3.88 on average and also consistently beats hybrid execution. This shows that saving work is more important than memory locality. These numbers stem from a preliminary experiment 1 Souce code available at https://github.com/kit-algo/HyperFlowCutter 2 Benchmark set and detailed statistics available at https://algo2.iti.kit.edu/schlag/sea2017/ 10 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm Figure 2 Improvement ratios 1 − cut(ReBaHFC) cut(PaToH) of the two ReBaHFC variants and ε = 0, 0.03 compared to their initial partitions. The curves are independent from one another. Higher values are better. Ratios of zero mean ReBaHFC did not improve the initial partition. We count partitions with zero cut as an improvement ratio greater than 1, since ReBaHFC does not invoke PaToH in this case. on a 139 hypergraph subset of the full benchmark set. The subset contains 78 sparse matrices, 17 Primal, 23 Dual, 6 Literal SAT instances, 15 VLSI and 0 DAC instances. It contains only connected hypergraphs (all DAC instances are disconnected) in order to measure the impact of interleaving, not the setup overhead for many small connected components. 5.2 ReBaHFC Configuration We now discuss the configuration for ReBaHFC. The imbalance for the initial partition is set to the same value as the desired imbalance ε for the output partition, which proved superior to larger imbalances on initial partitions. The block-size threshold parameter α should depend on ε, so we settled on α = 0.4 for ε = 0.03 and α = 0.46 for ε = 0. We resize the blocks once and run HyperFlowCutter five times, interleaved as described in the previous section. This number seems to provide decent quality without increasing running time too much. We consider two variants: ReBaHFC-D, which uses PaToH with default preset and ReBaHFC-Q, which uses PaToH with quality preset. The parameter study, which led to these choices, is discussed in more detail in Appendix A. Figure 2 shows how much ReBaHFC improves the initial partition. We run the two ReBaHFC variants for ε = 0, 0.03 on all hypergraphs of the benchmark set with five different random seeds and plot the ratio 1 − cut(ReBaHFC) cut(PaToH) per run. Note that there is no comparison between the curves, and higher values are better for ReBaHFC. Table 2 reports how often ReBaHFC improves the initial partition, for different hypergraph classes. As expected, ReBaHFC-Q could improve fewer solutions than ReBaHFC-D since the PaToH baseline is already better. Furthermore, ReBaHFC has more opportunities for refinement with ε = 0.03, in particular on the DAC and VLSI instances, whereas it struggles with the Primal and Literal SAT instances for ε = 0. Note that other refinement algorithms do not always improve solutions either. In particular, local moving based refinement algorithms struggle with zero-gain moves in the presence of large hyperedges, and the flow-based refinement in KaHyPar can yield unbalanced solutions or reproduce the existing solution. These results 020040060080010001200140016001800200022002440instances0.000.010.050.100.200.400.600.801.001−ReBaHFC−XlibPaToH−XpartitionswithzerocutReBaHFC-Q=0.0ReBaHFC-D=0.0ReBaHFC-Q=0.03ReBaHFC-D=0.03 L. Gottesbüren, M. Hamann, D.Wagner 11 Table 2 Overview by hypergraph class, how often ReBaHFC improves the initial partition. Algorithm ε ReBaHFC-Q 0.00 ReBaHFC-D 0.00 ReBaHFC-Q 0.03 ReBaHFC-D 0.03 all 37.3 49.2 52.5 64.5 SPM Dual Primal 23.9 39.8 27.4 58.4 50.9 47.2 61.5 56.7 47.4 59.8 51.5 65.9 Lit DAC VLSI 34.4 33.0 47.8 41.3 76.7 57.8 71.1 86.7 66.0 58.0 82.0 76.0 show that HyperFlowCutter is a promising candidate for a refinement algorithm integrated in a multilevel partitioner, which is a direction we hope to investigate in future work. The PaToH runs in the experiments from Section 5.4 use other random seeds than those used internally in ReBaHFC. This makes sure that stand-alone PaToH can find smaller cuts than ReBaHFC. 5.3 Plain HyperFlowCutter Configuration For the experiments on perfectly balanced partitioning we run plain HyperFlowCutter with up to q = 100 terminal pairs and take the minimum cut. This value was used already for FlowCutter [26]. With plain HyperFlowCutter we want to push the envelope on solution quality for ε = 0, regardless of running time -- because, as the experiments show, ReBaHFC already provides a good time-quality trade-off. The most simple method for choosing starting terminals is to select random vertices. We unsuccessfully experimented with pseudo-peripheral terminals, i. e. two vertices that are intuitively far away from each other and at the boundary of the hypergraph. Instead we propose a selection method based on ensemble classification. Ensemble classification is a technique used in machine learning to build a strong classifier from multiple weak ones. We compute 10 bipartitions π1, . . . , π10 with PaToH-D. Let x ≡ y ⇔ πi(x) = πi(y) for all i = 1, . . . , 10 be the equivalence relation, in which two vertices are equivalent if they are in the same block for all ensemble bipartitions. An equivalence class is likely in the same block of a good bipartition and is thus suited as a terminal set. We order the equivalence classes by size in descending order and group two successive classes as one terminal pair. Generally speaking, the larger equivalence classes make for better terminal pairs. Based on experiments in Appendix B, we use 3 ensemble terminal pairs and 97 random vertex pairs. The reported running time for plain HyperFlowCutter always includes the running time for the 10 PaToH-D runs. On 42 of the 488 hypergraphs, plain HyperFlowCutter with 100 terminal pairs exceeds the eight hour time limit. One downside of interleaving executions is that the solution is only available once all terminal pairs have been processed. Instead of interleaving all 100 executions, we run four waves of h1, 5, 14, 80i¸ terminal pairs consecutively and interleave execution within waves. An improved bipartition is available after every wave, so that, even if the time limit is exceeded, a solution is available as long as the first wave has been completed. We chose wave sizes, so that completing waves four and three corresponds to 100 and 20 terminal pairs, respectively, as these values were used in [26]. The first wave consists of the first ensemble terminal pair, the second/third wave consist of 5/14 random terminal pairs and the fourth wave consists of 78 random as well as two additional ensemble terminal pairs. There are 438 hypergraphs for which the fourth wave finishes, 35 for which the third but not the fourth wave finishes, 6 for the second, 1 for the first and there are 8 hypergraphs which are partitioned with zero cut, using just the subset sum preprocessing. 12 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm Figure 3 Comparison between the algorithms for ε = 0.03. Left: Absolute running times for every hypergraph and random seed. Right: Performance plot relating the minimum cut per algorithm and hypergraph to the overall best cut for that hypergraph. Lower values are better. 5.4 Comparing ReBaHFC and HyperFlowCutter against State-of-the-Art Hypergraph Partitioners In this section, we compare ReBaHFC and plain HyperFlowCutter against state-of-the-art hypergraph partitioners. After discussing our comparison methodology, we present results for two settings, namely ε = 0.03 and ε = 0. Methodology. We run each partitioner five times with different random seeds and report the minimum cut. For every run we set a time limit of eight hours. We use the performance plots introduced in [44] to compare algorithms on a per-hypergraph basis regarding cut size. For each algorithm and hypergraph these plots contain a performance ratio 1 − best/algorithm, which relates the minimum cut found by any algorithm to the minimum cut found by this algorithm. The ratios of each algorithm are sorted in increasing order. A ratio of 0 means that this algorithm found the smallest overall cut, the number of achieved ratios of 0 is the number of hypergraphs on which this algorithm is the best. Furthermore, algorithm A dominates algorithm B if the curve of A is strictly below that of B. We use values greater than 1 to indicate that algorithms exceeded the time limit or produced unbalanced solutions. This is clearly marked in the plots. To include partitions with zero cut, we set the performance ratio to 0, if the algorithm found the zero cut partition, and 1 otherwise. The performance plots use a cube root scaled y-axis in order to reduce right skewness [16] and to give a fine-grained view on the smaller improvements. For comparing algorithms regarding running time we use a combination of a scatter plot, which shows every measured running time, and a box plot (0.25, median, 0.75 quantiles, whiskers at most extreme points within distance 1.5·IQR from the upper/lower quartile). The running time plots use a fifth root scaled y-axis for a fine-grained view on areas with smaller running times, which contain more data points. Comparison for 3% imbalance. For ε = 0.03 we compare ReBaHFC against the state-of- the-art hypergraph partitioning tools KaHyPar-MF (the latest version of KaHyPar with flow-based refinement) and hMETIS-R (the recursive bisection variant of hMETIS), as well as PaToH-D (default preset) and PaToH-Q (quality preset). We use the library interface of PaToH. According to the hMETIS manual, hMETIS-R is preferred over hMETIS-K (direct k-way) for bipartitions, so we exclude hMETIS-K. These tools were chosen because KaHyPar-MFHMetis-RReBaHFC-QReBaHFC-DPaToH-QPaToH-Dalgorithm015025075025001000028800runningtime[s]151101151201251301351401451488hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmtimelimitKaHyPar-MFHMetis-RReBaHFC-QReBaHFC-DPaToH-QPaToH-D L. Gottesbüren, M. Hamann, D.Wagner 13 Figure 4 Comparison between the algorithms for ε = 0. Left: Absolute running times for every hypergraph and random seed. Right: performance plot relating the minimum cut per algorithm and hypergraph to the overall best cut for that hypergraph. Lower values are better. they provide the best solution quality according to [2, 29]. We chose ε = 0.03 as this is a commonly used value in the literature. Plain HyperFlowCutter is excluded from this part of the experiments because it is not competitive. Figure 3 shows the running times and a performance plot on the full benchmark set for ε = 0.03. In addition to the running time plot, we compare algorithms by the geometric mean of their running times. We use the geometric mean in order to give instances of different sizes a comparable influence. KaHyPar-MF finds the smallest cut on 292 hypergraphs, hMETIS-R on 257, ReBaHFC-Q on 228, ReBaHFC-D on 177, PaToH-Q on 136 and PaToH-D on 75 of the 488 hypergraphs. While KaHyPar-MF is the best algorithm regarding solution quality, it is also the slowest, exceeding the time limit on 11 hypergraphs. For the instances on which ReBaHFC-Q does not find the best solution it provides solution quality similar to hMETIS-R and only marginally worse than KaHyPar-MF. In particular its solution quality compared to the best cut deteriorates less than that of hMETIS-R. With 2.23s PaToH-Q is one order of magnitude faster than KaHyPar (34.1s) and hMETIS-R (20.1s), whereas ReBaHFC-Q (2.32s) is only slightly slower than PaToH-Q. Furthermore ReBaHFC-D (0.68s) finds more of the best solutions than PaToH-Q at a running time between PaToH-D (0.5s) and PaToH-Q. Thus ReBaHFC-Q and ReBaHFC-D provide new Pareto points in the time-quality trade-off. In Appendix C Figure 7 shows performance plots for the different hypergraph classes of the benchmark set. ReBaHFC is particularly good on the DAC and SPM instances. There are hypergraphs on which ReBaHFC is faster than PaToH. These are disconnected hypergraphs, for which ReBaHFC invokes PaToH on smaller sub-hypergraphs, due to the gap-filler optimization and the SubsetSum preprocessing described in Section 4.2. Comparison for perfectly balanced partitioning. Even though the setting ε = 0 has received no attention in hypergraph partitioning and only some attention in graph partition- ing [43, 37, 14, 9, 10, 11, 18], we consider it here. Previous studies on perfectly balanced partitioning for graphs have focused on high quality solutions through running time intensive metaheuristics such as evolutionary algorithms [43, 10, 9] or tabu search [11] and even an exact branch-and-bound algorithm [18]. Therefore, we include KaHyPar-EVO [6] (the evolutionary algorithm of KaHyPar) as well as plain HyperFlowCutter in addition to the already considered algorithms. We exclude hMETIS-R from this comparison since it rejects ε < 0.002 for bipartitions. HFC-100ReBaHFC-QReBaHFC-DPaToH-QPaToH-DKaHyPar-EVOKaHyPar-MFalgorithm015025075025001000028800runningtime[s]151101151201251301351401451488hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmtimelimitunbalancedHFC-100ReBaHFC-QReBaHFC-DPaToH-QPaToH-DKaHyPar-EVOKaHyPar-MF 14 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm We include plain HyperFlowCutter with up to 100 terminal pairs as described in Section 5.1 and denote this configuration as HFC-100. The evolutionary algorithm KaHyPar-EVO generates, manages and improves a pool of solutions until a time limit is exceeded, and outputs the minimum cut out of all generated solutions. We set the instance-wise time limit to the maximum of the running times of HFC-100 and KaHyPar-MF to evaluate whether KaHyPar-EVO can yield better solution quality when given the same running time as HFC-100. As opposed to the original paper, we configure KaHyPar-EVO to use flow-based refinement, which further improves solution quality. KaHyPar-MF is unable to find any balanced bipartition on 4 hypergraps, whereas KaHyPar-EVO always finds one. Furthermore, KaHyPar-MF exceeds the time limit on 7 hypergraphs and KaHyPar-EVO on an additional 17, without reporting intermediate solutions. Figure 4 shows the running times and a performance plot of all tested algorithms. HFC-100 produces the best solutions on 245 hypergraphs, followed by ReBaHFC-Q (230), ReBaHFC-D (122), PaToH-Q (121), PaToH-D (40), KaHyPar-EVO (28) and finally KaHyPar-MF (15). This shows that with exorbitant running time, HFC-100 produces high quality solutions for ε = 0. However the time-quality trade-off is clearly in favor of ReBaHFC-Q, especially since the solution quality of the latter is closer to the best cut for the instances on which it does not find the best cut, as opposed to HFC-100. PaToH is better than KaHyPar for ε = 0 because it includes a KL [32] refinement pass as opposed to KaHyPar which only uses FM [23]. 6 Conclusion In this paper we propose and evaluate HyperFlowCutter, a hypergraph bipartitioning algorithm based on maximum flow computations. It enumerates partitions with increasing balance up to perfect balance. We also propose and evaluate ReBaHFC, a refinement algorithm based on HyperFlowCutter. In our experimental evaluation on a large set of hypergraphs, we show that while ReBaHFC is unable to beat the state-of-the-art hypergraph partitioners in terms of quality, it is still close in terms of quality and at the same time an order of magnitude faster. Thus, it offers a new trade-off between quality and running time. For the special case of perfectly balanced bipartitioning, the plain HyperFlowCutter algorithm, while being slow, computes the highest- quality solutions. In this setting, ReBaHFC not only still beats all other partitioners but is also much faster. In future work, it would be interesting to integrate the refinement step of ReBaHFC into multilevel partitioners to see if it can further improve their solution quality. References 1 Ravindra K. Ahuja, Thomas L. Magnanti, and James B. Orlin. Network Flows: Theory, Algorithms, and Applications. Prentice Hall, 1993. 2 Yaroslav Akhremtsev, Tobias Heuer, Sebastian Schlag, and Peter Sanders. Engineering a direct k-way Hypergraph Partitioning Algorithm. In Proceedings of the 19th Meeting on Algorithm Engineering and Experiments (ALENEX'17), pages 28 -- 42. SIAM, 2017. doi: 10.1137/1.9781611974768.3. Charles J. Alpert. The ISPD98 Circuit Benchmark Suite. In Proceedings of the 1998 Interna- tional Symposium on Physical Design, pages 80 -- 85, 1998. doi:10.1145/274535.274546. 3 4 Charles J. Alpert, Jen-Hsin Huang, and Andrew B. Kahng. Multilevel Circuit Partitioning. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 17(8):655 -- 667, August 1998. doi:10.1109/43.712098. L. Gottesbüren, M. Hamann, D.Wagner 15 5 Charles J. Alpert and Andrew B. Kahng. Recent Directions in Netlist Partitioning: A Survey. Integration: The VLSI Journal, 19(1-2):1 -- 81, 1995. doi:10.1016/0167-9260(95)00008-4. 6 Robin Andre, Sebastian Schlag, and Christian Schulz. Memetic Multilevel Hypergraph Partitioning. In Proceedings of the Genetic and Evolutionary Computation Conference, pages 347 -- 354. ACM Press, July 2018. doi:10.1145/3205455.3205475. 7 David A. Bader, Henning Meyerhenke, Peter Sanders, and Dorothea Wagner. Graph Partition- ing and Graph Clustering: 10th DIMACS Implementation Challenge, volume 588. American Mathematical Society, 2013. doi:10.1090/conm/588. 8 Anton Belov, Daniel Diepold, Marijn JH Heule, and Matti Järvisalo. The SAT Competition 2014, 2014. URL: http://www.satcompetition.org/2014/. 9 Una Benlic and Jin-Kao Hao. An Effective Multilevel Memetic Algorithm for Balanced Graph Partitioning. In IEEE International Conference on Tools with Artificial Intelligence, pages 121 -- 128. IEEE Computer Society, 2010. doi:10.1109/ICTAI.2010.25. 10 Una Benlic and Jin-Kao Hao. A Multilevel Memetic Approach for Improving Graph k- Partitions. IEEE Transactions on Evolutionary Computation, 15(5):624 -- 642, October 2011. doi:10.1109/TEVC.2011.2136346. 11 Una Benlic and Jin-Kao Hao. An Effective Multilevel Tabu Search Approach for Balanced Graph Partitioning. Computers & Operations Research, 38(7):1066 -- 1075, July 2011. doi: 10.1016/j.cor.2010.10.007. 12 Thang Nguyen Bui and Curt Jones. Finding good approximate vertex and edge partitions is NP-hard. Information Processing Letters, 42(3):153 -- 159, 1992. doi:10.1016/0020-0190(92) 90140-Q. 13 Umit Catalyurek and Cevdet Aykanat. Hypergraph-Partitioning-Based Decomposition for Parallel Sparse-Matrix Vector Multiplication. IEEE Transactions on Parallel and Distributed Systems, 10(7):673 -- 693, 1999. doi:10.1109/71.780863. Pierre Chardaire, Musbah Barake, and Geoff P. McKeown. A PROBE-Based Heuristic for Graph Partitioning. IEEE Transactions on Computers, 56(12):1707 -- 1720, 2007. doi: 10.1109/TC.2007.70760. 14 15 Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms. MIT Press, second edition, 2001. 16 Nicholas J. Cox. Stata tip 96: Cube roots. The Stata Journal, 11(1):149 -- 154, 2011. doi: 10.1177/1536867X1101100112. 17 Timothy A. Davis and Yifan Hu. The University of Florida Sparse Matrix Collection. ACM Transactions on Mathematical Software, 38(1), 2011. doi:10.1145/2049662.2049663. 18 Daniel Delling and Renato F. Werneck. Better Bounds for Graph Bisection. In Leah Epstein and Paolo Ferragina, editors, Proceedings of the 20th Annual European Symposium on Algorithms (ESA'12), volume 7501 of Lecture Notes in Computer Science, pages 407 -- 418. Springer, 2012. doi:10.1007/978-3-642-33090-2_36. 19 Karen Devine, Erik Boman, Robert Heaphy, Rob Bisseling, and Umit Catalyurek. Par- allel Hypergraph Partitioning for Scientific Computing. In 20th International Parallel and Distributed Processing Symposium (IPDPS'06). IEEE Computer Society, 2006. doi: 10.1109/IPDPS.2006.1639359. Julian Dibbelt, Ben Strasser, and Dorothea Wagner. Customizable Contraction Hierarchies. ACM Journal of Experimental Algorithmics, 21(1):1.5:1 -- 1.5:49, April 2016. doi:10.1145/ 2886843. 20 21 Yefim Dinitz. Algorithm for Solution of a Problem of Maximum Flow in a Network with Power Estimation. Soviet Mathematics-Doklady, 11(5):1277 -- 1280, September 1970. Jack Edmonds and Richard M. Karp. Theoretical Improvements in Algorithmic Efficiency for Network Flow Problems. Journal of the ACM, 19(2):248 -- 264, April 1972. doi:10.1145/ 321694.321699. 22 16 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm 23 24 Charles M. Fiduccia and Robert M. Mattheyses. A linear-time heuristic for improving network partitions. In Proceedings of the 19th ACM/IEEE Conference on Design Automation, pages 175 -- 181, 1982. doi:10.1145/800263.809204. Lester R. Ford, Jr. and Delbert R. Fulkerson. Maximal flow through a network. Canadian Journal of Mathematics, 8:399 -- 404, 1956. 25 Andrew V. Goldberg and Robert E. Tarjan. A new approach to the maximum-flow problem. Journal of the ACM, 35(4):921 -- 940, 1988. doi:10.1145/48014.61051. 26 Michael Hamann and Ben Strasser. Graph Bisection with Pareto Optimization. ACM Journal of Experimental Algorithmics, 23(1):1.2:1 -- 1.2:34, 2018. doi:10.1145/3173045. 27 Bruce Hendrickson and Robert Leland. A Multilevel Algorithm for Partitioning Graphs. In Proceedings of the 1995 ACM/IEEE conference on Supercomputing (SC'05), page 28. ACM Press, 1995. doi:10.1145/224170.224228. 28 Tobias Heuer, Peter Sanders, and Sebastian Schlag. Network Flow-Based Refinement for Multilevel Hypergraph Partitioning. In Proceedings of the 17th International Symposium on Experimental Algorithms (SEA'18), Leibniz International Proceedings in Informatics, pages 1 -- 19, 2018. doi:10.4230/LIPIcs.SEA.2018.1. Tobias Heuer and Sebastian Schlag. Improving Coarsening Schemes for Hypergraph Partitioning by Exploiting Community Structure. In Costas S. Iliopoulos, Solon P. Pissis, Simon J. Puglisi, and Rajeev Raman, editors, Proceedings of the 16th International Symposium on Experimental Algorithms (SEA'17), volume 75 of Leibniz International Proceedings in Informatics, 2017. doi:10.4230/LIPIcs.SEA.2017.21. 30 George Karypis, Rajat Aggarwal, Vipin Kumar, and Shashi Shekhar. Multilevel Hypergraph Partitioning: Applications in VLSI Domain. IEEE Transactions on Very Large Scale Integration (VLSI) Systems, 7(1):69 -- 79, 1999. doi:10.1109/92.748202. 29 33 32 31 George Karypis and Vipin Kumar. Multilevel K-Way Hypergraph Partitioning. In Proceedings of the 36th Annual ACM/IEEE Design Automation Conference, 1999. doi:10.1145/309847. 309954. Brian W. Kernighan and Shen Lin. An Efficient Heuristic Procedure for Partitioning Graphs. Bell System Technical Journal, 49(2):291 -- 307, February 1970. doi:10.1002/j.1538-7305. 1970.tb01770.x. Eugene L. Lawler. Cutsets and Partitions of hypergraphs. Networks, 3:275 -- 285, 1973. doi:10.1002/net.3230030306. 34 Thomas Lengauer. Combinatorial Algorithms for Integrated Circuit Layout. Wiley, 1990. 35 Jianmin Li, John Lillis, and C.K. Cheng. Linear decomposition algorithm for VLSI design applications. In Proceedings of the 1995 IEEE/ACM International Conference on Computer- Aided Design, pages 223 -- 228. IEEE Computer Society, 1995. doi:10.1109/ICCAD.1995. 480016. 36 Huiqun Liu and D.F. Wong. Network-Flow-Based Multiway Partitioning with Area and Pin Constraints. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 17(1):50 -- 59, 1998. doi:10.1109/43.673632. 37 Henning Meyerhenke, Burkhard Monien, and Thomas Sauerwald. A new diffusion-based multilevel algorithm for computing graph partitions. Journal of Parallel and Distributed Computing, 69(9):750 -- 761, 2009. doi:10.1016/j.jpdc.2009.04.005. 38 Viswanath Nagarajan, Charles J. Alpert, Cliff Sze, Zhuo Li, and Yaoguang Wei. The DAC 2012 Routability-driven Placement Contest and Benchmark Suite. In Proceedings of the 49th Annual Design Automation Conference, 2012. doi:10.1145/2228360.2228500. 39 David A. Papa and Igor L. Markov. Hypergraph Partitioning and Clustering. In Teofilo F. Gonzalez, editor, Handbook of Approximation Algorithms and Metaheuristics. Chapman and Hall/CRC, 2007. doi:10.1201/9781420010749. Jean-Claude Picard and Maurice Queyranne. On the Structure of All Minimum Cuts in a Network and Applications. Mathematical Programming, Series A, 22(1):121, December 1982. doi:10.1007/BF01581031. 40 L. Gottesbüren, M. Hamann, D.Wagner 17 41 42 43 44 Joachim Pistorius and Michel Minoux. An Improved Direct Labeling Method for the Max -- Flow Min -- Cut Computation in Large Hypergraphs and Applications. International Transactions in Operational Research, 10(1):1 -- 11, 2003. doi:10.1111/1475-3995.00389. Peter Sanders and Christian Schulz. Engineering Multilevel Graph Partitioning Algorithms. In Proceedings of the 19th Annual European Symposium on Algorithms (ESA'11), volume 6942 of Lecture Notes in Computer Science, pages 469 -- 480. Springer, 2011. doi:10.1007/ 978-3-642-23719-5_40. Peter Sanders and Christian Schulz. Think Locally, Act Globally: Highly Balanced Graph Partitioning. In Proceedings of the 12th International Symposium on Experimental Algorithms (SEA'13), volume 7933 of Lecture Notes in Computer Science, pages 164 -- 175. Springer, 2013. doi:10.1007/978-3-642-38527-8_16. Sebastian Schlag, Vitali Henne, Tobias Heuer, Henning Meyerhenke, Peter Sanders, and Chris- tian Schulz. k-way Hypergraph Partitioning via n-Level Recursive Bisection. In Proceedings of the 18th Meeting on Algorithm Engineering and Experiments (ALENEX'16), pages 53 -- 67. SIAM, 2016. doi:10.1137/1.9781611974317.5. 45 Ruslan Shaydulin, Jie Chen, and Ilya Safro. Relaxation-Based Coarsening for Multilevel Hypergraph Partitioning. Multiscale Modeling and Simulation, 17(1):482 -- 506, 2019. doi: 10.1137/17M1152735. 46 A. J. Soper, Chris Walshaw, and Mark Cross. The Graph Partitioning Archive, 2004. URL: http://chriswalshaw.co.uk/partition/. 47 Aleksandar Trifunovic and William J. Knottenbelt. Parallel Multilevel Algorithms for Hy- pergraph Partitioning. Journal of Parallel and Distributed Computing, 68(5):563 -- 581, 2008. doi:10.1016/j.jpdc.2007.11.002. 48 Brendan Vastenhouw and Rob Bisseling. A Two-Dimensional Data Distribution Method for Parallel Sparse Matrix-Vector Multiplication. SIAM Review, 47(1):67 -- 95, 2005. doi: 10.1137/S0036144502409019. 49 Chris Walshaw. Multilevel Refinement for Combinatorial Optimisation Problems. Annals of Operations Research, 131(1):325 -- 372, October 2004. doi:10.1023/B:ANOR.0000039525.80601. 15. 50 Hannah Honghua Yang and D.F. Wong. Efficient Network Flow Based Min-Cut Balanced Partitioning. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 15(12):1533 -- 1540, 1996. doi:10.1007/978-1-4615-0292-0_41. 18 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm ReBaHFC Parameter Discussion A In this section we discuss our parameter choices for ReBaHFC. We use PaToH to obtain initial partitions for ReBaHFC, because it is between one and two orders of magnitude faster than KaHyPar and hMETIS, depending on whether the default or quality preset is used. In addition to constructing corridors using Breadth-First-Search, we also tried using PaToH to resize the blocks again. Regarding solution quality, the two methods are roughly equivalent, which can be seen in Figure 5. However, we would like to investigate the suitability of HyperFlowCutter as a refinement algorithm in a multilevel framework such as KaHyPar, which is specifically suited since it already contains the necessary infrastructure for its own flow-based refinement. Further, the necessary overhead of one or two additional invokations of PaToH led us to prefer corridor-construction using Breadth-First-Search. with α = 0.4 working best. For ε = 0 we tested α ∈ {0.46, 0.475, 0.49, 0.498} with α = 0.46 working best. Smaller values for α are possible but are not recommended since larger flow problems would increase the running time too much. Furthermore, we experimented with two different imbalance parameters ε0 ∈ {0.03, 0.05} for the initial partition, with requested imbalance ε = 0.03 for the output partition. Figure 5e shows that using an imbalance ε0 > ε for the initial partition yields worse output partitions. We tested several block-size threshold values α. For ε = 0.03 we tested α ∈ {0.4, 0.42, 0.46, 0.48} L. Gottesbüren, M. Hamann, D.Wagner 19 (a) ReBaHFC-Q, ε = 0.03. (b) ReBaHFC-D, ε = 0.03. (c) ReBaHFC-Q, ε = 0. (d) ReBaHFC-D, ε = 0. (e) ReBaHFC-Q with ε = 0.03 and block resizing using corridors. This plot shows that it is better to use ε0 = ε for the initial partition. Figure 5 Performance plots to compare the two block resizing strategies and block-size thresholds α. For both PaToH presets we get the same best-performing block-size threshold α = 0.4 for ε = 0.03 and α = 0.46 for ε = 0. The block resizing strategies barely differ in quality. 151101151201251301351401451488hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmReBaHFC-Q0=0.03α=0.4CorridorReBaHFC-Q0=0.03α=0.4RepartitionReBaHFC-Q0=0.03α=0.42CorridorReBaHFC-Q0=0.03α=0.42RepartitionReBaHFC-Q0=0.03α=0.44CorridorReBaHFC-Q0=0.03α=0.44RepartitionReBaHFC-Q0=0.03α=0.46CorridorReBaHFC-Q0=0.03α=0.46RepartitionReBaHFC-Q0=0.03α=0.48CorridorReBaHFC-Q0=0.03α=0.48Repartition151101151201251301351401451488hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmReBaHFC-D0=0.03α=0.4CorridorReBaHFC-D0=0.03α=0.4RepartitionReBaHFC-D0=0.03α=0.42CorridorReBaHFC-D0=0.03α=0.42RepartitionReBaHFC-D0=0.03α=0.44CorridorReBaHFC-D0=0.03α=0.44RepartitionReBaHFC-D0=0.03α=0.46CorridorReBaHFC-D0=0.03α=0.46RepartitionReBaHFC-D0=0.03α=0.48CorridorReBaHFC-D0=0.03α=0.48Repartition151101151201251301351401451488hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmReBaHFC-Q0=0α=0.46CorridorReBaHFC-Q0=0α=0.46RepartitionReBaHFC-Q0=0α=0.475CorridorReBaHFC-Q0=0α=0.475RepartitionReBaHFC-Q0=0α=0.49CorridorReBaHFC-Q0=0α=0.49RepartitionReBaHFC-Q0=0α=0.498CorridorReBaHFC-Q0=0α=0.498Repartition151101151201251301351401451488hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmReBaHFC-D0=0α=0.46CorridorReBaHFC-D0=0α=0.46RepartitionReBaHFC-D0=0α=0.475CorridorReBaHFC-D0=0α=0.475RepartitionReBaHFC-D0=0α=0.49CorridorReBaHFC-D0=0α=0.49RepartitionReBaHFC-D0=0α=0.498CorridorReBaHFC-D0=0α=0.498Repartition151101151201251301351401451488hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmReBaHFC-Q0=0.03α=0.4CorridorReBaHFC-Q0=0.03α=0.42CorridorReBaHFC-Q0=0.03α=0.44CorridorReBaHFC-Q0=0.03α=0.46CorridorReBaHFC-Q0=0.03α=0.48CorridorReBaHFC-Q0=0.05α=0.4CorridorReBaHFC-Q0=0.05α=0.42CorridorReBaHFC-Q0=0.05α=0.44CorridorReBaHFC-Q0=0.05α=0.46CorridorReBaHFC-Q0=0.05α=0.48Corridor 20 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm Plain HyperFlowCutter Parameter Discussion B In this section we discuss the configuration choices for plain HyperFlowCutter. Recall that we run plain HyperFlowCutter for ε = 0 with up to 100 terminal pairs using interleaved execution in waves, as introduced in Section 5.3. All experiments in this section are for ε = 0. Ensemble Terminals. We evaluate the ensemble terminal pairs that were introduced in Section 5.3. To assess the impact of replacing randomly generated terminal pairs by ensemble terminal pairs, we propose a randomized experiment. We replace Y ∈ {1, 3, 5, 7, 10} randomly selected terminal pairs out of 100 by the Y first ensemble terminal pairs and measure how often this improved the minimum cut. The results in Table 3 are accumulated over five runs of plain HyperFlowCutter with different random seeds, for each of which we accumulate 500 random samples of Y ejected terminal pairs. Any choice of Y other than 1 improves the solution in roughly 28-29% (better − worse) cases. On 62.3% of the hypergraphs, the first ensemble terminal pair is the best out of 10. Thus we use only Y = 3 ensemble terminal pairs for the final configuration. This experiment was conducted on the 139 hypergraph parameter tuning subset used in Section 5.1. Waves and Impact of Number of Terminal Pairs. In addition to providing intermediate solutions in case the limit is exceeded, the interleaved execution in waves allows us to evaluate the impact of the number of terminal pairs on the entire benchmark set, without re-running the experiments. We call the configuration, which takes the minimum of the first h1, 2, 3, 4i waves finished within time limit, HFC-h1, 6, 20, 100i respectively. Figure 6 shows the sorted per-hypergraph ratios 1 − cut (HFC−X) cut (HFC−1) , which indicate by how much HFC- {6, 20, 100} improved the bipartition of HFC-1. A ratio of zero means HFC-X computed the same solution as HFC-1. In this plot, the ratios share the same x-axis, since hypergraphs are sorted lexicographically by the ratios of HFC-6, HFC-20 and then HFC-100, as opposed to performance plots. This is possible since adding terminals only improves the solution. The purely green leg of 224 hypergraphs are instances on which HFC-1 still produces the best solutions. This confirms the impact of ensemble terminal pairs on quality. The green and blue leg from 225 to 259 are the instances where HFC-100 beats HFC-1 but HFC-20 and HFC-6 do not. The first all-color leg from 260 to 311 are the instances where HFC-100 and HFC-20 beat HFC-6 but HFC-6 does not and on the remaining 177 instances all three compute smaller cuts than HFC-1. Table 3 Percentage of cases in the randomized experiment, which yield a better/worse partition, by replacing Y randomly chosen, randomly generated terminal pairs out of 100 with the Y first ensemble terminal pairs. 1 3 5 10 Y better [%] +23.3 +28.1 +29.4 +30.4 +31.1 worse [%] -4.1 -2.7 -2.1 -0.5 -1.4 7 L. Gottesbüren, M. Hamann, D.Wagner 21 Figure 6 Ratios 1 − cut (HFC−X) cut (HFC−1) for the hypergraphs sorted lexicographically by the ratios of HFC-6, HFC-20 and then HFC-100. A ratio of zero means HFC-1 remains the best for this hypergraph, whereas higher values are better for HFC-X. 151101151201251301351401451488hypergraphs0.000.010.050.100.200.400.600.801.001−cut(HyperFlowCutter−X)cut(HyperFlowCutter−1)HyperFlowCutter-100HyperFlowCutter-20HyperFlowCutter-6 22 Evaluation of a Flow-Based Hypergraph Bipartitioning Algorithm C Performance Plots for different Hypergraph Classes (a) Sparse Matrices. (b) Dual SAT. (c) Primal SAT. (d) Literal SAT. (e) ISPD98 VLSI. (f) DAC. Figure 7 Performance plots for ε = 0.03 comparing the algorithms on the different hypergraph classes of the benchmark set. 151101151184hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmKaHyPar-MFHMetis-RReBaHFC-QReBaHFC-DPaToH-QPaToH-D12141618192hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmtimelimitKaHyPar-MFHMetis-RReBaHFC-QReBaHFC-DPaToH-QPaToH-D12141618192hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmtimelimitKaHyPar-MFHMetis-RReBaHFC-QReBaHFC-DPaToH-QPaToH-D12141618192hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmtimelimitKaHyPar-MFHMetis-RReBaHFC-QReBaHFC-DPaToH-QPaToH-D16111618hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmKaHyPar-MFHMetis-RReBaHFC-QReBaHFC-DPaToH-QPaToH-D1610hypergraphs0.000.010.050.100.200.400.600.801.001−bestalgorithmKaHyPar-MFHMetis-RReBaHFC-QReBaHFC-DPaToH-QPaToH-D
1109.6643
3
1109
2013-10-25T14:15:06
Optimal Eviction Policies for Stochastic Address Traces
[ "cs.DS" ]
The eviction problem for memory hierarchies is studied for the Hidden Markov Reference Model (HMRM) of the memory trace, showing how miss minimization can be naturally formulated in the optimal control setting. In addition to the traditional version assuming a buffer of fixed capacity, a relaxed version is also considered, in which buffer occupancy can vary and its average is constrained. Resorting to multiobjective optimization, viewing occupancy as a cost rather than as a constraint, the optimal eviction policy is obtained by composing solutions for the individual addressable items. This approach is then specialized to the Least Recently Used Stack Model (LRUSM), a type of HMRM often considered for traces, which includes V-1 parameters, where V is the size of the virtual space. A gain optimal policy for any target average occupancy is obtained which (i) is computable in time O(V) from the model parameters, (ii) is optimal also for the fixed capacity case, and (iii) is characterized in terms of priorities, with the name of Least Profit Rate (LPR) policy. An O(log C) upper bound (being C the buffer capacity) is derived for the ratio between the expected miss rate of LPR and that of OPT, the optimal off-line policy; the upper bound is tightened to O(1), under reasonable constraints on the LRUSM parameters. Using the stack-distance framework, an algorithm is developed to compute the number of misses incurred by LPR on a given input trace, simultaneously for all buffer capacities, in time O(log V) per access. Finally, some results are provided for miss minimization over a finite horizon and over an infinite horizon under bias optimality, a criterion more stringent than gain optimality.
cs.DS
cs
Optimal Eviction Policies for Stochastic Address Traces∗ Gianfranco Bilardi† Francesco Versaci‡ University of Padova Abstract The eviction problem for memory hierarchies is studied for the Hidden Markov Reference Model (HMRM) of the memory trace, showing how miss minimization can be naturally formulated in the optimal control setting. In addition to the traditional version assuming a buffer of fixed capacity, a relaxed version is also considered, in which buffer occupancy can vary and its average is constrained. Resorting to multiobjective optimization, viewing occupancy as a cost rather than as a constraint, the optimal eviction policy is obtained by composing solutions for the individual addressable items. This approach is then specialized to the Least Recently Used Stack Model (LRUSM), a type of HMRM often considered for traces, which includes V − 1 parameters, where V is the size of the virtual space. A gain optimal policy for any target average occupancy is obtained which (i) is computable in time O(V ) from the model parameters, (ii) is optimal also for the fixed capacity case, and (iii) is characterized in terms of priorities, with the name of Least Profit Rate (LPR) policy. An O(log C) upper bound (being C the buffer capacity) is derived for the ratio between the expected miss rate of LPR and that of OPT, the optimal off-line policy; the upper bound is tightened to O(1), under reasonable constraints on the LRUSM parameters. Using the stack-distance framework, an algorithm is developed to compute the number of misses incurred by LPR on a given input trace, simultaneously for all buffer capacities, in time O(log V ) per access. Finally, some results are provided for miss minimization over a finite horizon and over an infinite horizon under bias optimality, a criterion more stringent than gain optimality. Keywords: Eviction policies, Paging, Online problems, Algorithms and data structures, Markov chains, Optimal control, Multiobjective optimization. 1 Introduction to Eviction Policies for the Memory Hierarchy The storage of most computer systems is organized as a hierarchy of levels (currently, half a dozen), for technological and economical reasons [27] as well as due to fundamental physical constraints [13]. Memory hierarchies have been investigated extensively, in terms of hardware organization [22,27,44], operating systems [46], compiler optimization [3,26,56], models of computation [45], and algorithm design [1]. A central issue is the decision of which data to keep in which level. It is customary to focus on two levels (see Fig. 1), ∗Published in Theoretical Computer Science, 2013: http://dx.doi.org/10.1016/j.tcs.2013.01.016 †[email protected][email protected]. Currently at Vienna University of Technology. Supported by PAT-INFN Project AuroraScience, by MIUR-PRIN Project AlgoDEEP, and by the University of Padova Projects STPD08JA32 and CPDA099949. 1 Figure 1: Two-level memory hierarchy. respectively called here the buffer and the backing storage, the extension to multiple levels being generally straightforward. (We adopt the neutral names used in the seminal paper of Mattson et al. [37], since the concepts introduced have application at each level of the memory hierarchy: register allocation, CPU caching, memory paging, web caching, etc.) We assume that an engine generates a sequence of access requests a1, a2 . . . , at, . . . for items (equally sized blocks of data) stored in the hierarchy. A request is called a hit if the requested item is in the buffer and a miss otherwise. Upon a miss, the item must be brought into the buffer, a costly operation. If the buffer is full, the requested item will replace another item. We are interested in an eviction policy that selects the items to be replaced so as to minimize subsequent misses. The MIN policy of Belady [7] and the OPT policy1 of Mattson, Gecsei, Sluts, and Traiger [37], minimize the number of misses in an off-line setting. Since, in practical situations, the address trace unfolds with the computation, eviction decisions must be made on-line. Dozens of on-line policies have been proposed and implemented in hardware or within operating systems. Somewhat schematically, we can say that implemented policies have evolved mostly experimentally, by benchmarking plausible proposals against relevant workloads [44]. Most of these policies are variants of the Least Recently Used (LRU) policy. Departure from pure LRU is motivated to a large extent by its high implementation cost. However, several authors have also explored variants of LRU that incur fewer misses, at least on some workloads [38]. Theoretical investigations have focused mostly on two objectives: (a) to "explain" the practical success of LRU-like policies and (b) to explore the existence of better policies. One major question is how to model the input traces (i.e., the lists of requested memory references). An interesting perspective, proposed by Koutsoupias and Papadimitriou [31], is to model traces by a class of stochastic processes, all to be dealt with by the same policy. For a given stochastic model, two metrics help assess the quality of a policy: (i) the expected number of misses and (ii) its ratio with the expected number of misses incurred by OPT, called the competitive ratio. The competitive ratio of a policy with respect to a class of stochastic processes is defined in a worst-case sense, maximizing over the class. Competitive analysis was proposed by Sleator and Tarjan [47] for the class of all possible traces (all stochastic processes), for which they showed that the competitive ratio of any on-line policy is at least the buffer capacity C, a value actually achieved by, e.g., LRU and FIFO. While theoretically interesting, this results shed little light on what is experimentally known. For example, if we restrict the possible traces to the ones which actually emerge in practical applications, the miss ratio between LRU and OPT is much smaller than C, being typically around 2 and seldom exceeding 4. Borodin et al. [15] restrict the class of possible traces to be consistent with an underlying "access graph" that models the program 1OPT: Upon a miss, if the buffer contains items that will not be accessed in the future then evict (any) one of them, else evict the (unique) item whose next access is furthest in the future. 2 GeneratorBufferStoreBBackingStoreat locality (nodes correspond to items and legal traces correspond to walks); a heuristic policy based on this model has been developed by Fiat and Rosen [21] and has been shown to perform better than LRU, relative to some benchmarks. Albers et al. [2] propose a trace restriction based on Denning's working set concept [17]: for a given function f (n), the (average or maximum) number of distinct items referenced in n consecutive steps is at most f (n). LRU is proved to be optimal in both the average and maximum cases. Koutsoupias and Papadimitriou [31] have considered the class ∆ (0 <  ≤ 1) of stochastic processes such that, given any prefix of the trace, the probability to be accessed next is at most  for any item. A combinatorially rich development establishes that LRU achieves minimum competitive ratio, for each value of . A careful analysis of how the competitive ratio depends upon both  and C has been provided by Young [59]: in particular, the competitive ratio increases with . Qualitatively speaking, buffering is more efficient exactly when the items in the buffer are more likely to be referenced than those outside the buffer. Hence, for traces where LRU (or any policy) exhibits good performance (that is, few misses),  must be correspondingly high. Then, the ∆ competitive ratio is also high, unlike what observed in practice. For a more quantitative appraisal of the issue, consider that, at any level of the memory hierarchy of real systems, the average miss ratio is typically below 1/4 (even well below 1% in main memory). Let then C1/2 be the buffer capacity at which the miss rate would be 1/2. It is easy to see that it must be C1/2 ≥ 1/2. The actual buffer capacity C is typically considerably larger than C1/2, say C ≥ 4C1/2, by the rule of thumb that quadrupling the cache capacity halves the miss ratio [44]. Then, C ≥ 2. By the bounds of Young [59], the ∆ competitive ratio of LRU is at least C/2, which is not much more informative than the value C of [47]. To "explain" both the low miss rate and the low competitive ratio of LRU in practical cases, the approach of [31] requires some restriction to the class of stochastic processes, in order to capture temporal locality of the reference trace, while essentially assigning low the probability to those traces for which OPT vastly outperforms LRU. The model and results of Becchetti [6] can be viewed as an exploration of this direction. Following what could be viewed as an extreme case of the approach outlined above, a number of studies have focused on specific stochastic processes (the class is a singleton), with the objective of developing (individually) optimal policies for such processes. In [23], the address trace a1, a2, . . . , at, . . . is taken to be a sequence of mutually independent random variables, a scenario known as the Independent Reference Model (IRM). While attractive for its simplicity, the IRM does not capture the cornerstone property that memory hierarchies relay upon: the temporal locality of references. To avoid this drawback, the LRU-Stack Model (LRUSM) of the trace [40,50] has been widely considered in the literature [19,30,55] and is the focus of much attention in this paper. Here, the trace is statistically characterized by the probability s(j) of accessing the j-th most recently referenced item. The values of j for different accesses are assumed to be statistically independent. Throughout, we assume that the items being referenced belong to a finite virtual space of size V . If s is monotonically decreasing, LRU is optimal [50] (for an infinite trace); in general, the optimal policy varies with s and can differ from LRU, as shown by Woof, Fernandez and Lang [57, 58]. Smaragdakis, Kaplan, and Wilson [48, 49] introduced the EELRU policy as a heuristic inspired by the LRUSM. The model of Becchetti [6] mentioned above is similar to LRUSM, essentially dropping the assumption of independence, while restricting the form of the conditional distribution of accessing the j-th most recent item, given the value of the past trace. LRU is compared to OPT under this model. A different generalization of the IRM model is the Markov Reference Model (MRM), 3 already suggested by [37], where the address trace is a finite Markov chain. A wealth of results are obtained by Karlin, Phillips, and Raghavan [29] for MRM, including the Commute Algorithm, a remarkable policy computable from the transition probabilities of the chain in polynomial time, whose expected miss rate is within a constant factor of optimum. We underscore that MRM and LRUSM are substantially different models; in general, while the MRM trace is itself a Markov process with V states, the LRUSM trace is a function of a Markov process with V ! states. Paper outline In this work, we further the study of the LRUSM, deriving new results and strengthening its understanding. Some methodological aspects of our investigation, however, can be of interest for a wider class of models of the reference trace, hence they will be presented in a more general context. A first methodological aspect we explore is the possibility as well as the fruitfulness of casting miss minimization as a problem of optimal control theory (or, equivalently, as a Markov Decision Problem [33]). In Section 2, we show as this is possible whenever the trace is a hidden Markov process, a scenario which we call the Hidden Markov Reference Model (HMRM). The IRM, the MRM, and the LRUSM are all special cases of the HMRM. We refer to the classical optimal control theory framework as presented, for instance, in the textbook of Bertsekas [11]. In the dynamical system to be controlled, the state encodes the content of the buffer and some information on the past trace. The disturbance input models the uncertainty in the address trace, while the control input encodes the eviction decisions available to the memory manager. The cost per step is one if a miss is incurred and zero otherwise. We modify the standard assumption that the control is a function only of the state and allow it to depend on the disturbance as well: ut = µt(xt, wt). This modification is necessary since eviction decisions are actually taken with full knowledge of the current access. The Bellman equation characterizing the optimal policies has to be modified accordingly. The technicalities of this adaptation are dealt with in the Appendix. A second methodological aspect we explore is a generalization of the buffer management problem where rather than imposing the capacity as a fixed constraint, we let the number of buffer positions vary dynamically, under the control of the management policy. The average buffer occupancy becomes a second cost, in addition to the miss rate, and the tradeoff between the two costs is of interest. This problem could have practical applications. For example, in a time-shared environment, processes could be charged for their average use of main memory and hence be interested in utilizing more memory in phases where this can result in significant page-fault reduction and less memory in other phases. In addition, the study of the average occupancy problem sheds significant light even on the solution of the fixed capacity problem. In particular, for the LRUSM, an optimal policy for the case of a fixed buffer can be simply obtained from optimal policies for the average occupancy case. In Section 3, the average buffer occupancy problem is studied for the HMRM, exploiting techniques of multi-objective optimization and optimal control. A key advantage lies in the possibility of composing a global policy from policies tailored to the individual items in the virtual space. Furthermore, the approach naturally lends itself to the efficient management of a buffer shared among different processes. Throughout this section, the notion of optimality of the policies under consideration is that of gain optimality over an infinite horizon. In Section 4, the framework and the results developed in the two previous sections are applied to the LRUSM. After reviewing the LRU stack model, a class of optimal policies is derived, for an arbitrary distribution s, for the average occupancy problem. It is then shown that this class of policies includes some that use a buffer of fixed capacity 4 C. More specifically, it is shown that the minimum miss rate under a constraint on the average occupancy can be attained with fixed capacity. A buffer of capacity C is optimally managed by a K-L policy [57, 58], which can be specified by two parameters, denoted as K = K(C) and L = L(C). K-L policies include, as special cases, LRU (K = C, ∀L) and Most Recently Used (MRU) (K = 1, L = V ). Our derivation of the optimal policy has a number of advantages. (i) The optimality is established for the more general setting of average occupancy. (ii) The policy is naturally described in terms of a system of priorities for the eviction of items. As a corollary of a result of [37], it follows that the policy does satisfy the inclusion property: if an item is in a given buffer, then it is also in all buffers of larger capacity. The inclusion property rules out the so-called Belady anomaly [8] and enables more efficient algorithms for its performance evaluation. (iii) By linking the eviction priorities to the (planar) convex hull of the Pareto optimal points of the average occupancy problem and by adapting Graham's scan, an algorithm is derived for a linear time computation of the values K(C) and L(C) for all relevant values of C. (Previously known properties of the K-L policy lead to a straightforward cubic algorithm.) (iv) Finally, the priorities can be shown to correspond to a suitable notion of profit rate of an item, informally capturing the best achievable ratio between expected hits and the expected occupancy for that item, leading to the concept of Least Profit Rate (LPR) policy. The LPR policy can be defined for models different from the LRUSM for which, while not necessarily optimal, it may yield a good heuristic. In Section 5, we show that the ratio χ between the expected miss rate of the optimal on-line policy, LPR, and that of OPT is O(log C). Moreover, for the class of stack access distributions s for which the miss rate of LPR is lower bounded by some constant β > 1/C, we have χ ≤ 2 ln(2/β) ∈ O(1). The ability to efficiently compute the number of misses for buffers of various capacities when adopting a given policy for benchmark traces is of key interest in the design of hardware as well as software solutions for memory management [12,52,54]. In Section 6, we develop an algorithm to compute the LPR misses for all buffer capacities in time O(log V ) per access, providing a rather non trivial generalization of an analogous result for LRU [4,9]. In the remainder of the paper, we explore alternate notions of optimality. In Section 7, we consider optimization over a finite interval, or horizon. Technically, the optimal control problem is considerably harder. As an indication, even if the system dynamics, its cost function, and the statistics of the disturbance are all time invariant, the optimal control policy is in general time-dependent. We show that, for any monotonically non increasing stack distribution s, LRU is an optimal policy for any finite horizon, whereas MRU is optimal if the stack distribution is non decreasing. While these results appear symmetrical and highly intuitive, their proofs are substantially different and all but straightforward. The standard approach based on the Bellman equation, which requires "guessing" the optimal cost as a function of the initial state, does not seem applicable, lacking a closed form for such function. We have circumvented this obstacle by establishing an inductive invariant on the relative values of the cost for select pairs of states. This approach may have applicability to other optimal-control problems. Some of the results are derived for a considerably more general version of the LRUSM, which does not assume the statistical independence of stack distances at different steps. Finally, in Section 8, we take a preliminary look at bias optimality, a property stronger than gain optimality, but also considerably more difficult to deal with. As an indication of the obstacles to be faced, we prove that, in some simple cases of LRUSM, no bias-optimal policy satisfies the useful inclusion property. We also develop a closed-form solution for the simplest non-trivial case of buffer capacity, that is, C = 2. The derivation as well as the 5 Symbol Description OPT LRU LPR V C at Λt, dt The (off-line) optimal replacement policy The Least Recently Used replacement policy The Least Profit Rate replacement policy Size of the high-latency memory Size of the low-latency buffer Address of the item accessed at time t The LRU stack at time t and LRU stack depth of item accessed at time t + 1 (Λt(dt) = at+1) Probability of accessing the j-th most recently referenced item Cumulative probability distribution of s: S(j) =(cid:80)j s(j) S(j) Stochastic competitive ratio χ State at time t (dynamical systems) xt Disturbance at time t (dynamical systems) wt Control at time t (dynamical systems) ut = µt(xt, wt) xt+1 = f (xt, ut, wt) State transition (dynamical systems) g(xt, wt) J∗ t (x0) Cost (dynamical systems) Optimal cost starting from state x0 with a time horizon of t steps (dy- namical systems) i=1 s(i) Table 1: Main notation used throughout the paper results are not completely straightforward, suggesting that the solution for arbitrary buffer capacity may require considerable ingenuity. We conclude the paper with a brief discussion of directions for further research. The main notation introduced and used throughout this work is summarized in Table 1. 2 Optimal Control Formulation of Eviction for the Hidden Markov Reference Model In the typical problem of optimal control [11], one is given a dynamical system described by a state-transition equation of the form xt+1 = f (xt, ut, wt) , (1) where xt is the state at time t, while both ut and wt are inputs, with crucially different roles. Input ut, called the control, can be chosen by whoever operates the system. In contrast input wt, historically called the disturbance, is determined by the environment and modeled as a stochastic process. At each step t, a cost is incurred, given by some function g(xt, ut, wt). The objective of optimal control is to find a control policy ut = µt(xt) so as to minimize the total cost Ew(cid:34)(cid:88)t∈I g(xt, ut, wt)(cid:35) , (2) where I is a time interval of interest. A key premise of most optimal control theory is the assumption of past-independent disturbances (PID): given the current state xt, the current disturbance wt is statistically independent of past disturbances {wτ : τ < t}. In this section, we define a dynamical system whose optimal control corresponds to the minimization of the number of misses when the reference trace can be expressed as a 6 function at = r(zt) of a Markov chain zt with a finite state space Z. We call this scenario the Hidden Markov Reference Model (HMRM). In the following we assume the system to be unichain, i.e., under any stationary policy the Markov chain associated with the system evolution has only a single recurrent class. This hypothesis guarantees that the average cost in infinite horizon does not depend on the initial state and that there is always a solution to the Bellman equation (e.g., a Markov chain with two non communicating classes is not unichain). To cast eviction as a problem in optimal control, the state of our dynamical system will model both the Markov chain underlying the trace and the content of the buffer: xt := (zt, bt) , where bt ∈ {0, 1}V is a Boolean vector such that, for j = 1, . . . , V , bt(j) :=(cid:40)1 j is in the buffer, 0 otherwise. (3) (4) Toward formulating the transition function governing the evolution of xt, let us first observe that any Markov chain can be written as zt+1 = φ(zt, wt) , (5) where wt ∈ W is a sequence of equally distributed random variables, independent of each other and of the initial state z0 [32]. Furthermore, W is a finite set with W ≤ Z(Z− 1). We take wt to be the "disturbance" in (1). We let the control input ut ∈ {0, 1, . . . , V } encode the eviction decisions with 0 denoting no eviction (the only admissible control in case of a hit) and j > 0 denoting the eviction of the item j (an admissible control only when a miss occurs and the item j is in the buffer, i.e., bt(j) = 1). We can then write: where the transition function ψ is specified as bt+1 = ψ(bt, ut) , bt+1(j) := j = at = r(zt) , j = ut 1 0 bt(j) otherwise . , Finally, we have: xt+1 = (zt+1, bt+1) = (φ(zt, wt), ψ(bt, ut)) = f (xt, ut, wt) . The instantaneous cost function g is simply g(xt, wt) :=(cid:40)1 if a miss occurred , 0 otherwise . (6) (7) (8) (9) Finally, we assume that a policy can set the control ut with knowledge of both the state and the disturbance: ut = µt(xt, wt). This requires adaptation of some results derived in the control theory literature typically assuming ut = µt(xt). Consider a policy π = (µ1, µ2, . . . , µτ ) applied to our system during the time interval [1, τ ], so that, for t in this interval, we have xt+1 = f (xt, µt (xt, wt) , wt) . (10) 7 We define the cost of π, starting from state x0, with time horizon τ as J π τ (x0) := Ew(cid:34)τ−1(cid:88)t=0 g (xt, wt)(cid:35) , where w = [w0, w1, . . . , wτ−1] , (11) where the xt's are subject to (10) and the expected value averages over disturbances wt. For our system, this is the expected number of misses in τ steps. The optimal cost is J∗ τ (x0) := min π J π τ (x0) . (12) The optimal cost satisfies the following dynamic-programming recurrence (analogous to Eq. 1.6 in Vol. 1 of [11]) J∗ τ (x0) = Ew(cid:20) min u∈U (x0,w)(cid:8)g(x0, w) + J∗ τ−1 (f (x0, u, w))(cid:9)(cid:21) , (13) where U (x0, w) denotes the set of controls admissible when the state is x0 and the disturbance is w. Introducing a vector J∗ whose components are the values J∗ τ (x), in some chosen order of the states, (13) can be concisely rewritten as ∗ τ−1 , ∗ τ = T J (14) J where T is the (non-linear) optimal-cost update operator. In applications where the temporal horizon of interest is long and perhaps not known a priori, one is interested in policies that are optimal over an infinite horizon; an added benefit is that such policies are provably stationary, under very mild conditions. Usually, the cost defined in (11) diverges as τ → ∞, thus alternate definitions of optimality are considered [5, 11, 14, 33], like gain and bias optimality. Gain Optimality refers to a policy µ∗ that achieves the lowest average cost (that can be shown to be independent of x): µ∗ = arg minµ limτ→∞ J µ τ (x)/τ . Bias Optimality refers to a policy µ∗ that is as good as any other stationary policy for τ τ (x) ≥ 0. (Note that a bias optimal policy is long enough, i.e., ∀x limτ→∞ J µ also gain optimal.) τ (x) − J µ∗ In this work we mostly concentrate on the standard gain optimality concept (which corresponds to the miss rate minimization), but we also give some particular results for the stronger concept of bias optimality in Section 8. In Sections 3 and 8 we will use the classical Bellman equation, which characterizes optimal control policies in infinite horizon as solutions of a fixed point equation [11]. We show in A that the result holds in our model as well: Proposition 1. Let ∆ be a dynamical system, with state space X, whose control ut can be chosen with knowledge of the disturbance wt. If ∃λ∃h : λ1 + h = T h, then λ is the optimal average cost of ∆ and h is the vector of the differential costs of the states, i.e. ∀x, y ∈ X τ→+∞ J∗ lim τ (x) − J∗ τ (y) = h(x) − h(y) . (15) In the rest of the paper devoted to infinite horizon, since the costs will be independent of the initial state x0, we will simplify (and abuse a little) the notation by setting J µ(x0) = J(µ). 8 3 The Average Occupancy Eviction Problem The classical form of the eviction problem, as reviewed in the Introduction, is based on the assumption of a fixed capacity buffer: when the buffer is full, an eviction is required every time a miss occurs, otherwise no eviction is performed. In this section, we consider a relaxed version of the eviction problem where the buffer is of potentially unlimited capacity (C = V is actually sufficient) and a variable portion of it can be occupied at different times. The requirement that the item being referred must be kept in the buffer or brought in if not already there is retained. However, after an access (whether a hit or a miss), any item in the buffer, except for the one just accessed, can be evicted. In this relaxed buffer management scenario, in addition to the miss rate, an interesting cost metric is the average occupancy of the buffer. We call average occupancy eviction problem the minimization of the miss rate, given a target value for the average occupancy. This problem has direct applications, as mentioned in the Introduction. However, the study of average occupancy also sheds light on the fixed capacity version, as we will see in particular in the next section for the LRUSM. A key advantage of the average capacity problem is that its solution can be obtained by combining policies for the individual items considered in isolation. 3.1 The Single Item Problem In this section we study eviction policies for single items from a multiobjective perspective [20, 39], i.e., we are not interested in optimizing a single objective, but in obtaining all the "good" policies. When focusing on a single item, say ω, a first simplification arises from the fact that the state of the buffer, denoted βω, is just a binary variable, set to 1 when the item is kept in the buffer and to 0 otherwise. One also can restrict attention to the ω-trace aω,t, defined as 1 when the item is referenced (at = ω) and to 0 otherwise. Clearly, if the full trace at is a hidden Markov process, so is also the ω-trace. However, in some cases, the ω-trace can be described with fewer states, forming a set Zω. For example, the reduction is dramatic for the LRUSM, where Z = V ! while Zω = V , for every item ω. In general, we can write (16) aω,t = rω(zω,t), with zω,t+1 = φω(zω,t, wω,t) . Process zω,t is called the Characteristic Generator (CG) of item ω. The control input uω,t ∈ {0, 1} determines whether ω is evicted from the buffer (uω,t = 1), which is admissible only when the item is in the buffer at time t (βω,t = 1) and it is not currently accessed (aω,t = 0). This amounts to specifying the function ψω such that The overall state of the control system is then xω = (zω, βω), evolving as βω,t+1 = ψω(βω,t, uω,t) . xω,t+1 = fω(xω,t, uω,t, wω,t) . (17) (18) We are interested into two types of cost: buffer occupancy and misses. Correspondingly, we introduce two instantaneous cost functions: goc,ω(xω,t, wω,t) = βω,t gms,ω(xω,t, wω,t) =(cid:40)1, βω,t = 0 ∧ aω,t = 1 (miss) 0, otherwise . (19) Obviously, there is a tradeoff between the two costs, occupancy being minimized by evicting the item as soon as possible and misses being minimized by never evicting it. The set of 9 Figure 2: A Randomized Mixture of Policies (RMoP). Achieving C as average buffer occupancy using a probabilistic combination of µ2 and µ3. "good" solutions to multiobjective optimization problems is the Pareto set, i.e., the set of all policies whose costs are not dominated by the costs of other policies (Pareto points are also known as Efficient Points, EPs). A peculiarity of multiobjective optimization problems is that, since we are studying tradeoffs among the costs, sometimes we can usefully introduce Randomized Mixtures of Policies (RMoPs) to obtain more points in the costs space. E.g., consider the problem of choosing a route every day from home to work between two possible routes µ1 and µ2, with costs J (µ) defined by the driving time and gas used. If J (µ1) = (20 minutes, 10$) and J (µ2) = (30 minutes, 5$) by choosing every day with the same probability µ1 or µ2 we have long-run average costs equal to (25 minutes, 7.50$), which cannot be obtained by choosing always the same route. To properly define an RMoP for the average occupancy problem for a single item, we observe that there always exists a "hit" state x∗ = (z∗, 1) (with rω(z∗) = 1) which is recurrent in the system evolution (otherwise the item frequency would be zero and there would not be need to buffer it). If we call t1, t2, . . . the times at which the system enters the recurrent state, then the problems of choosing an eviction policy in the intervals [ti + 1, ti+1] are independent; by randomly choosing for each interval between two policies we can obtain all the convex combinations of the costs of the original non-mixture policies (see Fig. 2). In more detail, if policies µ(cid:48) and µ(cid:48)(cid:48) exist with Joc(µ(cid:48)) = η(cid:48) and Joc(µ(cid:48)(cid:48)) = η(cid:48)(cid:48) such that C = γη(cid:48) + (1 − γ)η(cid:48)(cid:48) for some γ ∈ [0, 1], we write µ = randγ (µ(cid:48), µ(cid:48)(cid:48)) to mean that µ is an RMoP that chooses µ(cid:48) with probability γ and µ(cid:48)(cid:48) with probability 1 − γ (the random choice being made every time the system leaves the state x∗). Note that an analog equation holds also for the miss rate cost: Jms(µ) = γJms(µ(cid:48)) + (1 − γ)Jms(µ(cid:48)(cid:48)). Since any point in the costs space between two policies can be obtained by an appropriate RMoP, the set of "good" policies in this context maps into the set S of Supported EPs (SEPs, also known as Pareto-convex points) which have costs not dominated by any convex combination of the costs of other policies. The set of SEPs can in general be of size exponential in Zω and thus it is interesting to find a polynomial approximation S of S. More specifically, for every point (J1, J2) in S we want two points ( J(cid:48) 2 ) in 2) and ( J(cid:48)(cid:48) 1, J(cid:48) 1 , J(cid:48)(cid:48) 10 J(µ1)=(η1,ζ1)J(µ2)=(η2,ζ2)J(µ3)=(η3,ζ3)J(µ4)=(η4,ζ4)J(µ5)=(η5,ζ5)J(cid:0)rand(µ2,µ3)(cid:1)C00.20.40.60.81Joc(µ)−0.200.20.40.60.81Jms(µ)Efficientpoints(EPs)SupportedEPs S and a real number 0 ≤ γ ≤ 1 such that, for q = 1, 2, we have Jq(1 + ) ≥ γ J(cid:48) q + (1 − γ) J(cid:48)(cid:48) q . A necessary and sufficient condition [18, 43] to get a Polynomial Time Approximation Scheme (PTAS) to construct S is the availability of a PTAS for solving the single-objective scalarized problem (Scal) which has the following cost: Gω,θ(xω, wω) = cos(θ)goc,ω(xω, wω) + sin(θ)gms,ω(xω, wω) . (20) The PTAS to build S runs in time polynomial in both Zω and (1/). (Note that any relative weight between the two costs can be achieved by a suitable choice of θ ∈ [0, π/2].) While Scal is interesting in its own right, here we are considering it mainly as a tool to find a polynomial approximation of the set of SEPs. For the single item problem the optimal policy solution of Scal can be obtained by solving the following Bellman equation [11], in the unknowns λω,θ ∈ R and hω,θ : Xω → R, where Xω = Zω × {0, 1}: λω,θ + hω,θ(x) = Ewω(cid:20)Gω,θ(xω, wω) + min uω {hω,θ (fω(xω, uω, wω))}(cid:21) . (21) The solution can be computed in time polynomial in Zω (the problem is P-complete [42]). The optimal policy can be obtained as µω,θ(xω, wω) = arg minuω {hω,θ (fω(xω, uω, wω))}. From the general theory, the cost of the optimal policy µω,θ (for the instantaneous cost Gω,θ) is Jω,θ = λω,θ. Standard methods permit the polynomial time computation of the values Joc,ω and Jms,ω of the same policy for the instantaneous costs goc,ω and gms,ω, respectively. 3.2 The Average Occupancy of All Items The solution for the average occupancy problem of all items can be obtained by choosing, for each item ω, an appropriate solution (given in general by an RMoP) to the single item problem. In fact, let µ be an optimal policy for the all items problem, then µ induces an occupancy cost Joc,ω(µ) and a miss rate cost Jms,ω(µ) for each item ω. Now consider the single item problem of finding a policy µω which minimizes Jms,ω(µω) while achieving occupancy Joc,ω(µω) = Joc,ω(µ): then we must necessarily have Jms,ω(µω) = Jms,ω(µ), otherwise either µ or µω would be suboptimal. Because of this relationship between single and all items optimal policies, the average occupancy problem for all items reduces to a convex resource allocation problem, which can be solved efficiently [24,51,53], once we have the approximation of the set of SEPs for each single item. A quantity of pivotal importance is the marginal gain ρω of policy µ(cid:48) ω w.r.t. to policy µω defined, as Jms,ω(µ(cid:48) Joc,ω(µ(cid:48) ρω := − ω) − Jms,ω(µω) ω) − Joc,ω(µω) . (22) The solution can be obtained in a greedy fashion by increasingly allocating buffer capacity to the item which provides a larger marginal gain. This greedy procedure takes time polynomial in (cid:80)ω Zω; a more sophisticated, asymptotically optimal algorithm can be found in [24]. Note that we can obtain the global miss rate M and buffer occupancy C just adding up the equivalent quantities for the single items: M =(cid:88)ω Jms,ω , C =(cid:88)ω Joc,ω . (23) ω , of the Theorem 1. Let J (µ1 SEPs for the generic item ω. The optimal policies µω (given for each item) are obtained applying Algorithm 1. ω), . . . be the list, with ηi ω < ηi+1 ω), J (µ2 ω) = (η2 ω) = (η1 ω, ζ 1 ω, ζ 2 11 Algorithm 1: Obtaining the optimal algorithm for multiple items. 1 ∀ω c[ω] ← 1 ; 2 B ← 1 ; 3 while B < C do // choose the policy improvement with maximum marginal gain φ φ 5 6 4 ζ c[ω]+1 ω ηc[ω]+1 ω − ηc[φ] ω (cid:40)− φ ← arg max B ← B + ηc[φ]+1 c[φ] ← c[φ] + 1 ; 7 ∀ω (cid:54)= φ µω ← µc[ω] 8 γ ← such that B −(cid:80)ω(cid:54)=φ ηc[ω] φ (cid:17) ; 9 µφ ← randγ(cid:16)µc[ω]−1 , µc[ω] ω ; φ ω ω (cid:41) ; − ζ c[ω] − ηc[ω] ; ω = γηc[φ]−1 φ + (1 − γ)ηc[φ] φ ; ≤ C and is optimal for that value of the occupancy. Remark 1. Algorithm 1 will produce a non-mixture eviction policy for each item except for one, for which an RMoP may be needed in order to use the entire buffer space assigned to it. Note that, given a target value C for the buffer occupancy, there exist a global policy made only of single item non-mixture policies which has average buffer occupancy C − 1 < C(cid:48) 3.3 Buffer Partitioning An interesting application of the previous algorithm arises when we want to partition a buffer of capacity C among n independent processes, each described by a different HMRM. We assume that the i-th process accesses a private address space size Vi, at each step the i=1 πi = 1) to be the one to run. We want to determine i=1 Ci = C) so as to minimize the global miss rate over an infinite temporal horizon, under the hypothesis that each process is using the optimal eviction policy. i-th process has probability πi ((cid:80)n the capacity Ci to devote to process i (with(cid:80)n It is straightforward to see that this problem is equivalent to building the global policy from single items with the cost Jms of the items accessed by the i-th process rescaled by a factor πi. 4 Optimal Policies for the LRUSM In this section, we focus on stack optimal policies for the LRU Stack Model. After first reviewing the LRUSM (§4.1), we derive the optimal policy in the average occupancy framework (§4.2); due to the strong LRUSM structure many simplifications apply to the general procedure built in the previous section leading to a very efficient way of computing the optimal policy (linear in V ). In §4.3 we focus on the fixed occupancy eviction problem and, by linking its solution to the average occupancy one, we are able to provide a stack eviction policy (Least Profit Rate, LPR) which is optimal for the LRUSM. Furthermore, we can fully characterize LPR behavior using a priority function based on a notion of profit which might be also of interest for other memory reference models. 12 Figure 3: LRU stack update. 4.1 The LRU Stack Model Mattson et al. [37] observed that a number of eviction policies of interest, including LRU, MRU, and OPT, satisfy the following property. Definition 1. Given an eviction policy µ defined for all buffer capacities, let Bµ t (C) be the content of the buffer of capacity C at time t, after processing references a1, . . . , at. We say that the inclusion property holds at time t if, for any C > 1, Bµ t (C), with t (C) < C). We say that µ is a equality holding whenever the bigger buffer is not full (Bµ stack policy if it satisfies the inclusion property at all times for all address traces, assuming that inclusion holds for the initial buffers Bµ 0 (C), with 1 ≤ C ≤ V (this is trivially verified if we assume, as we do, the initial buffers to be empty). t (C − 1) ⊆ Bµ The optimal on-line policy LPR, developed in this section, is a stack policy. Inclusion protects from Belady's anomaly [8] (i.e., increasing the buffer capacity cannot lead to a worse miss ratio, as can happen with, e.g., FIFO) and enables a compact representation of the content of the buffers of all capacities by the stack of the policy, an array Λµ t whose first C components yield the buffer of capacity C as Bµ t (C) = [Λµ t (1), . . . , Λµ t (C)] . (24) The stack depth dt of an access at+1 is defined as its position in the policy stack at time t, so that (25) Upon an access of depth d, a buffer incurs a miss if and only if C < d. Thus, computing the stack depth is an efficient way to simultaneously track the performance of all buffer capacities. at+1 = Λµ t (dt) . In the LRU stack, which we shall denote just by Λ (i.e., Λ = ΛLRU), the items are ordered according to the time of their most recent access; in particular, Λt+1(1) = at+1. Upon an access at depth dt, the LRU stack is updated by a downward, unit cyclic shift of its prefix of length dt, as illustrated in Fig. 3. The LRU stack has inspired an attractive stochastic model for the address trace [19, 30, 40, 50, 55], where the access depths d1, d2, . . . are independent and identically distributed random variables, specified by the distribution s(j) := Pr[at+1 = Λt(j)] = Pr[dt = j], j = 1, . . . , V , (26) 13 ΛtΛt+1Λt(1)Λt+1(1)Λt(2)Λt+1(2)......Λt(dt−1)Λt+1(dt−1)Λt(dt)Λt+1(dt)Λt(dt+1)Λt+1(dt+1)......Λt(V)Λt+1(V)at+1...... or, equivalently, by the cumulative sum S(j) := j(cid:88)i=1 s(i), j = 1, . . . , V . (27) We assume that an "initial" LRU stack is given. W.l.o.g., s(V ) (cid:54)= 0 (s(V ) = 0 implies that the last page in the stack is never accessed and can therefore be ignored). For example, the case where s(j) decreases with j captures a strict form of temporal locality, where the probability of accessing an item strictly decreases with the time elapsed from its most recent reference. It is simple to see that the actual trace a1, a2, . . . can be uniquely recovered from the stack-depth sequence d1, d2, . . ., given the initial stack Λ0. To summarize, in the notation of Section 2, the state underlying the trace is the LRU stack (zt = Λt) and the disturbance is the stack distance (wt = dt). We have a HMRM, since at+1 = r(Λt+1) = Λt+1(1). The transition function φ for the trace state (such that Λt+1 = φ(Λt, dt)) corresponds to the right unit cyclic shift of the the prefix of length dt of stack Λt. The control input ut, the buffer state bt, and the action of the former on the latter (bt+1 = φ(bt, ut)) are according to the general definitions given in Section 2. 4.1.1 K-L Eviction Policies A first optimal policy for the LRUSM was given by Wood, Fernandez and Lang in [57, 58]. They introduced the K-L eviction policy, defined as follows, in terms of LRU stack distance, for given integers K and L that 1 ≤ K < C ≤ L ≤ V . If access at+1 results in a miss, then • evict Λt+1(L + 1), if it is in buffer Bt(C); • otherwise evict Λt+1(K + 1), which is always in Bt(C) if the policy is consistently applied starting from an empty buffer. Here, Λ denotes the LRU stack, while B(C) denotes the content of the buffer under the K-L policy. Eviction is specified in terms of the LRU stack immediately after the rotation due to access at+1. Special cases are LRU (K = C, ∀L) and MRU (K = 1, L = V ). It has been shown in [57, 58] that, under the LRUSM, for any C, there exist values K(C) and L(C) for which the K-L policy is (gain) optimal. It is easily shown that, in the steady state, the items in the top K positions of the LRU stack are always in the buffer, the items in the bottom V − L positions are always outside the buffer, and C − K of the L − K items between position K + 1 and L are in the buffer. (Technically, the K-L policy is not specified for a buffer containing neither Λt+1(L + 1) nor Λt+1(K + 1). However, if the least recently used item is evicted in such case, one can show that the same steady state is reached, with probability 1.) It turns out that the miss rate of the K-L policy for a given distribution s is S(K)(L − C) + S(L)(C − K) . (28) M K-L[s] = 1 − L − K Finding, for each C, the optimal parameters K(C) and L(C) can be then accomplished in time Θ(V 3), by evaluating the miss ratio for all possible (K, L) pairs. In general, for a given C, the miss rate can be minimized by different (K, L) pairs. Smaragdakis et al. [48, 49] proved that, for any given s, K(C) and L(C) can be chosen so that the resulting K-L policy does satisfy the inclusion property. In the next subsection, we derive the optimal eviction policy in the average occupancy framework developed in Section 3 and highlight its deep structure. In §4.3 we derive a stack policy which is optimal in the fixed buffer model. By exploiting its similarity with 14 the average occupancy optimal, we develop an algorithm that computes the two K and L parameters for all C ∈ {1, V } in linear time, whereas a straightforward computation that does not exploit the stack policy characterization takes cubic time (a first speedup from cubic to quadratic is obtained exploiting the inclusion property, while the improvement from quadratic to linear derives from algorithmic refinements). 4.2 Average Occupancy Problem The general procedure described in the previous section can be specialized for the LRUSM as follows. For each item ω the associated CG is a Markov chain zω,t with states Zω = {1, . . . , V }. The state encodes the position of the item in the LRU stack, thus satisfying the following transition probabilities: ∀i Pr[zω,t+1 = 1zω,t = i] = s(i) Pr[zω,t+1 = i + 1zω,t = i] = 1 − S(i) . ∀i (cid:54)= 1 Pr[zω,t+1 = izω,t = i] = S(i − 1) ∀i (cid:54)= V (29) (30) (31) rω(i) = 0. Thus, in the LRUSM the statistical We also have rω(1) = 1 and, ∀i (cid:54)= 1, description of the CGs is the same for all the items. The stationary eviction policies for the single item are binary vectors of size V which say, for each LRU stack depth, if an item arriving at that position should be evicted. The "hit" state x∗ := (z∗ = 1, β = 1), in which the item is at the top of the LRU stack and in the buffer, is recurrent and hence will be used to define RMoPs in the LRUSM: we assume an RMoP will choose a SEP policy each time the system leaves the state x∗. In the following we call lifetime the time between two consecutive x∗. A lifetime ends when the item is accessed. Thus, at the beginning of a new lifetime, an item is always at the top of the stack and in the buffer. If evicted from the buffer, the item will re-enter only at the beginning of the next lifetime. We define EVk as the policy which keeps the item in the buffer while at stack depth i ≤ k and evicts it if i > k. Note that, in steady state, any policy µ is equivalent to an appropriate EVk, where k + 1 is the smallest depth at which the policy µ evicts (this is because, after the item is first accessed, it will always get evicted at depth k + 1; it can only get evicted once at a different depth). Hence, w.l.o.g., we can limit our study to EVk policies. To provide a close form for both the occupancy and the miss cost of EVk, we first need to establish some properties of the Markov chain zω. Proposition 2. Let tj j+h be the expected time spent by an item in position j + h (h ≥ 0) conditioned to the fact the item surely arrives in position j without getting accessed. Then tj j+h = 1 1 − S(j − 1) (Note that the expected time does not depend on h.) Proof. For h = 0 we easily have that . 1 (32) (33) . tj j = 1 + S(j − 1)tj j ⇒ tj j = 1 − S(j − 1) The event that an item starting from position j does not arrive in position j + 1 is the disjoint union of the events that there are exactly h accesses with depth smaller than j followed by one at depth j. So the probability for an item in position j to arrive to position j + 1 is P j j+1 = 1 − s(j) +∞ (cid:88)h=0 [S(j − 1)]h = 1 − S(j) 1 − S(j − 1) , 15 (34) and hence the expected time spent in position j + 1 is Furthermore tj j+h = P j j+1P j+1 tj+h j+h = tj j . tj j+1 = P j j+1tj+1 j+1 = 1 − S(j) 1 − S(j − 1) j+2 ··· P j+h−1 j+h 1 1 − S(j) = tj j . (35) (36) As a special case, if we know that an item starts from position 1 (in which it is going to spend exactly one time step in the current lifetime) then it is going to spend an expected time t1 j = 1 in each position on the LRU stack in its lifetime and hence a lifetime has an expected length of V timesteps. Under policy EVk, the item is buffered on average for k timesteps per lifetime and hence the occupancy cost is given by Joc(EVk) = k V . (37) As for the miss rate, since the each position at depth j > k contributes with a probability s(j) to the misses, we have that Jms(EVk) = 1 − S(k) V . (38) A direct application of Algorithm 1 would provide optimal policies µω identical for all the items except for on one (which, in general, will be managed by a RMoP). Actually, we can take a slightly different approach to exploit the CGs symmetry: by forcing the eviction policy to be the same for exactly all the items the global problem is reduced to the single-item one, with just a rescale of the costs Joc and Jms by a factor of V . The optimal policy is then an RMoP (the same for all the items) which mixes two eviction points corresponding to SEPs, causing each item to be evicted only at two possible stack depths. The next theorem summarizes the preceding discussion. Theorem 2. Let q1 = 1 < q2 < . . . < ql = V be the values of k such that EVk is a SEP (i.e., a Pareto-convex) policy and let qi < C(cid:48) ≤ qi+1, so that C(cid:48) = γ(cid:48)qi + (1 − γ(cid:48))qi+1 for some γ(cid:48) ∈ (0, 1]. Then, the RMoP that, for each item, mixes policies EVqi and EVqi+1 with probability γ(cid:48) and (1 − γ(cid:48)), respectively, achieves optimal miss rate for average occupancy C(cid:48). It is a simple exercise to show that, if s is monotonically decreasing, then l = V and qi = i. Instead, if s is monotonically increasing, then l = 2, q1 = 1, and q2 = V . 4.3 Fixed Occupancy Problem We have just shown that the optimal eviction policy in the average occupancy model is characterized by two eviction points in the LRU stack (let us call them K(cid:48)(C) and L(cid:48)(C)). It is natural to investigate what happens by applying a K-L policy in the fixed occupancy model with K = K(cid:48)(C) and L = L(cid:48)(C). Under the K-L policy each lifetime is managed either by policy EVK or EVL and thus its occupancy C and miss rate M can be written as (39) C = γJoc(EVK) + (1 − γ)Joc(EVL) M = γJms(EVK) + (1 − γ)Jms(EVL) . A set of similar equations holds for the average occupancy setting: C(cid:48) = γ(cid:48)Joc(EVK(cid:48)) + (1 − γ(cid:48))Joc(EVL(cid:48)) M(cid:48) = γ(cid:48)Jms(EVK(cid:48)) + (1 − γ(cid:48))Jms(EVL(cid:48)) . (40) 16 Since C = C(cid:48), K = K(cid:48) and L = L(cid:48) we must have the γ(cid:48) = γ. Then, we also have M = M(cid:48), i.e., the miss rate achieved by the K-L policy for K = K(cid:48)(C) and L = L(cid:48)(C) is the same achieved by the average occupancy optimal. Since the optimal miss rate for average occupancy C is obviously a lower bound for miss rate under fixed occupancy C, the choice K = K(cid:48)(C) and L = L(cid:48)(C) parameters yields an optimal policy under fixed capacity. Based on these observations and on Theorem 2, we can compute, for each positive integer C ≤ V , values K(C) and L(C) for a gain optimal, fixed capacity policy. Corollary 1. Given a stack-distance distribution s, the corresponding values q1, q2, . . . , ql can be computed in time Θ(V ) by Algorithm 2, a specialization of the Graham scan [25] to obtain the convex hall of planar sets of points. The same algorithm also computes optimal K(C) and L(C) for all (integer) buffer capacities 1 ≤ C ≤ V , uniquely determined from the qi's by the relation (41) K(C) = qi < C ≤ qi+1 = L(C) . Remark 2. Because of costs (37) and (38) finding the SEPs is equivalent to find the convex hull of the set {(1, 0)} ∪ {(j, S(j))}j ∪ {(V, 0)}. Since these points are already ordered along the first coordinate we can directly apply the linear phase of Graham scan, skipping the initial sorting. Finally, being the points equally spaced along the first coordinate, the algorithm reduces to finding, for each point j, the next point i which maximizes the difference quotient: S(i) − S(j) j − i + 1 = (cid:80)i k=j s(k) j − i + 1 . (42) This particular specialization of the Graham scan is studied in more detail in [10, 35]. Algorithm 2: Computing K(C) and L(C) and Profit Rates priorities -- Linear algorithm. K(C) = qi < C ≤ qi+1 = L(C) for some i. // Graham scan specialization 1 ν[1] ← 1; 2 π[V + 1] ← 0; ∆[V + 1] ← 1; 3 for j ← V downto 2 do π[1] ← s(1); ∆[1] ← 1; 4 5 6 7 8 9 10 ν[j] ← j; ∆[j] ← 1; while π[j]/∆[j] ≤ π[n]/∆[n] do π[j] ← s[j]; n ← ν[j] + 1; ν[j] ← ν[n]; π[j] ← π[j] + π[n]; ∆[j] ← ∆[j] + ∆[n]; n ← ν[j] + 1; // Print segmentation and priorities 13 14 11 j ← 1; i ← 1; 12 while j ≤ V do print "qi = " , ν[j]; j ← ν[j] + 1; 15 j ← 2; 16 while j ≤ V do i ← i + 1; 17 18 print "ξ(j) = " , π[j]/∆[j]; j ← j + 1; 17 4.3.1 The Least Profit Rate Eviction Policy In this subsection we define a new stack policy, called Least Profit Rate (LPR), by means of suitable priorities. We will see that, for any C, in steady state, the LPR policy becomes the same as the K(C)-L(C) policy, and is therefore optimal. Definition 2. We define ¯s(i, j) as the average of s between i and j: j − i + 1 Furthermore ¯s(i) will indicate the moving average of s: ¯s(i, j) := s(k) j(cid:88)k=i ¯s(i) := ¯s(1, i) . . (43) (44) Definition 3. Let ω be an item identified by its stack depth i (i.e., Λ(i) = ω). We define its profit rate ξ as ∀i (cid:54)= 1 ξ(i) := max j ¯s(i, j) . (45) (46) (The profit rate of the last accessed item Λ(1) is not defined, since it cannot be evicted.) Definition 4 (Least Profit Rate). The LPR policy evicts the item i∗ in the buffer such that i∗ := arg min ξ(i) = arg min i max j ¯s(i, j) . i (If more items achieve the minimum, then the closest to the top of the stack is chosen.) Next, we can state the main results of this section: Theorem 3. The K(C)-L(C) eviction policies (for the various C) are uniquely determined by the LPR (whose definition does not depend on C). Lemma 1. Let s be a function from natural to positive real numbers: s : N → R+. Let λ be the point of maximum for ¯s. Then for each q ≤ λ we have Proof. We can rewrite ¯s(λ) as ¯s(λ) ≤ ¯s(q, λ) . ¯s(λ) = λ(cid:88)j=1 s(j) λ = q − 1 λ λ(cid:88)j=q + λ − q + 1 λ = q − 1 λ ¯s(q) + q−1(cid:88)j=1 s(j) q − 1 s(j) λ − q + 1 = λ − q + 1 λ ¯s(q, λ) . Being ¯s(λ) a convex combination of ¯s(q) and ¯s(q, λ) the following inequality holds: min{¯s(q), ¯s(q, λ)} ≤ ¯s(λ) ≤ max{¯s(q), ¯s(q, λ)} . Since for hypothesis we have ¯s(λ) ≥ ¯s(q) we must have ¯s(q) ≤ ¯s(λ) ≤ ¯s(q, λ) . 18 (47) (48) (49) (50) (51) (52) Lemma 2. Let s be a function from natural to positive real numbers: s : N → R+. Let λ be the point of maximum for ¯s. Then for each r > λ we have ¯s(λ + 1, r) ≤ ¯s(λ) . Proof. We have the following convex combination: r − λ ¯s(λ) + ¯s(r) = λ r ¯s(λ + 1, r) , r with ¯s(λ) ≥ ¯s(r) so we must have ¯s(λ + 1, r) ≤ ¯s(r) ≤ ¯s(λ) . (53) (54) (55) Remark 3. Lemmas 1 and 2 highlight the following useful properties of the sequence (q1, q2, . . . , ql) obtained by Algorithm 2: 1. The average value of s is strictly decreasing between segments: ¯s(1 + qi, qi+1) > ¯s(1 + qi+1, qi+2) 2. Within each segment the average of any prefix is smaller or equal to that of any suffix: ∀k ∈ [1 + qi, qi+1], then ¯s(1 + qi, k) ≤ ¯s(1 + qi, qi+1) ≤ ¯s(k, qi+1) Proof of Thm. 3. Starting with an empty buffer we evict the first time when the top C position of the LRU stack are filled. The position i∗ = arg mini maxj ¯s(i, j) is exactly K + 1 (as can be seen applying Lemmas 1 and 2). The following position l that has maxj ¯s(l, j) < maxj ¯s(i∗, j) is L + 1, so each time an item reaches that position it is evicted (it can reach it only after a miss, since the positions after L are not in the buffer). Below, we give a general formulation of the concepts of profit and of profit rate in the HMRM. For the definition we adopt the single item average occupancy model. Given an item ω and a time t, consider a single item eviction policy µ to determine, for any underlying state z of the CG, whether ω is kept in the buffer or evicted upon reaching that state. We call µ-profit of ω the probability πµ that ω is referenced before it is evicted, which is a measure of how useful it would be to keep ω in the buffer under the policy. Let then t + ∆, with ∆ > 0, be the earliest time after t such that ω is either referenced or evicted at time t + ∆. Clearly, Eµ[∆] is a measure of the storage investment made on ω to reap that profit. Therefore, the quantity πµ/ Eµ[∆] is a measure of profit per unit time, under policy µ. Finally, we call profit rate of ω the maximum profit rate achievable for ω, as a function of µ. (It ought to be clear that profits and profit rates depend upon the current underlying state z of the CG, although this dependence has not been reflected in the notation, for simplicity.) As for the LRUSM, let consider a buffered item at position i in the LRU stack. If we choose to keep it in the buffer until it goes past position j, then the item is going to spend on average the same time in each position between i and j and hence its profit per unit time will be ¯s(i, j). This function has a maximum for some value of j that defines the item profit rate, as shown above. The Least Profit Rate (LPR) policy evicts, upon a miss, a page in the buffer with minimum profit rate. Profit rates are independent of buffer capacity, hence can be viewed as priorities. If ties are resolved consistently for all buffer capacities, LPR satisfies the inclusion property. In general, LPR is a reasonable heuristic, but not necessarily an optimal policy in the fixed occupancy model. 19 5 On-line vs. Off-line Optimality Intuitively, the optimal off-line policy makes the best possible use of the complete knowledge of the future address trace, whereas the optimal on-line has only a statistical knowledge of the future. We compare these two information conditions via the stochastic competitive ratio, defined as the following functional of the distribution s: χ[s] := M LPR[s] M OPT[s] , (56) where M LPR[s] and M OPT[s] denote the expected miss rates (technically, the limit of the expected number of misses per step over an interval of diverging duration, as considered in gain optimality). The next theorem states the key result of this section. Theorem 4. For any stack access distribution s and buffer capacity C, χ[s] = O(ln C). If M LPR[s] ≥ 1 C , then the bound can be tightened as χ[s] ∈ O(cid:16)ln To gain some perspective on the O(ln C) bound for LPR, we observe that the stochastic competitive ratio of LRU can be as high as C, (take s : s(C + 1) = 1). We also remark that, for classes of distributions where the miss rate of LPR is bounded from below by a constant, the competitive ratio is bounded from above by a corresponding constant. M LPR[s](cid:17). 1 Theorem 4 is established through several intermediate results: 1. A lower bound LOPT[s] is developed for the (difficult to evaluate) quantity M OPT[s], which yields a manageable upper bound to χ[s] (Prop. 3). (An analog lower bound for the deterministic case can be found in [41].) 2. An upper bound to the competitive ratio is evaluated for a quasi uniform distribution, which is analytically tractable (Prop. 4). 3. Finally, the analysis of the stochastic competitive ratio of an arbitrary distribution s is reduced to that of a related, quasi uniform distribution s(cid:48) (Prop. 5). Steps 1 and 3 lead to the following chain of inequalities: χ[s] = M LPR[s] M OPT[s] ≤ M LPR[s] LOPT[s] ≤ M LPR[s(cid:48)] LOPT[s(cid:48)] . (57) Proposition 3. Under the LRUSM, the miss rate of OPT is bounded from below as M OPT[s] ≥ LOPT[s], where, for G ∈ {1, . . . , V − C}, LOPT G [s] := G C+G−1(cid:88)j=0 −1 1 1 − S(j) , LOPT[s] := G∈{1,...,V −C} LOPT max G [s] . (58) Proof. For a given value of G, we consider a partition of the trace a1, a2, . . . into consecutive segments, each minimal under the constraint that it contains exactly C + G distinct references. Let τi denote the number of steps in the i-th such segment. The random variables τ1, τ2, . . . are statistically independent and identically distributed. Any one of them, generically denoted τ, can be decomposed as τ := φj , C+G−1(cid:88)j=0 20 (59) where φj is the minimum number of steps, starting at some fixed time, to observe the first access with stack distance greater than j. It can be easily seen that φj is a geometric random variable, with parameter pj = 1 − S(j), Pr[φj = k] = (1 − pj)k−1pj, expected value 1/pj, and finite variance. By linearity of expectation we have: E[τ ] = C+G−1(cid:88)j=0 1 1 − S(j) . (60) Under any policy, including OPT, in each of the intervals of durations τ1, τ2, . . ., there occur at least G misses, since at most C of the referenced items could be initially in the buffer. Therefore, we can write the following chain of relations: E(cid:20) qG i=1 τi(cid:21) = G lim (cid:80)q E(cid:20) 1 ¯τq(cid:21) = G E(cid:20) 1 limq→∞ ¯τq(cid:21) = q→∞ M OP T [s] ≥ lim q→∞ where ¯τq :=(cid:80)q q . The interchange between limit and expectation is justified because (i) by the law of large numbers, ¯τq converges in distribution to the delta peaked at E[τ ] and (ii) the function 1/x is continuous and bounded within the support of ¯τq (which equals {x ∈ Z : x ≥ C + G} since, for each i, τi ≥ C + G) [36]. Proposition 4. Let s(cid:48) be the distribution defined as = LOPT G [s] (61) i=1 τi , G E[τ ] s(cid:48)(j) := σ η η(cid:48) j = 1 j ∈ {2, . . . , V − 1} j = V . (62) Then the following lower bound for OPT miss rate holds: M OPT[s(cid:48)] ≥ LOPT[s(cid:48)] ≥ V − C 2 Proof. Applying Prop. 3 we can write LOPT G [s(cid:48)] = G1 + = G(cid:34)1 + −1 1 1 − S(j) η(cid:48) + kη(cid:35)−1 C+G−1(cid:88)j=1 V −2(cid:88)k=V −C−G 1 . 2 1 η (cid:34)1 + = G1 + ≥ G(cid:20)1 + ln(cid:32) (V − 2)η + η(cid:48) (cid:1) η + η(cid:48)(cid:33)(cid:35)−1 (cid:0) V −2−C η(cid:48) + (V − j − 1)η C+G−1(cid:88)j=1 (V − C − G − 1)η + η(cid:48)(cid:19)(cid:21)−1 ln(cid:18) (V − 2)η + η(cid:48) −1 1 η 1 (63) (64) . (65) 2 the thesis follows. By setting G = V −C Lemma 3. If ∀j S1(j) ≥ S2(j) then LOPT[s1] ≤ LOPT[s2]. Proof. From the definition of LOPT we can see that it is decreasing with(cid:80)C+G−1 and hence decreasing with each S(j). g=0 1 1−S(g), 21 Proposition 5. Let s be an LRU stack access distribution, C the buffer capacity and LPR its associated optimal online policy. Consider s(cid:48) defined as follows: s(cid:48)(j) = σ η η(cid:48) 0 j = 1 j ∈ {2, . . . , L + D} j = L + D + 1 j > L + D + 1 , (66) where η := ¯s(K + 1, L), σ := S(K) − (K − 1)η, D :=(cid:108) 1−S(L) (cid:109) − 1, η(cid:48) := 1 − S(L) − Dη ≤ η), then s(cid:48) is a valid distribution and LOPT[s(cid:48)] ≤ LOPT[s] and (note that 0 < η(cid:48) M LPR[s(cid:48)] = M LPR[s]. Proof. We begin by observing (due to Lemmas 1 and 2) ¯s(2, K) > ¯s(K + 1, L) > ¯s(L + 1, V ). The transformation from s to s(cid:48) can be intuitively described as follows. η • We first "flatten" to η = ¯s(K + 1, L) the access distribution within the segment [K + 1, L] (in this operation no probability mass is moved outside the segment). • We set s(j) = η in the interval [2, K]. Since ¯s(2, K) > ¯s(K + 1, L) some probability mass is removed from [2, K]. • We add to s(1) the probability removed during the previous step. • We redistribute the probability mass 1 − S(L) at positions starting from L + 1, assigning η per position, possibly followed by a leftover η(cid:48). This is possible because ¯s(K + 1, L) > ¯s(L + 1, V ). After all these movements total probability mass is preserved and no position has a negative value, hence s(cid:48) is still a valid distribution. Because of Lemmas 1 and 2 the transformation yields ∀j S(cid:48)(j) ≥ S(j) and hence, because of Lemma 3, LOPT[s(cid:48)] ≤ LOPT[s]. As for LPR miss rate we have M LPR[s] = 1 − S(L) + (L − C)η = (L + D − C)η + η(cid:48) = M LPR[s(cid:48)] . (67) Proof of Thm. 4. Because of Prop. 5, given a distribution s we can obtain a quasi uniform distribution s(cid:48) (with a narrowed memory space W := L + D + 1 ≤ V ) such that M LPR[s(cid:48)] LOPT[s(cid:48)] χ[s] ≤ η(cid:48) + (W − 1 − C)η = W − C (cid:34)2 + 2 η ln(cid:32) (W − 2)η + η(cid:48) (cid:1) η + η(cid:48)(cid:33)(cid:35) := χ[s(cid:48)] (cid:0) W−2−C 2 . (68) To simplify the analysis of χ[s] we can assume C (cid:29) 1 and W − C > 2 (the complementary case is easy to deal with). Equation (68) reduces to χ[s] ≤ O(1) + 2 ln(cid:18) 2(W − 1) (69) W − 2 − C(cid:19) ∈ O (ln C) . W−2 (since s(1) + η(cid:48) + η(W − 2) = 1) we have M LPR[s](cid:19) , (70) 1 Finally, since M LPR[s] ≤ (W − C)η and η ≤ 1 M LPR[s] ≤ W−C χ[s] ∈ O(cid:18)ln W−2 , implying which, for M LPR[s] > 1 C , provides a more descriptive bound than (69). 22 6 Fast Simulation of the LPR Policy In experimental studies it is important to simulate eviction policies on sets of benchmark traces. From the stack distances, the number of misses for all buffer capacities can be easily derived in time O(V ). Previous work [4, 9] has shown how to compute the stack distance for the LRU policy in time O(log V ) per access. We derive an analogous result for the more complex LPR policy. Theorem 5. Given any stack-distance distribution s, the number of misses incurred by the corresponding optimal LPR policy on an arbitrary trace of N references, can be computed, simultaneously for all capacities, in time O(V + N log V ). The algorithm proposed to prove the preceding result exploits some relations between the LPR stack and the LRU stack and achieves efficiency by means of fast data structures. Proposition 6. Let s be a stack-distance distribution and let (q1, q2, . . . , ql) be the (in- creasing) sequence associated with s as in Theorem 2. Let Λ be the LRU stack and let Π be the LPR stack corresponding to s, both assumed initially equal. In either stack, let the i-th segment be the set of positions in interval Qi := [qi + 1, qi+1]. Finally, for j ∈ {1, 2, . . . , V }, let ρt(j) denote the position in the LPR stack Πt of the item that is in position j of the LRU stack Λt, i.e., Πt(ρt(j))=Λt(j). Then, we have: 1. Segment equivalence. At any time t, segment Qi contains the same items in both stacks, that is, j ∈ Qi if and only if ρt(j) ∈ Qi. 2. Relative update. Upon an access at at LRU stack depth dt, if dt = 1, then the map ρ between the two stacks is unchanged. Otherwise (dt > 1), ρ is updated as follows. For any t, any segment Qi, with i = 1, . . . , l − 1, and any h ∈ {0, qi+1 − qi − 1}, (so that (qi + 1 + h) ∈ Qi), we have: ρt+1(qi + 1 + h) = ρt(qi + 1 + h) ρt (qi + 1 + ((h − 1) mod (dt − qi))) ρt (qi + 1 + ((h − 1) mod (qi+1 − qi))) dt < qi + 1 + h qi + 1 + h ≤ dt ≤ qi+1 qi+1 < dt (71) . In other words, (a) below the LRU point of access, ρ does not change; (b) within the prefix of the segment including the access up to the point of access itself, as well as (c) within those segments that are entirely above the point of access, ρ incurs a unit, right cyclic shift. Proof. Segment equivalence. We begin by observing that, for buffer sizes in the set {q1, q2, . . . , ql}, the LPR policy coincides with LRU, whence BLP R (qi). In fact, for a K-L policy, the buffer content is a subset of the first L positions of the LRU stack. From Corollary 1, if C = qi, then L(C) = qi, hence the LPR buffer content must equal that of the first qi positions of the LRU stack which, by definition of stack, is also the content of the LRU buffer of capacity qi. The segment equivalence property follows since, for any stack policy, the content of the stack in a segment Qi equals (by definition) the set theoretic difference between B(qi+1) and B(qi). (qi) = BLRU t t Relative update. If dt = 1, then neither stack changes, therefore ρt+1 = ρt. Otherwise, let dt ∈ Qa, that is, let Qa be the segment capturing the access and consider the following cases. 23 (i) For all buffer sizes C > qa+1, the access is a hit both for the LRU and for the LPR policy, hence both stacks, and consequently the ρ map, remain unchanged at positions greater than qa+1. This is a subcase of case (a) in the statement and applies to all segments with i > a (hence 1 + qi + h > qa+1). (ii) For buffer sizes C ∈ Qa the situation is as follows. Under LRU, there is a miss for C < dt, so that in the LRU stack: the items in positions smaller than dt shift down by one position, the item at dt goes at the top of the stack, and all other items retain their position. Under LPR, let Ca be the smallest capacity of a buffer containing the referenced item, at+1. Then, all the buffers with C < Ca will evict item Λt(qa), which will go to position Ca of the LPR stack, the item previously at Ca will go to the top of the stack, while all remaining items in segment Qa will retain their position. Consequently, for h = (dt + 1) − (qa + 1), . . . , qa+1 − (qa + 1), we have ρt+1(qa + 1 + h) = ρt(qa + 1 + h), still a subcase of case (a) in the statement. Furthermore, ρt+1(qa + 1) = ρt(dt) and, for h = 1, . . . , dt − (qa + 1), ρt+1(qa + 1 + h) = ρt(qa + 1 + h − 1), which establishes case (b) in the statement. (iii) For segments Qi with i < a, the argument is a straightforward adaptation of that developed for case (ii) and establishes case (c) of the statement. We are now ready to provide the algorithm for LPR stack-distance computation and its analysis. Proof of Thm. 5. The work of [4,9] has provided a procedure that, given the initial LRU stack Λ0 and the prefix a1, . . . , at of the input trace, will output the LRU stack distances d0, . . . , dt−1, in time O(V + t log V ). Below, we develop a representation of the map ρ between the LRU and the LPR stack, which can be updated and queried in time O(log V ) per access. Then the LPR stack distance of access at+1 can be obtained as ρ(dt). By Proposition 6, we can represent ρ by a separate sequence (ρ(qi + 1), . . . , ρ(qi+1)) for each segment. On such a sequence, we need to perform cyclic shifts of an arbitrary prefix and to access element ρ(qi + 1 + h), given an h ∈ [0, qi+1 − (qi + 1)]. Any of the well-known dynamic balanced trees (AVL, 2-3, red-black, . . . ) [16] can be easily adapted to perform each of the required operations in time O(1 + log(qi+1 − qi)) = O(log V ). Hereafter, we denote by Ri the data structure for segment Qi. The number of segments where the map ρ can change in one step can be θ(V ), in the worst case. Therefore, we adopt a lazy update strategy whereby only the segment Qa capturing the access is actually updated; for the other segments, record is taken that a shift should be applied to the sequence, without performing the shift itself. It is sufficient to increment a counter storing the amount of shift that has to be applied to the sequence and then perform just one global rotation when the segment is accessed. Still, individually incrementing each segment counter could lead to work proportional to V , per step. Instead, we maintain an auxiliary tree T of counters which collectively serve the segments and where at most logarithmically many counters need updating in a given step. A further field in the auxiliary tree will enable quick identification of segment Qa. More specifically, the auxiliary tree is a static, balanced tree with l − 1 leaves corre- sponding, from left to right, to segments Q1, . . . Ql−1. In each internal node, a search field contains the maximum right boundary of any segment associated with a descendant of that node. In each node, a counter field will be maintained so that, at the end of a step, the sum of the counters over the ancestors of the i-th leaf represent the amount of shift to be applied to ρ-sequence in segment Qi. 24 With the above data structures in place, the algorithm to process one access at+1 is outlined next. the root to the leaf corresponding to the segment Qa which contains dt. 1. From the LRU procedure, obtain the LRU stack distance dt. 2. In the auxiliary tree T , with the help of the search field, traverse the path P from 3. While traversing P, increment by one the counter of a left child ν of a visited node whenever ν itself is not on P. (This operation corresponds to incrementing the shift count for all the segments to the left of Qa, as required by Proposition 6.) 4. While traversing P, add the counters of the visited nodes and apply a shift of the resulting amount to Ra. Subtract such amount from the counter of the leaf for Qa. 5. Read ρt(dt) from the (dt − qa)-th position of sequence Ra and output this value as 6. Apply a unit right cyclic shift to the prefix of length (dt − qa) of sequence Ra. the LPR stack distance of at+1. Each step in the outlined procedure can be accomplished in time O(log V ), so that the overall time for processing N accesses is O(V + N log V ), where the term V accounts for the initial set up of the data structures. To avoid that the counter in a node ν of the auxiliary tree grow unbounded, we observe that it is sufficient to maintain its value modulo the minimum common multiple of the lengths of the segments associated with the descendant leaves of ν. 7 On Finite Horizon In practice, when dealing with sufficiently long traces, a policy that is optimal over an infinite horizon is likely to achieve near optimal performance. For shorter traces, transient effects may play a significant role, whence the interest in optimal policies over a finite horizon. In principle, the optimal policy can be computed by a dynamic-programming algorithm based on (13), but the exponential number of states makes this approach of rather limited applicability. An alternate, often successful route consists in guessing a closed form characterization of a policy π and its corresponding optimal cost function J π τ (·). Under very mild conditions, if the guess satisfies (13), then π is an optimal policy. Unfortunately, we have been unable to find a tractable form for the optimal cost. Ultimately, we have circumvented this obstacle for monotone stack-depth distributions, by realizing that what is really needed to make an optimal choice between two states is not the absolute value of their costs, but rather their relative value. Theorem 6. Let s be non increasing, i.e., s(j) ≥ s(j + 1) for j ∈ {1, V − 1}. Then, for any finite horizon τ ≥ 1 and any initial buffer content, LRU is an optimal eviction policy. Theorem 7. Let s be non decreasing, i.e., s(j) ≤ s(j + 1) for j ∈ {1, V − 1}. Then, for any finite horizon τ ≥ 1 and any initial buffer content, MRU is an optimal eviction policy. Thus, for monotone stack-depth distributions, the finite horizon optimal policy is time invariant, hence it is also optimal over an infinite horizon. This property does not hold for arbitrary distributions. In spite of the symmetry between the above two theorems, their proofs, given in §7.1 and §7.2, require significantly different ideas. We have extended Thm. 6 to the case of (non increasing) dependent stack depth distribution, where, given a prefix trace ζ, the next stack distance is described by the following distribution, assumed to be non increasing for all ζ: sζ(i) = Pr [dt = iζ] . 25 (72) The details are given in §7.1.1, Thm. 8. For the case of initially empty buffer a result similar to Thm. 8, but based on a stronger notion of optimality, is derived by Hiller and Vredeveld [28], using different techniques. This generalization of the LRUSM has also been studied by Becchetti [6], who provides sufficient conditions on sζ and C/V for the stochastic competitive ratio of LRU against OPT to be O(1). 7.1 Non-Increasing Access Distribution For the purposes of this section, the state description for the LRUSM developed in §4.1 can be simplified, by unifying the representation of the LRU stack and of the buffer in a vector x of V binary components, where xt(j) = 1 when the item at depth j in the LRU stack is in the buffer at time t and xt(j) = 0 otherwise. The disturbance is still the LRU depth of the access (wt = dt), while the control ut specifies the LRU depth of the item to be evicted. Denoting by f the state transition function, we have: xt+1 = f (xt, dt, ut) . (73) With this representation, the well-known LRU policy amounts to evicting the item in the deepest position of the (resulting) stack, among those that are in the buffer: Definition 5. Let Rd(x) denote the state resulting by applying a unit right cyclic shift to the prefix of length d of x; (strictly speaking, if x(d) = 0 then Rd(x) is a pseudo-state, as it is not in the admissible state set). The Least Recently Used (LRU) policy is defined (for a miss, x(d) = 0) by LRU(x, d) = max{j : y(j) = 1, where y = Rd(x)} . Definition 6. We say that two states y and z are form a critical pair and write y <c z if their structure is related as follows, where ν, ι are arbitrary and σ ∈ 0∗: (74) y = 1ν1ι0σ , z = 1ν0ι1σ . (75) We also write y ≤c z when y = z or y <c z. Remark 4. A critical pair represents a choice between what would the LRU policy do (obtaining y) and what would a different eviction policy do (obtaining z), when choosing the item to evict after the stack rotation. Lemma 4. The evolution of a critical pair under LRU preserves its criticality and order: ∀y ∀z : y <c z ∀d y(cid:48) = f LRU(y, d) ≤c z(cid:48)f LRU(z, d) . (76) where f LRU(x, d) = f (x, d, LRU(x, d)). Proof. We analyze the four possible cases: • Hit for both y and z. The two stacks rotate and produce a critical pair with y(cid:48) <c z(cid:48). • Miss for both y and z. The two evictions in the last filled positions make the states equal if ι ∈ 0∗, otherwise they yield y(cid:48) <c z(cid:48). • Hit for y and miss for z. The eviction in z yields y(cid:48) = z(cid:48). • Miss for y and hit for z. The eviction in y brings y(cid:48) = z(cid:48) if ι ∈ 0∗ and y(cid:48) <c z(cid:48) otherwise. 26 Proposition 7. Let s be monotonic non decreasing, then LRU is the optimal eviction policy for every time horizon τ and any initial buffer content. Furthermore: τ (y) ≤ J∗ Proof (by induction on τ). Base case. For τ = 1 we have ∀τ ∀y ∀z : y ≤c z J∗ τ (z) . ∀x J∗ 1 (x) = Ed [g(x, d)] := ¯g(x) , which, using the monotonicity of s, yields Induction. Assuming now that the statement holds for all t < τ, we obtain 1 (z) . ∀x J∗ 1 (y) ≤ J∗ ∀y ∀z : y ≤c z J∗ τ (x) = ¯g(x) + Ed(cid:104)min = ¯g(x) + Ed(cid:2)J∗ τ−1(cid:0)f LRU(y, d)(cid:1) ≤ J∗ τ−1 (f (x, d, u))(cid:105) τ−1(cid:0)f LRU(x, d)(cid:1)(cid:3) . Since ¯g(y) ≤ ¯g(z) and since, by the inductive hypothesis and Lemma 4, τ−1(cid:0)f LRU(z, d)(cid:1) , we finally obtain J∗ Proof of Thm. 6. Thm. 6 follows directly from Prop. 7. J∗ τ (y) ≤ J∗ τ (z). J∗ u (77) (78) (79) (80) (81) 7.1.1 Generalization to Dependent Processes i=0V i be the set of traces Let V := {1, 2, . . . , V }, V 0 := {} ( being the null trace), VL = ∪L of size no greater than L, and X the state space (boolean vectors on the LRU stack). We consider stochastic processes generating a trace of length L, such that, after having generated a partial trace ζ of length t − 1 = ζ, the probability distribution of the next access is specified by sζ(i) = Pr [at+1 = Λt(i) ζ] = Pr [dt = i ζ] . (82) (83) The optimal cost achievable for such a process, given a partial trace ζ is ∀x ∈ X, J∗ L(ζ, x) = Ed(cid:104)min u {g(x, d) + J∗ L (ζd, f (x, d, u))}ζ(cid:105) where the probability distribution of d is a function of ζ as given in (82). Theorem 8. If ∀ζ sζ is a non-increasing function, then LRU is optimal for any initial buffer content: ∀L ∀ζ ∈ VL ∀y, z ∈ X : y ≤c z J∗ (84) Proof. Let L be given. For a trace ζ we define τζ := L − ζ. The proof is by induction on τζ. L(ζ, y) ≤ J∗ L(ζ, z) . Base case. ⇒ ∀y ≤c z J∗ ∀ζ : τζ = 1 ∀x ∈ X J∗ L(ζ, y) ≤ J∗ 27 L(ζ, x) = Ed [g(x, d) ζ] L(ζ, z) . (85) (86) Induction. Since by inductive hypothesis we assume that ∀θ : τθ < τ ∀y ≤c z J∗ L(θ, y) ≤ J∗ L(θ, z) , we obtain, ∀x ∈ X, J∗ L(ζ, x) = Ed(cid:104)min Let θ := ζd, since ∀y ≤c z J∗ Lemma 4, u {g(x, d) + J∗ = Ed [g(x, d)ζ] + Ed(cid:2)J∗ L(θ, y) ≤ J∗ L(cid:0)θ, f LRU(y, d)(cid:1) ≤ J∗ L (ζd, f (x, d, u))}ζ(cid:105) L(cid:0)ζd, f LRU(x, d)(cid:1)ζ(cid:3) . L(cid:0)θ, f LRU(z, d)(cid:1) , L(ζ, z). J∗ we finally obtain J∗ L(ζ, y) ≤ J∗ (87) (88) (89) (90) L(θ, z) and, by the inductive hypothesis and 7.2 Non-Decreasing Access Distribution In this subsection we prove that MRU is the optimal eviction policy for non-decreasing s for any time horizon. The proof will be by induction: by assuming the optimal policy to be MRU for t ≤ τ we will be able to prove its optimality for the time horizon τ + 1 (more precisely, a strengthened inductive hypothesis will be used). In order to compare costs under MRU for different initial states we introduce a useful partition of the misses. Imagine to place an observer on every out-of-buffer item, following the item going down the LRU stack during the system evolution; every time an out-of-buffer item is accessed its observer moves to the item evicted by the policy µ. Thus the set Ψ of the observers remains constant during the evolution. J µ τ (x0) = Let dt be the access depth at time t, let ψ be an observer and lµ t (ψ, x0, dt(cid:48)<t) its LRU stack depth at time t. We are interested in the event the item observed by ψ is accessed at time t: dt = lµ t (ψ, x0, dt(cid:48)<t). We can partition the misses occurring in τ steps attributing each miss to the observer ψ ∈ Ψ on the item currently accessed: t (ψ, x0, dt(cid:48)<t)] = (cid:88)ψ∈Ψ (91) Let ψj be the observer which is at depth j at time 0. Under MRU the evolution of an observer ψj does not depend on x0 but only on the initial position of the observed item (ψj, dt(cid:48)<t) = lt(ψj) for brevity). If we have two states x(cid:48) (i.e., lMRU and x(cid:48)(cid:48) which differ for only two observers ψi and ψj we can write their costs Γ(cid:48) and Γ(cid:48)(cid:48) as: τ−1(cid:88)t=0(cid:88)ψ∈Ψ (ψj, x0, dt(cid:48)<t) = lMRU τ−1(cid:88)t=0 τ−1(cid:88)t=0 PrMISS(t) = Pr[dt = lµ t t Pr[dt = lµ t (ψ, x0, dt(cid:48)<t)] . Γ(cid:48) =(cid:88)ψ∈Ψ\{ψi} Γ(cid:48)(cid:48) =(cid:88)ψ∈Ψ\{ψj} τ−1(cid:88)t=0 τ−1(cid:88)t=0 Pr[dt = lt(ψ)] + Pr[dt = lt(ψ)] + τ−1(cid:88)t=0 τ−1(cid:88)t=0 Pr[dt = lt(ψi)] , Pr[dt = lt(ψj)] . (92) where the first term is equal in both the costs, because it is due to observers which start in the same position for both states, and thus: Γ(cid:48) − Γ(cid:48)(cid:48) = τ−1(cid:88)t=0 Pr[dt = lt(ψi)] − τ−1(cid:88)t=0 28 Pr[dt = lt(ψj)] = γτ (i) − γτ (j) , (93) having defined γτ (i) :=(cid:80)τ−1 t=0 Pr[dt = lt(ψi)]. Thus, the difference in the costs depends only on the items observed by the different observers. Quantity γτ (i) represents the contribution to the total cost due to items observed by ψi, the observer that at time zero is in position i (not in the buffer). To prove that MRU is optimal for a time horizon of τ + 1 under the hypothesis that it is optimal for any t ≤ τ it is sufficient to prove that γτ (i) ≤ γτ (j) if i < j: Proposition 8. Let s be non decreasing: ∀j ∈ {1, V − 1} s(j) ≤ s(j + 1). If ∀t ≤ τ ∀i∀j : i < j γt(2) ≤ γt(i) ≤ γt(j) ≤ 1 + γt(2) , then ∀i∀j : i < j γτ +1(2) ≤ γτ +1(i) ≤ γτ +1(j) ≤ 1 + γτ +1(2) . Proof. Base case. For t = 1 we have ∀k γt(k) = s(k), and hence Furthermore we have that Induction. γt(2) ≤ γt(i) ≤ γt(j) . γt(k) = s(k) ≤ 1 ≤ 1 + γt(2) . γτ +1(i) = s(i)(1 + γτ (2)) + S(i − 1)γτ (i) + (1 − S(i))γτ (i + 1) ≤ s(i)(1 + γτ (2)) + (1 − s(i))γτ (i + 1) ≤ s(i)(1 + γτ (2)) + (1 − s(i))γτ (j) = s(i)(1 + γτ (2)) + s(j)γτ (j) + (1 − s(i) − s(j))γτ (j) , γτ +1(j) = s(j)(1 + γτ (2)) + S(j − 1)γτ (j) + (1 − S(j))γτ (j + 1) ≥ s(j)(1 + γτ (2)) + (1 − s(j))γτ (j) = s(j)(1 + γτ (2)) + s(i)γτ (j) + (1 − s(i) − s(j))γτ (j) Finally under MRU we have ⇒ γτ +1(i) ≤ γτ +1(j) . and γτ +1(k) = s(k)(1 + γτ (2)) + S(k − 1)γτ (k) + (1 − S(k))γτ (k + 1) ≥ min{1 + γτ (2), γτ (k), γτ (k + 1)} = γτ (k) , γτ +1(k) = s(k)(1 + γτ (2)) + S(k − 1)γτ (k) + (1 − S(k))γτ (k + 1) ≤ max{1 + γτ (2), γτ (k), γτ (k + 1)} = 1 + γτ (2) , and therefore γτ +1(k) ≤ 1 + γτ +1(2) . Proof of Thm. 7. Thm. 7 follows directly from Prop. 8. 29 (94) (95) (96) (97) (98) (99) (100) (101) (102) 8 On Bias Optimality Bias optimality is a stronger property than average (gain) optimality, since it also takes into account the cost minimization in transient states of the dynamical system (whereas average costs are insensible to policy changes in transient states, provided the set of recurrent states stays unchanged). Bias optimal policies are characterized as solutions of the Bellman equation (see Prop. 1). In this section we provide evidence of the hardness of the general solution of the Bellman equation in two ways: • We prove that bias-optimal policies in general do not satisfy the inclusion property (the same result also applies to optimal policies in a finite horizon). • We derive the complex solution of the Bellman equation for the relatively simple case of C = 2. Theorem 9. There are systems for which the unique optimal policy over some finite horizon and bias-optimal over infinite horizon is not a stack policy. Proof. We will exhibit a counterexample of a distribution s that has optimal policies not induced by a priority (and hence not a stack policy). In more detail we first obtain by dynamic programming (executed by a computer program) the finite horizon optimal policies for two different buffer capacities C(cid:48) and C(cid:48)(cid:48) (being C(cid:48) < C(cid:48)(cid:48)). Starting with buffers that satisfy the inclusion (B0(C(cid:48)) ⊆ B0(C(cid:48)(cid:48))) we show that there exists a temporal horizon τ and state positions j(cid:48) and j(cid:48)(cid:48) such that, when in a state with both positions filled, for C = C(cid:48) the optimal policy evicts at j(cid:48), whereas for C = C(cid:48) it evicts at j(cid:48)(cid:48). By solving (by a computer program) the Bellman equation associated to the system we also prove that a similar situation applies to the infinite horizon case, implying that the unique bias-optimal policy in infinite horizon does not have the inclusion property. Consider the following s distribution, with V = 8 and β = 1 16. 5β 8 s(j): β 1 3β 2 3β 3 0 6 0 7 0 4 4β 5 j ∈ [1, V ] We are given an initial LRU stack Λ0 and we consider the following initial buffers B0(2) and B0(3), satisfying the inclusion property B0(2) ⊂ B0(3): B0(2) = [Λ0(1), Λ0(4)] , B0(3) = [Λ0(1), Λ0(4), Λ0(7)] . (103) If an access arrives at x0 = Λ0(8) a miss occurs in both buffers, and hence an eviction is needed. By computing the optimal policy for a time horizon of T = 5 we see that • for C = 2 the (unique) optimal eviction is at depth 2 (Λ0(1)), • for C = 3 the (unique) optimal eviction is at depth 5 (Λ0(4)). After the optimal evictions the two buffers become B1(2) = [Λ0(8), Λ0(4)] = [Λ1(1), Λ1(5)] B1(3) = [Λ0(8), Λ0(1), Λ0(7)] = [Λ1(1), Λ1(2), Λ1(8)] , , (104) (105) hence violating the inclusion property. The same eviction choice is given by the solution of the Bellman equation in infinite horizon, proving that bias-optimal policies are not, in general, stack policies. (Intuitively, the inclusion property violations happens because having in the buffer Λ(8) decreases the "profit" of having Λ(5): in fact a possible subsequent 30 access to Λ(8) brings to a new state with high instant cost g, since it has in the buffer the low profit item Λ(6); whereas when C = 2 the same access causes a miss, thus enabling the eviction of the poorly profitable Λ(6).) 8.1 The Bias-Optimal Policy for C = 2 When C = 2, the state of our dynamical system can be identified by the unique index j ∈ {2, . . . , V } such that the buffer contains the items in positions 1 and j of the LRU stack. The Bellman equation becomes h(j) = 1−s(j)+h(2)−λ+S(j−1) min{0, h(j) − h(2)}+(1−S(j)) min{0, h(j + 1) − h(2)} . (106) The h(j)'s are defined up to an additive constant, so we can set h(2) = 0 to simplify the equation: h(j) = 1 − s(j) − λ + S(j − 1) min{0, h(j)} + (1 − S(j)) min{0, h(j + 1)} . The solutions will satisfy h(j) = h(j)− h(2) = limτ→+∞ J∗ rather complex form of the solutions, in terms of the auxiliary functions τ (j)− J∗ τ (2). We now "guess" the (107) β(j) := max l≥1 ¯s(j, j + l − 1) , Φ(j) :=(cid:110)l ≥ 1 : ∀k ∈ {0, . . . , l − 1} ¯s(j + k, j + l − 1) ≥ β(2)(cid:111) ∪(cid:8)0(cid:9) , ρ(j) :=(cid:40)¯s(j, j + φ(j) − 1) − β(2) φ(j) (cid:54)= 0 , φ(j) := max Φ(j) , φ(j) = 0 . β(j) − β(2) (108) where Φ(j) is the subsequence of items that are visited when applying the policy induced using β as a priority and φ(j) the length of this subsequence. Proposition 9. Bellman equation (107) is solved using the following λ and h(j): λ = 1 − β(2) , h(j) = β(2) − s(j) − 1−S(j−1), then 1 Proof. Let ψ(j) := S(j − 1) 1 − S(j − 1) φ(j)ρ(j) − φ(j + 1)ρ(j + 1) . (109) h(j) =(cid:40)−ψ(j)ρ(j)φ(j) ρ(j) > 0 (⇒ φ(j) > 0) β(2) − s(j) − φ(j + 1)ρ(j + 1) ρ(j) < 0 (⇒ φ(j) = 0) . (110) This implies min{0, h(j)} = −ψ(j)ρ(j)φ(j). Using this term we can see that the chosen λ and h(j) satisfies (107). 9 Conclusions In this paper, we have revisited the classical eviction problem, relating it to optimal control theory and introducing the average occupancy variant, which provides solutions and insights even for the classical, fixed occupancy version of the problem. A number of interesting and challenging issues remain open in the area of eviction policies for the memory hierarchy. One objective is the search for optimal policies (or 31 policies with good performance guarantees), with fixed occupancy, for general HMRM traces. In this context, it may be worthwhile to investigate the Least Profit Rate policy beyond the LRUSM model. Within the LRUSM, we have considered policy design assuming a known stack-depth distribution: what performance guarantees can be achieved if the distribution is not known a priori, but perhaps estimated on-line, is another intriguing question, whose answer may have practical value for memory management in general purpose systems, where different applications are likely to conform to different distributions. In this work, we have also explored forms of optimality different from gain optimality. However, even within the LRUSM, we lack general solutions for a finite horizon as well as for infinite horizon, if we insist on bias optimality. A question underlying the entire area of eviction policies remains the choice of an appropriate stochastic model for the trace. While the LRUSM captures temporal locality in a reasonable fashion, it completely misses spatial locality, a property critically exploited in hardware and software systems. Spatial locality implies that certain subsets of the addressable items occur more frequently in short intervals of the trace than other subsets. On the contrary, the LRUSM is invariant under arbitrary permutations of the items. The Markov Reference Model can capture some level of temporal and space locality, for example if the transition graph contains regions where outward transitions have low probability, thus corresponding to a sort of working set. However, in real programs, the same item tends to occur in different working sets at different times, that is, the same item can be accessed in different states of the trace, so that the state cannot be identified with the last item that has been accessed, as in the MRM (see also [34] for evidence on the limitations of Markov models). Suitable hidden Markov models do not necessarily suffer from this limitation, which motivates further investigations of optimal policies for the general HMRM. Acknowledgments We wish to express our gratitude to Prof. Augusto Ferrante who has kindly provided valuable expert advise on optimal control theory at many critical junctures of this research. References [1] Aggarwal, A., Alpern, B., Chandra, A. K., and Snir, M. A model for hierarchical memory. In STOC (1987), pp. 305 -- 314. [2] Albers, S., Favrholdt, L. M., and Giel, O. On paging with locality of reference. J. Comput. Syst. Sci. 70, 2 (2005), 145 -- 175. [3] Allen, R., and Kennedy, K. Optimizing compilers for modern architectures: a dependence-based approach. Morgan Kaufmann, 2002. [4] Almasi, G. S., Cascaval, C., and Padua, D. A. Calculating stack distances efficiently. In MSP/ISMM (2002), pp. 37 -- 43. [5] Arapostathis, A., Borkar, V. S., Fernández-Gaucherand, E., Ghosh, M. K., and Marcus, S. I. Discrete-time controlled markov processes with average cost criterion: a survey. SIAM J. Control and Optimization 31, 2 (March 1993), 282 -- 344. [6] Becchetti, L. Modeling Locality: A Probabilistic Analysis of LRU and FWF. In ESA (2004), S. Albers and T. Radzik, Eds., vol. 3221 of Lecture Notes in Computer Science, Springer, pp. 98 -- 109. 32 [7] Belady, L. A. A study of replacement algorithms for virtual-storage computer. IBM Systems Journal 5, 2 (1966), 78 -- 101. [8] Belady, L. A., Nelson, R. A., and Shedler, G. S. An anomaly in space-time characteristics of certain programs running in a paging machine. Commun. ACM 12, 6 (1969), 349 -- 353. [9] Bennett, B., and Kruskal, V. LRU stack processing. IBM Journal of Research and Development 19, 4 (1975), 353 -- 357. [10] Bernholt, T., Eisenbrand, F., and Hofmeister, T. A geometric framework for solving subsequence problems in computational biology efficiently. In SCG '07 (New York, NY, USA, 2007), ACM, pp. 310 -- 318. [11] Bertsekas, D. P. Dynamic Programming and Optimal Control. Athena Scientific, 2000. [12] Bilardi, G., Ekanadham, K., and Pattnaik, P. Efficient stack distance com- In Conf. Computing Frontiers (2011), putation for priority replacement policies. p. 2. [13] Bilardi, G., and Preparata, F. P. Horizons of parallel computation. J. Parallel Distrib. Comput. 27, 2 (1995), 172 -- 182. [14] Blackwell, D. Discrete dynamic programming. The Annals of Mathematical Statistics (1962), 719 -- 726. [15] Borodin, A., Irani, S., Raghavan, P., and Schieber, B. Competitive paging with locality of reference. J. Comput. Syst. Sci. 50, 2 (1995), 244 -- 258. [16] Cormen, T., Leiserson, C., Rivest, R., and Stein, C. Introduction to algorithms. MIT Press, 2004. [17] Denning, P. J. The working set model for program behaviour. Commun. ACM 11, 5 (1968), 323 -- 333. [18] Diakonikolas, I., and Yannakakis, M. Succinct approximate convex pareto curves. In SODA (2008), pp. 74 -- 83. [19] Effelsberg, W., and Härder, T. Principles of database buffer management. ACM Trans. Database Syst. 9, 4 (1984), 560 -- 595. [20] Ehrgott, M. Multicriteria optimization. Springer, 2005. [21] Fiat, A., and Rosen, Z. Experimental studies of access graph based heuristics: Beating the LRU standard? In SODA (1997), pp. 63 -- 72. [22] Fotheringham, J. Dynamic storage allocation in the atlas computer, including an automatic use of a backing store. Commun. ACM 4, 10 (1961), 435 -- 436. [23] Franaszek, P. A., and Wagner, T. J. Some distribution-free aspects of paging algorithm performance. J. ACM 21, 1 (1974), 31 -- 39. [24] Frederickson, G. N., and Johnson, D. B. The complexity of selection and ranking in x+y and matrices with sorted columns. J. Comput. Syst. Sci. 24, 2 (1982), 197 -- 208. 33 [25] Graham, R. L. An efficient algorithm for determining the convex hull of a finite planar set. Information Processing Letters 1, 4 (1972), 132 -- 133. [26] Guo, J., Garzarán, M. J., and Padua, D. A. The power of belady's algorithm in register allocation for long basic blocks. In Proc. 16th International Workshop on Languages and Compilers for Parallel Computing (2003), pp. 374 -- 390. [27] Hennessy, J. L., and Patterson, D. A. Computer architecture: a quantitative approach. Morgan Kaufmann, 2006. [28] Hiller, B., and Vredeveld, T. Simple optimality proofs for least recently used in the presence of locality of reference. Research Memoranda 055, Maastricht : METEOR, Maastricht Research School of Economics of Technology and Organization, 2009. [29] Karlin, A. R., Phillips, S. J., and Raghavan, P. Markov paging. SIAM J. Comput. 30, 3 (2000), 906 -- 922. [30] Kobayashi, M., and MacDougall, M. H. The stack growth function: Cache line reference models. IEEE Trans. Computers 38, 6 (1989), 798 -- 805. [31] Koutsoupias, E., and Papadimitriou, C. H. Beyond competitive analysis. SIAM J. Comput. 30, 1 (2000), 300 -- 317. [32] Levin, D., Peres, Y., and Wilmer, E. Markov chains and mixing times. American Mathematical Society, 2009, ch. 1.2. [33] Lewis, M. E., and Puterman, M. L. Bias optimality. In Handbook of Markov Decision Processes: Methods and Applications, E. A. Feinberg and A. Shwartz, Eds. Springer, 2002, pp. 89 -- 111 (Chap. 3). [34] Liberatore, V. Empirical investigation of the markov reference model. In SODA (1999), pp. 653 -- 662. [35] Lin, Y.-L., Jiang, T., and Chao, K.-M. Efficient algorithms for locating the length- constrained heaviest segments with applications to biomolecular sequence analysis. J. Comput. Syst. Sci. 65, 3 (2002), 570 -- 586. [36] Loève, M. Probability Theory. Springer-Verlag, New York, 1977. [37] Mattson, R. L., Gecsei, J., Slutz, D. R., and Traiger, I. L. Evaluation techniques for storage hierarchies. IBM Systems Journal 9, 2 (1970), 78 -- 117. [38] Megiddo, N., and Modha, D. S. Outperforming LRU with an adaptive replacement cache algorithm. IEEE Computer 37, 4 (2004), 58 -- 65. [39] Miettinen, K. Nonlinear multiobjective optimization. Springer, 1999. [40] Oden, P. H., and Shedler, G. S. A model of memory contention in a paging machine. Commun. ACM 15, 8 (1972), 761 -- 771. [41] Panagiotou, K., and Souza, A. On adequate performance measures for paging. In STOC (2006), pp. 487 -- 496. [42] Papadimitriou, C., and Tsitsiklis, J. The complexity of markov decision processes. Mathematics of operations research (1987), 441 -- 450. 34 [43] Papadimitriou, C. H., and Yannakakis, M. On the approximability of trade-offs and optimal access of web sources. In FOCS '00: Proceedings of the 41st Annual Symposium on Foundations of Computer Science (Washington, DC, USA, 2000), IEEE Computer Society, p. 86. [44] Przybylski, S. A. Cache and memory hierarchy design: a performance-directed approach. Morgan Kaufmann, 1990. [45] Savage, J. E. Models of computation: Exploring the power of computing. Addison- Wesley Longman Publishing Co., Inc. Boston, MA, USA, 1997. [46] Silberschatz, A., Galvin, P. B., and Gagne, G. Operating System Principles. Wiley India Pvt. Ltd., 2005. [47] Sleator, D. D., and Tarjan, R. E. Amortized efficiency of list update and paging rules. Commun. ACM 28, 2 (1985), 202 -- 208. [48] Smaragdakis, Y., Kaplan, S. F., and Wilson, P. R. EELRU: Simple and effective adaptive page replacement. In SIGMETRICS (1999), pp. 122 -- 133. [49] Smaragdakis, Y., Kaplan, S. F., and Wilson, P. R. The EELRU adaptive replacement algorithm. Perform. Eval. 53, 2 (2003), 93 -- 123. [50] Spirn, J. R., and Denning, P. J. Experiments with program locality. In AFIPS '72 (Fall, part I) (New York, NY, USA, 1972), ACM, pp. 611 -- 621. [51] Stone, H. S., Turek, J., and Wolf, J. L. Optimal partitioning of cache memory. IEEE Trans. Comput. 41, 9 (1992), 1054 -- 1068. [52] Sugumar, R. A., and Abraham, S. G. Efficient simulation of caches under optimal replacement with applications to miss characterization. In SIGMETRICS (1993), pp. 24 -- 35. [53] Thiébaut, D., Stone, H. S., and Wolf, J. L. Improving disk cache hit-ratios through cache partitioning. IEEE Trans. Comput. 41, 6 (1992), 665 -- 676. [54] Thompson, J. G., and Smith, A. J. Efficient (stack) algorithms for analysis of write-back and sector machines. ACM Trans. Comput. Syst. 7, 1 (1989), 78 -- 116. [55] Turner, R., and Strecker, W. D. Use of the LRU stack depth distribution for simulation of paging behavior. Commun. ACM 20, 11 (1977), 795 -- 798. [56] Wolfe, M. J., Shanklin, C., and Ortega, L. High performance compilers for parallel computing. Addison-Wesley Longman Publishing Co., Inc. Boston, MA, USA, 1995. [57] Wood, C., Fernández, E. B., and Lang, T. Minimization of demand paging for the LRU stack model of program behavior. IBM Los Angeles Scientific Center Reports G320, 2689 (July 1977). [58] Wood, C., Fernández, E. B., and Lang, T. Minimization of demand paging for the LRU stack model of program behavior. Inf. Process. Lett. 16, 2 (February 1983), 99 -- 104. [59] Young, N. E. Bounding the diffuse adversary. In SODA (1998), pp. 420 -- 425. 35 A Bellman Equation Let ∆ be a discrete dynamical system and X, W and Q denote respectively its state, disturbance and control spaces; let P be the set of all the admissible policies to control the system. Definition 7. A system is said to be of type 1 (the standard model) if the policies are allowed to choose the control u at time t only as a function of the state at the same time: (111) (112) (113) (114) (115) where and ut = µ (xt) ∈ U (xt) , U : X → P(Q) , µ ∈ P : X → Q . Definition 8. A system is said to be of type 2 (our model) if the policies are allowed to choose the control u at time t as a function of the state and the disturbance at the same time: where and ut = µ (xt, wt) ∈ U (xt, wt) , U : X × W → P(Q) , µ ∈ P : X × W → Q . ∀x ∈ X ∀w ∈ W ∃u ∈ U (x, w) : f (x, u, w) = y ⇐⇒ ∃u(cid:48) (116) Definition 9. A system ∆ = (X, W, Q, g, f, U (·,·)) of type 2 is said to be equivalent to a system ∆(cid:48) = (X(cid:48), W (cid:48), Q(cid:48), g(cid:48), f(cid:48), U(cid:48)(·)) of type 1 if and only if X = X(cid:48), W = W (cid:48), g = g(cid:48) and (117) ∈ U(cid:48)(x) : f(cid:48)(x, u(cid:48), w) = y . Remark 5. Given an initial state x0 and a realization of wt for two equivalent systems ∆ and ∆(cid:48), and a sequence of controls ut for system ∆ is always possible to find u(cid:48) t such that the state trajectories xt (and hence the costs) of the two equivalent systems are the same. Lemma 5. For every system ∆ of type 2 exists a system ∆(cid:48) of type 1 s.t. ∆ and ∆(cid:48) are equivalent. Proof. The proof is obtained by choosing as controls for ∆(cid:48) the policies of ∆. Let ∀x ∈ X U(cid:48)(x) := P (since u(cid:48) ∈ P) . g(cid:48) := g, Q(cid:48) := P, f(cid:48)(cid:0)x, u(cid:48), w(cid:1) := f(cid:0)x, u(cid:48)(x, w), w(cid:1) , X(cid:48) := X, W (cid:48) := W, (118) (119) Then ∀x ∈ X, ∀w ∈ W, • ∀u ∈ U (x, w), let y = f (x, u, w). If we set u(cid:48) such that u(cid:48)(x, w) = u we have • ∀u(cid:48) f(cid:48)(cid:0)x, u(cid:48), w(cid:1) = f(cid:0)x, u(cid:48)(x, w), w(cid:1) = f (x, u, w) = y . ∈ U(cid:48)(x), let y = f(cid:48) (x, u(cid:48), w). If we set u = u(cid:48)(x, w) we have f (x, u, w) = f(cid:0)x, u(cid:48)(x, w), w(cid:1) = f(cid:48)(cid:0)x, u(cid:48), w(cid:1) = y . (120) (121) 36 Optimal cost update equations. Let wt be a random process with values in W , i.i.d. for different t's. Let ∆ be a system of type 2 and ∆(cid:48) an equivalent system of type 1. Then the cost update equation for ∆ can be written as: ∀x ∈ X J∗ τ (x) = Ew(cid:20) min u∈U (x,w)(cid:8)g(x, w) + J∗ τ−1 (f (x, u, w))(cid:9)(cid:21) , ∗ τ = T J whereas the same equation for ∆(cid:48) is: J ∗ τ−1 , ∀x ∈ X J∗ u(cid:48)∈U(cid:48)(x)(cid:8)Ew(cid:2)g(x, w) + J∗ ∗ τ = T(cid:48) τ (x) = min ∗ τ−1 . J J τ−1(cid:0)f(cid:48)(cid:0)x, u(cid:48), w(cid:1)(cid:1)(cid:3)(cid:9) , (122) (123) (124) (125) Remark 6. Since equivalent systems can reproduce each other's state evolution, their optimal costs are the same, in particular ∗ τ−1 = T(cid:48) ∗ τ−1 . (126) T J J We recall the classical Bellman equation theorem: Theorem 10 (Standard Bellman equation). Given a dynamical system ∆(cid:48) of type 1, if ∃λ and ∃h such that (127) then λ is the optimal average cost of ∆ and h are the differential costs of the states, i.e. λ1 + h = T h , ∀x, y ∈ X τ→+∞ J∗ lim τ (x) − J∗ τ (y) = h(x) − h(y) . (128) We are now ready to prove our version of the Bellman equation for a system ∆ of type 2: Proof of Prop. 1. Consider a system ∆(cid:48) equivalent to ∆. Applying Thm. 10 we have that, if we can solve Bellman equation for ∆(cid:48) then we have found its optimal average cost and differential costs vector. Since the two systems are equivalent this implies that they are also the corresponding costs of ∆. Hence we have ∃λ∃h : λ1 + h = T(cid:48) h ⇒ λ and h costs for ∆ , h = T h we finally have but since T(cid:48) ∃λ∃h : λ1 + h = T h ⇒ λ and h costs for ∆ . (129) (130) 37
1501.06148
1
1501
2015-01-25T12:45:29
A tie-break model for graph search
[ "cs.DS" ]
In this paper, we consider the problem of the recognition of various kinds of orderings produced by graph searches. To this aim, we introduce a new framework, the Tie-Breaking Label Search (TBLS), in order to handle a broad variety of searches. This new model is based on partial orders defined on the label set and it unifies the General Label Search (GLS) formalism of Krueger, Simonet and Berry (2011), and the "pattern-conditions" formalism of Corneil and Krueger (2008). It allows us to derive some general properties including new pattern-conditions (yielding memory-efficient certificates) for many usual searches, including BFS, DFS, LBFS and LDFS. Furthermore, the new model allows easy expression of multi-sweep uses of searches that depend on previous (search) orderings of the graph's vertex set.
cs.DS
cs
A tie-break model for graph search Derek G. Corneil ∗ J´er´emie Dusart † Michel Habib † Antoine Mamcarz † Fabien de Montgolfier † October 12, 2018 Abstract In this paper, we consider the problem of the recognition of various kinds of or- derings produced by graph searches. To this aim, we introduce a new framework, the Tie-Breaking Label Search (TBLS), in order to handle a broad variety of searches. This new model is based on partial orders defined on the label set and it unifies the General Label Search (GLS) formalism of Krueger, Simonet and Berry (2011), and the "pattern-conditions" formalism of Corneil and Krueger (2008). It allows us to derive some general properties including new pattern-conditions (yielding memory-efficient certificates) for many usual searches, including BFS, DFS, LBFS and LDFS. Further- more, the new model allows easy expression of multi-sweep uses of searches that depend on previous (search) orderings of the graph's vertex set. Keywords: Graph search model, tie-break mechanisms, BFS, DFS, LBFS, LDFS, multi-sweep algorithms. 1 Introduction A graph search is a mechanism for systematically visiting the vertices of a graph. It has been a fundamental technique in the design of graph algorithms since the early days of computer science. Many of the early search methods were based on Breadth First Search (BFS) or Depth First Search (DFS) and resulted in efficient algorithms for practical problems such as the distance between two vertices, diameter, connectivity, network flows and the recognition of planar graphs see [3]. Many variants of these searches have been introduced since, providing elegant and simple solutions to many problems. For example, Lexicographic Breadth First Search (LBFS) [19], and its generalization Maximal Neighbourhood Search (MNS) [21] were shown to yield simple linear time algorithms for chordal graph recognition. More recently, ∗Dept. of Computer Science, University of Toronto †LIAFA, UMR 7089 CNRS & Universit´e Paris Diderot, F-75205 Paris Cedex 13, France 1 Lexicographic Depth First Search (LDFS), was introduced in [8] based on its symmetrical "pattern-condition" with LBFS. A few years after its discovery it was shown that LDFS when applied to cocomparability graphs yields simple and efficient algorithms for solving various Hamiltonian Path related problems [6, 18, 7]. Some recent applications of graph searches involve a controlled tie-break mechanism in a series of consecutive graph searches, see [5, 9, 6, 11]. Examples include the strongly connected components computation using double-DFS [20] and the series of an arbitrary LBFS followed by two LBFS+s used to recognize unit interval graphs [5]. Note that a "+ search" breaks ties by choosing (amongst the tied vertices) the vertex that is rightmost with respect to a given ordering of the vertices. This motivates a general study of these graph searches equipped with a tie-break mechanism that incorporates such multi-sweep usage of graph searches. This is the goal of the present paper: to define the simplest framework powerful enough to capture many graph searches either used individually or in a multi-sweep fashion and simple enough to allow general theorems on graph searches. Building on the General Label Search (GLS) framework from [15] we not only simplify their model but also unify their model with the "pattern-conditions" formalism of [8]. This paper is organised as follows. After basic notations and definitions in Section 2, Section 3 introduces the Tie-Breaking Label Search (TBLS) formalism to address graph searches. We then illustrate the TBLS by expressing some classical graph searches in this formalism. We will also show the relationship between our formalism and the "pattern- conditions" of search orderings introduced in [8] thereby yielding some new pattern-conditions for various classical searches. In Section 5 we show that the TBLS and GLS models cap- ture the same set of graph searches. We then propose a unified method for recognizing whether a given ordering of the vertices could have been produced by a specific graph search. Finally, in Section 7 we present a TBLS implementation framework in a particular case. 2 Preliminaries and notation In this paper, G = (V, E) always (and sometimes implicitly) denotes a graph with n vertices and m edges. All graphs considered here are supposed to be finite. We identify the vertex-set with {1, ..., n}, allowing us to see a total ordering on V as a permutation on {1, ..., n}. We define a graph search to be an algorithm that visits all the vertices of a graph according to some rules, and a search ordering to be the ordering σ of the vertices yielded by such an algorithm. The link between these two notions is an overriding theme of this paper. Vertex σ(i) is the ith vertex of σ and σ−1(x) ∈ {1, ..., n} is the position of vertex x in σ. A vertex u is the leftmost (respectively rightmost) vertex with property X in σ if there is no vertex v such that X(v) and v <σ u (respectively u <σ v). Our graphs are assumed to be undirected, but most searches (especially those captured by TBLS) may be 2 performed on directed graphs without any modifications to the algorithm (if xy is an arc then we say that y is a neighbour of x while x is not a neighbour of y). The symmetric difference of two sets A and B, namely (A − B) ∪ (B − A) is denoted by A △ B. Furthermore, N+ represents the set of integers strictly greater than 0 and N+ p represents the set of integers strictly greater than 0 and less than p. P (N+) denotes the power-set of N+ and Pf (N+) denotes the set of all finite subsets of N+. By Sn we denote the set of all permutations of {1, ..., n}. For finite A ∈ P (N+), let umin(A) be: if A = ∅ then umin(A) = ∞ else umin(A) = min{i i ∈ A}; and let umax(A) be: if A = ∅ then umax(A) = 0 else umax(A) = max{i i ∈ A}. We always use the notation < for the usual strict (i.e., irreflexive) order between integers, and ≺ for a partial strict order between elements from Pf (N+) (or from another set when specified). Definitions of most of the searches we will consider appear in [8] or [12]. 3 TBLS, a Tie-Breaking Label Search A graph search is an iterative process that chooses at each step a vertex of the graph and numbers it (from 1 to n). Each vertex is chosen (also said visited) exactly once (even if the graph is disconnected). Let us now define a general Tie-Breaking Label Search (TBLS). It uses labels to decide the next vertex to be visited; label(v) is a subset of {1, ..., n}. A TBLS is defined on: 1. A graph G = (V, E) on which the search is performed; 2. A strict partial order ≺ over the label-set Pf (N+); 3. An ordering τ of the vertices of V called the tie-break permutation. The output of TBLS(G, ≺, τ ) is a permutation σ of V , called a T BLS − ordering or also the search ordering or visiting ordering. Let us say a vertex v is unnumbered until σ(i) ← v is performed, and then i is its visiting date. Thanks to the following algorithm, label(v) is always the set of visiting dates of the neighbours of v visited before v. More specifically labeli(v) for a vertex v denotes the label of v at the beginning of step i. This formalism identifies a search with the orderings it may produce, as in [8], while extending the formalism of General Label Search (GLS) of [15] by the introduction of a tie-break ordering τ , making the result of a search algorithm purely deterministic (no arbitrary decision is taken). Remarks on this formalism: 1. Notice that during a TBLS search vertices are always labelled from 1 up to n. The original description of LBFS generated labels from n down to 1. Since a label is always 3 Algorithm 1: TBLS(G, ≺, τ ) foreach v ∈ V do label(v) ← ∅ for i ← 1 to n do Eligible ← {x ∈ V x unnumbered and ∄ unnumbered y ∈ V such that label(x) ≺ label(y)}; Let v be the leftmost vertex of Eligible according to the ordering τ ; σ(i) ← v; foreach unnumbered vertex w adjacent to v do label(w) ← label(w) ∪ {i}; an unordered set rather than a string, as often seen with LBFS and LDFS, we avoid having to prepend or append elements to existing labels. It should also be noticed that the TBLS model does not require the graph to be connected, and therefore in the following we will extend classical graph searches to disconnected graphs. Since we just need to specify ≺ to describe a particular search no implementation details have to be discussed in the specification of the search. Finally, by requiring a tie-breaking permutation τ we have a mechanism for choosing a specific vertex from Eligible. Many existing recognition algorithms such as the unit interval recognition algorithm in [5] use a series of LBFS sweeps where ties are broken by choosing the rightmost eligible vertex in the previous LBFS search; to accomplish this in the TBLS formalism τ is set to be the reverse of the previous LBFS ordering. 2. Note that all elements of the set Eligible have a label set which is maximal with respect to some finite partial order, since any finite partial order has at least one maximal element; therefore Eligible cannot be empty. In the context of LBFS the Eligible set is often called a slice. The reader should be aware that we make no claims on the complexity of computing the strict partial order ≺ over the label-set Pf (N+); unfortunately it could be NP-hard. Let us first present an easy characterization property of TBLS search that will be used throughout the paper and which is a direct translation of the algorithm. First we define Nσ(u, v) to be the set of visiting dates of neighbours of u that occur before v in σ; formally Nσ(u, v) = {i σ(i) ∈ N (u) and σ(i) <σ v}. Property 3.1. Let S be a TBLS search with partial order relation ≺S. An ordering σ of the vertices of a graph G is an S-ordering if and only if for every x, y ∈ V , if x <σ y, then Nσ(x, x) 6≺S Nσ(y, x). Proof. The forward direction follows directly from the definition. For the backward direction, assume that for every x, y ∈ V , x <σ y, Nσ(x, x) 6≺S Nσ(y, x) but σ is not an S-ordering. Let γ = TBLS(G, ≺S , σ). Since σ is not an S- ordering, we know that σ 6= γ. Now let i be the first index such that σ−1(i) 6= γ−1(i). 4 Let x = σ−1(i) and y = γ−1(i). Since x <σ y but TBLS(G, ≺S, σ) did not choose x, we know that x did not have a maximal label at step i. Therefore there must exist z such that x <σ z, and labeli(x) ≺S labeli(z). But since labeli(x) = Nσ(x, x) and labeli(z) = Nσ(z, x) we now have a pair of vertices x, z that contradicts the assumption that for all x, y ∈ V , x <σ y, Nσ(x, x) 6≺S Nσ(y, x). With this formalism, in order to specify a particular search we just need to specify ≺, the partial order relation on the label sets for that search. As a consequence we can transmit relationships between partial orders to their associated graph searches. There are two natural ways of saying that a search S is a search S′ (for instance, that LBFS is a BFS): either the ≺ ordering used by S is a refinement of that of S′; or any search ordering σ output by an execution of S could also have been output by an execution of S′. In fact it can easily be shown that both formulations are equivalent, as stated in Theorem 3.5. Definition 3.2. For two TBLS searches S, S′, we say that S′ is an extension of S (denoted by S ≪ S′) if and only if every S′-ordering σ also is an S-ordering. The statement and proof of the next lemma follows the work of [15] where there are similar results for the GLS formalism. Lemma 3.3 (see [15]). For any T BLS S, any integer p ≥ 1 and any sets A and B of P (N+ p ), if A 6≺S B then there exists a graph G and an S-ordering σ such that in the (p − 1)st step the label of the (p − 1)st vertex is A and the label of the pth vertex is B (i.e., labelp−1(σ−1(p − 1)) = A and labelp−1(σ−1(p)) = B). i ≺S B ∩ N+ Proof. Let G = (V, E), with V = {z1, ..., zp} and E = {zizk 1 ≤ k < i ≤ p − 2 and if A ∩ N+ i then k ∈ B else k ∈ A} ∪ {zp−1zkk ∈ A} ∪ {zpzkk ∈ B}. Let σ = (z1, . . . , zp). By the definitions of E and σ, for any integers i, j such that 1 ≤ i ≤ j ≤ p, Nσ(σ−1(j), σ−1(i)) = A ∩ N+ i with Nσ(σ−1(i), σ−1(i)) 6≺S Nσ(σ−1(j), σ−1(i)). By Property 3.1, σ is an S ordering and we have Nσ(σ−1(p−1), σ−1(p− 1)) = A and Nσ(σ−1(p), σ−1(p − 1)) = B. i or Nσ(σ−1(j), σ−1(i) = B ∩ N+ Definition 3.4. For two partial orders ≺P , ≺Q on the same ground set X, we say that ≺P is an extension of ≺Q if ∀x, y ∈ X, x ≺Q y implies x ≺P y. Theorem 3.5. Let S, S′ be two TBLS. S′ is an extension of S if and only if ≺S′ is an extension of ≺S. Proof. For the forward direction, assume for contradiction that S′ is an extension of S but ≺S′ is not an extension of ≺S. Therefore there exists A, B such that A ≺S B and A 6≺S′ B. Now using Lemma 3.3 there exists a graph G and an S′-ordering σ such that 5 labelp−1(σ−1(p − 1)) = A and labelp−1(σ−1(p)) = B. Since A ≺S B using Property 3.1, we deduce that σ is not an S-ordering which contradicts the fact that S′ is an extension of S. Suppose that σ is an S′-ordering. Therefore using Property 3.1 we know that for every x, y ∈ V , x <σ y, we have Nσ(x, x) 6≺S′ Nσ(y, x). Since ≺S′ is an extension of ≺S, we deduce that x, y ∈ V , such that for every x <σ y, we have Nσ(x, x) 6≺S Nσ(y, x). Now using Property 3.1, we deduce that σ is an S-ordering. The choice of permutation τ is useful in some situations described below; otherwise, we consider the orderings output by an arbitrary choice of τ thanks to the following definition: Definition 3.6. Let ≺ be some ordering over Pf (N+). Then σ is a TBLS ordering for G and ≺ if there exists τ such that σ = TBLS(G, ≺, τ ). Before giving some examples of appropriate ≺ for well known searches, let us start with a kind of fixed point theorem and some general features of the TBLS formalism. Theorem 3.7. Let G be a graph; ≺ a search rule; and σ an ordering of the vertices of G. Then there exists τ such that σ = TBLS(G, ≺, τ ) if and only if σ = T BLS(G, ≺, σ). Proof. One direction is obvious. For the other direction, assume that σ = TBLS(G, ≺, τ ) for some τ , and consider σ′ = TBLS(G, ≺, σ). Assume, by contradiction, that σ 6= σ′, and consider i, the index of the first difference between σ and σ′. Let Eligibleσ i be the set of eligible vertices at step i of the algorithm that generated σ, and let Eligibleσ′ i be the set of eligible vertices at step i of the algorithm that generated σ′. Since σ and σ′ are equal until index i, Eligibleσ i . By the definition of TBLS, σ(i) is the first vertex of Eligibleσ i according to τ . Finally, since the first vertex of this set, according to σ, is σ(i), the tie-break rule chose it and so σ(i) = σ′(i), a contradiction. i = Eligibleσ′ This easy result (which is a direct consequence of our model equipped with a built-in tie-break process) is in fact a very powerful theoretical tool to show that some ordering is not a TBLS ordering, and we will use it several times in the proofs in the next sections, as for example in Theorem 4.2. As a first conclusion, the TBLS model is a pure mathematical abstraction of graph search algorithms via partial orders but with no data structures involved. Moreover, if we have a characterization of the total orderings produced by a given TBLS (as for example the usual search characterizations of section 4) then we can get rid of the implementation itself which can be parallel or sequential. In the next sections we will exhibit some easy consequences of this model. But before, we demonstrate its expressive power, in particular to deal with multi-sweep algorithms (i.e., algorithms written as a series of successive graph searches). To this aim, let us consider the sequence {σi}i∈N of total orderings of the vertices, satisfying the following recursive equations: 6 (i) σ0 is an arbitrary total ordering of the vertices (ii) σi = TBLS(G, ≺, σr i−1) where σr denotes the reverse ordering of σ. It was proven when ≺ is the partial order associated to the LBFS search, as described in the next section: (i) in [5], that if G is a unit interval graph then σ3 is a unit interval ordering1. (ii) in [11] that if G is a cocomparability graph then σV is a cocomp ordering2. 4 Characterizing classical searches using TBLS In this section we show how various classical searches (see [8] for the definitions of these various searches) may be expressed in the TBLS formalism. In each case we will state an appropriate ≺ order and where applicable, we will establish various characterizations of the search including the "pattern-condition" presented in [8]. In many cases we will exhibit new vertex ordering characterizations. Definition 4.1. For every vertex x, let ln(x) be the leftmost (in σ) left neighbour of x, and let rn(x) be the rightmost (in σ) right neighbour of x. In both cases, if x has no left (respectively right) neighbour, then ln(x) (respectively rn(x))=−1. 4.1 Generic Search A Generic Search as described by Tarjan [22] is any search that wherever possible visits neighbours of already visited vertices (this corresponds to the usual notion of graph search). We now give an alternative proof based on our formalism of the characterization of a generic search ordering, called a GEN-ordering throughout the rest of the paper. Theorem 4.2 (see [8]). We define A ≺gen B if and only if A = ∅ and B 6= ∅ and let σ be a permutation of V . The following conditions are equivalent: 1. Vertex ordering σ is a GEN-ordering of V (i.e., a TBLS using ≺gen). 2. For every triple of vertices a, b, c such that a <σ b <σ c, and a ∈ N (c) − N (b) there exists d ∈ N (b) such that d <σ b. 3. For every x ∈ V , for every y ∈ V such that x <σ y <σ rn(x), we have ln(y) 6= −1. Proof. Suppose that σ is a GEN-ordering. Using Property 3.1 on σ, we know that: σ is a GEN-ordering ⇐⇒ for every x, y ∈ V such that x <σ y, we have Nσ(x, x) 6≺gen Nσ(y, x) 1an ordering τ of V such that for all x <τ y <τ z with xz ∈ E, we have xy, yz ∈ E. 2an ordering τ of V such that for all x <τ y <τ z with xz ∈ E, we have at least one of xy, yz ∈ E. 7 ⇐⇒ for every x, y ∈ V such that x <σ y, we have Nσ(y, x) = ∅ or Nσ(x, x) 6= ∅ ⇐⇒ for every x, y ∈ V such that x <σ y, we have Nσ(y, x) 6= ∅ ⇒ Nσ(x, x) 6= ∅ ⇐⇒ for every triple of vertices a, b, c such that a <σ b <σ c, a ∈ N (c) − N (b), there exists d ∈ N (b) such that d <σ b. Therefore we proved the equivalence between 1 and 2. Let us consider 3, which is a reformulation of 2. The fact that 1 ⇒ 3, is obvious. To prove the converse, we can use Theorem 3.7. Suppose that there exists σ satisfying 3 but not 1. Let σ′ = TBLS(G, ≺gen , σ) 6= σ and i be the leftmost index where they differ (z = σ′(i) 6= y = σ(i)). This means that li(y) = ∅ and there exists some x ∈ li(z). But this implies with condition 3 since x <σ y <σ z ≤σ rn(x) that ln(y) 6= −1 contradicting li(y) = ∅. Remark 4.3. Theorem 3.7 can be used also in the following proofs of this section, but we omit them to avoid tedious reading. 4.2 BFS (Breadth-First Search) We now focus on BFS. Here, we will follow the definition of BFS given in [8], that is a graph search in which the vertices that are eligible are managed with a queue. Note that this differs for example from the definition given in [3], where BFS stands for what we call layered search. Our notion of BFS is the most common implementation of a layered search. Theorem 4.4. We define A ≺BF S B if and only if umin(A) > umin(B). Let σ be a permutation of V . The following conditions are equivalent: 1. Vertex ordering σ is a BFS-ordering (i.e., a TBLS using ≺BF S). 2. For every triple a, b, c ∈ V such that a <σ b <σ c, a ∈ N (c) − N (b), there exists d such that d ∈ N (b) and d <σ a. 3. For every triple a, b, c ∈ V such that a <σ b <σ c and a is the leftmost vertex of N (b) ∪ N (c) in σ, we have a ∈ N (b). Proof. The equivalence between condition (1) and condition (2) has been proved in [8]. We now prove that condition (1) is equivalent to condition (3). Suppose that σ is a BFS- ordering. Using Property 3.1 on σ, we know that: σ is a BFS-ordering ⇐⇒ for every x, y ∈ V , x <σ y, Nσ(x, x) 6≺BF S Nσ(y, x) ⇐⇒ for every x, y ∈ V , x <σ y, umin(Nσ(x, x)) 6> umin(Nσ(y, x)) ⇐⇒ for every x, y ∈ V , x <σ y, umin(Nσ(x, x)) ≤ umin(Nσ(y, x)) ⇐⇒ for every triple of vertices a, b, c such that a <σ b <σ c, and a is the leftmost vertex of N (b) ∪ N (c), we have a ∈ N (b). 8 4.3 DFS (Depth First Search) We now turn our attention to Depth First Search. Theorem 4.5. We define A ≺DF S B if and only if umax(A) < umax(B). Let σ be a permutation of V . The following conditions are equivalent: 1. Vertex ordering σ is a DFS-ordering (i.e., a TBLS using ≺DF S). 2. For every triple of vertices a, b, c such that a <σ b <σ c, a ∈ N (c) − N (b) there exists d ∈ N (b) such that a <σ d <σ b. 3. For every triple of vertices a, b, c such that a <σ b <σ c, and a is the rightmost vertex of N (b) ∪ N (c) to the left of b in σ, we have a ∈ N (b). Proof. The equivalence between condition (1) and (2) has been proved in [8]. Let us show the equivalence between (1) and (3). Suppose that σ is a DFS-ordering. Using Property 3.1 on σ, we know that: σ is a DFS-ordering ⇐⇒ for every x, y ∈ V such that x <σ y, we have Nσ(x, x) 6≺DF S Nσ(y, x) ⇐⇒ for every x, y ∈ V such that x <σ y, we have umax(Nσ(x, x)) 6< umax(Nσ(y, x)) ⇐⇒ for every x, y ∈ V such that x <σ y, we have umax(Nσ(y, x)) ≤ umax(Nσ(x, x)) ⇐⇒ for every triple of vertices a, b, c such that a <σ b <σ c and a is the rightmost vertex of N (b) ∪ N (c) to the left of b in σ, we have a ∈ N (b). 4.4 LBFS (Lexicographic Breadth First Search) LBFS was first introduced in [19] to recognize chordal graphs. Since then many new applications of LBFS have been presented ranging from recognizing various families of graphs to finding vertices with high eccentricity or to finding the modular decomposition of a given graph, see [13, 4, 9, 24]. Theorem 4.6. We define A ≺LBF S B if and only if umin(B − A) < umin(A − B). Let σ be a permutation of V . The following conditions are equivalent: 1. Vertex ordering σ is a LBFS-ordering (i.e., a TBLS using ≺LBF S) 2. For every triple a, b, c ∈ V such that a <σ b <σ c, a ∈ N (c) − N (b), there exists d <σ a, d ∈ N (b) − N (c). 3. For every triple a, b, c ∈ V such that a <σ b <σ c and a is the leftmost vertex of N (b) △ N (c) to the left of b in σ, then a ∈ N (b) − N (c). 9 Proof. The equivalence between (1) and (2) is well known, see [19, 12, 2]. We now prove the equivalence between (1) and (3). Suppose that σ is a LBFS-ordering. Using Property 3.1 on σ, we know that: σ is a LBFS-ordering ⇐⇒ for every x, y ∈ V , x <σ y, we have Nσ(x, x) 6≺LBF S Nσ(y, x) ⇐⇒ for every x, y ∈ V , x <σ y, we have umin(Nσ(y, x) − Nσ(x, x)) 6< umin(Nσ(x, x) − Nσ(y, x)) ⇐⇒ for every x, y ∈ V , x <σ y, we have umin(Nσ(x, x) − Nσ(y, x)) ≤ umin(Nσ(y, x) − Nσ(x, x)) ⇐⇒ for every triple of vertices a, b, c such that a <σ b <σ c and a is the leftmost vertex of N (b) △ N (c) to the left of b in σ, we have a ∈ N (b) − N (c). 4.5 LDFS (Lexicographic Depth First Search) Lexicographic Depth First Search (LDFS) was introduced in [8]. Theorem 4.7. We define A ≺LDF S B if and only if umax(A − B) < umax(B − A). Let σ be a permutation of V . The following conditions are equivalent: 1. Vertex ordering σ is a LDFS-ordering (i.e., a TBLS using ≺LDF S) 2. For every triple a, b, c ∈ V such that a <σ b <σ c, a ∈ N (c) − N (b), there exists a <σ d <σ b, d ∈ N (b) − N (c). 3. For every triple a, b, c ∈ V such that a <σ b <σ c and a is the rightmost vertex in N (b) △ N (c) to the left of b in σ, a ∈ N (b) − N (c). Proof. The equivalence between (1) and (2) is well known, see [8]. We now prove the equivalence between (1) and (3). Suppose that σ is a LDFS-ordering. Using Property 3.1 on σ, we know that: σ is a LDFS-ordering ⇐⇒ for every x, y ∈ V such that x <σ y, we have Nσ(x, x) 6≺LDF S Nσ(y, x) ⇐⇒ for every x, y ∈ V such that x <σ y, we have umax(Nσ(x, x) − Nσ(y, x)) 6< umax(Nσ(y, x) − Nσ(x, x)) ⇐⇒ for every x, y ∈ V such that x <σ y, we have umax(Nσ(y, x) − Nσ(x, x)) ≤ umax(Nσ(x, x) − Nσ(y, x)) ⇐⇒ for every triple of vertices a, b, c such that a <σ b <σ c and a is the rightmost vertex of N (b) △ N (c) to the left of b in σ, we have a ∈ N (b) − N (c). The symmetry between BFS and DFS (respectively LBFS and LDFS) becomes clear when using the TBLS ordering formalism. This symmetry was also clear using the pattern- conditions as introduced in [8], and in fact lead to the discovery of LDFS. 10 To finish with classical searches, we notice that Maximum Cardinality Search (MCS) as introduced in [23], can easily be defined using the partial order: A ≺M CS B if and only if A < B. Similarly MNS (Maximal Neighbourhood Search) as intro- duced in [21] for chordal graph recognition, is a search such that A ≺M N S B if and only if A ( B, i.e., it uses the strict inclusion partial order between subsets. To conclude this section we use Theorem 3.5 to easily rediscover the relationships amongst various graph searches as noted in [8] and [15]. Theorem 4.8. The partial order of the relation extension between classical searches is described in Figure 1. Proof. To show that a search extends another one we will use Theorem 3.5. Let us show that ≺BF S (respectively ≺DF S, ≺M N S) is an extension of ≺gen. Let A ≺gen B. By definition we have A = ∅ and B 6= ∅. As a consequence we have umin(B) < umin(A) and thus A ≺BF S B (respectively umax(A) < umax(B) implying A ≺DF S B, and A ( B implying A ≺M N S B). We now show that ≺LBF S is an extension of ≺BF S. Let A ≺BF S B. By definition, we have umin(B) < umin(A). As a consequence, umin(B − A) < umin(A − B), implying A ≺LBF S B. To see that ≺LDF S is an extension of ≺DF S, first suppose that A ≺DF S B. Therefore umax(A) < umax(B) and as a consequence umax(A−B) < umax(B−A) thereby implying A ≺LDF S B. Similarly ≺LBF S (respectively ≺LDF S, ≺M CS) is an extension of ≺M N S. Let A ≺M N S B; by definition we have A ( B. As a consequence, umin(B − A) < umin(A − B) (respectively umax(A − B) < umax(B − A) and A < B). So A ≺LBF S B (respectively A ≺LDF S B and A ≺M CS B). LBFS MCS LDFS BFS MNS DFS Generic Search Figure 1: Summary of the hereditary relationships proved in Theorem 4.8. An arc from Search S to Search S′ means that S′ extends S. 11 4.6 Limitations of the TBLS model To finish, let us remark that there exists at least one known search that does not fit into the TBLS model. In the following, recall that labeli(v) for a vertex v denotes the label of v at the beginning of step i of Algorithm 1. Layered Search starts at a vertex s, and ensures that if dist(s, x) < dist(s, y) then σ(x) < σ(y). In other words it respects the layers (vertices at the same distance from the start vertex s). We now show that this search is not a TBLS by considering the graph G in Figure 2. Assume that we have started the Layered Search with x1, x2, x3, x4 and so label5(x5) = {3} and label5(x6) = {4}. In a Layered Search, both x5 and x6 must be eligible at step 5. Thus we must have neither {3} ≺ {4} nor {4} ≺ {3}; they are incomparable labels. But now consider graph H in Figure 2 and assume that again we have started the search with v1, v2, v3, v4. So we have label5(v5) = {3} and label5(v6) = {4}. But in this graph we have to visit v5 before v6. Therefore we must have {3} ≺ {4}. As a conclusion, no partial ordering of the labels can capture all Layered Search orderings and so this search cannot be written in our formalism. The same seems true for Min-LexBFS as defined in [17] and Right Most Neighbour as used in [6]. x1 • x6• x5• x4• x3• x2• v1 • v6• v2• v3• v4• v5• Figure 2: Graph G on the left and H on the right. 5 The relationship between GLS and TBLS We are now interested in determining the relationship between TBLS and GLS. First let us recall GLS from [15]. It depends on a labeling structure which consists of four elements: • a set of labels L; • a strict order ≺GLS over the label-set L; • an initial label l0; • an UPLAB function L × N+ → L. The GLS algorithm then takes as input a graph G = (V, E) (over which the search is performed) as well as a labeling structure. The computational power of the UPLAB function is unbounded, even though it must be deterministic, and the label set L may be any set. In contrast, TBLS uses a fixed initial 12 label ∅, a fixed label set Pf (N+), and a fixed simple updating function. Despite these restrictions, it is, however equivalent to GLS in the sense of Theorem 5.3. Algorithm 2: GLS(G, {L, ≺GLS , l0, U P LAB}) foreach v ∈ V do l(v) ← l0 for i ← 1 to n do Let Eligible be the set of eligible vertices, i.e., those unnumbered vertices v with l(v) maximal with respect to ≺GLS; Let v be some vertex from Eligible; σ(i) ← v; foreach unnumbered vertex w adjacent to v do l(w) ← U P LAB(l(w), i); We now prove that for each GLS, there is a ≺T BLS producing the same orderings, and conversely. First we need some notation. At each iteration i of TBLS(G, ≺T BLS , σ), let lT BLS,i(v) be the label assigned to every unnumbered vertex v by TBLS(G, ≺T BLS , σ), i.e., the label that will be used to choose the ith vertex. Similarly, let lGLS,i(v) be the label assigned to every unnumbered vertex v by GLS(G, {L, ≺GLS , l0, U P LAB}), i.e., the label that will be used to choose the ith vertex. Given a graph G = (V, E), and an ordering σ of V , let us define I σ k (v) = N (v) ∩ {σ(1), . . . σ(k)} to be the neighbours of v visited at step k or before. Let us define pj k to be the j-th element of I σ k (v) sorted in increasing visiting ordering. Proposition 5.1 ([15]). Let S be a labeling structure, G = (V, E) a graph. At iteration i of GLS(G, S) computing an ordering σ, for every unnumbered vertex v: lGLS,i(v) = U P LAB(. . . U P LAB(lo, p1), . . . , pk) where (p1, . . . , pk) is the sequences of num- bers in Nσ(v, σ−1(i)) in increasing order. Proposition 5.2. Let G = (V, E) be a graph, v ∈ V , and σ the ordering produced by TBLS(G, ≺, τ ). At iteration i of TBLS(G, ≺, τ ), for every unnumbered vertex v: lT BLS,i(v) = I σ i−1(v). Proof. The proof goes by induction. At the first step of the algorithm, every vertex has ∅ as its label, and has no previously visited neighbour. Assume that at iteration i, every unnumbered vertex x has label lT BLS,i(x) = I σ i−1(x). After this iteration, for every unnumbered neighbour v of σ(i), lT BLS,i(v) = lT BLS,i−1(v) ∪ {i}, which is indeed I σ neighbour v of σ(i), lT BLS,i(v) = lT BLS,i−1(v), which is again I σ i (v). i (v), and for every unnumbered non- Theorem 5.3. A set T of orderings of the vertices of a graph G is equal to {T BLS(G, ≺T BLS , τ ) τ ∈ Sn} if and only if there exists a labeling structure S = (L, ≺GLS, l0, U P LAB) such that T is equal to the set of orderings produced by GLS(G, S). 13 Proof. First, consider an ordering ≺T BLS. The set {TBLS(G, ≺T BLS , τ ) τ ∈ Sn} is equal to the set of all orderings produced by GLS(G, S) with S = (P (N+), ≺T BLS , ∅, cons), where cons(l(w), i) returns l(w) ∪ {i}. Conversely, consider S = (L, ≺GLS, l0, U P LAB) a labeling structure. We show that there exists an order ≺T BLS such that, for every graph G, the set of all orderings produced by GLS(G, S) is equal to {T BLS(G, ≺T BLS , τ ) τ ∈ Sn}. By propositions 5.1 and 5.2 we can define a mapping φ from P (N+) (the labels used by TBLS) into labels effectively used by GLS (i.e., those that can be assigned to a vertex during some execution of the algorithm). φ is recursively defined as φ(∅) = l0, and if max(A) = i, then φ(A) = UPLAB(φ(A)\{i}, i). Notice the same GLS-label l may be reached in different ways. Subset φ−1(l) ⊂ P (N+) is the set of TBLS-labels that correspond to that label. It is empty for all labels not effectively used. Then, we define ≺T BLS as follows: ∀A, A′ ∈ Pf (N+), A ≺T BLS A′ if and only if φ(A) ≺GBLS φ(A′). We are now ready to prove the theorem. The proof goes by induction. Before the first iteration, for every vertex v, l0 T BLS(v) = ∅. GLS can pick any of these vertices, in particular the one that would be picked by T BLS(G, ≺T BLS, τ ), and by setting τ to be equal to a given output of GLS(G, S), TBLS would indeed chose the same vertex. GLS(v) = l0 and l0 Now, assume that when step i begins, both algorithms have produced the ordering σ(1) . . . σ(i−1), and the ith vertex is about to be chosen. By propositions 5.1 and 5.2, for ev- i−1(x), and lGLS,i(x) = U P LAB(. . . U P LAB(lo, p1 ery unnumbered vertex x, lT BLS,i(x) = I σ By the definition of φ, we have that lGLS,i(x) = φ(lT BLS,i(x)), and lT BLS,i(x) ∈ φ−1(lGLS,i(x)). Then, by the definition of ≺T BLS, for two unnumbered vertices v and w, we know that lT BLS,i(v) ≺T BLS lT BLS,i(w) if and only if φ(lT BLS,i(v)) ≺GLS φ(lT BLS,i(w)), and lGLS,i(v) ≺GLS lGLS,i(w) if and only if for all lv ∈ φ−1(lGLS,i(v)) and all lw ∈ φ−1(lGLS,i(w)), lv ≺T BLS lw. Thus, the set of eligible vertices at step i is the same for both algorithms. GLS can pick any of these vertices, in particular the one that would be picked by TBLS(G, ≺T BLS , τ ), and by setting τ to be equal to GLS(G, S), TBLS would indeed choose the right vertex. i−1) . . . , p k (x) I σ i−1 ). Although TBLS and GLS cover the same set of vertex orderings, we think that our TBLS formalism provides a simpler framework to analyze graph search algorithms, as can be seen in the next section. 6 Recognition of some TBLS search orderings Let us now consider the following problem: Recognition of Search S Data: Given a total ordering σ of the vertices of a graph G and a TBLS search S, Result: Does there exist τ such that σ = TBLS(G, ≺S , τ )? 14 Of course we can use Theorem 3.7 and build an algorithm that tests whether or not σ = TBLS(G, ≺S , σ). Let τ = TBLS(G, ≺S , σ). If τ = σ then the answer is yes; otherwise it is no. We can certify the no answer using the first difference between τ and σ. Let i be the first index such that σ(i) 6= τ (i). If TBLS chooses τ (i) and not σ(i) at step i, then at this time l(σ(i)) ≺S l(τ (i)). So we can build a contradiction to the pattern-condition of this search. But we may want to be able to answer this question without applying a TBLS search, or modifying a TBLS algorithm. For example suppose that a distributed or parallel algorithm has been used to compute the ordering (for example when dealing with a huge graph [1]) that is assumed to be a specific search ordering; how does one efficiently answer this question? Let us study some cases. 6.1 Generic Search For Generic Search consider Algorithm 3 where σ is the ordering we want to check, and for all i between 1 and n, ln(σ(i)) has been computed; note that G may be disconnected. Recall that ln(x) is the leftmost left neighbour of x; if x has no left neighbours, then ln(x) = −1. The algorithm will output either "YES" or "NO" depending on whether or not σ is a GEN-ordering. Algorithm 3: GEN-check J ← 1; % { If σ is a GEN-ordering, then J is the index of the first vertex of the current connected component.}% for i ← 2 to n do if ln(σ(i)) = −1 then J ← i else if ln(σ(i)) < J then return "NO" return "YES" Theorem 6.1. The GEN-check algorithm is correct and requires O(n) time. The recogni- tion of a GEN-ordering can be implemented to run in O(n + m) time. Proof. If the algorithm reports that σ is not a GEN-ordering, then vertices σ(ln(i)),σ(J), σ(i) form a forbidden triple as stipulated in Condition 2 of Theorem 4.2. Note that σ(J) has no neighbours to its left in σ. Now assume that the algorithm reports that σ is a GEN-ordering but for sake of contradiction there exists a forbidden triple on vertices a <σ b <σ c. Let J be the rightmost J index less than σ−1(c) identified by the algorithm; note that b ≤σ σ(J) <σ c and 15 σ(ln(c)) ≤σ a. When i = σ−1(c) the algorithm would have reported that σ is not a GEN-ordering. For the preprocessing we need to compute the values of ln(x) for every vertex x, fol- lowing Definition 4.1. By sorting the adjacency lists with respect to σ (in linear time), it is possible to find ln(x) in linear time by scanning the adjacency lists once and storing ln(x) in an array. Given this information, Algorithm 3 runs in O(n) time. Including the preprocessing time, the whole complexity needed is O(n + m). 6.2 BFS In order to handle the recognition of BFS-orderings and DFS-orderings, we will first prove variations of the conditions proposed in Theorems 4.4 and 4.5, which are easier to check. Let us define for every vertex x in V, the following two intervals in σ: Right(x) = [x, rn(x)] and Lef t(x) = [ln(x), x]. By convention, if rn(x) = −1 or ln(x) = −1 the corresponding interval is reduced to [x]. Theorem 6.2. Vertex ordering σ is a BFS-ordering of V if and only if 1. Vertex ordering σ is a GEN-ordering of G 2. For every pair of vertices x, y, if x <σ y then ln(x) ≤σ ln(y) 3. For every pair of vertices x, y, if x 6= y then the intervals Lef t(x) and Lef t(y) cannot be strictly included 3. Proof. It is easy to show that Conditions 2 and 3 are equivalent. ⇒ First, notice that every BFS-ordering σ is also a GEN-ordering. Now assume for contradiction that Condition 3 is contradicted, namely that x <σ y and that Lef t(y) ln(y) <σ ln(x) ≤σ x <σ y. strictly contains Lef t(x). Then we have the configuration: Considering the triple (ln(y), x, y), since ln(y) <σ ln(x), necessarily xln(y) /∈ E. Using the BFS 4-points condition on this triple there exists z such that z <σ ln(y) where xz ∈ E, thereby contradicting ln(y) <σ ln(x). ⇐ Assume that σ respects all three conditions of the theorem. Consider a triple (a, b, c) of vertices such that: a <σ b <σ c with ac ∈ E and ab /∈ E. Since σ is a GEN-ordering, ac ∈ E implies that ln(b) 6= −1 (i.e., b has a left neighbour in σ). Suppose ln(b) >σ a. Since ln(c) ≤σ a, this implies that Lef t(c) strictly contains Lef t(b), thereby contradicting Condition 3. Therefore b has a neighbour before a in σ. So σ follows the BFS 4-points condition and is a legitimate BFS-ordering. To determine whether a given vertex ordering σ is a BFS-ordering we first use Algorithm 3 to ensure that σ is a GEN-ordering. We then use Algorithm 4 to determine whether or 3One is included in the other and the two left extremities are different, as are the two right extremities. 16 not Condition 3 of Theorem 6.2 is satisfied and thus whether or not σ is a BFS-ordering. As with Algorithm 4, we assume that ln(σ(i)) has been computed for all i between 1 and n. Algorithm 4: BFS-check min ← n; %{min will store the index of the current leftmost value of ln(σ(j)) for all i ≤ j ≤ n.}% for i← n downto 1 do if ln(σ(i)) > min then return "NO" if ln(σ(i)) 6= −1 then min ← ln(σ(i)); return "YES" Theorem 6.3. Given a GEN-ordering σ, the BFS-check algorithm correctly determines whether σ is a BFS-ordering in O(n) time. The recognition of a BFS-ordering can be done in O(n + m) time. Proof. If the algorithm reports that σ is not a BFS-ordering, then consider the triple of vertices σ(min), σ(i), σ(k), where k is the value of i when min was determined. Note that σ(i) is not adjacent to σ(min) or to any vertices to the left of σ(min) and thus this triple forms a forbidden triple as stipulated in Condition 2 of Theorem 4.4. Now assume that the algorithm reports that σ is a BFS-ordering but for sake of con- tradiction there exists a forbidden triple on vertices a <σ b <σ c. We let a′ = σ(ln(c)) and note that since b has no neighbours to the left of or equal to a, b is not adjacent to a′ or to any vertices to its left. Thus when i = σ−1(c) the algorithm would have reported that σ is not a BFS-ordering. The complexity argument is the same as in the proof of Theorem 6.1. Concerning this particular result on BFS, when the graph is connected it provides as a corollary a linear time algorithm to certify a shortest path between the vertices σ(1) and σ(n). So in the spirit of [16], this can be used for certifying BFS-based diameter algorithms (see [1, 10]). 6.3 DFS We now consider DFS and define Lmax(x) for every vertex x ∈ V to be the rightmost left neighbour of x in σ; if x has no left neighbours then by convention Lmax(x) = −1. The interval RLef t(x) is defined to be [Lmax(x), x]; again by convention, if Lmax(x) = −1 RLef t(x) is reduced to [x]. 17 Theorem 6.4. Let G = (V, E) be a graph, and let σ be an ordering of V . Vertex ordering σ is a DFS-ordering of G if and only if 1. σ is a GEN-ordering of G 2. no two intervals Right(x) and RLef t(y), with x 6= y, strictly overlap as intervals. Proof. ⇒ First, notice that every DFS-ordering is also a GEN-ordering. Then, assume, for contradiction, that σ is a DFS-ordering of G, but that in σ Right(x) and RLef t(y) overlap for some x 6= y. Necessarily x <σ y and Lmax(y) <σ x <σ y <σ rn(x). Lmax(y) <σ x implies xy /∈ E(G). But then the triple (x, y, rn(x)) violates the 4-points condition of σ, since y has no neighbour between x and y in σ. ⇐ Assume that σ respects both conditions of the theorem but σ is not a DFS-ordering. Consider a triple (a, b, c) of vertices such that: a <σ b <σ c with ac ∈ E and ab /∈ E but there is no neighbour of b between a and b in σ. Since σ is supposed to be a GEN-ordering, ac ∈ E implies that b has a neighbour d left to it in σ, which by the above argument, must be before a. Thus Lmax(b) <σ a and therefore the intervals RLef t(b), Right(a) strictly overlap, a contradiction. Corollary 6.5. DFS-orderings can be recognized in O(n + m). Proof. Verifying that σ is a generic-ordering can be done in O(n + m) time using Theorem 6.1. To check the second condition, it suffices to build the family of 2n intervals and apply a simple 2 states stack automaton [14] to check the overlapping in O(n) time. 6.4 LBFS and LDFS Theorem 6.6. LBFS and LDFS-orderings can be recognized in O(n(n + m)) time. Proof. To build the recognition algorithm we use the third condition of the relevant the- orems in Section 4, in particular 4.6 (LBFS) and 4.7 (LDFS). Both of these conditions are pattern-conditions. The certificate is stored in a table whose entries are keyed by the pair (b, c) where b <σ c and the information will either be the vertex a, where a <σ b that satisfies the corresponding condition or an error message indicating that the condition has been violated. For LBFS and LDFS, the pattern-condition examines a, the leftmost (LBFS) or the rightmost (LDFS) vertex of N (b) △ N (c) and requires that a ∈ N (b) − N (c). It is easy to show that this can be accomplished in time O(N (b) + N (c), for any b and c. In all cases, if a satisfies the membership condition then it is stored in the (b, c)'th entry of the table; otherwise "error" is stored. Regarding complexity considerations, the table uses O(n2) space complexity. For the lexicographic searches, the timing requirement is bounded by Pb∈V Pc∈V (N (b) + N (c)) 18 to build the table and O(n2) time to search for an "error" entry, giving an O(n(n + m)) time complexity. These results for LBFS and LDFS do not seem to be optimal, but at least they yield a certificate in case of failure. To improve these algorithms we need to find some new characterizations of LBFS- and LDFS-orderings. 7 Implementation issues We now consider how to compute an TBLS search, in the case where ≺ is a total order. In such a case, at each step of the search, the labels yield a total preorder on the vertices. Such a total preorder (also called weak-order using ordered sets terminology) can be efficiently represented using ordered partitions as can beset in the next result. Theorem 7.1. T BLS(G, ≺, τ ) where ≺ is a total order can be implemented to run in O(n + mT (n) log n) time where the ≺ comparison time between two labels is bounded by O(T (n)). Proof. We use the framework of partition refinement [13]. First we sort the adjacency lists with respect to τ , and consider the following algorithm. The input to the algorithm is a graph G = (V, E), a total order ≺ on Pf (N+), and an ordering τ of V and the output is the TBLS(G, ≺, τ )-ordering σ of V . Algorithm 5: Computing a TBLS ordering Let P be the partition {V }, where the only part (i.e., V ) is ordered with respect to τ ; for i ← 1 to n do Let Eligible be the part of P with the largest label with respect to ≺ and; let x be its first vertex; replace Eligible by Eligible − {x} in P ; σ(i) ← x; Refine(P, N (x)); The algorithm maintains an (unordered) partition P of the unnumbered vertices. Each part of P is an ordered list of vertices. The following two invariants hold throughout the execution of the algorithm: 1. The vertices of each part have the same unique (with respect to parts) label; 2. Inside a part, the vertices are sorted with respect to τ . The action of Refine(P, A) is to replace each part P ∈ P with two new parts: P ∩ A and P − A (ignoring empty new parts). It is possible to maintain the two invariants using the data structure from [13], provided the adjacency lists of G are sorted with respect to 19 τ . After each refinement, each part of P therefore contains vertices that are twins with respect to the visited vertices (Invariant 1). Thanks to the second invariant, the chosen vertex is always the first vertex (with respect to τ ) of part Eligible; i.e., σ(i) is indeed x. For the time complexity, Refine(P, N (x)) takes O(N (x)) time [13], so all refinements take O(n + m) time. The only non-linear step is identifying part Eligible among all parts of the partition. Each part has a label (the one shared with all its vertices) used as a key in a Max-Heap. Refine(P, N (x)) creates at most N (x) new parts so there are at most m insertions into the heap. The label of a part does not change over time (but empty parts must be removed). There are no more removal operations than insertion operations, each consisting of at most log n label comparisons (since there are at most n parts at any time). So we get the O(n + mT (n) log n) time bound. This complexity is not optimal, since it is well-known and already used in some ap- plications (see for example [9]) that classical searches such as BFS, DFS, LBFS can be implemented within the TBLS framework, i.e., solving the tie-break with a given total or- dering τ of the vertices, within the same complexity as their current best implementations. To avoid the T (n) costs and the log n factor, the trick is simply to use an implementation of the search that uses partition refinement (such an implementation exists for BFS, DFS, and LBFS). If we start with a set ordered via τ , there exists a partition refinement imple- mentation that preserves this ordering on each part of the partition, and the tie-break rule means simply choose the first element of the Eligible part. For LDFS, that best known complexity can also be achieved this way. But for Gen-search, MCS and MNS we do not know yet how to achieve linear time, within the TBLS framework. 8 Concluding remarks We have focused our study on a new formalism that captures many usual graph searches as well as the commonly used multi-sweep application of these searches. The TBLS formalism allows us to define a generic TBLS-orderings recognition algorithm, and gives us a new point of view of the hierarchy amongst graph searches. The new pattern-conditions for Generic Search, BFS and DFS give us a better way (compared to the pattern-conditions presented in [8]) of certifying whether a given ordering could have been produced by such a search. Furthermore, for LBFS and LDFS we do not have to trust the implementation of the search (which can be complicated) but have presented a simple program that just visits the neighbourhood of the vertices of the graph and stores a small amount of information (see Theorem 6.6). The size of this extra information, however, can be bigger than the size of the input, and it may take longer to compute than the actual time needed to perform the search itself. 20 The landscape of graph search is quite complex. Graph searches can be clustered using the data structures involved in their best implementations (queue, stack, partition refinement . . . ). In this paper we have tried a more formal way to classify graph searches. This attempt yields an algebraic framework that could be of some interest. Clearly being an extension (see section 3) is a transitive relation. In fact ≪ structures the TBLS graph searches as ∧-semilattice. The 0 search in this semi-lattice, denoted by the null search or Snull, corresponds to the empty ordering relation (no comparable pairs). At every step of Snull the Eligible set contains all unnumbered vertices. Therefore for every τ , TBLS(G, ≺Snull, τ ) = τ and so any total ordering of the vertices can be produced by Snull. The infimum between two searches S, S′ can be defined as follows: For every pair of label sets A, B, we define: A ≺S∧S′ B if and only if A ≺S B and A ≺S′ B. Clearly every extension of S and S′ is an extension of S ∧ S′. Similarly S and S′ are extensions of S ∧ S′. While being as general as GLS, we feel that TBLS is closer to the pattern-conditions presented in [8], since many of the ≺ conditions presented in this paper are a rewriting of their pattern-conditions. Still, there are many variants of the searches we studied that do not fall under the TBLS model, such as layered search. We wonder if a more general search model can be found, that would not only include some of these other common searches but would also retain the simplicity of TBLS. Acknowledgements: The authors thank Dominique Fortin for his careful reading and numerous suggestions to improve the paper. The first author wishes to thank the Natural Sciences and Engineering Research Council of Canada for their financial support. References [1] Paolo Boldi and Sebastiano Vigna. Four degrees of separation, really. In ASONAM, pages 1222 -- 1227, 2012. [2] Andreas Brandstadt, Feodor F. Dragan, and Falk Nicolai. Lexbfs-orderings and powers of chordal graphs. Discrete Mathematics, 171(1-3):27 -- 42, 1997. [3] Thomas H. Cormen, Charles E. Leiserson, and Ronald L. Rivest. Algorithms. The MIT Press and McGraw-Hill Book Company, 1989. Introduction to [4] Derek G. Corneil. Lexicographic breadth first search - a survey. In WG, volume 3353 of Lecture Notes in Computer Science, pages 1 -- 19. Springer, 2004. 21 [5] Derek G. Corneil. A simple 3-sweep LBFS algorithm for the recognition of unit interval graphs. Discrete Applied Mathematics, 138(3):371 -- 379, 2004. [6] Derek G. Corneil, Barnaby Dalton, and Michel Habib. LDFS-based certifying al- gorithm for the minimum path cover problem on cocomparability graphs. SIAM J. Comput., 42(3):792 -- 807, 2013. [7] Derek G. Corneil, J´er´emie Dusart, Michel Habib, and Ekkehard Kohler. On the power of graph searching for cocomparability graphs. in preparation, 2014. [8] Derek G. Corneil and Richard Krueger. A unified view of graph searching. SIAM J. Discrete Math., 22(4):1259 -- 1276, 2008. [9] Derek G. Corneil, Stephan Olariu, and Lorna Stewart. The LBFS structure and recognition of interval graphs. SIAM J. Discrete Math., 23(4):1905 -- 1953, 2009. [10] Pierluigi Crescenzi, Roberto Grossi, Michel Habib, Leonardo Lanzi, and Andrea Marino. On computing the diameter of real-world undirected graphs. Theor. Comput. Sci., 514:84 -- 95, 2013. [11] J´er´emie Dusart and Michel Habib. A new LBFS-based algorithm for cocomparability graph recognition. submitted, 2014. [12] Martin Charles Golumbic. Algorithmic Graph Theory and Perfect Graphs (Annals of Discrete Mathematics, Vol 57). North-Holland Publishing Co., Amsterdam, The Netherlands, The Netherlands, 2004. [13] Michel Habib, Ross M. McConnell, Christophe Paul, and Laurent Viennot. LexBFS and partition refinement, with applications to transitive orientation, interval graph recognition and consecutive ones testing. Theor. Comput. Sci., 234(1-2):59 -- 84, 2000. [14] John E. Hopcroft, Rajeev Motwani, and Jeffrey D. Ullman. Introduction to automata theory, languages, and computation - (2. ed.). Addison-Wesley series in computer science. Addison-Wesley-Longman, 2001. [15] Richard Krueger, Genevi`eve Simonet, and Anne Berry. A general label search to investigate classical graph search algorithms. Discrete Applied Mathematics, 159(2- 3):128 -- 142, 2011. [16] Ross M. McConnell, Kurt Mehlhorn, Stefan Naher, and Pascal Schweitzer. Certifying algorithms. Computer Science Review, 5(2):119 -- 161, 2011. [17] Daniel Meister. Recognition and computation of minimal triangulations for at-free claw-free and co-comparability graphs. Discrete Applied Mathematics, 146(3):193 -- 218, 2005. 22 [18] George B. Mertzios and Derek G. Corneil. A simple polynomial algorithm for the longest path problem on cocomparability graphs. SIAM J. Discrete Math., 26(3):940 -- 963, 2012. [19] Donald J. Rose, Robert Endre Tarjan, and George S. Lueker. Algorithmic aspects of vertex elimination on graphs. SIAM J. Comput., 5(2):266 -- 283, 1976. [20] Micha Sharir. A strong connectivity algorithm and its applications to data flow anal- ysis. Computers and Mathematics with Applications, 7:67 -- 72, 1981. [21] D. R. Shier. Some aspects of perfect elimination orderings in chordal graphs. Discrete Applied Mathematics, 7:325 -- 331, 1984. [22] Robert Tarjan. Depth-first search and linear graph algorithms. SIAM Journal on Computing, 1(2):146 -- 160, 1972. [23] Robert Endre Tarjan and Mihalis Yannakakis. Simple linear-time algorithms to test chordality of graphs, test acyclicity of hypergraphs, and selectively reduce acyclic hypergraphs. SIAM J. Comput., 13(3):566 -- 579, 1984. [24] Marc Tedder. Applications of Lexicographic Breadth First Search to modular decom- position, split decomposition, and circle graphs. PhD thesis, University of Toronto, Toronto, Ontario, Canada, 2011. 23
1304.7456
1
1304
2013-04-28T11:24:40
Counting Hypergraphs in Data Streams
[ "cs.DS", "math.CO" ]
We present the first streaming algorithm for counting an arbitrary hypergraph $H$ of constant size in a massive hypergraph $G$. Our algorithm can handle both edge-insertions and edge-deletions, and is applicable for the distributed setting. Moreover, our approach provides the first family of graph polynomials for the hypergraph counting problem. Because of the close relationship between hypergraphs and set systems, our approach may have applications in studying similar problems.
cs.DS
cs
Counting Hypergraphs in Data Streams He Sun Max Planck Institute for Informatics Saarbrucken, Germany [email protected] Abstract We present the first streaming algorithm for counting an arbitrary hypergraph H of con- stant size in a massive hypergraph G. Our algorithm can handle both edge-insertions and edge-deletions, and is applicable for the distributed setting. Moreover, our approach provides the first family of graph polynomials for the hypergraph counting problem. Because of the close relationship between hypergraphs and set systems, our approach may have applications in studying similar problems. 1 Introduction The problem of counting subgraphs is one of the fundamental questions in algorithm design, and has various applications in analyzing the clustering and transitivity coefficients of networks, uncovering structural information of graphs that model biological systems, and designing graph databases. While the exact counting of subgraphs of constant size is polynomial-time solvable, traditional algorithms need to store the whole graph and compute the solution in an off-line fashion, which is not practical even for graphs of medium size. A modern way to deal with this problem is to design algorithms in the streaming setting, where the edges of the underlying graph come sequentially in an arbitrary order, and algorithms with sub-linear space are required to approximately count the number of occurrences of certain subgraphs. Since the first streaming algorithm by Bar-Yossef et al. [3], this problem has received much attention in recent years [2 -- 4, 6, 7, 11, 12, 14]. We address the subgraph counting problem for hypergraphs. Formally, we are given a sequence of sets s1, s2, . . . in a data stream. These sets, each of which consisting of vertices of the underlying hypergraph G, arrive sequentially and represent edges of a hypergraph G = (V, E). Moreover, every coming edge ei is equipped with a sign ("+" or "−"), indicating that edge ei is inserted to or deleted from the hypergraph G. That is, we study the so-called turnstile model [15] where the underlying graph may change over time. For any hypergraph H of constant size, algorithms with sub-linear space are required to approximate the number of occurrences of H in G. Motivation. Hypergraphs are basic models to characterize precise relations among items of data sets. For the study of databases, people started to use hypergraphs to model database schemes since 1980s [5, 8], and this line of research led to several well-known data storage mechanisms like HyperGraphDB [1]. Besides database theory, a number of studies have shown that simple graphs1, representing pairwise relationships, are usually not sufficient to encode all information when studying social, protein, or biological networks, and suggested to use hypergraphs to model the real relations among the items. For illustrating this point of view, let us look at the coauthor 1For ease of our discussion simple graphs refer to graphs where every edge consists of two vertices. 1 network for example. In a coauthor network, authors are represented as vertices of a graph, and an edge between two authors exists iff these two persons are co-authors. This natural model misses the information on whether a set of three (or more) authors have been co-authored of the same article. Such information loss is undesirable for many applications, e.g., for detecting communities or clusters like all authors that worked in the same research area. Similar problems occur in studying biological, social, and other networks when hypergraphs are required in order to express the complete relation among entities [13, 16]. Our Results & Techniques. We initiate the study of counting subgraphs in the streaming setting, and present the first algorithm for this problem. Although the subgraph counting problem is much more difficult for the case of hypergraphs and streaming algorithms were unknown even for the edge-insertion case prior to our work, our algorithm runs in the general turnstile model, and is applicable in the distributed setting. Formally, for any fixed subgraph H of constant size, our algorithm (1 ± ε)-approximates the number of occurrences of H in G. That is, for any constant ε ∈ (0, 1), the output of our algorithm satisfies Z ∈ [(1 − ε) · #H, (1 + ε) · #H] with probability at least 2/3. The main result of our paper is as follows: ε2 · mk ε2 · mk Theorem 1 (Main Result). Let G be a hypergraph of n vertices and m edges, and H a hypergraph of k edges and minimum degree at least 2. Then there is an algorithm to (1 ± ε)-approximate the number of occurrences of H in G that uses O(cid:16) 1 coming edge is O(cid:16) 1 (#H)2(cid:17). Our algorithm works in the turnstile model. (#H)2 · log n(cid:17) bits of space. The update time per To compare our algorithm with naıve methods, note that a naıve approach for counting #H needs to either sample independently k vertices (if possible) or k edges from the stream. Since the probability of k vertices (or k edges) forming H is #H/nk (or #H/mk), this approach needs space Ω(cid:16) nk log n #H = ω(cid:16)m #H (cid:17) and Ω(cid:16) mk log n the naıve approach. On the other hand, we note that for any graph G of m edges, and hypergraph H of k edges, the number of H in G can be as big as Ω(mk/2). Hence for dense graphs with #H (cid:17), respectively. Thus our algorithm has significant improvement over 2 (cid:17), our algorithm achieves a (1 + ε)-approximation in sublinear space. Our algorithm uses the composition of complex-valued random variables. Besides presenting the first hypergraph counting algorithm in the streaming setting, our approach yields a family of graph polynomials {pH} to count the number of hypergraph H in hypergraph G. That is, for any hypergraph H the polynomial pH takes hypergraph G as an argument, and the value of pH(G) is the number of isomorphic copies of H in G. This is the first family of graph polynomials for the hypergraph counting problem, and the techniques developed here may have applications in studying graph theory or related topics. k−1 Theorem 2. For any hypergraph H, there is a graph polynomial pH(·) such that for any hypergraph G, pH(G) ∈ N ∪ {0} is the number of isomorphic copies of H in G. , . . . , Ze⋆ , and each variable Ze⋆ maintain k variables Ze⋆ coming edge e in graph G, we choose one or more Ze⋆ Our algorithm follows the framework by Kane et al. [12]. For any hypergraph H of k edges, we corresponds to one edge in H. For every to update according to the value of hash is unbiased. However, in contrast to the simple graph case, the algorithm for hypergraphs and the analysis is much more complicated due to the following reasons: functions. We will prove that the returned value of Q16i6k Ze⋆ 1 k i i i 1. In contrast to simple graphs, subgraph isomorphoism between hypergraphs is more difficult to handle, and hence the update procedure for every coming edge is more involved. To 2 overcome this, for every coming edge e of hypergraph G that consists of ℓ edges, we look at ℓ! permutations of {1, . . . , ℓ}, and every such permutation gives e an "orientation". Moreover, simultaneously for the simple graph case, we choose one or more instead of updating every Ze⋆ to update. Through this, we prove that the returned value of our estimator is unbiased Ze⋆ for the number of occurrences of H in G. i i 2. The second difficulty for dealing with hypergraphs comes from analyzing the concentration of the estimator. All previous works on the subgraph counting problem, e.g. [11, 12, 14], indicate that the space requirement of the algorithm depends on the number of other subgraphs in the underlying graph. For instance, the space complexity of the algorithms by [11, 12, 14] is essentially determined by the number of closed walks of certain length in graph G. However, the notion of closed walks in (non-uniform) hypergraphs is not well-defined, and hence we need to use alternative methods to analyze the concentration of the estimator, as well as the space requirement. Because of these differences, our generalization is non-trivial and elegant. Our result (Theorem 1) shows that the regularity of hyperedges in G and H does not influence the actual space complexity of the algorithm, and the time and space complexity of our algorithm is the same as the simple graph case. Notation. Let G = (V, E) be a hypergraph graph. The set of vertices and edges are represented by V [G] and E[G]. We assume that graph G has n vertices, and n is known in advance. Graph G is called a hypergraph if every edge e ∈ E[G] is a non-empty subset of V [G], i.e. E[G] is a subset of the power set of V [G]. For any hypergraph G and vertex u ∈ V [G], the degree of u, expressed by deg(u), is the number of edges that include u. Moreover, the size of edge e ∈ E[G], denoted by size(e), is the number of vertices contained in e. Given two hypergraphs H1 and H2, we say that H1 is homomorphic to H2 if there is a mapping ϕ : V [H1] 7→ V [H2] such that for any set D ⊆ V [H1], D ∈ E[H1] implies {ϕ(u) : u ∈ D} is in E[H2]. We say that H1 is isomorphic to H2 if the above function ϕ is a bijection. For any hypergraph H, the automorphism of H is an isomorphism from V [H] into V [H]. Let auto(H) be the number of automorphisms of H. For any hypergraph H, we call a subgraph H1 of G that is not necessarily induced an occurrence of H, if H1 is isomorphic to H. Let #(H, G) be the number of occurrences of H in G. Let Sℓ be a permutation group of ℓ elements. A kth root of unity is any number of the form e2πi·j/k, where 0 6 j < k. 2 An Unbiased Estimator for Counting Hypergraphs Throughout the rest of the paper we assume that hypergraph G has n vertices and m edges, and hypergraph H has t vertices and k edges. For the notation, we denote vertices of G by u, v and w, and vertices of H are denoted by a, b and c. For every edge e⋆ of H, we give the vertices in e⋆ an −→ e⋆ . For simplicity and with slight abuse of notation arbitrary ordering and call this oriented edge we will use H to express such an oriented hypergraph. At a high level, our estimator maintains k complex variables Z−→ e⋆ , e⋆ ∈ E[H]. These complex variables correspond to k edges of hypergraph H, and are set to zero initially. For every arriving edge e ∈ E[G] with size(e) = ℓ, we update every Z−→ e⋆ with size(e⋆) = size(e) according to Z−→ e⋆ (G) ← Z−→ e⋆ (G) + X(σ(1),...,σ(ℓ))∈Sℓ M−→ e⋆(uσ(1), . . . , uσ(ℓ)), 3 where the summation is over all possible permutations of (1, . . . , ℓ), and M−→ computed in constant time. Hence we can rewrite Z−→ e⋆ as e⋆ : (V [G])ℓ 7→ C can be Z−→ e⋆ (G) = Xe∈E[G] size(e)=size(e⋆) X(σ(1),...,σ(ℓ))∈Sℓ M−→ e⋆ (uσ(1), . . . , uσ(ℓ)). More formally, each M−→ scaling factor and will be determined later. Intuitively M−→ according to a permutation (σ(1), . . . , σ(ℓ)), and map this oriented edge −→e to e⋆ Z−→ e⋆ (uσ(1), . . . , uσ(ℓ)) expresses the event to give edge e = {u1, . . . , uℓ} in G an orientation −→ e⋆ . When the number e⋆ , where α ∈ R+ is a of subgraph H is asked, the algorithm outputs the real part of α ·Q−→ e⋆ (u1, . . . , uℓ) is defined according to the degree of vertices in graph H and determined by three types of random variables Q, Xc(w) and Y (w), where c ∈ V [H] and w ∈ V [G]: (1) Variable Q is a random τ th root of unity, where τ := 2t − 1. (2) For vertex c ∈ V [H], w ∈ V [G], Xc(w) is random degH(c)th root of unity, and for each vertex c ∈ V [H], Xc : V [G] → C is chosen independently and uniformly at random from a family of (2t · k)-wise independent hash functions, where 2t · k = O(1). Variables Q and Xc (c ∈ V [H]) are chosen independently. (3) For every w ∈ V [G], Y (w) is a random element chosen from S := (cid:8)1, 2, 4, 8, . . . , 2t−1(cid:9) as part of a 4k-wise independent hash function. Variables Y (w) (w ∈ V [G]) and Q are chosen independently. −→ e⋆ = (c1, . . . , cℓ) we define the function M−→ Given these, for every edge e⋆ as M−→ e⋆ (u1, . . . , uℓ) := Y16i6ℓ(cid:18)Xci(ui) · Q Y (ui) degH (ci)(cid:19) . See Estimator 1 for the formal description of the update and query procedures. Estimator 1 Counting #(H, G) Update Procedure: When an edge e = {u1, . . . , uℓ} ∈ E[G] arrives, update each Z−→ e⋆ j w.r.t. with size(e⋆ j ) = ℓ Z−→ e⋆ j (G) ←Z−→ e⋆ j (G) + X(σ(1),...,σ(ℓ))∈Sℓ M−→ e⋆ j (cid:0)uσ(1), . . . , uσ(ℓ)(cid:1) . Query Procedure: When #(H, G) is required, output the real part of where ZH(G) is defined by tt t! · auto(H) · ZH(G) , ZH(G) := Y−→ e⋆∈E[H] Z−→ e⋆ (G) . (1) (2) (3) Before analyzing the algorithm, let us briefly discuss some properties of our algorithm. First, the estimator runs in the turnstile model. For simplicity we only write the update procedure for the edge insertion case. For every coming item that represents an edge-deletion, we replace "+" by "−" in (1). Second, our estimator works in the distributed setting, where there are several distributed sites, and each site receives a stream Si of hyperedges. For such settings every local site 4 does the same for coming edges in the local stream Si . When the number of subgraphs is asked, these sites cooperate to give an approximation of #(H, G) for the underlying graph G formed by Si Si. Third, we can generalize Estimator 1 to the labelled graph case. Namely, there are labels for every vertex (and/or edge) in G and H, and the algorithm can count the number of isomorphic copies of H in G whose labels are the same as H's. 3 Analysis of the Estimator In this section, we first prove that ZH(G) defined by (3) is an unbiased estimator for #(H, G). Then, we analyze the variance of the estimator and the space requirement of our algorithm in order to achieve a (1 ± ε)-approximation. We first explain the intuition behind our estimator. By (1) and (3) we have ZH(G) = Y−→ e⋆∈E[H] Xe∈E[G] size(e)=size( e={u1,...,uℓ} −→ e⋆) X(σ(1),...,σ(ℓ))∈Sℓ M−→ e⋆(cid:0)uσ(1), . . . , uσ(ℓ)(cid:1)   . (4)   e⋆ (G) is a sum over all Since H has k edges, ZH(G) is a product of k terms, and each term Z−→ possible edges e of G with size(e) = size(e⋆) together with all possible orientations of e. Hence, in the expansion of ZH(G), any k-tuple (e1, . . . , ek) ∈ Ek(G) with size(ei) = size(e⋆ i ) contributes Q16i6k (size(ei)!) terms to ZH(G), and each term corresponds to a certain orientation of edges e1, . . . , ek. −→ T = (−→e1, . . . , −→ek ) be an arbitrary orientation of (e1, . . . , ek), and let G−→ Let −→ T . Our algorithm relies on three types of variables to test if G−→ induced by H. These variables play different roles, as described below. T be the graph T is isomorphic to (i) For c ∈ V [H] and w ∈ V [G], T and V−→ we have E(cid:2)X i guarantee that G−→ T is homomorphic to G−→ u ∈ V−→ vertices in V−→ c(w)(cid:3) 6= 0 (1 6 i 6 degH (c)) if and only if i = degH(c). Random variables Xc(w) contributes to E[ZH(G)] only if H is surjectively homomorphic to G−→ T , i.e., H T 6 V [H]. (ii) Through function Y : V [G] → S, every vertex T = S = t, then with constant probability, T cannot T map to different t numbers in S. Otherwise, V−→ T < t and vertices in V−→ T maps to a random element Y (u) in S. If V−→ map to different t elements. Since Q is a random τ th root of unity, E(cid:2)Qi(cid:3) 6= 0 (1 6 i 6 τ ) if and only if i = τ , where τ =Pℓ∈S ℓ. The combination of Q and Y guarantees that G−→ T contributes to T have the same number of vertices. Combining (i) and (ii), only E[ZH(G)] only if graph H and G−→ subgraphs isomorphic to H contribute to E[ZH(G)]. 3.1 Analysis of the First Moment Now we show that ZH(G) defined by (3) is an unbiased estimator. We first list some lemmas that we use in proving the main theorem. Lemma 3 ([10]). Let Xc be a randomly chosen degH (c)th root of unity, where c ∈ V [H]. Then, for any 1 < i 6 degH (c), it holds that E(cid:2)X i Lemma 4 ([12]). Let R be a primitive τ th root of unity and k ∈ N. If τ k, then Pτ −1 otherwise Pτ −1 c(cid:3) = 1 if i = degH(c), and E(cid:2)X i c(cid:3) = 0 otherwise. ℓ=0 (Rk)ℓ = 0. ℓ=0 (Rk)ℓ = τ , 5 Lemma 5 ([12]). Let xi ∈ Z>0 and Pt−1 x0 = · · · = xt−1 = 1. i=0 xi 6 t. Then 2t − 1 Pt−1 i=0 2i · xi if and only if Theorem 6. Let H be a hypergraph with t vertices and k edges e⋆ Xc(w), Y (w) (c ∈ V [H], w ∈ V [G]) and Q are defined as above. Then, 1, . . . , e⋆ k. Assume that variables E[ZH (G)] = t! · auto(H) tt · #(H, G). Proof. Let qi be the size of edge e⋆ i in H. Consider the expansion of ZH(G): ZH(G) = Y−→   = Xe1,...ek∈E[G] e⋆ i ∈E[H] size(e)=size(e⋆) e={u1,...,uℓ} Xe∈E[G] Xσ1,...,σk ∀i:σi∈Sqi Y16i6k ∀i:size(ei)=size(e⋆ i ) ei=(ui,1,...,ui,qi ) X(σ(1),...,σ(ℓ))∈Sℓ M−→ e⋆ i (cid:0)uσ(1), . . . , uσ(ℓ)(cid:1) i (cid:0)ui,σi(1), . . . , ui,σi(qi)(cid:1) . M−→ e⋆   Hence the term corresponding to edges e1, . . . , ek with size(ei) = size(e⋆ tion σ1, . . . , σk of edges e1, . . . , ek is i ) and an arbitrary orienta- Y16i6k M−→ e⋆ i (cid:16)ui,σi(1), . . . , ui,σi(size(e⋆ i ))(cid:17) = Y16i6k Y16j6size(e⋆ i ) Y (wi j) j) , degH(ci (5) Xci j(cid:0)wi j(cid:1) Q where ci j is the jth vertex of edge −→ e⋆ i , and wi j is the jth vertex of edge −→ei . Consider −→ T = (−→e1, . . . , −→ek ) with size(ei) = size(e⋆ i ), where −→ei is determined by ei and an arbitrary orientation. We show that the expectation of (5) is non-zero if and only if the graph induced by −→ T is an occurrence of H in G. Moreover, if the expectation of (5) is non-zero, then its value is a constant. For a vertex c of H and a vertex w of G, let be the number of pairs (i, j) where the jth vertex of in −→ T is w. Since every vertex c of H is incident to degH(c) edges, for any c ∈ V [H], it holds that in H is c, and the jth vertex of −→ei −→ e⋆ i γ−→ T (c, w) :=(cid:12)(cid:12)(cid:8)(i, j) : ci j = c and wi j = w(cid:9)(cid:12)(cid:12) T (c, w) = degH(c). By the definition of γ−→ γ−→ T , we rewrite (5) as Pw∈V−→ T Therefore we can rewrite ZH (G) as T Q γ−→ T (c,w) (c,w)Y (w) γ−→ X T c  · (w)   Yc∈V [H] Yw∈V−→  Yc∈V [H] Yw∈V−→  · (w)   Yc∈V [H] Yw∈V−→  Yc∈V [H] Yw∈V−→ degH (c)   . Xσ1,...,σk γ−→ X T c ∀i:σi∈Sqi (c,w) Q T T T −→ T =(−→e1,...,−→ek) γ−→ T (c,w)Y (w) degH (c)   , Xe1,...ek∈E[G] ∀i:size(ei)=size(e⋆ i ) ei=(ui,1,...,ui,qi ) 6 where the first summation is over all k-tuples of edges in E[G] with size(ei) = size(e⋆ i ), and the second summation is over all possible permutations of vertices of edges e1, . . . , ek. By linear- ity of expectations of these random variables and the assumption that Xc(w) (c ∈ V [H], w ∈ V [G]), Y (w) (w ∈ V [G]) and Q have sufficient independence, we have E[ZH(G)] (c,w)Y (w) degH (c)   . Q γ−→ T w∈V−→ T  · E   Yc∈V [H] degH (c)   } (c,w)Y (w) γ−→ T Q . (6) = Xe1,...ek∈E[G] ∀i:size(ei)=size(e⋆ i ) ei=(ui,1,...,ui,qi ) −→ T , let For any Xσ1,...,σk ∀i:σi∈Sqi −→ T =(−→e1,...,−→ek)   Yc∈V [H] E  Yw∈V−→ T (c,w) γ−→ X T c (w)  α−→ T :=  Yc∈V [H] E  Yw∈V−→ {z A T γ−→ X T c (c,w) (w)    } · E  Yc∈V [H] Yw∈V−→ {z B T We will next show that α−→ T is either zero or a nonzero constant independent of case only if GT , the undirected hypergraph induced from edge set H. −→ T . The latter is the −→ T , is isomorphic to hypergraph , γ−→ T (c, w) 6 degH (c), and (ii) for any c ∈ V [H], w ∈ V−→ T we construct a homomorphism from H to G−→ T for any c ∈ V [H] and w ∈ V−→ T c(w)(cid:3) 6= 0 if and only if i = degH(c) or i = 0. Therefore, for any fixed First, we consider the product A. Assume A 6= 0. Using the same technique as [12, 14], under the condition A 6= 0. Remember that: (i) and −→ T T (c, w) ∈ {0, degH(c)} for all w. Now, T (c, w) ∈ {0, degH(c)} for T (c, w) = degH(c) for any c ∈ V [H], there exists for T : V [H] → V−→ T T is a homomorphism, T ]. Hence, A 6= 0 implies H is 0 6 i 6 degH(c), E(cid:2)X i and c ∈ V [H], EhQw∈V−→ assume that EhQw∈V−→ all c ∈ V [H], and w ∈ V [G]. Since Pw γ−→ (w)i 6= 0 if and only if γ−→ (w)i 6= 0 for every c ∈ V [H]. Then, γ−→ T (c) = w for the vertex w satisfying γ−→ each c ∈ V [H] a unique vertex w ∈ V−→ as ϕ−→ i.e., a set {u1, . . . , uℓ} ∈ E[H] implies {ϕ(u1), . . . , ϕ(uℓ)} ∈ E[G−→ homomorphic to G−→ T , and by Lemma 3 we have T such that γ−→ T (c, w) = degH(c). Then, ϕ−→ T (c, w) = degH (c). Define ϕ−→ γ−→ X T c T γ−→ X T c (c,w) (c,w) T Second, we consider the product B. We will show that, under the condition A 6= 0, GT is an occurrence of H if and only if B 6= 0. Observe that Yc∈V [H] E  Yw∈V−→ T (c,w) γ−→ X T c E  Yc∈V [H] Yw∈V−→ T γ−→ T Q (c,w)Y (w) degH (c)  (w)  = Yc∈V [H]  = E"Q EhX degH (c) c (ϕ−→ T (c))i = 1 . (7) Pc∈V [H] Pw∈V−→ T γ−→ T (c,w)Y (w) degH (c) # . Case 1: Assume that GT is an occurrence of H in G. Then, V−→ T = V [H], and the homomor- phism ϕ−→ T constructed above is a bijection and an isomorphism. This implies that Xc∈V [H] Xw∈V−→ T T (c, w) · Y (w) γ−→ degH(c) = Xc∈V [H] 7 Y (ϕ−→ T (c)) = Xw∈V−→ T Y (w). Without loss of generality, let V−→ T denoted by y(w1), . . . , y(wt) ∈ S, and independence between Q and Y (w) (w ∈ V [G]), we have = {w1, . . . , wt}. By considering all possible choices of Y (w1), . . . , Y (wt), B = = τ −1 τ −1 Xj=0 Xy(w1),...,y(wt)∈S Xy(w1),...,y(wt)∈S Xj=0 Xj=0 τ −1 + τ 1 1 Pr [ Y (wi) = y(wi) ]! · exp 2πij τ t Yi=1 exp(cid:18) 2πi τ (cid:18) 1 t(cid:19)t τ (cid:18) 1 t(cid:19)t · ϑ · j(cid:19) exp(cid:18) 2πi · ϑ · j(cid:19) . 1 τ τ Xy(w1),...,y(wt)∈S ϑ:=y(w1)+···+y(wt),τ ∤ϑ ϑ:=y(w1)+···+y(wt),τ ϑ y(wℓ)! t Xℓ=1 have Applying Lemma 4 with R = exp(cid:0) 2πi τ (cid:1), the second summation is zero. Hence, by Lemma 5, we (cid:18) 1 t(cid:19)t =(cid:18) 1 t(cid:19)t (cid:18) 1 t(cid:19)t B = Xy(w1),...,y(wt)∈S Xy(w1),...,y(wt)∈S · t! = t! tt (8) = . τ y(w1)+···+y(wt) y(w1)+···+y(wt)=τ Case 2: Assume that GT is not an occurrence of H in G. Then, ϕ−→ T is not a bijection, and T = {w1, . . . , wt′}, where t′ < t. Then, there is a vertex trivially is not an isomorphism. Let V−→ w ∈ V−→ T and different b, c ∈ V [H], such that ϕ−→ T (b) = ϕ−→ T (c) = w. As before, we have Xc∈V [H] Xw∈V−→ T T (c, w) · Y (w) γ−→ degH(c) = Xc∈V [H] Y (ϕ−→ T (c)) . By Lemma 5, τ ∤Pc∈V [H] Y (ϕ(c)) regardless of the choices of Y (w1), . . . , Y (wt′). Hence, τ −1 1 τ (cid:18) 1 t(cid:19)t′ exp(cid:18) 2πi τ · ϑ · j(cid:19) = 0 , B = Xj=0 Xy(w1),...,y(wt′ )∈S ϑ:=Pc∈V [H] y(ϕ−→ T (c)),τ ∤ϑ By (7) and (8), we have α−→ τ (cid:1). where the last equality follows from Lemma 4 with R = exp(cid:0) 2πi T = 0 otherwise. Note that for every occurrence of H in G, denoted by H ′, there are auto(H) isomorphic mappings between H ′ T corresponds to one T together with an appropriate orientation and H, and each such mapping ϕ−→ of every edge. Hence, every H ′ is counted auto(H) times and T = t!(cid:14)tt if ϕ−→ T is an isomorphism, and α−→ E[ZH(G)] = Xe1,...ek∈E[G] ∀i:size(ei)=size(e⋆ i ) ei=(ui,1,...,ui,qi ) Xσ1,...,σk ∀i:σi∈Sqi −→ T =(−→e1,...,−→ek) α−→ T = t! · auto(H) tt · #(H, G) . Proof of Theorem 2. By Theorem 6, we have #(H, G) = tt t! · auto(H) · E[ZH(G)]. (9) Expanding the right-hand side of (9) by the definition of the expectation, the theorem holds. 8 3.2 Analysis of the Second Moment Now we analyze the variance of ZH(G) and use Chebyshev's inequality to upper bound the space requirement of our algorithm in order to get a (1 ± ε)-approximation of #(H, G). Our analysis relies on the following lemma about the number of subgraphs in a hypergraph. Lemma 7. Let G be a hypergraph with m edges, and H be a hypergraph with k edges and minimum degree 2. Then #(H, G) = O(mk/2). Proof. We define the fractional cover ϕ : E[H] 7→ [0, 1] as ϕ(e) = 1/2 for every e ∈ E[H]. Since the minimum degree of graph H is 2, we have Pe∋v ϕ(e) > 1 for every v ∈ V [H]. Therefore the fractional cover number minϕnPe∈E[H] ϕ(e)o 6 k/2. By Theorem 1.1 of [9], the lemma holds. Theorem 8. Let G be a hypergraph with m edges, and H be a hypergraph with k edges. Random variables Xc(w), Y (w) (c ∈ V [H], w ∈ V [G]) and Q are defined as above. Then the following statements hold: (1) E[ZH (G) · ZH(G)] = O(m2k); (2) If the minimum degree of H is at least 2, then E[ZH(G) · ZH(G)] = O(mk). Proof. By definition we write E[ZH(G) · ZH(G)] as EhZH(G) · ZH(G)i   Xe1,...,ek∈E[G] ∀i:size(ei)=size(e⋆ i ) ei=(ui,1,...,ui,qi ) =E Xσ1,...,σk ∀i:σi∈Sqi −→ T1=(−→e1,...,−→ek) (c,w) γ−→ T1 X c   Yc∈V [H] w∈V−→ T1 Xe′ 1,...,e′ ∀i:size(e′ k∈E[G] i)=size(e⋆ i ) e′ i=(vi,1,...,vi,qi ) (c,w) γ−→ T2 X c   Yc∈V [H] w∈V−→ T2 Xσ′ 1,...,σ′ k ∀i:σ′ i∈Sqi −→ −→ e′ e′ k) 1,..., −→ T2=( (w)   · w∈V−→ T1 ·  Yc∈V [H] (w)  ·  Yc∈V [H] w∈V−→ T2 Q Q γ−→ T1 (c,w)Y (w) degH (c)        degH (c)   (c,w)Y (w) γ−→ T2     = E   Xe1,...,ek∈E[G] ∀i:size(ei)=size(e⋆ i ) ei=(ui,1,...,ui,qi ) Xσ1,...,σk ∀i:σi∈Sqi −→ T1=(−→e1,...,−→ek) Xe′ 1,...,e′ ∀i:size(e′ k∈E[G] i)=size(e⋆ i ) e′ i=(vi,1,...,vi,qi ) Xσ′ 1,...,σ′ k ∀i:σ′ i∈Sqi −→ −→ e′ e′ k) 1,..., −→ T2=(   Yc∈V [H] w∈V−→ T1 ∪ −→ T2 γ−→ T1 X c (c,w)−γ−→ T2 (c,w) (w)  ·  Yc∈V [H] w∈V−→ T1 ∪ −→ T2 (cid:18)γ−→ T1 Q (c,w)(cid:19)·Y (w) (c,w)−γ−→ T2 degH (c)     By linearity of expectations and the condition that random variables Xc(w)(c ∈ V [H], w ∈ V [G]) are (2t · k)-wise independent, and Xc(c ∈ V [H]), Q are chosen independently, we can rewrite 9 E[ZH · ZH] as Xe1,...,ek∈E[G] ∀i:size(ei)=size(e⋆ i ) ei=(ui,1,...,ui,qi ) where the value of α−→ T1, −→ T2 is Xσ1,...,σk ∀i:σi∈Sqi −→ T1=(−→e1,...,−→ek) Xe′ 1,...,e′ ∀i:size(e′ k∈E[G] i)=size(e⋆ i ) e′ i=(vi,1,...,vi,qi ) α−→ T1, −→ T2 Xσ′ 1,...,σ′ k ∀i:σ′ i∈Sqi −→ −→ e′ e′ k) 1,..., −→ T2=( Yc∈V [H] E  Yw∈V−→ T1∪ −→ T2 γ−→ T1 X c (c,w)−γ−→ T2 (c,w) (w)  · E  Yc∈V [H] w∈V−→ T1∪ −→ T2 (cid:18)γ−→ T1 Q (c,w)(cid:19)·Y (w) (c,w)−γ−→ T2 degH (c) = O(1).   Since E[ZH (G) · ZH (G)] has at most O(m2k) terms, the first statement holds. (c, w) 6 degH(c). Hence α−→ T1, (c, w) 6 degH(c) and 0 6 γ−→ T2 , E[X i c(w)] 6= Now for the second statement. Remember that (i) for any c ∈ V [H] and w ∈ V−→ −→ T2 , it holds that 0 if and only if i is divisible by degH(c), and (ii) for any c ∈ V [H] and w ∈ V−→ T1∪ 6= 0 if for any c ∈ V [H] and 0 6 γ−→ T1 (c, w) = 0, or (iii) (c, w) = degH(c), γ−→ w ∈ V [G] it holds that (i) γ−→ T2 T1 into three disjoint subsets A, B and C γ−→ T1 . Set A, B, and C are defined defined by A := V−→ T1 according to the above conditions (i), (ii) and (iii). By the assumption that the minimum degree of H is 2, the degree of every vertex in sets A, B and C is at least 2. Since there are O(1) different such H ′ of constant size, and for each H ′ of them it holds that #(H, G) = O(mk/2), by Lemma 7 we have E[ZH (G) · ZH(G)] = O(mk). (c, w) = degH(c). We partition V−→ T1∪ (c, w), or (ii) γ−→ T1 , and C := V−→ T1 (c, w) = 0, γ−→ T2 (c, w) = γ−→ T2 , B := V−→ T2 T1∪ −→ T2 ∩ V−→ T2 \ V−→ T1 \ V−→ T2 −→ T2 −→ T2 By applying Chebyshev's inequality, we can get a (1±ε)-approximation by running our estimator in parallel and returning the average of the output of these returned values, and this implies our main theorem (Theorem 1). Proof of Theorem 1. We run s parallel and independent copies of our estimator and take the average value Z ∗ = 1 i=1 Zi, where each Zi is the output of the ith instance of the estimator. Therefore, E[Z ∗] = E[ZH (G)], and a straightforward calculation shows that sPs By Chebyshev's inequality for complex-valued random variables (see, e.g., [14, Lemma 3]), we have EhZ ∗Z ∗i − E [Z ∗]2 = 1 s(cid:16)EhZH (G) · ZH (G)i − E[ZH(G)]2(cid:17) . EhZH(G) · ZH(G)i − E[ZH(G)] · E[ZH(G)] s · ε2 · E[ZH(G)]2 . Pr [ Z ∗ − E[Z ∗] > ε · E[Z ∗] ] 6 By the first statement of Theorem 8, we have EhZH (G) · ZH (G)i − E[ZH(G)] · E[ZH (G)] 6 EhZH(G) · ZH(G)i = O(mk) . ε2 · mk (#H)2(cid:17), we get By choosing s = O(cid:16) 1 Hence, the overall space complexity is O(cid:16) 1 Pr [ Z ∗ − E [Z ∗] > ε · E[Z ∗] ] 6 1/3 . ε2 · mk (#H)2 · log n(cid:17). 10 Acknowledgement. The author would like to thank Kurt Mehlhorn for helpful comments on the presentation. References [1] http://www.hypergraphDB.org. [2] K. J. Ahn, S. Guha, and A. McGregor. Graph sketches: sparsification, spanners, and sub- graphs. In Proc. 31st Symp. Principles of Database Systems (PODS), pages 5 -- 14, 2012. [3] Z. Bar-Yossef, R. Kumar, and D. Sivakumar. Reductions in streaming algorithms, with an ap- plication to counting triangles in graphs. In Proc. 13th Symp. on Discrete Algorithms (SODA), pages 623 -- 632, 2002. [4] L. Becchetti, P. Boldi, C. Castillo, and A. Gionis. Efficient semi-streaming algorithms for local triangle counting in massive graphs. In Proc. 14th Intl. Conf. Knowledge Discovery and Data Mining (KDD), pages 16 -- 24, 2008. [5] C. Beeri, R. Fagin, D. Maier, A. O. Mendelzon, J. D. Ullman, and M. Yannakakis. Properties of acyclic database schemes. In Proc. 13th Symp. on Theory of Computing (STOC), pages 355 -- 362, 1981. [6] I. Bordino, D. Donato, A. Gionis, and S. Leonardi. Mining large networks with subgraph counting. In Proc. 8th Intl. Conf. on Data Mining (ICDM), pages 737 -- 742, 2008. [7] L. S. Buriol, G. Frahling, S. Leonardi, and C. Sohler. Estimating clustering indexes in data streams. In Proc. 15th European Symp. on Algorithms (ESA), pages 618 -- 632, 2007. [8] R. Fagin. Degrees of acyclicity for hypergraphs and relational database schemes. J. ACM, 30 (3):514 -- 550, 1983. [9] E. Friedgut and J. Kahn. On the number of copies of one hyper graph in another. Isreal Journal of Mathematics, 105:251 -- 256, 1998. [10] S. Ganguly. Estimating frequency moments of data streams using random linear combinations. In Proc. 8th Intl. Workshop on Randomization and Comput. (RANDOM), pages 369 -- 380, 2004. [11] H. Jowhari and M. Ghodsi. New streaming algorithms for counting triangles in graphs. In Proc. 11th Intl. Conf. Computing and Combinatorics (COCOON), pages 710 -- 716, 2005. [12] D. M. Kane, K. Mehlhorn, T. Sauerwald, and H. Sun. Counting arbitrary subgraphs in data streams. In Proc. 39th Intl. Coll. Automata, Languages and Programming (ICALP), pages 598 -- 609, 2012. [13] S. Klamt, U. Haus, and F. Theis. Hypergraphs and cellular networks. PLoS Computational Biology, 5(5):1 -- 6, 2009. [14] M. Manjunath, K. Mehlhorn, K. Panagiotou, and H. Sun. Approximate counting of cycles in streams. In Proc. 19th European Symp. on Algorithms (ESA), pages 677 -- 688, 2011. [15] S. Muthukrishnan. Data Streams: Algorithms and Applications. Foundations and Trends in Theoretical Computer Science, 1(2), 2005. [16] D. Zhou, J. Huang, and B. Scholkopf. Learning with hypergraphs: Clustering, classification, and embedding. In Proc. 20th Conf. on Neural Information (NIPS), pages 1601 -- 1608, 2006. 11
1303.0726
2
1303
2013-08-09T16:50:23
Approximation Algorithms for Stochastic Boolean Function Evaluation and Stochastic Submodular Set Cover
[ "cs.DS" ]
Stochastic Boolean Function Evaluation is the problem of determining the value of a given Boolean function f on an unknown input x, when each bit of x_i of x can only be determined by paying an associated cost c_i. The assumption is that x is drawn from a given product distribution, and the goal is to minimize the expected cost. This problem has been studied in Operations Research, where it is known as "sequential testing" of Boolean functions. It has also been studied in learning theory in the context of learning with attribute costs. We consider the general problem of developing approximation algorithms for Stochastic Boolean Function Evaluation. We give a 3-approximation algorithm for evaluating Boolean linear threshold formulas. We also present an approximation algorithm for evaluating CDNF formulas (and decision trees) achieving a factor of O(log kd), where k is the number of terms in the DNF formula, and d is the number of clauses in the CNF formula. In addition, we present approximation algorithms for simultaneous evaluation of linear threshold functions, and for ranking of linear functions. Our function evaluation algorithms are based on reductions to the Stochastic Submodular Set Cover (SSSC) problem. This problem was introduced by Golovin and Krause. They presented an approximation algorithm for the problem, called Adaptive Greedy. Our main technical contribution is a new approximation algorithm for the SSSC problem, which we call Adaptive Dual Greedy. It is an extension of the Dual Greedy algorithm for Submodular Set Cover due to Fujito, which is a generalization of Hochbaum's algorithm for the classical Set Cover Problem. We also give a new bound on the approximation achieved by the Adaptive Greedy algorithm of Golovin and Krause.
cs.DS
cs
Approximation Algorithms for Stochastic Boolean Function Evaluation and Stochastic Submodular Set Cover Amol Deshpande Lisa Hellerstein Devorah Kletenik University of Maryland Polytechnic Institute of NYU Polytechnic Institute of NYU [email protected] [email protected] [email protected] November 1, 2018 1 Introduction We present approximation algorithms for two problems: Stochastic Boolean Function Evaluation and Stochas- tic Submodular Set Cover. We also consider a related ranking problem. Stochastic Boolean Function Evaluation (SBFE) is the problem of determining the value of a given Boolean function f on an unknown input x, when each bit xi of x can only be determined by paying a cost ci. The assumption is that x is drawn from a given product distribution, and the goal is to minimize expected cost. SBFE problems arise in diverse application areas. For example, in medical diagnosis, the xi might correspond to medical tests, and f (x) = 1 if the patient has a particular disease. In database query optimization, f could correspond to a Boolean query on predicates corresponding to x1, . . . , xn, that has to be evaluated for every tuple in the database to find tuples that satisfy the query [26, 29, 12, 37]. In Operations Research, the SBFE problem is known as "sequential testing" of Boolean functions. In learning theory, the SBFE problem has been studied in the context of learning with attribute costs. We focus on developing approximation algorithms for SBFE problems. There have been previous papers on exact algorithms for these problems, but there is very little work on approximation algorithms [38, 28]. Our approach is to reduce the SBFE problems to Stochastic Submodular Set Cover (SSSC). The SSSC problem was introduced by Golovin and Krause, who gave an approximation algorithm for it called Adaptive Greedy. 1 Adaptive Greedy is a generalization of the greedy algorithm for the classical Set Cover problem. We present a new algorithm for the SSSC problem, which we call Adaptive Dual Greedy. It is an extension of the Dual Greedy algorithm for Submodular Set Cover due to Fujito, which is a generalization of Hochbaum's primal-dual algorithm for the classical Set Cover Problem [15, 16]. We also give a new bound on the approximation achieved by the Adaptive Greedy algorithm of Golovin and Krause. The following is a summary of our results. We note that our work also suggests many open questions, including approximation algorithms for other classes of Boolean functions, proving hardness results, and determining adaptivity gaps. The Q-value approach: We first show how to solve the SBFE problem using the following basic approach, which we call the Q-value approach. We reduce the SBFE problem to an SSSC problem, through the construction of an assignment feasible utility function, with goal value Q. Then we apply the Adaptive Greedy algorithm of Golovin and Krause to the SSSC problem, yielding an approximation factor of (ln Q + 1). Using this approach, we easily obtain an O(log kd)-approximation algorithm for CDNF formulas (or decision trees), where k is the number of clauses in the CNF and d is the number of terms in the DNF. Pre- viously, Kaplan et al. gave an algorithm also achieving an O(log kd) approximation, but only for monotone CDNF formulas, unit costs, and the uniform distribution [28].2 We also use the Q-value approach to develop an O(log D)-approximation algorithm for evaluating linear threshold formulas with integer coefficients. Here D is the sum of the magnitudes of the coefficients. This O(log D) bound is a weak bound that we improve below, but we adapt the algorithm later to obtain other results. The Q-value approach has inherent limitations. We prove that it will not give an algorithm with a sublinear approximation factor for evaluating read-once DNF (even though there is a poly-time exact algo- rithm [28, 21]), or for evaluating linear threshold formulas with exponentially large coefficients. In fact, our weak O(log D) approximation factor for linear threshold formulas cannot be improved to be sublinear in n with the Q-value approach. We prove our negative results by introducing a new combinatorial measure of a Boolean function, which we call its Q-value. Adaptive Dual Greedy: We present Adaptive Dual Greedy (ADG), a new algorithm for the SSSC problem. 1Golovin and Krause called the problem Stochastic Submodular Coverage, not Stochastic Submdodular Set Cover, because the cover is not formed using sets. Our choice of name is for consistency with terminology of Fujito [16]. 2 Although our result solves a more general problem than Kaplan et al., they give their O(log kd) approximation factor in terms of expected certificate cost, which lower bounds the expected cost of the optimal strategy. See Section 2. 1 We prove that it achieves an approximation factor of of α, where α is a ratio that depends on the cover constructed by the algorithm. 3-Approximation for Linear Threshold Formulas: We substitute ADG for Adaptive Greedy in our O(log D) algorithm for evaluating linear threshold formulas. We show that in this case, α is bounded above by 3, and we get a 3-approximation algorithm. New bound on Adaptive Greedy: We prove that Adaptive Greedy achieves an 2(ln P + 1)-approximation in the binary case (and k(ln P + 1) in the k-ary case) where P is the maximum utility that can be contributed by a single item. The proof of this bound uses the same LP that we use in our analysis of ADG to lower bound the approximation factor, combined with Wolsey's approach to bounding the analogous algorithm for (non-adaptive) submodular set cover [39]. Our bound generalizes Wolsey's bound for (non-adaptive) submodular set cover [39], except for an additional factor of 2. Wolsey's bound generalized the (ln s + 1) bound for standard set cover, where s is the maximum size of one of the input subsets (cf. [16]). Simultaneous Evaluation of Linear Threshold Formulas: We apply the above techniques to the problem of simultaneous evaluation of m linear threshold formulas, giving two algorithms with approximation factors of O(log mDavg) and Dmax respectively. Here Davg and Dmax are the average and maximum, over the m formulas, of the sum of the magnitude of the coefficients. These results generalize results of Liu et al. for shared filter ordering [30]. We also improve one of Liu's results for that problem. Ranking of Linear Functions: We give an O(log(mDmax))-approximation algorithm for ranking a set of m linear functions a1x1 + . . . + anxn (not linear threshold functions), defined over {0, 1}n, by their output values, in our stochastic setting. This problem arises in Web search and database query processing. For example, we might need to rank a set of documents or tuples by their "scores", where the linear functions compute the scores over a set of unknown properties such as user preferences or data source reputations. 2 Stochastic Boolean Function Evaluation and Related Work Formally, the input to the SBFE problem is a representation of a Boolean function f (x1, . . . , xn) from a fixed class of representations C, a probability vector p = (p1, . . . , pn), where 0 < pi < 1, and a real-valued cost vector (c1, . . . , cn), where ci ≥ 0. An algorithm for this problem must compute and output the value of f on an x ∈ {0, 1}n, drawn randomly from product distribution Dp, such that pi = P rob[xi = 1]. However, it is not given access to x. Instead, it can discover the value of any xi by "testing" it, at a cost of ci. The algorithm must perform the tests sequentially, each time choosing the next test to perform. The algorithm can be adaptive, so the choice of the next test can depend on the outcomes of the previous tests. The expected cost of the algorithm is the cost it incurs on a random x from Dp. (Since each pi is strictly between 0 and 1, the algorithm must continue doing tests until it has obtained a 0-certificate or 1-certificate for the function.) The algorithm is optimal if it has minimum expected cost with respect to Dp. The running time of the algorithm is the (worst-case) time it takes to determine the next variable to be tested, or to compute the value of f (x) after the last test. The algorithm corresponds to a Boolean decision tree (strategy) computing f . If f is given by its truth table, the SBFE Problem can be exactly solved in time polynomial in the size of the truth table, using dynamic programming, as in [22, 34]. The following algorithm solves the SBFE problem with an approximation factor of n for any function f , even under arbitrary distributions: Test the variables in increasing cost order (cf. [28]). We thus consider a factor of n approximation to be trivial. We now review related work. There is a well-known algorithm that exactly solves the SBFE problem for disjunctions: test the xi in increasing order of ratio ci/pi (see, e.g., [17]). A symmetric algorithm works for conjunctions. There is also a poly-time exact algorithm for evaluating a k-of-n function (i.e., a function that evaluates to 1 iff at least k of the xi are equal to 1) [35, 4, 36, 9]. There is a poly-time exact algorithm for evaluating a read-once DNF formula f , but the complexity of the problem is open when f is a general read-once formula [7, 21, 20]. The SBFE problem is NP-hard for linear threshold functions [11], but for the special case of unit costs and uniform distribution, testing the variables in decreasing order of the magnitude of their coefficients is optimal [6, 14]. A survey by Unluyurt [38] covers other results on exactly solving the 2 SBFE problem. There is a sample version of the evaluation problem, where the input is a sample of size m of f (i.e, a set of m pairs (x, f (x))), and the problem is to build a decision tree that computes f correctly on the x in the sample that minimizes the average cost of evaluation over the sample. Golovin et al. and Bellala et al. developed O(log m) approximation algorithms for arbitrary f [19, 3], and there is a 4-approximation algorithm when f is a conjunction [2, 13, 33]. Moshkov and Chikalov proved a related bound in terms of a combinatorial measure of the sample [32]. Moshkov gave an O(log m)-algorithm for a worst-case cost variant of this problem [31]. A number of non-adaptive versions of standard and submodular set cover have been studied. For exam- ple, Iwata and Nagano [27] studied the "submodular cost set cover" problem, where the cost of the cover is a submodular function that depends on which subsets are in the cover. Beraldi and Ruszczynski addressed a set cover problem where the set of elements covered by each input subset is a random variable, and full coverage must be achieved with a certain probability [5]. Kaplan et al. gave their O(log kd) approximation factor for monotone CDNF (and unit costs, uniform distribution) in terms of the expected certificate cost, rather than the expected cost of the optimal strategy. The gap between expected certificate cost and expected cost of the optimal strategy can be large: e.g., for disjunction evaluation, with unit costs, where Prob[xi = 1] is 1/(i + 1), the first measure is constant, while the second is Ω(log n). Kaplan et al. also considered the problem of minimizing the expected cost of evaluating a Boolean function f with respect to a given arbitrary probability distribution, where the distribution is given by a conditional probability oracle [28]. In the work of Kaplan et al., the goal of evaluation differs slightly from ours in that they require the evaluation strategy to output an "explanation" of the function value upon termination. They give as an example the case of evaluating a DNF that is identically true; they require testing of the variables in one term of the DNF in order to output that term as a certificate. In contrast, under our definitions, the optimal strategy for evaluating an identically true DNF formula is a zero-cost one that simply outputs "true" and performs no tests. Charikar et al. [10] considered the problem of minimizing the worst-case ratio between the cost of evaluating f on an input x, and the minimum cost of a certificate contained in x. There are also papers on building identification trees of minimum average cost, given S ⊆ {0, 1}n, but that problem is fundamentally different than function evaluation because each x ∈ S must have its own leaf (cf. [1]). We note that there is a connection between the linear threshold evaluation problem and the Min-Knapsack problem. In Min-Knapsack, you are given a set of items with values ai ≥ 0 and weights ci ≥ 0, and the goal is to select a subset of the items to put in the knapsack such that the total value of the items is at least θ, and the total weight is minimized. We can therefore solve Min-Knapsack by simulating the above algorithm on the linear threshold formula Pn i=1 aixi ≥ θ, giving the value 1 as the result of each test. It is easy to modify the above analysis to show that in this case the ratio α is at most 2, because C0 is empty. We thus have a combinatorial 2-approximation algorithm for Min-Knapsack, based on ADG. (In fact, the deterministic Dual Greedy algorithm of Fujito would be sufficient here, since the outcomes of the tests are predetermined.) There are several previous combinatorial and non-combintorial 2-approximation algorithms for Min-Knapsack, and the problem also has a PTAS ( [8], cf. [24]). Han and Makino considered an on-line version of the Min-Knapsack where the items are given one- by-one over time [24]. There is also previous work on the "stochastic knapsack" problem, but that work concerns the standard (max) knapsack problem, not Min-Knapsack. 3 Preliminaries Basic notation and definitions. A table of notation used in this paper is provided in Appendix A. A partial assignment is a vector b ∈ {0, 1, ∗}n. We view b as an assignment to variables x1, . . . , xn. For partial assignment b, we use dom(b) to denote the set {xibi 6= ∗}. We will use b ∈ {0, 1}n to represent the outcomes of binary tests, where for l ∈ {0, 1}, bi = l indicates that test i was performed and had outcome 3 l, and bi = ∗ indicates that test i was not performed. For partial assignments a, b ∈ {0, 1, ∗}n, a is an extension of b, written a ∼ b, if ai = bi for all bi 6= ∗. We also say that b is contained in a. Given Boolean function f : {0, 1}n → {0, 1}, a partial assignment b ∈ {0, 1, ∗}n is a 0-certificate (1-certificate) of f if f (a) = 0 (f (a) = 1) for all a such that a ∼ b. Given a cost vector c = (c1, . . . , cn), the cost of a certificate b is Pj:bj6=∗ cj. Let N = {1, . . . , n}. In what follows, we assume that utility functions are integer-valued. In the context of standard work on submodularity, a utility function is a function g : 2N → Z≥0. Given S ⊆ N and j ∈ N, gS(j) denotes the quantity g(S S{j}) − g(S). We will also use the term utility function to refer to a function g : {0, 1, ∗}n → Z≥0 defined on partial assignments. Let g : {0, 1, ∗}n → Z≥0, be such a utility function, and let b ∈ {0, 1, ∗}n. For S ⊆ N, let bS ∈ {0, 1, ∗}n where bS i = ∗ otherwise. We define g(S, b) = g(bS ). For j ∈ N, we define gS,b(j) = g(S S{j}, b) − g(S, b). i = bi for i ∈ S, and bS For l ∈ {0, 1, ∗}. the quantity bxi←l denotes the partial assignment that is identical to b except that bi = l. We define gb(i, l) = g(bxi←l) − g(b) if bi = ∗, and gb(i, l) = 0 otherwise. When b represents test outcomes, and test i has not been performed yet, gb(i, l) is the change in utility that would result from adding test i with outcome l. Given probability vector p = (p1, . . . , pn), we use x ∼ Dp to denote a random x drawn from product distribution Dp. For fixed Dp, b ∈ {0, 1, ∗}n, and i ∈ N, we use E[gb(i)] to denote the expected increase in utility that would be obtained by testing i. In the binary case, E[gb(i)] = pigb(i, 1) + (1 − pi)gb(i, 0). Note that E[gb(i)] = 0 if bi 6= ∗. For b ∈ {0, 1, ∗}n, p(b) = Qj∈dom(b) p(b, j) where p(b, j) = pj if bj = 1, and p(b, j) = 1 − pj otherwise. Utility function g : {0, 1}n → Z≥0 is monotone if for b ∈ {0, 1, ∗}n, i ∈ N such that bi = ∗, and l ∈ {0, 1}, g(bxi←l) − g(b) ≥ 0; in other words, additional information can only increase utility. Utility xi←l) − g(b′) function g is submodular if for all b, b′ ∈ {0, 1, ∗}n and l ∈ {0, 1}, g(bxi←l) − g(b) ≥ g(b′ whenever b′ ∼ b and bi = b′ In the testing context, if the n test outcomes are predetermined, submodularity means that the value of a given test (measured by the increase in utility) will not increase if we delay that test until later. i = ∗. The Stochastic Submodular Set Cover (SSSC) problem. The SSSC problem is similar to the SBFE problem, except that the goal is to achieve a cover. Let O = {0, 1, . . . , k − 1} be a finite set of k states, where k ≥ 2 and ∗ 6∈ O. In what follows, we assume the binary case where k = 2, although we will briefly mention extensions to the k-ary case where k > 2. 3 In the (binary) SSSC problem, the input consists of the set N, a cost vector (c1, . . . , cn), where each cj ≥ 0, a probability vector p = (p1, . . . , pn) where p ∈ [0, 1]n, an integer Q ≥ 0, and a utility function g : (O S{∗})n → Z≥0. Further, g(x) = 0 if x is the vector that is all ∗'s, and g(x) = Q if x ∈ On. We call Q the goal utility. We say that b ∈ (O S{∗})n is a cover if g(b) = Q. The cost of cover b is Pj:bj6=∗ cj. Each item j ∈ N has a state xj ∈ O. We sequentially choose items from N. When we choose item j, we observe its state xj (we "test" j). The states of items chosen so far are represented by a partial assignment b ∈ (O S ∗)n. When g(b) = Q, we have a cover, and we can output it. The goal is to determine the order in which to choose the items, while minimizing the expected testing cost with respect to distribution Dp. We assume that an algorithm for this problem will be executed in an on-line setting, and that it can be adaptive. SSSC is a generalization of Submodular Set Cover (SSC), which is a generalization of the standard (weighted) Set Cover problem, which we call Classical Set Cover. In Classical Set Cover, the input is a finite ground set X, a set F = {S1, . . . , Sm} where each Sj ⊆ X, and a cost vector c = (c1, . . . , cm) where each cj ≥ 0. The problem is to find a min-cost "cover" F ′ ⊆ F such that SSj∈F ′ Sj = X, and the cost of F ′ is PSj∈F ′ cj. In SSC, the input is a cost vector c = (c1, . . . , cn), where each cj ≥ 0, and a utility function g : 2N → Z≥0 such that g is monotone and submodular, g(∅) = 0, and g(N ) = Q. The goal is to 3To simplify the exposition, we define the SSSC Problem in terms of integer valued utility functions. 4 find a subset S ⊆ N such that g(S) = Q and Pj∈S cj is minimized. SSC can be viewed as a special case of SSSC in which each pj is equal to 1. The Adaptive Greedy algorithm for Stochastic Submodular Set Cover. The Classical Set Cover problem has a simple greedy approximation algorithm that chooses the subset with the "best bang for the buck" -- i.e., the subset covering the most new elements per unit cost. The generalization of this algorithm to SSC, due to Wolsey, chooses the element that adds the maximum additional utility per unit cost [39]. The Adaptive Greedy algorithm of Golovin and Krause, for the SSSC problem, is a further generalization. It chooses the element with the maximum expected increase in utility per unit cost. (Golovin and Kruase actually formulated Adaptive Greedy for use in solving a somewhat more general problem than SSSC, but here we describe it only as it applies to SSSC.) We present the pseudocode for Adaptive Greedy in Algorithm 1. Some of the variables used in the pseudocode are not necessary for the running of the algorithm, but are useful in its analysis. (In Step 5, assume that if E[gb(x)] = 0, the expression evaluates to 0.) b ← (∗, ∗ . . . , ∗) l ← 0, F 0 ← ∅ while b is not a solution to SSSC (f (b) < Q) do l ← l + 1 jl ← arg min j6∈F l−1 cj E[gb(j)] k ← the state of jl //"test" jl F l ← F l−1 S{jl} //F l = dom(b) bjl ← k end while return b Algorithm 1: Adaptive Greedy Golovin and Krause proved that Adaptive Greedy is a (ln Q + 1)-approximation algorithm, where Q is the goal utility. We will make repeated use of this bound. 4 Function Evaluation and the SSSC Problem 4.1 The Q-value approach and CDNF Evaluation. Definition: Let f (x1, . . . , xn) be a Boolean function. Let g : {0, 1, ∗}n → Z≥0 be a utility function. We say that g is assignment feasible for f , with goal value Q, if (1) g is monotone and submodular, (2) g(∗, ∗, . . . , ∗) = 0, and (3) for b ∈ {0, 1, ∗}n, g(b) = Q iff b is a 0-certificate or a 1-certificate of f . We will use the following approach to solving SBFE problems, which we call the Q-value approach. To evaluate f , we construct an assignment feasible utility function g for f with goal value Q. We then run Adaptive Greedy on the resulting SSSC problem. Because g(b) = Q iff b is either a 0-certificate or a 1-certificate of f , the decision tree that is (implicitly) output by Adaptive Greedy is a solution to the SBFE problem for f . By the bound on Adaptive Greedy, this solution is within a factor of (ln Q + 1) of optimal. The challenge in using the above approach is in constructing g. Not only must g be assignment feasible, but Q should be subexponential, to obtain a good approximation bound. We will use the following lemma, due to Guillory and Bilmes, in our construction of g. Lemma 1. [23] Let g0 : {0, 1, ∗}n → Z≥0,' g1 : {0, 1, ∗}n → Z≥0, and Q0, Q1 ∈ Z≥0 be such that g0 and g1 are monotone, submodular utility functions, g0(∗, ∗, . . . , ∗) = g1(∗, ∗, . . . , ∗) = 0, and g0(a) ≤ Q0 and g1(a) ≤ Q1 for all a ∈ {0, 1}n. Let Q∨ = Q0Q1 and let g∨ : {0, 1, ∗}n → Z≥0 be such that g∨(b) = Q∨ − (Q0 − g0(b))(Q1 − g1(b)). Let Q∧ = Q0 + Q1 and let g∧ : {0, 1, ∗}n → Z≥0 be such that g∧(b) = g0(b) + g1(b). 5 Then g∨ and g∧ are monotone and submodular, and g∨(∗, . . . , ∗) = g∧(∗, . . . , ∗) = 0. For b ∈ {0, 1, ∗}n, g∨(b) = Q∨ iff g0(b) = Q0 or g1(b) = Q1, or both. Further, g∧(b) = Q∧ iff g0(b) = Q0 and g1(b) = Q1. Using the Q-value approach, it is easy to obtain an algorithm for evaluating CDNF formulas. A CDNF formula for Boolean function f is a pair (φ0, φ1) where φ0 and φ1 are CNF and DNF formulas for f , respectively. Theorem 1. There is a polynomial-time O(log kd)-approximation algorithm solving the SBFE problem for CDNF formulas, where k is the number of clauses in the CNF, and d is the number of terms in the DNF. Proof. Let φ0 be the CNF and φ1 be the DNF. Let f be the Boolean function defined by these formulas. Let k and d be, respectively, the number of clauses and terms of φ0 and φ1. Let g0 : {0, 1, ∗}n → Z≥0 be such that for a ∈ {0, 1, ∗}n, g0(a) is the number of terms of φ1 set to 0 by a (i.e. terms with a literal xi such that ai = 0, or a literal ¬xi such that ai = 1). Similarly, let g1(a) be the number of clauses of φ0 set to 1 by a. Clearly, g0 and g1 are monotone and submodular. Partial assignment b is a 0-certificate of f iff g0(b) = d and a 1-certificate of f iff g1(b) = k. Applying the disjunctive construction of Lemma 1 to g1 and g0, yields a utility function g that is assignment feasible for f with goal value Q = kd. Applying Adaptive Greedy and its (ln Q + 1) bound yields the theorem. Given a decision tree for a Boolean function f , a CNF (DNF) for f can be easily computed using the paths to the 0-leaves (1-leaves) of the tree. Thus the above theorem gives an O(ln t) approximation algorithm for evaluating decision trees, where t is the number of leaves. 4.2 Linear threshold evaluation via the Q-value approach A linear threshold formula with integer coefficients has the form Pn i=1 aixi ≥ θ where the ai and θ are integers. It represents the function f : {0, 1}n → {0, 1} such that f (x) = 1 if Pn i=1 aixi ≥ θ, and f (x) = 0 otherwise. We show how to use the Q-value approach to obtain an algorithm solving the SBFE problem for linear threshold formulas with integer coefficients. The algorithm achieves an O(log D)-approximation, D = Pn i=1 ai. This algorithm, like the CDNF algorithm, works by reducing the evaluation problem to an SSSC problem. However, the CDNF algorithm reduces the evaluation problem to a stochastic version of Classical Set Cover problem (each xi covers one subset of the (term,clause) pairs when it equals 1, and another when it equals 0). Here there is no associated Classical Set Cover problem. Let h(x) = (Pn i=1 aixi) − θ. For b ∈ {0, 1, ∗}, let min(b) = min{h(b′) : b′ ∈ {0, 1}n and b′ ∼ b} and let max(b) = max{h(b′) : b′ ∈ {0, 1}n and b′ ∼ b}. Thus min(b) = (Pj:bj6=∗ ajbj) + (Pi:ai<0,bi=∗ ai) − θ, max(b) = (Pj:bj6=∗ ajbj) + (Pi:ai>0,bi=∗ ai) − θ, and each can be calculated in linear time. Let Rmin = min(∗, . . . , ∗) and Rmax = max(∗, . . . , ∗). If Rmin ≥ 0 or Rmax < 0, f is constant and no testing is needed. Suppose this is not the case. Let Q1 = −Rmin and let submodular utility function g1 be such that g1(b) = min{−Rmin, min(b) − Rmin}, Intuitively, Q1 − g1(b) is the number of different values of h that can be induced by extensions b′ of b such that f (b′) = 0. Similarly, define g0(b) = min{Rmax + 1, Rmax − max(b)} and Q0 = Rmax + 1. Thus b is a 1-certificate of f iff g1(b) = Q1, and a 0-certificate iff g0(b) = Q0. We apply the disjunctive construction of Lemma 1 to construct g(b) = Q − (Q1 − g1(b))(Q0 − g0(b)), which is an assignment feasible utility function for f with goal value Q = Q1Q0. Finally, we obtain an O(log D) approximation bound by applying the (ln Q + 1) bound on Adaptive Greedy. The quantity D can be exponential in n, the number of variables. One might hope to obtain a better approximation factor, still using the Q-value approach, by designing a more clever assignment-feasible utility function with a much lower goal-value Q. However, in the next section we show that this is not possible. Achieving a 3-approximation for this problem, as we do in Section 5, requires a different approach. 6 4.3 Limitations of the Q-value approach The Q-value approach depends on finding an assignment feasible utility function g for f . We first demon- strate that a generic such g exists for all Boolean functions f . Let Q0 = {a ∈ {0, 1}nf (a) = 0} and Q1 = {a ∈ {0, 1}nf (a) = 1}. For partial assignment b, let g0(b) = Q0 −{a ∈ {0, 1}na ∼ b, f (a) = 0} with goal value Q0, and let g1(b) = Q1 − {a ∈ {0, 1}na ∼ b, f (a) = 1} with goal value Q1. Then g0, Q0, g1 and Q1 obey the properties of Lemma 1. Apply the disjunctive construction in that lemma, and let g be the resulting utility function. Then g is assigment feasible for f with goal value Q = Q1Q0. In fact, this g is precisely the utility function that would be constructed by the approximation algorithm of Golovin et al. for computing a consistent decision tree of min-expected cost with respect to a sample, if we take the sample to be the set of all 2n entries (x, f (x)) in the truth table of f [19]. The goal value Q of this g is 2θ(n), so in this case the bound for Adaptive Greedy, (ln Q + 1), is linear in n. Since we want a sublinear approximation factor, we would instead like to construct an assignment- feasible utility function for f whose Q is sub-exponential in n. However, we now show this is impossible even for some simple Boolean functions f . We begin by introducing the following combinatorial measure of a Boolean function, which we call its Q-value. Definition: The Q-value of a Boolean function f : {0, 1}n → {0, 1} is the minimum integer Q such that there exists a assignment feasible utility function g for f with goal value Q. The generic g above shows that the Q-value of every n-variable Boolean function is at most 2O(n). Lemma 2. Let f (x1, . . . , xn) be a Boolean function, where n is even. Further, let f be such that for all n′ ≤ n/2, and for all b ∈ {0, 1, ∗}n, if bi = bn/2+i = ∗ for all i ∈ {n′ + 1, . . . , n/2}, the following properties hold: (1) if for all i ∈ {1, . . . , n′}, exactly one of bi and bn/2+i is equal to * and the other is equal to 1, then b is not a 0-certificate or a 1-certificate of f and (2) if for all i ∈ {1, . . . , n′ − 1}, exactly one of bi and bn/2+i is equal to * and the other is equal to 1, and bn′ = bn/2+n′ = 1, then b contains a 1-certificate of f . Then the Q-value of f is at least 2n/2. Proof. Let f have the properties specified in the lemma. For bitstrings r, s ∈ {0, 1}l, where 0 ≤ l ≤ n/2, let dr,s ∈ {0, 1, ∗}n be such that di = ri and dn/2+i = si for i ∈ {1, . . . , l}, and di = ∗ for all other i. Suppose g is an assignment feasible utility function for f with goal value Q. We prove the following claim. Let 0 ≤ l ≤ n/2. Then there exists r, s ∈ {0, 1, ∗}l such that 0 ≤ Q − g(dr,s) ≤ Q/2l, and for all i ∈ {1, . . . , l}, either ri = 1 and si = ∗, or ri = ∗ and si = 1. We prove the claim by induction on l. It clearly holds for l = 0. For the inductive step, assume it holds for l. We show it holds for l + 1. Let r, s ∈ {0, 1, ∗}l be as guaranteed by the assumption, so Q − g(dr,s) ≤ n/2l. For σ ∈ {0, 1, ∗}, rσ denotes the concatenation of bitstring r with σ, and similarly for sσ. By the conditions on f given in the lemma, dr,s is not a 0 or 1-certificate of f . However, dr1,s1 is a 1-certificate of f and so g(dr1,s1) = Q. If Q − g(dr1,s∗) ≤ Q/2l+1, then the claim holds for l + 1, because r1, s∗ have the necessary properties. Suppose Q − g(dr1,s∗) > Q/2l+1. Then, because g(dr1,s1) = Q, g(dr1,s1) − g(dr1,s∗) > Q/2l+1. Note that dr1,s1 is the extension of dr1,s∗ produced by setting dn/2+l+1 to 1. Similarly, dr∗,s1 is the extension of dr∗,s∗ produced by setting dn/2+l+1 to 1. Therefore, by the submodularity of g, g(dr∗,s1) − g(dr∗,s∗) ≥ g(dr1,s1) − g(dr1,s∗), and thus g(dr∗,s1) − g(dr∗,s∗) ≥ Q/2l+1. Let A = g(dr∗,s1)−g(dr∗,s∗) and B = Q−g(dr∗,s1). Thus A ≥ Q/2l+1, and A+B = Q−g(dr∗,s∗) = Q − g(dr,s) ≤ Q/2l where the last inequality is from the original assumptions on r and s. It follows that B = Q − g(dr∗,s1) ≤ Q/2l+1, and the claim holds for l + 1, because r∗, s1 have the necessary properties. Taking l = n/2, the claim says there exists dr,s such that Q − g(dr,s) ≤ Q/2n/2. Since g is integer- valued, Q ≥ 2n/2. The above lemma immediately implies the following theorem. 7 Theorem 2. Let n be even. Let f : {0, 1}n → {0, 1} be the Boolean function represented by the read-once DNF formula φ = t1 ∨ t2 ∨ . . . ∨ tn/2 where each ti = xixn/2+i. The Q-value of f is at least 2n/2. The above theorem shows that the Q-value approach will not yield a good approximation bound for either read-once DNF formulas or for DNF formulas with terms of length 2. In the next theorem, we show that there is a particular linear threshold function whose Q-value is at least 2n/2. It follows that the Q-value approach will not yield a good approximation bound for linear-threshold formulas either. We note that the function described in the next theorem has been sudied before. As mentioned in [25], there is a lower bound of essentially 2n/2 on the size of the largest integer coefficients in any representation of the function as a linear threshold formula with integer coefficients. Theorem 3. Let f (x1, . . . , xn) be the function defined for even n, whose value is 1 iff the number repre- sented in binary by bits x1 . . . xn/2 is strictly less than the number represented in binary by bits xn/2+1, . . . , xn, and 0 otherwise. The Q-value of f is at least 2n/2. Proof. We define a new function: f ′(x1, . . . , xn) = f (¬x1, . . . , ¬xn/2, xn/2+1, . . . , xn). That is, f ′(x1, . . . , xn) is computed by negating the assignments to the first n/2 variables, and then computing the value of f on the resulting assignment. Function f ′ obeys the conditions of Lemma 2, and so has Q-value at least 2n/2. Then f also has Q-value at least 2n/2, because the Q-value is not changed by the negation of input variables. Given the limitations of the Q-value approach we can ask whether there are good alternatives. Our new bound on Adaptive Greedy is O(log P ), where P is the maximum amount of utility gained by testing a single variable xi, so we might hope to use P -value in place of Q-value. However, this does not help much: testing all n variables yields utility Q, so testing one of them alone must yield utility at least Q/n, implying that P ≥ Q/n. Another possibility might be to exploit the fact that Golovin and Krause's bounds on Adaptive Greedy apply to a more general class of utility functions than the assignment feasible utility functions, but we do not pursue that possibility. Instead, we give a new algorithm for the SSSC problem. 5 Adaptive Dual Greedy and a 3-approximation for Linear Threshold Evaluation We now present ADG, our new algorithm for the binary version of the SSSC problem. It easily extends to the k-ary version, where k > 2, with no change in the approximation bound. Like Fujito's Dual Greedy algorithm for the (non-adaptive) SSC problem, it is based on Wolsey's IP for the (deterministic) Submodular Set Cover Problem. We present Wolsey's IP in Figure 1. Min Pj∈N cjxj s.t. Pj∈N g(S S{j}) − g(S) ≥ Q − g(S) ∀S ⊆ N xj ∈ {0, 1} ∀j ∈ N Figure 1: Wolsey's IP for submodular set cover Wolsey proved that an assignment x ∈ {0, 1}n to the variables in this IP is feasible iff {jxj = 1} is a cover for the associated Submodular Set Cover instance, i.e., iff g({jxj = 1}) = Q. We call this Wolsey's property. In Figure 2, we present a new LP, based on Wolsey's IP, which we call LP1. We use the following notation: W = {w ∈ {0, 1, ∗}n wj = ∗ for exactly one value of j}. For w ∈ W , j(w) denotes the j ∈ N where wj = ∗. Further, w(0) and w(1) denote the extensions of w obtained from w by setting wj(w) to 0 and 1, respectively. For a ∈ {0, 1}n, j ∈ N, aj denotes the the partial assignment obtained from a by setting aj to ∗. We will rely on the following observation, which we call the Neighbor Property: Let T be a decision tree solving the SSSC problem. Given two assignments a, a′ ∈ {0, 1}n differing only in bit j, either T tests j on both input a and input a′, or on neither. 8 Min Pw∈W cj(w)p(w)xw s.t. Pj∈N gS,a(j)xaj ≥ Q − g(S, a) ∀a ∈ {0, 1}n, S ⊆ N xw ≥ 0 ∀w ∈ W Figure 2: LP1: the Linear Program for Lower Bounding Adaptive Dual Greedy Lemma 3. The optimal value of LP1 lower bounds the expected cost of an optimal decision tree T for the SSSC instance on g, p, and c. Proof. Let X be the assignment to the variables xw in the LP such that xw = 1 if T tests j on both assignments extending w, and xw = 0 otherwise. With respect to X, the expected cost of T equals Pa∈{0,1}n Pj cjxaj p(a). This equals the value of the objective function, because for a, a′ ∈ {0, 1}n differing only in bit j, P (a) + P (a′) = P (aj). Finally, for any fixed a ∈ {0, 1}n, the subset of constraints involving a, one for each S ⊆ N, is precisely the set of constraints of Wolsey's IP, if we take the utility function to be ga such that ga(S) = g(S, a). Since T produces a cover for every a, by Wolsey's property, the constraints of LP1 involving a are satisfied. Thus X is a feasible solution to LP1, and the optimal value of the LP is at most the expected cost of the optimal tree. We present the pseudocode for ADG in Algorithm 2. (In Step 5, assume that if E[gb(x)] = 0, the expression evaluates to 0.) Its main loop is analogous to the main loop in Fujito's Dual Greedy algorithm, except that ADG uses expected increases in utility, instead of known, deterministic increases in utility and the results of the tests performed on the items already in the cover. The quantity in Step 5 of ADG relies only on the outcomes of completed tests, so ADG can be executed in our stochastic setting. Max Pa∈{0,1}n PS⊆N p(a) (g(N, a) − g(S, a)) yS,a s.t. PS⊆N (1 − pj(w)) gS,w(0)(j) yS,w(0) + PS⊆N pj(w) gS,w(1)(j) yS,w(1) ≤ cj yS,a ≥ 0 ∀w ∈ W ∀S ⊆ N, a ∈ {0, 1}n Figure 3: LP2: the Linear Program for Adaptive Dual Greedy b ← (∗, ∗ . . . , ∗), yS ← 0 for all S ⊆ N F 0 = ∅, l ← 0 while b is not a solution to SSSC (g(b) < Q) do l ← l + 1 jl ← arg min j6∈F l−1 cj−PS:yS 6=0(E[gS,b(j)])yS E[gb(j)] cjl −PS:yS 6=0(E[gS,b(j)])yS E[gb(j)] yF l−1 ← k ← the state of jl F l ← F l−1 S{jl} bjl ← k end while return b // "test" jl // F l = dom(b) Algorithm 2: Adaptive Dual Greedy We now analyze Adaptive Dual Greedy. In the LP in Figure 2, there is a constraint for each a, S pair. Multiply both sides of such constraints by p(a), to form an equivalent LP. Take the dual of the result, and 9 divide both sides of each constraint by p(w). (Note that p(a)/p(w) = p(a, j(w)).) We give the resulting LP, which we call LP2, in Figure 3. The variables in it are yS,a, where S ⊆ N and a ∈ {0, 1}n. Consider running ADG on an input a ∈ {0, 1}n. Because g(a) = Q, ADG is guaranteed to terminate with an output b such that g(b) = Q. Let C(a) = dom(b). That is, C(a) is the set of items that ADG tests and inserts into the cover it constructs for a. We will sometimes treat C(a) as a sequence of items, ordered by their insertion order. ADG constructs an assignment to the variables yS (one for each S ⊆ N) when it is run on input a. Let Y be the assignment to the variables yS,a of LP2, such that YS,a is the value of ADG variable yS at the end of running ADG on input a. We now show that Y is a feasible solution to LP2 and that for each a, and each j ∈ C(a), Y makes the w(y) denote the function of the variables yS,a computed in the constraint for d = aj tight. For w ∈ W , let h′ left hand side of the constraint for w in LP2. Lemma 4. For every a ∈ {0, 1}n, j ∈ N , (1) h′ (2) h′ aj (Y ) = cj if j ∈ C(a), and aj (Y ) ≤ cj if j 6∈ C(a). Proof. Assignment Y assigns non-zero values only to variables yS,a where S is a prefix of sequence C(a). For t ∈ N, let Y t denote the assignment to the yS,a variables such that yS,a equals the value of variable yS at the end of iteration t of the loop in ADG, when ADG is run on input a. (If ADG terminates before iteration t, yS,a equals the final value of yS). Let Y 0 be the all 0's assignment. We begin by showing that for all t and a, h′ S,a. Recall that a(S) ∈ {0, 1, ∗}n such that ∀i ∈ S, a(S)i = ai, and ∀j /∈ S, a(S)j = ∗. aj (Y t) = PS⊆N E[ga(S)(j)]Y t Consider running ADG on w(0) and w(1). Since ADG corresponds to a decision tree, the Neighbor S,w(1) for all S,w(1) for all Property holds. Then, if j is never tested on w(0), it is never tested on w(1). and Y t S, t. Thus h′ t. S,w(0) = Y t S,w(1) = PS⊆N E[gS,w(j)]Y t w(Y t) = PS⊆N (pjgS,w(1)(j)) + (1 − pj )gS,w(0)(j))Y t Now suppose that j is tested in iteration t on input w(1), and hence on input w(0). For t ≤ t, Y t S,w(1) = S,w(0) for all S. This is not the case for t > t. However, in iterations t > t′, j is already part of the cover, Y t so ADG assigns values only to variables yS where j ∈ S. For such S, gS,w(1)(j) = 0. Thus in this case also, h′ w(Y t) = PS⊆N E[gS,w(j)]Y t S,w(1) for all t. It is now easy to show by induction on t that the the two properties of the lemma hold for every Y t, and hence for Y . They hold for Y 0. Assume they hold for Y t. Again consider assignments w(1) and w(0). If j was tested on w(1) and w(0) in some iteration t′ < t+1, then h′ aj (Y t+1) by the arguments above. If j is tested in iteration t + 1 on both inputs, then the value assigned to yF l−1 by ADG on w(1) (and w(0)) equals (cj − h′ w(Y t+1) = cj. If j is not tested in iteration t + 1, and was not tested earlier, the inductive assumption and the greedy choice criterion ensure that h′ w(Y t))/E[gF l−1,w(j)], and thus h′ aj (Y t) = h′ w(Y t+1) ≤ cj. The expected cost of the cover produced by ADG on a random input a is Pa∈{0,1}n Pj∈C(a) p(a)cj. Lemma 5. Pa∈{0,1}n Pj∈C(a) p(a)cj = Pa∈{0,1}n PS⊆N Pj:j∈C(a) p(a)gS,a(j)YS,a 10 p(w(1))cj + Xw∈Wj:j∈C(w(0)) p(w(1))cj + p(w(0))cj ) switching the order of summation p(w(0))cj ) grouping assignments by the value of bit j because j ∈ C(w(1)) iff j ∈ C(w(0)) by the Neighbor Property Proof. For j ∈ N, let W j = {w ∈ W wj = ∗}. Then p(a)cj p(a)cj p(w)cj Xa Xj:j∈C(a) = Xj Xa:j∈C(a) = Xj ( Xw∈Wj:j∈C(w(1)) = Xj ( Xw∈Wj:j∈C(w(1)) = Xj Xw∈Wj:j∈C(w(1)) = Xj Xw∈Wj:j∈C(w(1)) = Xj Xw∈Wj:j∈C(w(1)) = Xj Xw∈Wj:j∈C(w(1)) XS = Xj [( Xw∈Wj:j∈C(w(1)) XS because j ∈ C(w(1)) iff j ∈ C(w(0)) = Xj Xa:j∈C(a) XS = Xa XS Xj:j∈C(a) p(w)h′ w(Y ) (p(w) XS p(a)gS,a(j)YS,a p(a)gS,a(j)YS,a (pi gS,w(1)(j) YS,w(1) + (1 − pi) gS,w(0)(j) YS,w(0))) (p(w(1)) gS,w(1)(j) YS,w(1) + p(w(0))gS,w(0)(j)YS,w(0)) p(w(1))gS,w(1)(j)YS,w(1)) + ( Xw∈Wj:j∈C(w(0)) XS p(w(0))gS,w(0)YS,w(0))] by Lemma 4 by the definition of h′ w We now give our approximation bound for ADG. Theorem 4. Given an instance of SSSC with utility function g and goal value Q, ADG constructs a cover whose expected cost is no more than a factor of α larger than the expected cost of the cover produced , with the max taken over all a ∈ {0, 1}n and by the optimal strategy, where α = max S ∈ Pref(C(a)) such that the denominator is non-zero. Here Pref(C(a)) denotes the set of all prefixes of the cover C(a) that ADG constructs on input a. Pj∈C(a) gS,a(j) Q−g(S,a) Proof. By Lemma 5, the expected cost of the cover constructed by ADG is Pa PS Pj:j∈C(a) p(a)gS,a(j)YS,a. The value of the objective function of LP2 on Y is Pa PS p(a) (Q − g(S, a)) YS,a. For any a, YS,a is non- zero if S ∈ Pref(C(a)). Comparing the coefficients of YS,a in these two expressions implies that the value of the objective function on Y is at most max times the expected cost of the cover. The theorem follows by Lemma 3 and weak duality. Pj∈C(a) gS,a(j) Q−g(S,a) Theorem 5. There is a polynomial-time 3-approximation algorithm solving SBFE problem for linear thresh- old formulas with integer coefficients. Proof. We modify the linear threshold evaluation algorithm from Section 4.2, substituting ADG for Adap- tive Greedy. By Theorem 4, the resulting algorithm is within a factor of α of optimal. We now show that α ≤ 3 in this case. Fix x and consider the run of ADG on x. Let T be the number of loop iterations. So C(x) = j1, . . . , jT is the sequence of tested items, and F t = {j1, . . . , jt}. Assume first that f (x) = 1. Let F = F 0 = ∅, and consider the ratio Pj∈C(x) gF,x(j) . Q−g(F,x) 11 We use the definitions and utility functions from the algorithm in Section 4.2. Assume without loss of generality that neither g0 nor g1 is identically 0. Let A = −Rmin and let B = Rmax + 1. Thus Q − g(∅, x) = AB. Let C1 be the set of items jl in C(x) such that either xjl = 1 and ajl ≥ 0 or xjl = 0 and ajl < 0. Similarly, let C0 be the set of items jl in C(x), such that either xjl = 0 and ajl ≥ 0 or xjl = 1 and ajl < 0. Testing stops as soon as the goal utility is reached. Since f (x) = 1, this means testing on x stops when b satisfies g1(b) = Q1, or equivalently, b is a 1-certificate of f . Thus the last tested item, jT , is in C1. Further, the sum of the ajlxjl over all jl ∈ C1(x), excluding jT , is less than −Rmin, while the sum including jT is greater than or equal to −Rmin. By the definition of utility function g, Pjl∈C1:jl6=jT g∅,x(jl) < AB. The maximum possible value of g∅,x(jT ) is AB. Therefore, Pjl∈C1 Since x does not contain both a 0-certificate and a 1-certificate of f , the sum of the ajlxjl over all g∅,x(jl) < AB. Summing over Q−g(F,x) < 3, because for F = ∅, jl ∈ C0(x) is strictly less than Rmax. Thus by the definition of g, Pjl∈C0 all jl ∈ C(x), we get that Pjl∈C(x) g∅,x(jl) < 3AB. Therefore, Pj∈C(x) gF,x(j) Q = AB and g(∅, x) = 0. A symmetric argument holds when f (x) = 0. g∅,x(jl) < 2AB. It remains to show that the same bound holds when F 6= ∅. We reduce this to the case F = ∅. Once we have tested the variables in F t, we have an induced linear threshold evaluation problem on the remaining variables (replacing the tested variables by their values). Let g′ and Q′ be the utility function and goal value for the induced problem, as constructed in the algorithm of Section 4.2. The ratio Pj∈C(x) gF,x(j) is equal Q−g(F,x) Pj∈C(x)−F g′ to bounded by 3. Q′−g′(∅,x′) ∅,x′ (j) , where x′ is x restricted to the elements not in F . By the argument above, this ratio is 6 A new bound for Adaptive Greedy We give a new analysis of the Adaptive Greedy algorithm of Golovin and Krause, whose pseudocode we presented in Algorithm 1. Throughout this section, we let g(j) = maxl∈{0,1} gr(j, l) where r = (∗, . . . , ∗). Thus g(j) is the maximum increase in utility that can be obtained as a result of testing j (since g is submod- ular). We show that the expected cost of the solution computed by Adaptive Greedy is within a factor of 2(ln(maxi∈N g(i) + 1)) of optimal in the binary case. In the k-ary case, the 2 in the bound is replaced by k. Note that maxj g(j) is clearly upper bounded by Q, and in some instances may be much less than Q. However, because of the factor of k at the front of our bound, we cannot say that it is strictly better than the (ln Q + 1) bound of Golovin and Krause. (The bound that is analogous to ours in the non-adaptive case, proved by Wolsey, does not have a factor of 2.) Adaptive Greedy is a natural extension of the Greedy algorithm for (deterministic) submodular set cover of Wolsey. We will extend Wolsey's analysis [39], as it was presented by Fujito [16]. In our analysis, we will refer to LP2 defined in Section 5, along with the associated notation for the constraints h′ aj (y) ≤ cj. For x ∈ {0, 1}n, let T x be the number of iterations of the Adaptive Greedy while loop on input x. Let bt x denote the value of b at the end of iteration t of the while loop on input x, and let F t x denote the value of F t, where F t is the set of js tested by the end of the t + 1st iteration. (The x in the notation may be dropped when it is understood implicitly.) Set θt cj x = minj /∈F t−1 For j ∈ N, let kj be the value of t that maximizes (θt maximizes (θt r denote the assignment {∗, . . . , ∗}, and let H 1 j = H(gr(j, 1)) and H 0 the nth harmonic number, which is at most (ln n + 1). Let qj = 1 − pj. x (j, 1)). Similarly, let lj be the value of t that (j, 0)), where x′ is the assignment obtained from x by complementing xj. Again, let j = H(gr(j, 0)), where H(n) denotes x′)(gbt−1 x′ To analyze Adaptive Greedy, we define Y to be the assignment to the LP2 variables yS,x setting yF 0,x = x) for t ∈ {1 . . . T x − 1} and yS,x = 0 for all other S. We define Y x to be the x, yF t,x = (θt+1 θ1 restriction of that assignment to variables yS,x for that x. Let qx(y) = PS⊂N gS,x(N − S)yx S. x − θt E[gbt−1(j)] . x)(gbt 12 Lemma 6. The expected cost of the cover constructed by Adaptive Greedy is at most E[qx(Y x)], where the expectation is with respect to x ∼ Dp. Proof. By the definition of Y x, the proof follows directly from the analysis of (non-adaptive) Greedy in Theorem 1 of [16], by linearity of expectation. We need to bound the value of h′ w(Y ) for each w ∈ W . We will use the following lemma from Wolsey's analysis. Lemma 7. [39] Given two sequences (α(t))T t=0 , such that both are nonnegative, the former is monotonically nondecreasing and the latter, monotonically non-increasing, and β(t) is a nonnegative integer for any value of t, then t=1 and (β(t))T −1 α(1)β(0) + (α(2) − α(1))β(1) + . . . + (α(T ) − α(T −1))β(T −1) ≤ ( max 1≤t≤T α(t)β(t−1)H(β(0))). Lemma 8. For every x ∈ {0, 1}n and j ∈ {1, . . . , N }, h′ xj (Y ) ≤ cj2H(maxi∈N g(i)). Proof. By the submodularity of g, and the greedy choice criterion used by Adaptive Greedy, θ1 θT x x . By the submodularity of g, gb0 x, . . . θT x x and the non-increasing sequence g0 decreasing sequence θ1 bx This also holds if we substitute (j, 1) for (j, 0) in the second sequence. x . . . ≤ (j, 0). Thus Lemma 7 applies to the non- (j, 0). (j, 0), . . . , gT x−1 (j, 0) . . . ≥ gbT x (j, 0), . . . , g1 bx (j, 0) ≥ gb1 x ≤ θ2 x, θ2 bx x x x Let x′ be the assignment differing from x only in bit j. In the following displayed equations, we write k and l in place of kj and lj to simplify the notation. h′ xj (Y ) = X S⊆N (pjgS,x(j) + (1 − pj)gS,x′(j))YS,x by the Neighbor Property, by the same argument as used in the analysis of ADG = pj[θ1 xgb0 x (j, 1) + ΣT x i=2(θi )gbi−1 x (j, 1)] + qj[θ1 x′gb0 x′ ≤ pj[θk xgbk−1 x ≤ pj[θk xgbk−1 x (j, 1)H 1 (j, 1)H 1 x x − θi−1 lgbl−1 x′ xgbk−1 j ] + qj[θx′ j ] + qj[θk x (j, 0)H 0 j ] j ] + pj[θl (j, 0)H 0 (j, 0) + ΣT x′ x′ − θi−1 i=2(θi by Lemma 7 as indicated above x′ )gbi−1 x′ (j, 0)] x′gbl−1 x′ (j, 1)H 1 j ] + qj[θl x′gbl−1 x′ (j, 0)H 0 j ] (j, 1) + qjgbk−1 x (j, 0)] + θl x′H 0 j [qjgbl−1 x′ (j, 0) + pjgbl−1 x′ due to the greedy choices made by Algorithm 1 (j, 1)] since this just adds extra non-negative terms x = θk xH 1 j [pjgbk−1 j + cjH 0 ≤ cjH 1 j ≤ cj2H(g(j))) ≤ cj2H(max i g(i))) Theorem 6. Given an instance of SSSC with utility function g, Adaptive Greedy constructs a decision tree whose expected cost is no more than a factor of 2(maxi∈N (ln g(i)) + 1) larger than the expected cost of the cover produced by the optimal strategy. 13 Proof. Let OP T be the expected cost of the cover produced by the optimal strategy. let AGCOST be the expected cost of the cover produced by Adaptive Greedy, and let q(y) denote the objective function of LP2. By Lemma 3, the optimal value of LP1 is a lower bound on OPT. By Lemma 8, Z = Y /(2H(maxi g(i))) is a feasible solution to LP2. Thus by weak duality, q(Z) ≤ OP T . By Lemma 6, AGCOST ≤ E[qx(Y x)], and it is easy to see that E[qx(Y x)] = q(Y ). Since q(Y ) = q(Z)(2H(maxi g(i))), AGCOST ≤ OP T (2H(maxi g(i))). 7 Simultaneous Evaluation and Ranking Let f1, . . . , fm be (representations of) Boolean functions from a class C, such that each fi : {0, 1}n → {0, 1}. We consider the generalization of the SBFE problem where instead of determining the value of a single function f on an input x, we need to determine the value of all m functions fi on the same input x. The Q-value approach can be easily extended to this problem by constructing utility functions for each of the fi, and combining them using the conjuctive construction in Lemma 1. The algorithm of Golovin and Krause for simultaneous evaluation of OR formulas follows this approach [18] (Liu et al. presented a similar algorithm earlier, using a different analysis [30].) We can also modify the approach by calculating a bound based on P -value, or using ADG instead of Adaptive Greedy. We thus obtain the following theorem, where Pn Theorem 7. There is a polynomial-time algorithm for solving the simultaneous evaluation of linear thresh- old formulas problem which produces a solution that is within a factor of O(log mDavg) of optimal where Davg, is the average, over k ∈ {1, . . . , m}, of Pn i=1 aki. In the special case of OR formulas, where each variable appears in at most r of them, the algorithm achieves an approximation factor of 2(ln(βmaxr) + 1), where βmax is the maximum number of variables in any of the OR formulas. i=1 akixi ≤ θk. is the kth threshold formula. There is also a polynomial-time algorithm for solving the simultaneous evaluation of threshold for- mulas problem which produces a solution that is within a factor of Dmax of optimal, where Dmax = maxk∈{1,...,m} Pn Proof. Let g(1), . . . , g(m) be the m utility functions that would be constructed if we ran the algorithm from Section 4.2 separately on each of the m threshold formulas that need to be evaluated. Let Q(1), . . . , Q(m) be the associated goal values. i=1 aki. Pm Using the conjunctive construction from Lemma 1, we construct utility function g such that g(b) = k=1 g(k)(b), and Q = Pm To obtain the first algorithm, we evaluate all the threshold formulas by running Adaptive Greedy with g, goal value Q, and the given p, and c, until it outputs a cover b. Given cover b, it is easy to determine for each fk whether fk(x) = 1 or fk(x) = 0. k=1 Q(k). In the algorithm of Section 4.2, for each fk, the associated Qk = O(Dk), where Dk is the sum of the absolute values of the coefficients in fk. Since Q = Pk Qk, the O(log(mDavg)) bound follows from the (ln Q + 1) bound for Adaptive Greedy. Suppose each threshold formula is an OR formula. For b ∈ {0, 1, ∗}n, maxl∈{0,1} g(k) (i, l) = 0 if xj does not appear in the kth OR formula, otherwise it is equal to the number of variables in that formula. The 2(ln(βmaxr) + 1) approximation factor then follows by our bound on Adaptive Greedy in Theorem 6. b For the second algorithm, we just use ADG instead of Adaptive Greedy with the same utility function g. By Theorem 4, the approximation factor achieved by ADG is max Pj gS,x(j) Q−g(S,x) . We bound this ratio for g. Let Dj = Pn i=1 aji. Let d ∈ {0, 1}n and S ∈ F (x). Without loss of generality, assume S = {n′ + 1, . . . , n}. In the kth threshold formula, for i ≥ n′, replace xi with di. This induces a new threshold formula on n − n′ variables with threshold θk,d = θk − Dk,d whose coefficients sum to Dk,b = Dk − Pn i=n′ aidi. Let b be the partial assignment such that bi = di for i ≥ n′, and bi = ∗ otherwise. If b contains either a 0-certificate or a 1-certificate for fk, then Qk − gk(S, d) = 0. 14 Otherwise, Qk − g(S, d) = (θk,b)(Dk,b − θk,b + 1), and Pj gk S,d(j) ≤ Dk,b max{θ, Dk,b − θk,b + 1}. It follows that Pj gk S,d(j) Qk−gk(S,d) ≤ Dk,b ≤ Dmax. Since this holds for each k, max Pj gS,d(j) Q−g(S,d) ≤ Dmax. For the special case of simultaneous evaluation of OR formulas, the theorem implies a β-approximation algorithm, where β is the length of the largest OR formula. This improves the 2β-approximation achieved by the randomized algorithm of Liu et al. [30]. We use a similar approach to solve the Linear Function Ranking problem. In this problem, you are given a system of linear functions f1, . . . , fm, where for j ∈ {1, . . . , m}, fj is aj1x1 + aj2x2 + . . . ajnxn, and the coefficients aji are integers. You would like to determine the sorted order of the values f1(x), . . . , fm(x), for an initially unknown x ∈ {0, 1}n. (Note that the values of the fj(x) are not Boolean.) We consider the problem of finding an optimal testing strategy for this problem, where as usual, x ∼ Dp, for some probability vector p, and there is a cost vector c specifying the cost of testing each variable xi. Note that there may be more than one correct output for this problem if there are ties. So, strictly speak- ing, this is not a function evaluation problem. Nevertheless, we can still exploit our previous techniques. For each system of linear equations f1, . . . , fm over x1, . . . , xn, and each x ∈ {0, 1}n, let f (x) denote the set of permutations {fj1, fj2, . . . , fjm} of f1, . . . , fm such that fj1(x) ≤ fj2(x) ≤ . . . ≤ fjm(x). The goal of sorting the fj is to output some permutation that we know definitively to be in f (x). Note that in particular, if e.g., fi(x) < fj(x), it may be enough for us to determine that fi(x) ≤ fj(x). Theorem 8. There is an algorithm that solves the Linear Function Ranking problem that runs in time polynomial in m, n, and Dmax, and achieves an approximation factor that is within O(log(mDmax)) of optimal, where Dmax is the maximum value of Pn Proof. For each pair of linear equations fi and fj in the system, where i < j, let fij denote the linear function fi − fj. We construct a utility function g(ij) with goal value Q(ij). Intuitively, the goal value of g(ij) is reached when there is enough information to determine that fij(x) ≥ 0, or when there is enough information to determine that fij(x) ≤ 0. i=1 aji over all the functions fj. The construction of g(ij) is very similar to the construction of the utility function in our first threshold evaluation algorithm. For each i, j pair, let minij(b) be the minimum value of fij(b′) on any assignment b′ ∈ {0, 1}n such that b′ ∼ b, and let maxij(b) be the maximum value. Let Rmax(ij) = maxij(∗, . . . , ∗) and let Rmin(ij) = minij(∗, . . . , ∗). Let g(ij) < : {0, 1, ∗}n → Z≥0, be defined as follows. If Rmax(ij) ≤ 0, then g(ij) < (b) = 0 for all b ∈ < (b) = min{Rmax(ij), Rmax(ij) −maxij(b)} < = Rmax(ij). It follows that for b ∈ {0, 1, ∗}n, fi(b′) ≤ fj(b′) for all extensions b′ ∼ b iff < = 0. Otherwise, for b ∈ {0, 1, ∗}n, let g(ij) {0, 1, ∗}n and Q(ij) and Q(ij) < (b) = Q(ij) g(ij) < . Q(ij) > . We define g(ij) > and Q(ij) < symmetrically, so that fi(b′) ≥ fj(b′) for all extensions b′ ∼ b iff g(ij) > (b) = We apply the disjunctive construction of Lemma 1 to combine g(ij) < and their associated goal values. Let the resulting new utility function be g(ij) and let its goal value be Q(ij). As in the analysis of the algorithm in Section 4.2, we can show that Q(ij) is O(D2), where D is the sum of the magnitudes of the coefficients in fij. > and g(ij) Using the AND construction of Lemma 1 to combine the g(ij) we get our final utility function g = Pi<j g(ij) with goal value Q = Pi<j Q(ij). We now show that achieving the goal utility Q is equivalent to having enough information to do the ranking. Until the goal value is reached, there is still a pair i, j such that it remains possible that fi(x) > 15 fj(x) (under one setting of the untested variables), and it remains possible that fj(x) < fi(x) (under another setting). In this situation, we do not have enough information to output a ranking we know to be valid. Once g(b) = Q, the situation changes. For each i, j such that fi(x) < fj(x), we know that fi(x) ≤ fj(x). Similarly, if fi(x) > fj(x), then at goal utility Q, we know that fi(x) ≥ fj(x). If fi(x) = fj(x) at goal utility Q, we may only know that fi(x) ≥ fj(x) or that fi(x) ≤ fj(x). We build a valid ranking from this knowledge as follows. If there exists an i such that we know that fi(x) ≤ fj(x) for all j 6= i, then we place fi(x) first in our ranking, and recursively rank the other elements. Otherwise, we can easily find a "directed cycle," i.e. a sequence i1, . . . , im, m ≥ 2, such that we know that fi1(x) ≤ fi2(x) ≤ . . . ≤ fim(x) and fim(x) ≤ fi1(x). It follows that fi1(x) = . . . = fim(x). In this case, we can delete fi2, . . . , fim, recursively rank fi1 and the remaining fi, and then insert fi2, . . . , fm into the ranking next to fi1. Applying Adaptive Greedy to solve the SSSC problem for g, the theorem follows from the (ln Q + 1) approximation bound for Adaptive Greedy, and the fact that Q = O(D2 maxm2). 8 Acknowledgments Lisa Hellerstein was partially supported by NSF Grants 1217968 and 0917153. Devorah Kletenik was par- tially supported by NSF Grant 0917153 and by US Department of Education GAANN Grant P200A090157. Amol Deshpande was partially supported by NSF Grants 0916736 and 1218367. We would like to thank Tonguc¸ Unluyurt and Sarah Allen for their helpful feedback on earlier versions this paper, and Sarah Allen for preparing a notation summary. We thank an anonymous referee for suggesting a way to simplify the orig- inal analysis of ADG. Lisa Hellerstein would like to thank Endre Boros, Kazuhisa Makino, and Vladimir Gurvich for a stimulating discussion at RUTCOR. References [1] M. Adler and B. Heeringa. Approximating optimal binary decision trees. Algorithmica, 62(3-4):1112 -- 1121, 2012. [2] A. Bar-Noy, M. Bellare, M. M. Halld´orsson, H. Shachnai, and T. Tamir. On chromatic sums and distributed resource allocation. Inf. Comput., 140(2):183 -- 202, February 1998. [3] G. Bellala, S. Bhavnani, and C. Scott. Group-based active query selection for rapid diagnosis in time- critical situations. IEEE Trans. on Information Theory, 2012. [4] Y. Ben-Dov. Optimal testing procedure for special structures of coherent systems. Management Sci- ence, 1981. [5] P. Beraldi and A. Ruszczynski. The probabilistic set-covering problem. Operations Research, 50(6):956 -- 967, 2002. [6] E. Boros and T. Unluyurt. Diagnosing double regular systems. Annals of Mathematics and Artificial Intelligence, 26(1-4):171 -- 191, September 1999. [7] E. Boros, T. Unluyurt, et al. Sequential testing of series-parallel systems of small depth. Computing Tools for Modeling, Optimization and Simulation, pages 39 -- 74, 2000. [8] R. Carr, L. Fleischer, V. Leung, and C. Phillips. Strengthening integrality gaps for capacitated network design and covering problems. In SODA, 2000. [9] M.-F. Chang, W. Shi, and W. K. Fuchs. Optimal diagnosis procedures for k-out-of-n structures. IEEE Trans. Comput., 39(4), April 1990. [10] M. Charikar, R. Fagin, V. Guruswami, J. M. Kleinberg, P. Raghavan, and A. Sahai. Query strategies for priced information. J. Comput. Syst. Sci., 64(4):785 -- 819, 2002. 16 [11] L. Cox, Y. Qiu, and W. Kuehner. Heuristic least-cost computation of discrete classification functions with uncertain argument values. Annals of Operations Research, 21:1 -- 29, 1989. [12] A. Deshpande and L. Hellerstein. Flow algorithms for parallel query optimization. In ICDE, 2008. [13] U. Feige, L. Lov´asz, and P. Tetali. Approximating min-sum set cover. In Proceedings of the 5th International Workshop on Approximation Algorithms for Combinatorial Optimization, APPROX '02, pages 94 -- 107, London, UK, UK, 2002. Springer-Verlag. [14] A. Fiat and D. Pechyony. Decision trees: More theoretical justification for practical algorithms. In ALT, 2004. [15] T. Fujito. On approximation of the submodular set cover problem. Operations Research Letters, 1999. [16] T. Fujito. Approximation algorithms for submodular set cover with applications. IEICE Trans. Inf. Syst, 83, 2000. [17] M. Garey. Optimal task scheduling with precedence constraints. Discrete Mathematics, 4:37 -- 56, 1973. [18] D. Golovin and A. Krause. Adaptive submodularity: Theory and applications in active learning and stochastic optimization. J. Artif. Intell. Res., 2011. [19] D. Golovin, A. Krause, and D. Ray. Near-optimal Bayesian active learning with noisy observations. In NIPS, pages 766 -- 774, 2010. [20] R. Greiner, R. Hayward, M. Jankowska, and M. Molloy. Finding optimal satisficing strategies for and-or trees. Artif. Intell., 170(1):19 -- 58, 2006. [21] R. Greiner, R. Hayward, and M. Molloy. Optimal depth-first strategies for and-or trees. In AAAI/IAAI, pages 725 -- 730, 2002. [22] D. Guijarro, V. Lav´ın, and V. Raghavan. Exact learning when irrelevant variables abound. In Euro- COLT, 1999. [23] A. Guillory and J. Bilmes. Simultaneous learning and covering with adversarial noise. In ICML, 2011. [24] X. Han and K. Makino. Online minimization knapsack problem. In E. Bampis and K. Jansen, editors, Approximation and Online Algorithms, 7th International Workshop, WAOA 2009, Copenhagen, Den- mark, September 10-11, 2009. Revised Papers, volume 5893 of Lecture Notes in Computer Science, pages 182 -- 193. Springer, 2010. [25] J. Hastad. On the size of weights for threshold gates. SIAM Journal on Discrete Mathematics, 1994. [26] T. Ibaraki and T. Kameda. On the optimal nesting order for computing n-relational joins. ACM Trans. Database Syst., 9(3):482 -- 502, 1984. [27] S. Iwata and K. Nagano. Submodular function minimization under covering constraints. In FOCS, 2009. [28] H. Kaplan, E. Kushilevitz, and Y. Mansour. Learning with attribute costs. In STOC, pages 356 -- 365, 2005. [29] R. Krishnamurthy, H. Boral, and C. Zaniolo. Optimization of nonrecursive queries. In VLDB, 1986. [30] Z. Liu, S. Parthasarathy, A. Ranganathan, and H. Yang. Near-optimal algorithms for shared filter evaluation in data stream systems. In SIGMOD, 2008. 17 [31] M. Moshkov. Approximate algorithm for minimization of decision tree depth. In G. Wang, Q. Liu, Y. Yao, and A. Skowron, editors, Rough Sets, Fuzzy Sets, Data Mining, and Granular Computing, volume 2639 of Lecture Notes in Computer Science, pages 579 -- 579. Springer Berlin / Heidelberg, 2003. [32] M. Moshkov and I. Chikalov. Bounds on average weighted depth of decision trees. Fundam. Inform., 31(2):145 -- 156, 1997. [33] K. Munagala, S. Babu, R. Motwani, and J. Widom. The pipelined set cover problem. In ICDT, 2005. [34] S. Nijssen and E. Fromont. Mining optimal decision trees from itemset lattices. In KDD, 2007. [35] S. Salloum. Optimal testing algorithms for symmetric coherent systems. PhD thesis, University of Southern California, 1979. [36] S. Salloum and M. Breuer. An optimum testing algorithm for some symmetric coherent systems. Journal of Mathematical Analysis and Applications, 101(1):170 -- 194, 1984. [37] U. Srivastava, K. Munagala, J. Widom, and R. Motwani. Query optimization over web services. In VLDB, 2006. [38] T. Unluyurt. Sequential testing of complex systems: a review. Discrete Applied Mathematics, 142(1- 3):189 -- 205, 2004. [39] L. Wolsey. An analysis of the greedy algorithm for the submodular set covering problem. Combina- torica, 2:385 -- 393, 1982. 10.1007/BF02579435. 18 A Table of notation xi pi ci p c b dom(b) a ∼ b Dp x ∼ Dp Q P g N S g(S, b) gS,b(j) bxi←l k d m min(b) max(b) Rmin Rmax W w(0), w(1) j(w) aj a′ ga(S) yS,a C(a) YS,a h′ w(y) Y t T x bt x Y x qx(y) F t g(j) the ith variable probability that variable xi is 1 cost of testing xi the probability product vector (p1, p2, . . . , pn) the cost vector (c1, c2, . . . , cn) a partial assignment, an element of {0, 1, ∗}n {bibi 6= ∗}, the set of variables of b that have already been tested a extends b (is identical to b for all variables i such that bi 6= ∗) product distribution, defined by p a random x drawn from distribution Dp goal utility maximum utility that testing a single variable xi can contribute utility function defined on partial assignments with a value in {0, . . . , Q} the set {1, . . . , n} a subset of N utility of testing only the items in S, with outcomes specified by b g(S ∪ {j}, b) − g(S, b) b extended by testing variable i with outcome l number of clauses in a CNF number of terms in a DNF the number of linear threshold formulas in the simultaneous evaluation problem the minimum possible value of the linear threshold function for any extension of b symmetric to min(b), but maximum min(∗, . . . , ∗) max(∗, . . . , ∗) the set of partial assignments that contain exactly one ∗ for w ∈ W , the extensions obtained from w by setting the ∗ to 0 and 1, respectively for w ∈ W , the j for which wj = ∗ the partial assignment produced from a by setting the jth bit to ∗ for assignment a the assignment produced from a by complementing the jth bit g(S, a) the variable in LP2 for SSC associated with subset S and assignment a the sequence of items tested by ADG on assignment a, in order of testing the value of ADG variable yS after running ADG on input a the left hand side of the constraint in LP2 for w (a function of the yS,a variables) assignment to the yS,a variables s.t. yS,a is the value of ADG variable yS at the end of iteration t of its while loop, when ADG is run on input a the number of iterations of the Adaptive Greedy (AG) while loop on input x the value of b on input x after the tth iteration of the loop of AG on x the assignment to the LP2 variables used in the analysis of the new bound for AG PS⊂N gS,x(N − S)yx variable of ADG, the set containing the first t variables it tests equals maxl∈{0,1} gr(j, l) where r = (∗, . . . , ∗), in analysis of Adaptive Greedy S 19
1607.03961
3
1607
2017-03-26T12:43:59
Deleting and Testing Forbidden Patterns in Multi-Dimensional Arrays
[ "cs.DS", "cs.CV" ]
Understanding the local behaviour of structured multi-dimensional data is a fundamental problem in various areas of computer science. As the amount of data is often huge, it is desirable to obtain sublinear time algorithms, and specifically property testers, to understand local properties of the data. We focus on the natural local problem of testing pattern freeness: given a large $d$-dimensional array $A$ and a fixed $d$-dimensional pattern $P$ over a finite alphabet, we say that $A$ is $P$-free if it does not contain a copy of the forbidden pattern $P$ as a consecutive subarray. The distance of $A$ to $P$-freeness is the fraction of entries of $A$ that need to be modified to make it $P$-free. For any $\epsilon \in [0,1]$ and any large enough pattern $P$ over any alphabet, other than a very small set of exceptional patterns, we design a tolerant tester that distinguishes between the case that the distance is at least $\epsilon$ and the case that it is at most $a_d \epsilon$, with query complexity and running time $c_d \epsilon^{-1}$, where $a_d < 1$ and $c_d$ depend only on $d$. To analyze the testers we establish several combinatorial results, including the following $d$-dimensional modification lemma, which might be of independent interest: for any large enough pattern $P$ over any alphabet (excluding a small set of exceptional patterns for the binary case), and any array $A$ containing a copy of $P$, one can delete this copy by modifying one of its locations without creating new $P$-copies in $A$. Our results address an open question of Fischer and Newman, who asked whether there exist efficient testers for properties related to tight substructures in multi-dimensional structured data. They serve as a first step towards a general understanding of local properties of multi-dimensional arrays, as any such property can be characterized by a fixed family of forbidden patterns.
cs.DS
cs
Deleting and Testing Forbidden Patterns in Multi-Dimensional Arrays Omri Ben-Eliezer∗ Simon Korman† Daniel Reichman‡ August 15, 2018 Abstract Understanding the local behaviour of structured multi-dimensional data is a fundamental problem in various areas of computer science. As the amount of data is often huge, it is desirable to obtain sublinear time algorithms, and specifically property testers, to understand local properties of the data. We focus on the natural local problem of testing pattern freeness: given a large d-dimensional array A and a fixed d-dimensional pattern P over a finite alphabet Γ, we say that A is P -free if it does not contain a copy of the forbidden pattern P as a consecutive subarray. The distance of A to P -freeness is the fraction its entries that need to be modified to make it P -free. For any  ∈ [0, 1] and any large enough pattern P -- other than a very small set of exceptional patterns -- we design a tolerant tester that distinguishes between the case that the distance is at least  and the case that it is at most ad, with query complexity and running time cd−1, where ad < 1 and cd depend only on the dimension d. For the 1-dimensional case, we provide a linear time algorithm for computing the distance from P -freeness. To analyze the testers we establish several combinatorial results, including the following d- dimensional modification lemma, which might be of independent interest: for any large enough d-dimensional pattern P over any alphabet (excluding a small set of exceptional patterns for the binary case), and any d-dimensional array A containing a copy of P , one can delete this copy by modifying one of its locations without creating new P -copies in A. Our results address an open question of Fischer and Newman, who asked whether there exist efficient testers for properties related to tight substructures in multi-dimensional structured data. They serve as a first step towards a general understanding of local properties of multi- dimensional arrays. 1 Introduction Pattern matching is the algorithmic problem of finding occurrences of a fixed pattern in a given string. This problem appears in many settings and has applications in diverse domains such as computational biology, computer vision, natural language processing and web search. There has been extensive research concerned with developing algorithms that search for patterns in strings, resulting with a wide range of efficient algorithms [13, 26, 21, 15, 28, 27]. Higher-dimensional analogues where one searches for a d-dimensional pattern in a d-dimensional array have received ∗Blavatnik School of Computer Science, Tel Aviv University, Tel Aviv, Israel [email protected] †Computer Science Department, University of California at Los-Angeles [email protected] ‡Electrical Engineering and Computer Science, University of California at Berkeley [email protected] 1 attention as well. For example, the 2D case arises in analyzing aerial photographs [7, 8] and the 3D case has applications in medical imaging. Given a string S of length n and a pattern P of length k ≤ n, any algorithm which determines whether P occurs in S has running time Ω(n) [14, 31] and a linear lower bound carries over to higher dimensions. For the 2D and 3D case, when an n × n image is concerned, algorithms whose run time is O(n2) are known [8]. These algorithms have been generalized to the 3D case to yield running time of O(n3) [20]. Finally it is also known (e.g., [23]) that for the d-dimensional case it is possible to solve the pattern matching problem in time O(d2nd log m) (where the pattern is an array of size md). It is natural to ask which tasks of this type can be performed in sublinear (namely o(nd)) time for d-dimensional arrays. The field of property testing [22, 32] deals with decision problems regarding discrete objects (e.g., graphs, functions, images) that either have a certain property P or are far from satisfying P . Here, we are interested in deciding quickly whether a given d-dimensional array A is far from not containing a fixed d-dimensional pattern P . Tolerant property testing [29] is a useful extension of the standard notion, in which the tester needs to distinguish between objects that are close to satisfying the property to those that are far from satisfying it. A d-dimensional k1× . . .× kd array A over an alphabet Γ is a function from [k1]× . . .× [kd] to Γ. For simplicity of presentation, all results in this paper will be presented for cubic arrays in which k1 = . . . = kd, but they generalize to non-cubic arrays in a straightforward manner. We consider the (tolerant) pattern-freeness problem where one needs to distinguish between the case that a given d-dimensional array A is 1-close to being P -free for a fixed pattern P , and the case that A is 2-far from being P -free, where 1 < 2. An (1, 2)-tester Q for this problem is a randomized algorithm that is given access to an array A, as well as its size and proximity parameters 0 ≤ 1 < 2 < 1. Q needs to distinguish with probability at least 2/3 between the case that A is is 1-close to being P -free and the case that A is 2-far from being P -free. The query complexity of Q is the number of queries it makes in A. Our interest in the pattern-freeness problem stems from several applications. In certain scenarios of interest, we might be interested in identifying quickly that an array is far from not containing a given pattern. For the one dimensional case, being far from not containing a given text may indicate a potential anomaly which requires attention (e.g., an offensive word in social network media), hence such testing algorithms may provide useful in anomaly detection. Many computer vision methods for classifying images are feature based: hence being far from containing a certain pattern associated with a feature may be useful in rejection methods that enable to quickly discard images that do not possess a certain visual property. Beyond practical applications, devising property testing algorithms for the pattern freeness problem is of theoretical interest. In the first place, it leads to a combinatorial characterization of the distance from being P -free. Such a characterization has proved fruitful in graph property testing [3, 4] where celebrated graph removal lemmas were developed en route of devising algorithms for testing subgraph freeness. We encounter a similar phenomena in studying patterns and arrays: at the core of our approach for testing pattern freeness lies a modification lemma for patterns which we state next. We believe that this Lemma may be of independent interest and find applications beyond testing algorithms. Later we show one such application: computing the exact distance of a (one dimensional) string from being P -free can be done in linear time. For a pattern P of size k × k × . . . × k, any of its entries that is in {0, k − 1} × . . . × {0, k − 1} is said to be a corner of P . We say that P is almost homogeneous if all of its entries but one are 2 equal, and the different entry lies in a corner of P . Finally, P is removable (with respect to the alphabet Γ) if for any d-dimensional array A over Γ and any copy of P in A, one can destroy the copy by modifying one of its entries without creating new P -copies in A. The modification lemma states that for any d, and any large enough pattern P , when the alphabet is binary it holds that P is removable if and only if it is not almost homogeneous, and when the alphabet is not binary, P is removable provided that it is large enough. Recent works [11, 12] have obtained tolerant testers for visual properties. As observed in [11, 12], tolerance is an attractive property for testing visual properties as real-world images are often noisy. With the modification Lemma at hand, we show that when P is removable, the (relative) hitting number of P in A, which is the minimal size of a set of entries that intersects all P -copies in A divided by A, differs from the distance of A from P -freeness by a multiplicative factor that depends only on d (and not on P or A). This relation allows us to devise very fast (5−d, )-tolerant testers for P -freeness, as the hitting number of P in A can be well approximated using only a very small sample of blocks of entries from A. The query complexity of our tester is O(Cd/), where Cd is a positive constant depending only on the dimension d of the array. Note that our characterization in terms of the hitting number is crucial: merely building on the fact that A contains many occurrences of P (as can be derived directly from the modification lemma) and randomly sampling O(1/) possible locations in A, checking whether the sub-array starting at these locations equals P would lead to query complexity of O(kd/). Note that our tester is optimal (up to a multiplicative factor that depends on d), as any tester for this problem makes Ω(1/) queries. The one dimensional setting, where one seeks to determine quickly whether a string S is -far from being P -free is of particular interest. We are able to leverage the modification Lemma and show that the distance of a string S from being P -free for a fixed pattern P (that is not almost homogeneous) is exactly equal to the hitting number of P in A. For an arbitrary constant 0 < c < 1, this characterization allows us to devise a ((1 − c), )-tolerant tester making Oc(−1) queries for this case. For the case of almost homogeneous patterns, and an arbitrary constant c > 0 , we devise a ((1/16 + c), )-tolerant tester that makes Oc(1/) queries. Whether tolerant testers exist for almost homogenous patterns of dimension larger than 1 is an open question. Moreover, the characterization via the hitting number implies an O(n + k) algorithm that calculates (exactly) the distance of A from being P -free where P is an arbitrary pattern (that may be almost homogeneous). We are not aware of a previous algorithm for the distance computation problem. Unlike the one-dimensional case, in d dimensions we do not know of a clean combinatorial description of the distance to being P -free for higher dimension. Furthermore, it can be shown via a direct reduction from covering problems in the plane [19], that for dimension d > 1 there exists patterns P for which calculating the distance to P -freeness is NP-hard. 2 Related Work The problem of testing pattern freeness is related to the study of testing subgraph-freeness (see, for example, [1, 4]). This line of work examines how one can test quickly whether a given graph G is H-free or -far from being H-free, where H is a fixed subgraph. In this problem, a graph is -far from being H-free if at least an -fraction of its edges and non-edges need to be altered in order to ensure that the resulting graph does not contain H as a (not necessarily induced) subgraph. A key component in these works are removal lemmas: typically such lemmas imply that if G is -far from being H-free, it necessarily contains a "large" number of copies of H. Perhaps the best example for 3 this phenomena is the triangle removal lemma which asserts that for every  ∈ (0, 1), there exists δ = δ() > 0 such that if an n-vertex graph G is -far from being triangle free, then G contains at least δn3 triangles (see e.g., [6] and the reference within). Alon et. al. showed [3] that regular languages over {0, 1} are strongly testable. Testing pattern- freeness (1-dimensional, binary alphabet, constant pattern length k) is a special case of the former, since the language of all strings avoiding a fixed pattern is regular. The query complexity of their  )(cid:1), where c is a constant that depends on the minimal size of a DFA AL, that tester is O(cid:0) c  · ln3( 1 (cid:16) k3  · ln3( 1  ) (cid:17) accepts the regular language L. It is shown in [3] that c can be taken to be O(s3) where s is the size of AL. In the case of the regular language considered here a simple pumping-lemma inspired argument shows that s ≥ Ω(k). Hence the upper bound on testing pattern freeness implied by their algorithm is O . Our 1D tester solves a very restricted case of the problem the tester of [3] deals with, but it achieves a better query complexity of O(1/) in this setting. Moreover, our tester is much simpler and can be applied in the more general high dimensional setting, or when the pattern length k is allowed to grow as a function of the string length n. The problem of testing submatrix freeness was investigated in [16, 17, 5, 18, 2]. As opposed to our case, which is concerned with tight submatrices, all of these results deal with submatrices that are not necessarily tight (i.e. the rows and the columns need not be consecutive). Quantitatively, the submatrix case is very different from our case: in our case P -freeness can be testable using O(−1) queries, while in the submatrix case, for a binary submatrix of size k × k a lower bound of −Ω(k2) on the needed number of queries is easy to obtain, and in the non-binary case there exist 2 × 2 matrices for which there exists a super polynomial lower bound of Ω(log 1/). The 2D part of our work adds to a growing literature concerned with testing properties of images [30, 33, 11]. Ideas and techniques from the property testing literature have recently been used in the fields of computer vision and pattern recognition [24, 25]. 3 Notation and definitions With slight abuse of notation, for a positive integer n we let [n] denote the set {0, . . . , n − 1} and we write [n]d = [n] × . . . × [n]. Recall that a d-dimensional (cubic) array A over an alphabet Γ is a function from [k]d to Γ. The x = (x1, . . . , xd) entry of A, denoted by Ax, is the value of the function A at location x. Let P be a (k, d)-array over an alphabet Γ of size at least two. We say that a d-dimensional array A contains a copy of P (or a P -copy) starting in location x = (x1, . . . , xd) if for any y ∈ [k]d we have Ax+y = Py. Finally, A is P -free if it does not contain copies of P . A property P of d-dimensional arrays is simply a family of such arrays over an alphabet Γ. For an array A and a property P, the absolute distance dP (A) of A to P is the minimal number of entries that one needs to change in A to get an array from P. The relative distance of A to P is δP (A) = dP (A)/A, where clearly 0 ≤ δP (A) ≤ 1 for any nontrivial P and A. We say that A is -close (-far) to P if δP (A) ≤  (≥ ). In this paper we will consider the property of P -freeness, which consists of all P -free arrays. The absolute and relative distance to P -freeness will be denoted by dP (A) and δP (A), respectively. For an array A and a pattern P we will call a set of entries in A whose modification can turn it to be P -free a deletion set and therefore it is natural to call dP (A) (the absolute distance of A to P -freeness) the deletion number, since it is the size of a minimal deletion set. In a similar manner, for a given set of entries in A, if every P -copy in A contains at least one of these entries, we call 4 it a hitting set and we call the size of a minimal hitting set the hitting number, denoted by hP (A). For all notations here and above, in the 1-dimensional case we will replace A by S (for String). We will need several definitions from [29] as well. Let P be a property of arrays and let h1, h2 : [0, 1] → [0, 1] be two monotone increasing functions. An (h1, h2)-distance approximation algorithm for P is given query access to an unknown array A. The algorithm outputs an estimate δ to δP (A), such that with probability at least 2/3 it holds that h1(δP (A)) ≤ δ ≤ h2(δP (A)). Finally, for a property P and for 0 ≤ 1 < 2 ≤ 1, an (1, 2)-tolerant tester for P is given query access to an array A. The tester accepts with probability at least 2/3 if A is 1-close to P, and rejects with probability at least 2/3 if A is 2-far from P. In the 'standard' notion of property testing, 1 = 0. Thus, any tolerant tester is also a tester in the standard notion. Finally, we define the additive (multiplicative) tolerance of the tester above as 2 − 1 (2/1 respectively). 4 Main Results The modification lemma result is central in the study of minimal deletion sets. It classifies the possible patterns into ones that are removable and ones that are not. The result that the vast majority of patterns are removable is used extensively throughout the paper in the design and proofs of algorithms for efficient testing of pattern freeness (in 1 and higher dimensions) as well as for the exact computation of the deletion number in 1-dimension. Our 1-dimensional modification lemma (Lemma 9) gives the following full characterization of 1-dimensional patterns (i.e. strings). A binary pattern is removable if and only if it not almost homogeneous, while any pattern over a larger alphabet is removable. The multidimensional version of the lemma (Lemma 9) makes the exact same classification, but for (k, d)-arrays for which k ≥ 3·2d. The fact that most patterns are removable is very important for analyzing the deletion number (which is the distance to pattern freeness). As an example, a simple observation is that a removable pattern appears at least dP (A) times (possibly with overlaps) in the array A, which implies an - tester that can simply check for the presence of the pattern in 1/ random locations in the array at a sample complexity of O(k/). Another important part of our work makes explicit connections between the deletion number and the hitting number for both 1 and higher dimensions. These are needed in order to get improved testers (e.g. for getting rid of k in the sample complexity) in d-dimensions as well as for linear time computation of the distance (deletion number) in 1-dimension. For the 1-dimensional case we show that the deletion number dP (S) equals the hitting number hP (S), which leads to an exact computation of dP (S) in time O(n + k) (Theorem 12) as well as a tolerant testers for Pattern Freeness: An (1, 2)-tolerant tester for any 0 ≤ 1 < 2 ≤ 1 at a 2/(2 − 1)3) (Theorem 22) as well as an ((1 − τ ), )-tolerant tester for a fixed complexity of O(2 τ > 0 and any 0 <  ≤ 1 at a complexity of O(−1τ−3) (Corollary 13). For higher dimensions, we show (Lemma 11) that hP (A) ≤ dP (A) ≤ αdhP (A) ≤ αdk−d, a bound that relates the hitting number hP (A) and the deletion number dP (A) through a constant αd = 4d + 2d that depends only on the dimension d. This bound enables a ((1− τ )dα−1 d , )-tolerant tester making Cτ −1 queries, where Cτ = O(1/τ d(1 − (1 − τ )d)2) (Theorem 15). In the 1-dimensional setting we also provide dedicated algorithms to handle the almost homo- geneous (non-removable) patterns, achieving an O(n) algorithm for computing the deletion number (Theorem 23) as well as a (/(16 + c), )-tolerant tester, for any constant c > 0, at a complexity of αc−1 queries, where αc depends only on c (Theorem 24). 5 Finally, we provide a lower bound of Ω(1/) (Theorem 27, Appendix D) for any tester of pattern freeness. Unlike the previous lower bound of Ω(1/) [3] on testing regular languages, ours extends to dimensions higher than 1 and applies to the case where k may depend on n. Our main results are summarized in Table 1. dim. template type 1D 2+D general almost homog. general almost homog. deletion number computation modification lemma O(n + k) O(n + k) NP-Hard − removable for any k not removable for any k removable for k > 3 · 2d not removable for any k tester tolerance 1/(1 − τ ) (16 + c) (1 − τ )−dαd − query complexity O(1/τ 3) αc/ βd,τ / − Table 1: Summary of results. 0 < τ < 1 and c > 0 are arbitrary constants. αc is a constant that depends only on c. βd,τ is a constant that depends only on d and τ . 'modification lemma' specifies if patterns are classified as removable or not. the 'tester tolerance' is multiplicative 5 Modification Lemma Theorem 1 (Modification Lemma). Let d > 1 and let P be a (k, d)-array over the alphabet Γ where k ≥ 3 · 2d. 1. If Γ = 2 then P is removable if and only if it is not almost homogeneous. 2. If Γ ≥ 3 then P is removable. Remark. Theorem 1 states that any large enough binary pattern which is not almost homogeneous is removable. The requirement that the pattern is large enough is crucial, as the 2× . . .× 2 pattern P satisfying Px = 0 for any x = (x1, . . . , xd) with x1 = 0 and Px = 1 otherwise is not removable even though it is not almost homogeneous. To see this, consider the following 4 × . . . × 4 array A: Mx = 0 if either x1 = 0, or x1 = 1 and xi ∈ {1, 2} for any 2 ≤ i ≤ d, or x1 = 2 and xi ∈ {0, 3} for some 2 ≤ i ≤ d. For any other value of x, Mx = 1. Note that A contains a copy of P starting at (1, . . . , 1), but flipping any bit in this copy creates a new P -copy in A. Still, the size of the counterexample is only 2 × . . . × 2 while in the statement of Theorem 1, the dependence is exponential in d. It will be interesting to understand what is the correct order of magnitude of the dependence of k on d. Proof of Theorem 1. The second statement of the theorem can be easily derived from the first statement; If P does not contain all letters in Γ then it is clearly removable, as changing any of its entries to any of the missing letters cannot create new P -copies. Otherwise, we can reduce the problem to the binary case: let σ1, σ2 be the letters in Γ that appear the smallest number of times in P . Consider the following (k, d)-array P (cid:48) over {0, 1}: P (cid:48) x = 1 otherwise. Observe that P (cid:48) is not almost homogeneous, implying that it is removable. It is not hard to verify now that P is removable as well. In what follows, we will prove the first statement. If P is binary and almost homogeneous then it is not removable: Without loss of generality P(0,...,0) = 1 and Px = 0 for any x (cid:54)= (0, . . . , 0). Consider a (2k, d)-array A such that M(0,...,0) = M(1,...,1) = 1 and A = 0 elsewhere. Clearly, modifying any bit of the P -copy starting at (1, . . . , 1) creates a new copy of P in A, so P is not removable. x = 0 if Px ∈ {σ1, σ2} and P (cid:48) 6 The rest of the proof is dedicated to the other direction. Suppose that P is a binary (k, d)-array that is not removable. We would like to show that P must be almost homogeneous. As P is not removable, there exists a binary array A containing a copy of P that such that flipping any single bit in this copy creates a new copy of P in A. This copy of P will be called the template of P in A. Clearly, all of the new copies created by flipping bits in the template must intersect the template, so we may assume that A is of size (3k − 2)d and that the template starts in location k = (k − 1, . . . , k − 1). For convenience, let I = [k]d denote the set of indices of P . For any x ∈ I let ¯x = x + k; ¯x is the location in A of bit x of the template. Roughly speaking, our general strategy for the proof would be show that there exists at most two "special" entries in P such that when we flip a bit in the template, creating a new copy of P in A, the flipped bit usually plays the role of one of the special entries in the new copy. We will then show that in fact, there must be exactly one special entry, which must lie in a corner of P , and that all non-special entries are equal while the special entry is equal to their negation. This will finish the proof that P is almost homogeneous. Definition 2. Let i ≤ d and let δ be positive integers. Let x = (x1, . . . , xd) and y = (y1, . . . , yd) be d-dimensional points. The pair (x, y) is (i, δ)-related if yi − xi = δ and yj = xj for any j (cid:54)= i. An (i, δ)-related pair (x, y) is said to be an (i, δ)-jump in P if Px (cid:54)= Py. Figure 1: Illustration for Lemma 3. A 2-dimensional example, where i is the vertical coordinate: Flipping the bit (of the template P ) at location ¯a creates the P -copy Qa at location m(a). Sim- ilarly, the copy Qb is created at location m(b). Note that the pair of points (¯x, ¯y) (which is (x, y) in P ) and the copy loca- tions pair (m(a), m(b)) are both (i, ∆i)- related. The values Px and Py (M¯x and M¯y) must be equal. Lemma 3. For any 1 ≤ i ≤ d there exists 0 < ∆i < k/3 such that at most two of the (i, ∆i)-related pairs of points from I are (i, ∆)-jumps in P . Proof. Recall that, by our assumption, flipping any of the K = kd bits of the template creates a new copy of P in A. Consider the following mapping m : I → [2k − 1]d. m(x1, . . . , xd) is the starting location of a new copy of P created in A as a result of flipping bit x = (x1, . . . , xd) of the template (which is bit ¯x of A). If more than one copy is created by this flip, then we choose the starting location of one of the copies arbitrarily. Observe that m is injective, and let S be the image of m, where S = K. Let 1 ≤ i ≤ d and consider the collection of (one-dimensional) lines Li =(cid:8){x1} × . . . × {xi−1} × [2k − 1] × {xi+1} × . . . × {xd} ∀j (cid:54)= i : xj ∈ [2k − 1](cid:9). 7 Clearly(cid:80) S ∩ (cid:96) = K. On the other hand, Li =(cid:81) j(cid:54)=i(2k − 1) < 2d−1(cid:81) (cid:96)∈Li j(cid:54)=i k = 2d−1K/k, so there exists a line (cid:96) ∈ Li for which S ∩ (cid:96) > k/2d−1 ≥ 6. Hence S ∩ (cid:96) ≥ 7. Let α1 < . . . < α7 be the smallest i-indices of elements in S ∩ (cid:96). Since α7 − α1 < 2k − 1 there exists some 1 ≤ l ≤ 6 such that αl+1 − αl < k/3. That is, S contains an (i, ∆i)-related pair with 0 < ∆i < k/3. In other words, there are two points a, b ∈ I such that flipping ¯a (¯b) would create a new P -copy, denoted by Qa (Qb respectively), which starts in location m(a) (m(b) respectively) in A, and (m(a), m(b)) is an (i, ∆i)-related pair. The following claim finishes the proof of the lemma and will also be useful later on. Claim 4. For a and b as above, let (x, y) be a pair of points from I that are (i, ∆i)-related and suppose that y (cid:54)= ¯a − m(a) and that x (cid:54)= ¯b − m(b). Then Px = Py. Proof. The bits that were flipped in A to create Qa and Qb are ¯a, ¯b respectively. Since y +m(a) (cid:54)= ¯a, the copy Qa contains the original entry of A in location y + m(a). Therefore, Py = My+m(a) (as My+m(a) is bit y of Qa, which is a copy of P ). Similarly, since x + m(b) (cid:54)= ¯b, we have Px = Mx+m(b). But since both pairs (x, y) and (m(a), m(b)) are (i, ∆i)-related, we get that m(b) − m(a) = y − x, implying that x + m(b) = y + m(a), and therefore Px = Mx+m(b) = My+m(a) = Py, as desired. Clearly, the number of (i, ∆i)-related pairs that do not satisfy the conditions of the claim is at most two, finishing the proof of Lemma 3. Let ∆ = (∆1, . . . , ∆d) where for any 1 ≤ i ≤ d, we take ∆i that satisfies the statement of Lemma 3 (its specific value will be determined later). Definition 5. Let x ∈ I. The set of ∆-neighbours of x is (cid:12)(cid:12) ∃i : (x, y) is (i, ∆i)-related or (y, x) is (i, ∆i)-related(cid:9) Nx =(cid:8)y ∈ I and the number of ∆-neighbours of x is nx = Nx, where d ≤ nx ≤ 2d. We say that x is a ∆-corner if nx(∆) = d and that it is ∆-internal if nx(∆) = 2d. Furthermore, x is (∆, P )-isolated if Px (cid:54)= Py for any y ∈ Nx, while it is (∆, P )-generic if Px = Py for any y ∈ Nx. When using the above notation, we will sometimes omit the parameters (e.g. simply writing isolated instead of (∆, P )-isloated) as the context is usually clear. The definition imposes a symmetric neighborhood relation, that is, x ∈ Ny holds if and only if y ∈ Nx. If x ∈ Ny we say that x and y are ∆-neighbours. Note that a point x = (x1, . . . , xd) ∈ I is a ∆-corner if xi < ∆i or xi ≥ k− ∆i for any 1 ≤ i ≤ d, and that x is ∆-internal if ∆i ≤ xi < k− ∆i for any 1 ≤ i ≤ d. Claim 6. Two (∆, P )-isolated points in I cannot be ∆-neighbors. Proof. Suppose towards contradiction that x = (x1, . . . , xd) and y = (y1, . . . , yd) are two distinct (∆, P )-isolated points and that (x, y) is (i, ∆i)-related for some 1 ≤ i ≤ d. Since ∆i < k/3, at least one of x or y participates in two different (i, ∆i)-related pairs: if xi < k/3 then yi+∆i = xi+2∆i < k so y is in two such pairs, and otherwise xi ≥ ∆i, meaning that x participates in two such pairs. Assume without loss of generality that the two (i, ∆i)-related pairs are (t, x) and (x, y), then Pt (cid:54)= Px and Px (cid:54)= Py as x is isolated. By Lemma 3, these are the only (i, ∆i)-jumps in P . Choose an arbitrary j (cid:54)= i and take v = (v1, . . . , vd) where vj = ∆j and vl = 0 for any l (cid:54)= j. Recall that ∆j < k/3, implying that either xj + vj < k or xj − vj ≥ 0. Without loss of generality assume the former, and let x(cid:48) = x + v and y(cid:48) = y + v. Since x and y are (∆, P )-isolated, and since 8 x(cid:48) ∈ Nx and y(cid:48) ∈ Ny, we get that Px(cid:48) (cid:54)= Px (cid:54)= Py (cid:54)= Py(cid:48), and thus Px(cid:48) binary). Therefore, (x(cid:48), y(cid:48)) is also an (i, ∆i)-jump in P , a contradiction. (cid:54)= Py(cid:48) (as the alphabet is Illustration for Definition 7. Recall that flipping a bit ¯a in A creates a new P -copy Qa (which contains ¯a), located at the point m(a) in the coordinates of A. The bits x and a are mapped to y and f (a) respectively. Definition 7. For three points x, y, a ∈ I, we say that x is mapped to y as a result of the flipping of a if ¯x = m(a) + y. Moreover, define the function f : I → I as follows: f (x) = ¯x − m(x) is the location to which x is mapped as a result of flipping x. In other words, x is mapped to y as a result of flipping the bit a if bit ¯x of A "plays the role" of bit y in the new P -copy Qa that is created by flipping a. Note that • If ¯x − m(a) /∈ I then x is not mapped to any point. However, this cannot hold when x = a, so the function f is well defined. • For a fixed a, the mapping as a result of flipping a is linear: if x and y are mapped to x(cid:48) and y(cid:48) respectively, then y− x = y(cid:48)− x(cid:48). In particular, if (x, y) is (i, ∆i)-related for some 1 ≤ i ≤ d then (x(cid:48), y(cid:48)) is also (i, ∆i)-related. • If x is mapped to y as a result of flipping a and x (cid:54)= a, then Px = Py. • On the other hand, we always have Px (cid:54)= Pf (x). • If x is ∆-internal and (∆, P )-generic, then f (x) must be (∆, P )-isolated. The first four statements are easy to verify. To verify the last one, suppose that x is internal and generic and let z ∈ Nf (x); we will show that Pf (x) (cid:54)= Pz. Since x is internal, there exists y ∈ Nx such that y − x = z − f (x). Then y is mapped to z as a result of flipping x, since ¯y = y + k = z + (x + k) − f (x) = z + ¯x − f (x) = z + m(x). Therefore Py = Pz. On the other hand, Px = Py as x is generic and Px (cid:54)= Pf (x), and we conclude that Pz (cid:54)= Pf (x). Lemma 8. There is exactly one (∆, P )-isolated point in I. Proof. Let S be the set of isolated points; our goal is to show that S = 1. Consider the set C = {(x, y) : x, y ∈ I, (x, y) is an (i, ∆i)-jump for some 1 ≤ i ≤ d}. Clearly, each point in S is contained in at least d pairs from C. By claim 6 no pair of isolated points are ∆-neighbours and therefore every pair in C contains at most one point from S. By Lemma 3, C ≤ 2d which implies that S ≤ 2. On the other hand we have S ≥ 1. To see this, observe i=1 k/3 ≥ 2d2, while the number of non-∆-generic points is at most 2C ≤ 4d, implying that at least 2d2 − 4d > 0 of the internal that the number of (∆, P )-internal points in I is greater than (cid:81)d 9 points are generic. Therefore, pick an internal generic point z ∈ I. As we have seen before, f (z) must be isolated. To complete the proof it remains to rule out the possibility that S = 2. If two different (∆, P )-isolated points a = (a1, . . . , ad) and b = (b1, . . . , bd) exist, each of them must participate in exactly d pairs in C. This implies that both of them are ∆-corners with d neighbors. It follows that every ∆-internal point z must be generic (since an internal point and a corner point cannot be neighbours), implying that either f (z) = a or f (z) = b. Let 1 ≤ i ≤ d and define δi > 0 to be the smallest integer such that there exists an (i, δi)- related pair (x, y) of generic internal points with f (x) = f (y). For this choice of x and y we have m(y) − m(x) = ¯y − f (y) − (¯x − f (x)) = ¯y − ¯x = y − x, so (m(x), m(y)) is also (i, δi)-related. In particular, we may take ∆i = δi (Recall that until now, we only used the fact that ∆i < k/3, without committing to a specific value). Without loss of generality we may assume that f (x) = f (y) = a. By Claim 4, any pair (s, t) of (i, ∆i)-related points for which s (cid:54)= ¯y − m(y) = f (y) = a and t (cid:54)= ¯x − m(x) = f (x) = a is not an (i, ∆i)-jump. Since b is not a ∆-neighbour of a, it does not participate in any (i, ∆i)-jump, contradicting the fact that it is (∆, P )-isolated. This finishes the proof of the lemma. Finally, we are ready to show that P is almost homogeneous. Let a = (a1, . . . , ad) be the single (∆, P )-isolated point in I. Consider the set J = {x = (x1, . . . , xd) ∈ I : ∆i ≤ xi < ∆i + 2d for any 1 ≤ i ≤ d} and note that all points in J are ∆-internal. Let 1 ≤ i ≤ d and partition J into (i, 1)-related pairs of points. There are 2d2−1 ≥ 4d pairs in the partition. On the other hand, the number of non-generic points in J is at most 2C − (d − 1) < 4d (to see it, count the number of elements in pairs from C and recall that a is contained in at least d pairs). Therefore, there exists a pair (x, y) in the above partition such that x and y are both generic. As before, f (x) and f (y) must be isolated, and thus f (x) = f (y) = a, implying that ∆i = δi = 1. We conclude that ∆ = (1, . . . , 1). Claim 4 now implies that any pair (s, t) of (i, 1)-related points for which s (cid:54)= ¯y−m(y) = f (y) = a and t (cid:54)= ¯x−m(x) = f (x) = a is not an (i, 1)-jump. That is, for any two neighbouring points s, t (cid:54)= a in I, Ps = Pt, implying that Px = Py for any x, y (cid:54)= a (since ∆ = (1, . . . , 1), a ∆-neighbour is a neighbour in the usual sense). To see this, observe that for any two points x, y (cid:54)= a there exists a path x0x1 . . . xt in I where xj and xj+1 are neighbours for any 0 ≤ j ≤ t − 1, the endpoints are x0 = x and xt = y, and xj (cid:54)= a for any 0 < j < t. Since a is isolated, it is also true that Pa (cid:54)= Px for any x (cid:54)= a. To finish the proof that P is almost homogeneous, it remains to show that a is a corner. Suppose to the contrary that 0 < ai < k − 1 for some 1 ≤ i ≤ d and let b, c ∈ I be the unique points such that (a, b) and (c, a) are (i, 1)-related, respectively. Clearly f (b) = a, so a is mapped to ¯a − m(b) = ¯a − ¯b + f (b) = c − a + a = c as a result of flipping b, which is a contradiction - as Pa (cid:54)= Pc and b (cid:54)= a, c. This finishes the proof. The above proof only works when the dimension is bigger than one, though it can be adapted to the one-dimensional case. However, we present here another proof for the one-dimensional case, which is simpler than the general proof above and works for any pattern which is not almost homogeneous (as opposed to the proof above, that required the forbidden pattern to also be large enough). The main strategy here is to consider the longest streaks of zeros and ones in the pattern - a strategy that cannot be used in higher dimensions. 10 Theorem 9 (1D Modification Lemma). A one-dimensional pattern is removable if and only if it is almost homogeneous. Proof of Theorem 9. The reduction from a general alphabet to a binary one and the negative example for almost homogeneous patterns which were presented in the proof of Theorem 1 also hold here. It remains to prove that any 1-dimensional binary pattern that is not almost homogeneous is removable. Let P = P0 . . . Pk−1 be a binary pattern of length k, that is contained in an arbitrary binary string S. We need to show that one can flip one of the bits of P without creating a new P -copy in S. We assume that P contains both 0s and 1s (i.e. it is not homogeneous) otherwise flipping any bit would work. Therefore we can assume from now that k ≥ 3 (since for k = 1, 2 all patterns are homogeneous or almost homogeneous). Let us assume also that P starts with a 1, i.e. P0 = 1 and let t ≤ k − 1 be the length of the longest 0-streak (sub-string of consecutive 0s) in P . Let i > 0 be the leftmost index in which such a 0-streak of length t begins. Clearly, Pi−1 = 1 and Pi = . . . = Pi+t−1 = 0. If i + t ≤ k (i.e. the streak is not at the end of P ) then Pi+t = 1 and in such a case if we modify Pi+t to 0, the copy of P is removed without creating new P -copies in S. To see this, observe that a new copy cannot start at the bit flip location i + t or within the 0-streak at any of its locations i, . . . , i + t − 1 since the bits in these locations are 0 while the starting bit of P is 1. On the other hand, a new copy cannot start after i + t since it must include the bit flip location or anywhere before Pi since otherwise it would contain a 0-streak of length t + 1. This implies that P contains exactly one 0-streak of length t at its last t locations. In particular, we have that at the last location Pk−1 = 1, and if we denote by r the length of the longest 1-streak in P , a symmetric reasoning shows that P begins with its only longest 1-streak of length r. If P is not of the form 1s0t, it can be verified that flipping Ps (the leftmost 0 in P ) to 1 does not create any P -copy. The only case left is P = 1s0t, where s, t ≥ 2 since P is not almost homogeneous. Consider the bit of the string S that is to the left of P . If it is a 0 then we flip P1 to 0 and otherwise, we flip P0 to 0, where in both cases no new copy is created. 6 Characterizations of the Deletion Number We use the modification lemmas of Section 5 to investigate several combinatorial characterizations of the deletion number, which will in turn allow exact (and efficient) computations of the deletion number in the 1-dimensional case, as well as efficient approximation and testing of pattern freeness for removable patterns in the d-dimensional case for any d. In particular, we prove some surprising connections between minimal deletion sets and minimal hitting sets. The characterizations for almost homogeneous 1-dimensional patterns are given in Appendix C, along with an optimal algorithm to compute the exact deletion number and an optimal tester for pattern freeness in that case. The rest of this section deals with removable patterns, for both the 1-dimensional and multi-dimensional settings. In the 1-dimensional case, we show that for any removable pattern there exist certain minimal hitting sets which are in fact minimal deletion sets. These are sets where none of the flips create new occurrences. Our constructive proof shows how to build such a set and allows for a linear time algorithm for finding the deletion number. The result is summarized in Theorem 10 and proved in Appendix A. 11 Theorem 10 (dP (S) equals hP (S); Linear time computation of dP (S)). For a binary string S of length n and a binary pattern P of length k that is removable, the deletion number dP (S) equals hP (S) and can be computed in time O(n + k) and space O(k). For the multidimensional case, we start by showing that when P is removable, the hitting number hP (A) of A approximates the deletion number up to a multiplicative constant that depends only on the dimension d. This is done in two stages, the first of which involves the analysis of a procedure that proves the existence of a large collection of P -copies with small pairwise overlaps, among the large set of at least dP (A) P -copies that exist in A. This procedure heavily relies on the fact that P is removable. The second stage shows the existence of a large hitting set of the collection with small pairwise overlaps. The result is summarized in Lemma 11 and fully proved in Appendix A. Lemma 11 (relation between distance and hitting number). Let P be a removable (k, d)-array over an alphabet Γ, and let A be an (n, d)-array over Γ. Let αd = 4d + 2d. It holds that: hP (A) ≤ dP (A) ≤ αdhP (A) ≤ αd(n/k)d. 7 Testers for Pattern Freeness We describe efficient testers for both the one-dimensional and the d-dimensional removable patterns that have tolerance and query complexity that only depend on d (and not on k; using a completely naive tester, it can be seen that the tolerance and the query complexity depend on k). The testers essentially approximate the hitting number, which is related to the deletion number by the characterizations that were shown in Section 6. We start by presenting the distance approximation algorithm for P -freeness, which has both additive and multiplicative errors. Theorem 12 (Approximating the deletion number in 1-dimension). Let P be a removable string of length k and fix constants 0 < τ < 1, 0 < δ < 1/k. Let h1, h2 : [0, 1] → [0, 1] be defined as h1() = (1 − τ ) − δ and h2() =  + δ. There exists an (h1, h2)-distance approximation algorithm for P -freeness with query complexity and running time of O(1/kτ δ2). Note that dP (S) = hP (S) ≤ n/k always holds, so having an additive error parameter of δ ≥ 1/k is pointless. The proof of Theorem 12 can be adapted to derive (1, 2)-tolerant testers for any 0 ≤ 1 < 2 ≤ 1, which we describe in Theorem 22. An immediate corollary is the following multiplicative tester. The proofs for Theorems 12 and 22 can be found in Appendix B. Corollary 13 (Multiplicative tolerant tester for pattern freeness in 1-dimension). Fix 0 < τ < 1. For any 0 <  ≤ 1 there exists a ((1 − τ ), )-tolerant tester whose number of queries and running time are O(−1τ−3). For the multidimensional case, our distance approximation algorithm and tolerant tester for P -freeness are given in Theorems 14 and 15. As their technical details are very similar to those in the 1D case, we provide in Appendix B only a sketch of the main ideas. Theorem 14 (Approximating the deletion number in multidimensional arrays). Let P be a re- movable (k, d)-array and fix constants 0 < τ ≤ 1, 0 ≤ δ ≤ 1/kd. Let h1, h2 : [0, 1] → [0, 1] be defined as h1() = (1 − τ )dα−1 d  − δ and h2() =  + δ. There exists an (h1, h2)-distance approximation 12 algorithm for P -freeness making at most γ/kdτ dδ2 queries, where γ > 0 is an absolute constant, and has running time ζτ /kdδ2 where ζτ is a constant depending only on τ . Theorem 15 (Multiplicative tolerant tester for pattern freeness in multidimensional arrays). Fix 0 < τ ≤ 1 and let P be a removable (k, d)-array. For any 0 <  ≤ 1 there exists a ((1− τ )dα−1 d , )- tolerant tester making Cτ −1 queries, where Cτ = O(1/τ d(1 − (1 − τ )d)2). The running time is C(cid:48) τ −1 where C(cid:48) τ depends only on τ . 8 Discussion and Open Questions We have provided efficient algorithms for testing whether high-dimensional arrays do not contain a fixed pattern P for any removable pattern P . The results suggest several interesting open questions on the problem of pattern-freeness and more generally, on local properties - where we say that a property P is k-local if any array A not satisfying P, there exists a consecutive subarray of A of size at most k × . . . × k which does not satisfy P as well. That is, a property is local if any array not satisfying P contains a small 'proof' for this fact. Note that P -freeness is indeed k-local where k is the side length of P , and that a property P is k-local if and only if there exists a family F of arrays of size at most k × . . . × k each, such that A satisfies P if and only if it does not contain any consecutive sub-array from F. That is, to understand the general problem of testing local properties of arrays we will need to understand the testing of F-freeness, where F is a family of forbidden patterns (rather than a single forbidden pattern). In particular, the problem of approximate pattern matching is of interest. The family of forbid- den patterns for this problem might consist of a pattern and all patterns that are close enough to it, and the distance measures between patterns might also differ from the Hamming distance (e.g., (cid:96)1 distance for grey-scale patterns). Finally, it is desirable to settle the problem of testing pattern freeness for the almost homogenous case by either finding an efficient tester for the almost homogeneous multi dimensional case, or proving that an efficient tester cannot exist for such patterns. It is also of interest to examine which of the [k]d patterns with k < 3 · 2d are removable. Acknowledgements We are grateful to Swastik Kopparty for numerous useful comments. We are thankful to Sofya Raskhodnikova for her useful feedback. References [1] N. Alon (2002). Testing subgraphs in large graphs, Random structures and algorithms, 21(34):359 -- 370. [2] N. Alon and O. Ben Eliezer (2016). Removal lemmas for matrices, arXiv preprint 1609.04235. [3] N. Alon, M. Krivelevich, I. Newman and M. Szegedy (2001). Regular languages are testable with a constant number of queries, SIAM Journal on Computing, 30, 1842 -- 1862. [4] N. Alon, E. Fischer, M. Krivelevich and M. Szegedy (2000). Efficient testing of large graphs, Combinatorica, 20, 451 -- 476. [5] N. Alon, E. Fischer and I. Newman (2007). Efficient testing of bipartite graphs for forbidden induced subgraphs, SIAM Journal on Computing, 37.3, 959 -- 976. 13 [6] N. Alon and J. Spencer (2008). The Probablistic Method. Wiley. [7] A. Amir, G. Benson (1998). Two-Dimensional Periodicity in Rectangular Arrays, SIAM Journal on Computing, 27, 90-106. [8] A. Amir, G. Benson, M. Farach (1994). An Alphabet Independent Approach to Two- Dimensional Pattern Matching, SIAM Journal on Computing, 23, 313-323. [9] P. Awasthi, M. Jha, M. Molinaro and S. Raskhodnikova (2016). Testing Lipschitz functions on hypergrid domains. Algorithmica, 74(3), 1055 -- 1081. [10] Y. Bar-Hillel, M. Perles, and E. Shamir (1964). On formal properties of simple phrase structure In Y. Bar-Hillel, editor, Language and Information: Selected Essays on Their grammars, Theory and Application, 116 -- 150. Addison-Wesley, Reading, Massachusetts. [11] P. Berman, M. Murzabulatov, S. Raskhodnikova (2015). Constant-Time Testing and Learning of Image Properties, arXiv prepreint 1503.01363. [12] P. Berman, M. Murzabulatov and Sofya Raskhodnikova (2016). Tolerant Testers of Image Properties. ICALP, 1 -- 90:14. [13] R.S. Boyer and J.S. Moore (1977). A fast string searching algorithm, Comm. ACM, 20(10), 762 -- 772. [14] R. Cole (1991). Tight Bounds on the Complexity of the Boyer-Moore String Matching Algo- rithm, SODA, 224 -- 233. [15] C. Maxime, A. Czumaj, L. Gasieniec, S. Jarominek, T. Lecroq, W. Plandowski, and W. Rytter (1994). Speeding up two string-matching algorithms, Algorithmica, 12, 247 -- 267. [16] E. Fischer, and I. Newman (2001). Testing of matrix properties, STOC, 286 -- 295 [17] E. Fischer and I. Newman (2007). Testing of matrix-poset properties, Combinatorica, 27(3), 293 -- 327. [18] E. Fischer, E. Rozenberg, Lower bounds for testing forbidden induced substructures in bipartite-graph-like combinatorial objects, Proc. RANDOM 2007, 464-478. [19] R. Fowler, M. S. Paterson and S. L. Tanimoto (1981). Optimal packing and covering in the plane are NP-complete. Information processing letters, 12(3), 133 -- 137. [20] Z. Galil, J. G. Park and K. Park. (2004). Three-dimensional periodicity and its application to pattern matching. SIAM Journal on Discrete Mathematics, 18(2), 362 -- 381. [21] Z. Galil and J. I. Seiferas (1983). Time-Space-Optimal String Matching, J. Comput. Syst. Sci, 26(3), 280 -- 294. [22] O. Goldreich, S. Goldwasser and D. Ron (1998). Property testing and its connection to learning and approximation, JACM, 45, 653 -- 750. [23] J. Krkkinen and E. Ukkonen (2008). Multidimensional string matching. In Encyclopedia of Algorithms, 559 -- 562. 14 [24] I. Kleiner, D. Keren, I. Newman, O. Ben-Zwi (2011). Applying Property Testing to an Image Partitioning Problem, IEEE Trans. Pattern Anal. Mach. Intell, 33(2), 256 -- 265. [25] S. Korman, D. Reichman, G. Tsur and S. Avidan. Fast-Match: Fast Affine Template Matching, International Journal of Computer Vision, to appear. [26] D. E. Knuth, J. H. Morris Jr. and V. R. Pratt (1977). Fast Pattern Matching in Strings, SIAM J. Comput. 6(2): 323 -- 350. [27] T. Lecroq (2007). Fast exact string matching algorithms, Information Processing Letters, 102(6), 229-235. [28] G. Navarro and M. Raffinot (2000). Fast and flexible string matching by combining bit- parallelism and suffix automata, Journal of Experimental Algorithmics (JEA) 5: 4. [29] M. Parnas, D. Ron and R. Rubinfeld (2006). Tolerant property testing and distance approxi- mation. Journal of Computer and System Sciences, 72(6), 1012 -- 1042. [30] S. Raskhodnikova (2003). Approximate testing of visual properties, RANDOM, 370 -- 381. [31] R. L. Rivest (1977). On the Worst-Case Behavior of String-Searching Algorithms, SIAM J. Comput. 6(4): 669 -- 674. [32] R. Rubinfeld and M. Sudan (1996). Robust characterization of polynomials with applications to program testing, SIAM J. Comput. 25, 252 -- 271. [33] G. Tsur and D. Ron (2014). Testing properties of sparse images, ACM Transactions on Algorithms 4. [34] A. C. Yao (1977). Probabilistic computation, towards a unified measure of complexity, FOCS, 222 -- 227. A Characterizations of the Deletion Number: Proofs Proof of Theorem 10. The main challenge is in proving that dP (S) = hP (S), since then all we need is an algorithm that computes hP (S), which is relatively standard in template matching: Find the set O of all P -copies in S; Go though the P -copies in O from left to right, repeating the following: (i) Let P ∗ be the leftmost P -copy in O; (ii) Increment the hitting set count by 1; (iii) Remove from O all the (following) P -copies that intersect P ∗ (those whose starting location is not to the right of the rightmost location in P ∗);. Clearly, the complexity of the algorithm is dominated by the first step of finding O, which can be done in O(n + k) using, e.g., the KMP algorithm [26]. Taking the rightmost location in each of the visited P ∗s creates a hitting set, which is minimal, due to the fact that the set of P ∗s is independent. It is trivial that dP (S) ≥ hP (S) and hence we have to show that dP (S) ≤ hP (S). Refer to Algorithm 1 below that constructs a set of bit flip locations. Note that the choice in Step 3 is possible using the modification lemma, while the choice in Step 4 is possible, since if h is contained in only one P -copy P 0 ∈ D, by definition of D there is some P 1 ∈ D such that P 0 and P 1 intersect at some location x (in particular one of the 2 endpoints of P 0 must be in the intersection). Simply replace h by x. It is easy to verify that the set of locations F that it computes is a (particular) 15 minimal hitting set of O, and hence F = hP (S). It is therefore sufficient to show that flipping the bit locations in F turns the string S to be P -free. This will be guaranteed, using the fact that F is a hitting set of O, by Lemma 16 that shows that no bit flip of a location in F creates a new P -copy. Therefore, he proof of Lemma 16 will complete the proof of Theorem 10. Algorithm 1 Input: Binary string S of length n and removable binary string P of length k Output: Minimal set F of flip locations in S that make it P -free (F = dP (S)) 1. Find the set O of all P -copies in S 2. Divide O into I ∪ D, where I is the subset of P -copies that do not intersect any other P -copy in O, while D is the subset of P -copies that intersect some other P -copy in O. 3. For each P -copy P ∗ ∈ I add to F a bit location whose flipping removes P ∗ without creating any other P -copy 4. Find a minimal hitting set H of D such that every location h ∈ H is contained in at least two P -copies in D. 5. Add H to F return F Lemma 16 (Flipping bits in F does not create new P -copies). Let f ∈ F. Flipping the bit at location f does not create any new P -copy in S. Proof. Recall that F consisted of bits in I as well as bits in D. Each of the bit flips that are in I was chosen (step 3 of Algorithm 1) using the modification lemma to be such that no new P -copy is created. The main challenge is in showing that the remaining bit flips, i.e. at locations H, do not create any new P -copies. Notice our requirement that any location h ∈ H is contained in at least two P -copies. By symmetry considerations, we have the following Observation 17. [Flipping an arbitrary bit in the intersection of 2 P -copies can create a new P -copy] ⇐⇒ [Flipping an arbitrary bit in a P -copy can create 2 new P -copies] By Observation 17, in order to show that bit flips in H do not create new P -copies, one can prove that an arbitrary bit-flip in a P -copy cannot create more than 1 P -copy, as is stated in the next lemma. Lemma 18 (Any bit flip in a pattern P cannot create more than 1 new P -copy). Let x ∈ [k]. Flipping the bit Px can create at most 1 new P -copy in S. Proof. The proof goes by contradiction, assuming that a bit flip in P has created two new P -copies P 1 and P 2, and will analyze separately the two possible cases: case 1: 'P 1 and P 2 intersect P from different sides' In this case, flipping the bit location x of P creates a P -copy P 1 shifted t1 locations to the left and 16 a P -copy P 2 shifted t2 locations to the right, where we assume w.l.o.g. that t1 < t2. One can verify that Px−t2 = P 2 x+t1 = Px+t1). We will assume that Px = 0 and hence Px−t2 = 1. We refer the reader to Figure 2 and its caption for the intuition of the proof. x−t2 (cid:54)= Px (and similarly that Px (cid:54)= P 1 Figure 2: Illustration for case 1: Our proof is based on 'skipping' along a 'path' from loca- tion x to location x − t2 in P , while each skip is done between entries with equal values. A complete path from x to x− t2 will give a con- tradiction, since Px−t2 (cid:54)= Px. The path starts at x and makes skips of size t1 to the left as long as it does not pass x − t2, then it makes a single skip to the right of size t2. It repeats this traversal until reaching x − t2. Since the P -copy P 1 was created from P at a left offset of t1 by the flipping at location x, we can infer that Py = Py+t1 for any y ∈ [k − t1] , y (cid:54)= x (or informally that "P is t1-cyclic except at x from the right" ). Similarly, we know that "P is t2-cyclic except at x from the left". We define a 'path' of skips that starts from location x, makes skips of size t1 to the left as long as it does not pass x − t2, then it makes a single skip to the right of size t2. Call this short path a traversal. The path repeats this traversal until reaching x − t2. It is easy to verify that the path is always within the open range (x − t2, x + t1) (except for the last step that reaches x − t2). This implies in particular that the path does not go from x + t1 to x or from x to x − t2 (i.e. through the two only "value switching skips"), and hence the value of P along the path must be 0. It remains to prove that the path eventually reaches x−t2 and does not continue in some infinite loop. For each location y that the path goes through we can look at the value y (mod t1). Assume w.l.o.g. that for the 'target' location x − t2 we have that x − t2 = 0 (mod t1). This implies for the 'starting' location x that x = t2 (mod t1) = 0. Now, each skip by t1 does not change the location (mod t1), while a skip by t2 to the right increases the value by t2 (mod t1). In other words, the sub-sequence of locations at the beginning of each traversal (before the first left skip) is of the form (cid:96)· t2 (mod t1), for (cid:96) = 1, 2, 3, . . . . This is exactly the subgroup of Zt1 (the additive group of integers modulo t1) generated by the element t2 and hence must contain the identity element 0 (mod t1). This proves that the location x − t2 will be reached. case 2: 'P 1 and P 2 intersect P from one (the same) side' Flipping a location x in a P -copy P creates two new P -copies P i (i = 1, 2) that intersect P from the same side, w.l.o.g. right, at a shift of ti, where t1 < t2. Refer to Figure 3 and its caption for the intuition of the proof. We 'follow' the two disjoint 'arrow paths' shown in the figure that lead from x in P to x(cid:48) := x − t2 in P 1 to reach a contradiction. Formally: Px = P 1 x = P 2 Px (cid:54)= P 2 x−t2+t1 = Px−t2+t1 = P 1 x−t2 x−t2 = Px−t2 = P 1 x−t2 17 Figure 3: Illustration for case 2: All arrows (ignoring directions) except the red one represent equality, while the red arrow represents inequality. The two dis- joint 'arrow paths' from x in P to x(cid:48) in P 1 imply that both Px = Px(cid:48) and Px (cid:54)= Px(cid:48), leading to contradiction. Proof of Lemma 11. The first inequality follows from the fact that one needs to modify at least one entry in any P -copy in A. For the third inequality, note that the set {(x1, . . . , xd) ∈ [k]d : ∀1 ≤ i ≤ d, xi ≡ k − 1(mod k)} is a set of size [n/k]d that hits all k × . . .× k consecutive subarrays of A, and in particular all P -copies. It remains to prove that dP (A) ≤ αdhP (A). We may assume that the alphabet Γ is binary by applying the standard reduction from non-binary to binary alphabets presented in Section 5. We present a procedure on the array A that makes it P -free by sequentially flipping bits in it. In what follows, we will say that the center of a (k, d) matrix lies in location ((cid:98)k/2(cid:99), . . . ,(cid:98)k/2(cid:99)) in the matrix. Let P be the set of all P -copies before A is modified. In Phase 1, the procedure "destroys" all P -copies in P by flipping central bits of a subset of the original P -copies in A, which is chosen in a greedy manner. However, these bit flips might create new P -copies in M , which are removed in Phase 2 using the modification lemma. The procedure maintains sets A,B that contain the bits flipped in phases 1,2 respectively. • Let P be the set of all P -copies in A, N ← φ A ← φ, B ← φ. • Phase 1: While P (cid:54)= φ -- Pick Q ∈ P arbitrarily. -- Flip Ax where x is the center of Q. -- Add Q to A and remove all P -copies containing x from P. -- Add all P -copies created by flipping Ax to N . • Phase 2: While N (cid:54)= φ -- Pick Q ∈ N arbitrarily. -- Pick a location x in Q whose flipping does not create new P -copies in A (exists by modification lemma). -- Flip the bit Ax and add x to B. For the analysis of the procedure, we say that two P -copies Q, Q(cid:48) in A whose starting points are x = (x1, . . . , xd), y = (y1, . . . , yd) ∈ [n]d respectively are 1/2-independent if xi − yi ≥ k/2 for some 1 ≤ i ≤ d. Note that 1/2-independence is a symmetric relation. A set of P -copies is 1/2- independent if all pairs of copies in it are 1/2-independent. Denote by iP (A) the maximal size of a 1/2-indpendent set in A, divided by nd. For Q and Q(cid:48) as above, if Q(cid:48) does not contain the center of Q then Q, Q(cid:48) are 1/2-independent, as there is some 1 ≤ i ≤ d for which either yi < xi +(cid:98)k/2(cid:99)− (k− 1) ≤ xi− k/2 + 1 or yi > xi +(cid:98)k/2(cid:99) ≥ xi + k/2 − 1. In both cases yi − xi ≥ k/2, implying the 1/2-independence. Therefore the set A 18 generated by the procedure is 1/2-independent: if Q, Q(cid:48) ∈ A are two different P -copies and Q was added to A before Q(cid:48), then Q(cid:48) does not contain the center of Q(cid:48), so Q and Q(cid:48) are 1/2-independent. Using the following claims, it is not hard finish the proof of the lemma. Claim 19. iP (A) ≤ 2dhP (A). The proof of Claim 19 will be given later. For what follows, we say that P has a cycle of size t = (t1, . . . , td) ∈ Zd, if Px = Py for every pair of locations x = (x1, . . . , xd), y = (y1, . . . , jd) ∈ [k]d such that xi ≡ yi (mod ti) ∀i ∈ [d]. The following claim is straightforward to verify. Claim 20. [Shifted occurrences imply a cyclic pattern] If M contains two overlapping occurrences of A, at a relative offset of t ∈ Zd, then P has a cycle of size t. Claim 21. [Central bit flip creates few new occurrences] Flipping the central bit of a P -occurrence in A creates at most 2d new occurrences of P in A. We first show how to use these claims to finish the proof. Consider the sets A,B after the procedure ends. The procedure flips A +B bits in A, so A +B ≥ dP (A)nd. On the other hand, A ≤ iP (A)nd ≤ (2n)dhP (A) as A is 1/2-independent. Claim 21 now implies that B ≤ 2dA, and we get that nddP (A) ≤ A + B ≤ (2d + 1)A ≤ αdndhP (A) Dividing by nd yields the desired inequality. We now prove the claims. Proof of Claim 19. Let S be a 1/2-independent set of P -copies in A, which is of size iP (A). We will show that no point in [n]d is contained in more than 2d copies from S, implying that to hit all copies of P in A (and in particular, all copies of P in S) we will need at least S/2d = iP (A)/2d entries. Suppose to the contrary that there are 2d + 1 copies from S that contain the point x = (x1, . . . , xd) ∈ [n]d. we will say that a copy from S containing x is i-lower if k/2 ≤ xi − yi < k and i-higher if 0 ≤ xi − yi < k/2 (note that 0 ≤ xi − yi < k must hold). Therefore, there exist two copies Q, Q(cid:48) ∈ S containing x, starting at (y1, . . . , yd) and (y(cid:48) d) respectively, such that for any 1 ≤ i ≤ d, Q is i-higher (i-lower) if and only if Q(cid:48) is i-higher (i-lower respectively). But then, for any i, either 0 ≤ yi, y(cid:48) i < k/2, thus contradicting the fact that S is 1/2-independent. i < k, implying that yi − y(cid:48) 1, . . . , y(cid:48) i < k/2 or k/2 ≤ yi, y(cid:48) Proof of Claim 21. Assume that more than 2d new occurrences are created. Since these occurrences overlap (at the bit flip location),the same argument as in Claim 19 implies that there must be two of them, P1 and P2, that are shifted (one from the other) by some vector t ∈ Zd, where ti < k/2 ∀i ∈ [d]. By Claim 20, P (and hence also P1 and P2) has a cycle of size t. Let x be the point in M of the (central) flipped bit in P0 and consider the point x(cid:48) = x + t, which is also in P0, since ti < k/2 ∀1 ≤ i ≤ k. The occurrence P2 overlaps both locations x and x(cid:48) (since both new occurrences P1 and P2 overlap the bit flip location x and P2 is shifted by t from P1, which overlaps x). On one hand we have Mx = Mx(cid:48) (before the bit flip), since both locations belong to P0, which has a cycle of size t. On the other hand, Mx (cid:54)= Mx(cid:48), since these locations both belong to P2 and must be equal after flipping Mx as P2 has a cycle length of t. This leads to a contradiction. 19 B Testers for Pattern Freeness: Proofs Theorem 22. Let P be a removable string of length k and let 0 ≤ 1 < 2 ≤ 1. There exists an 2/(2 − 1)3) where the (1, 2)-tolerant tester whose number of queries and running time are O(2 constant term does not depend on k. It is not clear whether this upper bound is tight in general. However, for the important special case of tolerant testers with multiplicative tolerance of 1 + τ , where τ > 0 is a constant, the above tester is optimal (up to a multiplicative constant that depends on τ ), as is shown by taking 2 =  and 1 = (1 − τ ) in Theorem 22, leading to the multiplicative tester given in Corollary 13. Proof of Theorems 12 and 22. Let S be a string of length n ≥ βk, where β = 3/τ . Write  = δP (S) and let H ⊆ [n] be a hitting set for P in S whose size is n. That is, H is a minimal set if S contains a copy of P starting at location l, then of locations that satisfies the following: {l, . . . , l + k − 1} ∩ H (cid:54)= φ. For i ∈ [n] let Ii denote the "cyclic interval" of length βk starting at i. That is, if i + βk > n then Ii = {i, . . . , n} ∪ {0, . . . , i + βk − n − 1} and otherwise Ii = {i, . . . , i + βk − 1}. Let the random variable X denote the size of the minimal hitting set Hi for P in the interval Ii, divided by βk, where i ∈ [n] is chosen uniformly at random. Note that X is computable in time O(βk), by Theorem 10. Let µ and σ2 denote the expectation and the variance of X, respectively. By the minimality of Hi, we have that Hi ≤ H ∩ Ii since the set in the RHS is a hitting set for P with respect to the interval Ii. Thus, µ ≤ E[H ∩ Ii]/βk = . the minimality of H, we must have Hi > H ∩ I(cid:48) and ends in (i + (β − 1)k − 1) mod n. Therefore, µ ≥ E[H ∩ I(cid:48) conclude, we have seen that (1 − τ ) ≤ µ ≤ . Next we bound µ from below. Since Hi hits all P -copies that lie exclusively inside Ii, and by i is the cyclic interval that starts in i + k i]/βk = (1 − 2/β) ≥ (1 − τ ). To To compute the variance of X, note that 0 ≤ X ≤ 1/k, as there exist β entries in Ii such that any subinterval of length k in Ii contains at least one of them. By convexity, the variance satisfies σ2 ≤ kµ(1/k − µ)2 + (1 − kµ)(0 − µ)2 = µ(1/k − µ) ≤ /k. i where I(cid:48) (cid:80)t Now let Y = 1 t later. Then E[Y ] = µ and Var(Y ) = σ2/t ≤ /kt. j=1 Xj where the Xj are independent copies of X and t will be determined Recall that E[Y ] = µ, where (1− τ ) ≤ µ ≤ , so to get the desired approximation, it suffices to estimate Y with an additive error of no more than δ with constant probability. Chebyshev inequality implies that it suffices to have V ar(Y ) = Θ(δ2). In other words, it will be enough to sample t = Θ(/kδ2) blocks, each of size βk = Θ(k/τ ). In total, it is enough to make Θ(k(1/k− )/τ δ2) = O(/τ δ2) queries. In the setting of approximation,  is not known in advance, but  ≤ 1/k always holds, so sampling t = Θ(1/k2δ2) blocks would suffice to get the desired additive error. The return value of the approximation algorithm will be its estimate of Y . The query complexity and running time are βtk = Θ(1/kτ δ2). This finishes the proof of Theorem 12. Now consider the setting of (1, 2)-tolerant testing. By monotonicity of the tester, we can assume that we are given a string whose distance from P -freeness is either exactly 2 or exactly 1. Pick  = 2, δ = (2 − 1)/4, τ = (2 − 1)/42, and sample t = Θ(/kδ2) blocks, with query complexity and running time Θ(/τ δ2) = Θ(2 3), as was stated above. If the given string S is 2-far from P -freeness, then with probability at least 2/3, after sampling t = Θ(/τ δ2) samples, the value of Y will be bigger than (2)∗ (1− τ )− δ = (2 + 1)/2. On the other hand, if S is -close 2/2 − 1 20 then with probability at least 2/3, Y ≤ 1 + δ < (2 + 1)/2 Therefore, the tester will answer that the input is 2-far if and only if Y ≥ (2 + 1)/2. This finishes the proof of Theorem 22. Proof sketch for Theorems 14 and 15. Take β = 2/τ . Let A be an (n, d)-array where we may assume that n ≥ βk for a suitable choice of C. Again, the strategy is to take t (to be determined) independent samples of blocks of size βk × . . . × βk and compute the hitting number of each sampled block. Note that (as opposed to the one-dimensional case), computing the minimal hitting set is generally an N P -complete problem, but since the hitting number of each of these blocks is at most βd = Θ(τ−d), here we may compute it with running time that depends only on τ and d. As in the 1D case, the expected relative hitting number µ of a sampled block satisfies (1 − τ )dhP (A) = (1 − 2/β)dhP (A) ≤ µ ≤ hP (A). The variance of the hitting number for a single sample is no bigger than kd(1/kd − µ)2 + (1 − kdµ)µ2 = µ(1/kd − µ) ≤ µ/kd, so for t samples it is O(hP (A)/kdt). To get additive error of at most δ with constant probability, we may have (by Chebyshev inequality) hP (A)/kdt = Θ(δ2), or t = Θ(hP (A)/kdδ2). Therefore, for an approximation algorithm (in which we don't know hP (A) in advance, though we have an upper bound of hP (A) ≤ 1/kd), t = Θ(k−2dδ−2) sampled blocks are enough, and the total number of samples is O(1/kdτ dδ2). For a ((1 − τ )d, )-tolerant tester for the hitting number (which translates to a ((1 − τ )dα−1 d , )-tolerant tester for the deletion number), as observed in the 1D case, when deciding on the number of samples we may assume that hP (A) =  and pick δ = Θ((1−(1−τ )d)) , so t = Θ(/kdδ2) = Θ(1/kd(1−(1−τ )d)2) sampled block suffice. Since each block is of size Θ(kd/τ d), the total number of queries is O(Cτ −1) where Cτ = 1/τ d(1 − (1 − τ )d)2, while the running time is C(cid:48) τ depends on the time required to compute the hitting number in a single sampled block. τ −1, where C(cid:48) C Almost Homogeneous Patterns The testers discussed above only consider removable patterns. However, Theorem 1 states that almost homogeneous patterns over a binary alphabet are not removable. As the above testers are not applicable for this case, it is natural to ask whether there exist efficient testers (and in particular tolerant testers) for pattern freeness when the pattern is almost homogeneous. In this subsection we partially answer this question, addressing the one-dimensional case; we do so by describing a simple yet powerful characterization of the distance to P -freeness when P is almost homogeneous. The characterization is then utilized to get both an optimal 1/(16+c)-tolerant tester for P -freeness in the one-dimensional case and an efficient exact algorithm for computing the distance to P -freeness. Unfortunately, this characterization does not hold in higher dimensions, and the question of It is not clear testing and approximating the distance to P -freeness in this case is left open. whether there exist efficient algorithms for computing the exact distance to P -freeness in high dimensions. It will be interesting to either find such an algorithm or show that the problem is NP-hard. Denote the absolute distance of a string S to P -freeness by dP (S). Our main results here are as follows. Theorem 23. There exists an algorithm that, given an almost homogeneous binary string P and a binary string S of length n, compute dP (S) in time O(n) and space O(1) where the constants do 21 not depend on the length of P . The above algorithm is clearly optimal (up to a multiplicative constant that does not depend on k) with respect to time and space complexity. Our second result is a 1/(16 + c)-tolerant tester for P -freeness when P is almost homogeneous. Theorem 24. Let P be an almost homogeneous binary string and fix a constant c > 0. Then there exists a 1/(16 + c)-tolerant -tester for P -freeness making at most αc−1 queries, where αc depends only on c. Again, the running time of the above tester is optimal (up to a multiplicative constant). In particular, it does not depend on the length of the forbidden pattern P or the tested string. We did not try to optimize the tolerance factor in the above statement. In the rest of this subsection we will prove the above two theorems. We will start by describing a characterization of the distance to P -freeness which is easier to work with. Without loss of generality, in the rest of the subsection assume that P = 10k−1 for some k > 0 and that S is a string of length n. A pair (i, j) with 0 ≤ i < j ≤ n − k + 1 is said to be a P -evidence in S if Pi = 1 and Pl = 0 for any j ≤ l ≤ j + k − 2. Observation 25. S is P -free if and only if there are no P -evidences in S. Proof. If S contains a P -copy at location i then the pair (i, i + 1) is a P -evidence. On the other hand, suppose that (i, j) is a P -evidence and let i(cid:48) < j be the maximal integer such that Pi(cid:48) = 1. Then Pl = 0 for any i(cid:48) < l ≤ j + k − 2, implying that S contains a P -copy starting at i(cid:48). The main technical result of this subsection relates the distance to P -freeness to the maximal number of non-overlapping P -evidences, where two P -evidences (i, j) and (i(cid:48), j(cid:48)) are non-overlapping if i (cid:54)= i(cid:48) and j − j(cid:48) ≥ k − 1. Denote the maximal number of non-overlapping P -evidences in S by dE(S). Lemma 26. dP (S) = dE(S). Proof of Lemma 26. It is clear that dP (S) ≥ dE(S). Indeed, take a set of non-overlapping P - evidences which is of size dE(S), then by Observation 25 we will need to modify at least one bit corresponding to any evidence, and in total at least dE(S) bits in S, to make it P -free. Next we show that dP (S) ≤ dE(S) by showing that there exists a set T of non-overlapping P -evidences in S with the following property: to make S P -free, it is enough to modify exactly one bit in any evidence in T . The construction of T is carried by "marking" entries corresponding to P -evidences in S in the following manner. Initially, T is empty and no entry of S is marked. We repeat the following procedure as long as S contains a P -evidence whose entries are unamrked: in each round, we pick the smallest 0 < j ≤ n − k + 1 for which both Sl is unmarked for any j ≤ l ≤ j + k − 2 and the set Aj = {i < j : Si is unmarked and equal to 1} is not empty. Pick i = max Aj. Now add (i, j) to T and mark the entries of S in the k locations i, j, j + 1, . . . , j + k − 2. Consider the set T = {(i1, j1), . . . , (it, jt)} in the end of the process, where (is, js) was chosen in round s of the process, and let m be the largest integer such that Sm equals 1 and is not marked (if no such entry exists, we take m = n). Then T satisfies the following: • j1 < . . . < jt. This is true by the minimality of j picked in any round. In particular, if Si is marked before Sj and both entries are zero then i < j. 22 • Let 0 < s ≤ t. If is < is−1 then we must have js = js−1 + k − 1: by the maximality of is, it must be true that Pl = 0 for any js−1 + k − 1 ≤ l < js. Thus, by the minimality of js, we must have that js = js + k − 1, as desired. • On the other hand, if is > is−1 then js = is + 1. Again, this is true by the minimality of js and the maximality of is with respect to js. • For any 1 ≤ s ≤ t, either js < m or is > m. This is true by the maximality of is with respect to js. We now show how one can modify exactly t bits in S to make it P -free. For any (i, j) ∈ T such that j < m, we modify Pi to zero. After the modification, Pl = 0 for any l < m, so there cannot be P -copies in S starting at l < m. On the other hand, for any (i, j) ∈ T such that i > m, we modify Pj+k−2 to one. It remains to show that after the modification, S will not contain a P -copy starting at some l ≥ m. By the third observation and the minimality of j in any round of the process, we cannot have a P -copy starting in an unmarked entry Sl = 1 - since otherwise, at some point in the above process, we would have to add the evidence (l, l + 1) to T , while marking Sl, a contradiction. To complete the proof, suppose that Sl is marked and equals one after the modification; that is, l = js + k − 2 for some (is, js) ∈ T with is > m. There are two cases to consider. • If is+1 < is then, by the second observation above, js+1 = js + k − 1. Therefore, the entry in location js+1 + k − 2 = l + k − 1 was flipped to one during the modification, so it is not possible to have a P -copy starting in location l after the modification. • On the other hand, if is+1 > is then it is not possible to have Pl+1 = Pl+2 = . . . = Pl+k−1 = 0 s+1 ≥ before the modification, since otherwise we would choose the pair (i(cid:48) m in round s + 1 of the process instead of choosing (is+1, js+1), as we have l + 1 < is+1 < js+1 and by the first observation above. s+1, l+1) satisfying i(cid:48) We conclude that after the modification, S is P -free. Hence dP (S) ≤ T. Since obviously T ≤ dE(S), we get that dP (S) = dE(S) = T, as desired. Proof of Theorem 23. Consider the following algorithm to compute the distance of a string S of length n to P -freeness, where P = 10k−1. The idea of the proof is to read S from left to right, marking P -evidences along the way and keeping track of the following quantities. • The number of 1's that were already observed but not yet marked, denoted by a. • The length of the longest streak of unmarked 0's lying immediately to our left, denoted by b. • The number of non-overlapping P -evidences found until now, denoted by c. We initialize a, b, c = 0. For i running from 0 to n − 1 we do as follows: • If Si = 1 then a is increased by one. • If Si = 0 then -- If a = 0 then we do nothing. 23 -- if a > 0 then b is increased by one. If we now have b = k − 1 then a new P -evidence was found - and we update a ← a − 1, b ← 0, c ← c + 1. The algorithm returns the value of c after the above loop stops. It is not hard to see that the algorithm indeed calculates dE(S) = dP (S). Each round of the loop takes O(1) times, so the total running time is O(n) (with no dependence on k). The space complexity is clearly O(1), as we only need to keep track of a, b, c. Proof of Theorem 24. Let S be a string of length n and suppose that P = 10k−1. Given  > δ > 0 where δ ≤ /(16 + c), we will use the following simple tester to distinguish between the case that S is -far and the case that S is δ-close to P -freeness. Since any string S must be 1/k-close to P -freeness, we may assume that  ≤ 1/k ≤ 1/2. The tester makes at most m queries, where m will be determined later. First it chooses uniformly at random and independently (allowing repetitions) i1, . . . , im/3, j1, . . . , jm/3k. Then, the tester samples single entries Sil for any 1 ≤ l ≤ m/3 and blocks Sjr , . . . , Sjr+2k−2 for any 1 ≤ r ≤ m/3k. The tester accepts the input if and only if there are no il < jr such that Sil = 1 and Sj = . . . = Sj+k−1 = 0 for some jr ≤ j ≤ jr + k − 1. Let T = {(x1, y1), . . . , (xt, yt)} be a maximal set of non-overlapping P -evidences in S. Suppose first that S is -far from P -freeness; then t ≥ n. The probability that none of the locations x1, . . . , xt/2 was sampled by the tester as a single entry is at most (1 − /2)m/3 ≤ e−m/6. On the other hand, the probability that none of the 0k−1-copies starting at locations yt/2+1, . . . , yt is fully contained in one of the sampled blocks is at most (1− k/2)m/3k ≤ e−m/6. In total, the acceptance probability in this case, i.e. the probability that no P -evidence was found is at most 2e−m/6. On the other hand, if S is δ-close to P -freeness then t ≤ δn. Since T is a maximal set of non-overlapping P -evidences, to find a P -evidence, the tester must either sample at least one of x1, . . . , xt as a single entry or one of the entries of the form yi + δ, with 1 ≤ i ≤ t and 0 ≤ δk − 1 as part of one of the sampled blocks. The probability that the first event does not occur is at least (1 − δ)m/3 > e−2δm/3. The probability that the second event does not occur is at least (1 − 3kδ)m/3k > e−2δm. Hence the acceptance probability here, which is the probability that both events do not occur is at least e−8δm/3 ≥ e−m/(6+c/8). Clearly, if we pick m = c(cid:48)/ for a large enough constant c(cid:48) that depends only on c, we will get that the quantity e−m/(6+c/8) − 2e−m/6 is positive and bounded away from zero; Therefore, with this choice of m the tester accepts δ-close inputs with probability that is bigger by an absolute constant than the acceptance probability for any -far input. This finishes the proof of the theorem, since one can build a tester that has the same query complexity (up to a multiplicative constant), in which δ-close inputs are accepted with probability at least 2/3 while -far inputs are rejected with probability at least 2/3, as desired. D A Lower Bound for Testing Pattern Freeness Here we show that any tester that makes o( 1  ) queries in an attempt to test if a fixed pattern appears in a string, must err with probability greater than 1/3. While the lower bound of [3] already entails a lower bound of Ω(1/) for testing pattern-freeness (as for any fixed pattern J the language consisting of all strings not containing J is regular), we give here a self-contained proof for two reasons. First, our proof extends to the case where k, the length of J, is allowed to depend on n. Second, it is not hard to adapt the proof to the 2D (or higher dimensions) and demonstrate a lower bound of Ω(1/) on the query complexity of testing pattern freeness of multidimensional arrays. 24 Theorem 27. [Lower bound of Ω(1/) queries] Suppose k is even and consider the pattern J := 0k/2−110k/2. Any tester that distinguishes with probability at least 2/3 between the case that a string I is J-free and the case that I is -far from being J-free, makes at least 1 13 queries to I. Note: we show that the lower bound above applies for wide ranges of possible values for : 13 in the ranging from  = On(1/n) to  = Ωk(1/k). We did not attempt to optimize the constant 1 theorem above. Furthermore, to ease readability we avoid using floor/ceiling signs. Proof. By Yao's Principle [34], it suffices to construct two distributions B and C over length n strings where all strings in B are J-free and all strings in C are -far from being J-free, with the property that any deterministic algorithm D making less than 1 13 queries to I sampled from A = 1 2 C (namely we sample from B with probability 1/2 and from C otherwise), must err with probability greater than 1/3. We now explain how to construct these distributions. 2 B + 1 The distribution B is just the single string 0n sampled with probability 1. For the distribution C we take the string I = 0n and divide it to n/k disjoint intervals of length k: I1, . . . In/k. Then, we sample randomly a subset of 2n of these intervals. For each length k interval in the subset, we choose one of the last (right side) k/2 locations and flip it to be a 1. Clearly any string from B is J-free with probability 1, while every string in C contains exactly 2n occurrences of J. Furthermore, as changing a single location in a string I sampled from C can remove at most 2 occurrences of J, such a string I is -far from being J-free. Consider a deterministic tester D that performs at most 1 13 queries to the string I. Since D is deterministic, in the case that it encounters only zeros during its queries, it has to either declare the string I as being J-free or not. The first option is that D rejects (declares '-far from J-free') when it sees only zeros. In this case D errs with probability 1 if I was chosen from B, hence it errs with overall probability of at least 1/2. We next handle the second case, where D accepts (declares 'free') when it sees only zeros. We show that in this case D errs with probability greater than 1/3, by focusing on the distribution C (i.e. the -far case). Being deterministic, when D sees only zeros it queries a fixed set X of locations, where we chose X = 1 13 . All we need to show is that under the random process of the distribution C, the fixed set of locations X does not contain a 1 w.p. > 2/3. This will suffice, since all strings from C (which is chosen w.p. 1/2) are -far from being J-free, and therefore D will fail w.p. > 1/2 · 2/3 = 1/3. Let Xi = X ∩ Ii be the set of locations from X that are in interval Ii. An interval Ii has k/2 locations where a 1 could be placed (the right half of the interval) and we can assume that the set Xi is contained in the right half of Ii (since the left half is zero w.p. 1 hence would be pointless to query by any algorithm). Clearly, P r[Xi contains a 1] = P r[Ii contains a 1] · P r[the 1 is within Xi] = n/k·Xi k/2 = 4Xi, leading to P r[X contains a 1] ≤(cid:80)n/k i=1 4Xi = 4X < 1/3, by union bound. 2n As noted, Theorem 27 can be generalized to the higher-dimensional settings (details omitted). 25
1708.02769
1
1708
2017-08-09T09:23:48
Space Subdivision to Speed-up Convex Hull Construction in E3
[ "cs.DS" ]
Convex hulls are fundamental geometric tools used in a number of algorithms. This paper presents a fast, simple to implement and robust Smart Convex Hull (S-CH) algorithm for computing the convex hull of a set of points in E3. This algorithm is based on "spherical" space subdivision. The main idea of the S-CH algorithm is to eliminate as many input points as possible before the convex hull construction. The experimental results show that only a very small number of points are used for the final convex hull calculation. Experiments made also proved that the proposed S-CH algorithm achieves a better time complexity in comparison with other algorithms in E3.
cs.DS
cs
Space Subdivision to Speed-up Convex Hull Construction in E3 Vaclav Skala, Zuzana Majdisova, Michal Smolik Faculty of Applied Sciences, University of West Bohemia, Univerzitni 8, CZ 30614 Plzen, Czech Republic Abstract. Convex hulls are fundamental geometric tools used in a number of algorithms. This paper presents a fast, simple to implement and robust Smart Convex Hull (S-CH) algorithm for computing the convex hull of a set of points in ܧଷ. This algorithm is based on "spherical" space subdivision. The main idea of the S-CH algorithm is to eliminate as many input points as possible before the convex hull construction. The experimental results show that only a very small number of points is used for the final convex hull calculation. Experiments made also proved that the proposed S-CH algorithm achieves a better time complexity in comparison with other algorithms in ܧଷ. 1 Introduction A convex hull is a fundamental construction not only in computational geometry and mathematics. It has numerous applications in various fields such as collision detection, mesh generation, shape analysis, cluster analysis, metallurgy, crystallography, cartography, image processing, sphere packing and point location. There are many other problems which can be reduced to the convex hull, e.g. halfspace intersection, Delaunay triangulation, Voronoi diagram, etc. Fast convex hull algorithms are useful for interactive applications, such as collision detection in computer games and path planning for robotics in dynamic environments. A subset ܵ⊆ℝଷ is convex if and only if for any two points ࢖,ࢗ ∈ ܵ the line segment with endpoints ࢖ and ࢗ is contained in ܵ. The convex hull ࣝℋ(ܵ) of a set ܵ is the smallest convex set containing ܵ. The convex hull of a set of points ܲ is a convex polyhedron with vertices in ܲ. Many algorithms for calculation of the convex hull in 3ܦ have been developed over the last several decades. Chand and Kapur [1] developed the Gift Wrapping algorithm, and Preparata and Hong [2] developed a recursive algorithm, which is based on Divide & Conquer. Clarkson and Shor [3] introduced an incremental insertion algorithm, where the points are processed one by one with respect to the currently constructed convex hull. Barber et al. [4] developed an efficient convex hull algorithm, which is called QuickHull. The time complexity of some of the convex hull algorithms is presented in Table 1. Several parallel algorithms for convex hull construction were proposed. Chow [12] presented a parallel convex hull algorithm that runs at ܱ(logଷ ݊) time complexity. Amato and Preparata [13] designed an ܱ(logଶ ݊) time algorithm using ݊ processors, where ݊ is the number of input points. Reif and Sen [14] proposed a randomized algorithm for three dimensional convex hulls that runs at ܱ(log݊) time using a divide and conquer approach on ܱ(݊) processors. Amato et al. [15] gave a deterministic ܱ(logଷ ݊) time algorithm for a convex hull in ܴௗ using ܱ൫݊log݊ + ݊ہௗ/ଶۂ൯ work. Gupta and Sen [11] proposed a fast parallel convex hull algorithm that is output-size sensitive. There are several convex hull algorithms modified for GPU applications. Gao et al. [17] developed a two-phase convex hull algorithm in three dimensions that runs on the GPU. Stein et al. [10] proposed a parallel algorithm based on QuickHull approach. Other algorithms are based on a probabilistic approach [18]. Precision of convex hull algorithm with regard to physical floating point representation is solved as well, e.g. in [16]. Table 1. Comparison of 3D convex hull algorithms and their time complexity. The number of input points is ݊ and ℎ is the number of points on the output convex hull. Note that ℎ < ݊, so ݊ℎ < ݊ଶ, usually ℎ ≪ ݊. Algorithm Gift Wrapping QuickHull Time complexity Reference ܱ(݊ℎ) ܱ(݊log݊) ܱ(݊log݊) ܱ(݊log݊) ܱ(݊logℎ) [1],[7] [4] [2] [3],[5] [6] Divide & Conquer Randomized Incremental Chan's algorithm 2 Proposed Algorithm In this section, we introduce a new Smart Convex Hull (S-CH) algorithm based on space subdivision for construction of the convex hull in E3. The main idea of this algorithm is to eliminate as many input points as possible using an algorithm with ܱ(ܰ) ܱ(݊log݊) is used for the remaining points, where ݊ ≪ ܰ. We use "spherical" space subdivision based on 3ܦ sectors for efficient elimination of points not contributing to complexity based on space subdivision, and a "standard" convex hull algorithm with the final convex hull. This section is organized as follows. Section 2.1 presents the first step of the S-CH algorithm, which is an inner convex polyhedron construction followed by the location of points inside the initial convex polyhedron. In Section 2.2, we describe how to perform the division of points into non-overlapping 3D pyramidal shape sectors. Section 0 presents reduction of the suspicious points. The calculation of a convex hull from the selected points with a standard convex hull algorithm is made in Section 2.4. 2.1 Location of Points inside Polyhedron At the beginning of the proposed S-CH algorithm, we need to find the extremal points in all axes, i.e. points with maximum and minimum ݔ, ݕ or ݖ coordinates. The time complexity of this step is ܱ(ܰ). For our purpose, we do not need the exact extremal points, because extremal points close enough are sufficient. This means that we do not have to search extremes through all the input points, but we can search only random sample points. According to experiments made, approx. 10% of all points is sufficient. This simplification does not cause any problems for future calculations and we save computational time as well and the complexity of this step is ܱ(ܰ) only. Therefore, we generally get six distinct extremal points or less. Now we can create a convex polyhedron using these points, see Fig. 1. Note that the extremal points are determined using the above presented estimation. We assume that the volume of the final object is nonzero, so the convex polyhedron will not be degenerated. One very important property of this polyhedron is that any point lying inside cannot be a point on the convex hull. Thus, we can perform a fast and simple initial test for a point inside/outside the polyhedron and discard many points. a) b) c) Fig. 1. Location of an initial inner testing polyhedron inside the convex hull for 104 points: a) uniform points in sphere, b) uniform points in cube, c) Gauss points. The location test of a point inside a polyhedron can be performed as follows. Each face of the polyhedron is an oriented plane with a normal vector oriented outside of the polyhedron. Then we can calculate: ܨ௜(࢞) = ܽ௜ݔ + ܾ௜ݕ + ܿ௜ݖ + ݀௜ = ࢔௜்࢞ + ݀௜ = 0, (1) where ࢞ is a point and ܨ௜(࢞) = 0 is the implicit equation of a plane with index ݅ having the normal vector ࢔࢏ = (ܽ௜,ܾ௜,ܿ௜). If ܨ௜(࢞) < 0 for at least one ݅ ∈ ሼ0,1,…,7ሽ, then point ࢞ lies outside of the polyhedron and has to be further processed. Otherwise, point ࢞ lies inside of the polyhedron and can be eliminated. 2.2 Division of Points into 3D Sectors In the second step of the S-CH algorithm, only the points, which lie outside of the initial polyhedron, will be further processed. Firstly, we perform the division of 3ܦ space into spherical" subdivision. A center point and both angles (azimuth ߮ and zenith ߠ) are several non-overlapping "pyramidal shape" sectors, i.e. we are using an "approximated used in this subdivision. The center point ࡯ is defined as the average of all vertices of the initial polyhedron. Division of space can be performed as a uniform spherical subdivision in both angles, where azimuth ߮ ∈ ሾ0,2ߨ) and zenith ߠ ∈ ሾ0,ߨሿ. However, using this, we would have to calculate the exact angles and, moreover, an explosion of small and singular triangles would occur at the both poles. Therefore, we use a simplified calculation of approximated angle. As a result of this simplification, the sectors are not uniformly distributed in the spherical coordinate space, but are uniformly distributed on the faces of a cube, see Fig. 2. Now, when calculating the azimuth and zenith, we have to locate the exact third of the octant, where the point is located and then calculate the intersection with the given face. Calculation of the intersection is easy, because all faces are axes aligned, i.e. ݔ = ±1 or ݕ = ±1 or ݖ = ±1. Finally, we have to determine a table of neighbors for each sector. Note that the neighboring sector can lie on another face of the cube. This means that adjacency of sectors can be determined across the edge of a cube or the vertex of a cube. Now we are able to calculate the exact index of a sector to which the given point belongs. a) b) Fig. 2. Division of space into 96 (16 × 6 faces) non-overlapping sectors uniformly distributed on a cube: a) sectors displayed on a cube, b) sectors displayed on a sphere. For each sector with index ݅, one maximal point ࡾ௜௠௔௫ is determined. This point equals a point where is a maximum distance between the center point ࡯ and all points in a sector. The initial points ࡾ௜௠௔௫ are lying on the faces of the initial polyhedron. These points can be calculated as an intersection point of the axis of a sector and the face of the initial polyhedron. For each new point we have to check whether the distance from this point to the center point ࡯ is greater than the distance from ࡾ௜௠௔௫ to the center point ࡯. If this is true, then we have to replace point ࡾ௜௠௔௫ with a processed point, add this point into the sector with index ݅ and recalculate the test planes, see Fig. 3. Otherwise we continue with the next step. In the next step, we check whether the processed point lies over or under the test Fig. 3. Visualization of testing planes. planes. Firstly, we determine the projection of the actual point to the face of the unit cube. Then we can compare coordinates of this projection with the projection of maximal point ࡾ௜௠௔௫ and based on the result, we choose one of four options, see Fig. 4. Now we have to use the five planes which are defined by maximal points ࡾ௜௠௔௫ of the actual sector and neighboring sectors (hatched green) and perform a test for a point over/under the plane. If the point is under all five planes, we can discard it, because such a point cannot be part of the convex hull. Otherwise we add this point into the sector with index ݅. Fig. 4. Schema of a testing point with respect to the test planes. We can gain some extra speed-up if the input dataset is pre-sorted according to the distance from the center point ࡯. In such case we start by processing the farthest points from the input dataset. It leads to fast determination of maximal points ࡾ௜௠௔௫ and more points from the input dataset can be eliminated. Moreover, the next step, which is described in Section 2.3, does not need be performed. The pre-sorted input dataset can speed-up the reduction steps. However, the sorting algorithms have the time complexity ࣩ(ܰ logܰ), which is higher than the time complexity of reduction steps ࣩ(ܰ). Therefore, it is not beneficial to sort the input dataset. 2.3 Reduction of Suspicious Points initial values before starting to divide points into non-overlapping sectors and we used We have already divided all suspicious points into sectors. We gave points ࡾ௜௠௔௫ some these points ࡾ௜௠௔௫ to check whether to add or eliminate a point. Values of points ࡾ௜௠௔௫ points using the final values of points ࡾ௜௠௔௫. We minimize the number of suspicious have changed during the division process; hence we have to recheck all suspicious points, which are input for the final convex hull construction, using this step. Final sets of suspicious points for input datasets with different distributions of points are shown in Fig. 5. a) b) c) Fig. 5. Suspicious points that are the input for convex hull creation (10ସ input points): a) uniform points in sphere, b) uniform points in cube, c) Gauss points. It should be noted that the reduction test eliminates the vast majority of given points. In case that the majority of points are close to the surface of the corresponding convex hull then the performance of reduction steps will decreases as only few points will be reduced. 2.4 Convex Hull Construction After performing the previous steps, we use any known algorithm for calculation of the convex hull. The set of input points for this algorithm equals suspicious points. The number of suspicious points is extremely low in comparison of the number of the original points; thus the time needed for determining the convex hull is insignificant compared to the time needed for reduction of the original input points. Therefore, this step is more or less independent of the choice of a convex hull algorithm. In our approach we used the library MIConvexHull1, which is based on the QuickHull algorithm. QuickHull uses a divide and conquer approach. This algorithm performs the following steps: 1 This library is available at https://miconvexhull.codeplex.com/. 1. Find three points (for example, points with minimum and maximum ݔ coordinates and a point with a minimum ݕ coordinate) which are bound to be part of the convex hull. 2. Divide the set into two subsets of points by a plane formed by the three points. This step will be processed recursively. 3. On one side of the plane, determine the point with the maximum distance from the plane. The three points found before along with this one form a pyramid. In the next step, the points lying inside of the pyramid can be ignored. 4. 5. Repeat the previous two steps on the three planes formed by the pyramid. 6. Repeat this procedure until no points are left. Then the recursion has come to an end. It can be seen that the S-CH algorithm is quite simple. In the following experimental results will be presented. 3 Experimental Results The proposed S-CH algorithm has been implemented in C# using .Net Framework 4.5 and tested on data sets using a PC with the following configuration: • CPU: Intel® Core™ i7-2600 (4 × 3,40GHz) • memory: 16 GB RAM • operating system Microsoft Windows 7 64bits 3.1 Distribution of Points The proposed S-CH algorithm has been tested using different 3ܦ datasets. These datasets have different types of distributions of points. For experiments, we used well- known distributions such as randomly distributed uniform points in a unit sphere, uniform points in a unit cube, points lying on a unit sphere or points with a Gaussian distribution. Other distributions used were Halton points and Gauss ring points, which are described in the following text. Furthermore, we describe how to generate uniform spherical data. Spherical Points. For generating uniform spherical points, spherical coordinates cannot be used, because these coordinates cause the points to be concentrated around poles. Therefore, we use the following approach to generate spherical points. First, we generate a point ࡼ lying in a cube, which represents an axis-aligned bounding box for a unit sphere, and determine the Euclidean norm of this point ‖ࡼ‖. If ‖ࡼ‖ > 1, then we return to the start. Otherwise we normalize point ࡼ. Finally, we multiply this point by the required radius. The value of a radius can be either the same for all points (points on the sphere) or randomly generated for each point. Halton Points. Construction of a Halton sequence is based on a deterministic method. This sequence generates well-spaced "draws" points from the interval ሾ૙,૚ሿ. The sequence uses a prime number as its base and is constructed based on finer and finer prime-based divisions of sub-intervals of the unit interval. The Halton sequence [8] can be described by the following recurrence formula: ܪ݈ܽݐ݋݊(݌)௞ = ∑ උ୪୭୥೛ ௞ඏ ௜ୀ଴ ௣೔శభቀቔ௞ ଵ ௣೔ቕ mod ݌ቁ , (2) where ݌ is the prime number and ݇ is the index of the calculated element. ሼ2,3,5ሽ for the Halton sequence and we got a sequence of points in a unit cube: For the 3ܦ space, subsequent prime numbers are used as a base. In our test, we used ܪ݈ܽݐ݋݊(2,3,5) = ൜൬1 2,1 3,1 5൰,൬1 4,2 3,2 5൰,൬3 4,1 9,3 5൰,൬1 8,4 9,4 5൰,൬5 8,7 9, 1 25൰, 16, 1 25൰,൬ 9 9,16 16,8 25൰,൬ 1 9,11 8,5 25൰,൬7 9, 6 8,2 ൬3 27,21 25൰,…ൠ (3) Visualization of the dataset with 104 points of the Halton sequence from (3) can be seen in Fig. 6. We can see that the Halton sequence in 3ܦ space covers this space more evenly than randomly distributed uniform points in the unit cube. Fig. 6. 3ܦ Halton points generated by ܪ݈ܽݐ݋݊(2,3,5) (left) and 3ܦ random points in a cube with uniform distribution (right). Number of points is 104 in both cases. Gauss Ring Points. Construction of Gauss ring points in ૜ࡰ space is based on the method for generating spherical points which is described above. For each point, the radius is determined using the following equation: ݎ = 0.5 + 0.5 ∙ ݏ݅݃݊ ∙ ݎܽ݊݀ீ௔௨௦௦, (4) where ݏ݅݃݊ is a randomly generated number from set ሼ−1,1ሽ and ݎܽ݊݀ீ௔௨௦௦ is a randomly generated number with Gauss distribution from interval ሾ0,∞). Visualization of the dataset with 104 Gauss ring points can be seen in Fig. 7. We can see that this dataset consists of a large set of points, which are close to the sphere, and a small set of points, which are far from this sphere. Fig. 7. 3ܦ Gauss ring points. Number of points is 104. 3.2 Examples of Convex Hull Generated Some samples of convex hulls for datasets with a different distribution of points, which consist of 104 points, are shown in Fig. 8. It can be seen, the convex hull of points on a sphere or points with uniform distribution in a sphere has a spherical shape. Moreover, these convex hulls contain the majority of points. The convex hull of points with uniform distribution in a cube or Halton points is a box-shaped object. The random shape has a convex hull of Gauss points or Gauss ring points. c) a) b) d) e) f) Fig. 8. Convex hulls of points with different distributions (10ସ points): a) uniform points in sphere, b) uniform points in cube, c) Halton points, d) Gauss points, e) Gauss ring points and f) points on sphere. 3.3 Optimal Number of Divisions In the proposed approach, the main step is the division of the input set of points into non-overlapping sectors. Therefore, we need know an estimation of the optimal number of divisions, which should depend on the distribution of points. Consequently, we have to determine it for each type of input points separately. We measured the time performance of the convex hull for different distributions of points, different numbers of points and different numbers of divisions. Measurement for 10଻ points is presented in Graph 1. For all tested distributions of input points, except points on a sphere, we can see that the time performance decreases with the increasing number of divisions until the optimal number of divisions is achieved. After that time, the complexity increases with the increasing number of divisions. The situation is different for points on a sphere. Based on Graph 1f), it can be seen that the time complexity decreases with the increasing number of divisions. This is due to the fact that points are partially organized by the first step of the S-CH algorithm, and thus the construction of the final convex hull is accelerated. The speed up is gained due to better cache memory usage, more explained in [19]. 3.90 3.60 3.30 3.00 2.70 ] s [ e m i t 2 3.30 3.13 2.95 2.78 2.60 ] s [ e m i t 2 1.90 1.83 1.75 1.68 1.60 ] s [ e m i t 2 3.40 3.23 3.05 2.88 2.70 ] s [ e m i t 32 8 Divisions count a) 128 2 32 8 Divisions count 128 b) 1.70 1.63 1.55 1.48 1.40 ] s [ e m i t 8 32 Divisions count c) 128 2 8 32 Divisions count 128 d) 48 45 42 39 36 ] s [ e m i t 8 32 Divisions count e) 128 2 8 32 Divisions count 128 f) Graph 1. The time performance of the convex hull algorithm for different distributions of points and different division counts. The divisions count denotes the number of divisions in one axis, i.e. the total number of non-overlapping sectors is 6 ∙ (݀݅ݒ݅ݏ݅݋݊ݏ ܿ݋ݑ݊ݐ)ଶ. The number of input points is 10଻. Distributions of points are: a) uniform points in sphere, b) uniform points in cube, c) Halton points, d) Gauss points, e) Gauss ring points and f) points on sphere. Evaluating experimental results for different numbers of input points, including results from Graph 1, i.e. 10ହ, √10 ∙ 10ହ, 10଺, √10 ∙ 10଺, 10଻ and √10 ∙ 10଻, we came to the following conclusion. The expected optimal number of divisions is directly proportional to number of points lying on the convex hull. If the user knows properties of the input dataset, then the number of divisions can be determined more precisely. The optimal number of divisions, which is almost the same for all numbers of input points, is shown in Graph 2. 128 64 32 16 8 4 n o i s i v i d b u s f o r e b m u n l a m i t p O 2 1E+5 1E+6 Points count 1E+7 Uniform ○ Gauss Uniform □ GaussRing Halton Sphere Graph 2. The optimal number of subdivisions for different numbers of input points and different distributions of these points. 3.4 Number of Points Processed at Each Step In order to assess the effectiveness of the proposed algorithm, we need to know what proportion of input points to eliminate in each step of our algorithm, the size of the set of suspicious points and the number of points that lie on the convex hull. All these values are given relative to the size of the input dataset. Measurements were performed for different numbers of input points and different types of point distributions. The results of these experiments are in Table 2 - Table 6. In Table 2 we can see the percentage of points eliminated by the initial polyhedron. It is obvious that the most points are eliminated for the Gauss distribution points. This is due to the fact that most of the Gauss points lie around the center. The number of points eliminated for Gauss ring points by the initial polyhedron is dependent on the total number of input points. From this, we can deduce, consistent with the Gauss ring distribution, that for smaller inputs, it may not be always possible to choose the ideal initial polyhedron. The results for the uniform distribution of points in a cube and Halton points are consistent with the theoretical estimate. (The theoretical estimate is obtained as the quotient of two volumes. The dividend is a volume of the ideal initial polyhedron and the divisor is a bounding volume for the input dataset.) The number of eliminated points is larger than the theoretical estimate for points with a uniform distribution inside a sphere. Table 2. The percentage of points eliminated by the initial polyhedron. Number of points eliminated [%] (100% means all the input data) Number of points Uniform ○ Uniform (cid:1)(cid:1)(cid:1)(cid:1) Halton Gauss Gauss  Sphere 1E+5 √10E+5 1E+6 √10E+6 1E+7 √10E+7 49.37% 12.77% 13.71% 89.79% 47.65% 49.83% 13.61% 14.28% 91.13% 59.31% 50.16% 15.22% 14.27% 91.88% 67.67% 50.33% 15.42% 13.70% 92.53% 75.57% 50.41% 15.14% 14.91% 92.85% 82.24% 50.46% 14.39% 16.66% 93.10% 86.06% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% The percentage of points eliminated by the testing planes can be seen in Table 3. The most points are reduced for Halton points and for points with uniform distribution in a cube. For all tested distributions of input points, except points on a sphere, we can see that almost all input points are discarded after these two steps of the S-CH algorithm. Table 3. The percentage of points eliminated by the testing planes. Number of points eliminated [%] (100% means all the input data) Number of points Uniform ○ Uniform (cid:1)(cid:1)(cid:1)(cid:1) Halton Gauss Gauss  Sphere 1E+5 √10E+5 1E+6 √10E+6 1E+7 √10E+7 40.42% 72.22% 72.64% 43.53% 76.93% 77.24% 45.07% 78.87% 80.29% 45.91% 80.50% 82.54% 46.51% 82.01% 82.50% 46.89% 83.65% 81.55% 6.62% 6.93% 7.10% 6.94% 6.86% 6.72% 43.11% 36.30% 30.11% 23.32% 17.18% 13.63% 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% The percentage of points eliminated by reduction of suspicious points can be seen in Table 4. The minimal number of points is discarded by this step for all tested distributions of input points. But there exist distributions of points when this step is important, e.g. points forming a spiral. We can see non-zero values for points on a sphere. This is due to the elimination of initial points ࡾ௜௠௔௫, which were artificially added at the beginning (see Section 2.2) and lying on the faces of the initial polyhedron. Table 4. The percentage of points eliminated by reduction of suspicious points. Number of points eliminated [%] (100% means all the input data) Number of points Uniform ○ Uniform (cid:1)(cid:1)(cid:1)(cid:1) Halton Gauss Gauss  Sphere 1E+5 √10E+5 1E+6 √10E+6 1E+7 √10E+7 5.24% 2.93% 1.76% 1.13% 0.82% 0.60% 7.37% 4.24% 2.54% 1.63% 1.08% 0.74% 6.66% 3.84% 2.30% 1.49% 1.01% 0.69% 2.14% 1.22% 0.66% 0.35% 0.19% 0.11% 5.78% 2.82% 1.39% 0.72% 0.36% 0.19% 0.38% 0.12% 0.04% 0.01% 0.00% 0.00% The number of suspicious points for different numbers of input points and for different types of distributions is shown in Table 5. These points are used for the final calculation of the convex hull. It can be seen that for all tested distributions of points, except points on a sphere, the number of suspicious points is extremely low compared to the number of the original points. Table 5. The percentage of suspicious points. Number of candidates [%] (100% means all the input data) Number of points Uniform ○ Uniform (cid:1)(cid:1)(cid:1)(cid:1) Halton Gauss Gauss  Sphere 1E+5 √10E+5 1E+6 √10E+6 1E+7 √10E+7 5.36% 3.84% 3.05% 2.64% 2.27% 2.05% 8.03% 5.33% 3.41% 2.47% 1.77% 1.22% 7.38% 4.76% 3.18% 2.28% 1.59% 1.10% 1.83% 0.84% 0.39% 0.20% 0.11% 0.07% 3.84% 100.00% 1.68% 100.00% 0.86% 100.00% 0.41% 100.00% 0.22% 100.00% 0.12% 100.00% Table 6 presents the percentage of points lying on the final convex hull. Convex hulls of points with Gauss ring distribution, Gauss distribution, Halton distribution or uniform distribution in a cube are determined by the few remaining points. More points lie on the convex hull of uniform points in a sphere. The convex hull of points on a sphere should be determined by all these points, but the experimental results do not correspond to this assumption. This is due to the floating point precision of calculation. Table 6. The percentage of points lying on the convex hull. Number of points on the convex hull [%] (100% means all the input data) Number of points Uniform ○ Uniform (cid:1)(cid:1)(cid:1)(cid:1) Halton Gauss Gauss  Sphere 1E+5 √10E+5 1E+6 √10E+6 1E+7 √10E+7 1.100% 0.191% 0.183% 0.173% 0.086% 95.016% 0.620% 0.073% 0.068% 0.080% 0.034% 76.890% 0.350% 0.027% 0.025% 0.038% 0.013% 42.410% 0.190% 0.009% 0.009% 0.017% 0.005% 16.370% 0.110% 0.003% 0.003% 0.008% 0.002% 5.541% 0.060% 0.001% 0.001% 0.004% 0.001% 1.805% Moreover, we can see the percentage of suspicious points, which lie on the convex hull, in Graph 3. 25% 20% 15% ξ 10% 5% 0% 1E+05 Uniform ○ Gauss GaussRing Uniform □ Halton 1E+06 Points count 1E+07 Graph 3. The percentage of suspicious points lying on the final convex hull for different numbers of input points and different distributions of these points. 3.5 Time Performance In this section, we focus on running times for the calculation of a convex hull using our proposed S-CH algorithm. Running times were measured for different numbers of input points with different distributions of points. Measurements were performed many times and average running times, calculated from the measured results, are in Table 7 - Table 9; we can see these running times in Graph 4. It can be seen that the best time performance is for datasets with the Gaussian distribution. These datasets are followed by Gauss ring points. This is expected behavior because most of the points using one of these distributions lie inside the initial polyhedron. Therefore, there are only a few points on the convex hull. The time performance for Halton points and for uniform points in a cube is similar. The running times for points with uniform distribution inside a sphere are a bit slower than the running times for uniform points in a cube. The worst time performance was obtained for points, which lie on a sphere. This is again expected behavior because there are no points for elimination during the first phase and therefore the convex hull calculation has to be done from the whole dataset. Table 7. The time performance of the convex hull for different numbers of input points and different distributions of points. The number of divisions is equal to 4. Time [ms] Number of points Uniform ○ Uniform (cid:1)(cid:1)(cid:1)(cid:1) Halton Gauss Gauss  Sphere 1E+5 √10E+5 1E+6 √10E+6 1E+7 √10E+7 36.6 111.9 339.0 1 057.8 30.7 92.9 284.2 875.8 30.3 89.9 274.4 849.2 15.5 47.9 149.5 465.5 23.9 67.8 189.2 554.3 868.0 2 470.3 5 857.8 14 426.4 3 357.6 2 710.8 2 619.1 1 471.2 1 609.4 43 515.7 10 792.3 8 497.7 8 192.9 4 611.7 4 898.7 160 238.9 Table 8. The time performance of the convex hull for different numbers of input points and different distributions of points. The number of divisions is equal to 8. Time [ms] Number of points Uniform ○ Uniform (cid:1)(cid:1)(cid:1)(cid:1) Halton Gauss Gauss  Sphere 1E+5 √10E+5 1E+6 √10E+6 1E+7 √10E+7 35.1 104.4 312.1 970.8 31.6 94.1 285.1 879.9 31.2 91.1 277.5 849.7 16.1 48.6 149.4 463.1 24.9 68.8 189.3 554.9 865.6 2 451.1 5 760.5 13 989.2 3 054.4 2 716.4 2 633.6 1 456.2 1 612.5 40 942.3 9 715.4 8 541.4 8 215.8 4 567.2 4 877.4 146 343.2 You can see the best average running time for the optimal number of divisions for each distributions of points and different numbers of input points in Table 9. Table 9. The time performance of the convex hull for different numbers of input points and different distributions of points. The results are presented for the optimal number of divisions, see Graph 2. Time [ms] Number of points Uniform ○ Uniform (cid:1)(cid:1)(cid:1)(cid:1) Halton Gauss Gauss  Sphere 1E+5 √10E+5 1E+6 √10E+6 1E+7 √10E+7 35.1 103.4 300.5 910.8 30.7 92.9 284.2 875.8 30.2 89.9 274.4 849.2 15.5 47.9 149.4 463.1 23.9 67.8 189.2 554.3 865.6 2 436.4 5 666.3 13 358.2 2 799.4 2 710.8 2 619.1 1 456.2 1 609.4 36 873.2 8 718.4 8 497.7 8 192.9 4 564.4 4 877.4 121 323.3 1E+6 1E+5 1E+4 1E+3 1E+2 1E+1 ] s m [ e m T i 1E+5 1E+6 Points count 1E+7 Uniform ○ Uniform □ Halton Gauss GaussRing Sphere Graph 4. The time performance of the convex hull for different numbers of input points and different distributions of these points. Moreover, we were performed the measurements for different real-world examples, see Fig. 9. Average running times for S-CH algorithm and QuickHull algorithm are in Table 10. We can see that our proposed S-CH algorithm give for dataset of MRI of brain better time performance than QuickHull algorithm. Contrary, time performance of QuickHull algorithm is better than S-CH algorithm for dataset of laser scanned bunny. a) b) Fig. 9. Input sets for convex hull computation: a) MRI of brain (9 247 234 points), b) laser scanned bunny (35 947 points). Table 10. The time performance of the convex hull for different real-world examples. The optimal number of divisions is equal to 16. Time [ms] Number of S-CH points algorithm QuickHull 35 947 62.0 47.0 9 247 234 2925.0 4 118.5 Model bunny brain 3.6 Comparison with Other Algorithms We compared the proposed S-CH algorithm with the incremental insertion algorithm and QuickHull algorithm, whose expected time complexity is ܱ(ܰlogܰ), and with the Chan's algorithm, which expected time complexity is ܱ(ܰlogℎ), where ܰ is the number of input points and ℎ is the number of points on the output convex hull. It should be noted that we use the library MIConvexHull, which is implemented in C# using .Net Framework 4.5, for measurements of the QuickHull algorithm. The results for the incremental insertion algorithm are based on the use of the ratio of the Randomized Incremental algorithm to QuickHull. This ratio was obtained from measurements for a C implementation of both algorithms. Running times were measured for different numbers of input points with uniform distribution inside a sphere. The resultant speed-up of the S-CH algorithm with respect to the QuickHull algorithm, Chan's algorithm and Randomized Incremental algorithm can be seen in Graph 5. p u - d e e p s 4.50 4.00 3.50 3.00 2.50 2.00 1.50 1.00 S-CH vs. Randomized Incremental S-CH vs. QuickHull S-CH vs. Chan's algorithm 1E+5 1E+6 Points count 1E+7 Graph 5. The speed-up of the S-CH algorithm for points in a sphere with uniform distribution with respect to QuickHull, Chan's algorithm and Randomized Incremental algorithm for the same datasets. It can be seen that the proposed S-CH algorithm clearly outperforms "standard" convex hull algorithms. The graph shows that speed-up grows slowly from 10଻ points. This is due to swapping. 4 Conclusion A new fast convex hull algorithm in ܧଷ has been presented. The S-CH algorithm uses a space division technique. It is robust, as we do not use any angle calculations, and can process a large number of points as well as different distributions of points. Advantages of the S-CH algorithm are simple implementation, robustness and the use of almost any known algorithm for the final calculation of the convex hull as very efficient filtering, very small number of points are left for the final processing, i.e. for the final convex hull construction. Therefore the final efficiency is not sensitive to the convex hull algorithm properties. Thus, any brute force algorithm, which is easy to implement and robust, can also be used without significant influence to the algorithm efficiency. We do not assume any special order of input points. Otherwise, there is a possibility for a modification to increase the effectiveness of the algorithm. For future work, the S-CH algorithm can be easily parallelized, as most of the steps are independent, and for large datasets influence of caching and data transfer should be explored more deeply. Acknowledgments. The authors would like to thank their colleagues at the University of West Bohemia, Plzen, for their comments and suggestions, and anonymous reviewers for their valuable comments and hints provided. The research was supported by MSMT CR projects LH12181 and SGS 2013-029. References [1] D.R. Chand, S.S. Kapur, An algorithm for convex polytopes, Journal of the ACM (JACM) 17 (1) (1970) 78-86. [2] F.P. Preparata, S.J. Hong, Convex hulls of finite sets of points in two and three dimensions, Communications of the ACM 20 (2) (1977) 87-93. [3] K.L. Clarkson P.W. Shor, Applications of random sampling in computational geometry, II, Discrete & Computational Geometry 4 (1) (1989) 387-421. [4] C.B. Barber, D.P. Dobkin, H. Huhdanpaa, The quickhull algorithm for convex hulls, ACM Transactions on Mathematical Software (TOMS) 22(4) (1996) 469-483. [5] M. Kallay, The complexity of incremental convex hull algorithms in Rd, Information Processing Letters 19 (4) (1984) 197. [6] T.M. Chan, Optimal output-sensitive convex hull algorithms in two and three dimensions, Discrete & Computational Geometry 16 (4) (1996) 361-368. [7] K. Sugihara, Robust gift wrapping for the three-dimensional convex hull, Journal of Computer and System Sciences 49 (2) (1994) 391-407. [8] G.E. Fasshauer, Meshfree Approximation Methods with MATLAB, World Scientific Publishing Co., Inc., 2007. [9] F. Yaacoub, Y. Hamam, A. Abche, C. Fares, Convex Hull in Medical Simulations: A New Hybrid Approach, IEEE Industrial Electronics, IECON 2006-32nd Annual Conference on (2006) 3308-3313. [10] A. Stein, E. Geva, J. El-Sana, CudaHull: Fast parallel 3D convex hull on the GPU, Computers & Graphics 36 (4) (2012) 265-271. [11] N. Gupta, S. Sen, Faster output-sensitive parallel algorithms for 3D convex hulls and vector maxima, Journal of Parallel and Distributed Computing 63 (4) (2003) 488-500. [12] A. Chow, Parallel algorithms for geometric problems. PhD thesis. University of Illinois, Urbana-Champaign (1980). [13] N.M. Amato, F.P. Preparata, The parallel 3D convex hull problem revisited, International Journal of Computational Geometry & Applications 2 (02) (1992) 163-173. [14] J.H. Reif, S. Sen, Optimal parallel randomized algorithms for three-dimensional convex hulls and related problems, SIAM Journal of Computing 21 (3) (1992) 466-485. [15] N.M. Amato, M.T. Goodrich, E. Ramos, Parallel algorithms for higher-dimensional convex hulls, In Proc. Foundations of Computer Science (1994) 683-694. [16] A. Edalat, A. Lieutier, E. Kashe, The convex hull in a new model of computation, In Proc. 13th Canad. Conf. Comput. Geom. (2001) 93-96. [17] M. Gao, T.T. Cao, A. Nanjappa, T.S. Tan, Z. Huang, gHull: A GPU algorithm for 3D convex hull, ACM Transactions on Mathematical Software (TOMS) 40 (1) (2013) 3:1-3:19. [18] D. Yan, Z. Zhao, W. Ng, S. Liu, Probabilistic Convex Hull Queries over Uncertain Data, IEEE Transactions on Knowledge and Data Engineering 27 (3) (2015) 852-865. [19] N. Amenta, S. Choi, G. Rote, Incremental Constructions con BRIO, Proceedings of the 19th annual symposium on Computational geometry (2003) 211-219.
1303.2514
2
1303
2013-03-12T21:41:59
A local constant-factor approximation algorithm for MDS problem in anonymous network
[ "cs.DS" ]
In research on distributed local algorithms it is commonly assumed that each vertex has a unique identifier in the entire graph. However, it turns out that in case of certain classes of graphs (for example not lift-closed bounded degree graphs) identifiers are unnecessary and only a port ordering is needed. One of the open issues was whether identifiers are essential in planar graphs. In this paper, we answer this question and we propose an algorithm which returns constant approximation of the MDS problem in CONGEST model. The algorithm doesn't use any additional information about the structure of the graph and the nodes don't have unique identifiers. We hope that this paper will be very helpful as a hint for further comparisons of the unique identifier model and the model with only a port numbering in other classes of graphs.
cs.DS
cs
A local constant-factor approximation algorithm for MDS problem in anonymous network Wojciech Wawrzyniak1 ∗ Faculty of Mathematics and Computer Science, Adam Mickiewicz University, Pozna´n, Poland, [email protected] Abstract In research on distributed local algorithms it is commonly assumed that each vertex has a unique identifier in the entire graph. However, it turns out that in case of certain classes of graphs (for example not lift-closed bounded degree graphs) identifiers are unnecessary and only a port ordering is needed [8]. One of the open issues was whether identifiers are essential in planar graphs. In this paper, we answer this question and we propose an algorithm which returns constant approximation of the MDS problem in CON GE ST model. The algorithm doesn't use any additional information about the structure of the graph and the nodes don't have unique identifiers. We hope that this paper will be very helpful as a hint for further comparisons of the unique identifier model and the model with only a port numbering in other classes of graphs. 3 1 0 2 r a M 2 1 ] S D . s c [ 2 v 4 1 5 2 . 3 0 3 1 : v i X r a ∗The research supported by grant N N206 565740. 1 A local constant-factor approximation algorithm for MDS problem in anonymous network 1 Introduction In recent years, there has been a growing interest in designing distributed local algorithms. It might come out of the easiness of applying these algorithms in reality. They run very fast (in constant time) and are tolerant to the network structure changes and node failures. It turns out the running time of these algorithms is completely decoupled from the size of the network and each node takes its decision based only on the knowledge about its k-neighbourhoods. This fact is very important for the scalability of an algorithm in large networks. If the structure of the network changes (i. e. a vertex is removed), then an algorithm must be re-called to repair a solution only for a small surrounding of the removed vertex. It is a significantly faster solution than in case of standard algorithms requirements, which require re-execution of the algorithm on the entire network. In some research on designing local algorithms(but not strictly local), it is allowed that nodes have a knowledge about the f (n)-neighbourhood, where f (n) is a function that depends on the number of vertices in the network. However, in this paper we only consider strictly local algorithms, that do not need any additional information about the structure of the graph and don't have unique identifiers, so they satisfy much stronger assumptions. In recent years, several deterministic distributed local algorithms have been proposed. They return solutions that are good approximations of various problems (e.g. minimum edge cover, minimal dominating set[12], semi-matching[6, 7]), in constant time in different classes of graphs (e. i. bounded degree graphs, planar graphs). However, these algorithms very often assume that nodes have unique identifiers. This assumption could be very important if we consider a more "real" model, in which in a single communication round, each vertex can send a message which contains at most O(log n) bits, where n = V (G) is the number of vertices in the graph. This limitation makes it impossible to e.g. detect small cycles in the network, gather knowledge of 2-hop neighbourhoods. Recently in a paper [8] the authors Goos et al. have shown that for lift-closed bounded degree graphs, a model with unique identifiers (known as LOCAL [14]) and model with a port numbering only(known as PO model[8]), are practically equivalent. However, techniques used in their work do not allow us to consider the equivalence of these models for Minimum Dominating Set(M DS) problem in planar graphs. It is known[12] that there exists an algorithm for planar graphs which, in constant time, returns a constant approximation of the M DS in model with unique identifiers and an unbounded message size. It turns out that there also exists a strictly local algorithm for planar graphs, that in the model without unique identifiers and with upper bounded message size, finds constant approximation of the Minimum Dominating Set. 1.1 Related Work A distributed algorithm is called a local algorithm if it completes in a constant number of synchronised communication rounds. If we assume that the nodes do not have any additional information about the other vertices, then we say that our algorithm is strictly local. The research on local algorithms has been ongoing for several years ([1, 3, 9, 14, 15, 16, 17]), but the strictly local algorithms gained the increased interest just recently. There are now more than one hundred works referring, more or less closely, to the topic of such algorithms. Thus, it is not possible to briefly describe all of these publications. The best way to study this topic is to read excellent survey[18] written by Suomela. That article describes all the important results obtained so far by all the researchers. One of many open questions is an issue raised in a paper [8] concerning the similarity of two models: a model with unique identifiers and a model with only a port numbering for MDS problem in planar graphs. We answer this question. 2 A local constant-factor approximation algorithm for MDS problem in anonymous network One of the first papers, that considered network without unique identifiers, has been written by Angluin [2]. Unfortunately, in 1992, Linial showed in [14] that there is no algorithm that, in constant time, finds a Maximal Independent Set in a cycle in the unique identifiers model. This result shows how difficult it is to find a fast distributed algorithm and it is even more difficult if we consider strictly local algorithms only. Thankfully, in 1995 Naor and Stockmeyer in [16] introduced the concept of Local Checkable Labelling(LCL) problems and showed that if there is a local algorithm in a model with unique identifiers on nodes then there is also order-invariant local algorithm which uses only the fact that for each pair v, u of vertices id(v) < id(u) or id(v) > id(u). So from the point of view of the LCL problems both models are almost equivalent. Note that the class of LCL problems contains among others the maximal independent set or vertex colouring. Thus, a natural question then came up, whether there exists an algorithm which, without information about the sequence of vertices is able to solve any non-trivial problem. Kuhn and Wattenhofer in [11], presented the first local but randomized algorithm for bounded degree graphs. Their algorithm does not require long messages. Then in [10] the algorithm has been improved by Kuhn et al. Notice that both approaches used the method of linear programming. The first local algorithm for MDS problem for planar graphs was proposed by Lenzen et al. in [12], but their algorithm requires long messages and unique IDs on nodes. There is also a lower bound for possible approximation factor of an algorithm. In [4] it has been shown that there is no algorithm which in a constant number of communication rounds returns an (5 − ǫ) approximation of the MDS in planar graphs. 1.2 Main Results and Organisation Our main result is summarised in the following theorem. Let M denote an arbitrary MDS in a planar graph G = (V, E). Theorem 1. Let G = (V, E) be a planar graph and D be a set returned by algorithm Port- NumberingMds. Then D ≤ O(M ). The rest of this paper is structured as follows. We begin by describing the computational model and notation used in this paper. Then in section 2.1 we briefly introduce the principle of our algorithm and its formal pseudocode. Next, in section 2.2, we present the analysis of the correctness of our algorithm, and compute the approximation factor of the algorithm. At the end, in section 3, we summarise our considerations. 1.3 Model and Notation In this paper we work in a synchronous communication model and as a representation of the network we use a planar graph G = (V, E). Edges in the graph will correspond to communica- tion links and processors will correspond to vertices from the set V . Moreover, we assume that each vertex has its own labelling of its incident edges and vertices do not have unique identifiers and also do not have any additional information. In order to facilitate the reader to understand this paper, we use the same notations as in [12]. For nodes A ⊆ V we define the set of inclusive neighbourhood of A as N + A := {v : v ∈ A ∨ ∃e=uv∈Eu ∈ A}. We also denote the neighbours of A not in A as NA := N + A \ A. To simplify the notation in cases where A = {a} we may omit the braces, e.g. Na instead of N{a}. 3 A local constant-factor approximation algorithm for MDS problem in anonymous network 2 Constant approximation in CON GEST model 2.1 Algorithm The key idea of the algorithm is based on an appropriate use of planarity of the graph G. Intuitively, some vertex v should belong to the dominating set D if it dominates a lot of its neighbours. However, in reality, such approach does not give a constant approximation as we can see in the Figure 7. This situation occurs if graph G contains many vertices with big common neighbourhood. In our algorithm we first dominate only a small subset of these vertices (step 2 and 3 of the algorithm). So we avoid unnecessary adding of multiple vertices which dominate the same or almost the same neighbourhoods. Algorithm 1 PortNumberingMds 1: D := ∅. 2: D1 := Hop2Dominate(G,D), D := D ∪ D1 3: D2 := Hop2Dominate(G,D), D := D ∪ D2 4: for v ∈ V in parallel do v \ N + D 5: D V \N + δ v if v /∈ N + := N + D then V \N + w D } v ∩ND) {δ µv := maxw∈(N + choose any w(v) ∈ {w ∈ (N + D3 := {w(v) : v /∈ N + v ∩ ND) : δ V \N + w D = µv} D }, D := D ∪ D3 10: return D Function 2 Hop2Dominate(G,D) 1: for v ∈ V in parallel do δV \D 2: for v ∈ V \ D in parallel do ∆V \D {δV \D } v : δV \D(u) = ∆V \D choose any x(v) ∈ {u ∈ N + X := X ∪ {x(v)} := maxw∈N + v \ N + D := N + 4: 3: 5: w v v v v } 6: 7: 8: 9: 8: 9: 10: 11: 6: for v ∈ V in parallel do 7: v := N + δX if v ∈ X then v ∩ X {δX ξv := maxw∈N + choose any d(v) ∈ {w ∈ N + Dnew := {d(v) : v ∈ X} w } v v : δX w = ξv} 12: return Dnew In the next round each vertex not dominated yet adds to the set D a dominated vertex with biggest residual degree from its dominated neighbourhood. The planarity of the graph G ensures that there is a small number of such added vertices. To prove that both sets are small, we will use well known fact that Jordan curve divides the plane into two regions - an interior and an exterior, so that any cycle in a planar graph G divides the graph into two parts without edges between their interiors. We partition our plane graph into disjoint regions in such way that the number of regions are proportional to the size of the set D and moreover, in each region there is at least one vertex from the set M . 4 A local constant-factor approximation algorithm for MDS problem in anonymous network 2.2 Analysis As can be easily seen, the algorithm can be performed in a constant number of communication rounds and returns a dominating set due to last round (step 9), where all not dominated vertices add exactly one of their neighbours to the dominating set D. Therefore, in our analysis we only need to show that the numbers of vertices added to the dominating set D in steps 2, 3 and 9 are small enough that our algorithm returns solutions which are a constant approximation of an optimal MDS. To simplify notation in our analysis, we assume that the set of vertices added in step 2, 3 and 9 will be denoted by D1, D2 and D3 respectively, and some fixed optimal solution will be denoted as M . We need to recall the following well-known lemma. Lemma 1. A minor of a planar graph is planar. A planar graph of n nodes has less than 3n edges. A planar bipartite graph of n nodes has less than 2n edges. We will begin the analysis of our algorithm with estimating the maximal number of vertices added to the set D1 \ M . To bound this value we need to define a special subgraph G1 of graph G. Definition 1. Let graph G1 = (V1, E1) be a subgraph of G = (VG, EG) constructed in the following way: i) V1 := X ∪ D1 and E1 = ∅, where X is a set from step 2 of the algorithm. ii) Add all edges between vertices from V1. iii) Add minimal number of edges (from EG) and nodes (from VG) such that each vertex from the current set V1 has adjacent vertex from the set M or is contained in the set M (so for each v ∈ V1 we have N + v (G1) ∩ M 6= ∅). In order to simplify the description of proofs, we will also introduce the following notation (see Figure 1): XM := {v : v ∈ (X ∩ M )} , XS := {v : v ∈ X \ M ∧ N + XL := {v : v ∈ X \ (XM ∪ XS)} , Ei := {{v, x} : v ∈ (YL \ M ) ∧ x ∈ Xi} , Y := YM ∪ YS ∪ YL d(v) ∩ X ≤ c}, YM := {d(v) : v ∈ XM } , YS := {d(v) : v ∈ XS} , YL := {d(v) : v ∈ XL, } , i ∈ {M, S, L} , where d(v) is a vertex chosen in the step 10 of the algorithm. Notice that not all of the subsets are disjoint, for example, it is possible that some fixed vertex v belongs to both sets YL and XL (v ∈ YL ∩ XL). To show that the maximal number of vertices in the set D1 \ M ⊆ YM ∪ YS ∪ YL is comparable to the order of the set M , we will consider the size of each set YM , YS, and YL separately. This analysis is contained in Lemma 2, Lemma 3 and Lemma 7. At the beginning we will prove, a simple but very useful fact. Fact 1. Yi ≤ Xi for each i ∈ {M, S, L} Proof. Note that the vertex from the set Yi has been added in step 2 of the algorithm by one of the vertices in Xi. In addition, each vertex x ∈ Xi adds at most one vertex to D1. Thus, the order of the set Yi cannot be greater than the order of the set Xi. Lemma 2. XM ≤ M and YM ≤ M . Proof. The set XM is a set contains the elements which both belong to sets X and M . Hence the order of XM is less or equal to the order of M (XM ≤ M ). Moreover, using Fact 1, we obtain that YM ≤ XM ≤ M . 5 A local constant-factor approximation algorithm for MDS problem in anonymous network Y M X M Y S <c Y L w v >c X \ Y S S X \ Y L L M Figure 1: An example of the graph G1. If d(v) = u then edge e = vu is marked by an arrowhead. Lemma 3. XS ≤ cM and YS ≤ cM . w := N + w (where δX Proof. In the step 2 of the algorithm every vertex v ∈ X adds its adjacent vertex w ∈ N + v with the biggest residual X degree δX w ∩ X) from the inclusive neighbourhood. The definition of the set XS implies that every vertex v ∈ XS that does not belong to M has at least one neighbour in the set M , so that vertices from the set XS have to be dominated in the optimal solution M . Let us define a set A := NXS ∩ M then for all m ∈ A we have that the residual X degree of m is less or equal to c (δX m ≤ c). Otherwise, the vertex v would not belong to XS (v /∈ XS) because its residual X degree is bigger than c. Hence, every vertex m ∈ A ⊆ M dominates at most c vertices from the set XS so M ≥ XS/c. Using YS ≤ XS from Fact 1, we obtain that M ≥ XS/c ≥ YS/c. Our goal is to show that D1 \ M = O(M ) so it is left to prove that the maximal number of vertices in YL is small (YL = O(M )). For this purpose, we will use a technique of splitting the graph G into bunches and then we will show that each induced region of a bunch contains many vertices from the set M . We start by defining what we mean by a term bunch, which was first introduced in [5]. Definition 2. Let G = (V, E) be a planar graph, S ⊆ V , T ⊆ V and W ⊆ V . A vi-vj-path is called S-T-W-special if it has the form viuvj, where vi ∈ S, u ∈ T and vj ∈ W . Although our algorithm works in planar graphs, in the analysis we assume that the given graph G is plane. Let us recall some basic theoretical graph terminology for planar graphs. If G is a plane graph in R2 then maximal open set f in R2 \ G such that any two points in f can be connected by a curve contained in f is called a face of G. Let P, Q be two special vi-vj-paths. In any plane drawing, graph P ∪ Q contains exactly one bounded face. (We will assume here that the face is empty if P = Q.) Now we set F (P ∪ Q) := f and Reg[P ∪ Q] := (P ∪ Q) ∪ f where f is the bounded face in the drawing of P ∪ Q. Definition 3. Let G = (V, E) be a plane graph and let vi ∈ S, vj ∈ W , T ⊂ V where i 6= j. A maximal set B of S-T-W-special paths between vi and vj is called a S-T-W-bunch between vi and vj if there exist two distinct paths P, Q ∈ B such that all paths from B are contained in Reg[P ∪ Q] and no vertex from S ∪ W is contained in F (P ∪ Q). In addition, the paths P, Q will be called the boundary paths of B. Moreover if a bunch B contains at least five special paths then we say that B is a large bunch. To simplify the notation, if the sets A, B, C are clear from the context, we will write special paths instead of A-B-C-special paths. In one of the last lemmas in this paper we will consider 6 A local constant-factor approximation algorithm for MDS problem in anonymous network special paths and bunches of length three. Their definition is analogous to the definitions of bunches with special paths of length two. After defining the concepts of bunches and special paths, next, in Fact 3 and Lemma 7, we will estimate their sizes. Then, in Lemma 6, we will show that most of regions designated by the bunches contain many vertices from the set M . The proof of Fact 3 is quite complicated and at the beginning we show that the number of connected components of the induced subgraph is smaller than M . Lemma 4. Let G = (V, E) be a graph and M be a dominating set in G. If H = (VH , EH ) is a subgraph of G such that M ⊆ VH and every vertex v ∈ VH \ M contains at least one adjacent vertex from M then ω(H) ≤ M . Proof. Let Z1, Z2, . . . , Zk be a partition of VH to minimal number of connected components. If a set Zi contains at least one vertex v ∈ VH \ M then there is a vertex m ∈ M such that {m, v} ∈ EH . Hence each connected component Zi contains at least one vertex from M . In other case there is no vertex v ∈ VH \ M in component Zi then since Zi 6= ∅ thus Zi contains at least one vertex from a set M . We obtain that each connected component contains at least one vertex from M thus ω(H) ≤ M . Lemma 5. Let G = (V, E) be a planar graph and A, B, C ⊆ V be subsets of vertices such that the sets are pairwise disjoint and each vertex from B is adjacent to at least one vertex from each sets A and C. Then graph G contains at most 4(A + C) + ω(V ) A-B-C-bunches, where ω(V ) denote the number of connected components in graph G. Proof. To bound the number of bunches in the graph G more effort is required. First of all, we need to define a multigraph H = (VH , EH ) obtained from G by contracting each vertex x ∈ B to any adjacent vertex m ∈ C and adding edge between contracted vertices and neighbours of a vertex x from a set A (see Figure 2). Let vertices u, w ∈ V was contracted in the graph H then we say that path vuw from the graph G (v ∈ A, u ∈ B, w ∈ C) corresponds to edge e = {v, uw} in the graph H. Notice that each vertex x ∈ B is adjacent with exactly one vertex m ∈ C. A v 1 v 2 B v 3 v 4 v 5 v 6 v 7 A v 1 v 2 e v 8 v 9 C G v 3,4,5,8 v 6,7,9 H Figure 2: An example of the construction of the graph H. We say that path v2v5v8 from the graph G corresponds to edge e in the graph H. Let us consider a connected component of the multigraph H (H[Zi]), where Zi ⊆ VH denotes H in a the set of all vertices from such component. Then we can find spanning tree T := T Zi multigraph H[Zi]. From a well known Lemma 1 we know that a multigraph H[Zi] is planar. 7 A local constant-factor approximation algorithm for MDS problem in anonymous network Consider a plane drawing of H[Zi]. Let for every vertex v ∈ Zi and ǫv > 0 define a ball Cv around a vertex v of radius ǫv, such that Cv intersects only with these edges of H[Zi] that contain v and does not contain points from other balls. We denote a connected region of Cv \ T ⊆ R2 as a side of vertex v. It is obvious that every edge from E(H[Zi]) \ E(T ) that contains v reaches v by some side s of a vertex v. In this case we will say the edge ends in side s (see Figure 3). e 1 s 1 s 3 v s 2 e 2 e 3 Figure 3: An example of sides in an arbitrary graph, as we can see that edges e2, e3 end in side s2 of vertex v. The edges of the tree T are shown in bold. We also have to prove similar fact like in paper [5]. Fact 2. The multigraph H contains at most two edges e, e′ of E(H[Zi]) \ E(T ) such that e and e′ end in the same sides and corresponding special paths of edges e, e′ in G belong to different A-B-C-bunches in corresponding graph G[Z ′ i denotes all contracted vertices in Zi. Furthermore there is at most one such pair of edges e, e′ in a multigraph H. i], where Z ′ Proof. Let F be the set of u-v edges from E(H[Zi]) \ E(T ) that end in the same sides of u and v. Assume that e, e′ ∈ F belong to different bunches then C1 := uT v + e is a cycle and consequently every other u-v edge i.e. e′ must be contained in one of the regions of C1. Because corresponding special paths of e and e′ are contained in different bunches in G[Z ′ i] thus the region R[C1] ∪ R[C2] where C2 := uT v + e′ contains all vertices from Z ′ i. If there is other u-v edge e′′ which belongs to different bunch than e and e′ contained in the bounded face of C1 or bounded face C2 then there is a vertex z from the set Zi which is contained in the bounded region of the cycle ueve′u. Then e,e' and e" end in different side of u (contradiction). Moreover if graph H ′ contains such edges e, e′ then from planarity there is no any other pair of edges e2, e′ 2 ∈ E(H[Zi]) \ E(T ) which ends in the same sides of two vertices. Let H ′[Zi] be the supergraph of T obtained as follows. For every vertex v ∈ VT put a vertex wv in each side of v and join it with v by one edge. The set of new added vertices we denote as VT ′ . Substitute the edge from E(H[Zi]) \ E(T ) which ends in the side of v containing wv with the edge that ends in wv. Let e1, e2, . . . , ek ∈ E(H[Zi]) \ E(T ) be a maximal set of edges which corresponds to special paths in some fixed bunch from G[Z ′ i] then we remove edges e2, e3, . . . , ek from H ′[Zi]. The supergraph H ′[Zi] is a planar multigraph and using Fact 2 we obtain that almost every pair of vertices (except for one) could be connected by at most one edge from a set E(H ′[Zi]) \ E(T ). Let us notice that for each bunch in G[Z ′ i] there exists disjoint corresponding edge in H ′[Zi]. For every vertex v ∈ T we add exactly degT (v) new vertices, thus we can simply 8 A local constant-factor approximation algorithm for MDS problem in anonymous network e' e' u v w 1 u w 2 w 3 v w 4 e e H H' Figure 4: An example that sum of two regions R[C1] ∪ R[C2] contain all vertices from Zi. The edges of the tree T are shown in bold. determine the number of new added vertices from a supergraph H ′[Zi] VT ′ = Xv∈VT dT (v) = 2T − 2. (1) Let us observe that in our lemma we consider A-B-C-bunches, where sets A, B, C are pairwise disjoint. Thus each special path of considered bunches has one endpoint in set A and one in B. Hence we may assume that our supergraph is bipartite. Using Lemma 1, Fact 2 and equation (1) we obtain that number of edges H ′[Zi] ≤ 2VT ′ + T ′ + (T − 1) + 1 ≤ 7H[Zi] − 6. (2) Notice that edges between vertices from a spaning tree T and new vertices VT ′ was added in supergraph H ′ but not exists in T and moreover some edges (i.e. w3w4) belong to the same bunch. We can omit such edges in our calculation, thus the maximal number of bunches in the graph G[Zi] is less than 4Z1. Unfortunately, the graph G may not be connected, therefore the number of bunches B1 may be greater than Pi 4Zi due to some bunch B could be contained in a region of other bunch B′. If we consider creating a multigraph H by sequentially adding connected components then in i-th step after adding corresponding G[Zi] component we create at most 4Zi + 1 new bunches. So a graph G contains at most 4(A + C) + ω(G) bunches. Fact 3. Let A := YL \ M , B := XL \ YL and C := M . Then the graph G1 contains at most 4YL \ M + 5M A-B-C-bunches. This set of bunches we denote by B1. Proof. This follows directly from Lemma 4 and Lemma 5. Lemma 6. Let B ∈ B1 be a bunch such that B contains at least five (YL \ M )-(XL \ YL)-M - special paths in the graph G1 (bB ≥ 5). Then M ∈ F (B) ≥ (cid:6) bB −3 {m ∈ M : m ∈ F (P, Q) and P , Q are boundary paths of a bunch B}. 2 (cid:7) , where M ∈ F (B) := Proof. Let us consider the structure of a subgraph of G induced by vertices contained in a region designated by a boundary of special paths of some bunch B ∈ B1 (R[B]). Recall that we denote a number of special paths in a bunch B ∈ B1 as bB and we take into account only bunches B ∈ B1 such that bB ≥ 5. Hence each considered bunch contains a vertex v ∈ YL \ M , a vertex m ∈ M and at least five vertices from the set XL \ YL (see Figure 5). Moreover, a bunch B creates at least bB − 1 disjoint regions in the graph G \ B. We will show that many of them 9 A local constant-factor approximation algorithm for MDS problem in anonymous network x 1 i-1x x j LX \ LY i+1x m' x k Yv L x i z m M Figure 5: Example of a subgraph of G for some bunch B ∈ B1. Region F (v, xi−1, m, xi+1) is marked with grey colour. contain vertices from M and, more precisely, each region R[B] contains at least ⌈(bB − 3)/2⌉ vertices from M . Since vertex xi belongs to the set XL \ YL, thus xi was added to X by some vertex u ∈ V in the step 5 of the algorithm, as a vertex with the largest degree in the neighbourhood N + u (G). It is possible that v = u but note that a vertex v can add only one such vertex. Let us assume that u 6= v. Using an assumption that bB ≥ 5 we obtain degG(m), degG(v) ≥ 5 thus an interior vertex xi(see Figure 5) could not have been added by any of the vertices xi−1, xi+1 or m until some other node z adjacent to xi exists in F (v, xi−1, m, xi+1, v)(see Figure 5). Hence each interior vertex xi ∈ F (B) is adjacent with at least one vertex z from region F (v, xi−1, m, xi+1, v) such that at least one of the following cases is satisfied or x(v) = xi a) z ∈ M b) ∃m′ ∈ M such that {m′, z} ∈ EG and m′ ∈ F (v, xi−1, m, xi+1, v) 1, m′ 2, . . . , m′ k ∈ M such that each m′ Let z1, z2, . . . , zk be a set of vertices lying inside F (v, xi−1, m, xi+1, v) and adjacent to a ver- tex xi. Suppose that x(v) 6= xi and case a) is not satisfied for any zj, so x(v) 6= xi and In the optimal solution M every vertex v ∈ V belongs to M or has a z1, z2, . . . , zk /∈ M . neighbour in this set, thus there exist vertices m′ j domi- nates zj (j ∈ {1, 2, . . . , k}). Recall that there exists zl ∈ {z1, z2, . . . , zk} such that x(zl) = xi (determined in step 4 of the algorithm) so degG(m′ l) ≤ degG(xi). Assume by contradiction, that case b) is also not satisfied for each m′ k = m, but in this case degG(m) > degG(xi) and thus there is no vertex zl such that x(zl) = xi. It is a contradiction with assumption that xi ∈ X. Hence at least one of the cases a), b) is satisfied. In a subgraph induced by boundary paths of a bunch B there are exactly bB − 2 internal vertices from the set XL \ YL and furthermore at most one such vertex could be chosen by vertex v ∈ YL \ M from this bunch. So at least bB − 3 internal vertices of the bunch have corresponding vertex m′ ∈ M which is contained in the region F (v, xi−1, m, xi+1, v). Notice that it is possible that two vertices xj, xj+1 ∈ XL \ YL have corresponding vertices m′, m′′ in the same face (i.e m′ = m′′). Thus, we get that M ∈ F (B) ≥ ⌈(bB − 3)/2⌉. 2 = . . . = m′ 1, m′ 2, . . . , m′ k. Then m′ 1 = m′ Now we are ready to show that the YL = O(M ). Lemma 7. Let c ∈ N and c′ > 0 be constants such that 22c′ cc′ − 24c′ − 2 > 0 and C := max(cid:26) 22c′ cc′ − 24c′ − 2 , c′(cid:27). Then YL \ M ≤ CM so YL ≤ (C + 1)M 10 A local constant-factor approximation algorithm for MDS problem in anonymous network Proof. We start with an outline of the proof. Our goal is to show that YL \ M = O(M ). To this end, we first prove that there are many of edges in the set EL (EL was specified in Definition 1 on page 5). Since EL is large set, the graph G1 contains also many (YL \ M )- (XL \ YL)-M -bunches. In addition using Lemma 6, most of them contain a lot of vertices from the optimal solution M . Hence, finally we get that YL = O(M ). Assume that YL \M > c′M (where c′ > 0). In other case lemma is proved because C ≥ c′. To estimate the order of the set of edges EL we will first consider number of edges in sets EM and ES in a graph G1. Notice that the graph G1 is planar and sets XM and YL \ M are disjoint (XM ∩ (YL \ M ) = ∅). Hence, from the assumption that YL \ M > c′M and Lemma 1 and Lemma 2 we get that EM ≤ 2(XM + YL \ M ) ≤ 2(M + YL \ M ) ≤ (2YL \ M (c′ + 1))/c′. Notice also that set ES is empty (ES = ∅). Indeed, if there is an edge e = {u, v} such that u ∈ XS and v ∈ YL \ M then vertex u would have chosen vertex v ∈ YL \ M , so u would not be in the set XS (u /∈ XS). Let E′ L be a subset of EL, where no edge has two endpoints inside YL \ M set. Thus using planarity we obtain the following inequality E′ L ≥ EL − 6YL \ M . From the definition of the set YL we know that each vertex v ∈ YL is adjacent to at least c vertices from X := XM ∪ XS ∪ XL. Hence, E′ L ≥ cYL \ M − EM − ES ≥ cYL \ M − 0 − 2YL \ M (c′ + 1) c′ ≥ YL \ M · cc′ − 2c′ − 2 c′ Observe that there is a bijection from E′ the graph G1. Thus a graph G1 contains at least E′ L special paths. L to a set of (YL \ M )-(XL \ YL)-M -special paths in Now we would like to use fact 3 and lemma 6 together. To do it we have to ensure that considered bunches contain at least five special paths (assumption of the lemma 6). Recall that if bunch B contains at least five special paths then we say that B is large. It is obvious from pigeonhole principle, that there are at most 4B1 special paths which do not belong to large bunches. Now we will calculate order of the set of (YL \ M )-(XL \ YL)-M -special paths in graph G1 which belong to the set of large bunches. From Fact 3 we know that B1 ≤ 4YL \ M + 5M , so at most 16YL \ M + 20M considered special paths not belong to a set of large bunches. Let BBIG be a set of special paths which are contained in some large bunch and such that a internal vertex xi of each special path v, xi, m was not added to set X by a vertex v then 1 BBIG 1 ≥ E′ L − (16YL \ M + 20M ) ≥ YL \ M · cc′ − 24c′ − 2 c′ − 20M Using lemma 6 and observing that in calculation of a set BBIG bunch we get that 1 we remove four vertices for each M ≥ XB∈B1,bB ≥5 (cid:24) bB − 3 2 (cid:25) ≥ BBIG 1 2 ≥ YL \ M · cc′−24c′−2 c′ 2 − 20M Notice that using easily lemmas 2, 3, and 7 and assuming proper values for constants c and c′ we obtain that D1 \ M = O(M ) and moreover using exactly the same reasoning we could prove following lemma. Lemma 8. Let c, c′ and C be defined as in earlier lemmas. Then D2\M ≤ M +cM +CM . 11 A local constant-factor approximation algorithm for MDS problem in anonymous network Thus to prove that our algorithm returns a constant approximation of the MDS problem we have to show that D3 = O(M ). Let us observe that the set D3 contains only vertices which are not dominated by set D1. We divide a set D3 to three pairwise disjoint subsets D3 ∩ M , D′ 3 ∪ M ). The orders of the sets D3 ∩ M and D3 \ (D′ Our last step is to prove that D3 \ M = O(M ). 3 ∪ M ) is obvious so we only have to calculate the size of the set D′ 3. 3 := {v ∈ (D3 \ M ) : ∃u ∈ Nv \ M ∧ w(u) = v}, and D3 \ (D′ Definition 4. Let graph G2 = (V2, E2) be a subgraph of G = (VG, EG) constructed in the following way: i) V2 := {v ∈ (D3 \ M ) : ∃u ∈ Nv \ M ∧ w(u) = v} and E2 = ∅. ii) For every vertex v ∈ V2 add exactly one vertex u /∈ M . The set of added vertices denote as U . Add also edge {u, v} to E2. iii) Add minimal number of edges (from EG) and nodes (from D1 ∪ D2) such that each vertex x ∈ V2 \ U has adjacent vertex from the set D1 ∪ D2. iv) Add minimal number of edges (from EG) and nodes (from VG) such that each vertex v ∈ U has adjacent vertex from the set M . v 1 2 x 1 1 i-1x i-1 x i ui z1 z l x j 3D \ i+1x x k i+1 U k m M   1 Figure 6: Example of bunch in the graph G2. Notice that u ∈ U cannot be adjacent to any vertex from a set D1, indeed in other case a vertex u would be dominated by D1 and so it will omit a step 10 of the algorithm. Fact 4. Let denote a set of (D1 ∪ D2)-D′ B2 ≤ (9 + 8c + 8C)M . 3-U -(M \ D1)-bunches in graph G2 as B2. Then Proof. To prove this lemma we need to observe that sets D1 ∪ D2, D′ 3, U , and (M \ D1) in graph G2 are pairwise disjoint. Moreover each vertex x ∈ D′ 3 has exactly one adjacent vertex u ∈ U . Thus if G′ be a graph constructed from G by contracting each such edge {x, u} then we apply this graph in Lemma 5 and obtain that B2 ≤ 5(D1 ∪ D2 + M \ (D1 ∪ D2)) + M ≤ (9 + 8c + 8C)M . Lemma 9. Let B ∈ B2 be a bunch such that B contains at least five (D1 ∪ D2)-D′ 3-U -(M \ Y )- special paths in graph G2 (bB ≥ 5). Then M ∈ F (B) ≥ (cid:6) bB −4 2 (cid:7) . Proof. The graph G induced by vertices contained in a region of some bunch B ∈ B2 (R[B]) looks quite similar like a bunch from a set B1. Using the same reasoning as in the corresponding Lemma 6 we will obtain that for every vertex xi ∈ F (B) ∩ D′ 3 there exists at least one vertex z inside F (v, xi−1, m, xi+1, v) adjacent to xi such that at least one following case is satisfied: 12 A local constant-factor approximation algorithm for MDS problem in anonymous network a) z ∈ M b) ∃m′ ∈ M such that {m′, z} ∈ EG, m′ ∈ F (v, xi−1, m, xi+1, v) and m′ 6= m A vertex vi was added to the set D3 in the step 9 by vertex ui thus N + xi ∩ (V \ N + D ) ≥ N + m ∩ (V \ N + D ). Hence for each an interior vertex xi there exist adjacent vertices z1, . . . , zl which are not dom- inated by any vertex v ∈ D1 ∪ D2. Suppose that z1, . . . , zl /∈ M and case b) is not satisfied then vertices z1, . . . , zl must be adjacent with single vertex m ∈ M \ (D1 ∪ D2). Let us notice that vertex m is adjacent with at least one vertex D1 ∪ D2 so d(ui) = m. Contradiction that vertex ui chose xi in the step 10 of the algorithm. Each internal vertex from a bunch B has a corresponding vertex m′ ∈ M which is contained in one of two surrounding faces. Since two vertices xj, xj+1 ∈ D′ 3 could share the same corresponding vertex m′ thus we obtain that M ∈ F (B) ≥ ⌈(bB − 2)/4⌉. Lemma 10. D′ 3 ≤ (22 + 16c + 16C)M . Proof. Let us notice that for any v ∈ D1 and w ∈ U there is no edge {v, w} in a graph G2. Indeed, in other case a vertex w will be dominated in step 2 or step 3 of the algorithm so would not belongs to a set U . Moreover every vertex u ∈ U must be dominated in M so must be adjacent to some vertex m ∈ M \ (D1 ∪ D2). If we denote a set of special paths which are contained in set of large bunches as BBIG 3 − (20 + 16c + 16C)M . So similarly like in a lemma 6 we get that then BBIG ≥ D′ 2 2 M ≥ XB∈B2,bB ≥3 (cid:24) bB − 4 2 (cid:25) ≥ BBIG 2 2 ≥ D′ 3 − (20 + 16c + 16C)M 2 . Theorem 2. Let G = (V, E) be a planar graph and D be a set returned by the algorithm PortNumberingMds and M be an optimal solution of the Minimum Dominating Set for a given graph G then D ≤ 636M . Proof. Let us fix values of constants c and c′ in the following way c := 29 and c′ = 4.8. Then value of C from earliest lemma is equal to 4.8. We know that the order of the set D returned by our algorithm satisfy a following inequality D ≤ D1 \ M + D2 \ M + D3 \ M + M . So using lemmas 2, 8, 3 and 7 we obtain that D1 \ M , D2 \ M ≤ YM + YS + YL \ M ≤ 3 ∪ M ) M + cM + CM . Using Lemma 10, and simply calculating D3 ∩ M , and D3 \ (D′ we get that D3 \ M ≤ D′ 3 + M ≤ 23M + 16cM + 16CM . Thus if we fix constants c = 33 and c′ = 5.6 then D ≤ M + D1 \ M + D2 \ M + D3 \ M ≤ (26 + 18c + 18C)M ≤ 636M . 13 A local constant-factor approximation algorithm for MDS problem in anonymous network v v a) b) u 1 u 2 u k u1 u2 u k w w Figure 7: An example of possible results for a) an optimal algorithm b) algorithm in which each vertex chooses one the neigbor of the largest degree. The vertices from the resulting Dominating Set are marked(black). 3 Conclusion In this paper we presented a constant approximation algorithm for the MDS problem in planar graphs. The algorithm is deterministic and strictly local. So nodes do not need any additional information about the structure of the graph and don't have unique identifiers. In our algorithm we use only short messages with at most O(log n) bits (CON GEST model). Recently in paper "Lower Bounds for Local Approximation"[8] Mika Goos et al. have shown that for lift-closed bounded degree graphs models PO and ID are practically equivalent. In this paper we show that it is true for planar graphs and MDS problem. We hope that this work will be very helpful as a hint for further comparisons of these models in other classes of graphs. Moreover the approximation factor is 636, so there is a large gap to the known lower bound (5 − ǫ) from paper [4] and approximation factor 130 from paper [12]. An interesting issue might be a reduction of this gap in a PO or ID model. References [1] N. Alon, L. Babai, and A. Itai. A fast and simple randomized parallel algorithm for the maximal independent set problem. Journal of Algorithms, 7(4):567 -- 583, 1986. [2] D. Angluin. Local and global properties in networks of processors. In Proc. 12th Annual ACM Symposium on Theory of Computing (STOC, Los Angeles, CA, USA, April 1980), pages 82 -- 93. ACM Press, New York, NY, USA, 1980. [3] R. Cole and U. Vishkin. Deterministic Coin Tossing with Applications to Optimal Parallel List Ranking. Information and Control, 70(1):32 -- 53, 1986. [4] A. Czygrinow, M. Han´ckowiak, and W. Wawrzyniak. Fast distributed approximations in pla- nar graphs. In Proc. 22nd International Symposium on Distributed Computing (DISC, Arca- chon, France, September 2008), volume 5218 of Lecture Notes in Computer Science, pages 78 -- 92. Springer, Berlin, Germany, 2008. [5] A. Czygrinow, M. Han´ckowiak, and W. Wawrzyniak. Distributed packing in planar graphs. In the twentieth ACM Symposium on Parallel Algorithms and Architectures, pages 55 -- 61, 2008. [6] A. Czygrinow, M. Han´ckowiak, K. Krzywdzinski, E. Szyma´nska, and W. Wawrzyniak. Brief an- nouncement: Distributed approximations for the semi-matching problem. In Proc. 25th Interna- tional Symposium on Distributed Computing (DISC, Rome, Italy, September 2011), volume 6950 of Lecture Notes in Computer Science, pages 200-201. Springer,Berlin, Germany, 2011. [7] A. Czygrinow, M. Han´ckowiak, E. Szymanska, and W. Wawrzyniak. Distributed 2-approximation 14 A local constant-factor approximation algorithm for MDS problem in anonymous network algorithm for the semi-matching problem. In Proc. 26th International Symposium on Distributed Computing (DISC, Salvador, Brazil, October 2012), volume 7611 of Lecture Notes in Computer Science, pages 210-222. Springer, Berlin, Germany, 2012. [8] M. Goos, J. Hirvonen, and J. Suomela , Lower Bounds for Local Approximation, In Proc. 31st Annual ACM Symposium on Principles of Distributed Computing (PODC, Madeira, Portugal, July 2012), pages 175 -- 184. ACM Press, New York, NY, USA, 2012. [9] A. Israel and A. Itai. A fast and simple randomized parallel algorithm for maximal matching. Information Processing Letters, 22(2):77 -- 80, 1986. [10] F. Kuhn, T. Moscibroda, and R. Wattenhofer. The price of being near-sighted. In Proc. 17th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA, Miami, FL, USA, January 2006), pages 980 -- 989. ACM Press, New York, NY, USA, 2006. [11] F. Kuhn and R. Wattenhofer. Constant-time distributed dominating set approximation. Dis- tributed Computing, 17(4):303 -- 310, 2005. [12] C. Lenzen, Y. A. Oswald, and R. Wattenhofer. What can be approximated locally? TIK Report 331, ETH Zurich, Computer Engineering and Networks Laboratory, November 2010. [13] C. Lenzen and R. Wattenhofer. Leveraging Linial's locality limit. In Proc. 22nd Symposium on Distributed Computing (DISC 2008), volume 5218 of LNCS, pages 394 -- 407. Springer, Berlin, 2008. [14] N. Linial. Locality in Distributed Graph Algorithms. SIAM Journal on Computing, 21(1):193 -- 201, 1992. [15] M. Luby. A Simple Parallel Algorithm for the Maximal Independent Set Problem. SIAM Journal on Computing, 15(4):1036 -- 1055, 1986 [16] M. Naor and L. Stockmeyer. What Can Be Computed Locally? SIAM Journal on Computing, 24(6):1259 -- 1277, 1995. [17] D. Peleg. Distributed Computing: A Locality-Sensitive Approach. Society for Industrial and Ap- plied Mathematics, Philadelphia, PA, USA, 2000. [18] J. Suomela, Survey of local algorithms. ACM Computing Surveys (to appear), http://www.cs.helsinki.fi/local-survey/ 15
1503.03905
1
1503
2015-03-12T22:27:37
Local Distribution and the Symmetry Gap: Approximability of Multiway Partitioning Problems
[ "cs.DS" ]
We study the approximability of multiway partitioning problems, examples of which include Multiway Cut, Node-weighted Multiway Cut, and Hypergraph Multiway Cut. We investigate these problems from the point of view of two possible generalizations: as Min-CSPs, and as Submodular Multiway Partition problems. These two generalizations lead to two natural relaxations, the Basic LP, and the Lovasz relaxation. We show that the Lovasz relaxation gives a (2-2/k)-approximation for Submodular Multiway Partition with $k$ terminals, improving a recent 2-approximation. We prove that this factor is optimal in two senses: (1) A (2-2/k-\epsilon)-approximation for Submodular Multiway Partition with k terminals would require exponentially many value queries. (2) For Hypergraph Multiway Cut and Node-weighted Multiway Cut with k terminals, both special cases of Submodular Multiway Partition, we prove that a (2-2/k-\epsilon)-approximation is NP-hard, assuming the Unique Games Conjecture. Both our hardness results are more general: (1) We show that the notion of symmetry gap, previously used for submodular maximization problems, also implies hardness results for submodular minimization problems. (2) Assuming the Unique Games Conjecture, we show that the Basic LP gives an optimal approximation for every Min-CSP that includes the Not-Equal predicate. Finally, we connect the two hardness techniques by proving that the integrality gap of the Basic LP coincides with the symmetry gap of the multilinear relaxation (for a related instance). This shows that the appearance of the same hardness threshold for a Min-CSP and the related submodular minimization problem is not a coincidence.
cs.DS
cs
Local Distribution and the Symmetry Gap: Approximability of Multiway Partitioning Problems∗ Alina Ene† Jan Vondr´ak‡ Yi Wu§ Abstract We study the approximability of multiway partitioning problems, examples of which include Multiway Cut, Node-weighted Multiway Cut, and Hypergraph Multiway Cut. We investigate these problems from the point of view of two possible generalizations: as Min-CSPs, and as Submodular Multiway Partition problems. These two generalizations lead to two natural relaxations, the Basic LP, and the Lov´asz relaxation. The Basic LP is generally stronger than the Lov´asz relaxation, but grows exponentially with the arity of the Min-CSP. The relaxations coincide in some cases such as Multiway Cut where they are both equivalent to the CKR relaxation. We show that the Lov´asz relaxation gives a (2 − 2/k)-approximation for Submodular Multiway Partition with k terminals, improving a recent 2-approximation [4]. We prove that this factor is optimal in two senses: (1) A (2 − 2/k − ǫ)-approximation for Submodular Multiway Partition with k terminals would require exponentially many value queries. (2) For Hypergraph Multiway Cut and Node-weighted Multiway Cut with k terminals, both special cases of Submodular Multiway Partition, we prove that a (2 − 2/k − ǫ)-approximation is NP-hard, assuming the Unique Games Conjecture. Both our hardness results are more general: (1) We show that the notion of symmetry gap, previously used for submodular maximization problems [24, 8], also implies hardness results for submodular minimization problems. (2) Assuming the Unique Games Conjecture, we show that the Basic LP gives an optimal approximation for every Min-CSP that includes the Not-Equal predicate. Finally, we connect the two hardness techniques by proving that the integrality gap of the Basic LP coincides with the symmetry gap of the multilinear relaxation (for a related instance). This shows that the appearance of the same hardness threshold for a Min-CSP and the related submodular minimization problem is not a coincidence. 1 Introduction In this paper, we study the approximability of multiway cut/partitioning problems, where a ground set V should be partitioned into k parts while minimizing a certain objective function. Classical examples of such problems are Multiway Cut (that we abbreviate by Graph-MC), Node-weighted Multiway Cut (Node-Wt-MC) and Hypergraph Multiway Cut (Hypergraph-MC). These problems are NP-hard but admit constant-factor approximations. ∗This is a full version of the paper that appeared in ACM-SIAM SODA 2013 [9]. †Department of Computer Science, University of Illinois at Urbana-Champaign. Supported in part by NSF grants CCF-0728782 and CCF-1016684. Part of this work was done while the author was visiting the IBM Almaden Research Center. ‡IBM Almaden Research Center, San Jose, CA §Department of Computer Science, Purdue University. Part of this work was done while the author was a postdoc at the IBM Almaden Research Center. 1 Multiway Cut (Graph-MC): Given a graph G = (V, E) with weights on the edges and k terminals t1, t2, . . . , tk ∈ V , remove a minimum-weight set of edges so that every two terminals are disconnected. Node-weighted Multiway Cut (Node-Wt-MC): Given a graph G = (V, E) with weights on the nodes and k terminals t1, t2, . . . , tk ∈ V , remove a minimum-weight set of vertices so that every two terminals are disconnected. Hypergraph Multiway Cut (Hypergraph-MC): Given a hypergraph H = (V, E) with weights on the hyperedges and k terminals t1, t2, . . . , tk ∈ V , remove a minimum-weight set of hyperedges so that every two terminals are disconnected. Although the problems above are formulated as vertex/edge/hyperedge removal problems, Graph- MC and Hypergraph-MC can be also viewed as partitioning problems where vertices are assigned to terminals and we pay for each edge/hyperedge that is cut between different terminals. The Node- Wt-MC problem can also be stated in this form, and in fact shown to be approximation-equivalent to Hypergraph-MC (although the reduction is more complicated, see [19]). Given this point of view, and the fact that the cut function in graphs/hypergraphs is submodular, the following generalization of these problems was proposed in [26] and recently studied in [5, 4]. Submodular Multiway Partition (Sub-MP): Given a submodular set function f : 2V → R+ and k terminals t1, t2, . . . , tk ∈ V , find a partition of V into A1, . . . , Ak such that ti ∈ Ai and Pk i=1 f (Ai) is minimized. This problem captures the problems Graph-MC, Node-Wt-MC and Hypergraph-MC as spe- cial cases.1 One of the useful aspects of viewing the problems in this more general framework is that non-trivial linear programs, discovered on a case-by-case basis in the past, can be viewed in a unified way: by considering the Lov´asz extension of a submodular function (see Section 2 for details). In particular, [5] rederives the geometric CKR relaxation for Multiway Cut [2] in this way. It was shown in [4] that Sub-MP is not significantly more difficult than its special cases: Sub-MP admits a 2-approximation in general, and an improved (3/2 − 1/k)-approximation when the number of termi- nals is k and f is a symmetric submodular function (in the sense that f (S) = f ( ¯S); we denote this special case as Sub-MP-Sym). We remark that Graph-MC is a special case of Sub-MP-Sym, while Node-Wt-MC and Hypergraph-MC are not. This compares to the approximability of the classical problems as follows: Graph-MC admits a 1.2965-approximation, which has been obtained by a sequence of successive improvements [2, 12, 1, 21], all based on the CKR relaxation of [2]. The (3/2 − 1/k)-approximation obtained by [2] matches the result of [4] for Sub-MP-Sym. On the hardness side, it was proved that the CKR relaxation provides the optimal approximation factor for Graph-MC, assuming the Unique Games Conjecture [17]. However, the actual approximation factor is not known: it is only known that it is between 8/7 and 1.2965. In the case of 3 terminals, the optimal factor is known to be 12/11 [12, 17]. The problems Node-Wt-MC and Hypergraph-MC are known to be approximation-equivalent, and both admit a (2 − 2/k)-approximation for k terminals [19, 10]. It is known that a (2 − ǫ)- approximation independent of k would imply a (2 − ǫ)-approximation for Vertex Cover, which would refute the Unique Games Conjecture. Therefore, we do not expect an approximation better than 2 for Node-Wt-MC and Hypergraph-MC when the number of terminals is large. Nevertheless, this reduction does not give any hardness for a constant number of terminals k, and the optimal approximation for a given k was not known. 1We point out that in the case of Hypergraph-MC, the reduction is not as direct as one might expect - this is due to the fact that we want to count each cut hyperedge only once, independently of how many terminals share it. Consequently, the arising submodular function is not symmetric, although the cut function in a hypergraph is. 2 Our contribution. We study these partitioning problems from two points of view: (a) as general partitioning problems with a submodular cost function, using a natural convex program for the problem based on the Lov´asz extension of a submodular function; we refer to this convex program as the Lov´asz relaxation; (b) regarding them as Min-CSPs (constraint satisfaction problems), which leads to another natural relaxation that has been referred to as the Basic LP (see, e.g., [14, 22]).2 Our concrete results are as follows. Concrete results: • We give a (2 − 2/k)-approximation for the Sub-MP problem with k terminals using the Lov´asz relaxation. We also show that this is optimal, in two different senses. • We prove that any (2− 2/k− ǫ)-approximation for Sub-MP (for a constant number of terminals k) requires exponentially many value queries in the oracle model. • We prove that for Node-Wt-MC, a special case of Sub-MP, it is Unique-Games-hard to achieve a (2 − 2/k − ǫ)-approximation (for a constant number of terminals k). Since Hypergraph-MC is approximation-equivalent to Node-Wt-MC, we determine the approx- imability of all three problems, Sub-MP, Hypergraph-MC and Node-Wt-MC, to be exactly 2−2/k (assuming the Unique Games Conjecture in the case of Hypergraph-MC and Node-Wt-MC). Unique Games-hardness vs. NP-hardness more generally: Our hardness proofs in fact lead to more general results, revealing an interesting relationship between the Unique Games-hardness of Min-CSP problems and NP-hardness of their natural submodular generalizations. • We show a Unique Games-based hardness result for Min-CSP problems, generalizing the ma- chinery of [17]. Roughly speaking, we show that for every Min-CSP problem that includes the Not-Equal predicate, the integrality gap of the Basic LP can be translated to a Unique Games-hardness result. • We show how the symmetry gap technique, previously developed for submodular maximization problems [24], applies to submodular minimization problems. This technique yields hardness re- sults in the value oracle model, or computational hardness assuming N P 6= RP , using the tech- nique of [8]. In particular, we prove that it is hard to achieve a better than 1.268-approximation for Sub-MP-Sym (a special case of Sub-MP where the cost function is symmetric submodular). Finally, we present a connection between the two approaches, proving that the integrality gap of the Basic LP coincides with the symmetry gap of the multilinear relaxation (see the discussion below and Section 6 for more details). Discussion. Let us comment on some connections that we observed here. Integrality gap vs. symmetry gap. While Unique Games-hardness results typically start from an integrality gap instance, hardness results for submodular functions often start from the multilinear relaxation of a problem, exhibiting a certain symmetry gap (see [24, 8]). This is a somewhat different concept, where instead of integral vs. fractional solutions, we compare symmetric vs. asymmetric solutions. In this paper, we clarify the relationship between the two: For any integrality gap Min-CSP instance of the Basic LP, there is a related Min-CSP instance that exhibits the same symmetry gap in its multilinear relaxation. Conversely, for any symmetry gap instance of the multilinear relaxation of a Min-CSP instance, there is a related Min-CSP instance whose Basic LP has the same integrality gap (see Section 6). Therefore, the two concepts are in some sense equivalent (at least for Min-CSP 2In the ACM-SIAM SODA 2013 version of this paper, we referred to this LP as Local Distribution LP. 3 problems). This explains why the Unique Games-hardness threshold for Hypergraph-MC and the NP-hardness threshold for its submodular generalization Sub-MP are the same. Lov´asz vs. multilinear relaxation. The fact that the symmetry gap technique gives optimal results for a submodular minimization problem is interesting: The symmetry gap technique is intimately tied to the notion of a multilinear extension of a submodular function, which has recently found numerous applications in maximization of submodular functions [23, 24, 13, 15, 6]. Nevertheless, it has been common wisdom that the Lov´asz extension is the appropriate extension for submodular minimization [16, 11, 5, 4]. Here, we obtain a positive result using the Lov´asz extension, and a matching hardness result using the multilinear extension. Erratum. In the conference version [9], it was claimed that for every fixed k ≥ 1 and ǫ > 0 there is an efficient algorithm to round the Basic LP for a Min k-CSP instance, achieving an approximation factor within ǫ of the integrality gap. This result was found to contain errors and has been removed. Organization. The rest of the paper is organized as follows. In Section 2, we discuss the Lov´asz relaxation, and show how it yields a (2 − 2/k)-approximation for the Sub-MP problem. In Section 3, we present the symmetry gap technique for submodular minimization problems, and show how it implies our hardness results in the value oracle model. In Section 4, we present our hardness result for Min-CSP, and show how it implies the hardness result for Hypergraph-MC. In section 5, we discuss the relationship of the Lov´asz relaxation and the Basic LP. In Section 6, we discuss the relationship of integrality gaps and symmetry gaps. 2 Approximation for Submodular Multiway Partition In this section, we revisit the convex relaxation proposed by Chekuri and Ene [5], and provide an improved analysis that gives the following result. Theorem 2.1. There is a polynomial-time (2 − 2/k)-approximation for the Sub-MP problem with k terminals, where k and the terminals t1, . . . , tk are given on the input and the cost function is given by a value oracle. The Lov´asz relaxation. The following is the convex relaxation that has been used by Chekuri and Ene: i=1 (SubMP-Rel) minPk ∀j ∈ V ; Pk ∀i ∈ [k]; ∀i, j; f (xi) : i=1 xi,j = 1; xi,ti = 1; xi,j ≥ 0. Here, f (xi) denotes the Lov´asz extension of a submodular function. The function f can be defined in several equivalent ways (see [5, 4]). One definition is based on the following rounding strategy. We choose a uniformly random θ ∈ [0, 1] and define Ai(θ) = {j : xij > θ}. Then f (xi) = E[f (Ai(θ))]. Equivalently (for submodular functions), f is the convex closure of f on [0, 1]V . The second defini- tion shows that the relaxation SubMP-Rel is a convex program and therefore it can be solved in polynomial time. Given a fractional solution, we use the following randomized rounding technique, a slight modifi- cation of one proposed by Chekuri and Ene: Randomized rounding for the Lov´asz relaxation. 4 2 , 1] uniformly at random and define Ai(θ) = {j : xij > θ}. • Choose θ ∈ ( 1 • Define U (θ) = V \Sk • Allocate each Ai(θ) to terminal i, and in addition allocate U (θ) to a terminal i′ chosen uniformly i=1 Ai(θ) = {j : maxi xij ≤ θ}. at random. Each terminal ti is allocated to itself with probability one. Moreover, the sets Ai(θ) are disjoint by construction, and therefore the rounding constructs a feasible solution. The only difference from Chekuri and Ene's rounding [4] is that we assign the "unallocated set" U (θ) to a random terminal rather than a fixed terminal. (However, taking advantage of this in the analysis is not straightforward.) We prove the following. Theorem 2.2. The above rounding gives a feasible solution of expected value at most (2− 2 f (xi). i=1 This implies Theorem 2.1. In the following, we prove Theorem 2.2. We assume that f (∅) = 0. This is without loss of generality, as the value of the empty set can be decreased without violating submodularity and this does not affect the problem (since terminals are always assigned to themselves). k )Pk We start by defining several sets, parameterized by θ, that will be important in the analysis. • Ai(θ) = {j : xij > θ} • A(θ) =Sk i=1 Ai(θ) = {j : maxi xij > θ} • U (θ) = V \ A(θ) = {j : maxi xij ≤ θ}. • B(θ) = U (1 − θ) = {j : 1 − maxi xij ≥ θ}. We can express the LP cost and the cost of the rounded solution in terms of these sets as follows. The following lemma follows immediately from the definition of the Lov´asz extension. Lemma 2.3. The cost of the LP solution is LP = k Xi=1Z 1 0 f (Ai(θ))dθ. The next lemma gives an expression for the expected value achieved by the algorithm in a form convenient for the analysis. Lemma 2.4. The expected cost of the rounded solution is ALG =(cid:18)2 − 2 k(cid:19) k Xi=1Z 1 1/2 f (Ai(θ))dθ + 2 k k Xi=1Z 1/2 0 f (Ai(θ) ∪ B(θ))dθ. Proof. The set allocated to terminal i is Ai(θ) with probability 1 − 1/k, and Ai(θ) ∪ U (θ) with probability 1/k. We are choosing θ uniformly between 1 2 and 1. This gives the expression ALG =(cid:18)2 − 2 k(cid:19) k Xi=1Z 1 1/2 f (Ai(θ))dθ + 2 k k Xi=1Z 1 1/2 f (Ai(θ) ∪ U (θ))dθ. We claim that for θ ∈ [ 1 consider three cases for each element j: 2 , 1], Ai(θ) ∪ U (θ) can be written equivalently as Ai(1 − θ) ∪ B(1 − θ). We 5 • If xij > 1 2 for every other i′ 6= i and hence j cannot be allocated to any other terminal. Similarly, j ∈ Ai(1 − θ) ∪ B(1 − θ) for every θ ∈ [ 1 2 , then j ∈ Ai(θ) ∪ U (θ) for every θ ∈ [ 1 2 and so j ∈ Ai(1 − θ). 2 , 1], because 1 − θ ≤ 1 2 , 1], because xi′j < 1 2 , 1], because j is • If xij ≤ 1 2 and xij = maxi′ xi′j, then again j ∈ Ai(θ) ∪ U (θ) for every θ ∈ [ 1 always in the unallocated set U (θ). Also, j ∈ Ai(1 − θ) ∪ B(1 − θ), because B(1 − θ) = U (θ). • If xij ≤ 1 2 and xij < maxi′ xi′j, then j ∈ Ai(θ) ∪ U (θ) if and only if j ∈ U (θ) = B(1 − θ). Also, we have xij = 1 −Pi′6=i xi′j ≤ 1 − maxi′ xi′j, and therefore j ∈ Ai(1 − θ) ∪ B(1 − θ) if and only if j ∈ B(1 − θ). To summarize, for every θ ∈ [ 1 2 , 1], j ∈ Ai(θ) ∪ U (θ) if and only if j ∈ Ai(1 − θ) ∪ B(1 − θ). k(cid:19) k Xi=1Z 1 k(cid:19) k Xi=1Z 1 k(cid:19) k Xi=1Z 1 ALG = (cid:18)2 − = (cid:18)2 − = (cid:18)2 − Xi=1Z 1 Xi=1Z 1 Xi=1Z 1/2 f (Ai(1 − θ) ∪ B(1 − θ))dθ f (Ai(θ) ∪ B(θ))dθ. f (Ai(θ) ∪ U (θ))dθ f (Ai(θ))dθ + f (Ai(θ))dθ + f (Ai(θ))dθ + 2 k 2 k 2 k 1/2 1/2 k k k 1/2 2 2 2 1/2 0 Therefore, the total expected cost can be written as 1/2 0 The following statement was proved in [4]; we give a simplified new proof in the process of our In the rest of the analysis, we prove several inequalities that relate the LP cost to the ALG cost. 1/2 f (Ai(θ))dθ appear in both LP and ALG. The non-trivial part is how to Note that the integrals R 1 f (Ai(θ))dθ to R 1/2 relate R 1/2 Lemma 2.5 (Theorem 1.5 in [4]). Let f ≥ 0 be submodular, f (∅) = 0, and x a feasible solution to SubMP-Rel. For θ ∈ [0, 1] let Ai(θ) = {v xv,i > θ}, A(θ) = ∪k i=1Ai(θ) and U (θ) = V \ A(θ). For any δ ∈ [ 1 f (Ai(θ) ∪ B(θ))dθ. 2 , 1] the following holds: analysis. 0 k Xi=1Z δ 0 f (Ai(θ))dθ ≥Z δ 0 f (A(θ))dθ +Z 1 0 f (U (θ))dθ. In the following, we assume the conditions of Lemma 2.5 without repeating them. First, we prove the following inequality. Lemma 2.6. For any δ ∈ [ 1 Xi=1Z δ k−1 0 2 , 1], f ((A1(θ) ∪ ··· Ai(θ)) ∩ Ai+1(θ))dθ ≥Z 1 0 f (U (θ))dθ. Proof. First consider δ = 1. We can view the valueR 1 0 f (A1(θ)∪···∪ Ai(θ))∩ Ai+1(θ))dθ as the Lov´asz extension evaluated on the vector yi = (x1∨···∨xi)∧xi+1. Note that v ∈ (A1(θ)∪···∪Ai(θ))∩Ai+1(θ) if and only if yv,i ≥ θ. Therefore Z 1 f ((A1(θ) ∪ ··· ∪ Ai(θ)) ∩ Ai+1(θ))dθ = f (yi). 0 6 We can also view f (U (θ)) as follows: Let u = Pk−1 i=1 ((x1 ∨ ··· ∨ xi) ∧ xi+1) + (x1 ∨ ··· ∨ xk) = Pk Pk−1 i=1 yi + (x1 ∨ ··· ∨ xk) = Pk−1 proved by repeated use of the rule (u ∧ v) + (u ∨ v) = u + v, and finally Pk f (yi) ≥ f 1 Xi=1 k − 1 = f(cid:18) 1 k − 1 yi! Xi=1 u(cid:19) = ( f is convex) k − 1 k − 1 f (u) k−1 k−1 1 1 i=1 yi = 1 − (x1 ∨ ··· ∨ xk). (This holds because i=1 xi, which can be i=1 xi = 1.) Therefore where we also used the fact that f (αx) = α f (x) for any α ∈ [0, 1] ( f (x) is linear under multiplication by a scalar). Equivalently, k−1 Xi=1Z 1 0 f ((A1(θ) ∪ ··· Ai(θ)) ∩ Ai+1(θ))dθ ≥Z 1 0 f (U (θ))dθ. Now note that, if θ > δ ≥ 1/2, the sets (A1(θ)∪···∪ Ai(θ))∩ Ai+1(θ) are empty, sincePk and hence two vectors xj, xi+1 cannot have the same coordinate larger than 1 f (∅) = 0, so we proved in fact i=1 xi = 1 2 . We also assumed that k−1 Xi=1Z δ 0 f ((A1(θ) ∪ ··· Ai(θ)) ∩ Ai+1(θ))dθ ≥Z 1 0 f (U (θ))dθ as desired. Given this inequality, Lemma 2.5 follows easily: Lemma 2.5. By applying submodularity inductively to the sets A1(θ) ∪ ··· ∪ Ai(θ) and Ai+1(θ), we get k Xi=1 f (Ai(θ)) ≥ = k−1 Xi=1 Xi=1 k−1 f ((A1(θ) ∪ ··· ∪ Ai(θ)) ∩ Ai+1(θ)) + f (A1(θ) ∪ ··· ∪ Ak(θ)) f ((A1(θ) ∪ ··· ∪ Ai(θ)) ∩ Ai+1(θ)) + f (A(θ)). Integrating from 0 to δ and using Lemma 2.6, we obtain k Xi=1Z δ 0 k−1 f (Ai(θ))dθ ≥ 0 f ((A1(θ) ∪ ··· ∪ Ai(θ)) ∩ Ai+1(θ))dθ +Z δ Xi=1Z δ ≥ Z 1 f (U (θ))dθ +Z δ A(θ)dθ. 0 0 0 f (A(θ))dθ A corollary of Lemma 2.5 is the following inequality. Lemma 2.7. k Xi=1Z 1/2 0 f (Ai(θ))dθ ≥Z 1/2 0 f (B(θ))dθ. 7 Proof. Considering Lemma 2.5, we simply note that U (θ) = B(1 − θ). We discard the contribution of f (A(θ)) and keep only one half of the integral involving B(1 − θ). We combine this bound with the following lemma. Lemma 2.8. k Xi=1Z 1/2 0 f (Ai(θ))dθ ≥ k Xi=1Z 1/2 0 f (Ai(θ) ∪ B(θ))dθ − (k − 2)Z 1/2 0 f (B(θ))dθ. Proof. For simplicity of notation, we drop the explicit dependence on θ, keeping in mind that all the sets depend on θ. By submodularity, we have f (Ai) + f (B) ≥ f (Ai ∪ B) + f (Ai ∩ B). Therefore, k k Xi=1 f (Ai) ≥ = k Xi=1 (f (Ai ∪ B) + f (Ai ∩ B) − f (B)) Xi=1 f (Ai ∪ B) + Xi=1 f (Ai ∩ B) − k · f (B) k This would already prove the lemma with k instead of k − 2; however, we use Pk i=1 f (Ai ∩ B) to save the additional terms. We apply a sequence of inequalities using submodularity, starting with f (A1 ∩ B) + f (A2 ∩ B) ≥ f (A1 ∩ A2 ∩ B) + f ((A1 ∪ A2) ∩ B), then f ((A1 ∪ A2) ∩ B) + f (A3 ∩ B) ≥ f ((A1 ∪ A2) ∩ A3 ∩ B) + f ((A1 ∪ A2 ∪ A3) ∩ B), etc. until we obtain k Xi=1 k−1 Xi=1 f (Ai ∩ B) ≥ f ((A1 ∪ . . . ∪ Ai) ∩ Ai+1 ∩ B) + f ((A1 ∪ . . . ∪ Ak) ∩ B). The last term is equal to f (A∩B). Moreover, we observe that for every element j, at most one variable xij can be larger than 1 − maxi′ xi′j (because otherwise the two variables would sum up to more than 1). Therefore for every i, (A1 ∪ . . . ∪ Ai) ∩ Ai+1 ⊆ B. So we get k Xi=1 f (Ai ∩ B) ≥ Integrating from 0 to 1/2, we get k−1 Xi=1 f ((A1 ∪ . . . ∪ Ai) ∩ Ai+1) + f (A ∩ B). k Xi=1Z 1/2 0 f (Ai ∩ B)dθ ≥ k−1 Xi=1Z 1/2 0 f ((A1 ∪ . . . ∪ Ai) ∩ Ai+1)dθ +Z 1/2 0 f (A ∩ B)dθ. By Lemma 2.6 (recalling that Ai = Ai(θ)), we obtain k Xi=1Z 1/2 0 f (Ai ∩ B)dθ ≥Z 1 0 f (U )dθ +Z 1/2 0 f (A ∩ B)dθ. Using B(θ) = U (1 − θ), submodularity, and the fact that U is the complement of A, we obtain k Xi=1Z 1/2 0 0 f (Ai ∩ B)dθ ≥ Z 1/2 ≥ Z 1/2 = Z 1/2 0 0 0 f (B)dθ +Z 1/2 f (B)dθ +Z 1/2 f (B)dθ +Z 1/2 0 0 f (A ∩ B)dθ f (U )dθ +Z 1/2 f (U ∪ (A ∩ B))dθ 0 f (U ∪ B)dθ 8 Finally, for θ ∈ [0, 1 hence the membership on both sides depends only on j ∈ B. If maxi xij ≤ 1 also j ∈ U ∪ B. We conclude that 2 ], we claim that U ∪ B = B. This is because if maxi xij > 1 2 , then j /∈ U , and 2 , then j ∈ B and hence k Xi=1Z 1/2 0 f (Ai ∩ B)dθ ≥ 2Z 1/2 0 f (B)dθ and k Xi=1Z 1/2 0 f (Ai)dθ ≥ ≥ which finishes the proof. k 0 Xi=1Z 1/2 Xi=1Z 1/2 k 0 (f (Ai ∪ B) + f (Ai ∩ B) − f (B))dθ f (Ai ∪ B)dθ − (k − 2)Z 1/2 f (B)dθ 0 A combination of Lemma 2.7 and Lemma 2.8 relates Pk B(θ))dθ, and finishes the analysis. 0 i=1R 1/2 f (Ai(θ))dθ to Pk i=1R 1/2 0 f (Ai(θ) ∪ Proof of Theorem 2.2. Add up k−2 k−1× Lemma 2.7 + 1 k−1× Lemma 2.8: k Xi=1Z 1/2 0 f (Ai(θ))dθ ≥ 1 k − 1 k Xi=1Z 1/2 0 f (Ai(θ) ∪ B(θ))dθ. 1/2 f (Ai(θ))dθ to both sides gives us that Adding Pk k i=1R 1 Xi=1Z 1 0 f (Ai(θ))dθ ≥ k Xi=1Z 1 1/2 f (Ai(θ))dθ + 1 k − 1 · k Xi=1Z 1/2 0 f (Ai(θ) ∪ B(θ))dθ. The left-hand side is equal to LP , while the right-hand side is equal to ALG 2−2/k (see Lemma 2.4). 3 Hardness from the Symmetry Gap Here we show how the symmetry gap technique of [25] applies to submodular minimization problems. We remark that while the technique was presented in [25] for submodular maximization problems, it applies to submodular minimization problems practically without any change. Rather than repeating the entire construction of [25], we summarize the main components of the proof and point out the important differences. Finally, we mention that the recent techniques of [8] turn a query-complexity hardness result into a computational hardness result. First, we show the result for general Submodular Multiway Partition, which is technically simpler. 3.1 Hardness of Sub-MP Here we show that the (2 − 2/k)-approximation is optimal for Submodular Multiway Partition in the value oracle model. More precisely, we prove the following. Theorem 3.1. For any fixed k > 2 and ǫ > 0, a (2 − 2/k − ǫ)-approximation for the Submodular Multiway Partition problem with k terminals in the value oracle model requires exponentially many value queries. 9 We note that this result can also be converted into a computational hardness result for explicit instances, using the techniques of [8]. We defer the details to Appendix A.2 and focus here on the value oracle model. A starting point of the hardness construction is a particular instance of the problem which exhibits a certain symmetry gap, a gap between symmetric and asymmetric solutions of the multilinear relaxation. We propose the following instance (which is somewhat related to the gadget used in [7] to prove the APX-hardness of Multiway Cut). The instance is in fact an instance of Hypergraph Multiway Cut (which is a special case of Submodular Multiway Partition). As in other cases, we should keep in mind that this does not mean that we prove a hardness result for Hypergraph Multiway Cut, since the instance gets modified in the process. The symmetric instance. Let the vertex set be V = [k] × [k] and let the terminals be ti = (i, i). We consider 2k hyperedges: the "rows" Ri = {(i, j) : 1 ≤ j ≤ k} and the "columns" Cj = {(i, j) : 1 ≤ i ≤ k}. The submodular function f : 2V → R+ is the following function: for each set S, f (S) =Pk j=1 φ(S ∩ Cj), where φ(t) = t/k if t < k and φ(t) = 0 if t = k. i=1 φ(S ∩ Ri) +Pk Since φ is a concave function, it follows easily that f is submodular. Further, if a hyperedge is assigned completely to one terminal, it does not contribute to the objective function, while if it is partitioned among different terminals, it contributes t/k to each terminal containing t of its k vertices, i=1 f (Si) captures exactly the number of hyperedges cut by a and hence 1 altogether. Therefore, Pk partition (S1, . . . , Sk). The multilinear relaxation. Along the lines of [25], we want to compare symmetric and asymmetric solutions of the multilinear relaxation of the problem, where we allocate vertices fractionally and the objective function f : 2V → R+ is replaced by its multilinear extension F : [0, 1]V → R+; we have F (x) = E[f (x)], where x is the integral vector obtained from x by rounding each coordinate independently. The multilinear relaxation of the problem has variables xℓ ij corresponding to allocating (i, j) to terminal tℓ. minn k Xℓ=1 F (xℓ) k xℓ ij = 1, Xℓ=1 : ∀i, j ∈ [k]; ∀i ∈ [k]; xi ii = 1, ij ≥ 0o. ∀i, j, ℓ ∈ [k]; xℓ In fact, this formulation is equivalent to the discrete problem, since any fractional solution can be rounded by assigning each vertex (i, j) independently with probabilities xℓ ij, and the expected cost of ℓ=1 F (xℓ). this solution is by definition Pk Computing the symmetry gap. What is the symmetry gap of this instance? It is quite easy to see that there is a symmetry between the rows and the columns, i.e., we can exchange the role of rows and columns and the instance remains the same. Formally, the instance is invariant under a group G of permutations of V , where G consists of the identity and the transposition of rows and columns. A symmetric solution is one invariant under this transposition, i.e., such that the vertices (i, j) and (j, i) are allocated in the same manner, or xℓ ji. For a fractional solution x, we define the symmetrized solution as ¯x = 1 2 (x + xT ) where xT is the transposed solution (xT )ℓ ij = xℓ ji. ij = xℓ There are two optimal solutions to this problem: one that assigns vertices based on rows, and one that assigns vertices based on columns. The first one can be written as follows: xℓ ij = 1 iff i = ℓ and 0 otherwise. (One can recognize this as a "dictator" function, one that copies the first coordinate.) The cost of this solution is k, because we cut all the column hyperedges and none of the rows. We must 10 cut at least k hyperedges, because for any i 6= j, we must cut either row Ri or column Cj. Since we can partition all hyperedges into pairs like this ({R1, C2}, {R2, C3}, {R3, C4}, etc.), at least a half of all hyperedges must be cut. Therefore, OP T = k. Next, we want to find the optimal symmetric solution. As we observed, there is a symmetry between rows and columns and hence we want to consider only solutions satisfying xℓ ji for all i, j. Again, we claim that it is enough to consider integer (symmetric) solutions. This is for the following reason: we can assign each pair of vertices (i, j) and (j, i) in a coordinated fashion to the same random terminal: we assign (i, j) and (j, i) to the terminal tℓ with probability xℓ ji. Since these two vertices never participate in the same hyperedge, the expected cost of this correlated randomized rounding is equal to the cost of independent randomized rounding, where each vertex is assigned ij = xℓ ij = xℓ ℓ=1 F (xℓ). independently. Hence the expected cost of the rounded symmetric solution is exactly Pk Considering integer symmetric instances yields the following optimal solution: We can assign all vertices (except the terminals themselves) to the same terminal, let's say t1. This will cut all hyperedges except 2 (the row R1 and the column C1). This is in fact the minimum-cost symmetric solution, because once we have any monochromatic row (where monochromatic means assigned to the same terminal), the respective column is also monochromatic. But this row and column intersect all other rows and columns, and hence no other row or column can be monochromatic (recall that the terminals are on the diagonal and by definition are assigned to themselves). Hence, a symmetric solution can have at most 2 hyperedges that are not cut. Therefore, the symmetric optimum is OP T = 2k − 2 and the symmetry gap is γ = (2k − 2)/k = 2 − 2/k. The hardness proof. We appeal now to a technical lemma from [25], which serves to produce blown-up instances from the initial symmetric instance. Lemma 3.2. Consider a function f : 2V → R that is invariant under a group of permutations G on the ground set X. Let F (x) = E[f (x)], ¯x = Eσ∈G [σ(x)], and fix any ǫ > 0. Then there exists δ > 0 and functions F , G : [0, 1]V → R+ (which are also symmetric with respect to G), satisfying: 1. For all x ∈ [0, 1]V , G(x) = F (¯x). 2. For all x ∈ [0, 1]V , F (x) − F (x) ≤ ǫ. 3. Whenever x − ¯x2 ≤ δ, F (x) = G(x) and the value depends only on ¯x. 4. The first partial derivatives of F , G are absolutely continuous.3 5. If f is monotone, then ∂ F 6. If f is submodular, then ∂2 F ∂xi ≥ 0 everywhere. ∂xi ≥ 0 and ∂ G ∂xi∂xj ≤ 0 and ∂2 G ∂xi∂xj ≤ 0 almost everywhere. We apply Lemma 3.2 to the function f from the symmetric instance. This will produce continuous functions F , G : 2V → R+. Next, we use the following lemma from [25] to discretize the continuous function F , G and obtain instances of Sub-MP. Lemma 3.3. Let F : [0, 1]V → R be a function with absolutely continuous first partial derivatives. Let N = [n], n ≥ 1, and define f : N × V → R so that f (S) = F (x) where xi = 1 nS ∩ (N × {i}). Then 1. If ∂F 2. If ∂xi ≥ 0 everywhere for each i, then f is monotone. ∂xi∂xj ≤ 0 almost everywhere for all i, j, then f is submodular. ∂2F 3 A function F : [0, 1]V → R is absolutely continuous, if ∀ǫ > 0; ∃δ > 0; Pt i=1 xi−yi < δ ⇒ Pt i=1 F (xi)−F (yi) < ǫ. 11 Using Lemma 3.3, we define blown-up instances on a ground set X = N × V as follows: For each i ∈ N , choose independently a random permutation σ ∈ G on V , which is either the identity or the transposition of rows and columns. Then for a set S ⊆ N × V , we define ξ(S) ∈ [0, 1]V as follows: We define two functions f , g : 2V → R+, where f (S) = F (ξ(S)), ξj(S) = 1 n(cid:12)(cid:12)(cid:12){i ∈ N : (i, σ(i)(j)) ∈ S}(cid:12)(cid:12)(cid:12) . g(S) = G(ξ(S)). By Lemma 3.3, f , g are submodular functions. We consider the following instances of Sub-MP: max( k Xℓ=1 max( k Xℓ=1 f (Sℓ) : (S1, . . . , Sk) is a partition of X & ∀i ∈ N ;∀ℓ ∈ [k]; (i, tℓ) ∈ Sℓ), g(Sℓ) : (S1, . . . , Sk) is a partition of X & ∀i ∈ N ;∀ℓ ∈ [k]; (i, tℓ) ∈ Sℓ). Note that in these instances, multiple vertices are required to be assigned to a certain terminal (n vertices for each terminal). However, this can be still viewed as a Submodular Multiway Partition problem; if desired, the set of pre-labeled vertices Tℓ = N × {tℓ} for each terminal can be contracted into one vertex. Finally, we appeal to the following lemma in [25]. Lemma 3.4. Let F , G be the two functions provided by Lemma 3.2. For a parameter n ∈ Z+ and N = [n], define two discrete functions f , g : 2N×V → R+ as follows: Let σ(i) be an arbitrary permutation in G for each i ∈ N . For every set S ⊆ N × V , we define a vector ξ(S) ∈ [0, 1]V by ξj(S) = 1 n(cid:12)(cid:12)(cid:12){i ∈ N : (i, σ(i)(j)) ∈ S}(cid:12)(cid:12)(cid:12) . Let us define: f (S) = F (ξ(S)), g(S) = G(ξ(S)). Then deciding whether a function given by a value oracle is f or g (even using a randomized algorithm with a constant probability of success) requires an exponential number of queries. Lemma 3.4 implies that distinguishing these pairs of objective functions requires an exponential number of queries. We need to make one additional argument, that the knowledge of the terminal sets Tℓ = N × {tℓ} (which is part of the instance) does not help in distinguishing the two objective functions. This is because given oracle access to f or g, we are in fact able to identify the sets Tℓ, if we just modify the contribution of each row/column pair Rℓ, Cℓ by a factor of 1 + ǫℓ, where ǫℓ is some arbitrary small parameter. This does not change the optimal values significantly, but it allows an algorithm to distinguish the sets Tℓ easily by checking marginal values. Note that then we can also determine sets such as Ti,j = N × {(i, j), (j, i)}, but we cannot distinguish the two symmetric parts of Ti,j, which is the point of the symmetry argument. In summary, revealing the sets Tℓ does not give any information that the algorithm cannot determine from the value oracles for f , g, and given this oracle access, f and g cannot be distinguished. It remains to compare the optima of the two optimization problems. The problem with the objective function f corresponds to the multilinear relaxation with objective F , and admits the "dic- tatorship" solution Si = {(i, j) : 1 ≤ j ≤ k} for each i ∈ [k], which has a value close to k. On the other hand, any solution of the problem with objective function g corresponds to a fractional solution of the symmetrized multilinear relaxation of the problem with objective G, which as we argued has a value close to 2k − 2. Therefore, achieving a (2 − 2/k − ǫ)-approximation for any fixed ǫ > 0 requires an exponential number of value queries. 12 3.2 Hardness of Symmetric Submodular Multiway Partition Here we state a result for the Sub-MP-Sym problem. Theorem 3.5. For any fixed k sufficienly large, a better than 1.268-approximation for the Sub-MP- Sym problem with k terminals requires exponentially many value queries. The proof is essentially identical to the previous section, however the symmetric instance is different due to the requirement that the submodular function itself be symmetric (in the sense that f (S) = f ( ¯S)). The analysis of the symmetry gap in this case is technically more involved than in the previous section. The result that we obtain is as follows; we defer the proof to Appendix A. 4 Hardness from Unique Games In this section, we formulate our general hardness result for Min-CSP problems, and in particular we show how it implies the hardness result for Hypergraph Multiway Cut (Hypergraph-MC). 4.1 Min-CSP and the Basic LP The Min-CSPs we consider consist of a set of variables and a set of predicates (or cost functions) with constant arity over the variables. The goal is to assign a value from some finite domain to each variable so as to minimize the total cost of an assignment. Alternatively, we can view these variables as vertices of a hypergraph and the predicates being evaluated on the hyperedges of the hypergraph. Definition 4.1. Let ß = {Ψ : [q]i → [0, 1] ∪ {∞} i ≤ k} be a collection of functions with each function in ß has at most k input variables in [q] and outputs a value in [0, 1]. We call k the arity and q the alphabet size of the ß. An instance of the Min-ß-CSP, specified by (V, E, ΨE = {Ψe e ∈ E}, wE = {we ∈ E}), is defined over a weighted k-multi-hypergraph G(V, E). For every hyperedge e = (vi1, vi2, .., vij ) ∈ E, there is an associated cost function Ψe ∈ ß and a positive weight we. The goal is find an assignment ℓ : V → [q] for each vertex v ∈ V so as to minimize Xe=(vi1 ,...,vij )∈E we · Ψe(ℓ(vi1), . . . , ℓ(vij )). If there is a subset of vertices (which are called the terminal vertices) such that each has a single required label, we call the corresponding problem Min-ß-TCSP. If for every vertex v, it is only allowed to choose a label from a candidate list Lv ⊆ [q] (Lv is also part of the input), we call the corresponding problem Min-ß-LCSP. Given a Min-ß-CSP (or Min-ß-TCSP/Min-ß-LCSP) instance, it is natural to write down the fol- lowing linear program. We remark that this LP can be seen as a generalization of the Earthmover LP from [17], and has been referred to as the Basic LP [14, 22]. The LP captures probability distribu- tions over the possible assignments to each constraint (which is why we referred to this as the Local Distribution LP in the conference version of this paper). The Basic LP. There are variables xe,α for every hyperedge e ∈ E and assignment α ∈ [q]e, and variables xv,j for every vertex v ∈ V and j ∈ [q]. The objective function is of the following form: LP (I) = minXe we · Xα∈[q]e xe,α · Ψe(α) 13 under the constraint that, for every v ∈ V , xv,i = 1 q Xi=1 where 0 ≤ xv,i ≤ 1 for every v, i. We also have constraints that for every edge e = (v1, v2, . . . , vj) and i ∈ S and q0 ∈ [q] xvi,q0 = Xαi=q0 xe,α. where 0 ≤ xvi,α ≤ 1 for every xvi,α. every q0 that is not a feasible label assignment for v, we would add As for Min-ß-LCSP as well as Min-ß-TCSP, we would add the following additional constraint: for xv,q0 = 0. To see why this is a relaxation, one should think of xv,i as the probability of assigning label i to vertex v. For every edge e = (v1, v2, . . . , vj) and labeling α = (l1, l2, . . . , lj) for the vertices of e, xe,α is the probability of labeling the vertices of e according to α (that is, vertex vi receives label li). For every edge e, we define Pe as the distribution that assigns probability xe,α to each α ∈ [q]e. 4.2 The Min-CSP hardness theorem Definition 4.2. For some i ≥ 2,we define NAEi(x1, x2, ...xi) : [q]i → 0, 1 to be 0 if x1 = x2, . . . , = xi and 1 otherwise. Theorem 4.3. Suppose we have a Min-ß-CSP(TCSP/LCSP) instance I(V, E, ΨE, wE) with fractional optimum (of the Basic LP) LP (I) = c, integral optimum OPT(I) = s, and ß contains the predicate NAE2. Then for any ǫ > 0, for some λ > 0 it is Unique Games-hard to distinguish between instances of Min-ß-CSP(TCSP/LCSP) where the optimum value is at least (s − ǫ)λ, and instances where the optimum value is less than (c + ǫ)λ. As a corollary of Theorem 4.3, we obtain a hardness result for Hypergraph Multiway Cut. This follows from a known integrality gap example for Hypergraph Multiway Cut, reformulated for the Basic LP. Corollary 4.4. The Hypergraph-MC problem with k terminals is Unique Games-hard to approx- imate within (2 − 2 k − ǫ) for any fixed ǫ > 0. The same hardness result holds even the hyperedge of the graph has size at most k. Proof. Let ßk = {NAEi : [k]i → {0, 1} i = 2 . . . , k}. First, we claim if we have an α-approximation for the Hypergraph-MC with k terminals for some constant α > 1, then we can also have an α-approximation for the Min-ßk-TCSP. To see this, we make the following reduction. Take any instance of the Min-ßk-TCSP instance, it can almost be viewed as a k-way Hypergraph-MC instance on k-hypergraph as each constraint NAEi(v1, v2, . . . , vi) is corresponding to a hyperedge on v1, v2, . . . , vi. The only difference that is there may be multiple vertices fixed to be the same label in the Min-ßk-TCSP instance. To address this, we only need to add k new terminals t1, t2, . . . , tk. For all the existing vertex associated with the label i in the Min-ßk-CSP instance, we would add an edge of infinite weight to the corresponding ti. Therefore, it remains to show the hardness of approximating Min-ßk-CSP better than 2 − 2 k . Assuming the correctness of Theorem 4.3, consider the following Min-ßk-CSP instance Hk: there are 14 k(k + 1)/2 vertices indexed by (i, j) for 1 ≤ i ≤ j ≤ k. We have k hyperedges: for every i ∈ [k], the hyperedge ei is defined as ei = {(i1, i2) ∈ [k]2 : i = i1 ≤ i2 or i1 ≤ i2 = i}. We define the k terminals as ti = (i, i) for every i ∈ [k], with the label of ti required to be i. We claim that OPT(Hk) ≥ k − 1; i.e., there is no assignment with cost 0 on more than one edge. Without loss of generality, suppose the optimal solution has cost 0 on edge e1; i.e, assign label 1 to every vertex indexed by (1, i) for i ∈ [k]. Then we cannot have cost 0 for any of the remaining k − 1 hyperedges because to satisfy ei, we would need (1, i) to be labeled by i. On the other hand, LP (Hk) ≤ k/2. The following is a fractional solution: for every vertex v = (i, j), xv,i = 1/2 and xv,j = 1/2. All the other variables xv,k′ are 0 (for k′ 6= i, j). For every edge ei with its vertices ordered as (1, i), (2, i), . . . , (i, i), (i, i + 1), . . . (i, k), we have xe,(i,i,...,i) = 1/2 and xe,(1,2,...,k) = 1/2. This satisfies all the constraints and achieves an objective value of k/2. Therefore, applying Theorem 4.3, we get that it is Unique Games-hard to approximate Min-ßk- k , which implies the same hardness of approximation ratio for the TCSP beyond the factor k−1 k-way Hypergraph-MC problem (even on k-hypergraph as the arity of ßk is k). k/2 = 2− 2 In the following, we give a proof of Theorem 4.3, which is by an extension of the technique of [17]. In Section 4.3, we first review some standard definitions from the analysis of boolean functions. Then we describe our reduction and analyze it in Section 4.4. 4.3 Tools from Discrete Harmonic Analysis We now recall some standard definitions from the analysis of boolean functions. We will be considering functions of the form f : [q]n → Rk, where q, n, k ∈ N. The set of all functions f : [q]n → Rk forms a vector space with inner product hf, gi = E x∼[q]n [hf (x), g(x)i]; here we mean that x is uniformly random and the h·,·i inside the expectation is the usual inner product in Rk. We also write kfk =phf, fi as usual. Definition 4.5. For random x, y ∈ [q]n, we say that y is ρ-correlated with x if given x, we generate y by setting yi = xi with probability ρ or randomly in [q] with probability 1− ρ, independently for each i. For 0 ≤ ρ ≤ 1, we define Tρ to be the linear operator given by Tρf (x) = E y [f (y)], where y is a random string in [q]n which is ρ-correlated to x. We define the noise stability of f at ρ to be Definition 4.6. For i ∈ [n], we define the influence of i on f : [q]n → Rk to be Stabρ[f ] = hf, Tρfi. Inf i[f ] = E x1,...,xi−1,xi+1,...,xn∼[q](cid:20) Var xi∼[q] [f (x)](cid:21) , where Var[f ] is defined to be E[kfk2] − k E[f ]k2. More generally, for 0 ≤ δ ≤ 1 we define the δ-noisy- influence of i on f to be The following facts are well known in the literature of discrete harmonic analysis. Inf (1−δ) i [f ] = Inf i[T1−δf ]. 15 Fact 4.7. Inf (1−δ) i [f ] = Inf (1−δ) i [fj], k Xj=1 where fj : [q]n → R denotes the jth-coordinate output function of f . Fact 4.8. Let f (1), . . . , f (t) be a collection of functions [q]n → Rk. For c1, c2, ...ct ∈ R (or [q]n → Rk), we use the notation avg(c1, . . . , ct) to denote their (pointwise) average 1 j=1 cj. Then Inf (1−δ) i j∈[t]nf (j)o# ≤ avg "avg j∈[t]nInf (1−δ) i t Pt [f (j)]o . For randomized functions with discrete output, f′ : [q]n → [k], we can view them as functions defined as f : [q]n → ∆k where ∆k is the (k − 1)-dimensional standard simplex. The i-th coordinate indicates the probability that the function f′ outputs i. The following fact is also well known. Fact 4.9. For any f : [q]n → ∆k, Pn An important tool we need is the Majority Is Stablest Theorem from [18]. We state here a slightly modified version [20] using a small "noisy-influence" assumption rather than a small "low degree influence" assumption. [f ] ≤ 1/δ. i=1 Inf 1−δ i Theorem 4.10. (Majority Is Stablest) Suppose f : [q]n → [0, 1] has Inf (1−δ) i then [f ] ≤ τ and E[f ] = µ, Stab1−δ[f ] ≤ Γ1−δ(µ) + err(τ, q, δ) where for any fixed δ and q, limτ→0 err(τ, q, δ) = 0. Here the quantity Γ1−δ(µ) is defined to be Pr[x, y ≤ t] when (x, y) are joint standard Gaussian with covariance 1 − δ and t is defined by Pr[x ≤ t] = µ. We will use the following asymptotic estimate for Γ1−δ. Lemma 4.11. If δc ≤ µ ≤ 1 − δc for some constant 0 < c < 1, 2 +2c). 1 µ − Γ1−δ(µ) = Ω(δ Proof. Suppose that we have Prx∼N (0,1)[x ≤ t] = µ. Since (1 − δ)-correlated Gaussian variables (x, y) can be generated by starting with two independent Gaussian variables (x, z), and setting y = (1 − δ)x + √2δ − δ2z, we can write Γ1−δ(µ) = Pr[x ≤ t, y ≤ t] = Pr[(1 − δ)x +p2δ − δ2z ≤ t x ≤ t] · µ where x, z are independent Gaussian. For t′ = t − √2δ − δ2, we have that Pr[(1 − δ)x +p2δ − δ2z ≤ t x ≤ t] = Pr[x > t′ x ≤ t] · Pr[(1 − δ)x +p2δ − δ2z ≤ t t′ < x ≤ t] + Pr[x ≤ t′ x ≤ t] · Pr[(1 − δ)x +p2δ − δ2z ≤ t x ≤ t′] ] + Pr[x ≤ t′x ≤ t] (1) t − (1 − δ)t′ ≤ Pr[x > t′ x ≤ t] · Pr[z ≤ √2δ − δ2 = Pr[x > t′ x ≤ t] · Pr[z ≤ √2δ − δ2 √δt + (1 − δ)] + Pr[x ≤ t′x ≤ t] ≤ Pr[x > t′ x ≤ t] · Pr[z ≤ = p1 · (1 − p2) + (1 − p1) = 1 − p1p2 + (1 − δ)] + Pr[x ≤ t′x ≤ t] δt 16 where p1 = Pr[x > t′ x ≤ t] and p2 = Pr[z > √δt + (1 − δ)]. Hence we get that µ − Γ1−δ(µ) = µp1p2. Below we prove 1. p1 = Ω(δ 1 2 +c). 2. p2 = Ω(1). Combining with the fact that µ ≥ δc, this will complete the proof of Lemma 4.11. We need following property of Gaussian Distribution proved in [3]. Lemma 4.12. s > 0, [3] Let f (x) = 1√2π e− x2 2 be the density function of Gaussian Distribution. For every sf (s) s2 + 1 ≤ Pr g∼N (0,1) [g ≥ s] = Pr g∼N (0,1) [g ≤ −s] ≤ f (s) s . Recall that Prg∼N (0,1)[g ≤ t] = µ. In the case of µ ≤ 1/2 (and therefore t < 0), we have that µ = Pr g∼N (0,1) (g ≤ t) ≤ . f (t) t In the case that µ ≥ 1/2 (and therefore, t > 0), we also have that f (t) t (g ≥ t) = 1 − µ ≤ g∼N (0,1) Pr Combining the above two cases, we have that For sufficiently small δ, we claim that δc ≤ min(1 − µ, µ) ≤ = f (t) t 1 √2πt e− t2 2 . This can be proved by contradiction. Suppose that t >p2c log(1/δ), we would have f (t) t ≤p2c log(1/δ), t ≤ p4πc log(1/δ) δc < δc when δ is small enough. Therefore, p2 = Pr[z > √δt + (1 − δ)] ≥ Pr[z >p2cδ log(1/δ) + 1]. For sufficiently small δ, we have p2cδ log(1/δ) ≤ 1 and p2 ≥ Pr[z ≥ 2] ≥ 0.1. Next, we establish a lower bound for p1: p1 = Pr[t′ < x < tx < t] ≥ Pr[t′ ≤ x ≤ t] ≥ f (max(t′,t)) · (t − t′) Noticing that √2δ − δ2 ≤ √2δ, we have f (t +p2δ − δ2) ≥ f (t + √2δ) ≥ √2π The last inequality holds for sufficiently small constant δ and therefore p1 ≥ δ1/2+c ≥ f (t +p2δ − δ2)p2δ − δ2 ≥ e−(√2c log(1/δ)+√2δ)2/2 √2π = that √δ · f (t +p2δ − δ2). e−(c log(1/δ)+δ+√4δc log(1/δ)) δc 2π . ≥ 2π . Overall, we have and this finishes the proof of Lemma 4.11. µ − T1−δ(µ) ≥ µp1p2 = Ω(δ 17 1 2 +2c) 4.4 Reduction from Unique Games We describe a reduction from the Unique Games problem to Min-ß-CSP where ß contains the NAE2 predicate. Definition 4.13. A Unique Games instance U (V, E,{πu,v}(u,v)∈E , R) consists of a regular graph G(V, E) and each edge e = (u, v) ∈ E is associated with a permutation πuv : [R] 7→ [R]. For a given labeling L : V 7→ [R], an edge e = (u, v) ∈ E is said to be satisfied if L(v) = πu,v(L(u)). We denote OPT(U ) to be the maximum fraction of edges that can be satisfied by all the labeling. Conjecture 4.14 (The Unique Games Conjecture). Given a Unique Games instance U , for every ǫ > 0, there exists some large enough integer R , given a Unique Games instance U(cid:0)V, E,{πu,v}(u,v)∈E , R(cid:1), it is NP-hard to distinguish between the following two cases: • OP T (U ) ≥ 1 − ǫ; • OP T (U ) ≤ ǫ. Now we are ready to prove Theorem 4.3. We first prove the hardness result for Min-ß-CSP and then extend it to Min-ß-LCSP as well as Min-ß-TCSP. The reduction takes a Unique Games instance U (V, E, {πee ∈ E}, R) and it maps U to a ß-CSP instance M, using an integrality gap instance in the process. Suppose the integrality gap instance is I′ =(cid:0)V ′, E′, ΨE′ = {Ψe e ∈ E′}, wE′ = {we ∈ E′}(cid:1) and suppose that V ′ ≤ m, OPT(I′) = c and LP (I′) = s. Let us assume that the arity of ß is k and the alphabet size of ß is q. Without loss of generality, let us assume that the sum of the weights over all the hyperedges in E′ normalized to 1; thus we can view the weights we as a probability distribution over hyperedges. The reduction produces a new ß-CSP instance M with the following properties, for some parameter 0 < η < 1 to be specified later: 1. Completeness property: if OPT(U ) ≥ 1 − ǫ, then OPT(M) ≤ η(c + O(1/m)); 2. Soundness property: if OPT(U ) ≤ ǫ, then OPT(M) ≥ η(s − O(k/m)). By taking sufficiently large m, we have that it is Unique Games-hard to get any approximation better than s c − ǫ0 for any ǫ0 > 0 for the Min-ß-CSP. equal to one and we described it as a distribution over all the hyperedges. The vertex set of M's is going to be V × V ′ × [q]R. . The sum of the hyperedge weights in M is Recall that we denote by Pe the probability distribution over assignments in [q]e corresponding to the optimal fractional solution of I′, restricted to the hyperedge e. Given any π : [R] → [R] and x ∈ [q]R, we use π(x) to indicate a vector in [q]R such that π(x)i = xπ(i). 18 Reduction from Unique Games to ß-CSP. We choose the parameters as follows: m > max(V ′, q 4 , k2), ǫ ≤ 1/m80, η = 1/m39, δ = 1/m40. The weight we of a hyperedge e with cost function Ψe is the probability that it is generated by the following procedure. 1 • (Edge test) With probability η, we pick an edge e = (v′1, v′2, . . . , v′j) from E′. Then we randomly pick a vertex v from V and randomly pick j of its neighbors v1, v2, . . . , vj. We generate x1, x2 . . . , xj ∈ [q]R according to P R e . Output the cost function Ψe on (v1, v′1, πv1,v(x1)), (v2, v′2, πv2,v(x2)) . . . , (vj, v′j, πvj ,v(xj)). • (Vertex test) With probability (1 − η), we pick a vertex v from V and two of its neighbors v1, v2. We randomly pick a vertex v′ from V ′. Then we generate (1 − δ)- correlated x, y ∈ [q]R and output a cost function NAE2 on (v1, v′, πv1,v(x)) and (v2, v′, πv2,v(y)). A function f : V × V ′ × [q]R → [q] corresponds to a labeling of the instance M. Let us use Val(f ) to denote the expected cost of f and Valedge(f ) and Valvertex(f ) to denote the expected cost of f : [q]R → [q] on the edge test and the vertex test, respectively. Also let us use the notation fv,v′ to denote the restriction of f to a fixed pair v ∈ V, v′ ∈ V ′: fv,v′(x) = f (v, v′, x). We know that Val(f ) = (1 − η) · Valvertex(f ) + η · Valedge(f ). In the following we prove the completeness and soundness property of the reduction. Lemma 4.15 (completeness). If OPT(U ) ≥ 1 − ǫ, then OPT(M) ≤ η(c + O(1/m)) = c/m39 + O(1/m40). Proof. Suppose that a labeling Λ : V → [R] satisfies (1−ǫ)-fraction of the edges in the Unique Games instance. Let us consider a "dictator labeling" fv,v′ (x) = xΛ(v) for every (v, v′) ∈ V × V ′. Since a (1−ǫ)-fraction of the edges in the Unique Games instance can be satisfied, by an averaging argument and the regularity of the graph, we know that for at least a (1 − √ǫ)-fraction of the vertices, we have that at least a (1 − √ǫ)-fraction of its neighbors is satisfied by Λ. Therefore, by a union bound, when choosing a random pair of neighbors of a random vertex in V , with probability at least 1 − 3√ǫ the two edges are satisfied by Λ. This means that for the vertex test, with probability at least 1 − 3√ǫ we have πv1,v(Λ(v1)) = πv2,v(Λ(v2)). Conditioned on this, the cost of the vertex test is at most δ, as NAE2(πv1,v(x(Λ(v1)) = πv2,v(y(Λ(v2)))) = 0 with probability (1 − δ). Overall, we have that the vertex test cost is at most (1 − 3√ǫ) · δ + 3√ǫ. As for the edge test, by an extension of the argument above, with probability at least 1 − (m + 1)√ǫ, we have πv1,v(Λ(v1)) = πv2,v(Λ(v2)) . . . = πvj ,v(Λ(vj )). Conditioned on this, since πv1,v(Λ(v1)), . . . , xj (x1 πvj ,v(Λ(vj ))) ∼ Pe, the cost of the edge test corresponds exactly to the cost of the fractional solution of the LP: E e,v1,v2,...,vj [Ψe(x1 πv1,v(Λ(v1)), . . . , xj πvj ,v(Λ(vk ))] =Xe we Xα∼Pe E[Ψe(α)] = c. Therefore, the cost of the edge test is at most (1 − (m + 1)√ǫ) · c + (m + 1)√ǫ. Overall, the cost of the dictator labeling is η ·(cid:0)(m + 1)√ǫ + (1 − (m + 1)√ǫ) · c(cid:1) + (1 − η) · ((1 − 3√ǫ) · δ + 3√ǫ). By the choice of parameters, we obtain that Val(f ) = c/m39 + O(1/m40). 19 It remains to prove the following soundness property. Lemma 4.16 (soundness). If OPT(U ) ≤ ǫ, then OPT(M) ≥ η(s − O(k/m)) = s/m39 − O(k/m40). Proof. We will prove this by contradiction. Assume that there is an assignment f such that Val(f ) ≤ s/m39 − O(1/m40). The cost of the vertex test is: Valvertex(f ) = E v1,v2,v′,x,y [NAE2(fv1,v′(πv1,v(x)), fv2,v′(πv2,v(y)))] = E v′ [ E v1,v2,x,y [1 − q Xi=1 v1,v′(πv1,v(x)) · f i f i v2,v′(πv2,v(y))]] = 1 − = 1 − q q Xi=1 Xi=1 E v′ [ E v1,v2,x,y [f i v1,v′(πv1,v(x)) · f i v2,v′(πv2,v(y))]] E v′ [ E v,x,y [ E v1∼v [f i v1,v′(πv1,v(x))] E v2∼v [f i v2,v′(πv2,v(y))]]]. v,v′ is the indicator function of whether fv,v′ = i. Also vi ∼ v means vi is a u,v′(πu,v(x)], v,v′ (x) = Eu∼v[f i In the above expression, f i random neighbor of v and x, y ∈ [q]R are (1− δ)-correlated. If we define gi we have that v,v′ (y))(cid:3)(cid:21) v,v′ (x) · gi v,v′ ]# . v′(cid:20) E v,x,y(cid:2)gi Xi=1 Stab1−δ[gi Xi=1 v,v′"1 − Valvertex(f ) = 1 − = E E q q Recall that k ≤ √m by the choice of parameter, we have that Val(f ) = (1 − η) · Valvertex(f ) + ηValedge(f ) = s/m39 − O(k/m40) = O(1/m39), u,v′(πu,v(x)] and each (f 1 v,v′ ); v,v′ (x) = Eu∼v[f i u,v′) ∈ ∆q for any u, by the u,v′ as the indicator function of fu,v′ = i. For every gv,v′ , we classify it into the following we know then the cost of the vertex test Valvertex(f ) is O(1/m39). Let gv,v′ = (g1 gv,v′ ∈ ∆q as gi definition of f i three categories: (1) dictator function: there exists some gi specified later), (2) constant function: there exists some i with E[gi (3) all the other gv,v′ not in category (1) and (2). v,v′ with its δ-noisy-influence influence above τ (with τ being v,v′ ] ≥ 1 − δ0.1, and u,v′, . . . , f q u,v′, f 2 v,v′ , g2 v,v′ , . . . , gq The main idea of the remaining proof is to show that for every v′ ∈ V ′, in order to bound Valvertex(f ) by O(1/m39), we must have gv,v′ in category (2) for at least a 1 − O(1/m10) fraction of v ∈ V . Then we argue that this will incur a big cost on the edge test. We proceed as follows: (i) Bound the fraction of gv,v′ in category (3): Suppose for a fixed v′ ∈ V ′ and an α-fraction of v ∈ V , gv,v′ is in category (3); i.e., and max i∈R Inf 1−δ i [gv,v′ ] ≤ τ max i∈[k] E x∈[k]R [gi v,v′ (x)] < 1 − δ0.1. 20 Then setting τ to make err(τ, q, δ) ≤ 1/m30 in Theorem 4.10, we have that Stab1−δ[gi v,v′ ] ≤ Γ1−δ(µi v,v′ ) + err(τ, q, δ). where µi v,v′ = Ex[gi v,v′ (x)]. We know that µi v,v′ = q Xi=1 q Xi [gi v,v′ (x)] = E x q Xi=1 E x,u∼v [f i u,v′(πu,v(x)] = 1. Suppose that µi∗ v,v′ has the maximum value among µ1 v,v′ , µ2 v,v′ , . . . , µk v,v′ , we know then 1 q ≥ µi∗ v,v′ ≥ 1 δ0.1 . v,v′ , observing that δ0.1 ≤ µi∗ 1 m4 ≥ v,v′ ≤ 1 − δ0.1. We obtain µi∗ v,v′ − We apply Lemma 4.11 to µi∗ Γ1−δ(µi∗ q k 1 − v,v′ ] = Xi=1 Stab1−δ[gi v,v′ − Stab1−δ(gi v,v′ ) = Ω(δ0.7). For i 6= i∗ we simply use µi Xi=1(cid:0)µi ≥ µi∗ v,v′ − Γ1−δ(µi∗ v,v′ ) − err(τ, q, δ) m30(cid:19) ≥ Ω(δ0.7) − O(cid:18) 1 = Ω(cid:18) 1 v,v′ − Stab1−δ[gi m28(cid:19) . v,v′ ) ≥ 0. Therefore, v,v′ ](cid:1) Overall, each particular v′ ∈ V is picked with probability at least 1/m, and if gv,v′ for an α- fraction of v ∈ V is in category (3), the vertex test will have cost Ω(cid:0)α · 1 m28(cid:1). In order to m · keep the cost of the vertex test bounded by O(1/m39), we must have α = O(1/m10). (ii) Bound the fraction of gv,v′ in category (1): For a fixed v′ ∈ V ′, suppose that for a β-fraction of v ∈ V , gv,v′ has a coordinate with δ-noisy influence above τ . Then consider the following labeling for the Unique Games instance: for each v ∈ V , we can just assign randomly a label from the following list: 1 Λv = {i ∈ R : Inf 1−δ i [gv,v′ ] ≥ τ} ∪ {i ∈ R : Inf 1−δ i [fv,v′] ≥ τ /2}. Then by Lemma 4.9, q and δτ ). we know Λv = O( 1 By Fact 4.8, for every i ∈ Λv, Eu∼v[Inf 1−δ [gv,v′ ] ≥ τ . By an averag- ing argument, at least a τ /2-fraction of neighbors u ∼ v have a coordinate j ∈ R such that Inf 1−δ [fu,v′] ≥ τ /2 and πv,u(i) = j. Therefore, at least a τ /2-fraction of edges in the Unique Games instance have candidate labels in their lists that satisfy the edge. Hence choosing the [fu,v′(πv,u(x))]] ≥ Inf 1−δ j i i Inf 1−δ i [fv,v′] ≤ 1/δ, Inf 1−δ i [gv,v′ ] ≤ 1/δ, Xi=1 Xi=1 q 21 label of v independently and uniformly from Λv will satisfy each edge with probability Ω(βτ 3δ2). In expectation, we satisfy an Ω(βτ 3δ2)-fraction of the edges of the Unique Games instance. Since we can take ǫ (in the Unique Games Conjecture) to be an arbitrarily small constant. If we set ǫ = min(τ 3 · 1/m4 · δ2, 1/m80), we conclude that β = O(1/m4). Therefore, we can assume that for every v′ ∈ V ′, gv,v′ for a (1 − O(1/m4))-fraction of v ∈ V is in u,v′] ≥ 1 − δ0.1 = 1 − 1/m4. category (2); i.e., there exists some i ∈ [q] such that E[gi Therefore, if we pick a random v ∈ V , we have that Ev∈V [gi v,v′ ] = Eu∼v[f i v,v′ ] ≥ 1 − O(1/m4). Notice the regularity of the graph, we have that E v∈V u,v′] ≥ 1 − O(1/m4). [f i [gi v,v′ ] = E v∈V [ E u∼v [f i u,v′]] = E u∈V Given (v, v′) fixed, let us just consider the labeling of (v, v′, x) by arg maxi E[f i u ∈ V , we have that E[f i (1 − O(1/m)) fraction of the v ∈ V , maxi E[f i "good". By an average argument, for every v′ ∈ V ′ and for at least a (1− O(1/m2))-fraction of the vertices u,v′] ≥ 1 − 1/m2. Since V ′ ≤ m, by a union bound, we have that for a v,v′] ≥ 1− 1/m for every v′ ∈ V ′. Let us call these v ∈ V v,v′ ] for every x. This labeling has a cost at least s as it assigns a label depending only on (v, v′) which can be viewed as the cost of an integral labeling for the gap instance I′. Given a good v, f (v1, v′1, πv,v1 (x1)), (v, v2, πv2,v(x2)), . . . , (vj, v′j, πv,vj (xj)) in the reduction has the same cost as labeling each (vi, v′i, πvi,v(x)) with arg maxi E[f i v,v′] on (1 − O(j/m)) fraction of the hyperedges. Therefore, we have that Valvertex(f ) ≥ (1 − O(j/m)) · s ≥ (1 − O(k/m)) · s. This implies that Val(f ) ≥ ηValvertex(f ) ≥ η(1 − k/m) · s = s/m39 − O(k/m40) which leads to a contradiction. It remains to prove the same result holds for Min-ß-LCSP and Min-ß-TCSP. For Min-ß-LCSP. Assuming that there is an integrality gap instance I′ with LP (I) = c, OPT(I′) = s. For any v′ ∈ V ′ with the candidate label set Lv′ we will remove the requirement that its label must be in L′v, instead we will add a unary cost function PLv′ (z) : [q] → {0,∞} defined as PLv′ (z) =(cid:26) 0 if z ∈ Lv′ ∞ if z /∈ Lv′ on v′. Such a change transforms the Min-ß-LCSP instance I′ into an Min-ß ∪ {PLv′v′ ∈ V "}-CSP instance I′′. Since adding the PLv′ constraint on v′ is essentially the same as restricting the labeling of v′ in L′v, we know that OPT(I′) = OPT(I′′) and LP (I′) = LP (I′′). We will then use the reduction from a Unique Games instance U (with the integrality gap instance I′′) to a Min-ß ∪ {PLv′v′ ∈ V "}-CSP instance M, we still have that 1. Completeness property: if OPT(U ) ≥ 1 − ǫ, then OPT(M) ≤ η(c + O(1/m)); 2. Soundness property: if OPT(U ) ≤ ǫ, then OPT(M) ≥ η(s − O(k/m)). Then we can convert M into a Min-ß-LCSP instance M′. For any vertex u in M with PLv′ on it, we will remove PLv′ and set the candidate list of u to be Lv′. By doing this, we removing all the appearance of PLv′ . Such a conversion also has the property that OPT(M) = OPT(M′). Therefore, we prove the same Unique Games hardness result holds for the Min-ß-LCSP. As for Min-ß-TCSP, for any terminal vertex v′ ∈ V with fixed label i, we will remove the the requirement of the label of v′ to be i, instead we apply an equivalent cost function if z = i ∞ if z 6= i A similar argument as the proof for Min-ß-LCSP also holds. Pi(z) =(cid:26) 0 22 5 Lov´asz versus Basic LP Here we compare the Basic LP and the Lov´asz convex relaxation, for problems that can be phrased both as a Min-CSP and as a Submodular Multiway Partition problem. That is, we consider a ß-Min- CSP where each predicate Ψe ∈ ß is of the form Ψe(i1, . . . , il) = k Xi=1 fe({j : ij = i}) ye,i1,...,il = yv,ij where v is the j-th vertex of e. i=1 fe(yv,i : v ∈ e), where f is the Lov´asz extension Lemma 5.1. The value of the Lov´asz relaxation is at most the value of the Basic LP. and each fe : 2[l] → R+ is a submodular function. (Recall that Graph-MC, Hypergraph-MC and Node-Wt-MC fall in this category.) Then in both relaxations, we replace the labeling xv ∈ [k] by variables yv,i ≥ 0, i ∈ [k] such that Pk i=1 yv,i = 1. We also impose the list-coloring constraints yv,i = 0 for i /∈ Lv in both cases. The objective function is defined in different ways in the two relaxations. The Lov´asz relaxation. We minimize Pe∈EPk of f , f (y) = Eθ∈[0,1][f (Ay(θ))] where Ay(θ) = {i : yi > θ}. The Basic LP. We minimizePe∈EPi1,...,il∈[k] ye,i1,...,ikΨe(i1, . . . , il) subject to the consistency con- straints Pi1,...,ij−1,ij+1,...,il Proof. Given a fractional solution of the Basic LP, with variables yv,i for vertices v ∈ V and ye,i1,...,il for hyperedges e ∈ E, each hyperedge contributesPi1,...,il∈[k] ye,i1,...,ik Ψe(i1, . . . , il), where Ψe(i1, . . . , il) = Pk i=1 fe({j : ij = i}). In other words, each assignment (i1, . . . , il) contributes Pk the contribution of hyperedge e becomes Pk i=1PS⊆[l] ze,i,Sf (S). Moreover, the variables ze,i,S are consistent with yv,i for v ∈ e in the sense that yv,i =PS:v∈S ze,i,S. On the other hand, the contribution of a hyperedge e in the Lov´asz relaxation is given by the fe(yv,i : v ∈ e). It is known that the Lov´asz extension is the convex closure of Lov´asz extension Pk a submodular function, i.e. fe(yv,i : v ∈ e) is the minimum possible value of PS⊆[l] ze,i,Sf (S) subject to the consistency constraints yv,i = PS:v∈S ze,i,S, and ze,i,S ≥ 0. Therefore, the contribution of e to i=1 f (Si) where Si is the set of coordinates labeled by i. Aggregating all the contributions of a given set S, we can define ze,i,S as the sum of ye,i1,...,il over all choices where the coordinates labeled by i are exactly S. Then, i=1 the Lov´asz relaxation is always at most the contribution in the Basic LP. This means that the Basic LP is potentially a tighter relaxationand its fractional solution carries potentially more information than a fractional solution of the Lov´asz relaxation. However, in some cases the two LPs coincide: We remark that for the Graph-MC problem, both relaxations are known to be equivalent to the CKR relaxation (see [5] for a discussion of the Lov´asz relaxation, and [17] for a discussion of the "earthmover LP", identical to our Basic LP). Our results also imply that for the Hypergraph-MC problem, both relaxations have the same integrality gap, 2 − 2/k. However, for certain problems the Basic LP can be strictly more powerful than the Lov´asz relaxation. Hypergraph Multiway Partition. Given a hypergraph H = (V, E) and k terminals t1, . . . , tk ∈ V , find a partition (A1, . . . , Ak) of the vertices, so thatPk i=1 f (Ai) is minimized, where f (A) is the number of hyperedges cut by (A, ¯A). This is a special case of Sub-MP-Sym, because f here is the cut function in a hypergraph, a symmetric submodular function. The difference from Hypergraph Multiway Cut is that in Hypergraph Multiway 23 Partition, each cut hyperedge contributes 1 for each terminal that gets assigned some of its vertices (unlike in Hypergraph-MC where such a hyperedge contributes only 1 overall). Lemma 5.2. There is an instance of Hypergraph Multiway Partition where the Lov´asz relaxation has a strictly lower optimum than the Basic LP. Proof. The instance is the following: We have a ground set V = {t1, t2, t3, t4, t5, a12, a23, a34, a45, a51}. The hyperedges are {t1, t2, a12}, {t2, t3, a23}, {t3, t4, a34}, {t4, t5, a45}, {t5, t1, a51} with unit weight, and {a12, a23, a34, a45, a51} with weight ǫ = 0.001. The idea is that fractionally, each non-terminal ai,i+1 must be assigned half to ti and half to ti+1, otherwise the cost of cutting the triple-edges is prohibitive. Then, the cost of the 5-edge {a12, a23, a34, a45, a51} is strictly higher in the Basic LP, since there is no good distribution consis- tent with the vertex variables (while the Lov´asz relaxation is not sensitive to this). We verified by an LP solver that the two LPs have indeed distinct optimal values. 6 The equivalence of integrality gap and symmetry gap result assuming UGC. Similarly, if the objective function can be viewed as Pk In this section, we prove that for any Min-ß-CSP (specified by allowed predicates and candidate lists), the worst-case integrality gap of its Basic LP and the worst-case symmetry gap of its multilinear relaxation are the same. As we have seen, if we consider a ß-Min-CSP problem and ß includes the Not-Equal predicate, then the integrality gap of the Basic LP implies a matching inapproximability i=1 f (Si) where f is submodular and Si is the set of vertices labeled i, then the symmetry gap implies an inapproximability result for this "submodular generalization" of the ß-CSP problem. In fact, the two hardness threshold often coincide as we have seen in the case of Hypergraph-MC and Sub-MP, where they are equal to 2 − 2/k. Here, we show that it is not a coincidence that the two hardness thresholds are the same. We recall that the symmetry gap of a Min-CSP is the ratio s/c between the optimal fractional solution c and the optimal symmetric fractional solution s of the multilinear relaxation. The objective function in the multilinear relaxation is F (x) = E[f (x)], where x is an integer solution obtained by independently labeling each vertex v by i with probability xv,i. The notion of symmetry here is that I′ on a ground set V ′ is invariant under a group G of permutations of V ′. A fractional solution is symmetric if for any permutation σ ∈ G and v′ ∈ V ′, v′ and σ(v′) have the same fractional assignment. The following theorem states that an integrality gap instance can be converted into a symmetry gap instance. Theorem 6.1. For any ß-CSP instance I(V, E, k, Lv, h) whose Basic LP has optimum LP (I) = c, and the integer optimum is OPT(I) = s, there is a symmetric ß-CSP instance I′(V ′, E′, k, L′v, h) whose symmetry gap is s/c. Proof. Given an optimal solution x of the Basic LP for instance I, without loss of generality, let us assume that all the variables in the solution have a rational value and there exists some M such that the values of all the variables, i.e, xv,i and xe,α, in the LP solution become integers if multiplied by M . For every vertex v ∈ V , we define Sv = {y ∈ [k]M : for every i ∈ [k]; xv,i fraction of y's coordinates have value i}. In other words, Sv is the collection of strings in [k]M such that the portion of appearances of i in each string is exactly xv,i. We define a new instance on a ground set V ′ = {(v, y) : v ∈ V, y ∈ Sv}. For every vertex (v, y) in V ′, its candidate list is Lv, the candidate list of vertex v in instance I. Given an edge 24 e = (v1, v2, . . . , ve) ∈ E and its local distribution Pe over [k]e (implied by the fractional solution xe,α), we call (y1, y2, . . . , ye) ∈ ([k]M )e "consistent with e" if for every α ∈ [k]e, the fraction of i , . . . , yei ) = α is exactly xe,α. It is easy to check (using the LP consistency i ∈ [M ] such that (y1 constraints) that each yi must be in Svi. We define Se to be the collection of all possible (y1, y2, . . . , ye) that are consistent with edge e. i , y2 For every edge e = (v1, v2, . . . , ve) and every (y1, y2, . . . , ye) consistent with e, we add a constraint Ψe over (v1, y1), . . . , (vj, ye) with the same predicate function as edge e. We assign equal weights to all these copies of constraint Ψe, so that their total weight is equal to we. Let G be the group of all permutations π : [M ] → [M ]. For any π ∈ G, we also use the notation π(y) to indicate (yπ(1), yπ(2), . . . , yπ(M )) for any y ∈ [k]M . Let us also think of G as a permutation on V ′: for any (v, y) ∈ V ′, we map it to (v, π(y)). Then it is easy to check that I′ is invariant under any permutation σ ∈ G. Also, for any (v, y), (v, y′) ∈ V ′, since y and y′ contain the same number of occurences for each i ∈ [M ] (consistent with xv,i), we know there exists some π ∈ G such that π(y) = y′. Therefore, a fractional solution of I′ is symmetric with respect to G if and only if (v, y) has the same fractional assignment as (v, y′), for all y, y′ ∈ Sv. Let us also assume that both I and I′ are normalized with all their weights summing to 1; i.e, there is a distribution over the constraints with the probability being the weights. Essentially, I′ is constructed by randomly picking a constraint Ψe(v1, v2, . . . , ve) in I and then randomly picking (y1, y2, . . . , ye) in Se. Then we add a constraint Ψe on (v1, y1), (v2, y2), . . . , (ve, ye) in I′. Below, we prove that assuming there is a gap of s versus c between integer and fractional solutions for the Basic LP of I, there is a gap of at least s versus c between the best symmetric fractional solution and the best asymmetric fractional solution for the multilinear relaxation of I′. Some (asymmetric) solution of I′ has cost at most c: Consider the following (random) assign- ment for I′: we first choose a random i ∈ [M ] and then assign to each (v, y) the label yi. We know yi ∈ Lv, as it is a valid assignment for v by the definition of Sv. Such an assignment has expected cost E i∈[M ],e,y1,...,ye [Ψe(y1 i , . . . , yei )] = E e [ Xα∈[k]e xe,αΨ(α)] = LP (I) = c. Therefore there is also some deterministic assignment of cost at most c. Our assignment is in fact integral, so the multilinear relaxation does not play a role here. Every symmetric fractional solution of I′ has cost at least s: We know that a symmetric solution gives the same fractional assignment xv = (xv,1, xv,2, . . . , xv,k) to vertex (v, y) for every y ∈ Sv. Also by definition of the multilinear relaxation, the value of this fractional solution is equal to the expected cost of independently choosing the label of each (v, y) from the distribution Pv, which means i with probability xv,i. Therefore, given a symmetric solution of I′ specified by {xv v ∈ V }, it has cost (2) E [Ψe(l1, l2, . . . , le)] e=(v1,...,ve)∈E,(y1,...,ye)∈Se,li∼Pvi Since l1, l2, . . . , le is independent of (y1, y2, . . . , ye), we have (2) = E e=(v1,v2,...,ve)∈E,l1,l2,...,le [Ψe(l1, l2, . . . , le)] where li is chosen independently from the distribution Pvi for the respective vertex vi ∈ e. This is exactly the cost on the original instance I if we independently label each v by sampling from distribution Pv. Since the integer optimum of I is at least s, we have that (2) is also at least s. 25 In the other direction, we have the following. Theorem 6.2. For any symmetric ß-CSP instance I(V, E, k, Lv, h) whose multilinear relaxation has symmetry gap γ, and for any ǫ > 0 there is a ß-CSP instance I′(V ′, E′, k, L′v, h) whose Basic LP has integrality gap at least (1 − ǫ)γ. Proof. Assume that I is an instance symmetric under a group of permutations G on the vertices V . For each v ∈ V , we denote by ω(v) the orbit of v, ω(v) = {σ(v) : σ ∈ G}. We produce a new instance I′ by folding the orbits, i.e. we identify all the elements in a given orbit. First, let us assume for simplicity that no constraint (edge) in I operates on more than one variable from each orbit. Then, we just fold each orbit ω(v) into a single vertex. I.e., V ′ = {ω(v) : v ∈ V }. (We abuse notation here and use ω(v) also to denote the vertex of V ′ corresponding to the orbit ω(v).) We also define E′ to be edges corresponding one-to-one to the edges in E, with the same predicates; i.e. each constraint Ψe(x1, . . . , xe) in I becomes Ψe(ω(x1), . . . , ω(xe)) in I′. The candidate list for ω(v) is identical to the candidate list of v (and hence also to the candidate list for any other w ∈ ω(v), by the symmetry condition on I). Now consider an optimal fractional solution of the multilinear relaxation of I, with variables xv,i. We define a fractional solution of the Basic LP for I′, by setting xω(v),i = 1 ω(v) Pw∈ω(v) xw,i. We claim that the edge variables xe,α can be assigned values consistent with xω(v),i in such a way that the objective value of the Basic LP I′ is equal to the value of the multilinear relaxation for I. This is because the value of the multilinear relaxation is obtained by independently labeling each vertex v by i with probability xv,i. We can then define xe,α as the probability that edge e is labeled α under this random labeling. This shows that the optimum of the Basic LP for I′ is at most the optimum of the multilinear relaxation of I (if we have a minimization problem; otherwise all inequalities are reversed). Now, consider an integer solution of the instance I′, i.e. a labeling of the orbits ω(v) by labels in [k]. This induces a natural symmetric labeling of the instance I, where all the vertices in each orbit receive the same label. The values of the two labelings of I and I′ are the same. (Both labelings are integer, so the multilinear relaxation does not play a role here.) This shows that the symmetric optimum of the multilinear relaxation of I is at most the integer optimum of I′. Together with the previous paragraph, we obtain that the gap between integer and fractional solutions of the Basic LP of I′ is at least the gap between symmetric and asymmetric solutions of the multilinear relaxation of I. This completes the proof in the special case where no predicate takes two variables from the same orbit. Now, let us consider the general case, in which a constraint of I can contain multiple variables from the same orbit. Note that the proof above doesn't work here, because it would produce predicates in I′ that operate on the same variable multiple times, which we do not allow. (As an instructive example, consider a symmetric instance on two elements {1, 2} with the constraint l1 6= l2, which serves as a starting point in proving the hardness of (1/2 + ǫ)-approximating the maximum of a nonnegative submodular function. This instance is symmetric with respect to switching 1 and 2, and hence the folded instance would contain only one element and the constraint l′1 6= l′1, which is not a meaningful integrality gap instance.) Instead, we replace each orbit by a large cluster of identical elements, and we produce copies of each constraint of I, using distinct elements from the respective clusters. As an example, consider the 2-element instance above. We would first fold the elements {1, 2} into one, and then replace it by a large cluster C of identical elements. The original constraint l1 6= l2 will be replaced by the same constraint for every pair of distinct elements {i, j} ⊂ C. In other words, the new instance is a Max Cut instance on a complete graph and we consider the Basic LP for this instance. The symmetry 26 gap of the original instance is 2, and the integrality gap of the Basic LP is arbitrarily close to 2 (for C → ∞). Now let us describe the general reduction. For each orbit ω(v) of I, we produce a disjoint cluster of elements Cω(v). The candidate list for each vertex in Cω(v) is the same as the candidate list for any vertex in ω(v) (which must be the same by the symmetry assumption for I). The ground set of I′ is V ′ = Sv∈V Cω(v). For each edge e = (v1, . . . , ve) of I, we produce a number of copies by considering all possible edges e′ = (v′1, . . . , v′ are distinct. We use e the same predicate, Ψe′ = Ψe. The edge weights we′ are defined so that they are equal and add up to we. Let us assume that I,I′ are minimization problems. Let c be value of the optimal solution of the multilinear relaxation of I, and let s be the the value of the optimal symmetric solution of the multilinear relaxation of I. ) where v′i ∈ Cω(vi) and v′1, . . . , v′ e The fractional optimum of I′ is at most c: Let xv,i be an solution of the multilinear relaxation of value c. We define a fractional solution of the Basic LP for I′ to be equal to xv′,i = 1 ω(v) Pw∈ω(v) xw,i for each v′ ∈ Cω(v). Similar to the construction in the simpler case above, we define the edge variables xe′,α to simulate the independent rounding that defines the value of the multilinear extension of I; specifically, we define xe′,α for e′ = (ω(v1), ω(v2), . . . , ω(ve)) to be the probability that e = (v1, . . . , ve) receives assignment α, where e is the edge that produced e′ in our reduction. By construction, the value of this fractional solution for I′ is equal to the value of the multilinear relaxation for I which is c. The integer optimum of I′ is at least s: Here, we consider any integer solution of I′ and we produce a symmetric fractional solution for I′. If the integer solution for I′ is denoted by l(v′), we consider each cluster Cω(v) in I′ and we define xv,i to be the fraction of vertices in Cω(v) that are labeled i. Note that by definition, xv,i = xw,i for all w ∈ ω(v) and hence xv,i depends only on the orbit of v. This means that xv,i is a symmetric fractional solution. Also, it respects the candidate lists of I because I′ has the same candidate lists and hence the fractional solution uses only the allowed labels for each vertex v. The value of this symmetric fractional solution is given by the multilinear extension, i.e. the expected value of a random labeling where each label is chosen independently with probabilities xv,i. The final observation is that in the limit as Cω(v) → ∞, this is very close to the value of the integer solution l(v′) for I′: this is because the edges e′ in I′ are defined by all possible choices of distinct elements in the respective clusters. In the limit, this is arbitrarily close to sampling independently random vertices from the respective clusters, which is what the multilinear relaxation corresponds to. Therefore, the optimal symmetric fractional solution to I cannot be worse than the integer optimum of I′ in the limit. In conclusion, the integrality gap of the Basic LP for I′ can be made arbitrarily close to the symmetry gap of I, s/c. References [1] Niv Buchbinder, Joseph Naor, and Roy Schwartz. Simplex partitioning via exponential clocks and the multiway cut problem. In ACM STOC, pages 535 -- 544, 2013. [2] Gruia Calinescu, Howard J. Karloff, and Yuval Rabani. An improved approximation algorithm for multiway cut. Journal of Computer and System Sciences, 60(3):564 -- 574, 2000. Preliminary version in STOC 1998. [3] Moses Charikar, Konstantin Makarychev, and Yury Makarychev. Near-optimal algorithms for unique games. In Proceedings of the thirty-eighth annual ACM symposium on Theory of comput- ing, pages 205 -- 214. ACM, 2006. 27 [4] Chandra Chekuri and Alina Ene. Approximation algorithms for submodular multiway partition. In IEEE Symposium on Foundations of Computer Science (FOCS), 2011. [5] Chandra Chekuri and Alina Ene. Submodular cost allocation problem and applications. In Automata, Languages and Programming (ICALP), pages 354 -- 366, 2011. A longer version is available on the arXiv, abs/1105.2040. [6] Chandra Chekuri, Jan Vondr´ak, and Rico Zenklusen. Submodular function maximization via the multilinear extension and contention resolution schemes. In ACM Symposium on Theory of Computing (STOC), pages 783 -- 792, 2011. [7] Elias Dahlhaus, David S. Johnson, Christos H. Papadimitriou, Paul D. Seymour, and Mihalis Yannakakis. The complexity of multiterminal cuts. SIAM Journal on Computing, 23(4):864 -- 894, 1994. Preliminary version in STOC 1992. [8] Shahar Dobzinski and Jan Vondr´ak. From query complexity to computational complexity. In ACM Symposium on Theory of Computing (STOC), 2012. [9] Alina Ene, Jan Vondr´ak, and Yi Wu. Local distribution and the symmetry gap: Approximability of multiway partitioning problems. In SODA, pages 306 -- 325, 2013. [10] Naveen Garg, Vijay V. Vazirani, and Mihalis Yannakakis. Multiway cuts in node weighted graphs. Journal of Algorithms, 50(1):49 -- 61, 2004. Preliminary version in ICALP 1994. [11] Satoru Iwata and Kiyohito Nagano. Submodular function minimization under covering con- In IEEE Symposium on Foundations of Computer Science (FOCS), pages 671 -- 680, straints. 2009. [12] David R. Karger, Philip N. Klein, Clifford Stein, Mikkel Thorup, and Neal E. Young. Rounding algorithms for a geometric embedding of minimum multiway cut. Mathematics of Operations Research, 29(3):436 -- 461, 2004. Preliminary version in STOC 1999. [13] Ariel Kulik, Hadas Shachnai, and Tami Tamir. Maximizing submodular set functions subject to multiple linear constraints. In ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 545 -- 554, 2009. [14] G´abor Kun, Ryan O'Donnell, Suguru Tamaki, Yuichi Yoshida, and Yuan Zhou. Linear program- In Innovations in Theoretical Computer Science ming, width-1 csps, and robust satisfaction. 2012, Cambridge, MA, USA, January 8-10, 2012, pages 484 -- 495, 2012. [15] Jon Lee, Vahab S. Mirrokni, Viswanath Nagarajan, and Maxim Sviridenko. Maximizing nonmono- tone submodular functions under matroid or knapsack constraints. SIAM Journal on Discrete Mathematics, 23(4):2053 -- 2078, 2010. [16] L´aszl´o Lov´asz. Submodular functions and convexity. In Mathematical programming: the state of the art, pages 235 -- 257. Springer, 1983. [17] Rajsekar Manokaran, Joseph S. Naor, Prasad Raghavendra, and Roy Schwartz. SDP gaps and UGC hardness for multiway cut, 0-extension, and metric labeling. In ACM Symposium on Theory of Computing (STOC), pages 11 -- 20, 2008. [18] Elchanan Mossel, Ryan O'Donnell, and Krzysztof Oleszkiewicz. Noise stability of functions with In IEEE Symposium on Foundations of Computer invariance and optimality. low influences: Science (FOCS), pages 21 -- 30, 2005. 28 [19] Kazumasa Okumoto, Takuro Fukunaga, and Hiroshi Nagamochi. Divide-and-conquer algorithms for partitioning hypergraphs and submodular systems. Algorithmica, pages 1 -- 20, 2010. Prelimi- nary version in ISAAC 2009. [20] Prasad Raghavendra. Approximating NP-hard problems: efficient algorithms and their limits. PhD thesis, University of Washington, 2009. [21] Ankit Sharma and Jan Vondr´ak. Multiway cut, pairwise realizable distributions and descending thresholds. In ACM STOC, 2014. [22] Johan Thapper and Stanislav Zivny. The power of linear programming for valued csps. In 53rd Annual IEEE Symposium on Foundations of Computer Science, FOCS 2012, New Brunswick, NJ, USA, October 20-23, 2012, pages 669 -- 678, 2012. [23] Jan Vondr´ak. Optimal approximation for the submodular welfare problem in the value oracle model. In ACM Symposium on Theory of Computing (STOC), pages 67 -- 74, 2008. [24] Jan Vondr´ak. Symmetry and approximability of submodular maximization problems. In IEEE Symposium on Foundations of Computer Science (FOCS), pages 651 -- 670, 2009. [25] Jan Vondr´ak. Symmetry and approximability of submodular maximization problems. Available on the arXiv, abs/1110.4860, 2011. [26] Liang Zhao, Hiroshi Nagamochi, and Toshihide Ibaraki. Greedy splitting algorithms for approxi- mating multiway partition problems. Mathematical Programming, 102(1):167 -- 183, 2005. A Missing proofs from Section 3 A.1 Hardness for symmetric Sub-MP Here, we prove Theorem 3.5. We follow the symmetry gap approach of the proof of Theorem 3.1, only the symmetric instance is different here. The symmetric instance. Let V = [k] × [k]. It is convenient to think of the elements of V as belonging to "rows" Ri = {(i, j) 1 ≤ j ≤ k} and "columns" Ci = {(j, i) 1 ≤ j ≤ k}. The elements (i, i) are the terminals, i.e, ti = (i, i). We define our cost function f as follows. Let γ ∈ [0, k] be a parameter; we assume for convenience that γ is an even integer. Let φ : R → R be the following function: φ(t) =(t 2k − t − γ if t ≤ k − γ/2, otherwise. For each i ∈ [k], let gi : 2V → R+ be the following function: gi(S) =(φ(S) φ(k − S) The function f : 2V → R+ is defined by f (S) =Pk i=1 gi(S∩Ci). It is straightforward to verify that f is non-negative, submodular, and symmetric. As before, the instance is symmetric under swapping the vertices (i, j) and (j, i) for all i 6= j. i=1 gi(S∩Ri)+Pk if ti /∈ S, otherwise. 29 Computing the symmetry gap. Theorem A.1. Let γ = 2⌊2k−√3k2 − 2k⌋. Then the gap between the best symmetric and asymmetric assignment for the instance defined above is at least 8√3−12 2√3−2 − O( 1 k ) ≈ 1.2679 − O( 1 k ). Definition A.2. We say that element (i, j) is unhappy if it is assigned to a terminal ℓ /∈ {i, j}. An assignment is nice if it has the following properties: (a) Each unhappy element is assigned to terminal 1. (b) For each i 6= 1, the number of elements in row Ri that are assigned to terminal i is either 0 or at least γ/2. Similarly, for each i 6= 1, the number of elements in column Ci that are assigned to terminal i is either 0 or at least γ/2. The number of elements in row R1 and column C1 that are assigned to terminal 1 is at least γ/2. (c) For each i 6= 1, if the number of unhappy elements in row Ri is at least k − γ/2, all the elements in Ri \ {(i, i)} are assigned to terminal 1. Similarly, for each i 6= 1, if the number of unhappy elements in column Ci is at least k − γ/2, all the elements in Ci \ {(i, i)} are assigned to terminal 1. Theorem A.1 will follow from the following lemmas. Lemma A.3. Consider a symmetric assignment of cost C. Then there exists a nice symmetric assignment whose cost is at most C + 6k. Lemma A.4. Let γ = 2⌊2k−√3k2 − 2k⌋. Then the cost of any nice symmetric assignment is at least (8√3 − 12)k2 − O(k). Proof of Theorem A.1. Note that it follows from Lemma A.3 and Lemma A.4 that the optimal sym- metric assignment has cost OPT ≥ (8√3 − 12)k2 − O(k). Now we claim that the optimal asymmetric assignment has cost OPT ≤ 2k2 − γk ≤ 2k2 − 4k2 + 2k√3k2 + O(k) = (2√3 − 2)k2 + O(k). Consider the assignment that assigns the i-th row Ri = {(i, j) 1 ≤ j ≤ k} to terminal i. We have k k Xℓ=1 gℓ({(i, ℓ)}) f (Ri) = gℓ(Ri ∩ Cℓ) gℓ(Ri ∩ Rℓ) + Xℓ=1 = gi(Ri) + gi({(i, i)}) +Xℓ6=i = φ(0) + φ(k − 1) + (k − 1)φ(1) = 0 + (k + 1 − γ) + (k − 1) · 1 = 2k − γ. Therefore the total cost of the assignment is k(2k − γ) and the theorem follows by plugging in the value of γ. 30 A.1.1 Proof of Lemma A.3 Consider a symmetric assignment. Let Aℓ denote the set of all elements that are assigned to terminal ℓ. Note that, for each i, row Ri and column Ci have the same number of unhappy elements; additionally, they have the same number of elements assigned to terminal i. Let ni = Ai ∩ Ri denote the number of elements in Ri that are assigned to terminal i and let ui denote the number of elements in Ri that are unhappy. Let uiℓ denote the number of unhappy elements in Ri that are assigned to terminal ℓ. Let I be the set of all indices i such that ni < γ/2. We reassign elements as follows. For each i ∈ I \ {1}, i.e. such that row Ri has fewer than γ/2 elements assigned to terminal i, we reassign all the elements in (Ri ∪ Ci)∩ (Ai \{(i, i)}) to terminal 1. If row R1 has less than γ/2 elements assigned to terminal 1, we reassign all the elements in R1 ∪ C1 to terminal 1. We reassign each remaining unhappy element to terminal 1. Finally, for each i such that row Ri has at least k− γ/2 elements assigned to terminal 1, we reassign all elements in Ri∪ Ci\{(i, i)} to terminal 1. Note that the resulting assignment is symmetric. Let (A′1,··· , A′k) denote the resulting assignment, where A′ℓ is the set of all elements that are assigned to terminal ℓ, and let C′ be its cost. Let J denote the set of all indices i such that all of the elements of Ri \ {(i, i)} have been reassigned to terminal 1; more precisely, A′1 ∩ Ri ⊇ Ri \ {(i, i)}. Claim A.5. For each i ∈ I, gi(A′i∩Ri) ≤ gi(Ai∩Ri)−ni +1. For each i ∈ ¯I, gi(A′i∩Ri) = gi(Ai∩Ri). Proof. Consider an index i ∈ I. Suppose first that i = 1. Note that we reassigned all of the elements in R1 to terminal 1. Thus g1(A′1 ∩ R1) = φ(k − A′1 ∩ R1) = 0. Since n1 < γ/2 and γ ≤ k, g1(A1 ∩ R1) = φ(k − A1 ∩ R1) = k − γ + n1 ≥ n1. Therefore we may assume that i 6= 1. Note that we reassigned all of the elements in Ai ∩ Ri \ {(i, i)} to terminal 1 and thus A′i ∩ Ri = 1. We have gi(Ai ∩ Ri) = φ(k − Ai ∩ Ri) = k − γ + ni and gi(A′i ∩ Ri) = φ(k − A′i ∩ Ri) = k − γ + 1, which gi(Ai ∩ R) ≤ gi(Ai ∩ R) − ni + 1. Consider an index i ∈ ¯I. Since all of the elements of Ai ∩ Ri are happy, we have A′i ∩ Ri = Ai ∩ Ri and therefore gi(A′i ∩ Ri) = gi(Ai ∩ Ri). Corollary A.6. We have Pk Claim A.7. For each i ∈ J −{1}, gi(A′1 ∩ Ri) ≤Pℓ6=i gi(Aℓ ∩ Ri)− ni + 1. For each i ∈ I ∩ ( ¯J −{1}), gi(A′1∩ Ri) ≤ gi(A1∩ Ri) + ui− ui1 + ni. For each i ∈ ¯I ∩ ( ¯J −{1}), gi(A′1∩ Ri) ≤ gi(A1∩ Ri) + ui− ui1. Proof. Consider an index i ∈ J − {1}. Since we reassigned all elements of Ri − {(i, i)} to terminal 1, gi(A′1∩ Ri) = φ(k− 1) = k− γ + 1. Suppose there exists an ℓ∗ 6= i such that Aℓ∗ ∩ Ri > k− γ/2. Then gi(Aℓ∗ ∩ Ri) = φ(Aℓ∗ ∩ Ri) = 2k − γ − Aℓ∗ ∩ Ri. Additionally, for each ℓ /∈ {ℓ∗, i}, Aℓ ∩ Ri < γ/2 and thus gi(Aℓ ∩ Ri) = φ(Aℓ ∩ Ri) = Aℓ ∩ Ri. Therefore gi(Aℓ ∩ Ri) = 2k − γ − Aℓ∗ ∩ Ri + Xℓ /∈{ℓ∗,i} = 2k − γ − 2Aℓ∗ ∩ Ri + k − ni ≥ 3k − γ − ni − 2(k − ni) = k − γ + ni. i=1 gi(Ai ∩ Ri) −Pi∈I ni + k. i=1 gi(A′i ∩ Ri) ≤Pk Xℓ6=i Aℓ ∩ Ri (since Aℓ∗ ∩ Ri ≤ k − ni) Therefore gi(A′1 ∩ Ri) = k − γ + 1 ≤Pℓ6=i gi(Aℓ ∩ Ri) − ni + 1. Thus we may assume that Aℓ ∩ Ri ≤ k− γ/2 for each ℓ 6= i. For each ℓ 6= i, we have gi(Aℓ ∩ Ri) = 31 φ(Aℓ ∩ Ri) = Aℓ ∩ Ri. Thus Xℓ6=i gi(Aℓ ∩ Ri) = k − ni, gi(A′1 ∩ Ri) = k − γ + 1 =Xℓ6=i ≤Xℓ6=i gi(Aℓ ∩ Ri) + ni − γ + 1 gi(Aℓ ∩ Ri) − ni + 1 (since γ ≥ 0). Consider an index i ∈ I ∩ ( ¯J \ {1}). Then ni < γ/2 and ui + ni < k − γ/2. The elements of Ri that we reassigned to terminal 1 were the unhappy elements and the elements of Ai ∩ Ri. Note that, since i 6= 1, at most one element of A1 ∩ Ri is happy (namely the element (i, 1) ∈ C1). Therefore A′1 ∩ Ri ≤ ui + ni + 1 ≤ k− γ/2 and A1 ∩ Ri ≤ ui1 + 1 ≤ k − γ/2. Thus gi(A′1 ∩ Ri) = φ(A′1 ∩ Ri) = A′1 ∩ Ri = A1 ∩ Ri + ui − ui1 + ni and gi(A1 ∩ Ri) = φ(A1 ∩ Ri) = A1 ∩ Ri. Consider an index i ∈ ¯I ∩ ( ¯J \ {1}). Then ni ≥ γ/2 and ui < k − γ/2. The elements of Ri that we reassigned to terminal 1 were the unhappy elements. Note that at most one element of A1 ∩ Ri is happy and therefore A′1 ∩ Ri ≤ ui + 1 ≤ k − γ/2. Additionally, A1 ∩ Ri ≤ ui1 + 1 ≤ k − γ/2. Thus gi(A′1∩Ri) = φ(A′1∩Ri) = A′1∩Ri = A1∩Ri+ui−ui1 and gi(A1∩Ri) = φ(A1∩Ri) = A1∩Ri. Claim A.8. For each i ∈ J and each ℓ /∈ {i, 1}, gi(A′ℓ ∩ Ri) = 0. For each i ∈ ¯J and each ℓ /∈ {i, 1}, gi(A′ℓ ∩ Ri) ≤ gi(Aℓ ∩ Ri) − uiℓ. Proof. Consider an index i ∈ J. Then Ri\{(i, i)} ⊆ A′1. It follows that, for each ℓ /∈ {i, 1}, A′ℓ∩ Ri = ∅ and gi(A′ℓ ∩ Ri) = φ(A′ℓ ∩ Ri) = 0. Consider an index i ∈ ¯J and an index ℓ /∈ {i, 1}. Since i ∈ ¯J, we have ui < k − γ/2. Note that at most one element of Aℓ ∩ Ri is happy and thus Aℓ ∩ Ri ≤ uiℓ + 1 ≤ k − γ/2. Moreover, A′ℓ ∩ Ri = Aℓ ∩ Ri − uiℓ ≤ 1. Thus gi(Aℓ ∩ Ri) = φ(Aℓ ∩ Ri) = Aℓ ∩ Ri and gi(A′ℓ ∩ Ri) = φ(A′ℓ ∩ Ri) = A′ℓ ∩ Ri = Aℓ ∩ Ri − uiℓ. Corollary A.9. We have Xi∈J−{1}Xℓ6=i gi(A′ℓ ∩ Ri) ≤ Xi∈J−{1}Xℓ6=i gi(Aℓ ∩ Ri) − Xi∈J−{1} ni + k. Proof. By the preceding claims, we have gi(Aℓ ∩ Ri) − Xi∈J−{1} ni + k Xi∈J−{1} Xi∈J−{1} Xℓ /∈{i,1} Xi∈J−{1}Xℓ6=i gi(A′1 ∩ Ri) ≤ Xi∈J−{1}Xℓ6=i gi(A′ℓ ∩ Ri) = 0 gi(A′ℓ ∩ Ri) = Xi∈J−{1} gi(A′1 ∩ Ri) + Xi∈J−{1} Xℓ /∈{i,1} gi(Aℓ ∩ Ri) − Xi∈J−{1} ≤ Xi∈J−{1}Xℓ6=i gi(A′ℓ ∩ Ri) ni + k. 32 Corollary A.10. We have Xi∈ ¯J−{1}Xℓ6=i gi(A′ℓ ∩ Ri) ≤ Xi∈ ¯J−{1}Xℓ6=i gi(Aℓ ∩ Ri) + Xi∈I∩( ¯J−{1}) ni. Proof. We have Xi∈ ¯J−{1} Xi∈ ¯J−{1} Xℓ /∈{i,1} Xi∈ ¯J−{1}Xℓ6=i gi(A′ℓ ∩ Ri) = Xi∈ ¯J−{1} gi(A1 ∩ Ri) + Xi∈ ¯J−{1} (ui − ui1) + Xi∈I∩( ¯J−{1}) ni gi(A′1 ∩ Ri) ≤ Xi∈ ¯J−{1} gi(A′ℓ ∩ Ri) ≤ Xi∈ ¯J−{1} Xℓ /∈{i,1} = Xi∈ ¯J−{1} Xℓ /∈{i,1} uiℓ gi(Aℓ ∩ Ri) − Xi∈ ¯J−{1} Xℓ /∈{i,1} gi(Aℓ ∩ Ri) − Xi∈ ¯J−{1} gi(A′1 ∩ Ri) + Xi∈ ¯J−{1} Xℓ /∈{i,1} gi(Aℓ ∩ Ri) + Xi∈I∩( ¯J−{1}) ni. (ui − ui1) gi(A′ℓ ∩ Ri) = Xi∈ ¯J−{1}Xℓ6=i Claim A.11. We have g1(A′ℓ ∩ R1) ≤ k. Xℓ6=1 Proof. Consider an ℓ 6= 1. Note that we may assume that 1 /∈ J, since otherwise A′ℓ ∩ R1 = ∅ and g1(A′ℓ ∩ R1) = φ(A′ℓ ∩ R1) = 0. Since at most one element of Aℓ ∩ R1 is happy and we reassigned all unhappy elements of R1 to terminal 1, we have A′ℓ ∩ R1 ≤ 1 and thus g1(A′ℓ ∩ R1) = φ(A′ℓ ∩ R1) ≤ 1. By symmetry, the cost over columns is the same as the cost over rows. It follows that the cost C′ of the resulting assignment satisfies k k k gi(A′ℓ ∩ Ri) C′ = f (A′ℓ) = 2 k Xℓ=1 = 2 Xi=1  ≤ 2 Xi=1  ≤ 2 k Xi=1 k Xi=1 Xℓ=1 gi(A′i ∩ Ri) +Xℓ6=1 Xℓ=1 Xℓ=1 gi(Aℓ ∩ Ri) −Xi∈I gi(Aℓ ∩ Ri) + 3k! k k = C + 6k. g1(A′ℓ ∩ R1) + Xi∈J−{1}Xℓ6=i gi(A′ℓ ∩ Ri) + Xi∈ ¯J−{1}Xℓ6=i ni − Xi∈J−{1} ni + Xi∈I∩( ¯J−{1}) ni + 3k  gi(A′ℓ ∩ Ri)  33 A.1.2 Proof of Lemma A.4 Consider a nice symmetric assignment. We define a coloring of the complete graph Kk as follows. Vertex i represent terminal (i, i) and the edge (i, j) represents the pair (i, j), where i 6= j. We use the symmetric assignment to define a coloring of the edges of Kk: Consider a pair (i, j) where i 6= j, and suppose (i, j) is assigned to terminal ℓ; we assign color ℓ to the edge (i, j) of Kk. (Since the assignment is symmetric, (i, j) and (j, i) are both assigned to the same terminal.) Let Eℓ denote the set of all edges of Kk that have color ℓ, and let Ni denote the set of all edges incident to vertex i. We say that an edge (i, j) is unhappy if the element (i, j) is unhappy. Let µ denote the number of unhappy edges. We partition [k] into L and ¯L = [k] − L, where L is the set of all vertices i such that Ei ∩ Ni < γ/2 − 1. Note that since the assignment is nice, we actually have Ei ∩ Ni = 0 in this case. Note that vertices i ∈ L are "lonely", i.e., none of the edges incident to i have color i. Moreover, 1 /∈ L, since vertex 1 is incident to at least γ/2 − 1 edges of color 1. We further partition L into L1 and L2 = L− L1, where L1 is the set of all vertices i ∈ L such that all the edges incident to i have color 1. Let a = L1, b = L2, and c = ¯L = k − a − b. Let C be the cost of the assignment. Recall that µ is the number of unhappy edges. Claim A.12. We have C ≥ 2k(k − 2) − 2(2a + b)γ + 4(a + b) + 4µ. Proof. Let Aℓ denote the set of all elements that are assigned to terminal ℓ. Let Ri (resp. Ci) denote the i-th row (resp. the i-th column). Note that, since the assignment is symmetric, gi(Aℓ∩Ri) = gi(Aℓ∩Ci). Therefore k k k 1 2 k k C 2 = = = f (Aℓ) = gi(Aℓ ∩ Ri) Xi=1 Xℓ=1 Xℓ=1 gi(Ai ∩ Ri) +Xℓ6=i Xi=1 gi(Aℓ ∩ Ri) Xi=1 φ(k − 1 − Ei ∩ Ni) + Xi=1Xℓ6=i k φ(Eℓ ∩ Ni). We consider the two sums separately. k Xi=1 φ(k − 1 − Ei ∩ Ni) =Xi∈L φ(k − 1 − Ei ∩ Ni) +Xi∈ ¯L φ(k − 1 − Ei ∩ Ni). For each i ∈ L, Ei ∩ Ni = 0 and thus φ(k − 1−Ei ∩ Ni) = φ(k − 1). For each i ∈ ¯L, Ei ∩ Ni ≥ γ/2 and thus φ(k − 1 − Ei ∩ Ni) = k − 1 − Ei ∩ Ni. Thus k Xi=1 φ(k − 1 − Ei ∩ Ni) = φ(k − 1)L + (k − 1) ¯L −Xi∈ ¯L = k(k − 1) − (γ − 2)(a + b) −Xi∈ ¯L Ei ∩ Ni Ei ∩ Ni. Now consider the second sum. Consider an index i ∈ L1 and an index ℓ 6= i. Aℓ ∩ Ni = k − 1 and, if ℓ 6= 1, we have have Aℓ ∩ Ni = 0. Since 1 /∈ L1, we have If ℓ = 1, we have Xi∈L1Xℓ6=i φ(Eℓ ∩ Ni) = Xi∈L1 φ(E1 ∩ Ni) = φ(k − 1)L1. 34 Therefore we have k Xi=1Xℓ6=i φ(Eℓ ∩ Ni) = Xi∈L1Xℓ6=i φ(Eℓ ∩ Ni) + Xi∈L2Xℓ6=i φ(Eℓ ∩ Ni) +Xi∈LXℓ6=i Eℓ ∩ Ni φ(Eℓ ∩ Ni) = φ(k − 1)L1 + Xi∈L2Xℓ6=i = (k + 1 − γ)a + Xi∈L2Xℓ6=i φ(Eℓ ∩ Ni) +Xi∈ ¯LXℓ6=i φ(Eℓ ∩ Ni) +Xi∈ ¯LXℓ6=i Eℓ ∩ Ni. Consider an index i ∈ L2 \ {1}. If there exists an ℓ 6= i such that Eℓ ∩ Ni > k − γ/2, at least k − γ/2 edges incident to i are unhappy and therefore all of the edges incident to i have color 1. But i has at least γ/2 edges incident to it that have color i and therefore Eℓ ∩ Ni ≤ k − γ/2 for all ℓ 6= i. Thus, for each i ∈ L2 \ {1}, we have Xℓ6=i φ(Eℓ ∩ Ni) =Xℓ6=i Eℓ ∩ Ni. Therefore k Xi=1Xℓ6=i φ(Eℓ ∩ Ni) ≥ (k + 1 − γ)a − k + Xi∈L2∪ ¯LXℓ6=i Eℓ ∩ Ni. By combining the inequalities derived so far, it follows that C 2 ≥ k(k − 1) + k(a − 1) − (2a + b)γ + 3a + 2b −Xi∈ ¯L Ei ∩ Ni + Xi∈L2∪ ¯LXℓ6=i Eℓ ∩ Ni. C Recall that, for each i ∈ L1, all of the edges incident to i have color one. ThusPi∈L1Pℓ6=i Eℓ ∩ Ni = Pi∈L1 E1 ∩ Ni = (k − 1)a, and therefore k Ei ∩ Ni + In fact, the sum of ¯L can be replaced by a sum over all i, because vertices in L do not have any edge of 2 ≥ k(k − 2) − (2a + b)γ + 2(a + b) −Xi∈ ¯L Xi=1Xℓ6=i color i incident to them. Each unhappy edge contributes 2 to the sum Pk happy edge contributes 1 to the sum Pk 0 to the sum Pk that the number of unhappy edges is µ. Thus we have i=1Pℓ6=i Eℓ ∩ Ni, and each i=1Pℓ6=i Eℓ ∩ Ni. Moreover, each unhappy edge contributes i=1 Ei ∩ Ni. Recall Eℓ ∩ Ni. i=1 Ei ∩ Ni, and each happy edge contributes 1 to the sum Pk Xi=1Xℓ6=i Eℓ ∩ Ni −Xi∈ ¯L Xi=1Xℓ6=i Ei ∩ Ni = Eℓ ∩ Ni − Xi=1 k Ei ∩ Ni = 2µ. k k Therefore C 2 ≥ k(k − 2) − (2a + b)γ + 2(a + b) + 2µ. Claim A.13. The number of unhappy edges µ satisfies (a + b)(a + b − 1) 2 µ ≥ + a(k − a − b − 1). 35 Proof. For each vertex i ∈ L, there are no edges incident to L that have color i. Therefore all edges with both endpoints in i are unhappy; there are (a + b)(a + b − 1)/2 such edges. Additionally, the edges incident to a vertex in L1 have color 1. Therefore all edges (i, j) such that i ∈ L1 and j ∈ ¯L and j 6= 1 are also unhappy; there are at least a(c − 1) = a(k − a − b − 1) such edges. Proof of Lemma A.4. It follows from the previous claims that the total cost C satisfies C ≥ 2k(k − 2) + 2a(2k − 2γ − a − 2) + 2b(b − γ). Let h(a, b) = 2k(k − 2) + 2a(2k − 2γ − a − 2) + 2b(b − γ). The function h(a, b) is concave in a and therefore it is minimized when a = 0 or a = k. Consider the case a = 0. By taking the derivative of h(0, b) with respect to b and setting it to zero, we see that h(0, b) is minimized when b = γ/2. Consider the case a = k. Since a + b ≤ k, we have b = 0. Thus C ≥ min{h(0, γ/2), h(k, 0)}. We choose γ = 2⌊2k − √3k2 − 2k⌋ which makes the two expressions equal (up to the rounding of γ). This implies C ≥ (8√3 − 12)k2 − O(k). A.2 From oracle hardness to computational hardness Here we explain how the hardness results in the value oracle model (the first parts of Theorem 3.1 and 3.5) imply the analogous computational hardness results in these theorems. The key technique here is the use of list-decodable codes for the encoding of a "hidden partition", as introduced in [8]. The technique, although presented in [8] for submodular maximization problems, applies practically without any change to submodular minimization as well. For concreteness, let us summarize how this technique applies to the Sub-MP problem: We generate instances on a ground set X = N × V , where V = [k] × [k] is the ground set of our initial symmetric instance. The goal is to present an objective function f : 2X → R+ in a form that makes it difficult to distinguish the elements in sets N ×{(i, j)} from elements in N ×{(j, i)}, for any fixed i, j. More precisely, we construct a partition of N × V into sets {Aij : (i, j) ∈ [k]× [k]} such that it is hard to distinguish the elements in Aij from the elements in Aji. We accomplish this by way of a list-decodable code as follows (the construction is simplified for this particular case): We consider a Unique-SAT instance φ with m variables, and an encoding function 2). The satisfying assignment x∗ of φ (if it exists) implicitly defines a partition E : {0, 1}m → {0, 1}N×(k of N × [k] × [k] into subsets {Aij : (i, j) ∈ [k] × [k]}, by specifying that for i < j, Aij = {(a, i, j) ∈ N × [k] × [k] : (E(x∗))a,{i,j} = 0} ∪ {(a, j, i) ∈ N × [k] × [k] : (E(x∗))a,{i,j} = 1}. In other words, the string E(x∗) tells us which pairs of elements (a, i, j), (a, j, i) should be swapped, to obtain the sets Aij from the sets N × {(i, j)}. In particular, if E(x∗) is the all-zeros string, then Aij = N × {(i, j)}. For i = j, we define Aii = N × {(i, i)} in every case. The encoding of an objective function for Sub-MP then consists purely of the Unique-SAT instance φ, which is interpreted as follows. If φ is satisfiable, it induces the sets Aij as above, and the objective function is understood to be f (S) = F (ξ), where ξij = S∩Aij and F is the smooth submodular Aij function we described in Section 3. If φ is not satisfiable, then the objective function is understood to be f (S) = G(ξ), with the same notation as in Section 3. We know that the gap between the optima in these two cases can be made arbitrarily close to 2 − 2/k, and if we could distinguish the two cases, 36 we could determine whether a Unique-SAT instance has 0 or 1 satisfying assignments, which would imply N P = RP . xa −Pa∈Aji The question, however, is whether this is a legitimate encoding of the objective function, in the sense that given the encoding φ and a set S, the value of f (S) can be computed efficiently. The main insight of [8] is that list-decodable codes allow us to evaluate such functions efficiently. The reason for this is that the functions F (x), G(x) are constructed in such a way (going back to [24], see Lemma 3.2) that their value depends on the hidden partition Aij only if x is significantly unbalanced, meaning that Pa∈Aij xa > βn for some i, j ∈ [k] and constant β > 0. Equivalently, this means that to evaluate f (S) and g(S), we need to determine the hidden partition only if S ∩ Aij − S ∩ Aji > βn for some i, j ∈ [k]. Fortunately, there are known list-decodable codes that allow us to determine the satisfying assignment x∗ and the induced partition {Aij : i, j ∈ [k]}, given any such set S (because it corresponds to a corrupted message which is relatively close to the codeword E(x∗)). To summarize, for a given set S, we are either able to determine x∗ and the induced partition {Aij : i, j ∈ [k]}, in which case we are obviously able to evaluate f (S) or g(S); or we conclude that S does not satisfy S ∩ Aij − S ∩ Aji > βn for any i, j ∈ [k], and in this case we do not need to know the partition {Aij : i, j ∈ [k]} because f (S) = g(S) and g does not depend on the partition of Aij ∪ Aji into Aij and Aji. This concludes the proof that we presented a legitimate encoding of the objective function. For further details on this technique to convert oracle hardness results into computational hardness, we refer the reader to [8]. 37
1012.2547
1
1012
2010-12-12T14:47:00
The Exact String Matching Problem: a Comprehensive Experimental Evaluation
[ "cs.DS" ]
This paper addresses the online exact string matching problem which consists in finding all occurrences of a given pattern p in a text t. It is an extensively studied problem in computer science, mainly due to its direct applications to such diverse areas as text, image and signal processing, speech analysis and recognition, data compression, information retrieval, computational biology and chemistry. Since 1970 more than 80 string matching algorithms have been proposed, and more than 50% of them in the last ten years. In this note we present a comprehensive list of all string matching algorithms and present experimental results in order to compare them from a practical point of view. From our experimental evaluation it turns out that the performance of the algorithms are quite different for different alphabet sizes and pattern length.
cs.DS
cs
The Exact String Matching Problem: a Comprehensive Experimental Evaluation Simone Faro† and Thierry Lecroq‡ †Universit`a degli Studi di Catania, Dipartimento di Matematica e Informatica Viale Andrea Doria 6, I-95125, Catania, Italy [email protected] ‡Universit´e de Rouen, LITIS EA 4108, 76821 Mont-Saint-Aignan Cedex, France [email protected] Abstract. This paper addresses the online exact string matching prob- lem which consists in finding al l occurrences of a given pattern p in a text t. It is an extensively studied problem in computer science, mainly due to its direct applications to such diverse areas as text, image and signal pro- cessing, speech analysis and recognition, data compression, information retrieval, computational biology and chemistry. Since 1970 more than 80 string matching algorithms have been proposed, and more than 50% of them in the last ten years. In this note we present a comprehensive list of all string matching algorithms and present experimental results in order to compare them from a practical point of view. ¿From our experimental evaluation it turns out that the performance of the algorithms are quite different for different alphabet sizes and pattern length. 1 Introduction Given a text t of length n and a pattern p of length m over some alphabet Σ of size σ , the string matching problem consists in finding al l occurrences of the pattern p in the text t. It is an extensively studied problem in computer science, mainly due to its direct applications to such diverse areas as text, image and signal processing, speech analysis and recognition, data compression, information retrieval, computational biology and chemistry. String matching algorithms are also basic components used in implementa- tions of practical softwares existing under most operating systems. Moreover, they emphasize programming methods that serve as paradigms in other fields of computer science. Finally they also play an important role in theoretical com- puter science by providing challenging problems. Applications require two kinds of solutions depending on which string, the pattern or the text, is given first. Algorithms based on the use of automata or combinatorial properties of strings are commonly implemented to preprocess the pattern and solve the first kind of problem. This kind of problem is generally referred as online string matching. The notion of indexes realized by trees or automata is used instead in the second kind of problem, generally referred as offline string matching. In this paper we are only interested in algorithms of the first kind. The worst case lower bound of the online string matching problem is O(n) and has been firstly reached by the well known Morris-Pratt algorithm [MP70]. An average lower bound in O(n log m/m) (with equiprobability and independence of letters) has been proved by Yao in [Yao79]. More than 80 online string matching algorithms (hereafter simply string matching algorithms) have been proposed over the years. All solutions can be 2 Simone Faro and Thierry Lecroq Algorithms based on characters comparison BF MP KMP BM HOR GS AG KR ZT OM MS QS AC TW TunBM COL SMITH GG RAITA SMOA NSN TBM RCOL SKIP ASKIP KMPS BR AKC FS FFS BFS TS SSABS TVSBS PBMH FJS 2BLOCK HASHq TSW BMHq GRASPm SSEF Brute-Force Morris-Pratt Knuth-Morris-Pratt Boyer-Moore Horspool Galil-Seiferas Apostolico-Giancarlo Karp-Rabin Zhu-Takaoka Optimal-Mismatch Maximal-Shift Quick-Search Apostolico-Crochemore Two-Way Tuned-Boyer-Moore Colussi Smith Galil-Giancarlo Raita String-Matching on Ordered ALphabet Not-So-Naive Turbo-Boyer-Moore Reverse-Colussi Skip-Search Alpha-Skip-Search KMP-Skip-Search Berry-Ravindran Ahmed-Kaykobad-Chowdhury Fast-Search Forward-Fast-Search Backward-Fast-Search, Fast-Boyer-Moore Tailed-Substring Sheik-Sumit-Anindya-Balakrishnan-Sekar Thathoo-Virmani-Sai-Balakrishnan-Sekar Boyer-Moore-Horspool using Probabilities Franek-Jennings-Smyth 2-Block Boyer-Moore Wu-Manber for Single Pattern Matching Two-Sliding-Window Boyer-Moore-Horspool with q-grams Genomic Rapid Algo for String Pm SSEF [CLRS01] [MP70] [KMP77] [BM77] [Hor80] [GS83] [AG86] [KR87] [ZT87] [Sun90] [Sun90] [Sun90] [AC91] [CP91] [HS91] [Col91] [Smi91] [GG92] [Rai92] [Cro92] [Han93] [CCG+ 94] [Col94] [CLP98] [CLP98] [CLP98] [BR99] [AKC03] [CF03] [CF05] [CF05,CL08] [CF04] [SAP+ 04] [TVL+ 06] [Neb06] [FJS07] [SM07] [Lec07] [HAKS+ 08] [KPT08] [DC09] [Kul09] 1970 1977 1977 1980 1983 1986 1987 1987 1990 1990 1990 1991 1991 1991 1991 1991 1992 1992 1992 1993 1994 1994 1998 1998 1998 1999 2003 2003 2004 2004 2004 2004 2006 2006 2007 2007 2007 2008 2008 2009 2009 Fig. 1. The list of all comparison based string matching algorithms (1970-2010). Algorithms based on automata DFA RF SIM TRF FDM BDM BOM DFDM WW LDM ILDM1 ILDM2 EBOM FBOM SEBOM SFBOM SBDM Deterministic-Finite-Automaton Reverse-Factor Simon Turbo-Reverse-Factor Forward-DAWG-Matching Backward-DAWG-Matching Backward-Oracle-Matching Double Forward DAWG Matching Wide Window Linear DAWG Matching Improved Linear DAWG Matching Improved Linear DAWG Matching 2 Extended Backward Oracle Matching Forward Backward Oracle Matching Simplified Extended Backward Oracle Matching Simplified Forward Backward Oracle Matching Succint Backward DAWG Matching [CLRS01] [Lec92] [Sim93] [CCG+ 94] [CR94] [CR94] [ACR99] [AR00] [HFS05] [HFS05] [LWLL06] [LWLL06] [FL08] [FL08] [FYM09] [FYM09] [Fre09] 1992 1993 1994 1994 1994 1999 2000 2005 2005 2006 2006 2009 2009 2009 2009 2009 Fig. 2. The list of the automata based string matching algorithms (1992-2009). Exact String Matching: a Comprehensive Experimental Evaluation 3 Algorithms based on bit-parallelism SO SA BNDM BNDM-L SBNDM TNDM LBNDM SVM BNDM2 SBNDM2 BNDM-BMH BMH-BNDM FNDM BWW FAOSO AOSO BLIM FSBNDM BNDMq SBNDMq UFNDMq SABP BP2WW BPWW2 KBNDM KSA Shift-Or Shift-And Backward-Nondeterministic-DAWG-Matching BNDM for Long patterns Simplified BNDM Two-Way Nondeterministic DAWG Matching Long patterns BNDM Shift Vector Matching BNDM with loop-unrolling Simplified BNDM with loop-unrolling BNDM with Horspool Shift Horspool with BNDM test Forward Nondeterministic DAWG Matching Bit parallel Wide Window Fast Average Optimal Shift-Or Average Optimal Shift-Or Bit-Parallel Length Invariant Matcher Forward SBNDM BNDM with q-grams Simplified BNDM with q-grams Shift-Or with q-grams Small Alphabet Bit-Parallel Bit-Parallel2 Wide-Window Bit-Parallel Wide-Window2 Factorized BNDM Factorized Shift-And [BYR92] [BYR92] [NR98a] [NR00] [PT03,Nav01] [PT03] [PT03] [PT03] [HD05] [HD05] [HD05] [HD05] [HD05] [HFS05] [FG05] [FG05] [Kul08] [FL08] [DHPT09] [DHPT09] [DHPT09] [ZZMY09] [CFG10a] [CFG10a] [CFG10b] [CFG10b] 1992 1992 1998 2000 2003 2003 2003 2003 2005 2005 2005 2005 2005 2005 2005 2005 2008 2009 2009 2009 2009 2009 2010 2010 2010 2010 Fig. 3. The list of all bit-parallel string matching algorithms (1992-2010). divided into two classes: algorithms which solve the problem by making use only of comparisons between characters, and algorithms which make use of automata in order to locate all occurrences of the searched string. The latter class can be further divided into two classes: algorithms which make use of deterministic automata and algorithms based on bit-parallelism which simulate the behavior of non-deterministic automata. Fig. 1, Fig. 2 and Fig. 3 present the list of all string matching algorithms based on comparison of characters, deterministic automata and bit-parallelism, respectively. The class of algorithms based on comparison of characters is the wider class and consists of almost 50 per cent of all solutions. Among the comparison based string matching algorithms the Boyer-Moore algorithm [BM77] deserves a special mention, since it has been particularly successful and has inspired much work. Also automata play a very important role in the design of efficient string matching algorithms. The first linear algorithm based on deterministic automata is the Automaton Matcher [CLRS01]. Over the years automata based solutions have been also developed to de- sign algorithms which have optimal sublinear performance on average. This is done by using factor automata [BBE+83,Cro85,BBE+85,ACR99], data struc- tures which identify all factors of a word. Among the algorithms which make use of a factor automaton the BDM [CR94] and the Backward-Oracle-Matching algorithm [ACR99] are among the most efficient solutions, especially for long patterns. In recent years, most of the work has been devoted to develop software tech- niques to simulate efficiently the parallel computation of non-deterministic finite automata related to the search pattern. Such simulations can be done efficiently using the bit-parallelism technique [BYG92], which consists in exploiting the in- trinsic parallelism of the bit operations inside a computer word. In some cases, bit-parallelism allows to reduce the overall number of operations up to a factor 4 Simone Faro and Thierry Lecroq Comparison based Automata based Bit parallelism 14 12 10 8 6 4 2 0 1 9 9 0 1 9 9 1 1 9 9 2 1 9 9 3 1 9 9 4 1 9 9 5 1 9 9 6 1 9 9 7 1 9 9 8 1 9 9 9 2 0 0 0 2 0 0 1 2 0 0 2 2 0 0 3 2 0 0 4 2 0 0 5 2 0 0 6 2 0 0 7 2 0 0 8 2 0 0 9 2 0 1 0 Fig. 4. Number of algorithms proposed in the last 21 years (1990-2010) equal to the number of bits in a computer word. Thus, although string matching algorithms based on bit-parallelism are usually simple and have very low memory requirements, they generally work well with patterns of moderate length only. The bit-parallelism technique has been used to simulate efficiently the non- deterministic version of the Morris-Pratt automaton. The resulting algorithm, named Shift-Or [BYG92], runs in O(n⌈m/w⌉), where w is the number of bits in a computer word. Later, a variant of the Shift-Or algorithm, called Shift-And, and a very fast BDM-like algorithm (BNDM), based on the bit-parallel simulation of the non-deterministic suffix automaton, were presented in [NR98b]. Bit-parallelism encoding requires one bit per pattern symbol, for a total of ⌈m/w⌉ computer words. Thus, as long as a pattern fits in a computer word, bit-parallel algorithms are extremely fast, otherwise their performance degrades considerably as ⌈m/w⌉ grows. Though there are a few techniques to maintain good performance in the case of long patterns, such limitation is intrinsic. Fig. 4 presents a plot of the number of algorithms (for each class) proposed in the last 21 years (1990-2010). Observe that the number of proposed solutions have doubled in the last ten years, demonstrating the increasing interest in this issue. It is interesting to observe also that almost 50 per cent of solutions in the last ten years are based on bit-parallelism. Moreover it seems that the number of bit-parallel solutions proposed in the years follows an increasing trend. In the rest of the paper we present a comprehensive experimental evaluation of all string matching algorithms listed above in order to compare them from a practical point of view. Exact String Matching: a Comprehensive Experimental Evaluation 5 2 Experimental Results We present next experimental data which allow to compare in terms of running time all the algorithms listed in Fig. 1, Fig. 2 and Fig. 3. In particular we tested the Hashq algorithm with q equal to 3, 5 and 8. The AOSO and BNDMq algorithms have been tested with a value of q equal to 2, 4 and 6. Finally the SBNDMq and UFNDMq have been tested with q equal to 2, 4, 6 and 8. All algorithms have been implemented in the C programming language and were used to search for the same strings in large fixed text buffers on a PC with Intel Core2 processor of 1.66GHz and running times have been measured with a hardware cycle counter, available on modern CPUs. The codes have been compiled with the GNU C Compiler, using the optimization options -O2 -fno- guess-branch-probability. In particular, the algorithms have been tested on the following 12 text buffers: (i) eight Randσ text buffers, for σ = 2, 4, 8, 16, 32, 64, 128 and 256, where each Randσ text buffer consists in a 5Mb random text over a common alphabet of size σ , with a uniform distribution of characters; (ii) a genome sequence of 4, 638, 690 base pairs of Escherichia coli (with σ = 4); (iii) a protein sequence (the hs file) from the Saccharomyces cerevisiae genome, of length 3, 295, 751 byte (with σ = 20); (iv) the English King James version of the Bible composed of 4, 047, 392 char- acters (with σ = 63); (v) the file world192.txt (The CIA World Fact Book) composed of 2, 473, 400 characters (with σ = 94); Files (ii), (iv) and (v) are from the Large Canterbury Corpus (http://www.data- compression.info/Corpora/CanterburyCorpus/), while file (iii) is from the Protein Corpus (http://data-compression.info/Corpora/ProteinCorpus/). For each input file, we have generated sets of 400 patterns of fixed length m randomly extracted from the text, for m ranging over the values 2, 4, 8, 16, 32, 64, 128, 256, 512 and 1024. For each set of patterns we reported in a table the mean over the running times of the 400 runs. Running times are expressed in thousandths of seconds. Moreover we color each running time value with different shades of blue-red. In particular better results are presented in tones verging to red while worse results are presented in tones verging to blue. In addition best results are high- lighted with a light gray background. Although we tested more than 85 different algorithms, for the sake of clear- ness we include in the following tables only the algorithms that obtain, for each text buffer and each pattern length, the 25 best results. We add a red marker to comparison based algorithms, while a green and a blue marker is added to automata and bit parallel algorithms, respectively. Then, for each table, we briefly discuss the performance of the string matching algorithms by referring to the following four classes of patterns: – very short patterns (pattern with m ≤ 4); – short patterns (pattern with 4 < m ≤ 32); – long patterns (pattern with 32 < m ≤ 256); – very long patterns (pattern with m > 256); Finally we discuss the overall performance of the tested algorithms by considering those algorithms which maintain good performance for all classes of patterns. 6 Simone Faro and Thierry Lecroq 2.1 Experimental Results on Rand2 Problem In this section we present experimental results on a random text buffer over a binary alphabet. Matching binary data is an interesting problem in computer sci- ence, since binary data are omnipresent in telecom and computer network appli- cations. Many formats for data exchange between nodes in distributed computer systems as well as most network protocols use binary representations. m •BF •KR •QS •NSN •Smith •RCol •ASkip •BR •FS •FFS •BFS •TS •SSABS •TVSBS •FJS •HASH3 •HASH5 2 44.6 48.2 38.7 37.4 46.8 44.5 77.3 35.2 44.5 39.6 43.6 37.5 32.1 29.8 39.7 - - •HASH8 •SSEF •AUT •RF •BOM •BOM2 •WW •ILDM1 •ILDM2 •EBOM •FBOM •SEBOM •SFBOM •SO - - 21.7 68.3 94.1 84.7 70.0 40.5 54.7 41.1 55.6 41.4 52.0 16.4 16.4 •SA 63.5 •BNDM 63.4 •BNDM-L 56.1 •SBNDM 52.5 •SBNDM2 •SBNDM-BMH 46.6 150 •FAOSOq2 167 - 56.6 51.8 - - 51.1 - - - 56.8 57.6 58.5 •AOSO2 •AOSO4 •FSBNDM •BNDMq2 •BNDMq4 •BNDMq6 •SBNDMq2 •SBNDMq4 •SBNDMq6 •SBNDMq8 •UFNDMq4 •UFNDMq6 •UFNDMq8 4 46.4 24.7 41.2 43.1 41.2 37.5 53.2 35.6 37.2 33.9 37.0 34.1 37.8 34.3 42.9 28.2 - - - 21.7 50.8 74.3 61.1 53.0 31.1 38.9 37.2 43.8 37.0 40.5 16.4 16.4 47.9 46.6 38.1 35.8 37.6 104 36.7 147 37.7 35.8 53.0 - 35.0 49.7 - - 31.9 35.5 38.7 8 52.4 16.9 44.0 43.2 39.8 28.4 28.5 34.6 28.4 25.2 29.1 27.5 43.4 36.9 50.2 14.0 14.4 - - 21.7 31.6 47.4 34.7 35.1 23.9 23.6 25.8 28.3 25.3 26.2 16.4 16.4 25.6 25.3 23.4 21.0 23.6 39.7 11.5 90.9 20.0 21.1 18.4 26.3 20.8 17.9 29.4 97.0 22.2 17.9 18.4 16 52.6 16.4 45.3 43.4 39.2 20.4 15.2 33.4 20.1 16.4 20.5 22.9 46.0 36.1 49.4 9.78 6.05 7.67 - 21.7 16.9 28.9 17.9 19.9 16.9 12.8 14.4 15.9 14.6 14.8 16.4 16.4 12.6 12.5 11.8 10.9 11.8 12.5 9.66 32.1 10.2 11.4 9.49 9.13 10.9 9.79 9.80 11.9 13.4 10.7 10.1 32 52.5 16.4 44.4 43.4 40.2 15.2 8.27 33.4 15.4 11.6 15.5 19.3 43.8 34.9 49.1 8.64 3.72 3.47 5.38 21.7 9.48 17.1 9.51 11.8 11.2 7.42 8.06 8.71 8.17 8.24 16.4 16.4 6.48 6.40 6.17 5.93 6.13 9.97 8.54 6.92 5.69 6.45 5.10 5.08 5.73 5.49 5.25 5.02 8.58 7.57 7.12 64 52.5 16.4 45.2 43.3 39.7 11.9 4.89 32.6 12.0 8.41 12.2 17.1 44.7 36.6 50.2 8.71 3.07 2.47 3.38 21.8 6.19 9.94 5.30 7.43 7.73 5.20 4.77 5.19 4.89 4.90 21.7 19.1 8.53 13.7 5.92 5.98 5.92 9.97 8.53 6.39 5.69 7.84 6.51 5.11 5.99 5.37 4.86 4.63 8.63 7.55 7.12 128 52.5 16.4 45.5 43.3 39.5 9.80 5.09 32.2 10.0 7.05 10.2 15.5 45.6 35.6 50.6 8.88 3.15 2.87 3.44 21.8 5.89 7.52 4.93 6.90 7.16 5.56 4.61 4.91 4.79 4.75 21.7 19.1 8.52 15.9 5.91 5.98 5.91 9.97 8.55 6.40 5.70 7.83 6.49 5.13 5.99 5.39 4.88 4.63 8.61 7.59 7.14 256 52.5 16.4 45.5 43.3 40.5 8.59 3.74 32.5 8.55 6.13 9.04 13.9 44.5 36.2 50.0 8.71 3.12 1.97 1.79 21.9 4.32 4.14 2.91 5.77 6.09 4.81 2.79 2.95 2.94 2.93 21.8 19.1 8.52 16.3 5.91 5.99 5.91 9.97 8.54 6.39 5.71 7.80 6.50 5.12 5.99 5.37 4.88 4.65 8.58 7.57 7.12 512 52.5 16.4 45.7 43.3 40.3 7.09 3.20 33.3 7.25 5.03 7.88 12.6 44.8 36.3 50.2 8.72 3.12 1.44 0.99 22.6 4.93 2.27 1.87 7.07 7.39 6.46 1.99 2.05 2.07 2.06 21.8 19.1 8.53 16.4 5.91 5.98 5.91 9.96 8.55 6.40 5.70 7.83 6.51 5.14 5.98 5.39 4.86 4.66 8.60 7.56 7.12 1024 52.5 16.4 44.7 43.3 40.0 6.15 3.75 33.0 6.07 4.57 7.44 11.5 46.5 35.5 49.8 8.65 3.12 1.30 0.55 23.9 6.27 1.27 2.70 10.0 10.4 9.90 2.92 2.98 2.98 2.97 21.7 19.1 8.50 17.0 5.90 5.99 5.90 9.98 - 6.40 5.69 7.84 6.49 5.12 6.00 5.38 4.88 4.64 8.57 7.58 7.14 In the case of very short patterns the SO and SA algorithms obtain the best results. The AUT algorithm obtains also good results. For short patterns the al- gorithms based on bit-parallelism achieves good results. The AOSO2 algorithm is the best for patterns of length 8, while HASHq algorithms obtain best results for patterns of length 16 and 32. In the case of long patterns the best results are obtained by the HASHq algorithms and by the SSEF algorithm (for patterns of length 256). For very long patterns the best results are obtained by the SSEF algorithm. Regarding the overall performance no algorithm maintains good per- formances for all patterns. However when the pattern is short the SA algorithm is a good choice while the HASH5 and the SSEF algorithms are suggested for patterns with a length greater than 16. Exact String Matching: a Comprehensive Experimental Evaluation 7 2.2 Experimental Results on Rand4 Problem Matching data over four characters alphabet is an interesting problem in com- puter science mostly related with computational biology. It is the case, for in- stance, of DNA sequences which are constructed over an alphabet of four bases. m •KR •QS •NSN •Raita •RCol •ASkip •BR •FS •FFS •BFS •TS •SSABS •TVSBS 2 29.7 28.8 27.1 29.4 27.5 55.4 24.7 27.5 26.6 27.6 27.4 25.1 22.2 - - - 29.2 - 21.7 49.4 65.7 56.5 43.4 24.0 29.3 24.8 28.9 16.4 16.4 •SA 49.0 •BNDM 49.4 •BNDM-L 49.3 •SBNDM 39.4 •SBNDM2 •SBNDM-BMH 32.6 •BMH-SBNDM 29.4 97.6 •FAOSOq2 - •FAOSOq4 102 •AOSO2 - •AOSO4 - •AOSO6 39.7 •FSBNDM 37.5 •BNDMq2 - - 37.1 - - - 45.2 52.5 52.5 •SBNDMq4 •SBNDMq6 •SBNDMq8 •UFNDMq4 •UFNDMq6 •KBNDM •EBOM •FBOM •SEBOM •SFBOM •SO •HASH3 •HASH5 •HASH8 •TSW •SSEF •AUT •RF •BOM •BOM2 •ILDM2 •BNDMq4 •BNDMq6 •SBNDMq2 4 19.4 21.8 30.2 18.3 18.8 31.9 18.2 18.9 18.3 18.8 22.3 20.9 17.4 21.1 - - 21.6 - 21.7 30.8 44.0 32.3 24.3 14.2 18.1 14.3 18.1 16.4 16.4 27.8 27.8 22.5 18.4 21.1 19.4 37.8 79.7 35.0 84.7 - 21.1 18.4 48.7 - 17.8 46.0 - - 21.8 28.2 28.2 8 16.5 16.6 30.1 13.7 13.7 15.1 12.2 14.0 12.8 12.8 16.1 17.4 12.1 8.30 12.5 - 14.6 - 21.7 17.0 27.7 18.0 13.7 10.2 12.0 10.3 11.7 16.4 16.4 14.7 14.7 12.6 10.8 12.7 12.8 12.3 31.2 11.3 29.6 74.8 11.4 10.8 10.8 24.0 10.7 10.2 27.4 97.0 11.6 14.2 17.1 16 16.4 15.4 29.9 12.9 11.5 7.90 8.30 11.8 9.51 9.88 11.4 16.8 8.67 4.74 5.01 7.62 10.0 - 21.7 9.71 17.6 10.2 8.12 6.94 7.82 7.08 7.57 16.4 16.4 7.91 7.90 7.21 6.34 7.23 8.82 10.6 7.34 9.69 6.71 28.2 6.23 6.28 4.89 7.24 6.23 4.72 8.04 11.4 6.52 7.49 10.5 32 16.3 15.2 30.0 12.8 9.87 4.68 6.31 9.81 7.41 7.68 9.11 16.9 6.90 3.42 2.93 3.45 7.71 5.39 21.7 5.69 11.2 5.77 4.72 4.43 5.06 4.58 4.83 16.4 16.4 4.40 4.40 4.03 3.73 4.05 5.79 9.95 5.35 9.69 5.06 3.96 3.36 3.66 2.86 3.53 3.67 2.87 3.76 4.55 4.07 4.89 6.25 64 16.4 15.4 30.4 13.2 8.56 3.54 5.74 8.62 5.65 6.23 7.78 16.9 6.40 3.07 2.48 2.46 6.89 3.36 21.7 3.69 6.84 3.51 3.29 3.06 3.39 3.23 3.23 21.8 19.1 5.85 7.70 3.84 3.65 3.83 5.74 9.95 5.36 8.54 4.54 3.70 3.38 4.56 3.53 3.22 3.66 2.68 3.22 4.17 4.06 4.87 3.92 128 16.4 15.4 30.0 12.8 7.71 4.34 5.65 7.58 5.04 5.47 6.86 16.8 6.40 3.13 2.85 2.85 6.83 3.43 21.8 3.98 5.79 3.83 3.99 3.55 3.81 3.71 3.68 21.8 19.1 5.88 9.55 3.83 3.66 3.81 5.75 9.95 5.36 8.55 4.55 3.69 3.37 4.56 3.54 3.20 3.66 2.68 3.21 4.17 4.07 4.89 3.92 256 16.4 15.4 29.8 12.6 7.03 3.94 5.68 6.99 4.44 4.94 6.19 16.7 6.30 3.09 2.49 1.96 6.79 1.79 21.9 2.92 3.20 2.24 3.62 2.16 2.28 2.27 2.27 21.7 19.1 5.86 8.82 3.82 3.65 3.82 5.76 9.95 5.36 8.54 4.55 3.70 3.37 4.55 3.54 3.21 3.66 2.69 3.22 4.17 4.06 4.89 3.92 512 16.4 15.2 29.6 12.3 6.04 5.08 5.69 6.15 3.84 4.28 5.75 16.6 6.29 3.10 2.24 1.45 6.85 0.99 22.6 3.21 1.78 1.50 5.03 1.61 1.66 1.67 1.67 21.7 19.1 5.87 8.57 3.81 3.66 3.84 5.78 9.95 5.35 8.54 4.55 3.71 3.37 4.55 3.54 3.21 3.66 2.68 3.22 4.17 4.06 4.90 3.91 1024 16.4 15.4 30.2 12.8 5.51 8.88 5.64 5.54 3.56 4.14 5.28 16.4 6.37 3.08 2.19 1.30 6.85 0.54 23.9 4.83 1.03 2.49 8.65 2.75 2.77 2.79 2.78 21.8 19.1 5.86 8.98 3.82 3.66 3.82 5.81 9.96 5.36 8.55 4.54 3.71 3.37 4.55 3.53 3.22 3.66 2.69 3.22 4.17 4.07 4.89 3.90 In the case of very short patterns the SA and SO algorithms obtain the best results. For short patterns the algorithms based on bit-parallelism achieve bet- ter results, in particular BNDMq4 and SBNDMq4. Other algorithms like HASH5, HASH8, EBOM and SEBOM are quite competitive. In particular the HASH3 al- gorithm obtains the best results for patterns of length 8. In the case of long patterns the best results are obtained by the SSEF algorithm. However the al- gorithm in the EBOM family are good choices. Among the algorithm base on character comparisons the HASH5 and HASH8 algorithms achieve good results. Among the algorithms based on bit-parallelism the SBNDMq4 maintains quite competitive performance. For very long patterns the best results are obtained by the SSEF, HASH8 and BOM algorithms. Finally the algorithms EBOM maintains very good performance for all patterns. 8 Simone Faro and Thierry Lecroq 2.3 Experimental Results on Rand8 Problem In this section we present experimental results on a random text buffer over an alphabet of eight characters. •SSEF •AUT •RF •BOM •BOM2 •ILDM1 •ILDM2 m •KR •ZT •QS •TunBM •NSN •Raita •RCol •BR •FS •FFS •BFS •TS •SSABS 2 22.4 36.0 19.6 22.5 20.5 20.4 18.8 16.8 18.9 18.7 18.9 18.6 16.5 14.9 17.9 - - - 19.3 21.5 - 22.3 34.5 48.6 36.8 30.3 31.9 19.6 •EBOM 17.4 •FBOM 20.6 •SEBOM 17.2 •SFBOM 16.8 •SO 16.4 •SA 37.3 •BNDM 37.1 •BNDM-L 48.2 •SBNDM 29.9 •TNDM 27.0 •TNDMa 39.7 •LBNDM 36.0 •SBNDM2 •SBNDM-BMH 21.9 •BMH-SBNDM 19.4 58.0 •AOSO2 - •AOSO4 - •AOSO6 28.1 •FSBNDM 33.8 •BNDMq2 - •BNDMq4 - •BNDMq6 33.5 •SBNDMq2 - - 42.3 43.7 •TVSBS •FJS •HASH3 •HASH5 •HASH8 •TSW •GRASPm •SBNDMq4 •SBNDMq6 •UFNDMq4 •KBNDM 4 17.8 18.3 13.3 13.1 22.5 11.3 11.1 11.6 11.1 11.2 11.1 15.9 11.6 10.5 12.8 19.1 - - 13.5 12.4 - 22.3 22.0 33.3 23.1 20.1 19.4 8.37 10.4 8.73 10.4 16.8 16.4 22.0 21.9 17.8 19.1 18.2 22.9 13.5 14.0 11.0 15.9 49.7 - 14.2 12.8 48.4 - 12.7 45.8 - 21.1 22.0 8 16.4 9.86 8.91 8.59 22.1 7.38 7.23 7.47 7.25 7.23 7.08 12.2 8.34 6.91 9.36 7.25 12.2 - 8.80 7.94 - 21.7 12.6 22.2 13.2 11.6 10.8 5.04 6.72 5.22 6.77 16.8 16.4 11.6 11.6 8.61 10.9 11.2 12.8 6.98 8.49 6.96 9.79 11.1 44.8 7.85 6.58 10.4 24.0 6.72 9.90 27.4 10.9 12.1 16 16.4 5.84 6.88 6.65 22.1 5.65 5.47 4.75 5.54 5.24 5.15 8.75 6.74 4.50 7.61 3.88 4.79 7.61 5.69 5.84 - 22.3 7.02 15.1 7.16 6.38 5.93 3.70 4.63 3.82 4.68 16.8 16.4 6.10 6.08 5.05 5.89 5.93 7.08 4.30 5.03 5.10 9.72 5.15 9.79 4.71 4.06 4.59 7.22 4.25 4.39 8.03 6.04 7.25 32 16.4 3.79 6.16 6.28 22.1 5.33 4.97 3.24 4.95 4.34 4.30 6.13 6.33 3.23 7.19 2.66 2.71 3.45 3.91 4.76 5.39 22.4 4.31 9.60 4.37 4.01 3.77 3.00 3.45 3.12 3.49 16.8 16.4 3.66 3.67 3.24 3.57 3.47 4.27 3.01 3.21 4.08 9.71 5.05 3.53 2.74 2.84 2.57 3.52 2.97 2.56 3.75 3.53 4.72 64 16.4 2.96 6.14 6.21 22.1 5.25 4.67 2.76 4.62 3.61 3.61 4.84 6.32 2.82 7.13 2.46 2.41 2.46 3.07 3.84 3.36 21.7 2.89 5.98 2.82 2.94 2.83 2.63 2.83 2.76 2.88 21.8 18.9 4.51 5.48 3.09 3.55 3.40 2.95 2.79 3.08 4.22 8.56 4.56 3.31 2.75 3.41 3.16 3.19 2.79 2.46 3.21 3.54 3.10 128 16.4 3.26 6.10 6.12 22.1 5.23 4.50 3.39 4.45 3.61 3.64 4.22 6.28 3.17 6.99 2.75 2.78 2.85 3.84 4.06 3.43 21.8 3.47 5.11 3.40 3.54 3.53 3.13 3.30 3.25 3.33 21.8 18.9 4.51 6.86 3.08 3.55 3.39 4.25 2.79 3.11 4.25 8.58 4.55 3.31 2.74 3.44 3.15 3.19 2.79 2.46 3.22 3.53 3.58 256 16.4 3.02 6.12 6.19 22.1 5.29 4.44 2.97 4.35 3.36 3.44 3.73 6.29 2.96 7.09 2.60 2.06 1.96 3.28 3.35 1.79 21.9 2.59 2.82 1.96 3.29 3.29 1.90 2.01 2.02 2.05 21.7 18.9 4.52 6.33 3.11 3.54 3.39 3.86 2.81 3.08 4.21 8.56 4.57 3.31 2.74 3.45 3.17 3.18 2.79 2.46 3.21 3.53 3.58 512 16.4 2.94 6.17 6.19 22.2 5.18 4.01 2.93 4.00 2.97 3.06 3.48 6.26 2.95 7.14 2.45 1.64 1.45 3.24 2.70 1.00 22.6 2.87 1.60 1.36 4.67 4.65 1.48 1.52 1.56 1.56 21.7 18.9 4.52 5.98 3.10 3.53 3.38 7.02 2.80 3.09 4.19 8.57 4.57 3.30 2.74 3.45 3.16 3.18 2.81 2.45 3.21 3.52 3.59 1024 16.4 2.94 6.26 6.12 22.1 5.17 3.81 2.95 3.79 2.85 3.02 3.33 6.17 2.92 7.15 2.38 1.47 1.30 3.24 2.17 0.55 23.9 4.38 0.94 2.41 8.20 8.21 2.65 2.69 2.72 2.72 21.8 18.9 4.51 6.26 3.09 3.56 3.38 33.7 2.80 3.09 4.18 8.56 4.56 3.30 2.76 3.44 3.16 3.20 2.82 2.46 3.21 3.54 3.58 In the case of very short the best performance is obtained by the TVSBS and SSABS algorithms. Algorithms with very good performance are also FBOM and SFBOM. For short patterns the algorithms based on bit-parallelism achieve good results, in particular BNDMq2, FSBNDM and SBNDM2. However the algorithms in the EBOM family are also good choices. In the case of long patterns the best results are obtained by the EBOM, HASH5 and SBNDMq4 algorithms. For very long patterns the best results are obtained by the SSEF algorithm. For the overall performance we notice that the algorithms int the EBOM family, and the TVSBS and FSBNDM algorithms maintain very good performance for all patterns. Exact String Matching: a Comprehensive Experimental Evaluation 9 2.4 Experimental Results on Rand16 Problem In this section we present experimental results on a random text buffer over an alphabet of 16 characters. •TVSBS •FJS •HASH3 •HASH5 •HASH8 •TSW •GRASPm •SSEF •RF •BOM •BOM2 •ILDM1 •ILDM2 m •KR •ZT •QS •TunBM •NSN •Raita •RCol •BR •FS •FFS •BFS •TS •SSABS 2 19.4 31.6 15.4 17.4 16.8 17.3 15.3 13.3 15.3 15.2 15.4 14.7 12.3 11.6 12.7 - - - 15.2 17.2 - 26.5 40.9 27.7 24.5 25.4 18.6 •EBOM 13.3 •FBOM 19.6 •SEBOM 13.3 •SFBOM 16.8 •SO 16.4 •SA 48.1 •SBNDM 25.0 •TNDM 22.3 •TNDMa 34.0 •LBNDM 18.5 •SVM1 35.2 •SBNDM2 •SBNDM-BMH 16.1 •BMH-SBNDM 15.5 36.6 •FAOSOq2 34.1 •AOSO2 - •AOSO4 23.6 33.3 - 32.6 - •FSBNDM •BNDMq2 •BNDMq4 •SBNDMq2 •SBNDMq4 4 17.1 16.2 9.98 9.59 17.9 9.29 8.47 9.22 8.47 8.54 8.51 13.3 8.25 8.09 8.58 18.3 - - 10.6 9.42 - 16.2 29.0 16.9 15.2 15.2 7.15 8.17 7.57 8.25 16.8 16.4 16.8 14.9 13.6 19.0 13.9 12.5 9.90 8.42 12.4 11.2 28.5 12.1 11.8 48.4 11.7 45.7 8 16.4 8.71 6.38 5.71 17.8 5.59 5.08 5.96 5.08 5.13 5.08 11.1 5.51 5.33 5.75 6.85 12.1 - 6.94 5.57 - 10.3 22.6 10.9 9.65 9.59 3.88 5.10 4.11 5.18 16.8 16.4 7.71 9.34 9.26 11.2 16.4 6.10 6.57 5.00 10.7 9.73 6.57 6.46 5.61 10.4 5.70 9.88 16 16.4 5.10 4.34 3.87 17.8 3.77 3.48 3.83 3.47 3.46 3.43 8.52 3.94 3.51 4.16 3.58 4.72 7.59 4.53 3.72 - 6.11 15.6 6.40 5.59 5.48 2.81 3.41 2.94 3.48 16.8 16.4 4.20 5.32 5.65 6.31 11.9 3.45 4.17 3.35 10.7 9.72 5.09 3.73 3.16 4.57 3.35 4.36 32 16.4 3.22 3.46 3.17 17.9 3.06 2.88 2.76 2.86 2.84 2.79 6.08 3.28 2.74 3.44 2.49 2.65 3.45 3.19 2.99 5.38 3.51 9.65 3.56 3.18 3.15 2.55 2.79 2.68 2.87 16.8 16.4 2.61 2.89 2.88 3.57 9.20 2.55 2.62 2.75 10.2 9.74 5.10 2.38 2.48 2.57 2.50 2.54 64 16.4 2.60 3.22 3.04 17.7 2.91 2.77 2.56 2.77 2.65 2.65 4.21 3.12 2.55 3.26 2.33 2.39 2.46 2.60 2.74 3.37 2.66 5.86 2.60 2.68 2.69 2.44 2.66 2.56 2.74 22.1 19.1 2.60 2.87 2.83 2.62 20.8 2.44 2.59 2.84 10.2 8.52 4.55 2.38 2.68 3.14 2.45 2.44 128 16.4 3.00 3.26 3.06 17.8 2.96 2.80 3.08 2.80 2.90 2.89 3.61 3.14 2.87 3.31 2.69 2.74 2.85 3.60 2.98 3.44 3.28 4.89 3.21 3.38 3.37 2.83 3.20 2.95 3.28 22.1 19.1 2.59 2.88 2.83 3.54 20.8 2.45 2.59 2.84 10.2 8.52 4.57 2.38 2.67 3.14 2.44 2.45 256 16.4 2.05 3.27 3.04 17.9 2.94 2.77 2.08 2.78 2.77 2.77 3.56 3.16 1.96 3.30 2.31 1.84 1.96 2.47 2.65 1.79 2.49 2.75 1.86 3.19 3.18 1.81 1.88 1.93 1.96 22.1 19.1 2.60 2.89 2.82 2.47 20.8 2.45 2.60 2.85 10.2 8.52 4.55 2.39 2.67 3.16 2.44 2.45 512 16.4 1.56 3.28 3.04 17.8 2.93 2.72 1.64 2.72 2.53 2.56 3.56 3.15 1.52 3.28 2.07 1.37 1.44 2.00 1.94 0.99 2.77 1.55 1.29 4.54 4.53 1.42 1.45 1.49 1.50 22.1 19.1 2.60 2.89 2.82 2.53 20.8 2.45 2.59 2.81 10.2 8.53 4.55 2.39 2.68 3.15 2.44 2.44 1024 16.4 1.45 3.24 3.06 17.8 2.96 2.63 1.51 2.65 2.62 2.65 3.60 3.16 1.40 3.30 1.96 1.22 1.29 1.86 1.43 0.55 4.21 0.97 2.38 8.16 8.18 2.68 2.69 2.74 2.73 22.1 19.1 2.60 2.88 2.84 4.08 20.8 2.44 2.60 2.84 10.2 8.52 4.55 2.37 2.70 3.14 2.44 2.44 In the case of very short patterns the best results are obtained by the TVSBS and EBOM algorithms for patterns of length 2 and 4, respectively. For short patterns the algorithms EBOM is the fastest. However it is outperformed by the FSVBNDM algorithm for patterns of length 32. The FSBNDM algorithm is very fast also for long patterns but is outperformed by the HASH3 algorithm and by the SSEF algorithm for patterns of length 64 and 256, respectively. For very long patterns the best results are obtained by the SSEF algorithms. Regarding the overall performance the algorithm TVSBS, the algorithm BR and the algorithms in the EBOM family maintain very good performance for all patterns. 10 Simone Faro and Thierry Lecroq 2.5 Experimental Results on Rand32 Problem In this section we present experimental results on a random text buffer over an alphabet of 32 characters. •TVSBS •FJS •HASH3 •HASH5 •HASH8 •TSW •GRASPm •SSEF •RF •BOM •BOM2 m •BM •KR •ZT •QS •TunBM •NSN •Raita •RCol •Skip •BR •FS •FFS •BFS •TS •SSABS 2 21.1 17.8 29.8 13.5 14.9 15.0 15.9 13.8 23.6 11.8 13.8 13.8 13.8 12.8 10.6 10.2 10.5 - - - 13.6 15.4 - 22.8 37.8 24.0 18.3 •EBOM 11.8 •FBOM 19.4 •SEBOM 11.8 •SFBOM 16.8 •SO 16.4 •SA 48.1 •SBNDM 31.5 •LBNDM 15.9 •SVM1 35.0 •SBNDM2 •SBNDM-BMH 13.6 •BMH-SBNDM 13.9 23.8 •FAOSOq2 - •FAOSOq4 21.9 •AOSO2 - •AOSO4 - •AOSO6 21.9 33.1 - 32.4 - 30.3 19.3 19.1 40.2 •FSBNDM •BNDMq2 •BNDMq4 •SBNDMq2 •SBNDMq4 •UFNDMq2 •DBWW •DBWW2 •KBNDM 4 11.2 16.7 15.4 8.57 8.01 15.7 8.48 7.43 13.4 8.20 7.44 7.52 7.47 12.1 6.92 7.19 6.97 18.1 - - 9.51 8.25 - 13.0 27.4 13.6 6.87 7.41 7.29 7.48 16.8 16.4 16.6 16.9 11.6 12.3 7.81 7.42 11.1 18.1 10.1 16.9 - 11.2 11.5 48.5 11.4 45.7 15.5 11.1 11.1 20.3 8 6.34 16.4 8.29 5.29 4.58 15.7 4.84 4.27 8.19 5.34 4.27 4.33 4.29 11.0 4.43 4.73 4.49 6.68 12.1 - 6.29 4.69 - 8.05 24.6 8.47 3.63 4.61 3.85 4.68 16.8 16.4 7.52 9.64 15.4 5.90 4.92 4.24 10.7 6.12 9.73 5.45 15.1 5.97 5.37 10.5 5.46 9.90 8.19 6.90 6.85 10.6 16 3.88 16.4 4.86 3.43 2.92 15.6 3.07 2.76 5.51 3.50 2.76 2.79 2.75 9.22 3.06 3.17 3.09 3.45 4.72 7.59 4.18 2.95 - 5.29 17.4 5.59 2.67 3.05 2.79 3.14 16.8 16.4 4.00 5.81 11.1 3.27 3.45 2.73 10.7 5.72 9.73 5.09 3.96 3.43 2.94 4.59 3.12 4.37 4.52 4.07 4.03 5.82 32 2.79 16.4 3.08 2.64 2.50 15.6 2.52 2.43 3.80 2.64 2.43 2.44 2.44 7.07 2.58 2.62 2.61 2.45 2.64 3.44 3.05 2.48 5.38 3.36 11.4 3.48 2.49 2.67 2.61 2.74 16.8 16.4 2.45 3.43 8.70 2.45 2.52 2.41 10.2 5.46 9.72 5.08 3.57 2.29 2.40 2.58 2.42 2.53 2.79 4.07 4.03 3.49 64 2.55 16.4 2.55 2.48 2.36 15.5 2.40 2.33 2.85 2.51 2.33 2.35 2.35 4.98 2.46 2.50 2.49 2.30 2.38 2.45 2.55 2.35 3.38 2.57 6.97 2.51 2.41 2.61 2.52 2.67 22.0 19.1 2.61 2.46 20.7 2.39 2.60 2.44 10.2 5.45 8.52 4.55 3.29 2.28 2.47 3.15 2.38 2.44 2.79 4.06 4.03 2.62 128 2.76 16.4 2.87 2.82 2.57 15.7 2.63 2.53 4.78 2.85 2.53 2.64 2.65 4.35 2.66 2.68 2.68 2.63 2.73 2.85 3.36 2.61 3.44 3.07 5.31 3.00 2.72 2.91 2.83 2.98 22.1 19.1 2.61 3.23 20.7 2.40 2.60 2.45 10.2 5.45 8.53 4.55 3.29 2.29 2.48 3.15 2.37 2.45 2.79 4.07 4.04 3.01 256 2.74 16.4 1.67 2.71 2.58 15.7 2.60 2.52 3.44 1.67 2.51 2.62 2.61 3.58 2.64 1.58 2.66 1.92 1.85 1.95 2.06 2.49 1.78 2.42 2.96 1.75 1.71 1.79 1.79 1.89 22.1 19.1 2.61 1.98 20.7 2.39 2.60 2.44 10.2 5.45 8.52 4.55 3.29 2.31 2.48 3.15 2.39 2.45 2.79 4.06 4.04 2.00 512 2.72 16.4 1.07 2.70 2.57 15.7 2.61 2.48 2.58 1.08 2.49 2.47 2.49 3.19 2.65 1.02 2.66 1.55 1.37 1.45 1.40 2.09 1.00 2.62 1.73 1.27 1.38 1.46 1.45 1.51 22.1 19.1 2.60 1.58 20.7 2.39 2.60 2.44 10.2 5.45 8.54 4.55 3.29 2.29 2.48 3.14 2.39 2.44 2.80 4.07 4.05 2.00 1024 2.68 16.4 0.77 2.70 2.58 15.5 2.60 2.47 2.32 0.79 2.47 2.53 2.58 3.10 2.66 0.74 2.66 1.38 1.22 1.29 1.06 1.61 0.54 4.16 1.15 2.42 2.69 2.72 2.73 2.75 22.1 19.1 2.61 1.52 20.7 2.39 2.61 2.44 10.2 5.44 8.53 4.54 3.30 2.30 2.47 3.15 2.39 2.44 2.80 4.07 4.04 2.02 In the case of very short patterns the TVSBS and the EBOM algorithms obtain the best results. For short patterns the algorithm EBOM is still the best algorithm. However it is outperformed by the FSBNDM algorithm for patterns of length 32. In the case of long patterns the algorithm FSBNDM achieves the best results when then length of the pattern is less than 256. For patterns of length 256 the best results are obtained by the TVSBS algorithm. For very long patterns the best results are obtained by the SSEF algorithm. For the overall performance the algorithms TVSBS and BR maintain very good performance for all patterns. Exact String Matching: a Comprehensive Experimental Evaluation 11 2.6 Experimental Results on Rand64 Problem In this section we present experimental results on a random text buffer over an alphabet of 64 characters. m •BM •HOR •KR •ZT •QS •TunBM •NSN •Raita •RCol •Skip •BR •FS •FFS •BFS •TS •SSABS •TVSBS •PBMH •SSEF •RF •BOM •BOM2 •FJS •HASH3 •HASH5 •HASH8 •TSW •GRASPm 2 20.3 24.9 17.1 29.4 12.6 13.7 14.3 15.4 13.1 22.1 11.4 13.1 13.1 13.2 12.0 9.75 9.83 21.0 9.59 - - - 16.3 14.6 - 21.0 36.2 22.2 18.4 •EBOM 11.5 •FBOM 19.4 •SEBOM 11.5 •SFBOM 24.9 •SBDM 16.8 •SO 16.4 •SA 48.0 •SBNDM 21.7 •TNDM 19.5 •TNDMa 30.4 •LBNDM 14.7 •SVM1 34.9 •SBNDM2 •SBNDM-BMH 12.4 •BMH-SBNDM 13.2 17.3 •FAOSOq2 - •FAOSOq4 15.8 •AOSO2 - •AOSO4 21.2 33.0 - 32.3 - 30.2 17.4 17.3 40.2 •FSBNDM •BNDMq2 •BNDMq4 •SBNDMq2 •SBNDMq4 •UFNDMq2 •DBWW •DBWW2 •KBNDM 4 10.7 13.0 16.5 15.4 7.92 7.29 14.5 8.12 7.00 12.0 8.02 7.00 7.03 7.01 11.6 6.38 7.04 11.0 6.30 17.9 - - 11.4 7.72 - 11.5 26.6 12.1 6.92 7.41 7.32 7.47 13.0 16.8 16.4 16.5 11.7 10.4 15.9 10.5 12.3 6.90 6.98 10.8 12.0 9.80 11.0 10.9 11.4 48.6 11.4 45.7 15.4 9.58 9.55 20.5 8 5.87 7.05 16.4 8.42 4.80 4.09 14.5 4.55 3.94 6.92 5.32 3.94 3.96 3.95 11.0 4.02 4.75 6.05 3.98 6.62 12.1 - 7.42 4.31 - 6.70 25.6 7.10 3.72 4.70 3.94 4.76 7.03 16.8 16.4 7.47 6.75 5.94 8.75 14.9 5.85 4.08 3.92 10.7 5.82 9.73 5.18 5.80 5.31 10.5 5.40 9.90 8.07 5.73 5.73 10.8 16 3.49 4.04 16.4 5.01 3.03 2.60 14.6 2.77 2.52 4.37 3.60 2.52 2.54 2.53 9.94 2.69 3.30 3.58 2.69 3.40 4.73 7.60 4.80 2.63 - 4.32 19.0 4.54 2.77 3.23 2.88 3.29 4.06 16.8 16.4 3.94 4.22 3.89 5.16 10.5 3.23 2.83 2.50 10.7 5.72 9.72 5.09 3.32 2.88 4.60 3.07 4.37 4.43 3.66 3.63 5.94 32 2.52 2.69 16.4 3.25 2.45 2.34 14.5 2.41 2.32 3.11 2.78 2.31 2.34 2.34 8.37 2.43 2.73 2.54 2.44 2.42 2.63 3.44 3.33 2.36 5.39 3.07 13.9 3.18 2.59 2.76 2.70 2.83 2.69 16.8 16.4 2.42 2.87 2.92 3.28 8.34 2.42 2.41 2.30 10.2 5.45 9.72 5.08 2.27 2.39 2.57 2.39 2.53 2.71 3.65 3.64 3.54 64 2.32 2.43 16.4 2.61 2.28 2.20 14.5 2.26 2.20 2.57 2.60 2.19 2.23 2.23 6.39 2.29 2.56 2.36 2.31 2.28 2.39 2.46 2.68 2.21 3.37 2.56 9.40 2.52 2.51 2.67 2.62 2.74 2.44 22.1 19.1 2.53 2.84 2.84 2.43 20.7 2.38 2.52 2.34 10.2 5.45 8.53 4.54 2.27 2.44 3.14 2.38 2.44 2.70 3.65 3.63 2.64 128 2.72 3.14 16.4 2.86 2.97 2.60 14.5 2.66 2.58 3.74 2.82 2.58 2.66 2.68 5.20 2.66 2.67 3.19 2.66 2.58 2.72 2.86 3.34 2.64 3.43 3.05 6.85 2.99 2.76 2.86 2.87 2.95 3.11 22.1 19.1 2.52 2.84 2.85 3.00 20.7 2.38 2.52 2.35 10.2 5.45 8.52 4.55 2.27 2.44 3.14 2.38 2.44 2.70 3.65 3.63 3.01 256 2.53 2.72 16.4 1.61 2.59 2.42 14.5 2.47 2.41 2.76 1.59 2.42 2.54 2.55 3.87 2.48 1.52 2.91 2.48 1.72 1.84 1.96 1.98 2.41 1.80 2.34 3.71 1.71 1.73 1.79 1.83 1.86 2.72 22.1 19.1 2.52 2.85 2.84 1.77 20.7 2.38 2.51 2.36 10.2 5.46 8.52 4.55 2.26 2.43 3.16 2.38 2.45 2.70 3.66 3.63 1.63 512 2.49 2.68 16.4 0.97 2.55 2.40 14.4 2.45 2.38 2.14 0.96 2.39 2.58 2.59 2.90 2.44 0.92 3.64 2.43 1.28 1.37 1.44 1.26 2.26 0.99 2.51 2.10 1.24 1.41 1.45 1.48 1.52 2.68 22.1 19.1 2.52 2.84 2.84 1.21 20.7 2.38 2.52 2.36 10.2 5.45 8.52 4.55 2.27 2.43 3.15 2.38 2.44 2.70 3.66 3.63 1.47 1024 2.49 2.69 16.4 0.61 2.57 2.38 14.5 2.44 2.36 1.83 0.63 2.37 2.77 2.78 2.68 2.44 0.59 6.68 2.44 1.13 1.21 1.29 0.88 2.05 0.55 3.89 1.36 2.40 2.68 2.71 2.74 2.78 2.70 22.1 19.1 2.52 2.86 2.86 1.06 20.7 2.38 2.52 2.35 10.2 5.46 8.53 4.54 2.27 2.43 3.14 2.38 2.44 2.70 3.65 3.64 1.46 In the case of very short patterns the FJS algorithm obtains the best perfor- mance. For short patterns the algorithms SBNDM-BMH and BMH-SBNDM are very fast. However other algorithms based on bit-parallelism obtain good results. In particular the FSBNDM algorithm is the fastest for patterns of length 32. For patterns of length 8 the EBOM algorithm obtains the best results. In the case of long patterns the FSBNDM algorithm obtains very good results. In some cases it is outperformed by the TVSBS algorithm. For very long patterns the best results are obtained by the SSEF and TVSBS algorithms. Regarding the overall performance the algorithms BR, and TVSBS maintain very good performance for all patterns. 12 Simone Faro and Thierry Lecroq 2.7 Experimental Results on Rand128 Problem In this section we present experimental results on a random text buffer over an alphabet of 128 characters. •RCol •Skip •BR •FS •FFS •BFS •TS •SSABS •TVSBS •PBMH m •BM •HOR •KR •ZT •OM •QS •TunBM •NSN •Raita 2 19.9 24.2 16.7 39.2 18.5 12.1 13.1 13.8 15.1 12.8 21.4 15.2 12.8 12.8 12.8 11.6 9.34 13.6 20.3 9.18 - - - 18.8 14.2 - •SSEF 35.5 •BOM 21.5 •BOM2 19.6 •ILDM1 26.0 •EBOM 16.8 •FBOM 26.4 •SEBOM 16.8 •SFBOM 24.2 •SBDM 16.8 •SO 16.4 •SA 48.1 •SBNDM 21.1 •TNDM 19.1 •TNDMa 29.8 •LBNDM 14.1 •SVM1 34.9 •SBNDM2 •SBNDM-BMH 11.8 •FJS •HASH3 •HASH5 •HASH8 •TSW •GRASPm •BMH-SBNDM 12.8 22.5 •FNDM 14.0 •FAOSOq2 - •FAOSOq4 12.7 •AOSO2 - •AOSO4 20.9 33.0 - 32.3 - 30.2 16.5 16.4 44.7 •FSBNDM •BNDMq2 •BNDMq4 •SBNDMq2 •SBNDMq4 •UFNDMq2 •DBWW •DBWW2 •KBNDM 4 10.4 12.6 16.4 20.3 11.6 7.64 6.99 14.0 8.01 6.82 11.3 10.6 6.82 6.83 6.85 11.4 6.14 9.60 10.6 6.04 18.0 - - 13.1 7.51 - 26.4 11.4 10.4 8.61 10.7 8.82 10.7 12.6 16.9 16.5 16.6 11.2 9.95 15.5 9.97 12.4 6.55 6.86 12.1 10.8 8.87 9.74 8.02 10.8 11.4 48.7 11.4 45.8 15.4 8.85 8.82 22.7 8 5.65 6.74 16.3 10.9 6.99 4.57 3.85 13.9 4.40 3.80 6.29 6.87 3.79 3.81 3.80 11.1 3.81 6.30 5.76 3.76 6.62 12.1 - 8.52 4.13 - 26.6 6.43 5.77 4.65 6.52 4.78 6.60 6.75 16.8 16.4 7.46 6.27 5.39 8.29 14.6 5.84 3.71 3.78 6.65 10.7 5.76 9.75 5.12 5.74 5.30 10.5 5.39 9.89 8.07 5.07 5.05 11.8 16 3.32 3.81 16.4 6.16 4.30 2.86 2.48 13.9 2.64 2.46 3.79 4.43 2.46 2.47 2.47 10.5 2.54 4.15 3.38 2.54 3.41 4.71 7.59 5.57 2.48 - 20.3 3.93 3.51 3.11 4.16 3.23 4.22 3.81 16.8 16.4 3.94 3.74 3.28 4.73 10.2 3.23 2.58 2.45 3.93 10.7 5.72 9.74 5.10 3.29 2.88 4.58 3.06 4.37 4.40 3.17 3.16 6.38 32 2.44 2.53 16.4 3.83 2.83 2.40 2.29 13.9 2.38 2.27 2.71 3.06 2.29 2.32 2.31 9.47 2.39 2.95 2.47 2.38 2.44 2.65 3.44 4.05 2.35 5.40 16.0 2.83 2.75 2.69 2.97 2.81 3.04 2.52 16.8 16.4 2.42 2.64 2.58 3.01 8.12 2.43 2.29 2.28 2.71 10.2 5.44 9.74 5.09 2.26 2.38 2.58 2.39 2.54 2.69 3.17 3.17 3.64 64 2.24 2.34 16.4 2.77 2.45 2.21 2.14 13.9 2.19 2.13 2.43 2.74 2.13 2.17 2.19 7.96 2.25 2.66 2.27 2.25 2.30 2.38 2.46 3.44 2.15 3.38 12.2 2.54 2.59 2.56 2.83 2.67 2.87 2.33 22.1 19.1 2.36 2.62 2.51 2.41 20.7 2.38 2.36 2.34 2.63 10.2 5.45 8.53 4.55 2.27 2.42 3.15 2.37 2.44 2.68 3.18 3.17 2.64 128 2.68 3.06 16.4 2.98 2.83 2.91 2.58 14.0 2.66 2.58 3.28 2.92 2.57 2.66 2.66 6.43 2.61 2.77 3.20 2.61 2.57 2.73 2.85 3.67 2.64 3.43 9.55 3.03 3.18 2.83 2.96 2.93 3.06 3.05 22.1 19.1 2.36 2.62 2.52 2.91 20.7 2.38 2.36 2.33 2.63 10.2 5.46 8.51 4.55 2.25 2.41 3.17 2.38 2.44 2.67 3.17 3.17 3.09 256 2.08 2.30 16.4 1.62 2.26 2.21 2.03 13.9 2.09 2.03 2.18 1.59 2.02 2.20 2.20 5.01 2.07 1.54 2.54 2.04 1.72 1.85 1.97 2.11 2.06 1.79 5.49 1.72 3.02 1.75 1.83 1.83 1.98 2.42 25.3 21.5 2.66 2.94 2.81 1.81 23.3 2.66 2.67 2.61 2.95 11.4 6.10 9.58 5.09 2.54 2.72 3.52 2.65 2.76 3.00 3.88 3.84 2.07 512 2.11 2.36 18.7 1.07 2.35 2.28 2.06 15.9 2.13 2.04 1.90 1.08 2.04 2.44 2.44 3.67 2.08 1.05 3.52 2.10 1.45 1.57 1.65 1.47 2.06 1.14 3.45 1.41 5.01 1.62 1.68 1.67 1.77 2.37 25.1 21.8 2.70 3.01 2.87 1.18 23.7 2.70 2.69 2.67 3.00 11.7 6.20 9.74 5.18 2.57 2.77 3.58 2.71 2.79 3.06 3.62 3.59 1.24 1024 2.08 2.36 17.4 0.60 2.22 2.05 1.84 14.4 1.89 1.83 1.37 0.60 1.84 2.49 2.50 2.54 1.86 0.59 6.30 1.86 1.18 1.26 1.34 0.88 1.80 0.57 1.92 2.48 7.90 2.77 2.79 2.79 2.88 2.13 22.8 19.7 2.43 2.71 2.59 0.81 21.4 2.45 2.43 2.40 2.72 10.5 5.63 8.79 4.70 2.33 2.50 3.25 2.46 2.52 2.77 3.29 3.27 1.13 In the case of very short patterns the FJS algorithm have the best per- formance. For short patterns the algorithms SBNDM-BMH, BMH-SBNDM and FSBNDM obtain the best results. In the case of long patterns the algorithm FSBNDM is still a good choice. Very good results are obtained by the TVSBS and FS algorithms. For very long patterns the best results are obtained by the SSEF and TVSBS algorithms. Regarding the overall performance the algorithm FS shows good results for all patterns. Good results are also maintained over all patterns by the algorithm FJS. Exact String Matching: a Comprehensive Experimental Evaluation 13 2.8 Experimental Results on Rand256 Problem In this section we present experimental results on a random text buffer over an alphabet of 256 characters. m •BM •HOR •ZT •OM •QS •TunBM •NSN •Raita •RCol •Skip •BR •FS •FFS •BFS •TS •SSABS •TVSBS •PBMH •FJS •HASH3 •HASH5 •HASH8 •TSW •GRASPm 2 20.3 24.7 47.7 18.8 12.3 13.2 14.1 15.5 13.1 21.7 19.9 13.1 13.1 13.1 11.7 9.47 18.4 20.7 9.26 - - - 29.7 14.5 - 21.8 19.9 30.0 24.7 16.9 49.6 21.6 19.5 30.4 •LBNDM 14.2 •SVM1 36.0 •SBNDM2 •SBNDM-BMH 11.9 •BMH-SBNDM 13.1 22.9 •FNDM 12.8 •FAOSOq2 - •FAOSOq4 11.6 •AOSO2 - •AOSO4 - •AOSO6 21.4 34.0 33.3 - 16.6 16.6 46.6 •SSEF •BOM2 •ILDM1 •EBOM •SBDM •SA •SBNDM •TNDM •TNDMa •FSBNDM •BNDMq2 •SBNDMq2 •SBNDMq4 •DBWW •DBWW2 •KBNDM 4 10.6 12.8 24.7 11.8 7.71 6.98 14.1 8.13 6.91 11.3 13.8 6.90 6.92 6.90 11.6 6.19 12.8 10.8 6.07 18.5 - - 22.2 7.60 - 11.5 10.4 10.4 12.8 16.9 17.0 11.3 10.00 15.7 9.98 12.6 6.50 6.90 12.0 11.1 7.57 10.0 6.81 - 11.1 11.8 11.7 47.2 8.77 8.78 23.7 8 5.70 6.83 13.3 7.05 4.60 3.87 14.1 4.49 3.84 6.20 9.06 3.84 3.84 3.84 11.5 3.85 8.46 5.80 3.76 6.84 12.4 - 15.8 4.18 - 6.32 5.65 5.48 6.81 17.0 7.69 6.17 5.33 8.33 13.6 6.03 3.63 3.83 6.57 11.1 5.92 10.1 5.27 5.20 5.89 5.45 5.57 10.2 4.88 4.90 12.5 16 3.34 3.83 7.84 4.30 2.86 2.51 14.1 2.67 2.53 3.63 6.15 2.50 2.54 2.52 11.1 2.57 5.88 3.40 2.55 3.50 4.86 7.83 11.1 2.50 - 3.77 3.35 3.72 3.82 17.0 4.05 3.62 3.07 4.66 10.4 3.34 2.55 2.51 3.76 11.1 5.90 10.0 5.25 3.70 3.37 2.98 3.17 4.51 2.96 2.95 7.16 32 2.49 2.54 5.44 2.81 2.46 2.34 14.0 2.44 2.32 2.60 4.75 2.35 2.36 2.35 10.5 2.43 4.64 2.52 2.44 2.50 2.72 3.56 7.72 2.38 5.58 2.76 2.73 3.13 2.54 17.0 2.49 2.59 2.52 2.87 8.26 2.49 2.30 2.32 2.65 10.5 5.62 10.1 5.26 3.69 2.32 2.45 2.46 2.60 2.96 2.96 4.75 64 2.26 2.39 4.32 2.48 2.26 2.17 14.1 2.23 2.18 2.38 4.21 2.17 2.23 2.23 9.48 2.29 4.15 2.31 2.29 2.35 2.47 2.53 5.47 2.19 3.49 2.61 2.66 2.99 2.39 19.7 2.36 2.59 2.44 2.46 21.4 2.45 2.35 2.39 2.59 10.5 5.64 8.80 4.69 3.40 2.32 2.49 2.45 2.52 2.97 2.96 3.61 128 2.67 2.98 3.87 2.85 2.83 2.60 14.1 2.69 2.58 3.10 3.78 2.59 2.68 2.69 8.08 2.61 3.70 3.13 2.62 2.65 2.81 2.94 4.65 2.64 3.55 3.11 3.22 3.06 3.00 19.7 2.36 2.59 2.40 2.91 21.4 2.45 2.35 2.38 2.60 10.5 5.62 8.79 4.69 3.41 2.33 2.48 2.46 2.51 2.95 2.96 3.42 256 1.75 1.98 2.02 1.94 1.88 1.73 14.1 1.79 1.73 1.87 2.00 1.72 1.91 1.94 6.68 1.75 1.98 2.24 1.74 1.77 1.91 2.03 2.56 1.75 1.84 1.85 3.16 1.90 1.96 19.7 2.35 2.59 2.43 1.61 21.4 2.45 2.34 2.38 2.60 10.5 5.62 8.80 4.70 3.40 2.33 2.49 2.47 2.51 2.96 2.95 1.78 512 1.33 1.54 1.08 1.52 1.47 1.30 14.1 1.35 1.31 1.32 1.10 1.29 1.69 1.69 4.51 1.31 1.08 2.58 1.32 1.31 1.42 1.47 1.49 1.32 1.03 1.31 4.65 1.52 1.53 19.7 2.35 2.58 2.44 0.96 21.4 2.45 2.36 2.39 2.61 10.5 5.62 8.79 4.70 3.40 2.33 2.49 2.45 2.52 2.97 2.96 0.96 1024 1.21 1.40 0.63 1.49 1.35 1.16 14.1 1.20 1.18 1.02 0.60 1.18 1.91 1.92 2.90 1.18 0.60 5.59 1.18 1.17 1.25 1.33 0.92 1.16 0.55 2.41 7.83 2.77 1.37 19.7 2.36 2.58 2.44 0.66 21.4 2.45 2.36 2.40 2.60 10.5 5.62 8.80 4.70 3.38 2.34 2.49 2.45 2.51 2.97 2.96 0.87 In the case of very short patterns the best performance are obtained by the FJS algorithm. For short patterns the algorithms SBNDM-BMH, BMH-SBNDM and FS obtain the best results. In the case of long patterns the algorithms based on characters comparison are good choices, among them FS, GRASPm and TunBM. Very good results are obtained also by the LBNDM, KBNDM and FSBNDM algorithms. For very long patterns the best results are obtained by the SSEF, LBNDM and KBNDM algorithms. Regarding the overall performance the algorithm FS shows good results for all patterns. Good results are also main- tained over all patterns by the algorithms GRASPm and FJS. 14 Simone Faro and Thierry Lecroq 2.9 Experimental Results on a Genome Sequence In this section we present experimental results on a genomic sequence which consists of 4 different characters. •HASH3 •HASH5 •HASH8 •TSW •GRASPm •EBOM •FBOM •SEBOM •SFBOM •SO •SSEF •AUT •RF •TRF •BOM •BOM2 •WW •ILDM1 •ILDM2 m •KR •QS •TunBM •NSN •Raita •RCol •ASkip •BR •FS •FFS •BFS •TS •SSABS •TVSBS •FJS 2 51.1 58.4 66.5 55.1 60.6 57.4 112 50.5 57.4 56.1 57.2 56.0 51.4 44.6 60.3 - - - 55.0 66.7 - 44.8 102 112 136 117 108 80.4 89.7 49.8 60.2 51.4 57.5 35.3 33.8 •SA 102 •BNDM 101 •BNDM-L 102 •SBNDM 82.3 •TNDM 79.4 •TNDMa 108 •LBNDM 81.5 •SBNDM2 •SBNDM-BMH 67.4 •BMH-SBNDM 61.3 199 •FAOSOq2 - •FAOSOq4 211 •AOSO2 - •AOSO4 - •AOSO6 80.9 •FSBNDM 77.6 •BNDMq2 - •BNDMq4 - •BNDMq6 76.5 •SBNDMq2 - - - 93.5 109 109 •SBNDMq4 •SBNDMq6 •SBNDMq8 •UFNDMq4 •UFNDMq6 •KBNDM 4 35.8 44.6 44.0 63.0 37.4 39.5 65.5 37.2 39.7 37.9 38.8 45.9 42.5 35.3 50.6 39.8 - - 40.7 43.8 - 46.0 62.5 70.2 90.2 66.7 67.9 53.9 50.5 29.1 38.0 29.4 37.5 35.3 33.9 57.1 57.2 46.5 52.8 52.7 62.5 37.6 43.5 40.4 78.2 163 73.0 174 - 43.0 37.6 101 - 36.5 94.9 - - 45.1 58.2 58.1 8 33.8 34.7 35.0 62.0 28.4 28.6 31.7 25.2 28.9 27.1 26.9 33.1 36.2 24.6 43.7 15.0 25.1 - 27.6 30.1 - 44.8 35.5 41.2 56.5 37.7 40.3 33.3 28.5 21.3 24.8 21.4 24.1 35.3 33.8 30.5 30.6 26.2 29.7 30.1 34.2 22.3 26.2 26.2 26.1 64.7 23.4 61.1 155 23.2 22.5 22.4 49.8 22.0 21.2 56.7 201 24.1 29.4 35.5 16 33.7 31.7 32.3 61.6 26.2 23.7 16.3 17.0 23.5 19.9 20.1 23.7 34.2 17.5 41.8 7.93 9.84 15.8 19.0 23.1 - 46.1 20.1 24.8 36.6 21.2 23.5 19.9 16.5 14.3 16.0 14.5 15.4 35.3 33.8 16.5 16.4 15.0 16.6 16.9 19.1 13.0 14.9 18.2 22.4 15.5 20.0 13.8 57.5 12.9 13.0 10.2 14.9 12.9 9.76 16.6 23.6 13.6 15.4 21.6 32 33.7 31.1 31.7 61.7 25.7 20.7 9.67 12.8 20.4 14.9 15.7 18.5 33.6 13.8 42.2 5.38 5.54 7.18 14.6 17.9 11.5 46.0 11.8 15.1 23.0 12.0 13.9 11.8 9.90 9.03 10.2 9.14 9.68 35.3 33.8 9.12 9.13 8.44 9.54 9.73 10.8 7.75 8.44 11.9 20.5 11.0 20.0 10.4 8.15 7.06 7.63 5.95 7.28 7.63 5.93 7.73 9.37 8.47 10.0 12.9 64 33.8 31.2 32.7 61.2 26.6 17.7 7.07 11.3 17.7 11.8 12.6 15.5 33.7 12.7 42.0 4.96 4.91 5.09 12.8 14.2 6.22 44.8 7.53 9.96 14.1 7.20 8.71 7.73 6.74 6.11 6.78 6.32 6.30 44.8 39.0 12.1 15.6 8.03 9.32 9.47 8.18 7.73 8.04 11.9 20.5 11.0 17.6 9.34 7.62 7.07 9.49 7.34 6.59 7.73 5.55 6.64 8.64 8.45 10.1 8.06 128 33.8 31.3 32.6 61.1 26.2 15.6 8.41 11.3 15.8 10.4 11.2 13.7 33.8 12.6 41.7 5.59 5.66 5.86 12.9 16.1 6.68 46.1 8.09 9.64 11.8 7.84 9.43 8.33 7.95 7.03 7.59 7.24 7.22 44.8 39.0 12.1 19.9 8.02 9.32 9.48 12.4 7.73 8.01 11.8 20.5 11.0 17.6 9.34 7.61 7.05 9.50 7.34 6.58 7.73 5.57 6.65 8.64 8.45 10.0 8.02 256 33.8 31.7 32.6 61.6 25.8 14.4 6.59 11.4 14.5 9.06 9.89 12.4 33.9 12.6 42.4 5.22 4.00 4.19 12.7 12.5 3.75 45.0 5.22 7.42 6.52 4.37 6.54 6.10 5.88 4.08 4.35 4.19 4.18 44.8 39.0 12.0 18.1 8.04 9.29 9.44 26.4 7.74 8.04 11.8 20.5 11.0 17.6 9.34 7.62 7.07 9.48 7.35 6.58 7.72 5.56 6.66 8.63 8.48 10.0 8.00 512 33.8 31.4 32.1 61.5 26.1 12.6 6.61 11.4 12.9 7.47 8.43 10.9 33.6 12.8 41.7 5.06 3.04 3.13 12.6 9.97 2.26 45.7 4.79 7.39 3.59 2.73 6.69 6.65 6.51 2.74 2.84 2.79 2.80 44.8 39.0 12.1 17.8 8.03 9.30 9.46 113 7.74 8.03 11.8 20.5 11.0 17.6 9.33 7.60 7.06 9.47 7.35 6.58 7.72 5.58 6.64 8.64 8.48 10.0 8.02 1024 33.8 31.1 31.5 61.8 26.0 11.3 9.32 11.4 11.5 6.70 7.62 10.2 34.4 12.5 41.3 5.03 2.58 2.70 12.9 8.90 1.59 47.1 6.02 8.88 2.05 3.20 9.86 9.94 9.81 3.42 3.49 3.47 3.47 44.9 38.9 12.1 18.9 8.02 9.31 9.43 111 7.73 8.02 11.8 20.5 11.0 17.6 9.33 7.61 7.07 9.48 7.33 6.58 7.72 5.58 6.64 8.65 8.46 10.1 7.99 In the case of very short patterns the SA and EBOM algorithms obtain the best performance for patterns of length 2 and 4, respectively. In the case of short patterns the HASH3 algorithm achieves the best results. In the case of long patterns the algorithms in the HASHq family are still very good choices. They are sporadically outperformed by algorithms based on bit-parallelism. For very long patterns the best results are obtained by the SSEF. Regarding the overall performance the EBOM family of algorithms maintain good performance for all patterns. Exact String Matching: a Comprehensive Experimental Evaluation 15 2.10 Experimental Results on a Protein Sequence In this section we present experimental results on a protein sequence which consists of 20 different characters. •HASH3 •HASH5 •HASH8 •TSW •GRASPm m •KR •ZT •QS •TunBM •NSN •Raita •RCol •Skip •BR •FS •FFS •BFS •TS •SSABS •TVSBS •FJS 2 12.0 20.5 9.88 11.1 10.9 11.1 9.86 17.0 8.61 9.88 9.84 9.94 9.41 8.01 7.50 8.21 - - - 9.82 11.2 - 16.8 26.5 17.9 12.1 •EBOM 8.64 •FBOM 12.8 •SEBOM 8.68 •SFBOM 10.8 •SO 10.7 •SA 31.2 •SBNDM 16.1 •TNDM 14.4 •TNDMa 22.0 •LBNDM 11.9 •SVM1 22.8 •SBNDM2 •SBNDM-BMH 10.4 •BMH-SBNDM 10.1 23.1 •FAOSOq2 - •AOSO2 - •AOSO4 2.33 15.3 21.4 - 21.1 - 19.9 •SSEF •RF •BOM •BOM2 •AOSO6 •FSBNDM •BNDMq2 •BNDMq4 •SBNDMq2 •SBNDMq4 •UFNDMq2 4 10.9 10.6 6.32 6.17 11.4 5.97 5.46 10.4 5.98 5.49 5.52 5.48 8.58 5.28 5.28 5.52 11.8 - - 6.86 6.10 - 10.2 18.4 10.8 4.71 5.36 5.01 5.42 10.8 10.7 10.9 9.55 8.67 12.2 8.87 8.14 6.30 5.43 8.04 7.24 - 2.32 7.77 7.61 31.5 7.58 29.7 10.4 8 10.6 5.69 4.00 3.70 11.3 3.56 3.25 6.73 3.90 3.26 3.30 3.25 7.31 3.57 3.50 3.70 4.39 7.85 - 4.55 3.60 - 6.47 14.3 6.84 2.59 3.40 2.77 3.44 10.8 10.7 5.02 5.93 5.79 7.08 10.2 3.95 4.17 3.18 7.02 6.32 4.23 16.1 4.15 3.63 6.80 3.70 6.44 5.59 16 10.6 3.35 2.71 2.44 11.3 2.38 2.19 4.59 2.52 2.17 2.18 2.15 5.80 2.48 2.34 2.65 2.29 3.07 4.96 3.01 2.35 - 3.93 9.93 4.12 1.91 2.29 2.03 2.36 10.9 10.7 2.73 3.49 3.66 4.08 7.67 2.25 2.66 2.11 7.01 6.32 3.31 3.29 2.42 2.05 2.99 2.16 2.85 3.18 32 10.6 2.14 2.08 1.97 11.4 1.88 1.82 3.21 1.85 1.82 1.79 1.78 4.42 2.02 1.85 2.13 1.61 1.74 2.24 2.18 1.86 3.57 2.31 6.36 2.38 1.75 1.92 1.89 1.99 10.8 10.7 1.71 1.95 2.00 2.34 5.93 1.67 1.73 1.72 6.64 6.32 3.31 2.33 1.56 1.62 1.68 1.63 1.66 2.01 64 10.7 1.76 1.92 1.83 11.5 1.76 1.70 2.49 1.74 1.70 1.69 1.68 3.36 1.87 1.73 1.96 1.52 1.56 1.60 1.84 1.72 2.24 1.78 3.92 1.74 1.70 1.85 1.81 1.93 14.2 12.3 1.72 1.94 1.95 1.70 13.5 1.60 1.72 1.77 6.66 5.56 2.97 2.15 1.56 1.74 2.06 1.59 1.61 2.01 128 10.6 2.02 2.06 1.90 11.5 1.88 1.81 3.91 2.05 1.80 1.88 1.87 3.03 1.97 1.92 2.03 1.74 1.79 1.87 2.48 1.90 2.29 2.17 3.22 2.12 1.95 2.21 2.07 2.27 14.2 12.3 1.73 1.93 1.95 2.28 13.5 1.60 1.72 1.78 6.65 5.57 2.97 2.15 1.55 1.73 2.05 1.60 1.60 2.01 256 10.7 1.34 1.97 1.89 11.4 1.87 1.75 2.79 1.36 1.77 1.84 1.85 2.72 1.93 1.31 1.99 1.37 1.22 1.29 1.71 1.70 1.21 1.91 1.84 1.29 1.34 1.41 1.46 1.48 14.2 12.3 1.72 1.94 1.96 1.53 13.5 1.59 1.73 1.80 6.65 5.55 2.95 2.16 1.54 1.75 2.06 1.59 1.60 2.02 512 10.6 0.99 1.96 1.88 11.4 1.84 1.72 2.16 1.02 1.72 1.77 1.80 2.43 1.93 0.98 1.98 1.17 0.90 0.96 1.33 1.33 0.63 2.39 1.06 1.02 1.20 1.24 1.28 1.29 14.2 12.3 1.73 1.94 1.94 1.40 13.5 1.60 1.72 1.78 6.65 5.56 2.96 2.15 1.56 1.73 2.07 1.61 1.60 2.02 1024 10.7 0.84 1.94 1.87 11.2 1.82 1.68 1.93 0.87 1.69 1.98 2.01 2.20 1.93 0.82 1.98 1.07 0.80 0.85 1.16 0.99 0.36 4.19 0.73 2.22 2.57 2.59 2.61 2.63 14.2 12.3 1.72 1.95 1.95 1.49 13.5 1.60 1.73 1.78 6.64 5.57 2.97 2.16 1.56 1.73 2.06 1.60 1.61 2.02 In the case of very short patterns the SBNDM-BMH algorithm obtains the best performance. Other very good algorithms are SSABS, TVSBS and FJS. For short patterns the algorithms based on bit-parallelism achieves better results, in particular SBNDM2, FSBNDM, BNDMq2, SBNDMq2. The EBOM and SEBOM algorithms maintain also good performance. In the case of long patterns the algorithms EBOM and SEBOM are good choices. Very good results are obtained also by the HASHq algorithms, LBNDM and TVSBS. For very long patterns the best results are obtained by the SSEF, ZT, BR, HASHq and TVSBS algorithms. Among the algorithms based on automata the best results are obtained by the BOM algorithm. Evaluating the overall performance the algorithms GRASPm, BR and TVSBS maintains good performance for all patterns. 16 Simone Faro and Thierry Lecroq 2.11 Experimental Results on Bible In this section we present experimental results on a natural language text with 63 different characters. m •BM •HOR •KR •ZT •QS •TunBM •NSN •Smith •Raita •RCol •BR •FS •FFS •BFS •TS •SSABS 2 19.0 23.4 14.6 26.4 13.2 14.8 14.5 24.9 14.4 12.9 11.3 12.8 13.0 13.1 12.7 10.8 10.1 11.1 - - - 13.1 14.7 - 34.6 23.6 15.3 •EBOM 11.8 •FBOM 16.2 •SEBOM 11.6 •SFBOM 23.5 •SBDM 13.3 •SO 13.1 •SA 38.3 •SBNDM 28.3 •LBNDM 16.1 •SVM1 28.4 •SBNDM2 •SBNDM-BMH 13.8 •BMH-SBNDM 13.2 30.8 •AOSO2 - •AOSO4 19.8 •FSBNDM 26.8 •BNDMq2 - •BNDMq4 - •BNDMq6 26.3 •SBNDMq2 - - •SSEF •BOM •BOM2 •TVSBS •FJS •HASH3 •HASH5 •HASH8 •TSW •GRASPm •SBNDMq4 •SBNDMq6 4 10.8 13.1 13.3 13.8 8.90 8.41 15.8 15.5 7.90 7.39 8.17 7.46 7.57 7.62 11.2 7.17 7.16 7.53 14.6 - - 9.32 8.31 - 25.2 15.4 6.53 7.51 6.84 7.46 13.4 13.3 13.1 14.0 16.4 12.3 10.5 8.80 7.41 10.2 26.5 10.3 10.1 38.8 - 9.87 36.5 - 8 6.39 7.87 13.1 7.52 5.56 5.11 15.2 9.29 4.79 4.59 5.28 4.58 4.60 4.52 8.97 4.88 4.60 5.05 5.42 9.68 - 6.21 4.97 - 19.9 9.71 3.87 4.89 4.10 4.94 7.74 13.3 13.1 6.77 9.59 13.2 5.36 6.02 4.46 7.86 5.93 5.74 5.06 8.48 19.2 5.14 8.02 21.9 16 4.17 4.87 13.1 4.44 3.66 3.35 15.7 5.79 3.18 3.04 3.41 3.09 3.02 3.01 7.40 3.43 3.12 3.53 2.79 3.81 6.08 4.12 3.31 - 13.9 5.83 2.91 3.51 3.07 3.59 4.89 13.3 13.1 3.94 5.57 9.77 3.30 3.84 2.94 7.76 4.09 3.56 3.15 3.79 5.79 3.21 3.61 6.45 32 2.95 3.45 13.1 2.87 2.73 2.59 15.5 3.97 2.43 2.38 2.40 2.36 2.33 2.29 6.22 2.66 2.35 2.77 1.97 2.14 2.77 2.91 2.46 4.36 9.36 3.51 2.47 2.80 2.61 2.83 3.44 13.3 13.1 2.55 3.32 7.46 2.39 2.54 2.28 7.76 4.07 2.20 2.30 2.16 2.83 2.37 2.14 3.02 64 2.46 2.75 13.1 2.26 2.32 2.30 15.8 3.03 2.18 2.13 2.17 2.13 2.12 2.08 5.68 2.33 2.15 2.45 1.84 1.90 1.97 2.33 2.16 2.59 6.03 2.40 2.21 2.44 2.33 2.49 2.77 17.6 15.3 2.58 2.19 16.9 2.26 2.54 2.31 6.82 3.62 2.18 2.67 2.66 2.58 2.24 2.04 2.59 128 2.59 3.05 13.1 2.55 2.75 2.55 16.1 3.38 2.46 2.36 2.63 2.37 2.39 2.40 5.51 2.52 2.42 2.62 2.09 2.21 2.28 3.14 2.52 2.72 4.90 2.83 2.55 2.85 2.67 2.93 3.06 17.6 15.3 2.57 2.90 16.9 2.23 2.56 2.31 6.81 3.62 2.20 2.70 2.67 2.59 2.23 2.05 2.58 256 2.29 2.58 13.1 1.77 2.30 2.25 15.9 2.81 2.18 2.07 1.78 2.09 2.13 2.14 5.70 2.25 1.71 2.32 1.45 1.49 1.58 2.17 2.12 1.44 2.90 1.70 1.68 1.77 1.80 1.84 2.58 17.6 15.3 2.56 1.94 16.9 2.25 2.57 2.31 6.82 3.62 2.18 2.71 2.68 2.57 2.21 2.05 2.59 512 1.90 2.20 13.1 1.27 1.97 1.95 16.4 2.39 1.86 1.75 1.30 1.76 1.92 1.94 5.68 1.91 1.21 1.98 1.06 1.07 1.15 1.63 1.69 0.80 1.72 1.22 1.41 1.44 1.48 1.48 2.21 17.6 15.3 2.56 1.65 16.9 2.23 2.58 2.30 6.81 3.63 2.18 2.70 2.67 2.58 2.24 2.05 2.59 1024 1.59 1.91 13.1 0.98 1.70 1.65 16.0 2.08 1.59 1.47 1.01 1.47 1.96 1.99 5.68 1.65 0.94 1.69 0.85 0.89 0.98 1.30 1.32 0.45 1.10 2.35 2.67 2.69 2.71 2.73 1.91 17.6 15.3 2.56 1.48 16.9 2.24 2.57 2.29 6.81 3.64 2.19 2.69 2.67 2.58 2.25 2.05 2.59 In the case of very short patterns the best results are obtained by the TVSBS and EBOM algorithms. For short patterns the EBOM algorithm obtains the best results for patterns of length 8, while in the other cases the best results are obtained by the HASHq algorithm. In the case of long patterns the algorithms in the HASHq family are good choices. Very good results are obtained also by the SSEF and SBNDMq4 algorithms. For very long patterns the best results are obtained by the SSEF algorithm. Evaluating the overall performance the algorithm TVSBS maintains good performance for all patterns. Exact String Matching: a Comprehensive Experimental Evaluation 17 2.12 Experimental Results on World192 In this section we present experimental results on a natural language text with 94 different characters. •TVSBS •PBMH •FJS •HASH3 •HASH5 •HASH8 •TSW •GRASPm •SSEF •BOM •BOM2 m •BM •HOR •KR •ZT •OM •MS •QS •TunBM •NSN •Smith •Raita •RCol •BR •FS •FFS •BFS •TS •SSABS 2 11.1 13.7 8.59 15.6 10.9 10.6 7.38 8.18 7.96 15.0 8.39 7.47 6.60 7.39 7.44 7.43 7.02 6.04 5.91 12.1 6.07 - - - 7.92 8.39 - 19.9 13.2 9.36 •EBOM 6.84 •FBOM 9.90 •SEBOM 6.86 •SFBOM 13.7 •SBDM 8.12 •SO 8.02 •SA 23.5 •SBNDM 16.5 •LBNDM 8.80 •SVM1 17.2 •SBNDM2 •SBNDM-BMH 7.72 •BMH-SBNDM 7.60 15.7 •FAOSOq2 - •FAOSOq4 14.3 •AOSO2 - •AOSO4 11.4 16.2 - - 15.9 - •FSBNDM •BNDMq2 •BNDMq4 •BNDMq6 •SBNDMq2 •SBNDMq4 4 6.08 7.41 8.13 8.13 7.00 6.92 4.76 4.63 8.41 9.31 4.57 4.10 4.69 4.10 4.26 4.18 6.44 4.13 4.21 6.67 3.98 8.85 - - 5.68 4.65 - 13.9 7.89 3.84 4.40 4.10 4.38 7.59 8.10 8.01 8.32 9.14 6.60 6.27 4.62 4.18 6.13 13.2 5.60 11.9 6.04 5.87 23.7 - 5.84 22.3 8 3.57 4.26 8.01 4.46 4.50 4.39 2.99 2.72 8.41 5.57 2.73 2.50 3.13 2.48 2.50 2.48 5.50 2.65 2.88 3.80 2.70 3.31 5.94 - 3.83 2.72 - 11.7 5.04 2.20 2.81 2.35 2.87 4.24 8.12 8.02 3.87 5.28 7.73 3.07 3.03 2.41 5.34 3.50 4.81 3.08 3.27 2.89 5.19 11.8 2.92 4.89 16 2.22 2.59 7.99 2.68 2.98 2.79 1.96 1.75 8.45 3.39 1.75 1.62 2.09 1.64 1.64 1.63 4.71 1.83 1.98 2.31 1.86 1.72 2.32 3.74 2.59 1.75 - 8.39 3.13 1.64 2.01 1.80 2.08 2.62 8.11 8.02 2.19 3.15 5.70 1.81 2.01 1.58 5.27 2.86 4.79 2.52 1.95 1.67 2.31 3.57 1.75 2.22 32 1.56 1.76 7.98 1.77 2.06 1.91 1.45 1.39 8.35 2.22 1.36 1.31 1.55 1.32 1.33 1.32 4.09 1.44 1.54 1.58 1.48 1.22 1.32 1.70 1.94 1.35 2.74 5.80 1.99 1.48 1.68 1.62 1.75 1.76 8.10 8.04 1.39 1.90 4.38 1.35 1.40 1.28 4.97 2.69 4.76 2.50 1.26 1.32 1.33 1.76 1.34 1.32 64 1.31 1.44 8.00 1.44 1.59 1.48 1.26 1.27 8.24 1.62 1.22 1.23 1.42 1.20 1.25 1.23 3.72 1.28 1.43 1.36 1.32 1.15 1.17 1.23 1.61 1.23 1.69 3.92 1.45 1.44 1.61 1.56 1.68 1.43 10.7 9.39 1.44 1.30 10.3 1.29 1.47 1.30 4.99 2.67 4.18 2.23 1.25 1.47 1.64 1.59 1.29 1.26 128 1.50 1.72 8.01 1.60 1.68 1.57 1.62 1.44 8.43 1.97 1.46 1.40 1.65 1.40 1.45 1.46 3.66 1.46 1.56 1.78 1.51 1.29 1.36 1.43 2.05 1.45 1.73 3.15 1.73 1.62 1.86 1.75 1.93 1.74 10.8 9.40 1.47 1.66 10.3 1.27 1.45 1.30 4.99 2.69 4.19 2.25 1.23 1.46 1.63 1.60 1.27 1.26 256 1.21 1.33 8.02 1.08 1.41 1.33 1.23 1.16 8.40 1.50 1.18 1.12 1.10 1.13 1.28 1.29 3.62 1.18 1.05 1.55 1.20 0.88 0.93 0.99 1.41 1.16 0.93 1.92 1.09 1.18 1.24 1.28 1.33 1.32 10.7 9.38 1.45 1.05 10.3 1.29 1.47 1.29 4.99 2.67 4.19 2.25 1.24 1.45 1.63 1.60 1.30 1.26 512 0.93 1.08 8.02 0.76 1.17 1.23 0.99 0.94 8.39 1.20 0.91 0.87 0.78 0.89 1.19 1.23 3.15 0.93 0.74 2.07 0.96 0.63 0.68 0.72 1.04 0.87 0.48 1.20 0.91 1.11 1.16 1.19 1.23 1.04 10.8 9.38 1.46 0.76 10.3 1.30 1.46 1.32 4.99 2.68 4.18 2.25 1.24 1.47 1.64 1.60 1.28 1.24 1024 0.77 0.89 8.01 0.56 1.15 1.60 0.84 0.76 8.34 1.01 0.75 0.74 0.61 0.71 1.39 1.46 2.87 0.77 0.54 5.05 0.82 0.50 0.57 0.63 0.85 0.70 0.29 0.84 2.18 2.49 2.51 2.54 2.57 0.88 10.8 9.39 1.46 0.64 10.3 1.28 1.48 1.32 5.00 2.68 4.20 2.25 1.25 1.47 1.64 1.61 1.29 1.27 In the case of very short patterns the TVSBS and the EBOM algorithms obtain the best performance. In particular the TVSBS algorithm is the fastest for patterns of length 2 while the EBOM algorithm obtains the best results for pattern of length 8. For short patterns the algorithms EBOM, SBNDM-BMH and HASHq obtain good performance for patterns of length 8, 16 and 32, respectively. In the case of long patterns the algorithms HASHq are the best algorithms. However sporadically they are outperformed by the FSBNDM algorithm. For very long patterns the best results are obtained by the SSEF algorithm. Evaluating the overall performance the algorithms TVSBS, SSABS and FS maintain good performance for all patterns. 18 Simone Faro and Thierry Lecroq Experimental Map 512 256 128 64 32 16 e z i s t e b a h p l A 8 4 2 0 7 10 2 11 1 2 3 4 5 8 6 9 1 2 3 4 5 6 7 8 9 FJS TVSBS SA SBNDM-BMH/BMH-SBNDM EBOM AOSO FSBNDM HASHq SBNDMq 10 11 LBNDM SSEF 2 4 8 16 32 64 128 256 512 1024 Pattern length Fig. 5. Experimental map of the best results obtained in our evaluation. Comparison based algorithms are presented in red gradations, automata based algorithms are pre- sented in green gradations and bit parallel algorithms are presented in blu gradations. 3 Overall Discussion We performed comparisons between 85 exact string matching algorithms with 12 text of different types. We divide the patterns into four classes according to their length m: very short (m ≤ 4), short (4 < m ≤ 32), long (32 < m ≤ 256) and very long (m > 256). We proceed in the same way for the alphabet according to their size σ : very small (σ < 4), small (4 ≤ σ < 32), large (32 ≤ σ < 128) and very large (σ > 128). According to our experimental results, we conclude that the following algorithms are the most efficient in the following situations (see Fig. 5): – SA: very short patterns and very small alphabets. – TVSBS: very short patterns and small alphabets, and long patterns and large alphabets. – FJS: very short patterns and large and very large alphabets. – EBOM: short patterns and large and very large alphabets. – SBNDM-BMH and BMH-SBNDM: short patterns and very large alphabets. – HASHq : short and large patterns and small alphabets. – FSBNDM: long patterns and large and very larghe alphabets. – SBNDMq: long pattern and small alphabets. – LBNDM: very long patterns and very large alphabets. – SSEF: very long patterns. Among these algorithms all but one (the SA algorithm) have been designed during the last decade, four of them are based on comparison of characters, one of them is based on automata (the EBOM algorithm) while six of them are bit-parallel algorithms. Exact String Matching: a Comprehensive Experimental Evaluation 19 References [AR00] [CF03] [CF04] [CF05] [AG86] [AC91] [ACR99] [BM77] [BR99] [BYR92] [BYG92] A. Apostolico and M. Crochemore. Optimal canonization of all substrings of a string. Inf. Comput., 95(1):76–95, 1991. C. Allauzen, M. Crochemore, and M. Raffinot. Factor oracle: a new struc- ture for pattern matching. In J. Pavelka, G. Tel, and M. Bartosek, editors, SOFSEM’99, Theory and Practice of Informatics, number 1725 in Lecture Notes in Computer Science, pages 291–306, Milovy, Czech Republic, 1999. Springer-Verlag, Berlin. A. Apostolico and R. Giancarlo. The Boyer-Moore-Galil string searching strategies revisited. SIAM J. Comput., 15(1):98–105, 1986. [AKC03] M. Ahmed, M. Kaykobad, and R. A. Chowdhury. A new string matching algorithm. Int. J. Comput. Math., 80(7):825–834, 2003. C. Allauzen and M. Raffinot. Simple optimal string matching algorithm. J. Algorithms, 36(1):102–116, 2000. [BBE+ 83] A. Blumer, J. Blumer, A. Ehrenfeucht, D. Haussler, and R. McConnel. Linear size finite automata for the set of all subwords of a word: an outline of results. Bul l. Eur. Assoc. Theor. Comput. Sci., 21:12–20, 1983. [BBE+ 85] A. Blumer, J. Blumer, A. Ehrenfeucht, D. Haussler, M. T. Chen, and J. Seiferas. The smallest automaton recognizing the subwords of a text. Theor. Comput. Sci., 40(1):31–55, 1985. R. S. Boyer and J. S. Moore. A fast string searching algorithm. Commun. ACM, 20(10):762–772, 1977. T. Berry and S. Ravindran. A fast string matching algorithm and exper- imental results. In J. Holub and M. Sim´anek, editors, Proceedings of the Prague Stringology Club Workshop ’99, pages 16–28, Czech Technical Uni- versity, Prague, Czech Republic, 1999. Collaborative Report DC–99–05. R. Baeza-Yates and G. H. Gonnet. A new approach to text searching. Commun. ACM, 35(10):74–82, 1992. R. A. Baeza-Yates and M. R´egnier. Average running time of the Boyer- Moore-Horspool algorithm. Theor. Comput. Sci., 92(1):19–31, 1992. [CCG+ 94] M. Crochemore, A. Czuma j, L. G¸asieniec, S. Jarominek, T. Lecroq, W. Plandowski, and W. Rytter. Speeding up two string matching al- gorithms. Algorithmica, 12(4/5):247–267, 1994. D. Cantone and S. Faro. Fast-Search: a new efficient variant of the Boyer- Moore string matching algorithm. In WEA 2003, volume 2647 of Lecture Notes in Computer Science, pages 247–267. Springer-Verlag, Berlin, 2003. D. Cantone and S. Faro. Searching for a substring with constant extra- space complexity. In P. Ferragina and R. Grossi, editors, Proc. of Third International Conference on Fun with algorithms, pages 118–131, 2004. D. Cantone and S. Faro. Fast-Search Algorithms: New Efficient Variants of the Boyer-Moore Pattern-Matching Algorithm. J. Autom. Lang. Comb., 10(5/6):589–608, 2005. [CFG10a] D. Cantone, S. Faro, and E. Giaquinta. Bit-(parallelism)2 : Getting to the next level of parallelism. In Paolo Boldi and Luisa Gargano, editors, Fun with Algorithms, volume 6099 of Lecture Notes in Computer Science, pages 166–177. Springer-Verlag, Berlin, 2010. [CFG10b] D. Cantone, S. Faro, and E. Giaquinta. A compact representation of nonde- terministic (suffix) automata for the bit-parallel approach. In A. Amir and L. Parida, editors, Combinatorial Pattern Matching, volume 6129 of Lec- ture Notes in Computer Science, pages 288–298. Springer-Verlag, Berlin, 2010. M. Crochemore and T. Lecroq. A fast implementation of the Boyer-Moore string matching algorithm. manuscript, 2008. C. Charras, T. Lecroq, and J.D. Pehoushek. A very fast string matching algorithm for small alphabets and long patterns. In M. Farach-Colton, editor, Proceedings of the 9th Annual Symposium on Combinatorial Pattern Matching, number 1448 in Lecture Notes in Computer Science, pages 55– 64, Piscataway, NJ, 1998. Springer-Verlag, Berlin. [CL08] [CLP98] 20 Simone Faro and Thierry Lecroq [FG05] [FJS07] [FL08] [Fre09] [Cro85] [Cro92] [DC09] [CP91] [CR94] [Col91] [Col94] [CLRS01] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. MIT Press, second edition, 2001. L. Colussi. Correctness and efficiency of the pattern matching algorithms. Inf. Comput., 95(2):225–251, 1991. L. Colussi. Fastest pattern matching in strings. J. Algorithms, 16(2):163– 189, 1994. M. Crochemore and D. Perrin. Two-way string-matching. J. Assoc. Com- put. Mach., 38(3):651–675, 1991. M. Crochemore and W. Rytter. Text algorithms. Oxford University Press, 1994. M. Crochemore. Optimal factor transducers. In A. Apostolico and Z. Galil, editors, Combinatorial Algorithms on Words, volume 12 of NATO Ad- vanced Science Institutes, Series F, pages 31–44. Springer-Verlag, Berlin, 1985. M. Crochemore. String-matching on ordered alphabets. Theor. Comput. Sci., 92(1):33–47, 1992. S. Deusdado and P. Carvalho. GRASPm: an efficient algorithm for exact pattern-matching in genomic sequences. Int. J. Bioinformatics Res. Appl., 5(4):385–401, 2009. [DHPT09] B. Durian, J. Holub, H. Peltola, and J. Tarhio. Tuning BNDM with q- grams. In I. Finocchi and J. Hershberger, editors, Proceedings of the Work- shop on Algorithm Engineering and Experiments, ALENEX 2009, pages 29–37, New York, New York, USA, 2009. SIAM. K. Fredriksson and S. Grabowski. Practical and optimal string matching. In M. P. Consens and G. Navarro, editors, SPIRE, volume 3772 of Lecture Notes in Computer Science, pages 376–387. Springer-Verlag, Berlin, 2005. F. Franek, C. G. Jennings, and W. F. Smyth. A simple fast hybrid pattern- matching algorithm. J. Discret. Algorithms, 5(4):682–695, 2007. S. Faro and T. Lecroq. Efficient variants of the Backward-Oracle-Matching algorithm. In Jan Holub and Jan Zd´arek, editors, Proceedings of the Prague Stringology Conference 2008, pages 146–160, Czech Technical University in Prague, Czech Republic, 2008. K. Fredriksson. Succinct backward-DAWG-matching. J. Exp. Algorith- mics, 13:1.8–1.26, 2009. [FYM09] H. Fan, N. Yao, and H. Ma. Fast variants of the backward-oracle-marching algorithm. In Proceedings of the 2009 Fourth International Conference on Internet Computing for Science and Engineering, ICICSE ’09, pages 56–59, Washington, DC, USA, 2009. IEEE Computer Society. Z. Galil and R. Giancarlo. On the exact complexity of string matching: upper bounds. SIAM J. Comput., 21(3):407–437, 1992. Z. Galil and J. Seiferas. Time-space optimal string matching. J. Comput. Syst. Sci., 26(3):280–294, 1983. [HAKS+08] A. Hudaib, R. Al-Khalid, D. Suleiman, M. Itriq, and A. Al-Anani. A fast pattern matching algorithm with two sliding windows (TSW). J. Comput. Sci., 4(5):393–401, 2008. C. Hancart. Analyse exacte et en moyenne d’algorithmes de recherche d’un motif dans un texte. Th`ese de doctorat, Universit´e Paris 7, 1993. J. Holub and B. Durian. Talk: Fast variants of bit parallel approach to suffix automata. In The Second Haifa Annual International Stringology Research Workshop of the Israeli Science Foundation, http: // www. cri. haifa. ac. il/ events/ 2005/ string/ presentations/ Holub. pdf , 2005. L. He, B. Fang, and J. Sui. The wide window string matching algorithm. Theor. Comput. Sci., 332(1-3):391–404, 2005. R. N. Horspool. Practical fast searching in strings. Softw. Pract. Exp., 10(6):501–506, 1980. A. Hume and D. M. Sunday. Fast string searching. Softw. Pract. Exp., 21(11):1221–1248, 1991. [KMP77] D. E. Knuth, J. H. Morris, Jr, and V. R. Pratt. Fast pattern matching in strings. SIAM J. Comput., 6(1):323–350, 1977. [HFS05] [Han93] [GG92] [GS83] [Hor80] [HS91] [HD05] Exact String Matching: a Comprehensive Experimental Evaluation 21 [Kul09] [MP70] [Nav01] [Neb06] [KPT08] [KR87] [Kul08] [Lec92] [Lec07] Inf. Process. Lett., P. Kalsi, H. Peltola, and J. Tarhio. Comparison of exact string matching al- gorithms for biological sequences. In M. Elloumi, J. Kung, M. Linial, R. F. Murphy, K. Schneider, and C. Toma, editors, Proceedings of the Second International Conference on Bioinformatics Research and Development, BIRD’08, volume 13 of Communications in Computer and Information Science, pages 417–426, Vienna, Austria, 2008. Springer-Verlag, Berlin. R. M. Karp and M. O. Rabin. Efficient randomized pattern-matching algorithms. IBM J. Res. Dev., 31(2):249–260, 1987. M. Oguzhan Kulekci. A method to overcome computer word size limita- tion in bit-parallel pattern matching. In S.-H. Hong, H. Nagamochi, and T. Fukunaga, editors, Proceedings of the 19th International Symposium on Algorithms and Computation, ISAAC 2008, volume 5369 of Lecture Notes in Computer Science, pages 496–506, Gold Coast, Australia, 2008. Springer-Verlag, Berlin. M. Oguzhan Kulekci. Filter based fast matching of long patterns by using simd instructions. In Jan Holub and Jan Zd´arek, editors, Proceedings of the Prague Stringology Conference 2009, pages 118–128, Czech Technical University in Prague, Czech Republic, 2009. T. Lecroq. A variation on the Boyer-Moore algorithm. Theor. Comput. Sci., 92(1):119–144, 1992. T. Lecroq. Fast exact string matching algorithms. 102(6):229–235, 2007. [LWLL06] C. Liu, Y. Wang, D. Liu, and D. Li. Two improved single pattern matching algorithms. In ICAT Workshops, pages 419–422, Hangzhou, China, 2006. IEEE Computer Society. J. H. Morris, Jr and V. R. Pratt. A linear pattern-matching algorithm. Report 40, University of California, Berkeley, 1970. G. Navarro. NR-grep: a fast and flexible pattern-matching tool. Softw. Pract. Exp., 31(13):1265–1312, 2001. M. E. Nebel. Fast string matching by using probabilities: on an op- timal mismatch variant of Horspool’s algorithm. Theor. Comput. Sci., 359(1):329–343, 2006. G. Navarro and M. Raffinot. A bit-parallel approach to suffix automata: Fast extended string matching. Technical Report TR/DC–98–1, Depart- ment of Computer Science, University of Chile, 1998. G. Navarro and M. Raffinot. A bit-parallel approach to suffix automata: Fast extended string matching. In M. Farach-Colton, editor, Proceedings of the 9th Annual Symposium on Combinatorial Pattern Matching, number 1448 in Lecture Notes in Computer Science, pages 14–33, Piscataway, NJ, 1998. Springer-Verlag, Berlin. G. Navarro and M. Raffinot. Fast and flexible string matching by combin- ing bit-parallelism and suffix automata. ACM J. Experimental Algorith- mics, 5:4, 2000. H. Peltola and J. Tarhio. Alternative algorithms for bit-parallel string matching. In M. A. Nascimento, E. Silva de Moura, and A. L. Oliveira, editors, Proceedings of the 10th International Symposium on String Pro- cessing and Information Retrieval SPIRE’03, volume 2857 of Lecture Notes in Computer Science, pages 80–94, Manaus, Brazil, 2003. Springer-Verlag, Berlin. T. Raita. Tuning the Boyer-Moore-Horspool string searching algorithm. Softw. Pract. Exp., 22(10):879–884, 1992. S.S. Sheik, S.K. Aggarwal, A. Poddar, N. Balakrishnan, and K. Sekar. A fast pattern matching algorithm. J. Chem. Inf. Comput., 44:1251–1256, 2004. I. Simon. String matching algorithms and automata. In R. Baeza-Yates and N. Ziviani, editors, Proceedings of the 1st South American Workshop on String Processing, pages 151–157, Universidade Federal de Minas Gerais, Brazil, 1993. In M.A. Sustik and J.S. Moore. String searching over small alphabets. Technical Report TR-07-62, Department of Computer Sciences, University of Texas at Austin, 2007. [SAP+ 04] [NR00] [PT03] [NR98a] [NR98b] [Rai92] [Sim93] [SM07] 22 Simone Faro and Thierry Lecroq [Smi91] [Sun90] P. D. Smith. Experiments with a very fast substring search algorithm. Softw. Pract. Exp., 21(10):1065–1074, 1991. D. M. Sunday. A very fast substring search algorithm. Commun. ACM, 33(8):132–142, 1990. [TVL+ 06] R. Thathoo, A. Virmani, S. Sai Lakshmi, N. Balakrishnan, and K. Sekar. TVSBS: A fast exact pattern matching algorithm for biological sequences. J. Indian Acad. Sci., Current Sci., 91(1):47–53, 2006. A. C. Yao. The complexity of pattern matching for a random string. SIAM J. Comput., 8(3):368–387, 1979. R. F. Zhu and T. Takaoka. On improving the average case of the Boyer- Moore string matching algorithm. J. Inform. Process., 10(3):173–177, 1987. [ZZMY09] G. Zhang, E. Zhu, L. Mao, and M. Yin. A bit-parallel exact string matching algorithm for small alphabet. In X. Deng, J. E. Hopcroft, and J. Xue, editors, Proceedings of the Third International Workshop on Frontiers in Algorithmics, FAW 2009, Hefei, China, volume 5598 of Lecture Notes in Computer Science, pages 336–345. Springer-Verlag, Berlin, 2009. [Yao79] [ZT87]
1305.2108
1
1305
2013-05-09T14:40:06
On Advice Complexity of the k-server Problem under Sparse Metrics
[ "cs.DS" ]
We consider the k-server problem under the advice model of computation when the underlying metric space is sparse. On one side, we show that an advice of size {\Omega}(n) is required to obtain a 1-competitive algorithm for sequences of size n, even for the 2-server problem on a path metric of size N >= 5. Through another lower bound argument, we show that at least (n/2)(log {\alpha} - 1.22) bits of advice is required to obtain an optimal solution for metric spaces of treewidth {\alpha}, where 4 <= {\alpha} < 2k. On the other side, we introduce {\Theta}(1)-competitive algorithms for a wide range of sparse graphs, which require advice of (almost) linear size. Namely, we show that for graphs of size N and treewidth {\alpha}, there is an online algorithm which receives $O(n (log {\alpha} + log log N))$ bits of advice and optimally serves a sequence of length n. With a different argument, we show that if a graph admits a system of {\mu} collective tree (q,r)-spanners, then there is a (q+r)-competitive algorithm which receives O(n (log {\mu} + log log N)) bits of advice. Among other results, this gives a 3-competitive algorithm for planar graphs, provided with O(n log log N) bits of advice.
cs.DS
cs
On Advice Complexity of the k-server Problem under Sparse Metrics Sushmita Gupta1, Shahin Kamali2, and Alejandro L´opez-Ortiz2 1 University of Southern Denmark, Odense, Denmark 2 Cheriton School of Computer Science, University of Waterloo, Ontario, Canada Abstract. We consider the k-Server problem under the advice model of computation when the underlying metric space is sparse. On one side, we show that an advice of size Ω(n) is required to obtain a 1-competitive algorithm for sequences of size n, even for the 2-server problem on a path metric of size N ≥ 5. Through another lower bound argument, we 2 (log α − 1.22) bits of advice is required to obtain show that at least n an optimal solution3 for metric spaces of treewidth α, where 4 ≤ α < 2k. On the other side, we introduce Θ(1)-competitive algorithms for a wide range of sparse graphs, which require advice of (almost) linear size. Namely, we show that for graphs of size N and treewidth α, there is an online algorithm which receives O(n(log α+log log N )) bits of advice and optimally serves a sequence of length n. With a different argument, we show that if a graph admits a system of µ collective tree (q, r)- spanners, then there is a (q + r)-competitive algorithm which receives O(n(log µ + log log N )) bits of advice. Among other results, this gives a 3-competitive algorithm for planar graphs, provided with O(n log log N ) bits of advice. 1 Introduction Online algorithms have been extensively studied in the last few decades. In the standard setting, the input to an online algorithm is a sequence of requests, which should be answered sequentially. To answer each request, the algorithm has to take an irreversible decision without looking at the incoming requests. For minimization problems, such a decision involves a cost and the goal is to minimize the total cost. The standard method for analysis of online algorithms is the competitive analysis, which compares an online algorithm with an optimal offline algorithm, OPT . The competitive ratio of an online algorithm4 ALG is defined as the maxi- mum ratio between the cost of ALG for serving a sequence and the cost of OPT for serving the same sequence, within an additive constant factor. Although the competitive analysis is accepted as the main tool for analysis of online algorithms, its limitations have been known since its introduction; the prime critique being that it is not a good predictor of commonly observed be- haviour. Competitive analysis' limitations go to the very heart of the technique 3 We use log n to denote log2(n). 4 In this paper we only consider deterministic algorithms. itself. Inputs adversarially produced to draw out the worst performance of a particular algorithm are not commonplace in real life applications. Therefore, in essence competitive analysis mostly measures the benefit of knowing the future, and not the true difficulty of instances. From the perspective of an online algo- rithm, the algorithm is overcharged for its complete lack of knowledge about the future. Advice complexity quantifies this gap in information that gives OPT an unassailable advantage over any online strategy. Under the advice model for online algorithms [14,6], the input sequence σ = (cid:104)r1 . . . rn(cid:105) is accompanied by b bits of advice recorded on an advice tape B. For answering the request ri, the algorithm takes an irreversible decision which is a function of r1, . . . , ri and the advice provided on B. The advice complexity of an online problem is the minimum number of bits which is required to opti- mally solve any instance of the problem. In the context of the communication complexity, it is desirable to provide an advice of small size, while achieving high quality solutions. We are interested in the advice complexity of the k-Server problem, as well as the relationship between the size of advice and the competitive ratio of online algorithms. To this end, we study the problem for a wide variety of sparse graphs. 1.1 Preliminaries An instance of the k-Server problem includes a metric space M , k mobile servers, and a request sequence σ. The metric space can be modelled as an undirected, weighted graph of size N > k (we interchangeably use terms 'metric space' and 'graph'). Each request in the input sequence σ denotes a vertex of M , and an online algorithm should move one of the servers to the requested vertex to serve the request. The cost of the algorithm is defined as the total distance moved by all k servers over σ. For any graph G = (V, E), a tree decomposition of G with width α is a pair ({Xi(cid:107)i ∈ I} , T ) where {Xi(cid:107)i ∈ I} is a family of subsets of V (bags), and T is a rooted tree whose nodes are the subsets Xi such that -- (cid:83) i∈I Xi = V and max i∈I Xi = α+1. -- for all edges (v, w) ∈ E, there exists an i ∈ I with v ∈ Xi and w ∈ Xi. -- for all i, j, k ∈ I: if Xj is on the path from Xi to Xk in T , then Xi∩Xk ⊆ Xj. The treewidth of a graph G is the minimum width among all tree decompo- sitions of G. Informally speaking, the tree decomposition is a mapping a graph to a tree so that the vertices associated to each node (bag) of the tree are close to each other, and the treewidth measures how close the graph is to such tree. We say that a graph G = (V, E) admits a system of µ collective tree (q, r)- spanners if there is a set T (G) of at most µ spanning trees of G such that for any two vertices x, y of G, there exists a spanning tree T ∈ T (G) such that dT (x, y) ≤ q × dG(x, y) + r. For the ease of notation, we assume k denotes the number of servers, N , the size of metric space (graph), n, the length of input sequence, and α, the treewidth of the metric space. 1.2 Existing Results The advice model for the analysis of the online algorithm was first proposed in [14]. Under that model, each request is accompanied by an advice of fixed length. A slight variation of the model was proposed in [7,6], which assumes that the on- line algorithm has access to an advice tape. At any time step, the algorithm may refer to the tape and read any number of advice bits. The advice-on-tape model has an advantage that enables algorithms to use sublinear advice (an advan- tage over the original model). This model has been used to analyze the advice complexity of many online problems, which includes paging [7,18,20], disjoint path allocation [7], job shop scheduling [7,20], k-server [6], knapsack [8], bipar- tite graph coloring [4], online coloring of paths [16], set cover [19,5], maximum clique [5], and graph exploration [11]. In this paper, we adopt this definition of the advice model. For the k-Server problem on general metrics, there is an algorithm which achieves a competitive ratio of kO(1/b) for b ≤ k, when provided with bn bits of advice [14]. This ratio was later improved to 2(cid:100)(cid:100)log k(cid:101)/(b − 2)(cid:101) in [6], and then to (cid:100)(cid:100)log k(cid:101)/(b − 2)(cid:101) in [22]. Comparing these results with the lower bound k for the competitive ratio of any online algorithm [21], one can see how an advice of linear size can dramatically improve the competitive ratio. Since the introduction of the k-Server problem, there has been an interest in studying the problem under specific metric spaces. These metric spaces include trees [10], metric spaces with k +2 points [1], Manhattan space [2], the Euclidean space [2], and the cross polytope space (a generalization of a uniform space) [3]. For trees, it is known that the competitive ratio of any online algorithm is at least k, while there are online algorithms which achieve this ratio [10]. Under the advice model, the k-Server problem has been studied when the metric space is the Euclidean plane, and an algorithm with constant competitive ratio is presented, which receives n bits of advice for sequences of length n [6]. In [22], tree metric spaces are considered and a 1-competitive algorithm is introduced which receives 2n + 2(cid:100)log(p + 2)(cid:101)n bits of advice, where p is the caterpillar dimension of the tree. There are trees for which p is as large as (cid:100)log N(cid:101). Thus, the 1-competitive algorithm of [22] needs roughly 2(cid:100)n log log N(cid:101) bits of advice. Also in [22], it is proved that O(n) bits of advice are sufficient to obtain an optimal algorithm for paths. 1.3 Contribution Our first result implies that a sublinear advice does not suffice to provide close- to-optimal solution, even if we restrict the problem to 2-server problem on paths of size N ≥ 5. Precisely, we show that Ω(n) bits of advice are required to obtain a c-competitive algorithm for any value of c ≤ 5/4 −  ( is an arbitrary small constant). Since there is a 1-competitive algorithm which receives O(n) bits of advice for paths [22], we conclude that Θ(n) bits of advice are necessary and sufficient to obtain a 1-competitive algorithm for these metrics. Through another lower bound argument, we show that any online algorithm requires an advice of size at least n 4 ≤ α < 2k. 2 (log α− 1.22) bits to be optimal on a metric of treewidth α, where On the positive side, we introduce an online algorithm which optimally serves any input sequence, when provided O(n(log α + log log N )) bits of advice. For graphs with constant treewidth, the advice size is almost linear. Considering that an advice of linear size is required for 1-competitive algorithms (our first lower bound), the algorithm has an advice of nearly optimal size. For graphs with treewidth α ∈ Ω(lg N ) the advice size is O(n log α), which is asymptotically 2 (log α − 1.22) bits are required to be tight when 4 ≤ α < 2k, because at least n optimal in this case (our second lower bound). We provide another algorithm that achieves a competitive ratio of at most q+ r, when the metric space admits a system of µ collective tree (q, r)-spanners. This algorithm receives O(n(log µ + log log N )) bits of advice. This yields competitive algorithms for a large family of graphs, e.g., a 3-competitive algorithm for planar graphs, which reads O(n(log log N )) bits of advice. 2 Lower Bounds 2.1 2-server Problem on Path Metric Spaces In this section, we show that an advice of sublinear size does not suffice to achieve close-to-optimal solutions, even for the 2-server problem on a path metric space of size N ≥ 5. Without loss of generality, we only consider online algorithms which are lazy in the sense that they move only one server at the time of serving a request. It is not hard to see that any online algorithm can be converted to a lazy algorithm without an increase in its cost. Hence, a lower bound for the performance of lazy algorithms applies to all online algorithms. In the reminder of this section, the term online algorithm means a lazy algorithm. Consider a path of size N ≥ 5 which is horizontally aligned and the vertices are indexed from 1 to N . Assume that the servers are initially positioned at vertices 2 and 4. We build a set of instances of the problem, so that each instance is formed by m = n/7 round s of requests. Each round is defined by requests to vertices (3, 15, 3, 2, 4, 2, 4), where the second request of a round can be either to vertex 1 or vertex 5. Each round ends with consecutive requests to vertices 2 and 4. So, it is reasonable to move servers to these vertices for serving the last requests of each round. This intuition is formalized in the following lemma. Lemma 1. Consider an algorithm A that serves an instance of the problem as defined above. There is another algorithm A(cid:48) with a cost which is not more than that of A, for which the servers are positioned at vertices 2 and 4 before starting to serve each round. Proof. Consider the first round Rt such that A does not have a server positioned at vertex 2 before serving the requests in Rt (since the last request of the previous round has been to vertex 4, there is necessarily a vertex located at vertex 4). This implies that the last four requests of the previous round Rt−1 (to vertices 2, 4, 2, 4) are served by the same server s1. So, A pays a cost of at least 6 for serving these requests. Consider an algorithm A(cid:48), which moves the same servers as A does for serving all requests before the last four requests of Rt−1. To serve the last four requests of Rt−1, A(cid:48) moves the servers to vertices 2 and 4. This requires a cost of at most 3 (The worst case happens when the servers are positioned at 4 and 5 before the first request to 2; in this case the algorithm pays a cost of 2 to move the left server to position 2 and a cost of 1 to move the right server to position 4 on the next request). Hence, A(cid:48) pays a cost of at most three for the last four requests in Rt−1 and, when compared to A, saves a cost of at least 3 units in round Rt−1. At the beginning of round Rt, the servers of A are positioned at 4 and x (x /∈ {2, 4}), and the servers of A(cid:48) are at 2 and 4. In future rounds, A(cid:48) moves the server positioned at 2 (resp. 4) in the same way that A moves the server position at x (resp. 4). The total cost would be the same for both algorithms, except that the cost for the first request which is served by the server positioned at x in A might be at most 3 units more when served by the server positioned at vertex 2 in A(cid:48). This is because the distance from vertex 2 to any other vertex is at most 3. To summarize, when compared to A, A(cid:48) saves a cost of at least 3 units on the requests in the Rt−1 and pays an extra cost of at most 3 for the rounds after Rt−1. Hence, the cost of A(cid:48) is not more than that of A. To prove the lemma, it suffices apply the above procedure on all rounds for which there is no server at position 2 at the beginning of the round. The result would be an algorithm which has servers located at positions 2 and 4 before the start of any round. (cid:117)(cid:116) According to the above lemma, to provide a lower bound on the performance of online algorithms, we can consider only those algorithms which keep servers at positions 2 and 4 before each round. For any input sequence, we say a round Rt has type 0 if the round is formed by requests to vertices (3, 1, 3, 2, 4, 2, 4) and has type 1 otherwise, i.e., when it is formed by requests to vertices (3, 5, 3, 2, 4, 2, 4). The first request of a round is to vertex 3. Assume the second request is to vertex 5, i.e., the round has type 1. An algorithm can move the left vertex sl positioned at 2 to serve the first request (to vertex 3) and the right server sr positioned at 4 to serve the second request (to vertex 5). For serving other requests of the round, the algorithm can move the servers to their initial positions, and pay a total cost of 4 for the round (see Figure 1(a)). Note that this is the minimum cost that an algorithm can pay for a round. This is because there are four requests to distinct vertices and the last two are request to the initial positions of the servers (i.e., vertices 2 and 4). Now assume that the algorithm moves the right vertex sr to serve the first request (to vertex 3). The algorithm has to serve the second request (to vertex 5) also with sr. The third request (to vertex 3) can be served by any of the servers. Regardless, the cost of the algorithm will not be less than 6 for the round (see Figure 1(b)). With a symmetric argument, in case the second request is to vertex 1 (i.e., the round has type 0), if an algorithm moves the right server to serve the first request it can pay a total cost of 4, and if it moves the left server for the first request, it pays a cost of at least 6 for the round. (a) In case of a right guess for the type of a round, the algorithm can pay a cost of 4. (b) In case of a wrong guess for the type of a round, the algorithm pays a cost of at least 6. Fig. 1. The cost of an algorithm for a round of type 1, (3, 5, 3, 2, 4, 2, 4). The servers are initially located at 2 and 4. i.e., request to vertices In other words, an algorithm should 'guess' the type of a round at the time of serving the first request of the round. In case it makes a right guess, it can pay a total cost of 4 for that round, and if it makes a wrong guess, it pays a cost of at least 6. This relates the problem to the Binary String Guessing Problem. Definition 1 ([14,5]). The Binary String Guessing Problem with known his- tory (2-SGKH) is the following online problem. The input is a bitstring of size n, and the bits are revealed one by one. For each bit bt, the online algorithm A must guess if it is a 0 or a 1. After the algorithm has made a guess, the value of bt is revealed to the algorithm. Lemma 2 ([5]). On an input of length m, any deterministic algorithm for 2- SGKH that is guaranteed to guess correctly on more than αm bits, for 1/2 ≤ α < 1, needs to read at least (1 + (1 − α) log(1 − α) + α log α)m bits of advice. We reduce the 2-SGKH problem to the 2-server problem on paths. Lemma 3. If there is a 2-server algorithm with cost at most γn (γ ≥ 4/7) for an instance of length n (as defined earlier), then there is a 2-SKGH algorithm which guesses at least 6−7γ 2 m bits correctly for any input bit string of size m = n/7. Proof. Let B denote a bit string of length m = n/7, which is the input for the 2-SKGH problem. Consider the instance of the 2-server problem in which the types of rounds are defined by B. Precisely, the t'th round has type 0 if the t'th bit of B is 0, and has type 1 otherwise. We run the 2-server algorithm on such an instance. At the time of serving the first request of the t'th round, the 2-server algorithm guesses the type of round t by moving the left or right server. In particular, it guesses the type of the round to be 0 if it moves the right server for the first request, and 1, otherwise. Define a 2-SGKH algorithm which performs according to the 2-server algorithm, i.e., it guesses the t'th bit of B as being 0 (resp. 1) if the 2-server algorithm guesses the t'th round as having type 0 (resp. 1). As mentioned earlier, the 2-server algorithm pays a cost of 4 for the round for each right guess, and pays cost of at least 6 for each wrong guess. So, the cost of the algorithm is at least 4βm + 6(1− β)m = (6− 2β)m, in which βm is the number of correct guesses (β ≤ 1). Consequently, if an algorithm has cost 14532slsr14532slsr14532slsr14532slsr14532slsr14532slsr at most equal to this value, it correctly guesses the types of at least βm rounds, i.e., it correctly guesses at least βm bits of a bit string of length m. Defining γ (cid:117)(cid:116) as (6 − 2β)/7 completes the proof. Lemmas 2 and 3 give the following theorem. Theorem 1. On input of length n, any deterministic algorithm for the 2-server problem which has a competitive ratio smaller than τ (1 < τ < 5/4), needs to read at least (1 + (2τ − 2) log(2τ − 2) + (3 − 2τ ) log(3 − 2τ ))n/7 bits of advice, even if the metric space is restricted to being a path of size N ≥ 5. Proof. There is an offline 2-server algorithm which pays a cost of 4 for each round and consequently pays a total cost of 4m = 4n/7. Hence, in order to have a competitive ratio of τ , the cost of an algorithm should be at most 4τ n/7. According to Lemma 3, this requires the existence of a 2-SKGH algorithm which correctly guesses at least (3 − 2τ )m bits of a bit string of length m. By Lemma 2, this needs reading at least (1 + (1− (3− 2τ )) log(1− (3− 2τ )) + (3− 2τ ) log(3− 2τ ))m = (1 + (2τ − 2) log(2τ − 2) + (3 − 2τ ) log(3 − 2τ ))n/7 bits of advice. Note that 3 − 2τ is in the range required by the lemma when 1 < τ < 5/4. (cid:117)(cid:116) For a competitive ratio of τ = 5/4, the formula in Theorem 1 takes the value 0 and thus does not provide a non-trivial bound. However, for doing strictly better than 5/4, a linear number of bits of advice is required. For example, to achieve a competitive ratio of τ = 6/5, at least .007262n bits of advice are needed, and for the improved ratio of τ = 7/6, at least .020425n bits of advice are needed. To achieve a 1-competitive algorithm, n/7 bits of advice are required. 2.2 Metrics with Small Treewidth We show that there are instances of the k-Server problem in a metric space with 2 (log α− 1.22) bits treewidth α, for which any online algorithm requires at least n of advice to perform optimally. Our construction is based on the one described in [6], where a lower bound for a general metric space is provided. We introduce units graphs and module graphs as follows. A γ-unit graph is a bipartite graph G = (U ∪ W, E) where U = {u1, . . . , uγ} contains γ vertices, and W contains 2γ − 1 vertices each representing a proper subset of U . There is an edge between two vertices u ∈ U and w ∈ W iff u /∈ Set(w), where Set(w) denotes the set associated with a vertex w ∈ W . Let Bi ⊆ W denote the set of vertices of W whose associate sets have size i. i.e., for w ∈ Bi we have Set(w) = i. A valid request sequence is defined as (cid:104)x0, x1, . . . , xγ−1(cid:105) so that for each i, xi ∈ Bi and Set(xi) ⊆ Set(xi+1). In other words, a valid sequence starts with a request to the vertex associated with the empty set, and with each step one element is added to get a larger set defining the next request. With this definition, one can associate every input sequence I with a unique permutation π of set {1, 2, . . . , γ}. A γ-module graph G includes two γ-unit graphs G1 = (U1 ∪ W1, E1) and G2 = (U2 ∪ W2, E2). In such a graph, those vertices in W1 which represent sets Fig. 2. A γ-module graph and a tree decomposition of it with treewidth 2γ. G1 and G2 are the unit graphs involved in construction of the module graph. of size i are connected to the (i + 1)'th vertex of U2; the vertices of W2 and U1 are connected in the same manner (see Figure 2). Consider an instance of the k-Server problem defined on a k-module graph, where initially all servers are located at the vertices of U1. A valid sequence for the module graph is defined by repetition of rounds of requests. Each round starts with a valid sequence for G1 denoted by π1, followed by k requests to distinct vertices of U2, a valid sequence for G2, and k requests to distinct vertices of U1. It can be verified that there is a unique optimal solution for serving any valid sequence on G, and consequently a separate advice string is required for each sequence [6]. Since there are (k!)(n/(2k)) valid sequences of length n, at least (n/(2k)) log(k!) ≥ n(log k − log e)/2 bits of advice are required to separate all valid sequences. The following lemma implies that the treewidth of the graphs used in the above construction is at most 2k. Lemma 4. Any γ-module graph has a tree decomposition of width 2γ. Proof. Let G1 = (U1∪W1, E1) and G2 = (U2∪W2, E2) be the unit graphs which define the γ-module graph. Define a tree decomposition as follows. Consider 2 × 2k bags so that each bag contains all vertices from U1 and U2, and exactly one vertex from W1 or W2. Any tree which spans all these 2 × 2k bags is a valid tree decomposition (See Figure 2). Moreover, there are exactly 2γ + 1 vertices (cid:117)(cid:116) in each bag which completes the proof. For metrics with treewidth α ≥ 2k, the lower bound of n(log k − log e)/2 is tight, as n log k bits of advice are sufficient to serve each sequence optimally (by simply indicating the server that OPT would move to serve each request). In what follows, we consider metric spaces with treewidth α such that 4 ≤ α ≤ 2k. Assume that α is an even integer and we have k = mα/2 for some positive integer m. Consider a metric space Gb defined by a set of γ-modules where γ = α/2. There are k/γ = m such modules in Gb. Let M 1, . . . , M m denote these modules, and let Gi 2, E2) denote the unit graphs involved in the construction of M i (i ≤ m). For each module M i, select exactly one vertex 1 ∪ W i 2 ∪ W i 1 = (U i 1, E1), Gi 2 = (U i Ø{1}{2}{1, 2}{1, 2, 3}{1, 2, ... , γ-1}.........123γ...U1W1G1Ø'{1'}{2'}{1', 2'}{1', 2', 3'}{1', 2', ... , (γ-1)'}.........1'2'3'γ'...U2W2G2Ø,1, 2, ... , γ,1', 2', ... , γ'{1},1, 2, ... , γ,1', 2', ... , γ'{1, 2, ... , γ-1},1, 2, ... , γ,1', 2', ... , γ'{2},1, 2, ... , γ,1', 2', ... , γ'...Ø',1, 2, ... , γ,1', 2', ... , γ'{1'},1, 2, ... , γ,1', 2', ... , γ'{1', 2', ... , (γ-1)'},1, 2, ... , γ,1', 2', ... , γ'{2'},1, 2, ... , γ,1', 2', ... , γ'... Fig. 3. The metric space Gb and a tree decomposition associated with it. The source s is connected to the selected vertex aj 1 of module M j. from U i Gb a connected graph (see Figure 3). 1, and connect all of the selected vertices to a common source. This makes Lemma 5. The metric space Gb has a tree decomposition of width α. Proof. By Lemma 4, each module has a tree decomposition of width α. Let T i denote the tree associated with the decomposition of the ith module. For any tree T i, consider a bag Bi of size 2 which contains the source s and the other endpoint of the edge between s and T i. Connect Bi to an arbitrary bag of T i. Add m− 1 arbitrary edges between all Bis to form a connected tree. Such a tree (cid:117)(cid:116) represents a valid tree decomposition of Gb with width α (see Figure 3). Since there are m modules and in the i'th module U i 1 contains γ vertices, there are m× γ = k vertices in all of the U i 1s. Assume that the k servers are ini- tially placed at separate nodes in the U i 1s. A valid sequence for Gb is defined by a sequence of rounds of requests in which each round has the following structure: f (π1 1, . . . , πm 1 ), (b1 1, . . . , bm 1 ), . . . , (b1 γ, . . . , bm γ ), f (π1 2, . . . , πm 2 ), (a1 1, . . . , am 1 ), . . . , (a1 γ, . . . , am γ ) Here, f is a function that combines the requests from m permutations. Let γ(cid:105) (π1, . . . , πm) denote m permutations such that πi contains γ requests (cid:104)ri 1, . . . , ri which defines a permutation in the module M i. Thus, f gives a sequence of length m × γ starting with m requests to rj 1s, followed by m requests to rj 2s, and so on. For each j, (1 ≤ j ≤ γ) we have fixed orderings on the vertices such that (a1 2 ). With this definition, when a valid sequence of Gb is projected to the requests arising in a module M , the resulting subsequence is a valid sequence for M . j ) ∈ (U 1 j ) ∈ (U 1 1 , . . . , U m 1 ) and (b1 2 , . . . , U m j , . . . , am j , . . . , bm Source (s)...U1a111W11...U2b11b1γ1W21M1a1γ...U1a212W12...U2b21b2γ2W22M2a2γ...U1am1mW1m...U2bm1bmγmW2mMmamγa11, sa21, sTmam1,.........am1, sB1B2BmT2a21,.........T1a11,......... Lemma 6. There is a unique optimal solution to serve a valid sequence on the metric space Gb. Also, each valid sequence requires a distinct advice string in order to be served optimally. 2), PERM moves a server from U i 1 (resp. U i 1 (resp. πi Proof. We present an algorithm PERM and show that its solution is the unique optimal solution for serving any valid sequence. To serve a request in W i 1 (resp. W i 2) to act according to the corre- sponding permutation πi 2). To be precise, to serve a request xi (for 0 ≤ i ≤ γ − 2) it moves the server positioned at Set(xi+1) \ Set(xi), and thus leaving a unique choice for the last request xγ−1. To serve a request ai t in U i 1 2), PERM moves the single server which is located at an adjacent node (resp. U i in W i 2 (resp. W i There are γ servers initially located in each γ module, and PERM never moves a server from one module to another (no server passes the common source). To show that the solution of PERM is the unique optimal for serving any valid sequence, it is sufficient to show the following conditions: 1). Therefore, PERM incurs a cost of one for each request. -- No optimal algorithm moves a server from one module to another. -- Among all algorithms which do not move a server between modules, PERM provides the unique optimal solution. Assume that there is an optimal algorithm ALG which moves a server from one module to another. So at some point after serving the t'th request, there is a γ-module M which has γ + p servers stationed on it, for some p ≥ 1. We show that the cost incurred by ALG for serving the requests of M in each round after the t'th request is lower bounded by 4γ − p. Note that PERM incurs a total cost of 4γ in each round for the requests of any module. Assume that the cost incurred by ALG for serving a round in M is strictly less than 4γ − p. This implies that strictly more than p requests incur no cost in that round. Since the same vertex is not requested twice in the same round, more than p servers must not be moved in that round. So there is at least one server s which is moved by PERM and not by ALG. We show that moving s in the same way as PERM does decreases the cost for ALG. Assume that ALG keeps s at some vertex in U1 of M . Thus, PERM moves s from U1 to serve a request in W1, and then moves it to serve some request in U2, followed by a move to serve a request in W2, and finally a move to serve a request in U1. Each of these moves cost one for PERM. However, each of the involved requests imposes a cost of 2 for ALG since it has to use some server to serve at least two requests arising in W1 in that round, thus, requiring a move via some vertex in U1 or U2. The same holds for the requests in U1, U2 and W2. We can make similar arguments when ALG keeps s at some vertex in W1 or U2 of M , and conclude that ALG saves a cost of x by not moving s in a round while incurring a cost of 2x in the remainder of the round. Hence, ALG must incur a cost of at least 4γ − p for requests arising in M . Let M(cid:48) be a γ module in which ALG has stationed γ − q, (q ≥ 1) servers after serving the t'th request. We show that the cost incurred by ALG to serve the requests from M(cid:48) in each round starting after the t'th request is lower bounded by 4γ + 8q. Similar to the previous argument, since at least one server is missing, for some request(s) arising in W1, ALG has to use server(s) already located in W1. So instead of incurring a cost of 1 as PERM, ALG incurs a cost of 2 for each of those requests (the same holds for requests in U1,U2, and W2). To conclude, if ALG moves x servers between modules, compared to PERM, it saves at most x units of cost on the requests arising in the modules which receive extra servers, while it has to pay at least an extra 8x units for the requests in modules which lose their servers. This is in addition to the cost involved in moving servers from one module to another. We conclude that an optimal algorithm never moves servers between modules -condition 1. Inside each module, PERM acts the same as the unique optimal algorithm presented in [6]. Recall that the requests projected to each module form a valid sequence for that module, and can be treated independently (since servers do not move between modules in an optimal scheme). Hence, both conditions 1 and 2 are met, and PERM is the unique optimal for serving any valid request in Gb. Next, we show that each valid sequence requires a distinct advice string. Assume that two valid sequences σ and σ(cid:48) differ for the first time at the t'th request. Note that two valid sequences of Gb can only differ on the requests which define the permutations. Hence, t should be a request belonging to πi 1 or πi 2 of some module M i, i.e, one of the permutations representing a valid subsequence for the unit graphs defining M i. Let t0 < t denote the index of the previous request to an item in the same unit graph (that is, the previous request in the same permutation). While serving the request indexed t0 in the two sequences, an optimal algorithm will move different servers in anticipation of the t'th request. Hence an online algorithm should receive different advice (cid:117)(cid:116) strings to perform optimally for both sequences. To find a lower bound for the length of the advice string, we count the number of distinct valid sequences for the metric space Gb. In each round there are (γ!)2 valid sequences for each γ-module. Since there are m such modules, there are (γ!)2m possibilities for each round. A valid sequence of length n involves n/(4γm) rounds; hence there are (γ!)n/(2γ) valid sequences of length n. Each of these sequences need a distinct advice string. Hence, at least log((γ!)n/(2γ)) ≥ (n/2) log(γ/e) = (n/2) log(α/(2e)) bits of advice are required to serve a valid sequence optimally. This proves the following theorem. Theorem 2. Consider the k-Server problem on a metric space of treewidth α, 2 (log α − 1.22) bits of advice are required to such that 4 ≤ α < 2k. At least n optimally serve an input sequence of length n. 3 Upper Bounds 3.1 Graphs with Small Treewidth We introduce an algorithm called Graph-Path-Cover, denoted by GPC, to show that O(n(log α + log log N )) bits of advice are sufficient to optimally serve a sequence of length n on any metric space of treewidth α. We start with the following essential lemma. Lemma 7. Let T be a tree decomposition of a graph G. Also, let x and y be two nodes of G and P = (x = p0, p1, . . . pl−1, y = pl) be the shortest path between x and y. Let X and Y be two bags in T which respectively contain x and y. Any bag on the unique path between X and Y in T contains at least one node pi (0 ≤ i ≤ l) from P . Proof. By the definition of the tree decomposition, each vertex v of G is listed in the bags of a contiguous subtree Tv of T . Consider two vertices pi and pi+1 in P . Since pi and pi+1 are neighbors, there is a bag in T which contains both of them. So the union of the subtrees Tpi and Tpi+1 forms a (connected) subtree of T . Similarly, the union of all the subtrees of the nodes p0, . . . , pl form a (connected) subtree in T . Such a subtree contain X and Y and hence, any bag on the path between them. So any bag between X and Y contain at least one (cid:117)(cid:116) vertex pi of P . Similar to the Path-Cover algorithm introduced for trees in [22], GPC moves its servers on the same trajectories as OPT moves its. Suppose that OPT uses a server si to serve the requests(cid:2)rai,1 , . . . , rai,ni (cid:3) (i ≤ k, ni ≤ n). So, si is moved on the unique path from its initial position to rai,1, and then from rai,1 to rai,2 , and so on. Algorithm Path-Cover tends to move si on the same path as OPT . For any node v in G, GPC treats one of the bags which contains v as the representative bag of v. Moreover, it assumes an ordering of the the nodes in each bag. Each node in G is addressed via its representative bag, and its index among the nodes of that bag. A server si, located at a vertex v of G, is addressed via a bag which contains v (not necessarily the representative bag of v) and the index of v in that bag. Note that while there may be a unique way to address a node, there might be several different ways to address a server. Assume that for serving a request y, OPT moves a server si from a node x to y in G. Let X and Y be respectively the representative bags of x and y, and Z be the least common ancestor of X and Y in T . By Lemma 7, the shortest path between x and y passes at least one node z in Z, and that node can be indicated by (cid:100)log h(cid:101) + (cid:100)log α(cid:101) bits of advice ( h denotes the height of the tree associated with the tree decomposition), with (cid:100)log h(cid:101) bits indicating Z and (cid:100)log α(cid:101) bits indicating the index of the said node z in Z. After serving x, GPC moves si to z, provided that the address of z is given as part of the advice for x. For serving y, GPC moves si to y, provided that the address of si (address of z) is given as part of the advice for y. In what follows, we elaborate this formally. Before starting to serve an input sequence, GPC moves each server si from its initial position x0 to a node z0 on the shortest path between x0 and the first node rai,1 served by si in OPT 's scheme. GPC selects z0 in a way that it will be among the vertices in the least common ancestor of the representative bags of x0 and rai,1 in the tree decomposition (by Lemma 7 such a z0 exists). To move all servers as described, GPC reads ((cid:100)log h(cid:101) + (cid:100)log α(cid:101)) × k bits of advice. After these initial moves, GPC moves servers on the same trajectories of OPT as argued earlier. Assume that x, y and w denote three requests which are consecutively served by si in OPT 's scheme. The advice for serving x contains (cid:100)log h(cid:101) +(cid:100)log α(cid:101) bits which represents a node z1, which lies on the shortest path between x and y and is situated inside the least common ancestor of the respective bags in T . GPC moves si to z1 after serving x. The first part of advice for y contains (cid:100)log h(cid:101) + (cid:100)log α(cid:101) bits indicating the node z1 from which si is moved to serve y. The second part of advice for y indicates a node z2 on the shortest path between y and w in the least common ancestor of their bags in T . This way, 2((cid:100)log h(cid:101) + (cid:100)log α(cid:101)) bits of advice per request are sufficient to move servers on the same trajectories as OPT . The above argument implies that an advice of size 2((cid:100)log h(cid:101) + (cid:100)log α(cid:101)) × n + ((cid:100)log h(cid:101) +(cid:100)log α(cid:101))× k is sufficient to achieve an optimal algorithm. The value of h (the height of the tree decomposition) can be as large as N , however we can apply the following lemma to obtain height-restricted tree decompositions. Lemma 8. [9,15] Given a tree decomposition with treewidth α for a graph G with N vertices, one can obtain a tree decomposition of G with height O(log N ) and width at most 3α + 2. If we apply GPC on a height-restricted tree decomposition, we get the following theorem. Theorem 3. For any metric space of size N and treewidth α, there is an online algorithm which optimally serves any input sequence of size n, provided with O(n(log α + log log N )) bits of advice. 3.2 Graphs with Small Number of Collective Tree Spanners In this section we introduce an algorithm which receives an advice of almost linear size and achieves constant competitive ratio for a large family of graphs. Theorem 4. If a metric space of size N admits a system of µ collective tree (q, r)-spanners, then there is a deterministic online algorithm which on receiving O(n (log µ + log log N )) bits of advice, achieves a competitive ratio of at most q + r on any sequence of length n. Proof. When there is only one tree T in the collection (i.e., µ = 1), we can apply the PathCover algorithm of [22] on T to obtain the desired result. To be precise, for the optimal algorithm OPT , we denote the path taken by it to serve a sequence of requests with the server si to be PG =(cid:2)xai,1, xai,2 , . . . , xai,ni (cid:3). PathCover algorithm moves si on the path PT =(cid:2)xai,1, . . . , xai,2, . . . , xai,ni (cid:3) in T . Since T is a spanner of G, the total length of PT does not exceed that of PG by more than a factor of q + r for each edge in PG, and consequently the cost of the algorithm is at most q + r times that of OPT 's. Thus, the algorithm is (q + r)-competitive. After serving a request x with server si, PathCover can move si to the least common ancestor of x and y, where y is the next request at which OPT uses si. This requires (cid:100)log h(cid:101) bits of advice per request (h being the height of the tree). Instead, the algorithm can use the caterpillar decomposition of T and move servers on the same set of paths while using only O(log log N ) bits of advice. The main idea is the same, whether we use a rooted tree or the caterpillar decomposition. Here for the ease of explanation, we will only argue for the rooted tree, but the statement of the theorem holds when the caterpillar decomposition is used. We introduce an algorithm that mimics OPT 's moves for each server, by picking suitable trees from the collection to move the server through.The advice provided with each request indicates which tree from the collection would best approximate the edges traversed by the server in OPT 's scheme to reach the next node at which it is used. To this end, we look at the tree spanners as rooted trees. If OPT moves a server si on the path PG =(cid:2)xai,1, xai,2 , . . . , xi,ni (cid:3), then for each edge (xai,j , xai,j+1) on this path, our algorithm moves si on the shortest path of (one of) the tree spanners which best approximates the distance between the vertices xai,j and xai,j+1. As explained below the selection of suitable spanners at every step can be ensured by providing 2(cid:100)log µ(cid:101) bits of advice with each request. Let us denote the initial location of the k servers by z1, . . . , zk, and let z(cid:48) 1, . . . , z(cid:48) k respectively denote the first requested nodes served by them. Before starting to serve the sequence, for any server si, the algorithm reads (cid:100)log µ(cid:101) + (cid:100)log h(cid:101) bits of advice to detect the tree Tp(1 ≤ p ≤ µ) that preserves the distance between zi and z(cid:48) i in G, and moves si to the least common ancestor of zi and z(cid:48) i. Moreover, the algorithm labels si with index p. These labels are used to move the correct servers on the trees in order to cover the same paths as OPT . Let w and y be two vertices which are served respectively before and after x with the same server in OPT 's scheme. To serve the request to x the algorithm works as follows: -- Find the spanner Tp which best approximates the length of the shortest path between w and x in G. This can be done if provided with (cid:100)log µ(cid:101) bits of advice with x. -- Read (cid:100)log h(cid:101) bits of advice to locate a server s labeled as p on the path between node x and the root of Tp. Move s to serve x. In case of caterpillar decomposition, the algorithm reads roughly log log N bits. -- After serving x, find the spanner Tq which best approximates the length of the shortest path between x and y in G. This can be done if provided with (cid:100)log µ(cid:101) bits of advice with x. -- Find the least common ancestor of x and y in Tq. This can be done by adding (cid:100)log h(cid:101) bits of advice for x, where h is the height of Tq. In case of caterpillar decomposition, this would require roughly log log N bits. -- Move s to the least common ancestor of x and y and label it as q. Thus, since OPT moves the server si on the path PG = [xai,1 , xai,2, . . . , xai,ni ], our algorithm moves si from xai,j to xai,j+1 for each j (1 ≤ j ≤ ni − 1), on the path in the tree which approximates the distance between these two vertices within a multiplicative factor of q + r. The labels on the servers ensure that the algorithm moves the 'correct' servers on the trees. i.e, the ones which were intended to be used. Consequently, the cost of an algorithm for each server is increased by a multiplicative factor, at most q + r. Therefore, the total cost of the algorithm is at most (q + r) × OPT . The size of advice for each request is 2(cid:100)log µ(cid:101) + O(log log N ), assuming that the caterpillar decomposition is used. Adding to that an additional k(log µ+O(log log N )) bits for the initial movement (cid:117)(cid:116) of servers completes the proof. In recent years, there has been wide interest in providing collective tree span- ners for various families of graphs, mostly in the context of message routing in networks. The algorithms which create these spanners run in polynomial time and in some cases linear time. For example, it any planar graph of size N has a system of log N collective (3,0)-spanners [17]; every AT-free graph (including interval, permutation, trapezoid, and co-comparability graphs) admits a system of two (1,2)-spanners [12]; every chordal graph admits a system of at most log N collective (1,2)-spanners [13]; and every Unit Disk Graphs admits a system of 2 log1.5 n + 2 collective (3,12)-spanners [23]. Corollary 1 For metric spaces of size N and sequences of length n, O(n log log N ) bits of advice are sufficient to obtain I) a 3-competitive algorithm for planar graphs II) a 3-competitive algorithm for AT-free graph (including interval, per- mutation, trapezoid, and co-comparability graphs) III) a 3-competitive algorithm for chordal graphs IV) a 15-competitive algorithm for Unit Disk Graphs. Concluding Remarks For path metric spaces, we showed any 1-competitive algorithm requires an ad- vice of size Ω(n). This bound is tight as there is an optimal algorithm [22] which receives O(n) bits of advice. The same lower bound applies for trees, however, the best algorithm for tree receives an advice of O(n lg lg N ). We conjecture that the lower bound argument can be improved for trees to match it with upper bound, and leave this as future work. References 1. Bartal, Y., Koutsoupias, E.: On the competitive ratio of the work function algo- rithm for the k-server problem. Theor. Comput. Sci. 324(2-3), 337 -- 345 (2004) 2. Bein, W.W., Chrobak, M., Larmore, L.L.: The 3-server problem in the plane. Theor. Comput. Sci. 289(1), 335 -- 354 (2002) 3. Bein, W.W., Iwama, K., Kawahara, J., Larmore, L.L., Oravec, J.A.: A randomized algorithm for two servers in cross polytope spaces. Theor. Comput. Sci. 412(7), 563 -- 572 (2011) 4. Bianchi, M.P., Bockenhauer, H.J., Hromkovic, J., Keller, L.: Online coloring of bipartite graphs with and without advice. In: COCOON '12. LNCS, vol. 7434, pp. 519 -- 530 (2012) 5. Bockenhauer, H.J., Hromkovic, J., Komm, D., Krug, S., Smula, J., Sprock., A.: The string guessing problem as a method to prove lower bounds on the advice com- plexity. In: Electronic Colloquium on Computational Complexity. ECCC (2012) 6. Bockenhauer, H.J., Komm, D., Kr´alovic, R., Kr´alovic, R.: On the advice complexity of the k-server problem. In: ICALP '11. LNCS, vol. 6755, pp. 207 -- 218 (2011) 7. Bockenhauer, H.J., Komm, D., Kr´alovic, R., Kr´alovic, R., Momke, T.: On the advice complexity of online problems. In: ISSAC '09. pp. 331 -- 340. LNCS (2009) 8. Bockenhauer, H.J., Komm, D., Kr´alovic, R., Rossmanith, P.: On the advice com- plexity of the knapsack problem. In: LATIN '12. LNCS, vol. 7256, pp. 61 -- 72 (2012) 9. Bodlaender, H.L.: A tourist guide through treewidth. Acta Cybern. 11, 1 -- 23 (1993) 10. Chrobak, M., Larmore, L.L.: An optimal on-line algorithm for k-servers on trees. SIAM J. Comput. 20(1), 144 -- 148 (1991) 11. Dobrev, S., Kr´alovic, R., Markou, E.: Online graph exploration with advice. In: SIROCCO '12. LNCS, vol. 7355, pp. 267 -- 278 (2012) 12. Dragan, F.F., Yan, C., Corneil, D.G.: Collective tree spanners and routing in AT- free related graphs. J. Graph Algorithms Appl. 10(2), 97 -- 122 (2006) 13. Dragan, F.F., Yan, C., Lomonosov, I.: Collective tree spanners of graphs. SIAM J. Discrete Math. 20(1), 241 -- 260 (2006) 14. Emek, Y., Fraigniaud, P., Korman, A., Rosn, A.: Online computation with advice. Theor. Comput. Sci. 412(24), 2642 -- 2656 (2011) 15. Farzan, A., Kamali, S.: Compact navigation and distance oracles for graphs with small treewidth. In: ICALP '11. LNCS, vol. 6755, pp. 268 -- 280 (2011) 16. Forisek, M., Keller, L., Steinov´a, M.: Advice complexity of online coloring for paths. In: LATA '12. LNCS, vol. 7183, pp. 228 -- 239 (2012) 17. Gupta, A., Kumar, A., Rastogi, R.: Traveling with a pez dispenser (or, routing issues in mpls). SIAM J. Comput. 34(2), 453 -- 474 (2004) 18. Hromkovic, J., Kr´alovic, R., Kr´alovic, R.: Information complexity of online prob- lems. In: MFCS '10. LNCS, vol. 6281, pp. 24 -- 36 (2010) 19. Komm, D., Kr´alovic, R., Momke, T.: On the advice complexity of the set cover problem. In: CSR '12. LNCS, vol. 7353, pp. 241 -- 252 (2012) 20. Komm, D., Kr´alovic, R.: Advice complexity and barely random algorithms. In: SOFSEM '11. LNCS, vol. 6543, pp. 332 -- 343 (2011) 21. Manasse, M.S., McGeoch, L.A., Sleator, D.D.: Competitive algorithms for on-line problems. In: STOC. pp. 322 -- 333 (1988) 22. Renault, M.P., Ros´en, A.: On online algorithms with advice for the k-server prob- lem. In: WAOA '11. LNCS, vol. 7164, pp. 198 -- 210 (2012) 23. Yan, C., Xiang, Y., Dragan, F.F.: Compact and low delay routing labeling scheme for unit disk graphs. Comput. Geom. Theory Appl. 45(7), 305 -- 325 (2012)
1503.06610
1
1503
2015-03-23T11:54:55
Efficient Generation of Stable Planar Cages for Chemistry
[ "cs.DS" ]
In this paper we describe an algorithm which generates all colored planar maps with a good minimum sparsity from simple motifs and rules to connect them. An implementation of this algorithm is available and is used by chemists who want to quickly generate all sound molecules they can obtain by mixing some basic components.
cs.DS
cs
Efficient Generation of Stable Planar Cages for Chemistry Dominique Barth, Olivier David, Franck Quessette, Vincent Reinhard, Yann Strozecki, Sandrine Vial (cid:63) Universit´e de Versailles Saint-Quentin Abstract. In this paper we describe an algorithm which generates all colored planar maps with a good minimum sparsity from simple motifs and rules to connect them. An implementation of this algorithm is avail- able and is used by chemists who want to quickly generate all sound molecules they can obtain by mixing some basic components. 1 Introduction Carbon dioxide, as well as methane can be absorbed by large organic cages [1]. These cages are formed by spontaneous assembly of small organic molecules, called motifs, bearing different reacting centres. The prediction of the overall shape of the cage that will be obtained by mixing the starting motifs is rather difficult, especially because a given set of reacting partners can lead to very different cages. It is hence crucial for chemists to have an operating tool that is capable of generating the many shapes of cages accessible from predetermined molecular motifs. In this paper we present the algorithms we have designed and implemented to generates molecules that are much larger and less regular that what the chemists usually design by hand. The molecules are modelled by maps i.e. planar embed- dings of planar graphs, as explained in Sec. 2. The use of maps may seem un- suitable since they do not represent spatial positions. Though, planar maps are a good model for spherical topologies and the embedding capture the rigidity of the motifs. We must also be able to select the most relevant molecules among the huge number we generate. In Sec. 3.4, we characterize what a "good" molecule is through graph parameters which are then used to filter the best molecules. The relevance of our modeling and of our parameters is validated by the results we obtain: All small molecules (5-10 motifs) we generate and consider to be good according to our parameters have been studied before by chemists. Some of the very regular molecules of medium size (10-20 motifs) we generate correspond to the largest cages chemists have ever produced. We also have produced cages of shape unknown to chemists that they now try to synthesize (see Sec. 6). The aim of this paper is the generation of all colored planar maps up to isomorphism representing possible molecules obtained from a set of elementary (cid:63) Authors thank the French Labex CHARMMMAT for the financial support of this work and David Auger for fruitful discussions about the folding algorithm. starting motifs (colors). As with all enumeration problems, one difficulty is to avoid to produce a solution several times. Moreover the number of solutions may grow exponentially with their size, it is here the case for all bases of motifs but the most contrived. The complexity of such enumeration problems must then take into account the number of produced solutions (see [2] for more details on enumeration). We say that an algorithm is in polynomial total time if its complexity is polynomial in the number of solutions and polynomial in the size of the produced solutions. In our context, where the number of solutions is always exponential in their size, we are interested in linear total time algorithms. The best algorithms are in constant amortized time (CAT): the algorithm uses on average a constant time to generate each solution. This kind of efficient algorithms exists for simple enumeration problems such as listing all trees [3]. We may also want to bound the delay that is the time between the production of two consecutive solutions. Good algorithms have a delay polynomial, linear or even constant in the size of the generated solutions. There exist numerous works on enumeration and generation of planar maps [4], but none of them deals with the generation of planar maps built with a set of starting motifs and color constraints. Moreover, most of the literature deals with non-constructive tools [5] or yields algorithms which are not in polynomial total time. There are a few programs such as plantri [6] and CaGe [7] which generate efficiently some particular class of planar graphs such as cubic graphs or graphs with bounded size of face but they are not general enough for our purposes. The algorithm we present in Sec. 3 is far from being in polynomial total time since we are not able to bound the number of isomorphic copies of each solution we generate. However, we will present several subroutines used in our algorithm which are either CAT, for instance the generation of paths and almost foldable paths in Sec. 3.1, or in linear delay such as the folding of unsaturated maps of motifs in Sec. 3.2. Moreover, we study several heuristics and improvements which makes the enumeration feasible for maps of medium size. Sec. 5 presents numer- ical results which supports this assertion and illustrates the relative interest of our heuristics. 2 Modeling of the problem In this section, we propose the modeling of our problem by maps. A map is a connected planar graph drawn on the sphere considered up to continuous defor- mation. Note that by Steinitz's theorem, when a planar graph is 3-connected, there is only one corresponding map, but otherwise there may be several of them. It is relevant to distinguish between two maps with the same underlying graph, since the geometrical informations contained in the maps are useful to the chemist who are interested in their 3D representation. All maps used in this paper are vertex-colored maps. The representation of a map is a graph and a cyclic order of the neighbors around each vertex. 2 We first model the basic chemical elements with maps we call motifs. Then the motifs are assembled to form a map of motifs and from this map we derive a molecular map that is a more faithful model of the molecular cages we try to design. We use a finite even set of colors A = {a, a, b, b, c, c, . . .} where each positive color a in A has a unique complementary negative color denoted by a and a is the complementary color of a. Each color represents a different kind of reacting center. Let us give the definition of motifs. Definition 1. A map G = (Vc (cid:116) V, E, next) is a motif if, (1) Vc contains only one vertex c called the center, (2) each vertex in V is colored with a color in A, (3) E = {(c, u), u ∈ V }, and (4) next gives an order on the edges of c: next((c, u)) = (c, v) means that the edge (c, v) is "following" the edge (c, u) in a clockwise drawing of G. For all k < V , nextk((c, u)) (cid:54)= (c, u) and nextV ((c, u)) = (c, u). Note that a motif is a star graph. We assume as input M a finite set of motifs all different. Each motif is identified by a distinct color from an alphabet AM disjoint from A induced by the colors existing in M. Fig. 1 gives examples of motifs. a next a Y a a I a a a X a a b b V a a J b Fig. 1. Example of motifs on AM = {Y, I, X, V, J} and A = {a, a, b, b}. Definition 2. A connected planar map G = (Vc (cid:116) V, E, next) is a map of motifs based on M if, (1) the closed neighborhood of each vertex in Vc is a motif, (2) each vertex in V is connected to exactly one vertex in Vc and at most one vertex in V . If u and v in V are connected, the colors of u and v must be complementary. The number of vertices in Vc is called the size of G. Note that each motif of M may appear any number of times in a map of motifs, it may also be not present. A motif is a map of motifs of size 1. In a map of motifs, a vertex of degree 1 in V is called a free vertex. A map of motifs with no free vertex is called saturated otherwise it is called unsaturated. In our implementation, we have an ordering of the edges around each element of Vc consistent with next has been fixed. For optimal performances, we use in our implementation a rotation map to represent a map of motif. For each vertex c1 ∈ Vc, it maps the ith edge of c1, which connects c1 to u, to a triplet (a, c2, j) where a is the color of u, (c1, u, v, c2) is a path with c2 ∈ Vc and the edge (c2, v) is the jth of c2. The color of v is necessarly a and is thus not represented. When u is not connected to another vertex, c2 and j are set to a default value. Based on a saturated map of motifs we construct the molecular map that is the graph model of the cages. 3 Y a a a a I a a a a Y Y a a a a a a I I I a a a a a a Y Fig. 2. Example of two maps of motifs based on M = {Y, I}, the first map is unsatu- rated while the second map is saturated. Definition 3. Let G = (Vc (cid:116) V, EG, nextG) be a saturated map of motifs based on M, we define the molecular map M as the map G where all paths of size three between vertices of Vc are replaced by an edge. Y I I I Y Fig. 3. The molecular map corresponding to the saturated map of motifs in Fig. 2 3 Description of the algorithm The aim of this paper is to solve the following problem: given a base of motifs M and an integer n, enumerate all molecular maps of size n based on M. The complexity depends only on n since the size of M and the size of its elements are assumed to be small constants (usually less than 4). In this section, we describe an algorithm which solves this problem and explain in details its two main steps. The first one, the concatenation, consists in adding edges between comple- mentary vertices of two maps of motifs in such a way the result is still a map of motifs. In this paper, we always concatenate a single motif to a map of motifs, see [8] for other concatenations. Sec. 3.1 presents the different strategies of con- catenation. The second, the fold or folding, consists in adding an edge between two complementary vertices of a map of motifs, in such a way the result is a map of motifs. Sec. 3.2 presents an efficient approach to folding that we use to saturate the maps obtained by concatenation. Then, Sec. 3.3 explain how we detect and discard isomorphic copies of the same graph. Finally in Sec. 3.4, we introduce the indices which characterize a good molecular map and explain how we compute them. 4 3.1 Backbone generation The first step is to generate all backbones, that is unsaturated maps of motifs of a given size n which are of a very simple shape. The aim is that, by folding these backbones in a second step, we will recover all saturated maps of motifs. Since every map of motifs have a spanning tree, we can choose trees as backbones and be sure to recover all saturated maps. But for performance reason, we will also use paths and cycles as backbones. This turns out to be good heuristics, speeding up considerably our algorithm while only mildly reducing the set of generated maps of motifs. We would also like to restrict the backbones to those which can be folded into some saturated map. We address this problem by enumerating only what we call the almost foldable backbones, with a complexity as good as for the generation of regular backbones. This new algorithm greatly improve the computation time. Spanning tree. In a first version of our algorithm [8], the set of non isomorphic trees of size n was explicitly stored. To produce the set of trees of size n + 1, a single motif of every possible color was concatenated to each free vertex of each tree of size n. This generates all trees of size n + 1, but the drawback is that some trees are generated several times. The algorithm was thus not in linear total time and we needed to do an isomorphism test on every generated tree. We now generate all trees where the root and its first edge are fixed with a simple CAT algorithm. This method generates a tree as many times as edges in the tree: one for each choice of a vertex as root and for each choice of first edge of this root. Therefore, the implemented algorithm do not need to store the trees which are produced on the fly, and has a linear delay. A way to further improve this would be to use ideas from CAT algorithms which generate unrooted trees [3]. The main idea is to choose as root the centroid of the tree. However we have to deal with a second and harder problem: we generate maps of motifs and their vertices are colored. We can generate all maps of motifs sharing the same underlying tree efficiently but they may turn out to be isomorphic. Hamiltonian paths. Since generating trees is not easy, we propose to use simpler objects as backbones, here maps of motifs such that all vertices of Vc are on a path. These maps are caterpillar trees, but since the elements of Vc on the central path entirely determine the elements at distance one, we will consider them as paths and call them so. There are two advantages to generating paths instead of trees: they are easier to generate and their number is smaller. The drawback is that not any planar graph has an Hamiltonian path, therefore we could miss some planar maps in our enumeration. However, most small planar graphs have an Hamiltonian path, for instance all planar cubic 3-connected graphs of size less than 38 [9] and, if Barnette's conjecture holds, all fullerene graphs. The regularity of the graphs (all vertices of the same degree) crucially matters in the existence of an Hamiltonian path. Consider for instance the base of motifs M = {I, Y} from Fig. 1. All molecular maps based on M are bipartite graphs: the I's in one set of the bipartition and the Y's in the other. But in saturated 5 maps of motifs, we have twice the number of Y equal three times the number of I because all vertices in V must be connected, therefore there are no Hamiltonian path except in graphs with exactly three I and two Y. This problem can be easily solved by building from M a new base of motifs which in the end generates the same molecular maps (see Sec. 4). Let us now explain how we generate all paths based on a set of motifs M. We first build for each letter a ∈ A a list La of all non isomorphic motifs whose first edge is incident to a vertex of label ¯a. This data structure allows us to have a complexity independent of the size of M and of A. Then to build all possible paths of size n + 1 from a path of size n, we consider its last vertex c ∈ Vc and for each of the free vertex v connected to c and of color a, we attach every motif of La. Remark that beginning by the empty path, we generate all possible paths of a given size by applying recursively the algorithm. If we consider the paths as rooted at the first vertex produced during the algorithm, every path generated is clearly different. However, we can also consider the last concatenated vertex as the beginning of the path, which means we generate every path but the palindromes twice. To avoid that, we put an ordering on AM , the colors of the center vertices, and we consider the sequence of colors in a path. If the sequence of colors from the beginning to the end is lexicographically larger than the sequence from the end to beginning we output the path otherwise we do not. This is implemented in our algorithm and adds only in average a constant time. Proposition 1. The previous algorithm produces all maps of motifs which are paths without redundancies in constant amortized time, when in the base of motifs no two motifs of degree 2 can be concatenated. Proof. The tree of recursive calls of our algorithm can always be seen as of degree at least 3 by merging nodes of degree 2 to nodes of degree larger. Therefore it has at least as many internal nodes as leaves which correspond to output solutions. Since the algorithm needs only a constant time to go from one node to another, (cid:117)(cid:116) the generation of all paths can be done in constant amortized time. In our practical examples, there are never motifs of degree two which can be concatenated. Without this condition, the algorithm has still a linear delay. Hamiltonian cycles. If we want to further restrict the backbones we generate, a simple idea is to consider cycles instead of paths. Again it is a good choice if all motifs have the same degree or can be made so, since for instance all planar cubic 3-connected graphs of size less than 23 have an Hamiltonian cycle [10]. Moreover, we will only generate 2-connected graphs and not the ones which are only 1-connected. It is a desirable side effect, since those graphs have a bridge they are always the worse for the two main indices we are interested with, i.e. the minimum sparsity and the size of the largest cycle (see Sec. 3.4). In our implementation, we obtain the cycles by generating every path and by connecting their beginning to their end when possible. The same cycle can be obtained from several different paths (at most as much as its number of vertices). Therefore our algorithm is in linear amortized time. The question is, 6 can we generate all cycles with a CAT algorithm? It seems hard because we cannot fix a natural first vertex in a cycle as in a tree, since all its vertices can be isomorphic. Almost foldable paths. In each backbone we build, all free vertices will eventually be folded to get a saturated map of motifs. A simple necessary condition on the colors of a saturated map of motifs is that for each color a ∈ A, there are as many vertices in V labeled by a and ¯a. A backbone which satisfies this condition is said to be almost foldable. Let G be a map of motifs and let a1, . . . , ak be the positive colors of the alphabet A. We denote by CG the characteristic vector of G, it is of size k and its ith component is the number of elements in V labeled by ai minus the number of elements labeled by ¯ai. Note that a map G is almost foldable if and only if CG is the zero vector. We propose here a method to generate in constant amortized time only the almost foldable paths. We introduce a function F : N × A × Zk → 2A which has the following semantic: a(cid:48) ∈ F (n, a, (c1, . . . , ck)) if and only if (1) there is a path P of size n with a free vertex in the first motif labeled by a, (2) CP = (c1, . . . , ck), (3) a vertex of the last motif is labeled by a(cid:48). Proposition 2. There is an algorithm which enumerates all almost foldable paths in constant amortized time plus a precomputation in O(nk+1), when in the base of motifs no two motifs of degree 2 can be concatenated. Proof. First, we explain how to generate all needed values of the function F in time O(nk+1) by dynamic programming. Denote by f the maximal number of vertices in a motif labeled by the same color. For a path P of size n, it is clear that the coefficients in CP are all in the interval [−nf, nf ]. Therefore, to generate paths of size n, since f and the size of A are constants, we need to store O(nk+1) values of F only. F is easy to compute for n = 1: we consider each motif M ∈ M and each v of label a in M , and let F (1, a, CM ) be the set of labels of all vertices of M but v. Assume we have generated the values of F for n, we generate the values for n + 1 in the following way. For each a, C and each a(cid:48) ∈ F (n, a, C), we consider all motifs M ∈ M such that one of their vertex is labeled by ¯a. We add all the labels of the other vertices to the set F (n, a, C + CM ). This algorithm only does a constant number of operations for each value of F it computes, therefore its complexity is O(nk+1). Now that F is computed, we use it in our path generation algorithm to generate only the almost foldable paths. Assume we have generated a path P of size n(cid:48), its characteristic vector CP and we want to add a node at the end by connecting it to a node of label a. Assume we have already computed CP . The algorithm checks if F (n − n(cid:48), ¯a,−CP ) (cid:54)= ∅. If it is the case the algorithm go on normally otherwise it backtracks since this extension cannot yield a non foldable path. This improvement only adds a single test at each step of the original algorithm, plus an addition of a constant sized vector to maintain the (cid:117)(cid:116) value of CP . Therefore it is in constant amortized time. 7 The complexity of the precomputation may seem to be large but k must be seen as a small constant (less than 4). It is negligible with respect to the generation of paths, which is exponential in n because of the number of non isomorphic paths. In practice, the precomputation takes only a few milliseconds for size of graphs up to 40 on a regular desktop computer. On the other hand, this optimization makes the time to computes all the backbones much smaller than the time to do the next steps. Almost foldable trees. Following the idea used to efficiently compute almost foldable paths, we give here two ways to generate the almost foldable trees. When we extend a tree by a concatenation, it can be through any vertex. To keep the same dynamic programming algorithm as for paths we should track all free vertices in the tree in construction, which would make the algorithm exponential time. There are two solutions to this problem, the first and the one we have implemented is to compute a multidimensional array A such that A(n, C) = 1 if there is a forest F of size n such that CF = C and A(n, C) = 0 otherwise. We can thus test in our algorithm generating trees, whether any partial tree can be extended to a structure of the right size by a forest. Since we generate trees and not forests, we will sometimes expand a partial tree and obtain no almost foldable backbone in the end. The second solution is to change the characteristic vector of a backbone so that each of its component is the number of free vertices of some color positive or negative. In this way it is easy to compute an array A such that A(n, C) = 1 if there is a tree T of size n such that CT = C and A(n, C) = 0 otherwise. Indeed, for each motif M with a free vertex of color a, if for some C A(n, C) = 1 and C has a non-zero component ¯a then there is a tree of size n + 1 with vector C + CM that is A(n, C + CM ) = 1. The only drawback is that the size of A and thus the complexity of the precomputation is O(n2k+1), where k is the number of positive colors while the size of A in the solution we have implemented is O(nk+1). 3.2 Folding of the backbones Let G be a map of motifs, the fold operation on the vertices u and v is adding the edge (u, v) to G. The operation is valid if u and v are free, of complementary colors and in the same face of G. Therefore, the graph obtained after the fold is still a map of motifs. In this section we generate from a backbone, by sequences of folds, all possible saturated maps of motifs. The outline of a face is the list in order of traversal of the free vertices. An outline is a circular sequence of vertices (v1, . . . , vn) ∈ V n. Sequence means that the order is significant and circular means that the starting point is not. For instance, (v1, v2, v3) and (v3, v1, v2) are the same circular sequence but are different from (v3, v2, v1). Remark that a tree or a path has a single outline, a cycle has two and a saturated map has only empty outlines. The color of an outline (v1, . . . , vn) is the word w1 . . . wn with wi the color of vi. Folding two vertices vi and vj in the same outline of color W1wiW2wjW3 creates two outlines of color W3W1 and W2. The fold operation can then be seen as an operation from 8 words over A to multiset of words. Remark that this operation is very similar to the reduction of consecutive complementary parentheses which enables to define the classical Dyck language of balanced string parentheses. a a V1 a a J b b V2 a a a a V1 a a J b b V2 a a outline = {a, a, a, a} outline = {a, a} Fig. 4. A map on AM = {V1, V2, J} and its outline before and after a fold operation. Applying a sequence of fold to a backbone to get a saturated map is the same as applying a sequence of reductions to the colors of an outline so that we obtain only empty words. We work from now on only on the words w1 . . . wn and on sequences of reductions. If in a sequence of reductions, the reduction is applied to wi and wj we say that the sequence pairs i with j. Let us call a word (or a multiset of words) which reduces to a multiset of empty words a foldable word. As in the case of parentheses languages, we can restrict the reduction to consecutive complementary letters which transforms W1aaW2 into the word W1W2. Indeed, when a word is foldable, it can be reduced to empty words using the restricted reduction of consecutive letters only by reordering the sequence of reductions. We call result of a sequence of reductions the set of pairs (i, j) such that the sequence has paired i and j. The previous remark shows that it is indeed a set of pairs and not a sequence. Our aim is to generate all different results of sequences of reductions on foldable words without redundancies. Lemma 1 (Folklore). The restricted reduction on words is confluent i.e. each sequence of restricted reduction starting from a foldable word can be extended so that we get an empty word. Proof. To prove our lemma, it is enough to prove that if S is the sequence which reduces a word W = W1wiwi+1W2 with wi = wi+1, then W1W2 is fold- able. If S pairs i and i + 1, then W1W2 can be reduced to the empty word by S. We now assume that S pairs wi with wk and wi+1 with wl, where W = W 1 2 . Remark that the case where S pairs wi with wl and wi+1 with wk is not possible because all letters between i and l must be paired together by definition and i + 1 is between i and l but not k. Inside 2 and W 11W 2 the sequence S, we can find subsequences which reduce W 2 2 1 wiwi+1W 1 1 , W 1 1 wkW 2 2 wlW 2 9 to empty words since we are allowed to reduce consecutive letters only. There- fore W1W2 = W 1 1 wkW 2 2 can be reduced to the empty word. First the sequences reducing W 2 2 . Then one step of reduction remove wkwl which are of complementary color by definition. (cid:117)(cid:116) Finally we obtain W 1 2 wlW 2 2 are used to obtain the word W 1 1 W 1 1 W 1 1 W 2 2 which is foldable. 1 wkwlW 2 As a consequence of this lemma, we get a simple algorithm for testing whether a word is foldable: reduce the word as long as it is possible and if an empty word is obtained, the word is foldable. Proposition 3. There is a linear time algorithm to test whether a word is fold- able. Proof. The word is represented by a doubly linked list of its letters. At a given step of the algorithm we are at some position i in the list. If the letters at position i and i+1 in the list are complementary, they are removed and i is set to be i−1 if possible, 0 otherwise. If the letters are not complementary, i is incremented. The algorithm stops and decides that the word is foldable when the list is empty. If i is at some point the last element of the list then the algorithm stops and decides that the word is not foldable. The algorithm is clearly in linear time, since at each step either the size of the list decreases or the current position increases. Finally this algorithm is correct, because if it stops without removing every element in the list, it means that there are no two consecutive complementary letters left. Therefore there are no possible further restricted reductions and the obtained word is not foldable. By Lemma 1, since the reduction is confluent, the original (cid:117)(cid:116) word is also not foldable. We use this algorithm each time we produce a backbone to test whether it can be folded into a saturated map of motifs. Note that, even if we generate almost foldable backbones only, we may generate some which are not foldable such as those with outline ba¯b¯a. Proposition 4. There is an algorithm which enumerates all distinct results of sequences of reduction on a foldable word, with a linear delay and a quadratic precomputation. Proof. For a given word W we first build the lists Li which contain the set of indices j > i such that wi can be folded with wj and the obtained set of words is still foldable. The lists Li are built from a boolean matrix M such that Mi,j is true if and only if the word wi . . . wj is foldable. The matrix is computed by dynamic programming: Mi,i+1 is true if and only if wi and wi+1 are complementary. We compute Mi,j once we have computed all Mi(cid:48),j(cid:48) such that (j(cid:48) − i(cid:48)) < (j − i) by using the fact that wi . . . wj is foldable if and only if wi . . . wk and wk+1 . . . wj are foldable for some k in [i+1, j] or wi and wj are complementary and wi+1 . . . wj−1 is foldable. By this method, the matrix M is computed in time cubic in the size of the word. In fact, by Lemma 1, if there is a k such that wi . . . wk and wk+1 . . . wj are foldable, then for all l such that wi . . . wl is foldable, then wl+1 . . . wj is 10 foldable. We store for each i the smallest k > i such that wi . . . wk is foldable. Hence we can decide whether there is a k such that wi . . . wk is foldable in constant time and we compute the matrix M in quadratic time. Remark that a sequence of reductions applied to a word W yields a set of subwords which are consecutive letters of W . Therefore we can represent the result of several reductions by a set of pairs {(l1, r1), . . . , (lk, rk)} with (li, ri) representing the word wli . . . wri and li < ri < li+1. We build the results of sequences of reductions in a recursive way. Assume we have already built a result R through a sequence of reductions applied to W , which has produced the set {(l1, r1), . . . , (lk, rk)}. We consider l1, the index of the first letter which has not been reduced and we do the reduction with every possible letter of index i ∈ [l1, r1] ∩ Ll1 which produces the set {(l1, i), (i + 1, r1) . . . , (lk, rk)} and the result R∪{(l1, i)}. By using recursively this algorithm starting on W , we obtain all possible results R corresponding to a reduction to a multiset of empty words. It is not possible to generate twice a result since at any point of the algorithm we make recursive calls on R ∪ {(l1, i)} for different values of i which makes the results produced by each call disjoint. Between two recursive calls we do only a constant number of operations, therefore the delay is bounded by the depth of (cid:117)(cid:116) the tree of recursive calls, that is the size of the word W . The enumeration algorithm we have described is exponentially better than the naive one where each possible letter is folded when it is next to a comple- mentary letter and so on recursively. The complexity of the naive algorithm is proportional to the number of sequences of reductions while our is proportional to the number of results. For instance, on words of the form W n with W = a¯a¯aa, there is only one result but (2n)! sequences of reductions. 3.3 Dealing with isomorphic copies Since the construction process does not guaranty uniqueness of the generated maps, we need to detect during the enumeration the isomorphic copies of already generated maps to discard them. To do that we need to compute a unique signature for each map and we must store all produced maps and their signatures. Since the number of maps grows exponentially with their size, they are stored in a dynamic set structure which supports logarithmic addition and research of elements. In our implementation we have used an AVL whose key is the signature. Hence each time a new map is produced, we compute its signature and if this signature is already in the AVL, it is simply not inserted. From a theoretical point of view, planar isomorphism is well understood since it has been proved to be solvable in almost linear time [11] and logarithmic space [12]. However this algorithm is not practical and hard to implement as observed in [13], especially if we want a signature rather than just an isomor- phism test. This is particularly true for our small graphs of size about 20, which is the reason why we rely on a simpler algorithm of quadratic complexity in the spirit of [14]. The idea is that in a map, when a first edge is fixed we can do a deterministic traversal of the graph using the order on each neighborhood. The 11 signature is the least lexicographic traversal amongst the traversals beginning by all edges of the map. Let us describe precisely the quadratic isomorphism algorithm. All the sig- natures are numbers in a base B with B = n + A + AM. The first step that is common to all the maps of motifs of the same size n is to assign to each color in A and AM a different digit in [n, n + A + AM) in base B. In a map of motifs G = (Vc, V, E, next) of size n and for any edge (c, u) ∈ E with c ∈ Vc we perform a deterministic depth first search that will define the signature of G starting at (c, u). Since signatures are numbers, they can be easily compared and the signature of G will be the minimum number over all starting points. For computing a signature starting at (c, u), at first visit of each vertex in Vc assign an index number that is a digit in the range [0, n) in the base B. From c visit its neighbor u: since the map is saturated u is connected to a vertex v ∈ V and v is connected to a vertex c(cid:48) ∈ Vc. Construct the signature by concatenating the index number of c, the digits of the colors c, u, v and c(cid:48) and the index number of c(cid:48). If c(cid:48) is already visited backtrack and continue the visit from (c, next((c, u))) else continue the visit starting at (c(cid:48), v(cid:48)) with (c(cid:48), v(cid:48)) = next((c(cid:48), v)) and so on until all quadruplets (c, u, v, c(cid:48)) are visited once. At the end, we obtain a signature in base B for the starting point (c, u). Note that the signature itself is of size linear in n. Given any signature one may exactly reconstruct the graph. Conversely two graphs which are isomorphic have the same signature because the signature computation does not take into account the order or name of the nodes. We make a simple optimization, which is crucial, since profiling our algorithm reveals that it spends more than half of its time computing signatures. We assign the lower digits to the colors of c and u such that the number of couples (c, u) is minimal and non zero. Since the signatures are constructed with the most significant bit first, during the construction of a signature, we test for each digit added if the signature is at this point greater than the minimal one. Thus we can cut very efficiently in the signature calculation process. Moreover, the computed signature allows to detect chiral molecules, a very important notion in chemistry. Two maps are chiral if one is isomorphic to the other when the order of the next predicate is reversed for all neighborhoods. 3.4 Indices computed on the molecular map A molecular map is a candidate to be a "good" cage for chemistry. The definition of a "good" cage is merely topological: the 3D shape must be close to a sphere, it must be resistant to deformations and cuts and it must have an "entrance". We are able to check if a molecule satisfies or not these requirements only by consid- ering the structure of its molecular map: First the map is planar and connected by construction. In quadratic time we compute the equivalence classes of vertices up to automorphism, using the same technique as to compute a signature, which helps measure the sphericity of the cage. The entrance is given by the size of its largest face, which is easily computed in linear time. The resistance of a map is given by its minimum sparsity. 12 From a large set of experiments, these indices have proved to be realistic to the chemist on several examples (see Sec. 6). They are then used in our implementation to limit the number of molecular maps output by the program, which would otherwise be in such great number that a chemist could not try to study them all. For instance, all maps with a small minimum sparsity are filtered out. Distribution of the sizes of faces The faces size is an important parameter in the cage construction. The chemist wants a cage with an "entrance". In graph terms we seek for graphs with one large face and all the others faces of size around the mean size, which makes the molecule more spherical in practice. The distribution of the face size is straightforward to compute. As an indicator we compute the size difference between the two largest faces divided by the mean size. This indicator is zero when there is two largest faces with the same size and grows with the entrance size. Equivalence classes of the vertices Two vertices (motifs) of a molecular map are in the same class if it exists an automorphism that send one to the other. We compute the equivalence classes of all vertices: If the signature starting form (c1, u1) is equal to the signature starting at (c2, u2) the motif centered on c1 is in the same class as he motif centered on c2. The chemist, when synthesizing a molecule corresponding to a molecular map, will use the same compound for all motifs in the same equivalence class. In addition the less the number of classes the more the molecule has a spherical shape. size(S) Minimum sparsity We now define the sparsity and explain how to compute it, since it is the most relevant index and the hardest to compute. A cut of a graph G = (V, E) is a bipartition of V . The size of a cut S = (S1, S2) is the number of edges with one end in S1 and the other in S2. The sparsity of a cut is min(S1,S2) . The Sparsest Cut problem is to find the minimum sparsity(S) = sparsity over all cuts. We first implemented a brute-force algorithm, using a Gray code which enumerates all possible partitions of the set of vertices in time O(2n) where n is the number of vertices in our graph. Since we were using a Gray code, the partition changes at each step by only one element and the cut can be computed in constant time from the previous one. Therefore we have a simple algorithm with complexity O(2n) where n is the number of vertices in our graph, which is useful for n up to twenty but not practical for larger sizes. Although computing the minimum sparsity is NP-complete in general (min- imum cut into bounded set in [15]), there is a polynomial time algorithm when the graph is planar [16]. Since the time to compute the minimum sparsity was the limiting factor of our program, we have implemented and adapted to our case this more complicated algorithm (which has never been done as far as we know). The main idea is that a cut in a graph corresponds exactly to a cycle in the dual graph (see [17] for graph definitions useful in this paragraph). A weight is associated to each cycle of the dual: if the corresponding cut in the primal 13 partitions it into S1 and S2, the weight is min(S1,S2). From a spanning tree of the dual, we build a base of its fundamental cycles. A fundamental cycle is given by any edge not in the spanning tree completed by edges of the spanning tree to form a minimal cycle. From symmetric differences of fundamental cycles, we can generate every cycle and its weight. For each edge in the dual, we build a graph such that paths from a given vertex correspond to cycles of the dual which use the edge. Moreover, the weight of the cycle can be read in the last vertex of the path, and the size of the corresponding cut is the length of the path. Therefore, computing a single source shortest-path in each of these graphs enables us to compute the value of the sparsest-cut. While in the original article this was done by a modified Dijkstra algorithm, we use a breadth first-search. This is faster and it enables us to use a good heuristic: at any point of one of the breadth first-search, we know the current distance from the source can only increase. We can stop the search, if this distance divided by the maximal weight (equal to the number of vertices) is larger than the current minimum sparsity value. This implementation has very good practical performances: on a regular desktop computer the mean time to compute the sparsest cut of a graph of size 30 is 0.2 ms while the brute force algorithm needs 6000 ms. 4 Metamotifs From a base of motifs, we can generate a new one, by concatenation of elements of the base. The new motifs are called metamotifs. It is useful, if the new elements added to the base can be used to remove other elements of the base so that some good properties are enforced. For instance, one can remove the elements of degree 2 (if they cannot be concatenated together), while not increasing the degree of motifs in the base. Every motif of degree 2 is concatenated in every possible way to the other motifs and deleted. From our example {I, Y}, we obtain a base {Y0, Y1, Y2, Y3} where the Yi are of degree 3 and have i vertices of V labeled by ¯a and the others by a. If we now generate all molecular maps of size n based on {Y0, Y1, Y2, Y3} it is easy to convert them into molecular maps based on M. The converted maps are of size exactly 5 2 n since there are 3 2 I for each Y. a I a Y a a a Y a a a a a a I I I a a a Fig. 5. Representation of the two metamotifs Y1 and Y3, built from Y and I 14 Note that the isomorphism test is done on the generated map of motifs seen as made of the motifs of the first base, otherwise we could not detect some isomorphic copies. The choice of a new base can also be interesting if it decreases its size or the size of the alphabet. It is a way to encode constraints on some specific base understood by the user. For instance the base X (a, a, a, a), V (¯a, ¯a, b) and I (¯b, ¯b) can be turned into the base X1 (a, a, a, a), X2 (¯a, ¯a, ¯a, ¯a) because with I we can only connect two V. It is now easy to see that we are generating the 4-regular planar bipartite maps. In that particular case, the efficiency of our algorithm is not improved since the generated paths are the same. 5 Results The code and the exhaustive results of our approach can be found at the following address http://kekule.prism.uvsq.fr. For several sets of motifs, one can find the set of generated maps and their indices. We stopped all computations at 300 seconds an put a -- in the tables when the algorithm has not finished. All times are given in second, a.f. stands for almost foldable. Table 1. Number of backbones and generation time for J (a, b), V1 (¯a, ¯a, b), V2 (a, ¯b, ¯b) Size Tree A.f. tree Path A.f. path Backbones Time Backbones Time Backbones Time Backbones Time 9.87 103 0.01 2.46 105 0.08 6.17 106 1.74 1.56 108 45.84 4.92 104 0.01 1.77 106 0.28 7.26 107 10.88 -- 3.85 105 0.05 5.55 107 7.98 -- -- 5.70 105 0.09 1.16 108 14.28 -- -- -- -- -- 9 12 15 18 -- -- In Tab. 1, we give the time to compute the backbones and the number of backbones generated (we also count isomorphic copies which are generated). The time to compute cycles is not given since they are computed from paths, the difference is seen in the number of folded maps and the time to generate them. In Tab. 2, we give the time to generate all unique maps and their indices. Table 2. Number of maps and time to generate them and their indices for J (a, b), V1 (¯a, ¯a, b), V2 (a, ¯b, ¯b) Size A.f. tree A.f. path A.f. cycle 3.85 105 5.55 107 A.f. backb. Maps Time A.f. backb. Maps Time A.f. backb. Maps Time 8.06 103 0.01 148 2.03 105 0.32 1931 5.13 106 29164 8.81 1.30 108 501503 184.48 9.87 103 2.46 105 6.17 106 1.56 108 2307686 236 0.03 4463 0.71 97112 28.40 -- 236 0.32 4476 53.99 -- -- -- > 98100 -- -- 9 12 15 18 15 Remark that the number of unique maps generated by trees, paths or cycles are different, since only the generation from trees is exhaustive. However, most of the maps with the largest minimum sparsity are generated with paths or cycles as backbones. 6 Chemical validation Using the set of motifs {X, I}, if we take for each size of maps the ones with the lowest cut indices, we find the molecules obtained by Warmuth and Liu (Solvent effects in thermodynamically controlled multicomponent nanocage syntheses) in real-life experiments. An example of a molecular map built on {X, I} is given in Fig. 6 (in 3 dimension for easier reading). The white elements are X and the red I. Its chemical realization by Warmuth and Liu is also given in the same figure. Fig. 6. A cage obtained by Warmuth with 6 X and 12 I From all maps of size 8 based on Y (a, a, a), V1 (¯a, b, b) and V2 (¯a, ¯b, ¯b), we have selected the map of Fig. 7 because it has good indices. This has led to the conception of a real molecule which can be represented by this molecular map. It is given in Fig. 7, the blue parts being the Y, the black parts the V1 and the green parts the V2. References 1. Holst, J., Trewin, A., Cooper, A.: Porous organic molecules. Nature Chem. 2 (2010) 915 -- 920 2. Strozecki, Y.: Enumeration complexity and matroid decomposition. PhD thesis, Universit´e Paris Diderot - Paris 7 (2010) 3. Li, G., Ruskey, F.: The advantages of forward thinking in generating rooted and free trees. In: ACM-SIAM symposium on Discrete algorithms. (1999) 939 -- 940 4. Liskovets, V.: Enumeration of nonisomorphic planar maps. Selecta Math. Soviet. 4 (1985) 304 -- 323 16 V1 V2 Y V1 V2 Y V1 V2 Fig. 7. A cage based on {I, V1, V2} 5. Cori, R., Vauquelin, B.: Planar maps are labelled trees. Canadian Journal Math. 33(5) (1981) 1023 -- 1042 6. Brinkmann, G., McKay, B.D.: Fast generation of planar graphs. MATCH Commun. Math. Comput. Chem 58(2) (2007) 323 -- 357 7. Brinkmann, G., Friedrichs, O.D., Lisken, S., Peeters, A., Van Cleemput, N.: Cage -- a virtual environment for studying some special classes of plane graphs -- an update. MATCH Commun. Math. Comput. Chem 63(3) (2010) 533 -- 552 8. Barth, D., Boudaoud, B., Couty, F., David, O., Quessette, F., Vial, S.: Map generation for CO2 cages. In: Computer and Information Sciences III. Springer (2013) 503 -- 510 9. Holton, D.A., McKay, B.D.: The smallest non-hamiltonian 3-connected cubic pla- nar graphs have 38 vertices. Journal of Combinatorial Theory, Series B 45(3) (1988) 305 -- 319 10. Aldred, R.E., Bau, S., Holton, D.A., McKay, B.D.: Cycles through 23 vertices in 3-connected cubic planar graphs. Graphs and Combinatorics 15(4) (1999) 373 -- 376 11. Hopcroft, J.E., Wong, J.K.: Linear time algorithm for isomorphism of planar graphs (preliminary report). In: ACM symposium on Theory of computing. (1974) 172 -- 184 12. Datta, S., Limaye, N., Nimbhorkar, P., Thierauf, T., Wagner, F.: Planar graph isomorphism is in log-space. In: Computational Complexity. (2009) 203 -- 214 13. Kukluk, J.P., Holder, L.B., Cook, D.J.: Algorithm and experiments in testing planar graphs for isomorphism. Journal of Graphs Algorithms and Applications 8(3) (2004) 313 -- 356 14. Weinberg, L.: A simple and efficient algorithm for determining isomorphism of planar triply connected graphs. Circuit Theory, IEEE Transactions on 13(2) (1966) 142 -- 148 15. Garey, M., Johnson, D.: Computers and intractability: a guide to NP-completeness. WH Freeman and Company, San Francisco (1979) 16. Park, J.K., Phillips, C.A.: Finding minimum-quotient cuts in planar graphs. In: ACM symposium on Theory of computing. (1993) 766 -- 775 17. Diestel, R.: Graph theory. 2005. Grad. Texts in Math (2005) 17
1910.07944
1
1910
2019-10-17T14:44:20
Faster parameterized algorithm for Bicluter Editing
[ "cs.DS" ]
In the Bicluter Editing problem the input is a graph $G$ and an integer $k$, and the goal is to decide whether $G$ can be transformed into a bicluster graph by adding and removing at most $k$ edges. In this paper we give an algorithm for Bicluster Editing whose running time is $O^*(3.116^k)$.
cs.DS
cs
Faster parameterized algorithm for Bicluter Editing Dekel Tsur∗ Abstract 9 1 0 2 t c O 7 1 ] S D . s c [ 1 v 4 4 9 7 0 . 0 1 9 1 : v i X r a In the Bicluter Editing problem the input is a graph G and an integer k, and the goal is to decide whether G can be transformed into a bicluster graph by adding and removing at most k edges. In this paper we give an algorithm for Bicluster Editing whose running time is O∗(3.116k). Keywords graph algorithms, parameterized complexity, branching algorithms. 1 Introduction A graph G is called a biclique if G is a complete bipartite graph, namely, there is a partition of V (G) into disjoint non-empty sets V1, V2 such that V1 and V2 are independent sets and there is an edge between every vertex in V1 and every vertex in V2. A graph G is called a bicluster graph if every connected component of G with at least two vertices is a biclique. In the Bicluter Editing problem the input is a graph G and an integer k, and the goal is to decide whether G can be transformed into a bicluster graph by adding and removing at most k edges. Protti et al. [3] gave an O∗(4k)-time algorithm for Bicluter Editing. A faster algorithm, with O∗(3.237k) running time, was given by Guo et al. [2]. In this paper, we give an algorithm for Bicluter Editing with O∗(3.116k) running time. Preleminaries For a set S of vertices in a graph G, G[S] is the subgraph of G induced by S (namely, G[S] = (S, ES) where ES = {(u, v) ∈ E(G) : u, v ∈ S}). For a graph G = (V, E) and a set F of pairs of vertices, G△F is the graph (V, (E \ F ) ∪ (F \ E)). A set F of pairs of vertices is called an editing set of a graph G if G△F is a bicluster graph. For a graph G, let F (G) be a set containing every inclusion minimal editing set of G. A P4 is a graph which consists of a path on 4 vertices. Let A be a set of vertices that induces a P4 in a graph G. Let I(A) = {v ∈ V (G) \ A : N(v) ∩ A = ∅} and P (A) = V (G) \ (A ∪ I(A)) = {v ∈ V (G) \ A : N(v) ∩ A 6= ∅}. ∗Ben-Gurion University of the Negev. Email: [email protected] 1 2 The algorithm A graph is a bicluster graph if and only if it is bipartite and it does not contain an induced P4. Therefore, the Bicluster Editing problem is closely related to the Cograph Editing problem, which is the problem of deciding whether a graph G can be transformed to a graph without an induced P4 by adding and removing at most k edges. Our algorithm for Bicluster Editing is based on the algorithm of [5] for Cograph Editing. The algorithm is a branching algorithm (cf. [1]). The algorithm uses the following branching rules. (B1) on the instance (G△{e}, k − 1). Let X be a set that induces a triangle. For every edge e in G[X], recurse The branching factor of Rule (B1) is (1, 1, 1) and the branching number is 3. Let A be a set that induces a P4 such that P (A) ≥ 2. Choose distinct (B2) vertices p, p′ ∈ P (A). For every F ∈ F (G[A ∪ {p, p′}]), recurse on the instance (G△F, k − F ). To compute the branching number of Rule (B2), we consider all possible cases for the neighbors of p in A and all possible cases for the neighbors of p′ in A ∪ {p}. Note that the number of cases is finite. For each case, we used a Python script to compute F (G[A ∪ {p, p′}]) and to compute the corresponding branching number. The case with the largest branching number is when p is adjacent to the first vertex of the path and p′ is adjacent to the second vertex of the path. Additionally, p and p′ are not adjacent. In this case, the branching vector is (2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4) and the branching number is at most 3.116. Let A be a set that induces a P4 such that there is a vertex p ∈ P (A) that (B3) is adjacent to a vertex i ∈ I(A). For every F ∈ F (G[A ∪ {p, i}]), recurse on the instance (G△F, k − F ). The branching number of Rule (B3) was also computed with a script. The branching number of this rule is at most 3.116. We now consider an instance of the problem on which the above branching rules cannot be applied. We will show that the instance can be solved in polynomial time. Lemma 1. Let (G, k) be an instance of Bicluster Editing on which Rules (B1) -- (B3) cannot be applied. Then, every connected component of G with at least 6 vertices is a biclique. Proof. Without loss of generality, we assume that G is connected. We also assume that G has at least 6 vertices. We first claim that G is not connected. Suppose conversely that G is connected. By a result of Seinsche [4], G contains an induced P4, and let A be a set of vertices that induces a P4 in G. Since G has at least 6 vertices and P (A) ≤ 1 (due to Rule (B2)), we have that I(A) 6= ∅. By definition, a vertex i ∈ I(A) is not adjacent to the vertices in A. Additionally, if P (A) 6= ∅, a vertex i ∈ I(A) is not adjacent to the single vertex in P (A) (due to Rule (B3)). Therefore, A ∪ P (A) is a connected component in G which does not contain all the vertices of G, contradicting the assumption that G is connected. Therefore, G is not connected. 2 Let C1, . . . , Cp be the connected components of G. In G, a vertex in a connected component Ci is adjacent to all the vertices in V (G) \ Ci. Since G does not contain a triangle (due to Rule (B1)), it follows that p = 2. Additionally, the sets C1 and C2 are independent sets. Therefore, G is a biclique. Lemma 2. Let G be a graph. If F is a minimum size editing set of G then for every (u, v) ∈ F , u and v belong to the same connected component of G. Proof. Let F be a minimum size editing set of G. Let F ′ be a set containing every pair (u, v) ∈ F such that u, v belong to the same connected component of G. Since being a bicluster graph is a hereditary property, for every connected component C of G we have that (G△F )[C] = (G△F ′)[C] is a bicluster graph. Since the disjoint union of bicluster graphs is a bicluster graph, G△F ′ is a bicluster graph. Since F is a minimum size editing set of G, it follows that F ′ = F . By Lemma 1 and Lemma 2, if (G, k) is an instance on which the above branching rules cannot be applied then the instance can be solved in polynomial time: Let C1, . . . , Cp be the connected components of G. For every i such that Ci ≤ 5, compute a minimum size editing set Fi of G[Ci] using brute force. For every i such that Ci ≥ 6, let Fi = ∅. Then, F = Sp i=1 Fi is a minimum size editing set of G. We obtain the following theorem. Theorem 3. There is an O∗(3.116k)-time algorithm for Bicluster Editing. References [1] M. Cygan, F. V. Fomin, L. Kowalik, D. Lokshtanov, D. Marx, M. Pilipczuk, M. Pilipczuk, and S. Saurabh. Parameterized algorithms. Springer, 2015. [2] J. Guo, F. Huffner, C. Komusiewicz, and Y. Zhang. Improved algorithms for bicluster editing. In Proc. 5th International Conference on Theory and Applica- tions of Models of Computation (TAMC), pages 445 -- 456, 2008. [3] F. Protti, M. D. da Silva, and J. L. Szwarcfiter. Applying modular decomposition In Proc. 2nd International Workshop on to parameterized bicluster editing. Parameterized and Exact Computation (IWPEC), pages 1 -- 12, 2006. [4] D. Seinsche. On a property of the class of n-colorable graphs. J. of Combinatorial Theory, Series B, 16(2):191 -- 193, 1974. [5] D. Tsur. Faster algorithms for cograph edge modification problems. arXiv preprint arXiv:1908.01223, 2019. 3
1503.02654
4
1503
2015-05-22T15:40:48
Algorithms for Replica Placement in High-Availability Storage
[ "cs.DS", "cs.DC" ]
A new model of causal failure is presented and used to solve a novel replica placement problem in data centers. The model describes dependencies among system components as a directed graph. A replica placement is defined as a subset of vertices in such a graph. A criterion for optimizing replica placements is formalized and explained. In this work, the optimization goal is to avoid choosing placements in which a single failure event is likely to wipe out multiple replicas. Using this criterion, a fast algorithm is given for the scenario in which the dependency model is a tree. The main contribution of the paper is an $O(n + \rho \log \rho)$ dynamic programming algorithm for placing $\rho$ replicas on a tree with $n$ vertices. This algorithm exhibits the interesting property that only two subproblems need to be recursively considered at each stage. An $O(n^2 \rho)$ greedy algorithm is also briefly reported.
cs.DS
cs
Algorithms for Replica Placement in High-Availability Storage K. Alex Mills, R. Chandrasekaran, Neeraj Mittal Department of Computer Science The University of Texas at Dallas, Richardson Texas, USA {k.alex.mills,chandra,neerajm}@utdallas.edu Abstract. A new model of causal failure is presented and used to solve a novel replica placement problem in data centers. The model describes dependencies among system components as a directed graph. A replica placement is defined as a subset of vertices in such a graph. A criterion for optimizing replica placements is formalized and explained. In this work, the optimization goal is to avoid choosing placements in which a single failure event is likely to wipe out multiple replicas. Using this criterion, a fast algorithm is given for the scenario in which the dependency model is a tree. The main contribution of the paper is an O(n + ρ2) dynamic programming algorithm for placing ρ replicas on a tree with n vertices. This algorithm exhibits the interesting property that only two subprob- lems need to be recursively considered at each stage. An O(n2ρ) greedy algorithm is also briefly reported. 1 Introduction With the surge towards the cloud, our websites, services and data are increas- ingly being hosted by third-party data centers. These data centers are often contractually obligated to ensure that data is rarely, if ever unavailable. One cause of unavailability is co-occurring component failures, which can result in outages that can affect millions of websites [13], and can cost millions of dollars in profits [11]. An extensive one-year study of availability in Google's cloud stor- age infrastructure showed that such failures are relatively harmful. Their study emphasizes that "correlation among node failure dwarfs all other contributions to unavailability in our production environment" [4]. We believe that the correlation found among failure events arises due to dependencies among system components. Much effort has been made in the literature to produce quality statistical models of this correlation. But in using such models researchers do not make use of the fact that these dependencies can be explicitly modeled, since they are known to the system designers. In contrast, we propose a model wherein such dependencies are included, and demonstrate how an algorithm may make use of this information to optimize placement of data replicas within the data center. To achieve high availability, data centers typically store multiple replicas of data to tolerate the potential failure of system components. This gives rise to a placement problem, which, broadly speaking, involves determining which subset of nodes in the system should store a copy of a given file so as to maximize a given objective function (e.g., reliability, communication cost, response time, or access time). While our focus is on replica placements, we note that our model could also be used to place replicas of other system entities which require high- availability, such as virtual machines and mission-critical tasks. In this work, we present a new model for causal dependencies among failures, and a novel algorithm for optimal replica placement in our model. An example model is given as Fig. 1, in which three identical replicas of the same block of data are distributed on servers in a data center. Each server receives power from a surge protector which is located on each server rack. In Scenario I, each replica is located on nodes which share the same rack. In Scenario II, each replica is located on separate racks. As can be seen from the diagram of Scenario I (Fig. 1(a)), a failure in the power supply unit (PSU) on a single rack could result in a situation where every replica of a data block is completely unavailable, whereas in Scenario II, (Fig. 1(b)) three PSUs would need to fail in order to achieve the same result. In practice, Scenario I is avoided by ensuring that each replica is placed on nodes which lie on separate racks. This heuristic is already part of known best-practices. Our observation is that this simple heuristic can be suboptimal under certain conditions. For example, consider a failure in the aggregation switch which services multiple racks. Such a failure could impact the availability of every data replica stored on the rack. Moreover, this toy example only represents a small fraction of the number of events that could be modeled in a large data center. While many approaches for replica placement have been proposed, our ap- proach of modeling causal dependencies among failure events appears to be new. Other work on reliability in storage area networks has focused on objectives such as mean time to data loss [3, 7]. These exemplify an approach towards cor- related failure which we term "measure-and-conquer". In measure-and-conquer approaches, a measured degree of correlation is given as a parameter to the model. In contrast, we model explicit causal relations among failure events which we believe give rise to the correlation seen in practice. In [7] the authors consider high-availability replica placement, but are primarily focused on modeling the effects of repair time. Later work [3] begins to take into account information Switches Racks Servers v (cid:41) Replicas u B C A (a) Scenario I v Switches u Racks Servers A B C Replicas (b) Scenario II Fig. 1: Two scenarios represented by directed trees. 2 concerning the network topology, which is a step towards our approach. Similar measure-and-conquer approaches are taken in [1, 4, 8, 14]. More recently, Pezoa and Hayat [10] have presented a model in which spatially correlated failures are explicitly modeled. However, they consider the problem of task allocation, whereas we are focused on replica placement. In the databases community, work on replica placement primarily focuses on finding optimal placements in storage- area networks with regard to a particular distributed access model or mutual exclusion protocol [5, 12, 15]. In general, much of the work from this community focuses on specialized communication networks and minimizing communication costs -- system models and goals which are substantially different from our own. Recently, there has been a surge of interest in computer science concerning cascading failure in networks [2,6,9,16]. While our model is most closely related to this work, the existing literature is primarily concerned with applications involving large graphs intended to capture the structure of the world-wide web, or power grids. The essence of all these models is captured in the threshold cascade model [2]. This model consists of a directed graph in which each node v is associated with a threshold, (cid:96)(v) ∈ N+. A node v experiences a cascading failure if at least (cid:96)(v) of its incoming neighbors have failed. This model generalizes our own, wherein we pessimistically assume that (cid:96)(v) = 1 for all nodes v. Current work in this area is focused on network design [2], exploring new models [6, 9], and developing techniques for adversarial analysis [16]. To our knowledge, no one has yet considered the problem of replica placement in such models. 2 Model We model dependencies among failure events as a directed graph, where nodes represent failure events, and a directed edge from u to v indicates that the occurrence of failure event u could trigger the occurrence of failure event v. We refer to this graph as the failure model Given such a graph as input, we consider the problem of selecting nodes on which to store data replicas. Roughly, we define a placement problem as the problem of selecting a subset of these vertices, hereafter referred to as a placement, from the failure model so as to satisfy some safety criterion. In our application, only those vertices which represent storage servers are candidates to be part of a placement. We refer to such vertices as placement candidates. Note that the graph also contains vertices representing other types of failure events, which may correspond to real-world hardware unsuitable for storage (such as a ToR switch), or even to abstract events which have no associated physical component. In most applications, the set of placement candidates forms a subset of the set of vertices. More formally, let E denote the set of failure events, and C denote the set of placement candidates. We are interested in finding a placement of size ρ, which is defined to be a set P ⊆ C, with P = ρ. Throughout this paper we will use P to denote a placement, and ρ to denote its size. We consistently use C to denote the set of placement candidates, and E to denote the set of failure events. 3 Let G = (V, A) be a directed graph with vertices in V and edges in A. The vertices represent both events in E and candidates in C, so let V = E ∪ C. A directed edge between events e1 and e2 indicates that the occurrence of failure event e1 can trigger the occurrence of failure event e2. A directed edge between event e and candidate c indicates that the occurrence of event e could com- promise candidate c. We will assume failure to act transitively. That is, if a failure event occurs, all failure events reachable from it in G also occur. This a pessimistic assumption which leads to a conservative interpretation of failure. We now define the notions of failure number and failure aggregate. Definition 1. Let e ∈ E. The failure number of event e, denoted f (e, P ), for a given placement P , is defined as the number of candidates in P whose correct operation could be compromised by occurrence of event e. In particular, f (e, P ) = {p ∈ P p is reachable from e in G}. As an example, node u in Fig. 1 has failure number 3 in Scenario I, and failure number 1 in Scenario II. The following property is an easy consequence of the above definition. A formal proof can be found in the appendix. Property 1. For any placement P of replicas in tree T , if node i has descendant j, then f (j, P ) ≤ f (i, P ). The failure number captures a conservative criterion for a safe placement. Intuitively, we consider the worst case scenario, in which every candidate which could fail due to an occurring event does fail. Our goal is to find a placement which does not induce large failure numbers in any event. To aggregate this idea across all events, we define failure aggregate, a measure that accounts for the failure number of every event in the model. Definition 2. The failure aggregate of a placement P is a vector in Nρ+1, de- noted f (P ), where f (P ) := (cid:104)pρ, ..., p1, p0(cid:105), and each pi :=(cid:12)(cid:12)(cid:8)e ∈ E f (e, P ) = i(cid:9)(cid:12)(cid:12). In Fig. 1, node v has failure aggregate (cid:104)2, 0, 0, 1(cid:105) in Scenario I and failure aggre- gate (cid:104)1, 0, 2, 0(cid:105) in Scenario II. Failure aggregate is also computed in Fig. 6. In all of the problems considered in this paper, we are interested in opti- mizing f (P ). When optimizing a vector quantity, we must choose a meaningful way to totally order the vectors. In the context of our problem, we find that ordering the vectors with regard to the lexicographic order is both meaningful and convenient. The lexicographic order ≤L between f (P ) = (cid:104)pρ, ..., p1, p0(cid:105) and f (P (cid:48)) = (cid:104)p(cid:48) 0(cid:105) is defined via the following formula: f (P ) ≤L f (P (cid:48)) ⇐⇒ ∃ m > 0, ∀ i > m(cid:2)pi = p(cid:48) ρ, ..., p(cid:48) 1, p(cid:48) (cid:3). i ∧ pm ≤ p(cid:48) m To see why this is desirable, consider a placement P which lexicominimizes f (P ) among all possible placements. Such a placement is guaranteed to minimize pρ, i.e. the number of nodes which compromise all of the entities in our place- ment. Further, among all solutions minimizing pρ, P also minimizes pρ−1, the 4 number of nodes compromising all but one of the entities in P , and so on for pρ−2, pρ−3, ..., p0. Clearly, the lexicographic order nicely prioritizes minimizing the entries of the vector in an appealing manner. Throughout the paper, any time a vector quantity is maximized or minimized, we are referring to the maximum or minimum value in the lexicographic order. We will also use f (P ) to denote the failure aggregate, and pi to refer to the ith component of f (P ), where P can be inferred from context. In the most general case, we could consider the following problem. Problem 1. Given graph G = (V, A) with V = C ∪ E, and positive integer ρ with ρ < C, find a placement P ⊆ C with P = ρ such that f (P ) is lexicominimum. Problem 1 is NP-hard to solve, even in the case where G is a bipartite graph. In particular, a reduction to independent set can be shown. However, the problem is tractable for special classes of graphs, one of which is the case wherein the graph forms a directed, rooted tree with leaf set L and C = L. Our main contribution in this paper is a fast algorithm for solving Problem 1 in such a case. We briefly mention a greedy algorithm which solves the problem on O(n2ρ) time. However, since n (cid:29) ρ in practice our result of an O(n + ρ2) algorithm is much preferred. 2.1 An O(n2ρ) Greedy Algorithm The greedy solution to this problem forms a partial placement P (cid:48), to which new replicas are added one at a time, until ρ replicas have been placed overall. P (cid:48) starts out empty, and at each step, the leaf u which lexicominimizes f (P (cid:48) ∪{u}) is added to P (cid:48). This greedy algorithm correctly computes an optimal placement, however its running time is O(n2ρ) for a tree of unbounded degree. This running time comes about since each iteration requires visiting O(L) leaves for inclusion. For each leaf q which is checked, every node on a path from q to the root must have its failure number computed. Both the length of a leaf-root path and the number of leaves can be bounded by O(n) in the worst case, yielding the result. That the greedy algorithm works correctly is not immediately obvious. It can be shown via an exchange argument that each partial placement found by the greedy algorithm is a subset of some optimal placement. This is the content of Theorem 1 below. To establish the correctness of the greedy algorithm, we first introduce some notation. For a placement P and S ⊆ V , let f (S, P ) = (cid:104)gρ, gρ−1, ..., g1, g0(cid:105) where gi := {x ∈ S f (x, P ) = i}. Intuitively, f (S, P ) gives the failure aggregate for all nodes in set S ⊆ V . We first establish the truth of two technical lemmas before stating and proving Theorem 1. Lemma 1. Let r be the root of a failure model given by a tree. Given P ⊆ C, a, b ∈ C − P . If f (r (cid:32) a, P ) <L f (r (cid:32) b, P ) then f (P ∪ {a}) <L f (P ∪ {b}). Proof. Suppose f (r (cid:32) a, P ) <L f (r (cid:32) b, P ). Let nodes on the paths from r to a and from r to b be labeled as follows: r → a1 → a2 → ... → an → a 5 r → b1 → b2 → ... → bm → b We proceed in two cases. In the first case, there is some 1 ≤ i ≤ min(m, n) for which f (ai, P ) < f (bi, P ). Let i be the minimum such index, and let f (bi, P ) = k. Clearly, f (P ∪ {a})k < f (P ∪ {b})k, since P ∪{b} counts bi as having survival number k and P ∪ {a} does not. Moreover, since f (a(cid:96), P ) = f (b(cid:96), P ) for all (cid:96) < i, we have that for all j > k, f (P ∪ {a})j = f (P ∪ {b})j by Property 1. In the second case, f (ai, P ) ≥ f (bi, P ) for all 1 ≤ i ≤ min(m, n). In this case, if f (ai, P ) > f (bi, P ) for some i, the only way we could have f (r (cid:32) a, P ) <L f (r (cid:32) b, P ) is if there is some j > i with f (aj, P ) < f (bj, P ), but this is a con- tradiction. Therefore, f (ai, P ) = f (bi, P ) for all 1 ≤ i ≤ min(m, n). So, we must also have n ≤ m, since if n > m, we would have f (r (cid:32) a, P ) >L f (r (cid:32) b, P ). Moreover, since f (r (cid:32) a, P ) <L f (r (cid:32) b, P ), we must have that n < m, for if n = m, we would have f (r (cid:32) a, P ) = f (r (cid:32) b, P ), a contradiction. We have just shown the existence of some node bn+1, for which we must have that f (bn+1, P ) ≤ f (an, P ). Notice that the path r (cid:32) a does not have an (n + 1)st node, so it's clear that if f (bn+1, P ) = k, then f (P ∪ {a})k < f (P ∪ {b})k. Fi- nally, since n < m, we have by Property 1, that f (ai, P ) ≤ f (an, P ) ≤ k for all 1 ≤ i ≤ n. By an additional application of Property 1 it's easy to see that for all j > k, we have f (P ∪ {a})j = f (P ∪ {b})j. (cid:117)(cid:116) From Lemma 1, we obtain the following result as an easy Corollary. Corollary 1. Let r be the root of a failure model given by a tree. Given P ⊆ C, a, b ∈ C − P . Then f (r (cid:32) a, P ) ≤L f (r (cid:32) b, P ) if and only if f (P ∪ {a}) ≤L f (P ∪ {b}). Proof. Suppose f (r (cid:32) a, P ) ≤L f (r (cid:32) b, P ). If f (r (cid:32) a, P ) = f (r (cid:32) b, P ), then since the only nodes which change failure number when considering placements P and P ∪ {a} are those on the paths r (cid:32) a, and each of these nodes' failure numbers increase by 1, we must have that f (P ∪ {a}) = f (P ∪ {b}), since the sequence of failure numbers in r (cid:32) a and r (cid:32) b are the same. If f (r (cid:32) a, P ) <L f (r (cid:32) b, P ) then by Lemma 1 the Corollary is proven. If instead f (P ∪ {a}) ≤L f (P ∪ {b}), and yet f (r (cid:32) a, P ) >L f (r (cid:32) b, P ), then by Lemma 1 we obtain that f (P ∪{a}) >L f (P ∪{b}), a contradiction. (cid:117)(cid:116) Given a node u in a tree, let L(u) be the set of all leaves which are descendants of u. Lemma 2. Given P ⊆ C, a, b ∈ C. Let c be the least common ancestor of a and b, and let d be the child of c on the path from c to a. If f (r (cid:32) a, P ) ≤L f (r (cid:32) b, P ) and X ⊂ C − {a, b} for which L(d) ∩ X = ∅, and a, b /∈ X then f (P ∪ X ∪ {a}) ≤L f (P ∪ X ∪ {b}). Proof. We have that f (r (cid:32) a, P ) ≤L f (r (cid:32) b, P ). Consider f (r (cid:32) a, P ∪X) and f (r (cid:32) b, P ∪ X). We wish to show that f (r (cid:32) a, P ∪ X) ≤L f (r (cid:32) b, P ∪ X). 6 Since c is the least common ancestor of a and b, it is clear that nodes on r (cid:32) c have equivalent failure numbers in both cases. Therefore it suffices to show that f (c (cid:32) a, P ∪ X) ≤L f (c (cid:32) b, P ∪ X). Note that since d ∩ L(X) = ∅, we have that f (c (cid:32) a, P ∪ X) = f (c (cid:32) a, P ). Moreover, since the addition of nodes in X cannot cause failure numbers on the path c (cid:32) b to decrease, we must have that f (c (cid:32) b, P ) ≤L f (c (cid:32) b, P ∪ X). Altogether, we have that f (c (cid:32) a, P ∪ X) = f (c (cid:32) a, P ) ≤L f (c (cid:32) b, P ) ≤L f (c (cid:32) b, P ∪ X). By applying Corollary 1, we obtain that f (P ∪ X ∪{a}) ≤L f (P ∪ X ∪{b}). (cid:117)(cid:116) auv au av u swap v Fig. 2: Named nodes used in Theorem 1. The arrow labeled "swap" illustrates the leaf nodes between which replicas are moved, and is not an edge of the graph. Theorem 1. Let Pi be the partial placement from step i of the greedy algorithm. Then there exists an optimal placement P ∗, with P ∗ = ρ such that Pi ⊆ P ∗. Proof. The proof proceeds by induction on i. P0 = ∅ is clearly a subset of any optimal solution. Given Pi ⊆ P ∗ for some optimal solution P ∗, we must show that there is an optimal solution Q∗ for which Pi+1 ⊆ Q∗. Clearly, if Pi+1 ⊆ P ∗, then we are done, since P ∗ is optimal. In the case where Pi+1 (cid:54)⊆ P ∗ we must exhibit some optimal solution Q∗ for which Pi+1 ⊆ Q∗. Let u be the leaf which was added to Pi to form Pi+1. Let v be the leaf in P ∗ − Pi+1 which has the greatest-depth least common ancestor with u, where the depth of a node is given by its distance from the root (see Fig. 2). We set Q∗ = (P ∗ − {v}) ∪ {u}, and claim that f (Q∗) ≤L f (P ∗). Since f (P ∗) is optimal, and Pi+1 ⊆ Q∗ this will complete our proof. Clearly, f (a (cid:32) u, Pi) ≤L f (a (cid:32) v, Pi), since otherwise f (r (cid:32) u, Pi) >L f (r (cid:32) v, Pi), implying that f (Pi ∪ {u}) >L f (Pi ∪ {v}), contradicting our use of a greedy algorithm. Note that u, v /∈ (P ∗ − Pi − {v}). Moreover, by choice of v, we have that L(a) ∩ (P ∗ − Pi − {v}) = ∅, since the only nodes from P ∗ in L(a) must also be in Pi. To complete the proof, we apply Lemma 2, setting X = P ∗ − Pi − {v}. This choice of X is made so as to yield the following equalities. Q∗ = (P ∗ − {v}) ∪ {u} = Pi ∪ (P ∗ − Pi − {v}) ∪ {u}, 7 2 1, 2 1 1, 2 u v w rv rw qv swap qw Fig. 3: Round-robin placement cannot guarantee optimality Fig. 4: Nodes used in Theorem 2. P ∗ = Pi ∪ (P ∗ − Pi − {v}) ∪ {v}. By Lemma 2, we obtain inequality in the following formula, f (Q∗) = f (Pi ∪ (P ∗ − Pi −{v})∪{u}) ≤L f (Pi ∪ (P ∗ − Pi −{v})∪{v}) = f (P ∗). (cid:117)(cid:116) Thereby completing the proof. 3 Balanced Placements Consider a round-robin placement in which the set of replicas placed at each node is distributed among its children, one replica per child, until all replicas have been placed. This process is then continued recursively at the children. Throughout the process, no child is given more replicas than its subtree has leaf nodes. This method has intuitive appeal, but it does not compute an optimal placement exactly as can be seen from Fig. 3. Let placements P1 and P2 consist of the nodes labeled by 1 and 2 in Fig. 3 respectively. Note that both outcomes are round-robin placements. A quick computation reveals that f (P1) = (cid:104)1, 1, 7, 0(cid:105) (cid:54)= (cid:104)1, 3, 3, 2(cid:105) = f (P2). Since the placements have different failure aggregates, round- robin placement alone cannot guarantee optimality. Key to our algorithm is the observation that any placement which lexico- minimizes f (P ) must be balanced. If we imagine each child ci of u as a bin of capacity (cid:96)i, balanced nodes are those in which all unfilled children are approx- imately "level", and no child is filled while children of smaller capacity remain unfilled. These ideas are formalized in the following definitions. Definition 3. Let node u have children indexed 1, ..., k, and let the subtree rooted at the ith child of node u have (cid:96)i leaves, and ri replicas placed on it in placement P . A node for which (cid:96)i − ri = 0 is said to be filled. A node for which (cid:96)i − ri > 0 is said to be unfilled. Definition 4. Node u is said to be balanced in placement P iff: (cid:96)i − ri > 0 =⇒ ∀ j ∈ {1, ..., k} (ri ≥ rj − 1). Placement P is said to be balanced if all nodes v ∈ V are balanced. 8 3 0 0 3 2 1 1 1 0 0 0 0 0 3 1 0 1 0 1 0 0 2 0 0 1 0 1, 2 2 2 1 1 Fig. 5: Placements P1, P2 Fig. 6: Failure numbers for P1 (right) and P2 (left). To motivate a proof that lexico-minimum placements must be balanced, con- sider Fig. 5 in which P1 and P2 are sets containing leaf nodes labeled 1 and 2 respectively. Fig. 6 presents two copies of the same tree, but with failure num- bers labeled according to P1 and P2. Upon computing f (P1) and f (P2), we find that f (P1) = (cid:104)2, 1, 3, 7(cid:105) ≥L (cid:104)1, 1, 4, 7(cid:105) = f (P2). Note that for placement P1, the root of the tree is unbalanced, therefore P1 is unbalanced. Note also, that P2 is balanced, since each of its nodes are balanced. We invite the reader to verify that P2 is an optimal solution for this tree. Our main result is that it is necessary for an optimal placement to be bal- anced. However, the balanced property alone is not sufficient to guarantee op- timality. To see this, consider the two placements in Fig. 3. By definition, both placements are balanced, yet they have different failure aggregates. Therefore, balancing alone is insufficient to guarantee optimality. Despite this, we can use Theorem 2 to justify discarding unbalanced solutions as suboptimal. We exploit this property of optimal placements in our algorithm. Theorem 2. Any placement P in which f (P ) is lexicominimum among all placements for a given tree must be balanced. Proof. Suppose P is not balanced, yet f (P ) is lexicominimum among all place- ments P . We proceed to a contradiction, as follows. Let u be an unbalanced node in T . Let v be an unfilled child of u, and let w be a child of u with at least one replica such that rv < rw − 1. Since v is unfilled, we can take one of the replicas placed on w and place it on v. Let qw be the leaf node from which this replica is taken, and let qv be the leaf node on which this replica is placed (see Fig. 4). Let P ∗ := (P − {qw}) ∪ {qv}. We aim to show that P ∗ is more optimal than P , contradicting P as a lexicominimum. 0(cid:105). For convenience, we let f (w, P ) = m. To show that f (P ∗) <L f (P ), we aim to prove that p∗ m < pm, and that for any k with ρ ≥ k > m, that p∗ k = pk. We will concentrate on proving the former, and afterwards show that the latter follows easily. m < pm, observe that as a result of the swap, some nodes change failure number. These nodes all lie on the paths v (cid:32) qv and w (cid:32) qw. Let S− (resp. S+) be the set of nodes whose failure numbers change to m (resp. change Let f (P ) := (cid:104)pρ, ..., p0(cid:105), and f (P ∗) := (cid:104)p∗ To prove p∗ ρ, ..., p∗ 9 from m), as a result of the swap. Formally, we define By definition, p∗ which yields p∗ and after the swap, the failure number of w changes. Therefore, S− ≥ 1. S− := {x ∈ V f (x, P ) = m, f (x, P ∗) (cid:54)= m}, S+ := {x ∈ V f (x, P ) (cid:54)= m, f (x, P ∗) = m}. m = pm − S− + S+. We claim that S− ≥ 1 and S+ = 0, m < pm. To show S− ≥ 1, note that f (w, P ) = m by definition, To show S+ = 0, we must prove that no node whose failure number is affected by the swap has failure number m after the swap has occured. We choose to show a stronger result, that all such node's failure number must be strictly less than m. Let sv be an arbitrary node on the path v (cid:32) qv, and consider the failure number of sv. As a result of the swap, one more replica is counted as failed in each node on this path, therefore f (sv, P ∗) = f (sv, P ) + 1. Likewise, let sw be an arbitrary node on path w (cid:32) qw. One less replica is counted as failed in each node on this path, so f (sw, P ∗) = f (sw, P )− 1. We will show that f (sw, P ∗) < m, and f (sv, P ∗) < m. First, note that for any sw, by Property 1 f (sw, P ∗) ≤ f (w, P ∗) = m−1 < m. Therefore, f (sw, P ∗) < m, as desired. To show f (sv, P ∗) < m, note that by supposition rw − 1 > rv, and from this we immediately obtain f (w, P )− 1 > f (v, P ) by the definition of failure number. Now consider the nodes sv, for which f (sv, P ) ≤ f (v, P ) < f (w, P ) − 1 = m − 1 =⇒ f (sv, P ∗) − 1 < m − 1, Where the first inequality is an application of Property 1, and the implication follows by substitution. Therefore f (sv, P ∗) < m as desired. Therefore, among all nodes in P ∗ whose failure numbers change as a result of the swap, no node has failure number m, so S+ = 0 as claimed. Moreover, since f (s, P ∗) < m for any node s whose failure number changes as a result of k for all k where ρ ≥ k > m. This the swap, we also have proven that pk = p∗ (cid:117)(cid:116) completes the proof. 4 An O(nρ) Algorithm Our algorithm considers only placements which are balanced. To place ρ replicas, we start by placing ρ replicas at the root of the tree, and then proceed to assign these replicas to children of the root. We then recursively carry out the same procedure on each of the children. Before the recursive procedure begins, we obtain values of (cid:96)i at each node by running breadth-first search as a preprocessing phase. The recursive procedure is then executed in two consecutive phases. During the divide phase, the algorithm is tasked with allocating r(u) replicas placed on node u to the children of u. After the divide phase, some child nodes are filled, while others remain unfilled. To achieve balance, each unfilled child ci will have either r(ci) or r(ci) − 1 replicas placed upon them. The value of r(ci) is computed for each ci as part of the divide 10 phase. The algorithm is then recursively called on each unfilled node to obtain values of optimal solutions for their subtrees. Nodes which are filled require no further processing. The output of this call is a pair of two optimal failure aggregates, one supposing r(ci) replicas are placed at ci, the other supposing r(ci) − 1 are placed. Given these failure aggregates obtained from each child, the conquer phase then chooses whether to place r(ci) or r(ci) − 1 replicas on each unfilled child so as to achieve a lexicominimum failure aggregate for node u overall. For ease of exposition, we describe an O(nρ) version of our algorithm in this section, and prove it correct. In Section 5 then discuss improvements which can be used to obtain an O(n + ρ2) algorithm. Finally, we describe some tree transformations which can be used to obtain an O(n + ρ log ρ) algorithm in Section 6. 4.1 Divide Phase When node u is first considered, it receives at most two possible values for the number of replicas it could be asked to accommodate. Let these be the values r(u) and r(u) − 1. Let u have a list of children indexed 1, 2, ..., m, with leaf capacities (cid:96)i where 1 ≤ i ≤ m. The divide phase determines which children will be filled and which will be unfilled. Filled children will have (cid:96)i replicas placed on them in the optimal solution, while the number of replicas on the unfilled children is determined during the conquer phase. The set of unfilled children can be determined (without sorting) in an iter- ative manner using an O(m) time algorithm similar to that for the Fractional Knapsack problem. The main idea of the algorithm is as follows: in each iter- ation, at least one-half of the children whose status is currently unknown are assigned a filled/unfilled status. To determine which half, the median capacity child (with capacity (cid:96)med) is found using the selection algorithm. Based upon the number of replicas that have not been assigned to the filled nodes, either a) the set of children ci with (cid:96)i ≥ (cid:96)med are labeled as "unfilled" or b) the set of children ci with (cid:96)i ≤ (cid:96)med are labeled as "filled". The algorithm recurses on the remaining unlabeled children. Pseudocode for this algorithm can be found in Algorithm 1 We briefly sketch the correctness of Algorithm 1. The following invariant holds after every execution of the while loop: max(F ) · (U + M) < r − (cid:88) (cid:96)i ≤ min(U ) · U + (cid:96)i. (cid:88) ci∈M ci∈F easy to test for: U = ∅ if and only if (cid:80) (cid:96)i = r(u), and F = ∅ if and only if When U = ∅ or F = ∅ the invariant is not well-defined. These conditions are M (cid:99) for all i. Hence in what follows, we will work only with cases where (cid:96)i > (cid:98) r(u) U (cid:54)= ∅ and F (cid:54)= ∅. At the end of the algorithm, M = ∅, and the invariant reduces to the following max(F ) < ≤ min(U ). (1) r −(cid:80) ci∈F (cid:96)i U 11 Algorithm 1: Determines filled and unfilled nodes 1 Function Get-Filled(M , r)begin 2 F ← ∅ ; U ← ∅ ; while M (cid:54)= ∅ do // F := filled children U := unfilled children 3 4 5 6 7 8 9 10 11 12 13 14 15 (cid:96)med ← median capacity of children in M ; M1 ← {ci ∈ M (cid:96)i < (cid:96)med} ; M2 ← {ci ∈ M (cid:96)i = (cid:96)med} ; M3 ← {ci ∈ M (cid:96)i > (cid:96)med} ; (cid:96)i ; if x ≥ (cid:96)med · (U + M3) then x ← r −(cid:80) ci∈F∪M1∪M2 F ← F ∪ M1 ∪ M2 ; M ← M − (M1 ∪ M2) ; U ← F ∪ M2 ∪ M3 ; M ← M − (M2 ∪ M3) ; else // x to be distributed among M3 ∪ U // M1 ∪ M2 guaranteed filled // M2 ∪ M3 guaranteed unfilled return (F , U ) ; // return filled and unfilled children Equation 1 indicates that the average number of replicas placed on the unfilled nodes lies between the maximum value of F and the minimum value of U . From this, it is easy to see that the labeling is correct. Suppose that some filled child ci ∈ F has been incorrectly classified. This child contains at most (cid:96)i − 1 replicas, be assigned at least (cid:100) r−(cid:80)(cid:96)i and yet is still unfilled. Moreover, to attain the average, some unfilled child must (cid:101) replicas. Taking the difference of the number of ci∈F replicas assigned to these two unfilled nodes, we have U (cid:108) r −(cid:80) (cid:108) r −(cid:80) ≥ (cid:108) r −(cid:80) > ci∈F (cid:96)i U ci∈F (cid:96)i U ci∈F (cid:96)i U (cid:109) − (cid:96)i + 1 (cid:109) − max(F ) + 1 (cid:109) − max(F ) + 2 ≥ 2 which is a violation of the balanced placement property. Therefore, all replicas are correctly classified. This completes the proof sketch. Suppose we know that we only need to find placements of size r(u) and r(u) − 1 for node u. Moreover, we know that in an optimal placement of size r(u), each child ci only needs to accomodate either r(ci) or r(ci) − 1 replicas. Suppose that optimal placements of size r(ci) and r(ci) − 1 are available at each child ci. Theorem 3 shows that these placements are all that is required to compute optimal placements of size r(u) and also of size r(u) − 1. 12 k Theorem 3. In any case where r(u) or r(u)−1 replicas must be balanced among k unfilled children, it suffices to consider placing either (cid:100) r(u)−L (cid:101) or (cid:98) r(u)−L−1 (cid:99) replicas at each unfilled child. Proof. Let s := r(u) − L. Suppose s mod k = 0. If s replicas are placed at u, k(cid:101)) replicas. If s − 1 replicas k (= (cid:100) s then all unfilled children receive exactly s k (cid:99) replicas. If instead s mod k > 0, k − 1 = (cid:98) s−1 are placed at u, one child gets s k /∈ Z. To attain then the average number of replicas on each unfilled child is s this average using integer values, values both above and below s k are needed. However, since the unfilled children must be balanced, whatever values selected must have absolute difference at most 1. The only two integer values satisfying (cid:117)(cid:116) these requirements are (cid:100) s k (cid:99) when s mod k > 0. k(cid:101) and (cid:98) s k(cid:99). But (cid:98) s k(cid:99) = (cid:98) s−1 k 4.2 Conquer Phase k k Once the recursive call completes, we combine the results from each of the chil- dren to achieve the lexicographic minimum overall. Our task in this phase is to select (r(u) − L) mod k unfilled children on which (cid:100) r(u)−L (cid:101) replicas will be placed, and place (cid:98) r(u)−L−1 (cid:99) replicas on the remaining unfilled children. We need to do this in such a way that the resulting placement is lexicominimum. Recall also that we must return two values, one for r(u) and another for r(u) − 1. We show how to obtain a solution in the r(u) − 1 case using a greedy algorithm. A solution for r(u) can easily be obtained thereafter. In this section, when two vec- tors are compared or summed, we are implicitly making use of an O(ρ) function for comparing two vectors of length ρ in lexicographic order. Let ai (respectively bi) represent the lexicominimum value of f (P ) where P is any placement of (cid:98) r(u)−L−1 (cid:101)) replicas on child i. Recall that ai, bi ∈ Nρ+1, and are available as the result of the recursive call. We solve the optimization problem by encoding the decision to take bi over ai as a decision variable xi ∈ {0, 1}, for which either xi = 0 if ai is selected, or xi = 1 if bi is selected. The problem can then be described as an assignment of values to xi according to the following system of constraints, in which all arithmetic operations are performed point-wise. (cid:99) (respectively (cid:100) r(u)−L k k min ai + (bi − ai)xi, subj. to: xi = (r(u) − L) mod k. (2) i i An assignment of xi which satisfies the requirements in (2) can be found by computing bi − ai for all i, and greedily assigning xi = 1 to those i which have the (r(u) − L) mod k smallest values of bi − ai. This is formally stated as Theorem 4. Let π := (π1, π2, ..., πk) be a permutation of {1, 2, ..., k} such that: bπ1 − aπ1 ≤L bπ2 − aπ2 ≤L ... ≤L bπk − aπk . If vector x = (cid:104)x1, ..., xk(cid:105) is defined according to the following rules: set xπi = 1 iff i < (r(u) − L) mod k, else xπi = 0, then x is an optimal solution to (2). 13 (cid:88) (cid:88) The following Lemma greatly simplifies the proof of Theorem 4. Lemma 3. (cid:104)Zn, +(cid:105) forms a linearly-ordered group under ≤L. In particular, for any x, y, z ∈ Zn, x ≤L y =⇒ x + z ≤L y + z. A straight-forward proof of Lemma 3 can be found in the appendix. the quantity(cid:80) i(bi − ai)xi also minimizes the quantity(cid:80) Proof (Proof of Theorem 4). First, notice that a solution to (2) which minimizes i ai + (bi − ai)xi. It suffices to minimize the former quantity, which can be done by considering only those values of (bi − ai) for which xi = 1. For convenience, we consider x to be the characteristic vector of a set S ⊆ {1, ..., k}. We show that no other set S(cid:48) can yield a characteristic vector x(cid:48) which is strictly better than x as follows. Let α := (r(u) − L) mod k, and let S := {π1, ..., πα−1} be the first α − 1 entries of π taken as a set. Suppose that there is some S(cid:48) which represents a feasible assignment of variables to x(cid:48) for which x(cid:48) is a strictly better solution than x. S(cid:48) ⊆ {1, ..., k}, such that S(cid:48) = α − 1, and S(cid:48) (cid:54)= S. Since S(cid:48) (cid:54)= S, and S(cid:48) = S we have that S − S(cid:48) (cid:54)= ∅ and S(cid:48) − S (cid:54)= ∅. Let i ∈ S − S(cid:48) and j ∈ S(cid:48) − S. We claim that we can form a better placement, S∗ = (S(cid:48)−{j})∪{i}. Specifically, (cid:88) (cid:96)∈S∗ (cid:88) m∈S(cid:48) (b(cid:96) − a(cid:96)) ≤L (bm − am) . (3) which implies that replacing a single element in S(cid:48) with one from S does not cause the quantity minimized in (2) to increase. To prove (3) note that j /∈ S and i ∈ S =⇒ (bi − ai) ≤L (bj − aj). We now (cid:96)∈(S∗−{i})(b(cid:96) − a(cid:96)). apply Lemma 3, setting x = (bi−ai), y = (bj−aj), and z =(cid:80) This yields(cid:88) (cid:88) (b(cid:96) − a(cid:96)) + (bi − ai) ≤L (b(cid:96) − a(cid:96)) + (bj − aj) . But since S∗ − {i} = S(cid:48) − {j}, we have that (b(cid:96) − a(cid:96)) + (bi − ai) ≤L (bm − am) + (bj − aj) . (4) Clearly, (4) =⇒ (3), thereby proving (3). This shows that any solution which is not S can be modified to swap in one extra member of S without increasing the quantity minimized in (2). By induction, it is possible to include every element from S, until S itself is reached. Therefore, x is an optimal solution to (2). (cid:117)(cid:116) In the algorithm, we find an optimal solution to (2) by assigning (cid:100) r(u)−L−1 (cid:101) replicas to those children where i is such that 1 ≤ i < (r(u) − L) mod k, and (cid:98) r(u)−L (cid:99) replicas to those remaining. To do this, we find the unfilled child having the ((r(u)− L) mod k)th largest value of bi − ai using linear-time selection, and use the partition procedure from quicksort to find those children having values below the selected child. This takes time O(kρ) at each node. k k 14 (cid:96)∈(S∗−{i}) (cid:88) (cid:96)∈(S∗−{i}) (cid:96)∈(S∗−{i}) (cid:88) m∈(S(cid:48)−{j}) At the end of the conquer phase, we compute and return the sum1 (cid:88) (cid:88) (cid:88) i < (r(u)−L) mod k i ≥ (r(u)−L) mod k j : filled bi + ai + f (Pj) + 1r(u)−1, (5) where Pj is the placement of (cid:96)j replicas on child j and 1r(u)−1 is a vector of length ρ having a one in entry r(u) − 1 and zeroes everywhere else. The term 1r(u)−1 accounts for the failure number of u. This sum gives the value of an optimal placement of size r(u) − 1. Note there are k + 1 terms in the sum, each of which is a vector of length at most ρ + 1. Both computing the sum and performing the selection take O(kρ) time at each node, yielding O(nρ) time overall. We have only focused upon computing the value of the optimal solution. The solution itself can be recovered easily by storing the decisions made during the conquer phase at each node, and then combining them to output an optimal placement. 5 An O(n + ρ2) Algorithm An O(n + ρ2) running time can be achieved by an O(n) divide phase, and an O(ρ2) conquer phase. The divide phase already takes at most O(n) time overall, so to achieve our goal, we concern ourselves with optimizing the conquer phase. The conquer phase can be improved upon by making two changes. First, we modify the vector representation used for return values. Second, we transform the structure of the tree to avoid pathological cases. In the remainder of the paper, we will use array notation to refer to entries of vectors. For a vector v, the kth entry of v is denoted v[k]. Compact Vector Representation Observe that the maximum failure number returned from child ci is r(ci). This along with Property 1 implies that the vector returned from ci will have a zero in indices ρ, ρ− 1, ..., r(ci) + 1. To avoid wasting space, we modify the algorithm to return vectors of length only r(ci). At each node, we then compute (5) by summing entries in increasing order of their index. Specifically, to compute v1 + v2 + ... + vk, where each vector vj has length r(ci), we first allocate an empty vector w, of size r(ci), to store the result of the sum. Then, for each vector vj, we set w[i] ← w[i] + vj[i] for indices i from 0 up to r(ci). After all vectors have been processed, w = v1 + ... + vk. This algorithm takes r(c1) + ... + r(ck) = O(r(u)) time. Using smaller vectors also implies that the ((r(u) − L) mod k)th best child is found in O(r(u)) time, since each unfilled child returns a vector of size at most O( r(u) k ), and there are only k unfilled children to compare. With these modifications the conquer phase takes O(r(u)) time at node u. 1 In the mentioned sum we assume for notational convenience, that the vectors have been indexed in increasing order of bi − ai, although the algorithm performs no such sorting. 15 Tree Transformations Note that for each i, nodes at depth i have O(ρ) repli- cas placed on them in total. We can therefore achieve an O(ρ2) time conquer phase overall by ensuring that the conquer phase only needs to occur in at most O(ρ) levels of the tree. To do this, we observe that when r(u) = 1, any leaf with minimum depth forms an optimal placement. Recursive calls can therefore be stopped once r(u) = 1. To ensure that r(u) = 1 after O(ρ) levels, we contract paths on which all nodes have degree two into a single pseudonode during the preprocessing phase. The length of this contracted path is stored in the pseudon- ode, and is accounted for when computing the sum. This suffices to ensure r(u) decreases by at least one at each level, yielding an O(n + ρ2) algorithm. 6 An O(n + ρ log ρ) Algorithm In this section, we extend ideas about tree transformation from the last section to develop an algorithm in which the conquer phase only needs to occur in at most O(log ρ) levels. We achieve this by refining the tree transformations described in Section 5. 2 To ensure that there are only O(log ρ) levels in the tree, we transform the tree so as to guarantee that as the conquer phase proceeds down the tree, r(u) decreases by at least a factor of two at each level. This happens automatically when there are two or more unfilled nodes at each node, since to balance the unfilled children, at most (cid:100) r(u)−L (cid:101) replicas will be placed on each of them. Prob- lems can therefore only arise when a tree has a path of nodes each of which have a single, unfilled child. We call such a path a degenerate chain. By detecting and contracting all such degenerate chains, we can achieve an O(ρ log ρ) conquer phase. Fig. 7(a) illustrates a degenerate chain. In this figure, each Ti with 1 ≤ i ≤ t − 1 is the set of all descendant nodes of vi which are filled. Thus, v1, ..., vt−1 each have only a single unfilled child (since each vi has vi+1 as an child). In contrast, node vt has at least two unfilled children. It is easy to see that if the number of leaves in each Ti is O(1) then t, the length of the chain, can be as large as O(ρ). This would imply that there can be O(ρ) levels in the tree where the entire conquer phase is required. To remove degenerate chains, we contract nodes v1, ..., vt−1 into a single pseudonode w, as in Fig. 7(b). However, we must take care to ensure that the pair of vectors which pseudonode w returns takes into account contributions from the entire contracted structure. We will continue to use vi and Ti throughout the remainder of this section to refer to nodes in a degenerate chain. To find and contract degenerate chains, we add an additional phase, the transform phase, which takes place between the divide and conquer phases. Recall that after the divide phase, the set of filled and unfilled children are available at each node. Finding nodes in a degenerate chain is therefore easily done via a breadth-first search. We next consider what information must be stored in the pseudonode, to ensure that correct results are maintained. 16 le n g t h v1 T1 O(1) leaves v2 T2 O(1) leaves O ( ρ ) v3 T3 w vt Tt . . . vt Tt O(1) leaves (b) Contracted pseudonode. (a) A degenerate chain. Fig. 7: Illustration of a degenerate chain in which each vi where 1 ≤ i ≤ t − 1 represents a node which has a single unfilled child. All filled descendents of node vi are collectively represented as Ti. In the figure on the right, nodes v1, ..., vt−1 have been contracted into pseudonode w. Let (aw, bw) be the pair of values which will be returned by pseudonode w at the end of the conquer phase. In order for the transformation to be correct, the vectors (aw, bw) must be the same as those which would have been returned at node v1 had no transformation occurred. To ensure this, we must consider and include the contribution of each node in the set T1 ∪ ... ∪ Tt−1 ∪ {v1, ..., vt−1}. It is easy to see that the failure numbers of nodes in {v1, ..., vt−1} depend only upon whether r(vt) or r(vt) − 1 replicas are placed on node vt, while the filled nodes in sets T1, ..., Tt−1 have no such dependency. Observe that if r(vt) replicas are placed on vt, then r(vi) replicas are placed at each node vi. If instead r(vt) − 1 replicas are placed, then r(vi) − 1 replicas are placed at each vi. Since values of r(vi) are available at each node after the divide phase, enough information is present to contract the degenerate chain before the conquer phase is performed. The remainder of this section focuses on the technical details needed to sup- port our claim that the transform phase can be implemented in time O(n + ρ log ρ) overall. Let Sw := T1∪...∪Tt−1∪{v1, ..., vt−1}, and let the contibution of nodes in Sw to aw and bw be given by vectors a and b respectively. The transform phase is then tasked with computing a and b, and contracting the degenerate chain. We will show that this can be done in time O(Sw + r(v1)) for each pseudonode w. Pseudocode for the transform phase is given in Algorithm 2. The transform phase is started at the root of the tree by invoking Transform(root, f alse, ρ). Transform is a modified recursive breadth-first search. As the recursion proceeds down the tree, each node is tested to see if it is part of a degenerate chain (lines 17 Algorithm 2: Transform phase 1 Function Transform(u, chain, r(v1))begin 2 if u has two or more unfilled children then 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 foreach child ci unfilled do (−,−,−, x) ←Transform(ci, f alse,⊥) ; ci ← x ; if chain = f alse then return (⊥,⊥,⊥, u) ; else return (0r(v1)+1, 0r(v1)+1, 0r(v1)+1, u) ; if u has one unfilled child, v then if chain = f alse then // pass r(v) as max vector length (a, b, f , x) ← Transform(v, true, r(v)) ; else (a, b, f , x) ← Transform(v, true, r(v1)) ; foreach filled child ci do k ←(cid:80) Filled(ci, f ) ; i (cid:96)i + r(v) − 1; a[k + 1] ← a[k + 1] + 1; b[k] ← b[k] + 1; if chain = f alse then x ← Make-Pseudonode(a, b, f , x) return (a, b, f , x) // 3 · O(r(v1)) time // O(ni) time 2 and 8). If a node is not part of a degenerate chain, the call continues on all unfilled children (line 3). The first node (v1) in a degenerate chain is marked by passing down chain ← true at lines 11 and 13. The value of r(v1) is also passed down to the bottom of the chain at lines 11 and 13. Once the bottom of the chain (node vt) has been reached, the algorithm allocates memory for three vectors, a, b and f , each of size r(v1) + 1 (line 7). These vectors are then passed up through the entire degenerate chain (line 21), along with node u, whose use will be explained later. When a node u in a degenerate chain receives a, b, and f , u adds its contribution to each vector (lines 14-18). The contribution of node u consists of two parts. First, the contribution of the filled nodes is added to f by invoking a special Filled subroutine (see Algorithm 3) which computes the sum of the failure aggregates of each filled child of u (lines 14-15). Note that Filled uses pass-by-reference semantics when passing in the value of f . The contribution of node u itself is then added, by summing the number of leaves in all of the filled children, and the number of replicas on the single unfilled child, v (lines 16-18). By the time that the recursion reaches the start of the chain on the way back up (line 19), all nodes have added their contribution, and the pseudonode is created and returned (line 20). The transformation takes place as Transform is returned back up the tree. At the end of the degenerate chain, node vt is returned (lines 6-7), and this value is 18 Algorithm 3: Computes failure aggregate of filled nodes 1 Function Filled(u, f )begin 2 else if u is a leaf then f [0] ← f [0] + 1; return; 3 4 5 6 7 8 9 foreach child ci do Filled(ci, f ) a ←(cid:80) i (cid:96)i ; f [a] ← f [a] + 1; return; passed along the length of the entire chain (line 21), until reaching the beginning of the chain, where the pseudonode is created and returned (line 20). When the beginning of the chain is reached, the parent of v1 updates its reference (line 5) to refer to the newly created pseudonode. At line 5 note that if ci was not the beginning of a degenerate chain, x = ci and the assignment has no effect (see lines 6-7). We provide pseudocode for the Filled and Make-Pseudonode subroutines in Algorithms 3 and 4. The Make-Pseudonode subroutine runs in O(1) time. It is easy to see that the Filled routine runs in O(ni) time, where ni is the number of nodes in the subtree rooted at child ci. The Transform routine therefore takes O(Ti) time to process a single node vi. The time needed for Transform to process an entire degenerate chain is therefore O(Sw) + 3 · O(r(v1)), where the 3 · O(r(v1)) term arises from allocating memory for vectors a, b and f at the last node of the chain. When we sum this time over all degenerate chains, we obtain a running time of O(n+ρ log ρ) for the transform phase. To reach this result, we examine the sum of r(v1) for all pseudonodes at level i. Since there are at most ρ replicas at each level i, this sum can be at most O(ρ) in any level. There are only O(log ρ) levels where r(u) > 1 after degenerate chains have been contracted, thus, pseudonodes can be only be present in the first O(log ρ) levels of the tree. Therefore the 3 · O(r(v1)) term sums to O(ρ log ρ) overall. Since Sw clearly sums to O(n) overall, the transform phase takes at most O(n + ρ log ρ) time. Finally, after the transformation has completed, we can ensure that the value of r(u) decreases by a factor of two at each level. This implies that there are only O(log ρ) levels where the conquer phase needs to be run in its entirety. Therefore, the conquer phase takes O(ρ log ρ) time overall. When combined with the O(n) divide phase and the O(n + ρ log ρ) transform phase, this yields an O(n + ρ log ρ) algorithm for solving replica placement in a tree. 19 Algorithm 4: Creates and returns a new pseudonode 1 Function Make-Pseudonode(a, b, f , x)begin 2 allocate a new node node; node.a ← a + f ; node.b ← b + f ; node.child ← x; return node 3 4 5 6 7 Conclusion In this paper, we formulate the replica placement problem and show that it can be solved by a greedy algorithm in O(n2ρ) time. In search of a faster algorithm, we prove that any optimal placement in a tree must be balanced. We then exploit this property to give a O(nρ) algorithm for finding such an optimal placement. The running time of this algorithm is then improved, yielding an O(n + ρ log ρ) algorithm. An interesting next step would consist of proving a lower bound for this problem, and seeing how our algorithm compares. In future work we plan to consider replica placement on additional classes of graphs, such as special cases of bipartite graphs. We would like to acknowledge insightful comments from S. Venkatesan and Balaji Raghavachari during meetings about results contained in this paper, as well as comments from Conner Davis on a draft version of this paper. References 1. Bakkaloglu, M., Wylie, J.J., Wang, C., et. al: On correlated failures in survivable storage systems. Tech. Rep. CMU-CS- 02-129, Carnegie Mellon University (2002) 2. Blume, L., Easley, D., Kleinberg, J., Kleinberg, R., Tardos, E.: Which networks are least susceptible to cascading failures? In: Foundations of Computer Science (FOCS), 2011 IEEE 52nd Annual Symposium on. pp. 393 -- 402 (Oct 2011) 3. Chen, M., Chen, W., Liu, L., et. al: An analytical framework and its applications for studying brick storage reliability. In: Proceedings of 26th International Symposium on Reliable Distributed Systems. pp. 242 -- 252. IEEE Computer Society (2007) 4. Ford, D., Labelle, F., Popovici, F.I., Stokely, M., Truong, V.A., Barroso, L., Grimes, C., Quinlan, S.: Availability in globally distributed storage systems. In: Presented as part of the 9th USENIX Symposium on Operating Systems Design and Imple- mentation. USENIX, Berkeley, CA (2010) 5. Hu, X.D., Jia, X.H., Du, D.Z., Li, D.Y., Huang, H.J.: Placement of data replicas for optimal data availability in ring networks. Journal of Parallel and Distributed Computing 61(10), pp. 1412 -- 1424 (2001) 6. Kim, J., Dobson, I.: Approximating a loading-dependent cascading failure model with a branching process. IEEE Transactions on Reliability 59, pp. 691 -- 699 (Dec 2010) 7. Lian, Q., Chen, W., Zhang, Z.: On the impact of replica placement to the reliability of distributed brick storage systems. In: 25th IEEE International Conference on Distributed Computing Systems (ICDCS'05). pp. pp. 187 -- 196. IEEE (2005) 20 8. Nath, S., Yu, H., Gibbons, P.B., Seshan, S.: Subtleties in tolerating correlated failures in wide-area storage systems. In: 3rd Symposium on Networked Systems Design and Implementation (NSDI 2006), May 8-10, 2007, San Jose, California, USA, Proceedings. pp. 225 -- 238 (2006) 9. Nie, L., Liu, J., Zhang, H., Xu, Z.: On the inapproximability of minimizing cas- cading failures under the deterministic threshold model. Information Processing Letters 114, pp. 1 -- 4 (2014) 10. Pezoa, J., Hayat, M.: Reliability of heterogeneous distributed computing systems in the presence of correlated failures. IEEE Transactions on Parallel and Distributed Systems, 25(4), pp. 1034 -- 1043 (April 2014) 11. Pletz, J.: The price of failure: Data-center power outage cost sears $2.2m in profit. http://www.chicagobusiness.com/article/20130604/BLOGS11/130609948/ the-price-of-failure-data-center-power-outage-cost-sears-2-2m-in-profit (Jun 2013) 12. Shekhar, S., Wu, W.: Optimal placement of data replicas in distributed database with majority voting protocol. Theoretical Computer Science 258, pp. 555 -- 571 (2001) 13. Verge, J.: How a switch failure in utah took out four big hosting providers. http://www.datacenterknowledge.com/archives/2013/08/05/how-did-the-failure- of-network-switches-at-a-little-known-data-center-in-provo-utah-knock-four- major-services-and-millions-of-web-pages-offline (Sep 2013) 14. Weatherspoon, H., Moscovitz, T., Kubiatowicz, J.: Introspective failure analysis: Avoiding correlated failures in peer-to-peer systems. In: Proceedings of the 21st IEEE Symposium on Reliable Distributed Systems, 2002. pp. 362 -- 367 (2002) 15. Zhang, Z., Wu, W., Shekhar, S.: Optimal placements of replicas in a ring network with majority voting protocol. J. Parallel Distrib. Comput. 69(5), 461 -- 469 (May 2009) 16. Zhu, Y., Yan, J., Sun, Y., He, H.: Revealing cascading failure vulnerability in power grids using risk-graph. IEEE Transactions on Parallel and Distributed Systems, 25(12), pp. 3274 -- 3284 (Dec 2014) Appendix Proof of Property 1 The following property from Section 2 is an easy result regarding failure numbers which is used in the proofs of Theorems 1 and 2. Proof (Proof of Property 1). Suppose that in P there are ki replicas placed on leaves in the subtree rooted at i. If i fails, ki replicas fail, yielding s(i, P ) = ρ−ki. Let kj be the number of replicas in the subtree rooted at j. Clearly, kj ≤ ki, (cid:117)(cid:116) yielding the result. NP-Hardness of Problem 1 However, Problem 1 is NP-hard to solve exactly or approximately. In partic- ular, we can reduce the well-known problems of Independent Set (IS) and Dominating Set (DS) to Problem 1. The reduction from DS shows that min- imizing only the first entry of f (P ), fr, is NP-hard, while the reduction from 21 IS shows that lexico-minimizing the vector down to the second-to-last entry, f1 is NP-hard. That is to say, if it were possible to lexico-minimize the vector (cid:104)fr, ..., f2, f1(cid:105) in polynomial time, it would imply P = NP. Proof of Lemma 3 The proof of Theorem 4 is greatly simplified through use of an algebraic property of addition on Zn under lexicographic order. Recall that a group is a pair (cid:104)S,·(cid:105), where S is a set, and · is a binary operation which is 1) closed for S, 2) is associative, and has both 3) an identity and 4) inverses. A linearly-ordered group is a group G = (cid:104)S,·(cid:105), along with a linear-order ≤ on S in which for all x, y, z ∈ S, x ≤ y =⇒ x·z ≤ y·z, i.e. the linear-order on G is translation-invariant. Lemma 3 states that Zn under ≤L has such a property. Proof (Proof of Lemma 3). It is well-known that G = (cid:104)Zn, +(cid:105) is a group. To show G is linearly-ordered, it suffices to show that ∀ x, y, z ∈ Zn : x ≤L y =⇒ x + z ≤L y + z . If x = y then surely x + z = y + z =⇒ x + z ≤L y + z. If instead, x ≤L y, then let k = minxi<yi i. Note that for all i with 1 ≤ i < k, xi = yi, and that xk < yk. Consider x + z and y + z. Surely, for all 1 ≤ i < k, (x + z)i = (y + z)i, since xi = yi =⇒ xi + zi = yi + zi. Likewise, (x + z)k < (y + z)k, since xk < yk =⇒ xk + zk < yk + zk. (cid:117)(cid:116) Therefore, x ≤L y =⇒ x + z ≤L y + z. 22
1104.1852
1
1104
2011-04-11T06:25:40
Randomized $\Delta$-Edge-Coloring via Quaternion of Complex Colors
[ "cs.DS" ]
This paper explores the application of a new algebraic method of color exchanges to the edge coloring of simple graphs. Vizing's theorem states that the edge coloring of a simple graph $G$ requires either $\Delta$ or $\Delta+1$ colors, where $\Delta$ is the maximum vertex degree of $G$. Holyer proved that it is {\bf NP}-complete to decide whether $G$ is $\Delta$-edge-colorable even for cubic graphs. By introducing the concept of complex colors, we show that the color-exchange operation follows the same multiplication rules as quaternion. An initially $\Delta$-edge-colored graph $G$ allows variable-colored edges, which can be eliminated by color exchanges in a manner similar to variable eliminations in solving systems of linear equations. The problem is solved if all variables are eliminated and a properly $\Delta$-edge-colored graph is reached. For a randomly generated graph $G$, we prove that our algorithm returns a proper $\Delta$-edge-coloring with a probability of at least 1/2 in $O(\Delta|V||E|^5)$ time if $G$ is $\Delta$-edge-colorable. Otherwise, the algorithm halts in polynomial time and signals the impossibility of a solution, meaning that the chromatic index of $G$ probably equals $\Delta+1$. Animations of the edge-coloring algorithms proposed in this paper are posted at YouTube http://www.youtube.com/watch?v=KMnj4UMYl7k.
cs.DS
cs
Randomized ∆-Edge-Coloring via Quaternion of Complex Colors (Extended Abstract) Tony T. Lee ∗ Yujie Wan † Hao Guan ‡ June 7, 2018 Abstract This paper explores the application of a new algebraic method of color exchanges to the edge coloring of simple graphs. Vizing's theorem states that the edge coloring of a simple graph G requires either ∆ or ∆ + 1 colors, where ∆ is the maximum vertex de- gree of G. Holyer proved that it is NP-complete to decide whether G is ∆-edge-colorable even for cubic graphs. By introducing the concept of complex colors, we show that the color-exchange operation follows the same multiplication rules as quaternion. An initially ∆-edge-colored graph G allows variable-colored edges, which can be eliminated by color exchanges in a manner similar to variable eliminations in solving systems of linear equa- tions. The problem is solved if all variables are eliminated and a properly ∆-edge-colored graph is reached. For a randomly generated graph G, we prove that our algorithm returns a proper ∆-edge-coloring with a probability of at least 1/2 in O(∆V E5) time if G is ∆-edge-colorable. Otherwise, the algorithm halts in polynomial time and signals the im- possibility of a solution, meaning that the chromatic index of G probably equals ∆ + 1. Animations of the edge-coloring algorithms proposed in this paper are posted at YouTube http://www.youtube.com/watch?v=KMnj4UMYl7k. Keywords: incidence graph, edge coloring, color exchange, Kempe path, directional path 1 Introduction The chromatic index χe(G) of a simple graph G = (V, E), with vertex set V and edge set E, is the minimum number of colors required to color the edges of the graph such that no adjacent edges have the same color. A theorem proved by Vizing [18] states that the chromatic index is either ∆ or ∆ + 1, where ∆ is the maximum vertex degree of graph G. The graph G is said to be Class 1 if χe(G) = ∆; otherwise, it is Class 2. Except for some particular types of graphs, such as bipartite graphs, it is inherently difficult to classify an arbitrary simple graph. In fact, Holyer has proved in [14] that it is NP-complete to determine the chromatic index of arbitrary simple graph even if ∆ = 3. In this paper, we describe a new algebraic method of color exchanges for edge coloring of simple graphs. The original color-exchange method was devised by Alfred Kempe in his endeavor to prove the four-color theorem [16]. Although his attempt was unsuccessful, his method remains critical to the final proof given by Appel and Haken [4]. The Kempe chain method was defined on two-colored vertices. An extension of this method to two-colored edges, called alternating paths, constitutes the basis of the proof of Vizing's theorem and Edmonds' ∗Tony T. Lee is with Dept. of Information Engineering, The Chinese University of Hong Kong, Hong Kong and Dept. of Electronics Engineering, Shanghai Jiao Tong University, Shanghai, China. Email: [email protected] †Yujie Wan is with Dept. of Information Engineering, The Chinese University of Hong Kong, Hong Kong. Email: [email protected] ‡Hao Guan is with Dept. of Information Engineering, The Chinese University of Hong Kong, Hong Kong. Email: [email protected] 1 matching algorithm [8]. By introducing the concept of complex colors, we show that the color- exchange operation performed on alternating paths follows the same multiplication rules as quaternion, and edge coloring is a procedure of variable eliminations. We consider each edge e ∈ E as a pair of links; each link is a half-edge. Let C be the set of colors. The coloring of graph G = (V, E) is a function c : E → C × C defined by assigning a color pair, or a complex color, to each e ∈ E, one color assigned for each link. If C = ∆, then a color configuration c of G such that all links incident to the same vertex have different colors can be easily obtained. Suppose that the complex color assigned to edge e is c(e) = (α, β), α, β ∈ C, then the colored edge e is a variable if α 6= β; otherwise, c(e) = (α, α) is a constant for any color α. A proper ∆-edge-coloring of graph G can be achieved by eliminating all variables. Our edge-coloring algorithm starts with an arbitrary color configuration c of G, which may contain variable edges. Applying a sequence of well-defined "moves" (color exchanges) of vari- ables in a configuration may lead to other new configurations. Variables can be systematically eliminated when they encounter other variables while moving around the graph. For a graph G with ∆ ≥ 3, the algorithm can be initialized by a configuration of G with a set of ∆ colors C = {c1, ..., c∆}. First, we eliminate variables that contain color c1, then remove the remaining variables that contain color c2, and so on. The problem is solved if all variables are eliminated and a properly ∆-edge-colored graph is reached; otherwise, the algorithm halts in polynomial time and signals the impossibility of a solution, meaning that the chromatic index of G probably equals ∆ + 1, which implies that the graph G could be class 2. Based on random walks on graphs, the average time that a variable hits another variable in a graph has a polynomial bound [2] [3] [17] . For a randomly generated graph G, we prove that our algorithm returns a proper ∆-edge-coloring with a probability of at least 1/2 in O(∆V E5) time if chromatic index χe(G) = ∆. On the other hand, it returns with absolute certainty if G is a class 2 graph. In existing literature, the only known exact algorithms are the O(2V /2) and O(1.5039V ) algorithms for 3-edge-coloring proposed by Beigel and Eppstein [9] [5]. Vizing's proof implies an O(V E) time algorithm with ∆ + 1 colors, which was later improved to O(EpV log V ) by Gabow et al. [11]. Some approximation algorithms with high probability of success were reported in [12] [7] [1]. Grable and Panconesi [12] proposed an edge coloring algorithm using (1 + ǫ)∆ colors, which operates in O(log log V ) rounds if ∆ is larger than polylogV but smaller than any positive power of V . Dubhashi, Grable, and Panconesi [7] proposed another O(log V + logs V log log V ) time algorithm using ∆ + ∆/ logs V colors if ∆ = Ω(logk V ) for some constants s, k > 0. For general multigraph with ∆ = ω(V 2), Aggarwal et al. [1] proposed an algorithm using ∆ + o(∆) colors that runs in O(V 2) steps. There are also some heuristics reported in [13] that do not provide any performance guarantees. Our randomized algorithm is the first polynomial time algorithm for ∆-edge-coloring. In principle, each vertex v ∈ V and each edge e ∈ E represent a constraint on coloring of edges, and the entire graph G can be considered as a set of simultaneous equations. The variable elimination procedure of edge coloring is similar to the Gaussian elimination of solving systems of linear equations. A comparison between these two procedures is summarized in Table 1. System of linear equations Operations Constraints Unknowns Algorithms Solutions No solution Complexity arithmetic operations linear equations variables variable elimination consistency inconsistency polynomial time Edge coloring color exchanges vertices and edges variable-colored edges variable elimination ∆-colorable infinite loop (χe(G) = ∆ + 1) randomized polynomial time Table 1: Comparison between system of linear equations and edge coloring of simple graphs. 2 In spite of the similarity between solving linear equations and edge coloring, the main differ- ence is recognizing the final state. If a system of linear equations has no solution, the inconsis- tency of the system can be identified by variable eliminations in polynomial time. Eliminating variable edges of class 2 graphs may result in an infinite loop. Recognizing snarks, class 2 cubic graphs, could have been significant in determining the halting state of edge-coloring algorithms. A polynomial time algorithm for identifying snarks will immediately lead to the conclusion that P=NP. The rest of this paper is organized as follows. In section 2, we define the color function of incidence graphs, and establish the rules of color exchanges and Kempe walks. In section 3, we describe the variable elimination procedure by Kempe walks, and introduce the concept of canonical configurations. Section 4 is devoted to walks on directional paths. In particular, we give a randomized algorithm based on walks on spanning tree with deflection. In addition, the performance of this randomized algorithm and the characterization of snarks are provided in this section. In section 5, we present experimental results and compare our method with existing heuristics. Section 6 provides a conclusion and discussions on future research. 2 Color-Exchange Operations of Complex Colors This section introduces an algebraic method of color exchanges implemented on the edges of a colored simple graph. We first describe the properties of color function defined on incidence graphs, and then establish the rules of color exchanges and Kempe walks. Let G = (V, E) be a simple graph with vertex set V , edge set E. The incidence graph G∗ is constructed from G by placing a fictitious vertex in the middle of each edge of G. Let E∗(G∗) = {e∗ i,jei,j ∈ E(G)} denote the set of fictitious vertices on edges. Then edge ei,j ∈ E(G∗), connecting two end vertices vi and vj, consists of two links, denoted by li,j = (vi, e∗ i,j) and lj,i = (vj, e∗ i,j). Fig. 1 (a) illustrates the incidence graph of the tetrahedron. Let L(G∗) be the set of links and C = {c1, ..., c∆} denote a set of ∆ colors. A coloring function c defined on an incidence graph G∗ is a mapping of color assignments on links c : L(G∗) → C. The color of link li,j ∈ L(G∗) is denoted as c(li,j) = ci,j. Since each edge e ∈ E(G∗) consists of two links, the color function c can also be considered as a mapping defined on the set of edges: c : E(G∗) → C × C. We define the colored edge c(ei,j) = ~ei,j = (ci,j, cj,i) as a two-tuple color vector, where ci,j = c(li,j) and cj,i = c(lj,i) are respective colors of the two links of ei,j. The following properties of a color function c are related to the edge coloring of graph G. Definition Let c be a coloring function of the incidence graph G∗. Define 1.The colored edge ~ei,j = (ci,j, cj,i) is a constant if ci,j = cj,i; otherwise it is a variable. The number of variables is denoted by nc. 2.Vertex constraint: The coloring function c is consistent if colors assigned to those links incident to the vertex v are all distinct for all v ∈ V (G∗). 3.Edge constraint: The coloring function c is proper if it is consistent and all colored edges are constant. The coloring of incidence graph G∗ is called a configuration of graph G. As an example, a consistent configuration of a tetrahedron containing two variables is shown in Fig. 1 (b), and a proper configuration of a tetrahedron is shown in Fig. 1 (c) with the set of colors C = {g, r, b}, where g, r, and b, respectively represent green, red, and blue. The edge constraints are sets of equalities of colors and the vertex constraints are un- equalities. The equality is a transitive binary relation but the un-equality is not. Most edge- coloring algorithms assign edge colors to satisfy vertex constraints, sets of un-equalities. How- ever, mathematically, it is more natural and usually much easier to solve problems with equali- ties. Initially, we start with an arbitrary consistent color function c with ∆ colors that satisfies 3 1v 1,3l 1,4l 1,2l * 1,3e * 1,4e 4v * 1,2e * 3,4e * 2,4e g g 3,4e 1,3e r g 3v * 2,3e (a) 2v 3v b 1v b b r 1,4e 4v r 2,3e (b) 1,2e g r 2,4e b r g 3,4e 1,3e r g 2v 3v b 1v b b g 1,4e 4v r 2,3e (c) 1,2e g r 2,4e b 2v Figure 1: (a) Incidence graph of tetrahedron. (b) Consistent coloring with variables ~e1,3 = (g, r) and ~e1,2 = (r, g). (c) Proper coloring of tetrahedron. the vertex constraint at every vertex of the graph, which may contain variable-colored edges. Our edge coloring algorithm is a systematic procedure to eliminate those variables, similar to the procedure of solving a system of simultaneous equations. 2.1 Kempe Walks In general, variable eliminations require a sequence of color exchanges, called Kempe walks that are performed on a two-colored Kempe path defined as follows. Definition In a consistently colored incidence graph, a (α, β)-Kempe path, or simply (α, β) path, where α, β ∈ C and α 6= β, is a sequence of adjacent links l1, l2, ..., ln−1, ln such that c(li) ∈ {α, β} for i = 1, ..., n. The corresponding sequence of vertices contained in the path is defined as its interior chain. There are two types of maximum (α, β) path: 1. (α, β) cycle or closed (α, β) path: The two end-links l1 and ln are adjacent to each other. 2. Open (α, β) path: Only one α or β colored link is adjacent to the end-links l1 and ln. A (α, β)-variable edge is always contained in a maximum (α, β) path, either a (α, β) cycle or an open (α, β) path. Note that the open path may either end at a fictitious vertex or a real vertex. The following lemma can be obtained by simple counting arguments. Lemma 2.1 An even (odd) (α, β) cycle contains even (odd) number of (α, β) variables. Proof Deleting all variables in the (α, β) cycle by edge contraction, the remaining constant edges constitute an even (α, β) cycle. The lemma is established by the following relation: #variables=#edges − even #constant edges. Variable eliminations can be achieved by the following color-exchange operation performed on adjacent colored edges. Definition Let ~ej,i = (cj,i, ci,j) and ~ei,k = (ci,k, ck,i) be two colored edges incident to the same vertex vi, written as (cj,i, ci,j) ◦ (ci,k, ck,i). Suppose that ci,j = β and ci,k = α, for α, β ∈ C = {c1, ..., c∆}, the binary operation ⊗ defined below exchanges the colors of link li,j and li,k incident to vi: (cj,i, ci,j) ⊗ (ci,k, ck,i) = (cj,i, β) ⊗ (α, ck,i) ⇒ (cj,i, α) ◦ (β, ck,i) The binary operation ⊗ is non-commutative but associative, it can be considered as a transformation of a consistent coloring function c to another consistent coloring function c′ ′ such that c i,k = ci,j = β. Two adjacent variables may be eliminated by the color-exchange operation. For example, if the two colored edges are variables ~ej,i = (α, β) and ~ei,k = (α, γ), then the color exchange ~ej,i ⊗ ~ei,k = (α, β) ⊗ (α, γ) ⇒ (α, α) ◦ (β, γ) can eliminate i,j = ci,k = α and c ′ 4 (a) b r b r r r ! e 1 (, b b r r ) b b ! b e 2 r r b ( , ) b r b r r b r r b b b r b r b r r r b b b r b r ( , ) b r " ( , ) b b " ( , ) r b # ( , ) b b " ( , ) r b r b" ( , ) # ( , ) b b " ( , ) r r " ( , ) b b c4 b r r c4 b r b c4 r b b ! e 2 (b) ( , b c ), c 4 4 ! { , } r b r ! { , c c c 1 3 , } 2 c1 c2 c3 b b ! e 1 b r ( , ) r b r r c1 c2 c3 b b r r c1 c2 c3 b b ( , ) r b " ( , ) r r " ( , b c 4 ) # ( , ) r r " ( , ) b r b c" 4 ( , ) # ( , ) r r " ( , ) b b " ( , r c 4 ) ! e 2 c4 , ), c b c 4 4 b { , } r b ! r ( r (c) r ! { , c c c 1 3 , } 2 c1 c2 c3 b b ! e 1 b r ( , ) b r c4 b c1 c2 c3 r b r r b b c4 b c1 c2 c3 r r r r b b ( , ) b r b b" ( , ) $ $" ( , ) # ( , ) b b " r b " $ $ ( , ) ( , ) # ( , ) b b " ( , ) r r Figure 2: Variable eliminations by Kempe walks. one of these variables. On the other hand, color exchanges between two adjacent constant edges may introduce new variables. A color-exchange operation is effective if it does not increase the number of variables nc. The Kempe walk of a (α, β) variable on a (α, β) path is a sequence of effective color-exchange operations performed on its interior chain. Examples of variable eliminations by Kempe walks are provided in Fig. 2. Consider the (r, b) path (b, r) ◦ (b, b) ◦ (r, b) shown in Fig. 2 (a), the variable ~e1 = (b, r) can walk to another variable ~e2 = (r, b) by the following sequence of color exchanges performed on its interior chain: (b, r) ⊗ (b, b) ◦ (r, b) ⇒ (b, b) ◦ (r, b) ⊗ (r, b) ⇒ (b, b) ◦ (r, r) ◦ (b, b), in which two variables are eliminated by color exchanges. In a regular graph G, walks on an open (α, β) path always terminate on fictitious vertices at both ends; however, they may terminate on a vertex vi ∈ V (G) with a missing α or β link if the graph G is irregular. A missing colored edge at a vertex can be regarded as a don't care edge, denoted as (∅, ∅). At those degenerate vertices, the color-exchange operation involving a don't care edge is symbolically expressed as (α, β) ⊗ (∅, ∅) ⇒ (α, α). The examples depicted in Fig. 2 (b) and (c) show that a (b, r) variable on an open (b, r) path can be eliminated by walking to either end of the path, regardless if it is a vertex or a fictitious vertex. Table 2 summarizes all possible one-step Kempe walks of a (α, β) variable. Note that cases KW3 and KW4 only occur at the end of an open (α, β) path, and the number of variables nc monotonically decreases as long as the (α, β) variable is walking on a (α, β) path. Case KW1 KW2 KW3 KW4 Next Step (α, β) ◦ (α, α) (α, β) ◦ (α, β) (α, β) ◦ (α, γ) (α, β) ◦ (∅, ∅) Operation (α, β) ⊗ (α, α) ⇒ (α, α) ◦ (β, α) (α, β) ⊗ (α, β) ⇒ (α, α) ◦ (β, β) (α, β) ⊗ (α, γ) ⇒ (α, α) ◦ (β, γ) (α, β) ⊗ (∅, ∅) ⇒ (α, α) Result step forward eliminate two variables eliminate one variable eliminate one variable Table 2: One-step move of (α, β) variable on (α, β) path. 2.2 Color Quaternion Define the negation of a colored variable (α, β), denoted by −(α, β) = (β, α), as the color vector in the opposite direction of (α, β). The following color-inversion operation can change the direction of a (α, β) variable contained in a maximum (α, β) path. 5 Definition The color inversion performed on a maximum (α, β) path H exchanges color α and β on all links of H. The color inversion operation requires a sequence of color exchanges involving all vertices of the interior chain of the (α, β) path. It can only apply to a maximum (α, β) path, either a (α, β) cycle or an open (α, β) path, to avoid increasing the number of variables nc. For consistency, we also use the notation −(α, α) = (α, α)(mod2) to denote the negation of a constant edge. With the notion of negation, the color-exchange operation of complex colors follows the same multiplication rules as quaternion. The concept of quaternion was introduced by Hamilton in 1843 [6] as an extension of com- plex numbers. The basis elements of quaternions are customarily denoted as 1, i, j, and k. The correspondences between quaternion multiplication and color-exchange operations are summa- rized in Table 3. Note that the minus sign of diagonal entries in the color-exchange table indicates the necessary color inversion of the right operand due to the consistency requirement at each vertex of the color configuration. The exchange operation listed in Table 3 implies that if two adjacent variables have one color in common, then at least one of them can be eliminated. This is an important property in the construction of edge-coloring algorithms for eliminating variables involving more than three colors. Correspondence A = (α, α) = −(α, α), B = (β, β) = −(β, β), C = (γ, γ) = −(γ, γ) → 1 (α, β) → i, (β, α) → −i, (β, γ) → j, (γ, β) → −j, (γ, α) → k, (α, γ) → −k Quaternion Multiplication Color-exchange Operation  × −i −j −k 1 −k j i −i 1 j k k −j 1 i    ⊗ (β, α) (α, β) −AB (β, γ) B(γ, α) −BC (γ, α) (α, γ) (γ, β) (α, γ)B A(β, γ) (β, α)C −CA (γ, β)A C(α, β) Table 3: Correspondence between quaternion multiplication and color-exchange operations. 3 Canonical Configurations Kempe walks provide the most efficient and natural way to eliminate variables. Almost all variables in an arbitrary initial color configuration can be eliminated by implementing Kempe walks. A configuration is called a canonical configuration if no variables can be further reduced by single variable Kempe walks. In a canonical configuration, it is easy to show from Lemma 2.1 that all remaining variables are contained in odd cycles, and every odd cycle only contains a single variable. The following algorithm exhaustively eliminates variables by Kempe walks. Walk-on-Kempe-Path Algorithm (WKP) Algorithm: Walk-on-Kempe-Path (WKP) Input: an initial ∆-edge-coloring configuration of G∗ Output: a proper ∆-edge-coloring or a canonical configuration of G∗ 1. VariableList ← find all variables 2. if VariableList is empty then return a properly colored graph for each variable ~e in VariableList do 3. else 4. 5. 6. 7. 8. return a canonical configuration if Variable-Walk(~e)=true then update VariableList and goto step 2 else continue Subroutine: Variable-Walk Input: variable ~ei,j = (α, β) Output: return true if ~ei,j is eliminated; otherwise, return false 9. KempePath ← staring from one end of ~ei,j, say vi, search for (α, β) path until (1) it finds another variable (2) it terminates at a vertex with missing α or β link (3) it returns to vj , thus forms a cycle 10. if case (3) occurred, then return false 11. else color exchange on interior chain of KempePath and return true 6 Theorem 3.1 For graph G = (V, E), the algorithm WKP either returns a proper ∆-edge- coloring or a canonical configuration. The running time of the algorithm is on the order of O(V E2) Proof Because the subroutine Variable-Walk returns false at step 10 only when case (3) occurs, according to Lemma 2.1, the input variable ~ei,j = (α, β) must be the only variable contained in an odd (α, β) cycle. The algorithm returns a properly colored graph in step 2 if the VariableList is empty. Otherwise, every variable in the VariableList is contained in an odd Kempe cycle, and the algorithm returns a canonical configuration at step 8. Next, the order of running time O(V E2) can be estimated from the number of times that the subroutine Variable-Walk is executed, and the running time of the subroutine Variable- Walk. The number of times that the subroutine Variable-Walk is executed is a function of nc, the initial number of variables, denoted as Φ(nc). Since at least one variable is eliminated in an updated VariableList when the subroutine repeats in the loop (steps 4-7), then Φ(nc) ≤ 2) ⊂ O(E2). The running time of the subroutine Variable-Walk is on the order of O(V ), because both the running time of path searching in step 9 and the number color-exchange operations performed in step 11 are bounded by the number of vertices V . i=0(nc − i) ∈ O(nc Pnc An immediate consequence of the above theorem is the following corollary. Corollary 3.2 For bipartite graph G = (V, E), the WKP algorithm always returns a proper ∆-edge-coloring in O(E log V ) time. Proof Since there are no odd cycles in bipartite graphs, then the subroutine Variable-Walk always eliminates at least one variable and the subroutine is executed at most nc times, where nc is the initial number of variables. Let Li be the length of the search path of the ith input variable in step 9. Since the number of color exchanges and the path search time are proportional i=1 Li , the average path length in a random graph is on the order of O(log V ) [10]. Thus, the running time of the WKP algorithm for a bipartite graph G = (V, E) is bounded by to the total path lengthPnc Li = ncPnc i=1 Li nc ncXi=1 ∈ ncO(log V ) ⊂ O(E log V ) The above bound is a conservative estimate, because we did not take the trade-off between the number of variables nc and the path lengths in a bipartite graph into consideration. For non-bipartite graphs, two examples of the 3-edge-colored Tutte graphs that resulted from the WKP algorithm are depicted in Fig. 3, where green-colored edges and fictitious vertices are faded to highlight (b, r) cycles. The canonical configuration shown in Fig. 3 (a) has two remaining (b, r) variables, respectively, contained in two disjoint odd (b, r) cycles. Fig. 3 (b) shows that a properly colored Tutte graph has three even (b, r) cycles. 4 Walks on Directional Paths Despite the fact that an overwhelming number of variables in the initial color configuration can be eliminated by Kempe walks, the graph G is still not properly colored if some variables remain trapped in odd Kempe cycles. The Kempe walks are limited to color exchanges performed within alternating paths, which are fixed subgraphs H ⊂ G in any given color configuration. In this section, we introduce walks on directional paths, which involve more than two colors, to systematically eliminate remaining variables in a canonical configuration. Consider that a tagged variable ~e1 = (α, β) walks along a predetermined directional path. A move of ~e1 is effective if either the tagged variable can step forward, or some variables are 7 two even and two odd (b,r) cycles three even (b,r) cycles e 1 ( , ) b r ) r , b ( 2 e (a) (b) Figure 3: 3-edge-colored Tutte graph. eliminated along the way. If ~e2 = (γ, δ), where γ 6= α and δ 6= β, is the next edge adjacent to ~e1 on the path, then it is necessary to change the colors of ~e2, either γ or δ, such that the operation ~e1 ⊗ ~e2 yields an effective move of ~e1. That is, effective walks on directional paths are actually walks on dynamically changed Kempe paths. As indicated in Table 3 in color quaternion multiplication, any effective moves only involve three colors. Thus, there are only two useful types of color inversion on the next edge ~e2: α-type : ~e2 = (γ, δ) → ~e2 = (α, ∗) β-type : ~e2 = (γ, δ) → ~e2 = (∗, β) Note that a color inversion operation applied to ~e2 may become invalid if the operation also involve ~e1. If a valid color conversion cannot be found, then the tagged variable ~e1 is blocked. All possible one-step non-Kempe moves of a tagged variable on a directional path in a canonical configuration are given in the Appendix. It should be expected that blocking may occur along the way; otherwise, variables can all be eliminated by walking them to a common vertex, resulting in a proper ∆-edge-colored graph. The Petersen graph is a well-known counterexample to show that this is impossible. In the reminder of this section, we describe a variable elimination algorithm by walks on a directional spanning tree with deflections. 4.1 Walks on Spanning Trees with Deflections Intuitively, a spanning tree of the graph G can provide efficient directional paths that guide remaining variables in canonical configurations to walk to a common destination. In view of the analogy between variable edges and vectors, we can think of the paths of a spanning tree as coordinates of a vector space embedded in the graph G with the origin at the root of the tree. Presumably, if variables can freely walk on those directional paths, then they will either intercept each other on the way or eventually meet at the root. A blocked variable can be randomly deflected to another nearby directional path and resume the walking toward the root. The detailed steps of variable eliminations are listed in the WST algorithm. The WST algorithm is initialized by a spanning tree and an arbitrary color configuration of G with a set of ∆ colors C = {c1, ..., c∆}. In the canonical configuration generated in step 3, we firstly eliminate variables that contain color c1, then eliminate the remaining variables that contain color c2, and so on. The process is similar to the Gauss elimination for solving systems of linear equations, in which variables are eliminated one kind at a time. 8 Walk-on-Spanning-Tree Algorithm (WST) Algorithm: Walk-on-Spanning-Tree(WST) Input: incidence graph G∗ Output: proper ∆-edge-coloring or claim χe(G) = ∆ + 1 1. ST ← construct a spanning tree of G 2. 3. execute KWP algorithm on G∗ initial coloring of G∗ (comment: results in proper ∆-edge-coloring, or a canonical configuration according to theorem 3.1) for each color ci in C = {c1, ..., c∆} VariableList ← all variable edges containing ci if VariableList is empty, then goto step 4 and continue with next color ci+1 else for each variable ~e in VariableList loop r(ni, k) − 1 times if Walk-to-Next-Step(~e, ST, ci)=true then update VariableList, go to step 6 4. 5. 6. 7. 8. 9. 10. Subroutine: Walk-to-Next-Step Input: variable ~ei,j = (α, β), spanning tree ST, color ci ∈ {α, β} Output: return true if variable containing ci is eliminated; otherwise, variable moves to the next edge and returns false 16. pick a next edge ~el,k toward the root of ST 17. loop until ~ei,j → ~el,k succeeds 18. 19. end loop 20. if ~ei,j → ~el,k eliminates variable ~el,k ← pick a fresh adjacent edge containing ci or Variable-Walk(~el,k)=true then return true (comment: execute Variable-Walk subroutine in WKP algorithm in case new Kempe paths are created) 21. else return false end loop 11. 12. 13. 14. end for each 15. output proper ∆-edge-coloring of G end for each output χe(G) = ∆ + 1 In the ith iteration started at step 4, the VariableList only includes those variables containing color ci, sometime called ci-variables. In steps 8-12, each selected ci-variable is allowed to walk towards the root for r(ni, k)−1 steps, where the parameter r(ni, k) is a function to be determined later in the next subsection. If the subroutine Walk-to-Next-Step returns true, indicating the elimination of a ci-variable, then another ci-variable will be selected from the VariableList and the above process is repeated. If the VariableList is empty, the algorithm goes back to step 4 and focuses on the next color ci+1. The problem is solved if all variables are eliminated and a proper ∆-edge-coloring is reached. On the other hand, if a ci-variable in the ith iteration fails to eliminate any ci-variables within r(ni, k) − 1 steps, then the algorithm halts in step 13 and claims that χe(G) = ∆ + 1. In step 16 of the subroutine Walk-to-Next-Step, we first choose an adjacent edge ~el,k that is closer to the root. If the move to next edge ~ei,j → ~el,k is blocked, then we choose another adjacent edge until it succeeds in steps 17-19. Since a blocked variable ~ei,j = (α, β) can always be deflected to one of the two neighboring α or β links, there is no risk of running into an infinite loop in steps 17-19 even in the worst-case scenario. 4.2 Analysis of Randomized Algorithm In general, walks on carefully selected paths, such as spanning tree, are more efficient than random walks. However, the efficiency of guided walks depends on path selection, which makes the complexity analysis mathematically intractable. On the other hand, the complexity of path-independent random walks is easier to estimate, and it provides an upper bound of the complexity of all guided variable elimination methods. The basic idea of the random-walk algorithm is similar to that of the WST algorithm, except In the following in step 16, the neighboring edge ~el,k of the next edge is randomly chosen. analysis, we assume that, for randomly generated graph, the probability of the next edge, resulting from the execution of the subroutine Walk-to-Next-Step, is evenly distributed among all neighboring edges. If the chromatic index of the input graph is χe(G) = ∆ and the parameter r(ni, k) in step 9 is properly chosen, we prove that the random-walk algorithm returns a proper ∆-edge-coloring in polynomial time with a probability of at least 1/2. Consider a random walk that starts at a vertex v ∈ V of an n-vertices graph G = (V, E), 9 and whenever it reaches any vertex u ∈ V , chooses an edge at random from those edges incident to u, and traverses it. Suppose the random walk starts from a vertex v ∈ V , the access time or hitting time H[v, u] is the expected number of steps before vertex u is visited. An O(n3) upper bound on the access time was first obtained by Aleliunas, Karp, Lipton, Lov´asz, and Rackoff [3]. Later, it was proved in [17] that the access time is at most 2n2 for a regular graph. Let A ⊂ V be a proper subset of vertices and let v ∈ Ac, where Ac = V \ A, the access time H[v, A] is the expected number of steps before any vertex u ∈ A is visited, starting from vertex v. A proof of the following bound is given in [2]. Lemma 4.1 Consider random walk on a regular graph G = (V, E). Let A ∈ V and v ∈ Ac, then H[v, A] < 4Ac2 To be consistent with the above analysis of random walks on graphs, we consider that the i , e∗ random-walk algorithm is implemented on the line graph bG = (V ∗, bE) induced from incidence graph G∗ = (V, E). The set of vertices V ∗ is the set of fictitious vertices of G∗ = (V, E), and an j ∈ V ∗ if and only if ei and ej are incident to the same "edge" connecting two "vertices" e∗ vertex in G. Moreover, we assume, without loss of generality, that the input graph is ∆-regular. The running time of the random walk searching algorithm is determined by the total number of moves required for finding a proper configuration. A move of a variable in the algorithm is a transformation from one configuration to another configuration. Since any simple graph H with maximum degree ∆ is a subgraph of a ∆-regular graph G with the same number of vertices, and those edges in G missing in H are all don't care edges. The ∆-regular graph G admits far more color configurations than its subgraph H. Thus, we are considering the worst case in our analysis. This point is verified by the experimental results described in section 5. Let ni be the number of ci-variables at the beginning of the ith iteration of the random-walk algorithm, corresponding to step 4 in the WST algorithm, and let h(ni, k) be a function defined by: h(ni, k) = 4∆ni(E − k + 1)2 ln 2 , (1) where k = 1, ..., ni is a parameter representing the number of ci-variables in the VariableList. We show that the random-walk algorithm has the following property. Theorem 4.2 If input to the random-walk algorithm is a ∆-edge-colorable graph G = (V, E) and the parameter in step 9 of the algorithm is r(ni, k) = ⌈h(ni, k)⌉, then the algorithm returns a proper ∆-edge-coloring of G with a probability of at least 1/2. Proof We first prove that Pr{all ci-variables are eliminated} >(cid:18) 1 2(cid:19)1/∆ , (2) in the ith iteration of the algorithm. Let Ak = {ǫ1, ..., ǫk} be the set of k ci-variables in the VariableList. Suppose that the variable ǫj takes T (k) steps to hit another variable in the set Ak \ {ǫj}. It follows from Lemma 4.1 that the access time is bounded by j EhT (k) j i = H [ǫi, Ak \ {ǫi}] < 4(E − k + 1)2, are i.i.d. random variables, the probability that no variables in the for j = 1, ..., k. Since T (k) set Ak can be eliminated is given by j Pr{Ak fails to reduce to Ak−1} = PrnT (k) = PrnT (k) j ≥ r(ni, k)ok 1 ≥ r(ni, k), ..., T (k) k ≥ r(ni, k)o 10 (3) (4) From Markov inequality we have PrnT (k) j ≥ r(ni, k)ok ≤ j EhT (k) i r(ni, k) k <(cid:18) H [ǫi, Ak \ {ǫi}] h(ni, k) (cid:19)k ∆ni(cid:19)k <(cid:18) ln 2 . (5) The probability that all ci-variables can be eliminated in the ith iteration of the algorithm is given by Pr {all ci-variables are eliminated} = (1 − Pr{Ak fails to reduce to Ak−1}). niYk=1 ∆ni(cid:19)k! > niYk=1 1 −(cid:18) ln 2 =(cid:18)1 −(cid:18) ln 2 ∆ni(cid:19)(cid:19)ni niYk=1(cid:18)1 −(cid:18) ln 2 ∆ni(cid:19)(cid:19) 2(cid:19)1/∆ ∼ e− ln 2/∆ =(cid:18) 1 . (6) (7) Substituting (4) and (5) into (6), we have Pr {all ci-variables are eliminated} > If χe(G) = ∆, then the probability that the algorithm returns a proper ∆-edge-coloring of G is given by Pr {output a proper ∆-edge-coloringχe(G) = ∆} = > Pr {all ci-variables are eliminated} ∆Yi=1 ∆Yi=1(cid:18) 1 2(cid:19)1/∆ = 1/2 Theorem 4.3 The running time of the random-walk algorithm with r(ni, k) = ⌈h(ni, k)⌉ is O(∆V E5). Proof The number of steps Φi for eliminating all ci-variables is bounded by Φ(ci) ≤ ≤ niXk=1 4∆ni ln 2 k(r(ni, k) − 1) < kh(ni, k) = 4∆ni ln 2 niXk=1 k(E − k + 1)2 niXk=1 kE2 = niXk=1 2∆niE2ni(ni + 1) . ln 2 Therefore, the total number of steps Φ after eliminating all variables is bounded by Φ = ∆Xi=1 Φ(ci) < 2∆E2 ln 2 ∆Xi=1 (ni 3 + ni 2). The total number of variables is monotonic decreasing throughout the entire process, which implies P∆ i=1 ni ≤ nc. Then we have Φ < 2∆E2 ln 2 ∆Xi=1 (ni 3 + ni 2) ≤ 2∆E2 ln 2 (nc 3 + nc 2). Hence, the complexity in terms of the number of steps is bounded by Φ ∈ O(∆E2nc 3) ⊂ O(∆E5). (8) (9) (10) (11) From the proof of theorem 3.1, we know that the running time of the subroutine Variable-Walk, or the running time of each successful move, is on the order of O(V ). Therefore, the running time of random walk coloring algorithm is on the order of O(∆V E5). 11 4.3 Snarks The main difference between solving linear equations and edge coloring is the recognizing of final state. The inconsistency of a system of linear equations can be easily identified by variable eliminations in polynomial time. But eliminating variables in a class 2 graph may run into an infinite loop. The smallest class 2 cubic graph, called snark, is Petersen graph. The 3-color canonical configuration of the Petersen graph shown in Fig. 4 (a) contains two variables in two disjoint odd cycles. The two odd cycles behave the same as two parallel lines in a Euclidean space; they can never cross each other, which is the geometric interpretation of inconsistent linear equations. In general, all 3-color canonical configurations of Petersen graph are isomorphic. That is, corresponding to any maximum (α, β) path H1 in a canonical configuration φ1, there is a maximum (α, β) path H2 in another canonical configuration φ2, such that the two subgraphs H1 and H2 are graph isomorphic [18]. This is the reason that any variable elimination procedures can never halt when all canonical configurations of graph G are isomorphic. 9 g g b 6 b 10 8 b 7 g g b 4 b g b g g 10 b g b 6 3 b g b 2 5 b g g 1 b 5 g g b 1 (a) g g b b 9 b 6,7e 4 g (b) g b 7 g b 3,6e b g 2 10 8 g b g b 6 5 b g 3 b 2,3e 9 b g 6,7e 4 b g g 5,7e g b b g 7 g 8 5(10) g b g b 4(6) 10(5) 3 b 2,3e b g g 1(1) b g 2 b 1 (c) b g b b 7(9) g 6(4) g g 8(8) b b g 9(7) g 3(3) b g b 2(2) (d) (a) Canonical (c) Isomorphic configurations of Petersen graph (red color is faded). Figure 4: configuration. ~e6,7 → ~e5,7 succeed. (d) Twin-cycle configuration after ~e6,7 → ~e5,7. (b) Twin-cycle configuration, ~e6,7 → ~e3,6 and ~e2,3 → ~e3,6 are blocked. The configuration shown in Fig. 4 (b) is the same as that in Fig. 4 (a), but the two disjoint (b, g) cycles are separated in the plane, and connected by constant (r, r) edges. In Fig. 4 (b), we consider the walk on the shortest directional path ~e6,7 ◦ ~e3,6 ◦ ~e2,3 = (b, g) ◦ (r, r) ◦ (b, g) between the two variables ~e6,7 and ~e2,3. Both moves, ~e6,7 → ~e3,6 and ~e2,3 → ~e3,6 are blocked according to the blocked move of DW1.2 described in Table 5(see the Appendix). In fact, walks on any shortest directional path will be blocked if the two variables are directly connected by a constant (r, r) edge. Fig. 4 (c) shows that the variable ~e6,7 successfully walks to edge ~e5,7. However, the resulting configuration is the same as the previous one up to some permutation of vertices. The corre- spondence between the vertices in Fig. 4 (b) and Fig. 4 (c) is shown in Fig. 4 (d). Therefore, whenever a blocked variable walks out of the odd cycle, the new configuration is isomorphic to the previous one. The edge coloring of general graphs also faces the halting problem. In fact, any ∆-regular graph G with an odd number of vertices is a class 2 graph. A simple example is K5, where n = 5, ∆ = 4 and χe(K5) = 5. In a 4-color canonical configuration of K5, two distinct variables are mutually blocked and can never be eliminated, which corresponds to the blocked move of DW2.2 given in Table 5 (see the Appendix). 5 Experimental Study Experiments were conducted on randomly generated graphs and selected benchmark graphs. The results show that the performance of our algorithm on random graphs agrees with theoret- 12 ical expectations, and our algorithm can efficiently solve many hard instances. All experiments ran on a Linux KVM virtual machine with one CPU core at 2.66 GHz and 512 MB memory. The coloring algorithm was implemented in C and compiled by GCC 4.4.3. Python scripts were used to generate random graph instances as well as manage the experiments. 5.1 Results of Random Graphs All input random graphs in the testing of our coloring algorithm were generated by the graph generator provided by NetworkX1. For regular graphs, 100 instances were randomly generated for each pair of (∆, n), where degree ∆ = 4, 8 and the number of vertices n = 100, 200, . . . , 10000. For irregular graphs, 100 instances were randomly generated for each pair of (δ, n) where density δ = E/V = 2, 4 and n = 100, 200, . . . , 10000. The distributions of the running time to color the edges are plotted in Figure 5. All randomly generated graphs can be properly ∆-edge- colored by our algorithm. As shown in these figures, the running time of about 95% of input graphs is highly predictable and quite stable. The experimental results also show that irregular graphs are generally easier to be colored than regular graphs, mainly because of the flexibility of "coloring" the don't care edges. 50% 75% 90% 95% 100% 0.35 0.3 0.25 0.2 50% 75% 90% 95% 100% 0.4 0.35 0.3 0.25 0.2 ) c e s ( r o o C o l ) c e s ( r o o C o l 0.15 t e m T i 0.1 0.05 0 0 1000 2000 3000 5000 4000 6000 Number of Vertices 7000 8000 9000 10000 t e m T i 0.15 0.1 0.05 0 0 1000 2000 3000 5000 4000 6000 Number of Vertices 7000 8000 9000 10000 (a) 4-regular (∆ = 4, δ = 2) (b) 8-regular (∆ = 8, δ = 4) 50% 75% 90% 95% 100% 0.2 0.18 0.16 0.14 0.12 0.1 0.08 0.06 0.04 0.02 50% 75% 90% 95% 100% 0.25 0.2 0.15 ) c e s ( r o o C o l t e m T i 0.1 0.05 ) c e s ( r o o C o l t e m T i 0 0 1000 2000 3000 5000 4000 6000 Number of Vertices 7000 8000 9000 10000 0 0 1000 2000 3000 5000 4000 6000 Number of Vertices 7000 8000 9000 10000 (c) Irregular with δ = 2 (d) Irregular with δ = 4 Figure 5: Experimental running time of edge coloring for random graphs. 1NetworkX is a Python package for the creation and manipulation of complex networks, it includes various graph generators as well. 13 5.2 Results of Benchmark Graphs For the purpose of comparisons, we use the same benchmark graphs provided in [13], which were originally taken from CP2002 [15]. Since all smaller graphs presented in [13] can be easily solved in a short time by heuristics and our algorithm, we only compare the results of benchmark graphs with more than 500 vertices, which are considered to be large graphs. The experiment results are listed in Table 4 with graph qualities of each benchmark graph. The best result of each benchmark graph achieved by heuristic algorithms in [13] is compared with the performance of our algorithm. All eleven benchmark graphs considered are ∆-edge-colorable. They were all properly ∆-edge-colored by using our algorithm while only five of them were ∆-edge-colored by the heuristic and evolutionary algorithms (EAs) described in [13]. In Table 4, the number of colors used for coloring a benchmark graph G is in bold if it is equal to the maximum degree. Since the performance of these algorithms depends on the particular implementation and computing environment, the absolute time listed in Table 4 is only for reference, and does not indicate the time complexity of the algorithm. Nevertheless, these experiment results clearly reveal that our algorithm outperforms heuristic algorithms in accuracy and efficiency. Best Heuristic in [13] Our Algorithms colors colors Graph Qualities name vertices DJSC500.1 ash331GPIA ash958GPIA will199GPIA 4-FullIns 4 5-FullIns 4 qg.order30 qg.order60 qg.order100 wap04a latin square 10 500 662 1916 701 690 1085 900 3600 10000 5231 900 edges 12458 4185 12506 6772 6650 11395 26100 212400 990000 294902 202081 δ 24.92 6.32 6.53 9.66 9.64 10.50 29.00 59.00 99.00 56.38 224.53 ∆ χe(G) 68 23 24 38 119 160 58 118 198 351 512 68 23 24 38 119 160 58 118 198 351 512 69 23 24 40 120 161 58 118 212 351 554 secs 0.25 0.01 0.01 0.03 0.03 0.09 0.59 17.94 248.38 24.98 268.85 secs 68 23 24 38 119 160 58 118 198 351 512 0.0227 0.0106 0.0766 0.0158 0.0114 0.0264 0.2174 7.4265 94.0123 3.2052 2.1981 Table 4: Performance on benchmark graphs. 6 Conclusions In this paper, edge coloring of simple graphs is solved by a variable elimination process similar to the solving of linear equations. The connections between graphs and linear equations provide cornerstones in many areas such as electric circuit theory and Markov chains. In edge coloring of simple graphs, variables are eliminated by color-exchange operations implemented on graphs. The problem is solved by a sequence of configuration transformations in the same manner as solving the puzzle of Rubik's Cube, which has a final configuration that can always be reached from any initial configuration. In the case of edge coloring of graphs, however, only ∆-edge- colorable graphs have final configurations. Another related problem that could be solved by color exchanges is finding the Hamiltonian cycles. A simple graph G may have more than one proper color configurations. Consider the set of all proper color configurations as the state space of a Markov chain associate with edge-colored graph G. A state is Hamiltonian if it contains a two-colored Hamiltonian cycle, which can be reached by random walks on the Markov chain. In the future, the application of the algebraic method proposed in this paper to graph factors and Hamiltonian cycles could be challenging research topics. 14 References [1] G. Aggarwal, R. Motwani, D. Shah, and A. Zhu. Switch Scheduling via Randomized Edge Coloring. In Proceedings of the 44th Annual IEEE Symposium on Foundations of Computer Science, page 502. IEEE Computer Society, 2003. [2] D. Aldous and J. Fill. Reversible markov chains and random walks on graphs.(monograph in preparation.). http://stat-www.berkeley.edu/users/aldous/RWG/book.html, 2002. [3] R. Aleliunas, R. Karp, R. Lipton, L. Lov´asz, and C. Rackoff. Random walks, universal travelling, sequences, and the complexity of maze problems. Proceeding of 20th Annual Symposium on Foundations of Computer Science, pages 218 -- 223, 1979. [4] K. Appel and W. Haken. Every planar map is four colorable. Amer Mathematical Society, 1989. [5] R. Beigel and D. Eppstein. 3-coloring in time O(1.3446n): a no-MIS algorithm. In 36th IEEE Symp. Foundations of Comp. Sci., page 444. Published by the IEEE Computer Society, 1995. [6] J. Conway and D. Smith. On quaternions and octonions. AK Peters, 2003. [7] D. Dubhashi, D. Grable, and A. Panconesi. Near-optimal, distributed edge colouring via the nibble method. Theoretical Computer Science, 203(2):225 -- 251, 1998. [8] J. Edmonds. Paths, trees, and flowers. Classic Papers in Combinatorics, pages 361 -- 379, 1987. [9] D. Eppstein. Improved algorithms for 3-coloring, 3-edge-coloring, and constraint satisfac- tion. In Proceedings of the twelfth annual ACM-SIAM symposium on Discrete algorithms, pages 329 -- 337. Society for Industrial and Applied Mathematics, 2001. [10] A. Fronczak, P. Fronczak, and J. Ho lyst. Average path length in random networks. Physical Review E, 70(5):056110, 2004. [11] H. Gabow, T. Nishizeki, O. Kariv, D. Leven, and O. Terada. Algorithms for edge-coloring graphs. Tech. Rep, 1985. [12] D. Grable and A. Panconesi. Nearly optimal distributed edge colouring in O (log log n) rounds. In Proceedings of the eighth annual ACM-SIAM symposium on Discrete algorithms, pages 278 -- 285. Society for Industrial and Applied Mathematics, 1997. [13] M. Hilgemeier, N. Drechsler, and R. Drechsler. Fast heuristics for the edge coloring of In Digital System Design, 2003. Proceedings. Euromicro Symposium on, large graphs. pages 230 -- 237. IEEE, 2003. [14] I. Holyer. The NP-completeness of edge-colouring. Siam J. Comput, 10(4):718 -- 720, 1981. [15] D. Johnson, A. Mehrotra, and M. Trick. Graph coloring instances, constraint programming 2002. http://mat.gsia.cmu.edu/COLOR03/, 2002. [16] A. Kempe. On the geographical problem of the four colours. American journal of mathe- matics, 2(3):193 -- 200, 1879. [17] L. Lov´asz. Random walks on graphs: A survey. Combinatorics, Paul Erdos is Eighty, 2(1):1 -- 46, 1993. [18] D. West. Introduction to graph theory. Prentice Hall, 2001. 15 Appendix An effective one-step non-Kempe move of the tagged variable ~e1 = (α, β) to ~e2 = (γ, δ), where γ 6= α and δ 6= β, requires one of the following two types of color inversion on the next edge ~e2: α-type : ~e2 = (γ, δ) → ~e2 = (α, ∗) β-type : ~e2 = (γ, δ) → ~e2 = (∗, β) A color inversion applied to ~e2 may become invalid if the operation also involves ~e1. The following two cases are considered in a canonical configuration: Case DW1: ~e1 ◦ ~e2 = (α, β) ◦ (γ, δ) , where γ 6= α, δ 6= β and δ ∈ {α, γ}. • (1.1) δ = α, α-type: inversion of the (γ, α) cycle H shown in Fig. 6 (a) that contains ~e2 = (γ, α) • (1.2) δ = γ, α-type: inverse the maximum (γ, α) path H shown in Fig. 6 (b) that contains the edge ~e2 = (γ, γ). The variable ~e1 = (α, β) is blocked if v3 = v0. Note that the variable ~e1 is not blocked if v4 = v0, as illustrated in Fig. 6 (c), the following sequence of operations can move ~e1 one step forward: 1. exchange color on the interior chain from v2 to v0, hence ~e1 = (γ, β) and ~e2 = (γ, α). 2. ~e1 ⊗ ~e2 = (γ, β) ⊗ (γ, α) ⇒ (γ, γ) ◦ (β, α) (a) H # : ( , )-cycle (b) 3v 4v (c) 3v H : maximum ( , # )-path H : maximum ( , # )-path 0v e !" ) 1 ( , 1v e ) # " ( , 2 2v 0v e !" ) 1 ( , 1v e # #" ( , ) 2 2v v 4 v" 0 e !" ) 1 ( , 1v e # #" ( , ) 2 2v Figure 6: Illustration of non-Kempe walk Case DW1. Case DW2: ~e1 ◦ ~e2 = (α, β) ◦ (γ, δ) , where γ 6= α, δ 6= β and δ /∈ {α, γ}. • (2.1) α-type: inverse the maximum (γ, α) path H1 shown in Fig. 7 (a) that contains the vertex v1, or • (2.2) β-type: inverse the maximum (δ, β) path H2 shown in Fig. 7 (a) that contains the vertex v2. The variable ~e1 = (α, β) is blocked if v3 = v0 and v4 = v1, as illustrated in Fig. 7 (b). (a) 3v 4v (b) 1 maximum H # ( , )-path H 1 maximum # ( , )-path H 2: maximum $ ! ( , )-path v 4 v" 1 0v e !" ) 1 ( , v 3 v" 0 1v e # $" ) ( , 2 2v e !" ) 1 ( , 2v e # $" ) ( , 2 H 2: maximum $ ! ( , )-path Figure 7: Illustration of non-Kempe walk Case DW2. Table 5 lists all possible one-step non-Kempe moves of the tagged variable ~e1 = (α, β). 16 Case DW1.1 DW1.2 Next Step (α, β) ◦ (γ, α) (α, β) ◦ (γ, γ) Color Inversion (γ, α) → (α, γ) (γ, γ) → (α, α) blocked DW1.2 Operation Result (α, β) ⊗ (α, γ) ⇒ (α, α) ◦ (β, γ) (α, β) ⊗ (α, α) ⇒ (α, α) ◦ (β, α) if v3 = v0 eliminate one variable step forward blocked DW2.1 DW2.2 (α, β) ◦ (γ, δ) (α, β) ◦ (γ, δ) (γ, δ) → (α, δ) (γ, δ) → (γ, β) (α, β) ⊗ (α, δ) ⇒ (α, α) ◦ (β, δ) (α, β) ⊗ (γ, β) ⇒ (α, γ) ◦ (β, β) eliminate one variable eliminate one variable blocked DW2 if v3 = v0 and v4 = v1 blocked Table 5: One-step non-Kempe moves of (α, β) variable on directional path. 17
1809.06564
1
1809
2018-09-18T07:30:27
Utilizing Network Structure to Bound the Convergence Rate in Markov Chain Monte Carlo Algorithms
[ "cs.DS", "math.PR" ]
We consider the problem of estimating the measure of subsets in very large networks. A prime tool for this purpose is the Markov Chain Monte Carlo (MCMC) algorithm. This algorithm, while extremely useful in many cases, still often suffers from the drawback of very slow convergence. We show that in a special, but important case, it is possible to obtain significantly better bounds on the convergence rate. This special case is when the huge state space can be aggregated into a smaller number of clusters, in which the states behave {\em approximately} the same way (but their behavior still may not be identical). A Markov chain with this structure is called {\em quasi-lumpable}. This property allows the {\em aggregation} of states (nodes) into clusters. Our main contribution is a rigorously proved bound on the rate at which the aggregated state distribution approaches its limit in quasi-lumpable Markov chains. We also demonstrate numerically that in certain cases this can indeed lead to a significantly accelerated way of estimating the measure of subsets. The result can be a useful tool in the analysis of complex networks, whenever they have a clustering that aggregates nodes with similar (but not necessarily identical) behavior.
cs.DS
cs
Utilizing Network Structure to Bound the Convergence Rate in Markov Chain Monte Carlo Algorithms 8 1 0 2 p e S 8 1 ] S D . s c [ 1 v 4 6 5 6 0 . 9 0 8 1 : v i X r a Ahmad Askarian Rupei Xu Andr´as Farag´o Department of Computer Science The University of Texas at Dallas E-mail: {axa120431, rxx130430, farago}@utdallas.edu Richardson, Texas, U.S.A. Abstract We consider the problem of estimating the measure of subsets in very large networks. A prime tool for this purpose is the Markov Chain Monte Carlo (MCMC) algorithm. This algorithm, while extremely useful in many cases, still often suffers from the drawback of very slow convergence. We show that in a special, but important case, it is possible to obtain significantly better bounds on the convergence rate. This special case is when the huge state space can be aggregated into a smaller number of clusters, in which the states behave approximately the same way (but their behavior still may not be identical). A Markov chain with this structure is called quasi-lumpable. This property allows the aggregation of states (nodes) into clusters. Our main contribution is a rigorously proved bound on the rate at which the aggregated state distribution approaches its limit in quasi-lumpable Markov chains. We also demonstrate numerically that in certain cases this can indeed lead to a significantly accelerated way of estimating the measure of subsets. The result can be a useful tool in the analysis of complex networks, whenever they have a clustering that aggregates nodes with similar (but not necessarily identical) behavior. I Introduction The Markov Chain Monte Carlo (MCMC) method is one of the most frequently used al- gorithms to solve hard counting, sampling and optimization problems. This is relevant for many areas, including complex networks, physics, communication systems, computational biology, optimization, data mining, big data analysis, forecast problems, prediction tasks, 1 and innumerable others. The success and influence of the method is shown by the fact that it has been selected as one of the top ten of all algorithms in the 20th century, see [1]. The MCMC algorithm also plays an important role in large, complex networks. In this paper, building on our earlier conference presentations [4, 5], we consider the following regularly occurring application of the MCMC method: Consider a very large graph G, with node set S, and let A ⊆ S be a subset of the nodes. We would like to estimate the relative size of A, that is, the goal is to obtain a good estimate of the value (1) A S . p = More generally, if a random walk is considered on the graph, with stationary distribution π, then we would like to estimate π(A), the stationary probability of being in A. In the special case when π is the uniform distribution, we get back the formula (1). If we can take random samples from S, according to the stationary distribution, then an obvious estimate with good properties is the relative frequency of the event that the sample falls in A. Unfortunately, in most nontrivial cases of interest, this sampling task is not feasible. The reason is that often the large set S is defined implicitly. Examples are the set of all cliques in a graph, or the set of all feasible solutions to an optimization problem, and many others. No efficient general method is known to sample uniformly at random from such complex sets. An important application in telecommunication networks is to estimate blocking proba- bilities, see [8, 12]. More generally, if we have a large system, with an enormous state space, we may want to estimate that the actual state falls in a specific subset. For example, if the state space consists of all possible load values of the network links, which leads to a state space of astronomical size, we may want to know what the probability is that at most k links are overloaded, for some value of k. At this point the MCMC does a very good service. If we define a Markov chain in which the states are the elements of S and the transitions are based on simple local operations, then we can very often obtain a Markov chain with uniform, or some other simple stationary distribution over S. Then, if we run this chain long enough so that it gets close to the stationary distribution, then the state where we stop the chain will be a good approximation of a random sample over S, distributed according to the stationary distribution. Then by repeating the process sufficiently many times, and by counting the relative frequency that the random sample falls in A, we can get a good estimate of the probability measure of A. The key difficulty is, however, that we should run the chain long enough to get sufficiently close to the stationary distribution. This time is often referred to as mixing time [16]. If the mixing time grows only polynomially with the size of the problem, e.g. with the size of the graph, then we say that the chain is rapidly mixing. Unfortunately, in many cases of interest the mixing time grows exponentially with the problem parameters, so in many important 2 cases the Markov chain is mixing very slowly. What we are interested in is whether it is possible to speed up the running time. It is clear that if we want to estimate the size of any possible subset, then we really need to get close to the stationary distribution, since only this distribution can guarantee that the probability of the random state falling in the set is really the relative size of the set. On the other hand, if we only want to estimate the relative size of a specific subset A, then it is enough for us if we reach a distribution in which the measure of A is close to the stationary measure, but this does not have to hold for every other set. In other words, if πt denotes the state distribution after t steps and π is the stationary distribution, then we want to choose t such that πt(A) − π(A) is small, but the same does not have to hold for all other sets. This makes it possible to reduce the required value of t, that is, to speed up the algorithm. In this paper we investigate under what conditions it is possible to obtain such a speed-up. The main result is that the structure of the chain, that is, the network structure, can significantly help, if it has some special properties. Specifically, if the Markov chain is close to a so called lumpable chain, then remarkable speedup is possible. In other words, in this case we can indeed capitalize on the particular network structure to accelerate the method. Below we informally explain what the concept of lumpability means. The formal definition will follow in the next section. The concept of lumpability stems from the following observation: it is very useful if the state space can be partitioned such that the states belonging to the same partition class "behave the same way," in the sense defined formally in the next section. This is the concept of lumpability [9]. Informally speaking, it means that some sets of states can be lumped together (aggregated) and replaced by a single state, thus obtaining a Markov chain which has a much smaller state space, but its essential behavior is the same as the original. In some cases the lumpability of the Markov chain can have a very significant effect on the efficiency of the model. A practical example is discussed in [11, 15], where the authors present a fast algorithm to compute the PageRank vector, which is an important part of search engine algorithms in the World Wide Web. The PageRank vector can be interpreted as the stationary distribution of a Markov chain. This chain has a huge state space, yielding excessive computation times. This Markov chain, however, is lumpable. Making use of the lumpability, the computation time can be reduced to as low as 20% of the original, according to the experiments presented in [11]. Unfortunately, it happens relatively rarely that the Markov chain satisfies the definition of lumpability exactly. This motivates the concept of quasi-lumpability [2, 3]. Informally, a Markov chain is quasi-lumpable if its transition matrix is obtainable by a small perturbation from a matrix that exactly satisfies the lumpability condition (see the formal definition in the next section). In this paper we are interested in the following problem, which is often encountered 3 in applications: how long do we have to run the Markov chain if we want to get close to the stationary distribution within a prescribed error? While the general question is widely discussed in the literature (see, e.g., [10, 16]), we focus here on a less researched special case: how much gain can the convergence speed enjoy, if we can capitalize on the special structure of quasi-lumpability. II Aggregation in Markov Chains We assume the reader is familiar with the basic concepts of Markov chains. We adopt the notation that a Markov chain M is given by a set S of states and by a transition probability matrix P , so we write M = (S, P ). This notation does not include the initial distribution, because it is assumed arbitrary. Let us first define the concept lumpability of a Markov chain. Informally, as mentioned in the Introduction, a chain is lumpable if its states can be aggregated into larger subsets of S, such that the aggregated (lumped) chain remains a Markov chain with respect to the set-transition probabilities (i.e, it preserves the property that the future depends on the past only through the present). Note that this is generally not preserved by any partition of the state space. Let us introduce now the formal definition. Definition 1 (Lumpability of Markov chain) Let M = (S, P ) be a Markov chain. Let Q = {A1, . . . , Am} be a partition of S. The chain M is called lumpable with respect to the partition Q if for any initial distribution the relationship Pr(Xt ∈ Aj Xt−1 ∈ Ai1, . . . , Xt−k ∈ Aik) = Pr(Xt ∈ Aj Xt−1 ∈ Ai1) (2) holds for any t, k, j, i1, . . . , ik, whenever these conditional probabilities are defined (i.e., the conditions occur with positive probability). If the chain is lumpable, then the state set of the lumped chain is Q and its state transition probabilities are defined by pij = Pr(Xt ∈ Aj Xt−1 ∈ Ai). Checking whether a Markov chain is lumbable would be hard to do directly from the definition. That is why it is useful to have the following characterization, which is funda- mental result on the lumpability of Markov chains, see [9]. For simple description, we use the notation p(x, A) to denote the probability that the chain moves into a set A ⊆ S in the next step, given that currently it is in the state x ∈ S. Note that x itself may or may not be in A. Theorem 1 (Necessary and sufficient condition for lumpability, see [9]) A Markov chain M = (S, P ) is lumpable with respect to a partition Q = {A1, . . . , Am} of S if and 4 only if for any i, j the value of p(x, Aj) is the same for every x ∈ Ai. These common values define the transition probabilities p(Ai, Aj) for the lumped chain, which is a Markov chain with state set Q and state transition probabilities p(Ai, Aj) = p(x, Aj) = Pr(Xt ∈ Aj Xt−1 ∈ Ai) where x is any state in Ai. Informally, the condition means that a move from a set Ai ∈ Q to another set Aj ∈ Q happens with probability p(x, Aj), no matter which x ∈ Ai is chosen. That is, any x ∈ Ai has the property that the probability of moving from this x to the set Aj in the next step is the same for every x ∈ Ai. The sets Ai, Aj are partition classes of Q. We also allow i = j, so they may coincide. Whenever our Markov chain is lumpable, we can reduce the number of states by the above aggregation, and it is usually advantageous for faster convergence (a specific bound will be proven in Section III). It is worth noting that lumpability is a rather special property, and one has to be quite lucky to encounter a real-life Markov chain that actually has this property. Sometimes it happens (see, e.g., the example in the Introduction about PageRank computation), but it is not very common. Therefore, let us now relax the concept of lumpability to broaden the family of the considered Markov chains. The extended condition, as explained below, is called quasi-lumbability. Informally, a Markov chain is called quasi-lumpable or -quasi-lumpable or simply - lumpable, if it may not be perfectly lumpable, but it is "not too far" from that. This "-closeness" is defined in [2, 3] in a way that the transition matrix can be decomposed as P = P − + P . Here P − is a component-wise non-negative lower bound for the original tran- sition matrix P , such that P − satisfies the necessary and sufficient condition of Theorem 1. The other matrix, P , represents a perturbation. It is an arbitrary non-negative matrix in which each entry is bounded by . This definition is not very easy to visualize, therefore, we use the following simpler but equivalent definition. Definition 2 (-lumpability) Let  ≥ 0. A Markov chain M = (S, P ) is called -lumpable with respect to a partition Q = {A1, . . . , Am} of S if holds for any x, y ∈ Ai and for any i, j ∈ {1, . . . , m}. p(x, Aj) − p(y, Aj) ≤  Note that if we take  = 0, then we get back the ordinary concept of lumpability. Thus, quasi-lumpability is indeed a relaxation of the original concept. It can also be interpreted in the following way. If  > 0, then the original definition of lumpability may not hold. This 5 means, the aggregated process may not remain Markov. i.e., it does not satisfy (2). On the other hand, if  is small, then the aggregated process will be, in a sense, "close" to being Markov, that is, to satisfying (2). What we are interested in is the convergence analysis of quasi-lumpable Markov chains, typically for a small value of . For the analysis we need to introduce another definition. Definition 3 (Lower and upper transition matrices) Let M = (S, P ) be a Markov chain which is -lumpable with respect to a partition Q = {A1, . . . , Am}. The lower and upper transition matrices L = [lij] and U = [uij] are defined as m × m matrices with entries lij = min x∈Ai p(x, Aj) and uij = max x∈Ai p(x, Aj), respectively, for i, j = 1, . . . , m. Note that it always holds (component-wise) that L ≤ U . If the chain is lumpable, then these matrices coincide, so then L = U = P , where P is the transition matrix of the lumped chain. If the chain is -lumpable, then L and U differ at most by  in each entry. Generally, L and U are not necessarily stochastic matrices1, as their rows may not sum up to 1. III Convergence Analysis An important concept in Markov chain convergence analysis is the ergodic coefficient, see, e.g., [10]. It is also called coefficient of ergodicity. Definition 4 (Ergodic coefficient) Let P = [pij] be an n×n matrix. Its ergodic coefficient is defined as ρ(P ) = 1 2 max i,j pik − pjk. n(cid:88) k=1 The ergodic coefficient is essentially the largest L1 distance that occurs between different row vectors of the matrix P . That is, in a sense, it captures how diverse are the row vectors of the matrix. The 1/2 factor is only for normalization purposes. For stochastic matrices two important properties of the ergodic coefficient are the following [10]: (i) (ii) 0 ≤ ρ(P ) ≤ 1 ρ(AB) ≤ ρ(A)ρ(B) 1 A vector is called stochastic if each coordinate is non-negative and their sum is 1. A matrix is called stochastic if each row vector of it is stochastic. 6 The importance of the ergodic coefficient lies in its relationship to the convergence rate of the Markov chain. It is well known that the convergence rate is determined by the second largest eigenvalue of the transition matrix (that is, the eigenvalue which has the largest If this eigenvalue is denoted by λ1, then the absolute value less than 1), see, e.g., [16]. convergence to the stationary distribution happens at a rate of O(λt 1), where t is the number of steps, see [10]. It is also known [10] that the ergodic coefficient is always an upper bound on this eigenvalue, it satisfies λ1 ≤ ρ(P ) ≤ 1. Therefore, the distance to the stationary distribution is also bounded by O(ρ(P )t). Thus, the smaller is the ergodic coefficient, the faster convergence we can expect. Of course it only provides any useful bound if ρ(P ) < 1. If ρ(P ) = 1 happens to be the case, then it does not directly provide a useful bound on the convergence rate, since then ρ(P )t remains 1. In this situation a possible way out is considering the k-step transition matrix P k for some constant integer k. If k is large enough, then we can certainly achieve ρ(P k) < 1, since it is known [10] that limk→∞ ρ(P k) = 0. Now we are ready to present our main result, which is a bound on how fast will an -lumpable Markov chain converge to its stationary distribution on the sets that are in the partition, which is used in defining the -lumpability of the chain. We are going to discuss the applicability of the result in the next section. Theorem 2 Let  ≥ 0 and M = (S, P ) be an irreducible, aperiodic Markov chain with stationary distribution π. Assume the chain is -lumpable with respect to a partition Q = {A1, . . . , Am} of S. Let ρ be any upper bound on the ergodic coefficient of the lower transition matrix L (Definition 3), that is, ρ(L) ≤ ρ. Let π0 be any initial probability distribution on S, such that P(Xt ∈ Ai) > 0 holds for any i, and t = 0, 1, 2, . . ., whenever the chain starts from π0. Then for every t ≥ 1 the following estimation holds: πt(Ai) − π(Ai) ≤ 2(ρ + m/2)t + m 1 − (ρ + m/2)t 1 − ρ − m/2 m(cid:88) i=1 assuming ρ + m/2 < 1. Remark: Recall that the parameter  quantifies how much the Markov chain deviates from the ideal lumpable case, see Definition 2. In the extreme case, when  = 1, every Markov chain satisfies the definition. This places an"upward pressure" on : the larger it is, the broader is the class of Markov chains to which -lumpability applies. On the other hand, a downward pressure is put on  by Theorem 2: the convergence bound is only meaningful, if ρ + m/2 < 1 holds. This inequality can be checked for any particular , since it is assumed that ρ and m are known parameters. Furthermore, the smaller is , the faster is the convergence. Therefore, the best value of  is the smallest value which still satisfies Definition 2 for the considered state partition. For the proof of Theorem 2 we need a lemma about stochastic vectors and matrices (Lemma 3.4 in [6], see also [7]): 7 Lemma 1 (Hartfiel [6, 7]) Let x, y be n-dimensional stochastic vectors and B1, . . . , Bk; C1, . . . , Ck be n × n stochastic matrices. If ρ(Bi) ≤ ρ0 and ρ(Ci) ≤ ρ0 for all i, 1 ≤ i ≤ k, then (cid:107)xB1 . . . Bk − yC1 . . . Ck(cid:107) ≤ ρk 0(cid:107)x − y(cid:107) + where E = maxi (cid:107)Bi − Ci(cid:107). The vector norm used is the L1-norm (cid:107)x(cid:107) = (cid:80)n j=0 ρj 0 i=1 xi and the k−1(cid:88) E matrix norm is (cid:107)A(cid:107) = sup z(cid:54)=0 (cid:107)zA(cid:107) (cid:107)z(cid:107) = max i for any n × n real matrix A = [aij]. n(cid:88) j=1 aij Lemma 1 can be proved via induction on k, see [6, 7]. Now, armed with the lemma, we can prove our theorem. Proof of Theorem 2. Let π0 be an initial state distribution of the Markov chain M, let πt be the corresponding distribution after t steps and π = limt→∞ πt be the (unique) stationary distribution of M. For a set A ⊆ S of states the usual notations πt(A) = P(Xt ∈ A), π(A) = limt→∞ πt(A) are adopted. Using the sets A1, . . . , Am of the partition Q, let us define the stochastic vectors for t = 0, 1, 2, . . . and the m × m stochastic matrices πt = (πt(A1), . . . , πt(Am)) Pt(π0) = [p(π0) t (i, j)] = [P(Xt+1 ∈ Aj Xt ∈ Ai)] (3) (4) for t = 1, 2, . . .. Let us call them aggregated state distribution vectors and aggregated transition matrices, respectively. Note that although the entries in (4) involve only events of the form {Xt ∈ Ak}, they may also depend on the detailed state distribution within these sets, which is in turn determined by the initial distribution π0. In other words, if two different initial distributions give rise to the same probabilities for the events {Xt ∈ Ak} for some t, they may still result in different conditional probabilities of the form P(Xt+1 ∈ Aj Xt ∈ Ai), since the chain is not assumed lumpable in the ordinary sense. This is why the notations Pt(π0), p(π0) (i, j) are used. Also note that the conditional probabilities are well defined for any initial distribution allowed by the assumptions of the lemma, since then P(Xt ∈ Ai) > 0. For any fixed t the events {Xt ∈ Ai}, i = 1, . . . , m, are mutually exclusive with total t probability 1, therefore, by the law of total probability, P(Xt+1 ∈ Aj) = P(Xt+1 ∈ Aj Xt ∈ Ai)P(Xt ∈ Ai), j = 1, . . . , m m(cid:88) i=1 8 holds. This implies πt+1 = πt Pt(π0), from which πt = π0 P1(π0) · . . . · Pt(π0) (5) follows. We next show that for any t = 1, 2, . . . the matrix Pt(π0) falls between the lower and upper transition matrices, i.e., L ≤ Pt(π0) ≤ M holds. Let us use short notations for certain and for x ∈ S let Ex = {Xt = x}. Then Ex ∩ Ey = ∅ holds for any x (cid:54)= y and (cid:80) i = {Xt+1 ∈ Ai}, events: for any i = 1, . . . , m and for a fixed t ≥ 1 set Hi = {Xt ∈ Ai}, H(cid:48) x∈S Ex = 1. Applying the definition of conditional probability and the law of total probability, noting that P(Hi) > 0 is provided by the assumptions of the lemma, we get p(π0) t (i, j) = P(H(cid:48) j Hi) = = = = = j ∩ Hi) P(H(cid:48) (cid:80) P(Hi) x∈S P(H(cid:48) (cid:80) x∈S P(H(cid:48) (cid:88) (cid:88) P(H(cid:48) P(H(cid:48) x∈S x∈S j ∩ Hi ∩ Ex) P(Hi) j Hi ∩ Ex)P(Hi ∩ Ex) P(Hi ∩ Ex) P(Hi) j Hi ∩ Ex) P(Hi) j Hi ∩ Ex)P(Ex Hi). Whenever x /∈ Ai we have P(Ex Hi) = P(Xt = x Xt ∈ Ai) = 0. Therefore, it is enough to take the summation over Ai, instead of the entire S. For x ∈ Ai, however, Hi ∩ Ex = {Xt ∈ Ai} ∩ {Xt = x} = {Xt = x} holds, so we obtain p(π0) t (i, j) = P(Xt+1 ∈ Aj Xt = x)P(Xt = x Xt ∈ Ai). (cid:88) x∈Ai (i, j) is a weighted average of the P(Xt+1 ∈ Aj Xt = x) probabilities. The weights Thus, p(π0) are P(Xt = x Xt ∈ Ai), so they are non-negative and sum up to 1. Further, t lij ≤ P(Xt+1 ∈ Aj Xt = x) ≤ uij must hold, since lij, uij are defined as the minimum and maximum values, respectively, of p(x, Aj) = P(Xt+1 ∈ Aj Xt = x) over x ∈ Ai. Since the weighted average must fall between the minimum and the maximum, therefore, we have (6) lij ≤ p(π0) t (i, j) ≤ uij, 9 that is, L ≤ Pt(π0) ≤ M (7) for any t ≥ 1 and for any initial distribution π0 allowed by the conditions of the Theorem. Let us now start the chain from an initial distribution π0 that satisfies the conditions of the Theorem. We are going to compare the arising aggregated state distribution vectors (3) with the ones resulting from starting the chain from the stationary distribution π. Note that, due to the assumed irreducibility of the original chain, π(x) > 0 for all x ∈ S, so π is also a possible initial distribution that satisfies the conditions P(Xt ∈ Ai) > 0. When the chain is started from the stationary distribution π, then, according to (5), the aggregated state distribution vector at time t is π P1(π) · . . . · Pt(π) where π is given as π = (π(A1), . . . , π(Am)). On the other hand, P(Xt ∈ Ai) remains the same for all t ≥ 0 if the chain starts from the stationary distribution. Therefore, we have π P1(π) · . . . · Pt(π) = π = (π(A1), . . . , π(Am)). (8) When the chain starts from π0, then we obtain the aggregated state distribution vector πt = π0 P1(π0) . . . Pt(π0) (9) after t steps. Now we can apply Lemma 1 for the comparison of (8) and (9). The roles for the quantities in Lemma 1 are assigned as x = π0, y = π, k = t, n = m, and, for every τ = 1, . . . , k, Bτ = Pτ (π0), Cτ = Pτ (π). To find the value of ρ0 recall that by (7) we have L ≤ Pτ (π0) ≤ M and L ≤ Pτ (π) ≤ M . Since any entry of U exceeds the corresponding entry of L at most by , therefore, by the definition of the ergodic coefficient, ρ( Pτ (π0)) ≤ ρ+m/2 and ρ( Pτ (π)) ≤ ρ + m/2 hold, where ρ is the upper bound on ρ(L). Thus, we can take ρ0 = ρ + m/2. With these role assignments we obtain from Lemma 1 P1(π0) . . . Pt(π0) − π P1(π) . . . Pt(π)(cid:107) ≤ (ρ + m/2)t(cid:107)π0 − π(cid:107) + E t−1(cid:88) (cid:107)π0 (ρ + m/2)k k=0 where E = maxτ (cid:107)Pτ (π0) − Pτ (π0)(cid:107) and the norms are as in Lemma 1. Taking (8) and (9) into account yields (cid:107)πt − π(cid:107) = m(cid:88) πt(Ai) − π(Ai) ≤ (ρ + m/2)t(cid:107)π0 − π(cid:107) + E t−1(cid:88) i=1 k=0 (ρ + m/2)k. (10) Thus, it only remains to estimate (cid:107)π0 − π(cid:107) and E. Given that π0, π are both stochastic vectors, we have (cid:107)π0 − π(cid:107) ≤ (cid:107)π0(cid:107) + (cid:107)π(cid:107) ≤ 2. Further, m(cid:88) E = max (cid:107)Pτ (π0) − Pτ (π)(cid:107) = max p(π0) τ (i, j) − p(π) τ (i, j) ≤ m, τ max i τ j=1 10 since (6) holds for any considered π0 (including π), and, by the definition of -lumpability, uij − lij ≤ . Substituting the estimations into (10), we obtain t−1(cid:88) (ρ + m/2)k 1 − (ρ + m/2)t 1 − ρ − m/2 πt(Ai) − π(Ai) ≤ 2(ρ + m/2)t + m = 2(ρ + m/2)t + m k=0 m(cid:88) i=1 proving the Theorem. ♠ If the chain happens to be exactly lumpable, then we get a "cleaner" result. Let πt be the state distribution of the lumped chain after t steps and let π be its stationary distribution. For concise description let us apply a frequently used distance concept among probability distributions. If p, q are two discrete probability distributions on the same set S, then their total variation distance DT V (p, q) is defined as DT V (p, q) = 1 2 p(x) − q(x). (cid:88) x∈S It is well known that 0 ≤ DT V (p, q) ≤ 1 holds for any two probability distributions. It is also clear from the definition of the ergodic coefficient that it is the same as the maximum total variation distance occurring between any two row vectors of the transition matrix. Note that exact lumpability is the special case of -lumpability with  = 0. Therefore, we immediately obtain the following corollary. Corollary 1 If the Markov chain in Theorem 2 is exactly lumpable, then in the lumped chain for any t = 0, 1, 2, . . . the following holds: DT V (πt, π) ≤ ρt where ρ = ρ( P ) is the ergodic coefficient of the transition matrix P of the lumped chain. Proof. Take the special case  = 0 in Theorem 2. ♠ IV Numerical Demonstration Let us consider the following situation. Let M be a Markov chain with state space S. Assume we want to estimate the stationary measure π(A) of a subset A ⊆ S. A practical example of such a situation is to estimate the probability that there is at most k blocked 11 links, for some constant k, in a large communication network. Here the state space is the set S of all possible states of all the links. The state of a link is the current traffic load of the link, and it is blocked if the load is equal to the link capacity, so it cannot accept more traffic. Within this state space the considered subset A is the subset of states in which among all links at most k are blocked. Therefore, the relevant partition of S is {A, S − A}. This is motivated by real-world application, since the number of blocked links critically affects network performance. When considering the loss of traffic due to blocking, the models of these networks are often called loss networks. For detailed background information on loss networks, see [8, 13, 14]. Of course, we can also consider other events in the network. For example, at most a given percentage of traffic is blocked, without specifying how many links are involved in the blocking. In many cases we are unable to directly compute π(A). This task frequently has enor- mous complexity, for the theoretical background see [12]. Then a natural way to obtain an estimation of π(A) is simulation. That is, we run the chain from some initial state, stop it after t steps and check out whether the stopping state is in A or not. Repeating this experiment a large enough number of times, the relative frequency of ending up in A will give a good estimation of the measure of πt(A). If t is chosen such that πt is close enough to the stationary distribution π for any initial state, then we also obtain a good estimation for π(A). This is the core idea of the Markov Chain Monte Carlo approach. Unfortunately, Markov chains with large state space often converge extremely slowly. Therefore, we may not get close enough to π after a reasonable number of steps. In such a case our result can do a good service, at least when the chain satisfies some special requirements. As an example, let us consider the following case. First we examine it using our bounds, then we also study it through numerical experiments. Assume the set A ⊆ S has the property that its elements behave similarly in the following sense: for any state x ∈ A the probability to move out of A in the next step, given that the current state is x, is approximately the same. Similarly, if x /∈ A, then moving into A in the next step from the given x has approximately the same probability for any x /∈ A. To make this assumption formal, assume there are values p0, q0, , such that the following conditions hold: (A) If x ∈ A then p0 ≤ p(x, ¯A) ≤ p0 +  where ¯A = S − A. This means, the smallest probability of moving out of A from any state in x ∈ A is at least p0, and the largest such probability is at most p0 + . (B) If x ∈ ¯A then q0 ≤ p(x, A) ≤ q0 + . Similarly to the first case, this means that the smallest probability of moving into A from any state in x /∈ A is at least q0, and the largest such probability is at most q0 + . (We choose  such that it can serve for this purpose in both directions.) 12 (C) To avoid degenerated cases, we require that the numbers p0, q0,  satisify p0 +  < 1, q0 +  < 1 and 0 < p0 + q0 < 1. The other state transition probabilities (within A and A) can be completely arbitrary, assuming, of course, that at any state the outgoing probabilities must sum up to 1. Let us now apply our main result, Theorem 2, for this situation. The parameters will be as follows: m, the number of sets in the partition, is 2, since the partition is (A, A). The matrices L, U become the following: (cid:34) L = (cid:35) (cid:34) 1 − p0 −  q0 p0 1 − q0 −  U = 1 − p0 p0 +  q0 +  1 − q0 (cid:35) . Furthermore, we can take ρ = 1− p0 − q0 −  as an upper bound on the ergodic coefficient of L. Then we obtain from Theorem 2, expressing the estimation in terms of the total variation distance: DT V (πt, π) ≤ (1 − p0 − q0)t +  1 − (1 − p0 − q0)t p0 + q0 where the distributions πt, π are over the sets of the partition (A, ¯A), not on the original state space. Note that in our case we actually have DT V (πt, π) = πt(A) − π(A), due to the fact that πt(A) − π(A) = πt( ¯A) − π( ¯A). Therefore, we obtain the estimation directly for the set A: πt(A) − π(A) ≤ (1 − p0 − q0)t +  (11) If p0 + q0 is not extremely small, then the term (1 − p0 − q0)t will quickly vanish, as it approaches 0 at an exponential rate. Therefore, after a reasonably small number of steps, we reach a distribution πt from any initial state, such that approximately the following bound is satisfied: p0 + q0 . 1 − (1 − p0 − q0)t πt(A) − π(A) ≤  p0 + q0 . (12) It is quite interesting to note that neither the precise estimation (11), nor its approximate version (12) depend on the size of the state space. Now we demonstrate via numerical results that the obtained bounds indeed hold. More- over, they are achievable after a small number of Markov chain steps, that is, with fast convergence. We simulated the example with the following parameters: n = 100 states, p0 = q0 = 0.25, and  = 0.1. The set A was a randomly chosen subset of 50 states. The transition probabilities were also chosen randomly, with the restriction that together with the other parameters they had to satisfy conditions (A), (B), (C). Figure 1 shows the relative frequency of visiting A, as function of the number of Markov chain steps. It is well detectable that the chain converges quite slowly. Even after many iterations the deviation from the stationary probability π(A) does not visibly tend to 0. On 13 the other hand, it indeed stays within our error bound: πt(A) − π(A) ≤  p0 + q0 = 0.1 0.25 + 0.25 = 2 · 0.1, as promised. Having observed this, it is natural to ask, how soon can we reach this region, that is, how many steps are needed to satisfy the bound? This is shown in Figure 2. We can see that after only 10 iterations, the error bound is already satisfied. Note that this is very fast convergence, since the number of steps to get within the bound was as little as 10% of the number of states. Figure 1: Deviation from the stationary measure for many iterations. 14 Figure 2: Very fast convergence to satisfy the error bound. V Conclusion We have analyzed the convergence rate of quasi-lumpable Markov Chains. This represents the case when the large state space can be aggregated into a smaller number of clusters, in which the states behave approximately the same way. Our main contribution is a bound on the rate at which the aggregated state distribution approaches its limit in such chains. We have also demonstrated that in certain cases this can lead to a significantly accelerated convergence to an approximate estimation of the measure of subsets. The result can serve as a useful tool in the analysis of complex networks, when they have a clustering that approximately satisfies the conditions lumpability. References [1] B.A. Cipra, "The Best of the 20th Century: Editors Name Top 10 Algorithms," SIAM News, Vol. 33, No. 4, May 2000. 15 [2] T. Dayar and W.J. Stewart, "Quasi Lumpability, Lower Bounding Coupling Matrices, and Nearly Completely Decomposable Markov Chains", SIAM J. Matrix Anal. Appl., 18(1997/2), pp. 482-498. [3] G. Franceschinis and R.R. Muntz, "Bounds for Quasi-Lumpable Markov Chains", Per- formance Evaluation, 20(1994) pp. 223-243. [4] A Farag´o, "Speeeding Up Markov Chain Monte Carlo Algorithms", International Con- ference on Foundations of Computer Science (FCS'06), Las Vegas, Nevada, June 26-29, 2006. [5] A Farag´o, "On the Convergence Rate of Quasi Lumpable Markov Chains", 3rd European Performance Engineering Workshop (EPEW'06), Budapest, Hungary, June 21-22, 2006. [6] D.J. Hartfiel, Markov Set-Chains, Lecture Notes in Mathematics 1695, Springer-Verlag, 1998. [7] D.J. Hartfiel, "Results on Limiting Sets of Markov Set-Chains", Linear Algebra and its Applications, 195(1993), pp. 155-163. [8] F.P. Kelly, "Loss Networks", Annals of Applied Probability, Vol. 1, No. 3, 1991, pp. 319-378. [9] J.G. Kemeny and J.L. Snell, Finite Markov Chains, Van Nostrand Reinhold, New York, 1960. (Later editions: Springer, 1976, 1983) [10] M. Kijima, Markov Processes for Stochastic Modeling, Chapman & Hall, 1997. [11] C. P.-C. Lee, G. H. Golub and S. A. Zenios, "A Fast Two-Stage Algorithm for Comput- ing PageRank and Its Extensions", Technical Report SCCM-2003-15, Scientific Com- putation and Computational Mathematics, Stanford University, Stanford, CA, 2003. [12] G. Louth, M. Mitzenmacher and F.P. Kelly, "Computational Complexity of Loss Net- works", Theoretical Computer Science, 125(1994), pp. 45-59. [13] R.R. Mazumdar, Performance Modeling, Stochastic Networks, and Statistical Multiplex- ing, Morgan & Claypool, 2013. [14] K.W. Ross, Multiservice Loss Models for Broadband Telecommunication Networks, Springer, 1995. [15] P. Sargolzaei, and F. Soleymani, "PageRank Problem, Survey And Future, Research Directions," International Mathematical Forum, Vol. 5, No. 19, pp. 937 -- 956, 2010. [16] A. Sinclair, Algorithms for Random Generation and Counting, Birkhauser, Boston 1993. 16
1102.5441
2
1102
2011-03-07T19:49:20
Obtaining a Bipartite Graph by Contracting Few Edges
[ "cs.DS" ]
We initiate the study of the Bipartite Contraction problem from the perspective of parameterized complexity. In this problem we are given a graph $G$ and an integer $k$, and the task is to determine whether we can obtain a bipartite graph from $G$ by a sequence of at most $k$ edge contractions. Our main result is an $f(k) n^{O(1)}$ time algorithm for Bipartite Contraction. Despite a strong resemblance between Bipartite Contraction and the classical Odd Cycle Transversal (OCT) problem, the methods developed to tackle OCT do not seem to be directly applicable to Bipartite Contraction. Our algorithm is based on a novel combination of the irrelevant vertex technique, introduced by Robertson and Seymour, and the concept of important separators. Both techniques have previously been used as key components of algorithms for fundamental problems in parameterized complexity. However, to the best of our knowledge, this is the first time the two techniques are applied in unison.
cs.DS
cs
Obtaining a Bipartite Graph by Contracting Few Edges⋆ Pinar Heggernes1, Pim van 't Hof1, Daniel Lokshtanov2, and Christophe Paul3 1 Department of Informatics, University of Bergen, Norway. {pinar.heggernes,pim.vanthof}@ii.uib.no 2 Dept. Computer Science and Engineering, University of California San Diego, USA. 3 CNRS, LIRMM, Universit´e Montpellier 2, France. [email protected] [email protected] Abstract. We initiate the study of the Bipartite Contraction prob- lem from the perspective of parameterized complexity. In this problem we are given a graph G and an integer k, and the task is to determine whether we can obtain a bipartite graph from G by a sequence of at most k edge contractions. Our main result is an f (k) nO(1) time algorithm for Bipartite Contraction. Despite a strong resemblance between Bipar- tite Contraction and the classical Odd Cycle Transversal (OCT) problem, the methods developed to tackle OCT do not seem to be di- rectly applicable to Bipartite Contraction. Our algorithm is based on a novel combination of the irrelevant vertex technique, introduced by Robertson and Seymour, and the concept of important separators. Both techniques have previously been used as key components of algorithms for fundamental problems in parameterized complexity. However, to the best of our knowledge, this is the first time the two techniques are applied in unison. 1 Introduction Odd Cycle Transversal (OCT) is a central problem in parameterized com- plexity. The establishment of its fixed parameter tractability by Reed, Smith, and Vetta [20] in 2004, settling a long-standing open question [6], supplied the field with the powerful new technique of iterative compression [18]. OCT and the closely related Edge Bipartization problem take a graph G and an inte- ger k as input, and ask whether a bipartite graph can be obtained by deleting at most k vertices, respectively k edges, from G. These two problems can be viewed as two ways of measuring how close G is to being bipartite. Over the last few years a considerable amount of research has been devoted to studying different measures of how close a graph is to being bipartite [7, 8, 13, 12], and how similarity to a bipartite graph can be exploited [4]. A natural similarity measure is defined by the Bipartite Contraction problem: Given a graph G and an integer k, can we obtain a bipartite graph from ⋆ This work is supported by the Research Council of Norway. G by a sequence of at most k edge contractions in G? The number of possible edge contractions in G is always less than the number of vertices of G, since every edge contraction reduces the number of vertices by exactly one. In practical instances of bipartization problems the similarity parameter k tends to be small [21], which makes these problems especially well-suited for parameterized algorithms. A graph problem with input G and k is fixed parameter tractable (FPT) if there is an algorithm with running time f (k) nO(1), where the function f depends only on k and not on the size of G. Considering the significant amount of interest the problems OCT and Edge Bipartization have received, we find it surprising that Bipartite Contraction has not yet been studied. In this paper we show that Bipartite Contraction is fixed parameter tractable when parameterized by the number k of edges to be contracted. The key ingredients of our algorithm fundamentally differ from the ones used in the above-mentioned algorithms for OCT and Edge Bipartization. In the algo- rithm for OCT by Reed, Smith, and Vetta [20], iterative compression is combined with maximum flow arguments. The recent nearly linear time algorithm for the two problems, due to Kawarabayashi and Reed [12], uses the notion of odd mi- nors, together with deep structural results of Robertson and Seymour [22] about graphs of large treewidth without large clique minors. Interestingly, Bipartite Contraction does not seem to be amenable to these approaches. Although our algorithm is based on iterative compression, it seems difficult to adapt the compression step from [20] for OCT to work for Bipartite Contrac- tion. Instead, we perform the compression step using a variant of the irrelevant vertex technique, introduced by Robertson and Seymour [22] (see also [23]). In particular, if the treewidth of the input graph is large, then we identify an irrel- evant edge that can be deleted from the graph without affecting the outcome. The irrelevant vertex technique has played a key role in the solutions of several problems (see e.g., [11, 13, 14]). Our algorithm crucially deviates from previous work in the manner in which it finds the irrelevant edge. While previous work has relied on large minor models as obstructions to small treewidth, ours uses the fact that any graph of high treewidth contains a large p-connected set X [5]. A vertex set X is p-connected if, for any two subsets X1 and X2 of X with X1 = X2 ≤ p, there are X1 vertex- disjoint paths with one endpoint in X1 and the other in X2. Using p-connected sets in order to find irrelevant edges has several advantages. First, our algorithm avoids the huge parameter-dependence which seems to be an inadvertent side effect of applying the Robertson and Seymour's graph minors machinery. Second, our arguments are nearly self-contained, and rely only on results whose proofs are simple enough to be taught in a graduate class. Thus, even though our algorithm is not practical by any means, it is much closer to practicality than other algorithms based on the irrelevant vertex technique. It is an intriguing question whether some of the algorithms that currently use Robertson-Seymour machinery to find an irrelevant vertex can be modified in such a way, that they find an irrelevant vertex using p-connected sets instead. 2 Using p-connected sets in order to find an irrelevant vertex or edge is non- trivial, because p-connectivity is a more "implicit" notion than that of a large minor model. We overcome this difficulty by using important sets. Important sets and the closely related notion of important separators were introduced in [16] to prove the fixed-parameter tractability of multiway cut problems. The basic idea is that in many problems where terminals need to be separated in some way, it is sufficient to consider separators that are "as far as possible" from one of the terminals. Important separators turned out to be a crucial component, in some cases implicitly, in the solutions of cardinal problems in parameterized complexity [2, 3, 19, 17]. To the best of our knowledge, this is the first time the irrelevant vertex technique and important sets (or separators) are used together. We believe that this combination will turn out to be a useful and powerful tool. 2 Definitions and notation All graphs considered in this paper are finite, undirected, and simple, i.e., do not contain multiple edges or loops. Given a graph G, we denote its vertex set by V (G) and its edge set by E(G). We also use the ordered pair (V (G), E(G)) to represent G. We let n = V (G) and m = E(G). For two graphs G1 = (V1, E1) and G2 = (V2, E2), the disjoint union of G1 and G2 is the graph G1 ∪ G2 = (V1 ∪ V2, E1 ∪ E2). The deletion of an edge e ∈ E(G) yields the graph G − e = (V (G), E(G) \ e). For a set X ⊆ V (G), we write G[X] to denote the subgraph of G induced by X. A graph is connected if there is a path between every pair of its vertices. The connected components of a graph are its maximal connected subgraphs. For any set X ⊆ V (G), we write δG(X) to denote the set of edges in G that have exactly one endpoint in X. We define dG(X) = δ(X). The contraction of edge xy in G deletes vertices x and y from G, and replaces them by a new vertex, which is made adjacent to precisely those vertices that were adjacent to at least one of the vertices x and y. The resulting graph is denoted G/xy. Every edge contraction reduces the number of vertices in the graph by exactly one. We point out that several edges might disappear as the result of a single edge contraction. For a set S ⊆ E(G), we write G/S to denote the graph obtained from G by repeatedly contracting an edge from S until no such edge remains. It follows from the definition of an edge contraction that in order to obtain the graph G/S from S, it is necessary and sufficient to contract all the edges of some spanning forest of the graph (V (G), S). Let H be a graph with V (H) = {h1, h2, . . . , hℓ}. A graph G is H-contractible if H can be obtained from G by contracting edges. Saying that G is H-contractible is equivalent to saying that G has a so-called H-witness structure W, which is a partition of V (G) into witness sets W (h1), W (h2), . . . , W (hℓ). The witness sets have the property that each of them induces a connected subgraph of G, and for every two hi, hj ∈ V (H), there is an edge in G between a vertex of W (hi) and a vertex of W (hj) if and only if hi and hj are adjacent in H. Let G′ = G[W (h1)] ∪ · · · ∪ G[W (hℓ)] be the graph obtained from G by re- moving all the edges of G, apart from the ones that have both endpoints in 3 the same witness set. In order to contract G to H, it is necessary and suf- ficient to contract all the edges of some spanning forest F of G′. Note that E(F ) = Pℓ i=1(W (hi) − 1) = V (G) − V (H). A 2-coloring of a graph G is a function φ : V (G) → {1, 2}. We point out that a 2-coloring of G is merely an assignment of colors 1 and 2 to the vertices of G, and should therefore not be confused with a proper 2-coloring of G, which is a 2-coloring with the additional property that no two adjacent vertices receive the same color. An edge uv is said to be good (with respect to φ) if φ(u) 6= φ(v), and uv is called bad (with respect to φ) otherwise. A good component of φ is the vertex set of a connected component of the graph (V (G), E ′), where E ′ ⊆ E is the set of all edges that are good with respect to φ. Any 2-coloring φ of G defines a partition of V (G) into two sets V 1 φ , which are the sets of vertices of G colored 1 and 2 by φ, respectively. A set X ⊆ V (G) is a monochromatic component of φ if G[X] is a connected component of G[V 1 φ ] or a connected component of G[V 2 φ ]. We write Mφ to denote the set of all monochromatic components of φ. The cost of a 2-coloring φ is defined as PX ∈Mφ (X − 1). Note that the cost of a 2-coloring φ of G is 0 if and only if φ is a proper 2-coloring of G. φ and V 2 Let G be a graph. A tree decomposition of G is a pair (T, X = {Xt}t∈V (T )), where T is a tree and X is a collection of subsets of V (G), satisfying the following three properties: (1) ∪u∈V (T )Xu = V ; (2) ∀uv ∈ E(G), ∃t ∈ V (T ) : {u, v} ⊆ Xt; and (3) ∀v ∈ V (G), T [{t v ∈ Xt}] is connected. The width of a tree decomposition is maxt∈V (T ) Xt − 1 and the treewidth of G, denoted tw(G), is the minimum width over all tree decompositions of G. The syntax of Monadic Second Order Logic (MSO) of graphs includes the logical connectives ∨, ∧, ¬, variables for vertices, edges, sets of vertices and sets of edges, the quantifiers ∀, ∃ that can be applied to these variables, and the following five binary relations: 1. u ∈ U , where u is a vertex variable and U is a vertex set variable; 2. d ∈ D, where d is an edge variable and D is an edge set variable; 3. inc(d, u), where d is an edge variable, u is a vertex variable, and the inter- pretation is that the edge d is incident to the vertex u; 4. adj(u, v), where u and v are vertex variables and the interpretation is that u and v are adjacent; 5. equality of variables representing vertices, edges, sets of vertices and sets of edges. 3 Bipartite Contraction and the cost of 2-colorings In the Bipartite Contraction problem we are given a graph G and an integer k, and the task is to determine whether there exists a set S ⊆ E(G) of at most k edges such that G/S is bipartite. The following lemma allows us to reformulate this problem in terms of 2-colorings of the graph G. Lemma 1. A graph G has a 2-coloring φ of cost at most k if and only if there exists a set S ⊆ E(G) of at most k edges such that G/S is bipartite. 4 Proof. Suppose G has a 2-coloring φ of cost at most k. We build an edge set S as follows. For each monochromatic component X ∈ Mφ, find a spanning tree T of G[X] and add the X − 1 edges of T to S. The total number of edges in S is exactly the cost of φ, so S ≤ k. It remains to argue that G′ = G/S is bipartite. Let uv ∈ S be a bad edge in G, and let φ′ be the 2-coloring of G/uv that assigns color φ(u) = φ(v) to the new vertex resulting from the contraction of uv, and that assigns color φ(w) to every vertex w ∈ V (G) \ {u, v}. Since we contracted a bad edge, the cost of φ′ is 1 less than the cost of φ. Repeating this for every edge in S yields a 2-coloring φ′′ of G′ of cost 0. This means that φ′′ is a proper 2-coloring of G′, which implies that G′ is bipartite. For the reverse direction, suppose there is a set S ⊆ E(G) of at most k edges such that G′ = G/S is bipartite. We define G∗ to be the graph with the same vertex set as G and edge set S, i.e., G∗ = (V (G), S). Let W be a G′-witness structure of G. Observe that W (y) induces a connected component of G∗ for every y ∈ V (G′). Let φ be a proper 2-coloring of G′. We construct a 2-coloring φ′ of G as follows. For every v ∈ V (G), we set φ′(v) = φ(y), where y is the vertex in V (G′) such that v ∈ W (y). Since the monochromatic components of φ′ are exactly the connected components of the graph G∗, and since G∗ contains exactly S edges, the cost of φ′ is at most S ≤ k. ⊓⊔ An instance of the Cheap Coloring problem consists of a graph G and an integer k, and the task is to decide whether G has a 2-coloring of cost at most k. Lemma 1 shows that the problems Bipartite Contraction and Cheap Coloring are equivalent. The deletion of an edge can not increase the cost of a 2-coloring, and can only decrease the cost of a 2-coloring by at most one. We state this as the following observation. Observation 1 Let φ be a 2-coloring of G of cost k. For any edge uv ∈ E(G), the cost of φ in G − uv is k or k − 1. Observation 1 allows us to use the well-known iterative compression technique of Reed, Smith and Vetta [20] to reduce the Cheap Coloring problem to the Cheaper Coloring problem. The Cheaper Coloring problem takes as input a graph G, an integer k, and a 2-coloring φ of G of cost k + 1, and the task is to either find a 2-coloring of G of cost at most k, or to conclude that such a coloring does not exist. Lemma 2. If there is an algorithm for Cheaper Coloring that runs in time f (k) nc, then there is an algorithm for Cheap Coloring that runs in time f (k) ncm. Proof. Suppose there exists an algorithm for Cheaper Coloring that runs in time f (k) nc. Then we can solve an instance (G, k) of Cheap Coloring by iterating over the edges e1, e2, . . . em of G as follows. For every i ∈ {1, . . . , m}, we define Gi to be the graph with vertex set V (G) and edge set Ei = {ej : j ≤ i}. The graph G1 has a 2-coloring φ1 of cost 0, which is at most k. For the first k 5 iterations, we trivially maintain a 2-coloring of cost at most k. Now, in iteration i of the algorithm, assume that we have a 2-coloring φi of cost at most k in Gi. By Observation 1, the cost of φi in Gi+1 is at most k + 1. If the cost of φi in Gi+1 is at most k, then we proceed to the (i + 1)th iteration. Otherwise, we run the algorithm for Cheaper Coloring with input (Gi+1, k, φi). If the algorithm concludes that Gi+1 has no 2-coloring of cost at most k, then, by Observation 1, neither does G. If, on the other hand, the algorithm outputs a 2-coloring φi+1 of Gi+1 of cost at most k, then we proceed to the (i + 1)th iteration. Since we call the algorithm for Cheaper Coloring at most m times, each time with parameter k, the time bound follows. ⊓⊔ We have now almost reached the variant of the problem that will be the focus of attention in the remainder of this paper. For two disjoint vertex sets T1 and T2, a 2-coloring φ of G is a (T1, T2)-extension if φ colors every vertex in T1 with 1 and every vertex in T2 with 2. In the Cheap Coloring Extension problem we are given a bipartite graph G, two integers k and t, and two disjoint vertex sets T1 and T2 such that T1 + T2 ≤ t. The objective is to find a (T1, T2)-extension φ of cost at most k, or to conclude that such a 2-coloring does not exist. We will say that a (T1, T2)-extension φ is a cheapest (T1, T2)-extension if there is no (T1, T2)-extension φ′ with strictly lower cost than φ. Lemma 3. If there is an algorithm for Cheap Coloring Extension that runs in time f (k, t) nc, then there is an algorithm for Cheaper Coloring that runs in time 4k+1f (k, 2k + 2) nc. Proof. Given an f (k, t) nc time algorithm for Cheap Coloring Extension, we show how to solve an instance (G, k, φ) of Cheaper Coloring. Let S be the set of all bad edges in G with respect to φ, and let X be the set of endpoints of the edges in S. Since φ has cost k + 1, we have X ≤ 2k + 2. We create 4k+1 instances of Cheap Coloring Extension as follows. For every possible partition X into two sets X1 and X2, we set k′ = k and t = X1 + X2, and we build a graph G(X1, X2) from G in the following way. As long as there is an edge uv ∈ S such that u and v are both in X1 or both in X2, contract the edge uv, put the new vertex resulting from the contraction into the set Xi that u and v belonged to, and decrease k′ by 1. Since the cost of φ is at most k+1, we contract at most k+1 edges in this way, and hence k′ ≥ −1. When there are no such edges left, then we discard this partition of X into X1 and X2 if k′ = −1; otherwise, we continue to build an instance of Cheap Coloring Extension as follows. Delete all edges uv ∈ S with u ∈ Xi and v ∈ Xj such that i 6= j. Since S contains all the edges of G that are bad with respect to φ, and each of the edges of S is either contracted or deleted, the resulting graph G(X1, X2) has no bad edges with respect to φ and is therefore bipartite. Thus we obtain an instance (G(X1, X2), k′, t, X1, X2) of Cheap Coloring Extension with k′ ≥ 0. We now show that (G, k, φ) is a yes-instance of Cheaper Coloring if and only if there is a partition of X into X1 and X2 such that (G(X1, X2), k′, t, X1, X2) with k′ ≥ 0 is a yes-instance of Cheap Coloring Extension. 6 Suppose that (G, k, φ) is a yes-instance of Cheaper Coloring. Then there exists a 2-coloring φ∗ of G of cost at most k. Let X1 and X2 be the vertices of X that are colored 1 and 2 by φ∗, respectively. Consider the set S ′ ⊆ S of edges that were contracted in order to obtain G(X1, X2) from G in the way described earlier. Since every edge in S ′ is bad with respect to φ∗, the cost of φ∗ decreased by 1 with every edge contraction. Hence, φ∗ is an (X1, X2)-extension of G(X1, X2) of cost k′. We conclude that (G(X1, X2), k′, t, X1, X2) is a yes-instance of Cheap Coloring Extension. For the reverse direction, suppose there is a partition of X into X1 and X2 such that (G(X1, X2), k′, t, X1, X2) is a yes-instance of Cheap Coloring Extension with k′ ≥ 0, i.e., the bipartite graph G(X1, X2) has an (X1, X2)- extension ψ of cost at most k′. Let S ′ ⊆ S be the set of edges that were contracted in G to create the instance (G(X1, X2), k′, t, X1, X2). Since k′ = k − S ′ ≥ 0, we have that S ′ ≤ k. We define a 2-coloring θ of G by coloring both endpoints of every edge uv in S ′ with the color that ψ assigned to the vertex resulting from the contraction of the edge uv, and coloring all other vertices in G with the color they received from ψ. Clearly, the cost of θ is at most k′ + S ′ = k, and therefore (G, k, φ) is a yes-instance of Cheaper Coloring. Since we need to run the f (k, t) nc time algorithm for Cheap Coloring Extension at most 4k+1 times, with parameters k′ ≤ k and t = X ≤ 2k + 2 at each iteration, the time bound follows. ⊓⊔ The next section is devoted to showing that Cheap Coloring Extension is fixed parameter tractable when parameterized by k and t. The reason we want to work with the Cheap Coloring Extension problem rather than with the Bipartite Contraction problem directly is that, as we shall see in Section 4.2, Cheap Coloring Extension is a "cut" problem, and is therefore amenable to techniques based on important separators [16]. 4 Solving Cheap Coloring Extension in FPT time In this section, we present an algorithm for the Cheap Coloring Extension problem. For the remainder of this section, let (G, k, t, T1, T2) be a given instance of Cheap Coloring Extension. Recall that G is bipartite. The high level structure of our algorithm is as follows. If the treewidth of G is bounded by a function of k and t, then we can use standard dynamic programming techniques to solve the problem in time f (k, t) n. If, on the other hand, the treewidth of G is large, then we can find a large set which is "highly connected". In this case we show how to find in f (k, t) nO(1) time an edge e ∈ E(G) such that G has a (T1, T2)-extension of cost at most k if and only if G − e does. We then re-run our algorithm on G − e. To make the distinction between the two cases in our algorithm more precise, we use the following notion, due to Diestel et al. [5]. A set X ⊆ V (G) is p- connected in G if X ≥ p and, for all subsets X1, X2 ⊆ X with X1 = X2 ≤ p, there are X1 vertex-disjoint paths in G with one endpoint in X1 and the other 7 in X2. Diestel et al. [5] prove the following statement in the proof of Proposition 3 (ii): if h ≥ p and G contains no p-connected set of size h, then G has treewidth < h + p − 1. (In fact, they prove a stronger version of this statement using the notion of an externally p-connected set, but we do not need this stronger assertion for our purposes.) We define a set X to be well-connected if it is X/2- connected. Using this definition, the result of Diestel et al. can be seen to imply the following. Theorem 1 ([5]). If tw(G) > w, then G contains a well-connected set of size at least 2w/3. The proof of Theorem 1 is constructive. In fact, given G and w, a tree de- composition of width at most w or a well-connected set of size at least 2w/3 can be computed in time cwnO(1) for some constant c [5]. We use Theorem 1 to compute either a tree-decomposition of G of width at most 3(4k2) t 44k2 + 3 or a well-connected set Y of size at least 2(4k2) t 44k2 + 2. Section 4.1 deals with the first case, whereas the second case is covered in Section 4.2. 4.1 Small treewidth Suppose our algorithm has found a tree-decomposition of G of width at most 3(4k2) t 44k2 + 3. We will use the following celebrated theorem by Courcelle [1] to solve the Cheap Coloring Extension problem in this case. Theorem 2 ([1]). There is an algorithm that tests whether an MSO formula ψ holds on a graph G of treewidth w, in time f (ψ, w) n. We remark that Theorem 2 holds even when the input graph G is supple- mented by unary relations α1, . . . , αp on vertices and edges and the MSO formula ψ is allowed to use these relations [1]. Lemma 4. There is an algorithm that, given an instance (G, k, t, T1, T2) of Cheap Coloring Extension together with a tree-decomposition of G of width w, solves the instance in time f (k, t, w) n. Proof. The Cheap Coloring Extension problem can be formulated in MSO. To see this, we define two unary relations on the vertex set of G: α1(v) is true if v ∈ T1 and α2(v) is true if v ∈ T2. We claim that the following formula holds on G if and only if G has a (T1, T2)-extension of cost at most k. ψ = ∃S1 ⊆ V (G), S2 ⊆ V (G), C ⊆ E(G), e1 ∈ E(G), e2 ∈ E(G), . . . , ek ∈ E(G) : C = {e1, e2, . . . ek} ∧ ∀v ∈ V (G), α1(v) → v ∈ S1 ∧ α2(v) → v ∈ S2 ∧ ∀uv ∈ E(G) (cid:0)(u ∈ S1 ∧ v ∈ S2) ∨ (u ∈ S2 ∧ v ∈ S1) ∨ (∀X1 ⊆ V (G), u /∈ X1 ∨ v ∈ X1 ∨ ∃xy ∈ C (x ∈ X1 ∧ y /∈ X1))(cid:1) The interpretation of ψ is as follows. The sets S1 and S2 are the vertices of G colored 1 and 2, respectively, by a (T1, T2)-extension φ. The edge set C contains 8 all the edges, k in total, of a spanning tree of each monochromatic component of φ. Every edge uv of G is either good (third line of the formula), or bad (fourth line). If uv is a bad edge and uv belongs to C, then we can take xy = uv. Suppose uv is a bad edge and uv /∈ C. Let X be the monochromatic component of φ such that G[X] contains uv, and let X1 be any subset of V (G) containing u but not v. Since C contains all the edges of a spanning tree of G[X], there exists a path P in G[X] from u to v, using only edges of C. Hence we can take xy to be the first edge of P that has one endpoint (x) in X1 and the other endpoint (y) in V (G) \ X1. Note that, for simplicity, we took some liberties in the formulation of the MSO formula. For example, C = {e1, e2, . . . ek} is not really an MSO formulation, but it can easily be translated into MSO by demanding that every edge ei ∈ C and that any edge in C must be one out of e1, e2, . . . ek. Similarly, operators such as → can be reformulated using the ∧, ∨, and ¬ operators. Applying Theorem 2 ⊓⊔ to this formulation completes the proof of the lemma. We would like to remark that, given an instance (G, k, t, T1, T2) of Cheap Coloring Extension together with a tree-decomposition of G of width w, it is possible to solve that instance in time (w+1)O(w)n, using standard dynamic pro- gramming techniques. This gives a much faster algorithm than the one obtained by applying Theorem 2 on the MSO formula. However, it would take several pages to give the details of such an algorithm, and for the main purpose of this paper, we find it sufficient to handle the case of small treewidth by Lemma 4. 4.2 Large treewidth and irrelevant edges Suppose our algorithm did not find a tree-decomposition of G of small width, but instead found a well-connected set Y of size at least 2(4k2) t 44k2 + 2. We use Y throughout this section to refer to this specific set. An edge e ∈ E(G) is said to be irrelevant if it satisfies the following property: G has a (T1, T2)-extension of cost at most k if and only if G − e does. We will show that the presence of the large well-connected set Y guarantees the presence of an irrelevant edge e in G. Hence we find such an irrelevant edge e in G, delete it from the graph, and solve Cheap Coloring Extension on the instance (G − e, k, t, T1, T2). Since each iteration of this process deletes an edge, we will find a tree-decomposition of the graph under consideration of small width after at most m iterations, in which case we solve the problem as described in Section 4.1. Observation 3 below gives a hint about how we are going to identify an irrelevant edge of G. We first need a basic observation about bad edges. Observation 2 Let φ be a 2-coloring of G. No bad edge has both endpoints in the same good component of φ. Proof. Suppose, for contradiction, that G has a bad edge uv such that both u and v belong to a good component C of φ. Since uv is bad, we have φ(u) = φ(v). Every good component is connected, so there is a path P in C, starting in u and 9 ending in v, consisting only of good edges. The path P must contain an even number of edges, implying that P and uv together form an odd cycle in G. This contradicts the assumption that G, which is part of the instance (G, k, t, T1, T2) of Cheap Coloring Extension that we are solving, is bipartite. ⊓⊔ Observation 3 Let uv ∈ E(G). If φ is a cheapest (T1, T2)-extension of G − uv and u and v are in the same good component of φ, then uv is irrelevant. Proof. Suppose u and v belong to the same good component of a cheapest (T1, T2)-extension φ of G − uv. Note that φ is a 2-coloring of G, and that the edge uv in G is good with respect to φ as a result of Observation 2. Hence φ is a (T1, T2)-extension of G, and the cost of φ in G equals the cost of φ in G − uv. As a result of Observation 1, φ must be cheapest (T1, T2)-extension of G. Since the cost of a cheapest (T1, T2)-extension of G − uv equals the cost of a cheapest (T1, T2)-extension of G, the edge uv is irrelevant by definition. ⊓⊔ In order to use Observation 3, we need to identify vertices that will end up in the same good component of some cheapest (T1, T2)-extension of G − uv. The vertices in Y are good candidates, because they are so highly connected to each other. Over the next few lemmas we formalize this intuition. We start with two observations that will allow us, in the proof of Lemma 5 below, to bound the number of bad edges and the number of good components of a cheapest (T1, T2)-extension of G of cost at most k. Observation 4 Let φ be a 2-coloring of G. If φ has cost at most k, then there are less than 2k2 bad edges. φ = {X ∈ Mφ : Proof. Let M′ X ≥ 2} be the set of monochromatic compo- nents of φ containing more than one vertex, and let G′ be the disjoint union of the graphs induced in G by the elements of M′ G[X]. By definition, the cost of φ is PX ∈Mφ (X−1), which is exactly the number of edges in any spanning forest of G′. Since any forest on at most k edges without isolated vertices has at most 2k vertices, we have V (G′) ≤ 2k. Every bad edge has both endpoints in V (G′), so the number of bad edges is at most (cid:0)2k ⊓⊔ φ, i.e., G′ = SX ∈M′ 2 (cid:1) < 2k2. (X−1) = PX ∈M′ φ φ Observation 5 Let φ be a cheapest (T1, T2)-extension of G. Every good compo- nent of φ contains a vertex from T1 ∪ T2. Proof. Suppose a good component C of φ does not contain any vertex from T1 ∪ T2. We build a coloring φ′ from φ by changing the color of every vertex in C, leaving the color of every other vertex unchanged, i.e., φ′(v) = 3 − φ(v) if v ∈ C, and φ′(v) = φ(v) if v /∈ C. Since φ(v) = φ′(v) for every v ∈ T1 ∪ T2, φ′ is a (T1, T2)-extension of G. Furthermore, every edge that was good with respect to φ is good with respect to φ′, while every edge in δG(C) was bad with respect to φ and is good with respect to φ′. Since G is connected, there is some vertex v ∈ C which is incident to at least one edge that was bad with respect to φ. On 10 the other hand, all edges incident to v are good with respect to φ′. Hence {v} is a monochromatic component of φ′, but {v} was not a monochromatic component of φ. This means that Mφ < Mφ′. This, together with the observation that the number of edges that are bad with respect to φ′ is not more than the number of edges that were bad with respect to φ, implies that the cost of φ′ is strictly less than the cost of φ. This contradicts the assumption that φ is a cheapest ⊓⊔ (T1, T2)-extension of G. The next lemma shows that almost all the vertices of Y appear in the same good component of any cheapest (T1, T2)-extension φ of G of cost at most k. Lemma 5. Let uv ∈ E(G), and let φ be a cheapest (T1, T2)-extension of G − uv of cost at most k. There exists exactly one good component C ∗ of φ satisfying Y \ C ∗ ≤ 2k2, and every other good component C ′ of φ satisfies Y ∩ C ′ ≤ 2k2. Proof. Let C be a good component of φ. We first show that either Y \C ≤ 2k2 or Y ∩ C ≤ 2k2. Suppose for contradiction that Y ∩ C > 2k2 and Y \ C > 2k2. We define Y1 to be the smallest of the two sets Y ∩ C and Y \ C, and Y2 to be any subset of the largest of the two sets such that Y2 = Y1. Note that 2k2 + 1 ≤ Y1 = Y2 ≤ Y /2. By the definition of a well-connected set, there are Y1 ≥ 2k2 + 1 vertex-disjoint paths with one endpoint in Y ∩C and the other in Y \ C. At least 2k2 of these paths exist in G − uv, and each of those must contain an edge in δG−uv(C). Since each edge in δG−uv(C) is bad, it follows that φ has at least 2k2 bad edges, contradicting Observation 4. Now suppose for contradiction that φ does not have a good component C ∗ with Y \ C ∗ ≤ 2k2. Then Y ∩ C ≤ 2k2 for every good component C of φ, as we showed earlier. Since φ has at most t = T1 + T2 good components as a result of Observation 5, at most t 2k2 vertices of Y appear in good components. The fact that the size of Y is much larger than t 2k2, together with the observation that every vertex of G appears in a good component by definition, yields the desired contradiction. Hence we know that φ has a good component C ∗ with Y \ C ∗ ≤ 2k2. The uniqueness of C ∗ follows from the sizes of Y and C ∗, and the fact that the good components of φ are pairwise disjoint. ⊓⊔ There are two problems with how to exploit the knowledge obtained from Lemma 5. The first is that, even though we know that almost all the vertices of Y appear in the same good component together, we do not know exactly which ones do. The second problem is that we are looking for an edge with both endpoints in the same good component, and Y could be an independent set and thus not immediately give us an edge to delete. We deal with both problems by employing the very useful notion of important sets. For two vertices x, y ∈ V (G), we say that a set X ⊆ V (G) is (x, y)-important if it satisfies the following three properties: (1) x ∈ X and y /∈ X; (2) G[X] is connected; and (3) there is no X ′ ⊃ X, y 6∈ X ′ such that dG(X ′) ≤ dG(X) and G[X ′] is connected. The following theorem was first proved in [2]. We use here the formulation in [15], because that one best fits the purposes of this paper. 11 Theorem 3 ([2, 15]). Let x, y be two vertices in a graph G. For every p ≥ 0, there are at most 4p (x, y)-important sets X such that dG(X) ≤ p. Furthermore, these important sets can be enumerated in time 4p · nO(1). Suppose G− uv has a cheapest (T1, T2)-extension φ of cost at most k. We will use the important sets together with Lemma 5 to identify vertices in Y which must be in the unique good component C ∗ of φ that contains all but at most 2k2 vertices of Y . We first build a graph G∗ from G by adding a new vertex y∗ and making y∗ adjacent to all vertices in Y . We then enumerate all x ∈ T1 ∪ T2 and all (x, y∗)-important sets X in G∗ such that dG∗ (X) ≤ 4k2. By Theorem 3, this can be done in time 44k2 nO(1) for each choice of x. Finally, we define the set Z to be the union of all enumerated sets X. In other words, Z = {w ∈ V (G∗) : ∃x ∈ T1 ∪ T2, X ⊆ V (G∗), w ∈ X, dG∗(X) ≤ 4k2 and X is (x, y∗)-important} Observe that, given G and Y , Z can be computed in time t 44k2 nO(1). We will use the set Z in the following way. First we show that if there is an edge uv ∈ E(G) such that neither u nor v are in Z, then the edge uv is irrelevant. Then we show that such an edge always exists. Lemma 6. Let uv ∈ E(G) such that u /∈ Z and v /∈ Z. Then uv is irrelevant. Proof. Let φ be a cheapest (T1, T2)-extension of G − uv with cost at most k. Let C ∗ be a good component of φ such that Y \ C ∗ ≤ 2k2. By Lemma 5, such a component C ∗ exists, and every other good component C of φ satisfies Y ∩ C ≤ 2k2. We prove that both u and v are in C ∗. Suppose u /∈ C ∗. Then u ∈ C for some other good component of φ. Now, C induces a connected subgraph in G − uv, and all edges leaving C in G − uv are bad with respect to φ. Since φ has less than 2k2 bad edges by Observation 4, it follows that dG−uv(C) < 2k2, and thus dG(C) ≤ 2k2. Furthermore, because Y ∩ C ≤ 2k2, we have that dG∗ (C) ≤ 4k2. Finally, by Observation 5, C must contain a vertex x ∈ T1 ∪ T2. Hence there must be a (x, y∗)-important set X such that C ⊆ X and d(X) ≤ 4k2 in G∗. But C ⊆ X ⊆ Z, which implies that u ∈ Z, contradicting the assumption that u /∈ Z. The proof that v ∈ C ∗ is identical. We conclude that both u and v are in C ∗, and hence, by Observation 3, uv is irrelevant. ⊓⊔ Lemma 7. G contains an edge uv such that u /∈ Z and v /∈ Z. and Z ∩ Y ≤ (4k2) t 44k2 Proof. We first prove that dG(Z) ≤ (4k2) t 44k2 . For the first inequality, it suffices to show that dG∗ (Z) ≤ (4k2) t 44k2 , because G is a subgraph of G∗. However, Z is the union of at most t 44k2 important sets X, where dG∗ (X) ≤ 4k2 for each set. Hence the first inequality follows. To see that Z ∩ Y ≤ (4k2) t 44k2 , observe that each (x, y∗)-important set X in G∗ with dG∗ (X) ≤ 4k2 contains at most 4k2 vertices of Y , since each vertex in Y is a neighbour of y∗. 12 In order to prove that G contains an edge uv with u /∈ Z and v /∈ Z, we arbitrarily partition Y into Y1 and Y2 such that Y1 = Y2 and Z ∩Y ⊆ Y2. Since Y ≥ 2(4k2) t 44k2 + 2 by assumption and we showed that Z ∩ Y ≤ (4k2) t 44k2 , such a partition always exists. By the definition of a well-connected set, there are Y1 = (4k2) t 44k2 + 1 vertex-disjoint paths starting in Y1 and ending Y2. For every i ≤ Y1, let uivi be the first edge on the ith such path, with ui ∈ Y1. Recall that Z ∩ Y ⊆ Y2 by assumption. Since all of the ui's are in Y1, none of them are in Z. Thus, each vi that belongs to Z contributes one to dG(Z), as then uivi ∈ δG(Z). Since we bounded dG(Z) from above by (4k2) t 44k2 at the start of this proof, not every vi can belong to Z. Hence there is an edge uivi ⊓⊔ with neither endpoint in Z. We are now ready to state the main lemma of this section. Lemma 8. Cheap Coloring Extension can be solved in time f (k, t) nO(1). Proof. Let (G, k, t, T1, T2) be an instance of Cheap Coloring Extension, and let f be an appropriate function that does not depend on n. We first apply Theo- rem 1 and the remark immediately following it to compute, in time f (k, t) nO(1), either a tree-decomposition of G of width at most 3(4k2) t 44k2 + 3 or a well- connected set Y of size at least 2(4k2) t 44k2 + 2. If we get a tree-decomposition of small width, we apply Lemma 4 to solve the problem in additional time f (k, t) n, after which we terminate and output the answer. If we find a well- connected set Y , we continue to find an irrelevant edge e ∈ E(G) and delete it from G. Lemmas 6 and 7 guarantee that such an edge always exists. In order to find e, we first compute the set Z. We already argued that this can be done in time f (k, t) nO(1). We can find an irrelevant edge as explained in the proof of Lemma 7 in additional polynomial time, since this amounts to computing Z ∩ Y , choosing Y2 to contain the whole intersection and as many more ver- tices as needed to obtain Y1 = Y2, and checking all edges leaving Y1 to find one whose endpoints do not belong to Z. The total running time of this whole procedure is clearly f (k, t) nO(1). After an irrelevant edge e is deleted from G, we run the whole procedure on (G − e, k, t, T1, T2). This can be repeated at most E(G) = nO(1) times, and hence the total running time f (k, t) nO(1) follows. ⊓⊔ Our main result immediately follows from Lemmas 1, 2, 3, and 8. Theorem 4. Bipartite Contraction is fixed parameter tractable when pa- rameterized by k. We end this section with a remark on the running time. If we use Lemma 4 in the proof of Lemma 8, then the parameter dependence of the whole algorithm is dominated by a very large function in k [1]. However, as we remarked after Lemma 4, we can obtain a running time of (4O(k2))4O(k2 ) n for the small treewidth case of the proof of Lemma 8. This is because the treewidth of the instance at hand is 44k2 kO(1) = 44k2O(log k) = 4O(k2) when the small treewidth case applies. This gives a total running time of of 22O(k2 ) nO(1) for our algorithm for Bipartite Contraction. n = 22O(k2 ) 13 5 Concluding remarks For completeness, we would like to mention that Bipartite Contraction is NP-complete; a polynomial time reduction from Edge Bipartization can be obtained by replacing every edge of the input graph by a path of sufficiently large odd length. A highly relevant question is whether Bipartite Contraction admits a polynomial kernel, meaning that there is a polynomial time algorithm that transforms an instance (G, k) to an instance (G′, k′) of size g(k), where g is a polynomial in k. The mentioned NP-completeness reduction from Edge Bipartization is parameter preserving, as k remains the same. However, it is not known whether or not Edge Bipartization admits a polynomial kernel. References 1. B. Courcelle. The monadic second-order logic of graphs. I. Recognizable sets of finite graphs. Information and Computation, 85:12 -- 75, 1990. 2. J. Chen, Y. Liu, and S. Lu. An improved parameterized algorithm for the minimum node multiway cut problem. In Proceedings WADS 2007, 495 -- 506, 2007. 3. J. Chen, Y. Liu, S. Lu, B. O'Sullivan, and I. Razgon. A fixed-parameter algorithm for the directed feedback vertex set problem. J. ACM, 55(5), 2008. 4. E. Demaine, M. Hajiaghayi and K. Kawarabayashi. Decomposition, approximation, and coloring of odd-minor-free graphs, In Proceedings SODA 2010, 329 -- 344, 2010. 5. R. Diestel, K. Yu. Gorbunov, T. R. Jensen and C. Thomassen. Highly connected sets and the excluded grid theorem, J. Comb. Theory, Series B, 75, 61 -- 73, 1999. 6. R. G. Downey and M. R. Fellows. Parameterized complexity. Monographs in Com- puter Science, Springer-Verlag, 1999. 7. J. Guo, J. Gramm, F. Huffner, R. Niedermeier, and S. Wernicke. Compression- based fixed-parameter algorithms for feedback vertex set and edge bipartization. J. Comp. Sys. Sci., 72:1386 -- 1396, 2006. 8. F. Huffner. Algorithm engineering for optimal graph bipartization. Journal of Graph Algorithms and Applications, 13(2):77 -- 98, 2009. 9. R.M. Karp. Reducibility among combinatorial problems. In Complexity of Com- puter Computations, 85 -- 103, Plenum Press, New York, 1972. 10. K. Kawarabayashi. Planarity Allowing Few Error Vertices in Linear Time. In Proceedings FOCS 2009, 639 -- 648, 2009. 11. K. Kawarabayashi. An improved algorithm for finding cycles through elements. In Proceedings IPCO 2008, Lecture Notes in Computer Science, 5035:374 -- 384, Springer, 2008. 12. K. Kawarabayashi and B. A. Reed. An (almost) linear time algorithm for odd cycles transversal. In Proceedings SODA 2010, 365 -- 378, ACM-SIAM, 2010. 13. K. Kawarabayashi and B. A. Reed. Odd cycle packing. In Proceedings STOC 2010, 695 -- 704, ACM, 2010. 14. K. Kawarabayashi and P. Wollan. A shorter proof of the graph minor algorithm: the unique linkage theorem. In Proceedings STOC 2010, 687 -- 694, ACM, 2010. 15. D. Lokshtanov and D. Marx Clustering with Local Restrictions. Manuscript. 2011 16. D. Marx. Parameterized graph separation problems. Theoretical Computer Science, 351(3):394 -- 406, 2006. 14 17. D. Marx and I. Razgon. Fixed-parameter tractability of multicut parameterized by the size of the cutset. In Proceedings of STOC 2011, to appear. Manuscript available as CoRR abs/1010.3633. 18. R. Niedermeier. Invitation to Fixed-Parameter Algorithms. Oxford University Press, 2006. 19. I. Razgon and B. O'Sullivan. Almost 2-sat is fixed-parameter tractable (extended abstract). In Proceedings ICALP (1) 2008, 551 -- 562, 2008. 20. B. Reed, K. Smith, and A. Vetta. Finding odd cycle transversals. Oper. Res. Lett., 32: 299 -- 301, 2004. 21. R. Rizzi, V. Bafna, S. Istrail, G. Lancia. Practical algorithms and fixed parameter In Proceedings tractability for the single individual SNP haplotyping problem. WABI 2002, Lecture Notes in Computer Science, 2452:29 -- 43, Springer, 2002. 22. N. Robertson and P. D. Seymour. Graph minors. XIII. The disjoint paths problem. J. Comb. Theory, Ser. B, 63:65 -- 110, 1995. 23. N. Robertson and P. D. Seymour. Graph Minors. XXII. Irrelevant vertices in linkage problems. Submitted. 24. S. Wernicke. On the algorithmic tractability of single nucleotide polymorphism (SNP) analysis and related problems. Diplomarbeit, WSI fur Informatik, Univer- sitat Tubingen, 2003. 15
1209.4623
1
1209
2012-09-20T19:18:53
Counting inequivalent monotone Boolean functions
[ "cs.DS", "math.CO" ]
Monotone Boolean functions (MBFs) are Boolean functions $f: {0,1}^n \rightarrow {0,1}$ satisfying the monotonicity condition $x \leq y \Rightarrow f(x) \leq f(y)$ for any $x,y \in {0,1}^n$. The number of MBFs in n variables is known as the $n$th Dedekind number. It is a longstanding computational challenge to determine these numbers exactly - these values are only known for $n$ at most 8. Two monotone Boolean functions are inequivalent if one can be obtained from the other by renaming the variables. The number of inequivalent MBFs in $n$ variables was known only for up to $n = 6$. In this paper we propose a strategy to count inequivalent MBF's by breaking the calculation into parts based on the profiles of these functions. As a result we are able to compute the number of inequivalent MBFs in 7 variables. The number obtained is 490013148.
cs.DS
cs
COUNTING INEQUIVALENT MONOTONE BOOLEAN FUNCTIONS TAMON STEPHEN AND TIMOTHY YUSUN Abstract. Monotone Boolean functions (MBFs) are Boolean functions f : {0, 1}n → {0, 1} satisfying the monotonicity condition x ≤ y ⇒ f (x) ≤ f (y) for any x, y ∈ {0, 1}n. The number of MBFs in n variables is known as the nth Dedekind number. It is a longstanding compu- tational challenge to determine these numbers exactly – these values are only known for n at most 8. Two monotone Boolean functions are inequivalent if one can be obtained from the other by renaming the vari- ables. The number of inequivalent MBFs in n variables was known only for up to n = 6. In this paper we propose a strategy to count inequiva- lent MBF's by breaking the calculation into parts based on the profiles of these functions. As a result we are able to compute the number of inequivalent MBFs in 7 variables. The number obtained is 490013148. 1. Introduction A Boolean function on n variables (BF) is a function f : {0, 1}n → {0, 1}. A monotone Boolean function (MBF) additionally satisfies the condition x ≤ y ⇒ f (x) ≤ f (y), for any x, y ∈ {0, 1}n. We write x ≤ y if xi ≤ yi for all i = 1, 2, . . . , n, and x < y if x ≤ y and xi < yi for some i. A BF is monotone if and only if it can be written as a combination of conjunctions and disjunctions only. Since each input state in {0, 1}n has two possible output states, there are a total of 22n Boolean functions on n variables. On the other hand, no exact closed form is known for the number of monotone Boolean functions on n variables. This number is usually denoted by D(n), which is also called the nth Dedekind number. These numbers are named after Richard Dedekind who defined them in [Ded97]. The first few values are given in Table 1, taken from [Slo11]. Currently, only values of D(n) up to n = 8 are known. Kisielewicz gives in [Kis88] a logical summation formula for D(n), however performing the computation using his summation has the same complexity as brute force enumeration of D(n). (See [Kor03], e.g.) There are some asymptotic results concerning the behavior of D(n), one of the earliest of which was a result of Kleitman in 1969, that log2 D(n) ∼ (cid:0) n(cid:98)n/2(cid:99) (cid:1) [Kle69]. So far, the most accurate one is given by Korshunov in [Kor03], given in Table 2. 2010 Mathematics Subject Classification. Primary 68W05; Secondary 06E30, 05A05. Key words and phrases. Boolean functions, Dedekind numbers. 1 2 TAMON STEPHEN AND TIMOTHY YUSUN n 0 1 2 3 4 5 6 7 D(n) 2 3 6 20 168 7 581 7 828 354 2 414 682 040 998 8 56 130 437 228 687 557 907 788 Source Dedekind, 1897 Church, 1940 [Chu40] Ward, 1946 [War46] Church, 1965 [Chu65] (see also [BK76]) Wiedemann, 1991 [Wie91] (see also [FMSS01]) Table 1. Known Values of D(n), A000372 n 2 −1 (cid:1)(cid:0)2−n/2 + n22−n−5 − n2−n−4(cid:1)(cid:105) (cid:104)(cid:0) n (cid:104)(cid:0) n (cid:1)(cid:0)2(−n−1)/2 − n22−n−4(cid:1)(cid:105) (cid:1)(cid:0)2(−n−3)/2 − n22−n−5 − n2−n−3(cid:1) , for odd n n−3 2 , for even n D(n) ∼ 2( n n/2) · exp D(n) ∼ 2( (n−1)/2)+1 · exp n +(cid:0) n n−1 2 Table 2. Korshunov's Asymptotics 1.1. Inequivalent MBFs. We define an MBF f to be equivalent to another MBF g if g can be obtained from f by a renaming of the variables. For example, the function f (x1, x2, x3) = (x1 ∧ x2) ∨ (x2 ∧ x3) is equivalent to g(x1, x2, x3) = (x1 ∧ x2) ∨ (x1 ∧ x3), since interchanging x1 and x2 sends f to g. We write this as f ∼ g. For brevity, from here on we write xi ∧ xj as xixj. Let R(n) be the number of equivalence classes defined by "∼" among monotone Boolean functions on n variables. As with D(n), no closed form is known for R(n), and in fact only the values up to n = 6 have been computed. These appear to have been obtained by the straightforward method of listing all monotone Boolean functions on n variables and then sorting them into equivalence classes. The known values from [Slo11] are shown in Table 3. Example 1.1. The five functions in R(2) are: f = 0, f = 1, f = x1, f = x1∨x2, and f = x1x2. The functions in D(2) are exactly these functions plus f = x2, which is equivalent to f = x1. COUNTING INEQUIVALENT MONOTONE BOOLEAN FUNCTIONS 3 R(n) n 2 0 3 1 5 2 10 3 30 4 5 210 6 16 353 Table 3. Known Values of R(n), A003182 1.2. Terminology and Elementary Facts. Define a minimal term of an MBF f to be an input x ∈ {0, 1}n such that f (x) = 1 and f (y) = 0 if y < x. The minimal terms of a monotone Boolean function represent the "smallest" sets where the function equals one – any input below x evaluates to zero, and everything above evaluates to one by virtue of monotonicity. For example, the function f (x1, x2, x3) = x1 ∨ x2x3 evaluates to one at (1, 0, 0) and (0, 1, 1), as well as at all vectors above (1, 0, 0) and (0, 1, 1), and evaluates to 0 at all other vectors. Indeed, each MBF can be written as a disjunction of clauses, each representing one of its minimal terms. MBFs can be classified according to the number of minimal terms they have. Call Dk(n) the number of monotone Boolean functions on n variables with k minimal terms. Kilibarda and Jovovic [KJ03] derive closed form expressions for Dk(n) for fixed k = 4, 5, . . . , 10, these sequences are sequences A051112 to A051118 of [Slo11]. A truth table for a Boolean function is a row of zeros and ones which encodes the outputs of the function corresponding to every possible input state. To illustrate, the function on three variables f (x1, x2, x3) = x1 ∨ x2x3 has minimal terms {{1},{2, 3}}, and it has the following truth table: variables set to 1 x1, x2, x3 x2, x3 x1, x3 x3 x1, x2 x2 x1 none output states Table 4. Truth table for the function f (x1, x2, x3) = x1 ∨ x2x3 1 1 0 1 0 1 0 1 Note that the input states on the top row are arranged in a reverse colex- icographic (or colex ) order on {0, 1}3, defined as x < y if x (cid:54)= y and xk < yk where k = max{i : xi (cid:54)= yi}. Fixing this order, we write f as 11101010. In general, any Boolean function on n variables can be written as a 0-1 string of length 2n where each entry corresponds to an input state; we use this convention throughout this paper. The choice for the ordering has the nice property that the first 2n−1 of its entries all involve setting the variable xn to 1, and the second half has inputs with xn = 0. 4 TAMON STEPHEN AND TIMOTHY YUSUN The truth table form is the most compact way to represent general Boolean functions. For monotone Boolean functions, both the truth table and the minimal terms representation are useful for our purposes. Example 1.2. The colexicographic order for two variables is {1, 2} > {2} > {1} > {}. The functions in D(2), written in truth table form are {1111, 1110, 1100, 1010, 1000, 0000}. 1.3. Motivation. Monotone Boolean functions are interesting because many mathematical objects can be represented by MBFs. For instance, there is a one-to-one correspondence between MBFs in D(n) and antichains in the set 2[n], that is, pairwise incomparable subsets of the power set of {1, 2, . . . , n}. Specifically, the set of minimal terms of an MBF in D(n) is an antichain in 2[n]. Since by Sperner's Theorem, any antichain on the n-set can have at (cid:1) elements, we have that any n-variable MBF can have at most most(cid:0) n(cid:98)n/2(cid:99) (cid:0) n(cid:98)n/2(cid:99) (cid:1) minimal terms. The one-to-one correspondence between n-variable MBFs and Sperner hypergraphs is also well-known. In particular, each minimal term of an MBF maps to a hyperedge in the corresponding hypergraph, and because of pairwise incomparability, the hypergraph thus exhibits the Sperner property, that is, no hyperedge contains another. Some other fields in which monotone Boolean functions appear include lattice theory [SSGC95], nonlinear signal processing [SSGC95], coding the- ory [IKN07], computational learning theory [Shm], game theory [RP11], and computational biology ([KG04],[HKS08]). For a comprehensive discussion of Boolean functions, see the recently- published book by Crama and Hammer [CH11]. 2. Computational Strategies 2.1. Profiles of MBFs. It is natural to refine the classification of monotone Boolean functions by number of minimal terms, and consider how many elements are contained in each of these terms. We define the notion of a profile formally as given in [Eng97], and introduce some notation: Definition 2.1 (Profile of an MBF). Given an n-variable MBF f where f (cid:54)≡ 1, the profile of f is a vector of length n (a1, a2, . . . , an), where the ith entry is equal to the number of minimal terms of f which are i-sets. Example 2.2. The MBF 11111100 has minimal terms {2},{3}, and profile (2, 0, 0), while the MBF 11111000 has minimal terms {1, 2}, {3}, and profile (1, 1, 0). Definition 2.3. Given profile vector (a1, a2, . . . , an), define (a1, a2, . . . , an)D to be the number of monotone Boolean functions on n variables with pro- file vector (a1, a2, . . . , an). Similarly define (a1, a2, . . . , an)R for inequivalent monotone Boolean functions on n variables. COUNTING INEQUIVALENT MONOTONE BOOLEAN FUNCTIONS 5 Note that the number of variables n is implicit in the profile vector – it is just the length of the vector. Some relations between the profiles are described and proven in Lemma 2.4. Lemma 2.4. Assume that all profile vectors pertain to MBFs on n variables, unless otherwise stated. (A): (0, 0, . . . , ai, . . . , 0)D = (0, 0, . . . ,(cid:0)n (cid:1) − ai, . . . , 0)D. i (B): If a1 > 0, then an = 0 and (a1, a2, . . . , an−1, an)D = (a1 − 1, a2, . . . , an−1)Dn−1. (C): (a1, a2, . . . , an−2, an−1, an)D = (an−1, an−2, . . . , a2, a1, an)D. All these statements hold true when D is replaced by R. i Proof. The proof of each claim rests on the fact that there is a one-to- one correspondence between functions of the first type and functions of the second type, for the purposes of counting both D(n) and R(n). another MBF with minimal terms exactly the (cid:0)n (cid:1) − ai i-sets which were (A): Given an MBF with exactly ai i-sets as minimal terms, we can derive not taken in the first MBF. Furthermore, the images of any two equivalent functions under this correspondence will also be equivalent, under the same permutation. (B): If an n-variable MBF has a singleton set, say {n}, as a minimal term, then we know that the rest of its minimal terms cannot contain the element n. Hence an = 0. In addition, removing the term {n}, we are left with an (n − 1)-variable MBF, with the profile (a1 − 1, a2, . . . , an−1). (C): If an = 1, then {1, 2, . . . , n} is the only minimal term. This implies that all the other ai's are zero, and hence the claim follows trivially. If an = 0, assume that the minimal terms of an MBF f with the given profile are A1, A2, . . . , Ak. We know that none of the Ai's are comparable, so it should follow that none of the sets [n] − A1, [n] − A2, . . . , [n] − Ak must be comparable as well. Hence the collection {[n] − Aj}1≤j≤k is the set of minimal terms of an MBF g where the number of i-sets is equal to the number of (n − i)-sets in f . This proves that the profile of g is (cid:3) (an−1, an−2, . . . , a2, a1, an). Lemma 2.4 is very useful in reducing the amount of computation that needs to be done to compute D(n) or R(n). For instance, when counting R(7), instead of counting all (0, 0, k, 0, 0, 0, 0) for k = 1 to 35, we count the profiles up to k = 17. Part (B) enables us to refer back to R(6) when considering profiles with a nonzero entry in the first position. The most useful is (C), which effectively cuts all computation time in half. 2.1.1. Generating Profiles. Sequence A007695 on the OEIS gives the number of profile vectors for any n, and also outlines an algorithm that can be used to compute this number [Slo11]. We modify this algorithm to actually output the profiles that are being counted. We present this algorithm as Algorithm 1. 6 TAMON STEPHEN AND TIMOTHY YUSUN Algorithm 1: Generating all profiles of MBFs on n variables. Input: n Output: P (n), the list of profiles of MBFs on n variables initialize C := zeros n + 1,(cid:0) n(cid:98)n/2(cid:99) (cid:1) + 1 ; (cid:16) (cid:17) 10 16 18 26 28 K := C, C(0, 0) = 1, C(0, 1) = 1, s = 2 ; initialize P (n) := zeros (n + 1, n) ; set the first column of P (n) to the vector [0 1 2 ··· n]T ; total := n + 1 ; for r = 1 to n do d ← s, k ← r, j ← 0, s ← 0 ; xmax =(cid:0)n (cid:1) ; if x ≥(cid:0)k r (cid:1) then r k ← k + 1 ; for x = 0 to xmax do end if x = 0 then else K(r, x) = 0; K(r, x) = K(r − 1, x −(cid:0)k−1 r (cid:1)) +(cid:0)k−1 (cid:1) ; r−1 end while j < K(r, x) do d ← d − C(r − 1, j) ; j ← j + 1 ; end C(r, x) = d; s ← s + d; end if r (cid:54)= 1 then recent = last C(r, 0) − C(r − 1, 0) rows of P (n) ; for x = 1 to xmax do candidates = rows of recent with (r − 1)-st entry at least K(r, x). ; Subtract K(r, x) from the (r − 1)-st column of candidates ; Add x to the r-th column of candidates ; Append candidates to P (n) ; Update total ← total + size(candidates). ; end end end Output P (n). ; COUNTING INEQUIVALENT MONOTONE BOOLEAN FUNCTIONS 7 Algorithm 1 uses a dynamic programming strategy, where the matrix K(r, x) is built up from the previous values K(r− 1, x). In fact, the (r, x)-th entry of the matrix K is a strict lower bound on the number of (r − 1)-sets that any family of x r-sets can contain. We use this information to generate the list of profiles P (n). We prove these facts in Section 4. Using the algorithm, we can compute the number of profiles of MBFs on n variables, which is one less than Sequence A007695 on the OEIS, to account for the all-ones function. We show this in Table 5. n Number of profiles n Number of profiles 0 1 2 3 4 95 552 5460 100708 3718353 1 2 4 9 25 5 6 7 8 9 Table 5. Number of profiles for each n, from n = 0 to n = 9. 2.1.2. Using Profiles to Generate Functions. A monotone Boolean function can be written uniquely as the disjunction of its minimal terms. Thus we can generate all MBFs inductively beginning with profiles that have a single non-zero entry. These have a simple structure - each consists of k subsets of size i, where i is the index of the non-zero entry and k is the value of that entry. Suppose now there is a second non-zero entry with index j. If that entry is 1, we can generate all functions for this profile by taking disjunctions between the functions in the first profile and all j-sets which are incomparable to each of them. If the jth entry is larger than 1, we just repeat the same steps until we generate the desired list of functions. Hence a typical computation might start with the profile (0, 7, 0, 0, 0, 0, 0) and continue on to (0, 7, 1, 0, 0, 0, 0), (0, 7, 2, 0, 0, 0, 0), etc. These lists are then in turn used as starting points for profiles with three non-zero terms, and so on. Since we are computing inequivalent MBFs, we eliminate equivalent func- tions after each profile is generated. To do this we generate for each function obtained all 5040 equivalent functions, and take the "least representative," by which we mean the lexicographically smallest function. This can be imple- mented quickly by keeping only the least representative as each permutation of the original MBF is generated. With the goal of enumerating R(7), we use Lemma 2.4 to eliminate profiles we do not have to compute. However, we have to compute some profiles more than once, as some profiles whose R-value can be obtained by symmetry are used as intermediate steps to compute other profiles. More details of the computation can be found in Section 3. The largest profile for R(7) computed is that of (0, 0, 7, 7, 0, 0, 0), having 5443511 functions. For further illustration, we give in Table 6 the list of 8 TAMON STEPHEN AND TIMOTHY YUSUN profiles in R(5) and the number of functions in each one. Note the list does not include the all-ones function, which does not have a corresponding profile (by Definition 2.1). Profile Profile Profile # 1 1 1 1 1 1 2 1 3 1 2 1 1 1 1 1 1 1 1 1 1 1 1 # 1 (0,0,0,0,0) 6 (1,0,0,0,0) 6 (2,0,0,0,0) 4 (3,0,0,0,0) 1 (4,0,0,0,0) 6 (5,0,0,0,0) 1 (0,1,0,0,0) 6 (1,1,0,0,0) 4 (2,1,0,0,0) 1 (3,1,0,0,0) 1 (0,2,0,0,0) 6 (1,2,0,0,0) 4 (2,2,0,0,0) 1 (0,3,0,0,0) 6 (1,3,0,0,0) 2 (2,3,0,0,0) 4 (0,4,0,0,0) 1 (1,4,0,0,0) 2 (0,5,0,0,0) 1 (1,5,0,0,0) 1 (0,6,0,0,0) 1 (1,6,0,0,0) 1 (0,7,0,0,0) (0,8,0,0,0) 1 TOTAL 209 Table 6. Number of inequivalent five-variable MBFs by profile. (1,0,3,0,0) (0,1,3,0,0) (0,2,3,0,0) (0,3,3,0,0) (0,4,3,0,0) (0,0,4,0,0) (1,0,4,0,0) (0,1,4,0,0) (0,2,4,0,0) (0,3,4,0,0) (0,4,4,0,0) (0,0,5,0,0) (0,1,5,0,0) (0,2,5,0,0) (0,0,6,0,0) (0,1,6,0,0) (0,0,7,0,0) (0,1,7,0,0) (0,0,8,0,0) (0,0,9,0,0) (0,0,10,0,0) (0,0,0,1,0) (1,0,0,1,0) (0,1,0,1,0) (0,9,0,0,0) (0,10,0,0,0) (0,0,1,0,0) (1,0,1,0,0) (2,0,1,0,0) (0,1,1,0,0) (1,1,1,0,0) (0,2,1,0,0) (1,2,1,0,0) (0,3,1,0,0) (1,3,1,0,0) (0,4,1,0,0) (0,5,1,0,0) (0,6,1,0,0) (0,7,1,0,0) (0,0,2,0,0) (1,0,2,0,0) (0,1,2,0,0) (1,1,2,0,0) (0,2,2,0,0) (0,3,2,0,0) (0,4,2,0,0) (0,5,2,0,0) (0,0,3,0,0) Profile (0,2,0,1,0) (0,3,0,1,0) (0,4,0,1,0) (0,0,1,1,0) (0,1,1,1,0) (0,2,1,1,0) (0,0,2,1,0) (0,1,2,1,0) (0,0,3,1,0) (0,1,3,1,0) (0,0,4,1,0) (0,0,5,1,0) (0,0,6,1,0) (0,0,0,2,0) (0,1,0,2,0) (0,0,1,2,0) (0,0,2,2,0) (0,0,3,2,0) (0,0,0,3,0) (0,0,1,3,0) (0,0,0,4,0) (0,0,0,5,0) (0,0,0,0,1) # 1 1 1 1 1 2 1 4 1 6 1 6 4 2 1 2 1 4 1 7 6 4 1 4 # 1 1 1 1 1 1 1 1 1 1 2 2 1 4 3 1 6 2 6 1 6 1 4 2 As a byproduct of the calculations done for R(7), we also extended the known values for the sequences Rk(n) included in the OEIS. The correspond- ing sequences for Dk(n) are A051112 to A051118 [Slo11]. The new values that we have computed are included in Table 7. 2.1.3. Computing Bounds on R(n) and D(n). Since each MBF can have at most 7!− 1 = 5039 other functions equivalent to it, we know that D(7)/7! ∼ 479 million is a lower bound for R(7). In fact, we can increase the lower bound by looking for highly symmetric functions. For instance, the MBF with minimal term {1} is equivalent to only six other MBFs, all with one singleton set as the only minimal term. Hence this equivalence class only has 7 functions, and increases the lower bound we have by 5040−7 5040 . If we do this for all equivalence classes of functions with at most two minimal terms, COUNTING INEQUIVALENT MONOTONE BOOLEAN FUNCTIONS 9 Rk(7) k Rk(5) Rk(6) 34 2 22 202 84 3 1321 287 4 8626 5 787 50961 1661 6 253104 2630 7 1025322 3164 8 3365328 2890 9 2159 10 9005678 1327 19850932 11 13 30 49 48 34 18 7 2 2 0 Table 7. Partial list of values Rk(n), values in boldface were not known to us. and some simple equivalence classes with three and four minimal terms, we are able to increase this lower bound by around 500. This raises the interesting question of what the functions in high-cardinality equivalence classes look like, that is, functions which have few or no sym- metries. For n ≤ 5 functions with no symmetries are quite rare, however it appears that they already are the overwhelming majority when n = 7. The number of inequivalent n-variable MBFs that have no symmetries, starting from n = 1, is the sequence 0, 1, 0, 0, 7, 7281. 3. Implementation Details All computations were done on MATLAB, a high-level scientific com- puting language [MAT]. We used three computational clusters: the Optima cluster at SFU Surrey, the IRMACS computational cluster, and the bugaboo cluster of Westgrid under Compute Canada. We use MATLAB for building a prototype because it is easy to get started, and it is built for handling large vectors and matrices. It has many built-in functions that work well with the types of lists we are generating, and if desired, further work can be transported over to other programming languages. In MATLAB, we represent MBFs as their truth table forms, 1 × 2n row vectors. This representation also lends itself well to using 32-bit integers instead of long 0-1 strings. Given an MBF of length 2n, we partition the zeros and ones into blocks of length 32, which we consider as a binary number (a0a1a2 . . . a31)2, and which we then convert into decimal, by computing k=0 1ak2k. If n is smaller than 5, the truth table form has less than 32 entries, and we pad with zeros on the right. For n ≥ 5, an n-variable MBF can be written as 2n−5 32-bit integers. (cid:80)3 Example 3.1. The six-variable MBF f = 1111111011111110111111001000000011111010111010101111100000000000 10 TAMON STEPHEN AND TIMOTHY YUSUN has 64 entries, so it is divided into two blocks of 32: 11111110111111101111110010000000 → 20938623 11111010111010101111100000000000 → 2053983 hence the 32-bit integer representation of f is (20938623, 2053983). Its minimal terms are {1, 2, 4}, {3, 4}, {1, 5}, {2, 3, 5}, {1, 2, 3, 6}, {2, 4, 6}, {2, 5, 6}, and {3, 5, 6}. The algorithms we use involve building and frequently referencing a very long list of functions. To do this efficiently we use a hash table and a nonlinear hashing function on the 32-bit representations to perform checks and lookups quickly. In particular, we use a polynomial hash function, which acts on the four integers (say b1, b2, b3, and b4) by repeatedly adding a number α > 2 modulo a prime p, and multiplying by the next component. This can be written as b1(α + b2(α + b3(α + b4))) where all operations are done modulo p. In our computations, using hash tables for list handling instead of binary search led to a speedup of a factor of 4 for lists of size 40000, and a factor of 8 for lists of size 1500000. The list of functions for each profile is generated from the list for a pro- file which differs from it by one in a single coordinate. This allows many possibilities for traversing this lattice of profiles. Our general strategy is as follows: first, all profiles with a nonzero 1st or 6th entry, by Lemma 2.4 can be obtained from the corresponding profile in R(6). Next, we consider the remaining profiles that have a nonzero 2nd or 5th entry. It is faster to generate profile (0, 1, 8, 8, 0, 0, 0)R from (0, 1, 8, 7, 0, 0, 0)R rather than from (0, 0, 8, 8, 0, 0, 0)R because the 2-set in the profile (0, 1, 8, 7, 0, 0, 0) substan- tially reduces the number of comparable terms we need to consider when taking disjunctions: any 2-set is comparable to five 3-sets and ten 4-sets. Note that this also implies that the largest profiles we encounter are those solely containing 3-sets and 4-sets. In fact, the functions in these profiles account for 366689638 out of the total of 490013148 for R(7), or 74.8%. In the computation, we generated the list of functions for profiles with exactly one nonzero entry first, then proceeded through the list of profiles with the above considerations as a general guide. Note that the branches of computation are independent of each other and so multiple calculations can be made to run concurrently. Also many profiles were computed more than once, either as an intermediate step with the goal of computing a larger pro- file, or as a redundancy check. For example, the profile (0, 0, 3, 4, 0, 0, 0)R is computed both by a process generating profiles of the form (0, 0, 3, x, 0, 0, 0)R and another one generating profiles of the form (0, 0, x, 4, 0, 0, 0)R. We saved lists of functions to disk for the larger profiles generated to have various points to start further computations or recover (as some jobs lasted several weeks and were susceptible to system shutdowns, etc.). All results of computations are saved by the script files as text files, which include the numbers obtained and the computation time (Fig. 1). To keep track of the data, we save all the results in a database together with the COUNTING INEQUIVALENT MONOTONE BOOLEAN FUNCTIONS 11 computation times, with a running total (Fig. 2). At the end we obtain the number R(7) = 490013148. Figure 1. Sample output log of the computation Figure 2. Portion of database where results are stored To ensure accuracy we wrote code that outputs the minimal terms of any input function. We then checked the minimal terms of around 10,000 functions from each profile in a random sample. Moreover, each iteration of the code also includes a check to ensure that the functions in the input file indeed correspond to the profile we start with. We also tested our algorithm for n = 6 and obtained the correct number for both D(6) and R(6). As a final check, we observe that the number obtained is higher than the lower bound of 479 million discussed in Section 2. Our MATLAB code and the database shown in Figure 2 are available on the website [Yus12]. 4. Proof of Algorithm 1 Here we present a proof that Algorithm 1 is correct. First, we prove that the rth row of the matrix K generated as an intermediate step in the algorithm contains lower bounds on the number of comparable (r − 1)-sets. Then, we show that the output P (n) of the algorithm contains all profiles of n-variable MBFs. Lemma 4.1. For 0 < r ≤ n and 0 < x ≤(cid:0) n(cid:98)n/2(cid:99) matrix K output by Algorithm 1 encodes the smallest number of (r − 1)-sets that are comparable to any of x number of r-sets. (cid:1), the (r, x)-th entry of the 12 TAMON STEPHEN AND TIMOTHY YUSUN Proof. Assume first that r = 1, or r − 1 = 0. Since K(0, x) = 0 for any x > 0, Line 16 of the algorithm gives K(r, x) = K(0, x − k − 1) + ⇒ K(r, x) = 1. (cid:18)k − 1 (cid:19) 0 r r r r−1 r r (cid:1)) +(cid:0)k−1 r−1 where the value of k was updated in Line 11 and one where it was not. Now assume that r > 1. Again, Line 16 of the algorithm gives the recur- This is correct since the empty set is comparable to any number of singleton sets, and there is only one empty set. sion step: K(r, x) = K(r− 1, x−(cid:0)k−1 Case 1: If k was updated in Line 10, then x is exactly equal to(cid:0)k k was incremented by 1. This means, at Line 16, x is equal to (cid:0)k−1 hence K(r − 1, x −(cid:0)k−1 collection U =(cid:0){1,2,...,k−1} collection of x r-sets must be equal to(cid:0)k−1 then the number we obtained when we considered U = (cid:0){1,2,...,k−1} 1, x−(cid:0)k−1 Case 2: If k was not updated in Line 10, then(cid:0)k−1 (cid:1) < x <(cid:0)k and V contains x −(cid:0)k−1 The number of (r − 1)-sets contained in U is equal to (cid:0)k−1 (cid:1). We consider two cases, one (cid:1) before (cid:1), and (cid:1)) = K(r − 1, 0) = 0. Now if we have the exact (cid:1), then the number of (r− 1)-sets contained in our (cid:1), counting all (r − 1)-subsets of (cid:1) must (cid:1) must be the lower bound for the number of (r − 1)-sets (cid:1). Consider (cid:1) other sets, all of which contain the element k. (cid:1), that is, all Since any other collection of x r-sets must contain at least k elements, have been the lower bound for any such collection. Thus, K(r, x) = K(r − contained in x r-sets. the family of sets A = U ∪ V where U is the set of all r-subsets of [k − 1], [k − 1] = {1, 2, . . . , k − 1}. (cid:1)) +(cid:0)k−1 r−1 possibilities of taking r − 1 elements from [k − 1]. As for V, since U already contains all (r−1)-subsets of [k−1], we will only count the number of (r− 1)-sets comparable to V which contain the element k. By removing k from all of the sets in V, we can see that this number is bounded below by the number of (r − 2)-sets that must be contained in any Hence, the number of (r − 1)-sets that are necessarily contained in any (cid:1) (r−1)-sets, or by induction, the value K(r−1,(cid:0)k−1 (cid:1)). collection of x−(cid:0)k−1 (cid:1)) + collection of x r-sets must be bounded below by K(r, x) = K(r− 1,(cid:0)k−1 (cid:0)k−1 (cid:1), completing the proof. (cid:3) r r r r r r r−1 r r r−1 Theorem 4.2. The list P (n) in Algorithm 5 contains all profiles of mono- tone Boolean functions on n variables. Proof. We perform induction on the rightmost nonzero entry in a profile vector. When P (n) is initialized, the empty profile and all profiles with a single nonzero entry in the first position are included. This is just the collection of COUNTING INEQUIVALENT MONOTONE BOOLEAN FUNCTIONS 13 all MBFs with only 1-sets as minimal terms, and there are n such profiles as there are n such sets in 2[n]. Now assume that P (n) contains all profiles with the rightmost nonzero entry in the r-th position. First of all, note that when x = 0, the conditional in Line 18 fails, and so C(r, 0) = d, which was most recently updated to the value of s, the running total of all profiles so far. This means that C(r, 0)−C(r−1, 0) is the number of new profiles added when iterating in the (r − 1)-st row. From Line 26, we see that recent contains exactly the profiles with rightmost nonzero entry in the (r − 1)-st position. The loop starting at Line 28 looks at K(r, x), which by Lemma 4.1 tells how many (r − 1)-sets are equivalent to x r-sets. Then all the profiles which have (r− 1)-st entry at least K(r, x) will be taken – this is candidates. The next few lines do a substitution, replacing this number of (r − 1)-sets by x in the r-th entry. This new set of profile vectors is then appended into the existing list, and values are updated. Finally we prove the fact that the variable s keeps track of how many profiles have been generated already. Since s is at each iteration incremented by d, which is in turn C(r, x), we just have to prove that C(r, x) encodes the number of profiles such that the rightmost nonzero entry is an x in the rth position. But this is apparent from the loop starting at Line 18, since we are forcing j to be larger than K(r, x), so that from the previous row, we are only looking at profiles where the (r − 1)-st entry is at least K(r, x). This allows us to make the substitution we describe above in the loop starting at (cid:3) Line 28. 5. Conclusions and Discussion In this paper we propose a strategy for counting inequivalent monotone Boolean functions (MBFs), which is a challenging enumeration problem on a fundamental combinatorial object. The strategy is to break the computation into smaller parts based on profiles of MBFs. We describe and implement a non-trivial algorithm to generate the profiles. Using profiles, we are able to generate the full set of inequivalent 7-variable MBFs in manageable pieces, which in particular allows us to find that the number of such functions is R(7) = 490013148. At present it appears difficult to extend this technique to computing R(8). This is because it requires generating, rather than merely counting, a non- trivial fraction of the profiles. It is appealing to try to use R(7) to compute D(9), which is presently not known. Wiedemann in 1991 computed D(8) using D(6) and R(6), by going through all pairs of functions in D(6)× R(6), and using a lookup function to calculate how many functions in D(8) can be formed by fixing two "middle functions". See [Wie91] for details. 14 TAMON STEPHEN AND TIMOTHY YUSUN To apply this technique to the computation of D(9), we would need to generate D(7) from R(7), store the number of functions in each equivalence class, and then calculate the number of MBFs each function contains as a preprocessing step. The difficulty lies in the sheer amount of computation needed, but as the strategy is simple to parallelize, there is some hope. To make the calculation more manageable we would like to understand the symmetries of monotone Boolean functions better. We might start by trying to count functions by their symmetry group, or by extending the sequence of inequivalent non-symmetric MBFs that we consider in Section 2.1.3. 6. Acknowledgments This research was partially supported by an NSERC Discovery Grant. We would like to thank the SFU Math Department, the IRMACS Centre at SFU, and Westgrid and Compute Canada for the access to the computational resources needed to perform the calculations in this paper. Also, we are grateful to Michael Monagan and Utz-Uwe Haus for discus- sion, in particular we thank MM for pointing out that we needed to use hash tables for the large lists. References [BK76] [CH11] J. Berman and P. Kohler, Cardinalities of finite distributive lattices, Mitt. Math. Sem. Giessen (1976), no. Heft 121, 103–124. Y. Crama and P.L. Hammer, Boolean functions: Theory, algorithms, and ap- plications, Encyclopedia of Mathematics and Its Applications, Cambridge Uni- versity Press, 2011. [Chu40] R. Church, Numerical analysis of certain free distributive structures, Duke Mathematical Journal 6 (1940), no. 3, 732–734. [Chu65] , Enumeration by rank of the free distributive lattice with 7 generators, Notices of the American Mathematical Society (1965), no. 11, 724. [Ded97] R. Dedekind, Uber Zerlegungen von Zahlen durch ihre grossten gemeinsamen Teiler, Ges. Werke, Vol. 2, 1897, pp. 103–148. [Eng97] K. Engel, Sperner theory, Cambridge University Press, 1997. [FMSS01] R. Fidytek, A. Mostowski, R. Somla, and A. Szepietowski, Algorithms counting monotone boolean functions, Information Processing Letters 79 (2001), 203– 209. [HKS08] U. Haus, S. Klamt, and T. Stephen, Computing knock-out strategies in metabolic networks, J. Comput. Biol. 15 (2008), no. 3, 259–268. [IKN07] H. Ito, M. Kobayashi, and G. Nakamura, Semi-distance codes and steiner sys- [KG04] [Kis88] [KJ03] [Kle69] tems, Graph. Comb. 23 (2007), 283–290. S. Klamt and E.D. Gilles, Minimal cut sets in biochemical reaction networks, Bioinformatics 20 (2004), no. 2, 226–234. A. Kisielewicz, A solution of Dedekind's problem on the number of isotone boolean functions, J. Reine Angew. Math. 386 (1988), 139–144. G. Kilibarda and V. Jovovic, On the number of monotone boolean functions with fixed number of lower units (in Russian), Intellektualnye sistemy 7 (2003), no. 1-4, 193–217. D. Kleitman, On Dedekind's problem: The number of monotone boolean func- tions, Proc. Amer. Math. Soc. 21 (1969), 677–682. COUNTING INEQUIVALENT MONOTONE BOOLEAN FUNCTIONS 15 [Kor03] [MAT] [RP11] [Shm] [Slo11] A. Korshunov, Monotone boolean functions, Russian Mathematical Surveys 58 (2003), no. 5, 929–1001. MATLAB, The MathWorks Inc., Natick, Massachusetts. F. Riquelme and A. Polym´eris, On the complexity of the decisive problem in sim- ple and weighted games, Electronic Notes in Discrete Mathematics 37 (2011), 21–26. I. systemsbiology.net/ilya/LEARN.htm. N. J. A. Sloane, The online encyclopedia of integer sequences, http://oeis.org, 2011. http://personal. Computational Shmulevich, learning theory, [SSGC95] I. Shmulevich, T. M. Sellke, M. Gabbouj, and E. J. Coyle, Stack filters and free distributive lattices, Proceedings of the 1995 IEEE Workshop on Nonlinear Signal and Image Processing (Halkidiki, Greece), 1995, pp. 927–930. [War46] M. Ward, Note on the order of free distributive lattices, Bulletin of the American Mathematical Society (1946), no. 52, 423. [Wie91] D. Wiedemann, A computation of the eighth Dedekind number, Order 8 (1991), [Yus12] no. 1, 5–6. T. Yusun, Counting inequivalent monotone Boolean functions, http://sfu.ca/ ~tyusun/inequivalentMBF.html, 2012. Department of Mathematics, Simon Fraser University, 8888 University Drive, Burnaby, B.C. V5A 1S6, Canada E-mail address: [email protected] E-mail address: [email protected]
1901.02536
1
1901
2019-01-08T22:02:50
Fast generalized DFTs for all finite groups
[ "cs.DS", "math.GR" ]
For any finite group $G$, we give an arithmetic algorithm to compute generalized Discrete Fourier Transforms (DFTs) with respect to $G$, using $O(|G|^{\omega/2 + \epsilon})$ operations, for any $\epsilon > 0$. Here, $\omega$ is the exponent of matrix multiplication.
cs.DS
cs
Fast generalized DFTs for all finite groups Chris Umans∗ Caltech January 10, 2019 Abstract For any finite group G, we give an arithmetic algorithm to compute generalized Discrete Fourier Transforms (DFTs) with respect to G, using O(Gω/2+ǫ) operations, for any ǫ > 0. Here, ω is the exponent of matrix multiplication. 1 Introduction For a finite group G, let Irr(G) denote a complete set of irreducible representations of G. A gen- eralized DFT with respect to G is a map from a group algebra element α ∈ C[G] (which is a vector of G complex numbers), to the following linear combination of irreducible representations: Xg∈G αg Mρ∈Irr(G) ρ(g). It is unique once one fixes a basis for each ρ; one usually seeks algorithms that work for arbitrary chosen bases. We typically speak of the complexity of computing this map in the (non-uniform) arithmetic circuit model and do not concern ourselves with finding the irreducible represen- tations. The trivial algorithm thus requires O(G2) operations, since we are summing G block-diagonal matrices, each with G entries in the blocks. Fast algorithms for the DFT with respect to cyclic groups are well-known and are attributed to Cooley and Tukey in 1965 [CT65], although the ideas likely date to Gauss. Beth in 1984 [Bet84], together with Clausen [Cla89], initiated the study of generalized DFTs, the "general- ized" terminology signalling that the underlying group may be any group. A central goal since that time has been to obtain fast algorithms for generalized DFTs with respect to arbitary underlying groups. One may hope for "nearly-linear" time algorithms, meaning that they use a number of operations that is upper-bounded by cǫG1+ǫ for universal constants cǫ and ar- bitary ǫ > 0. Such "exponent one" algorithms are known for certain families of groups: abelian groups, supersolvable groups [Bau91], and symmetric and alternating groups [Cla89]. Algo- rithms for generalized DFTs often find themselves manipulating matrices, so it is not surprising that they require a number of operations that depends on ω, the exponent of matrix multiplica- tion. Thus we view algorithms that achieve exponent one conditioned on ω = 2 as being "nearly as good" as unconditional exponent one algorithms. Such algorithms are known for solvable groups [Bet84, CB93], and with the recent breakthrough of [HU18a], for linear groups; these algorithms achieve exponent ω/2. In this paper we realize the main goal of the area, obtaining exponent ω/2 for all finite groups G. The previous best exponent that applies to all finite groups was obtained by [HU18a]; it depends in a somewhat complicated way on ω, but it is at best √2 (when ω = 2). Before that, the best known exponent was 1 + ω/4 (which is at best 3/2 when ω = 2), and this dates back to the original work of Beth and Clausen. ∗Supported by NSF grant CCF-1815607 and a Simons Foundation Investigator grant. 1 1.1 Past and related work A good description of past work in this area can be found in Section 13.5 of [BCS97]. The first algorithm generalizing beyond the abelian case is due to Beth in 1984 [Bet84]; this algorithm is described in Section 3.1 in a form often credited jointly to Beth and Clausen. Three other milestones are the O(G log G) algorithm for supersolvable groups due to Baum [Bau91], the O(G log3 G) algorithm for the symmetric group due to Clausen [Cla89] (see also [Mas98] for a recent improvement), and the O(Gω/2+ǫ) algorithms for linear groups obtained by Hsu and Umans, which is described in Section 3.2. Wreath products were studied by Rockmore [Roc95] who obtained exponent one algorithms in certain cases. In the 1990s, Maslen, Rockmore, and coauthors developed the so-called "separation of vari- ables" approach [MR97a], which relies on non-trivial decompositions along chains of subgroups via Bratteli diagrams and detailed knowledge of the representation theory of the underlying groups. There is a rather large body of literature on this approach and it has been applied to a wide variety of group algebras and more general algebraic objects. For a fuller description of this approach and the results obtained, the reader is referred to the surveys [MR97b, Roc02], and the most recent paper in this line of work [MRW16]. 2 Preliminaries Throughout this paper we will use the phrase "generalized DFTs with respect to G can be computed using O(Gα+ǫ) operations, for all ǫ > 0" where G is a finite group and α ≥ 1 is a real number. We mean by this that there are universal constants cǫ independent of the group G under consideration so that for each ǫ > 0, the operation count is at most cǫGα+ǫ. Such an algorithm will be referred to as an "exponent α" algorithm. This comports with the precise definition of the exponent of matrix multiplication, ω: that there are universal constants bǫ for which n× n matrix multiplication can be performed using at most bǫnω+ǫ operations, for each ǫ > 0. Indeed we will often report our algorithms' operation counts in terms of ω. In such cases matrix multiplication is always used as a black box, so, for example, an operation count of O(Gω/2) should be interpreted to mean: if one uses a fast matrix multiplication algorithm with exponent α (which may range from 2 to 3), then the operation count is O(Gα/2). In particular, in real implementations, one might well use standard matrix multiplication and plug in 3 for ω in the operation count bound. We use Irr(G) to denote the complete set of irreducible representations of G being used for the DFT at hand. In the presentation to follow, we assume the underlying field is C; however our algorithms work over any field F pk whose characteristic p does not divide the order of the group, and for which k is sufficiently large for Fpk to represent a complete set of irreducibles. We use In to denote the n × n identity matrix. The following is an important general observation (see, e.g., Lemma 4.3.1 in [HJ91]): Proposition 2.1. If A is an n1 × n2 matrix, B is an n2 × n3 matrix, and C is an n3 × n4 matrix, then the entries of the product matrix ABC are exactly the entries of the vector obtained by multiplying A ⊗ CT (which is an n1n4 × n2n3 matrix) by B viewed as an n2n3-vector, and denoted vec(B). 2.1 Basic representation theory A representation of group G is a homomorphism ρ from G into the group of invertible d × d matrices. Representation ρ naturally specifies an action of G on Cd; representation ρ is thus said to have dimension dim(ρ) = d. A representation is irreducible if the action on Cd has no G-invariant subspace. Two representations of the same dimension d, ρ1 and ρ2, are equivalent (written ρ1 ∼= ρ2) if they are the same up to a change of basis; i.e., ρ1(g) = T ρ2(g)T −1 for some invertible d × d matrix T . The classical Maschke's Theorem implies that every representation 2 ρ0 of G breaks up into the direct sum of irreducible representations; i.e. there is an invertible matrix T and a multiset S ⊆ Irr(G), for which T ρ0(g)T −1 = Mρ∈S ρ(g). Given a subgroup H ⊆ G one can obtain from any representation ρ ∈ Irr(G) a representation ResG H (ρ) (the restriction of ρ to H), which is a representation of H, simply by restricting the domain of ρ to H. One can also obtain from any representation σ ∈ Irr(H), a representation of G called the induced representation IndG H (ρ), which has dimension dim(σ)G/H. We will not need to work directly with induced representations, but we will use a fundamental fact called Frobenius reciprocity. Given ρ ∈ Irr(G) and σ ∈ Irr(H), Frobenius reciprocity states that the number of times σ appears in the restriction ResG H (ρ) equals the number of times ρ appears in the induced representation IndG A basic fact is that Pρ∈Irr(G) dim(ρ)2 = G, which implies that for all ρ ∈ Irr(G), we have dim(ρ) ≤ G1/2. This can be used to prove the following inequality, which we use repeatedly: Proposition 2.2. For any real number α ≥ 2, we have H (σ). Xρ∈Irr(G) dim(ρ)α ≤ Gα/2. Proof. Set ρmax to be an irrep of largest dimension. We have Xρ∈Irr(G) dim(ρ)α ≤ dim(ρmax)α−2 Xρ∈Irr(G) dim(ρ)2 = dim(ρmax)α−2G ≤ Gα/2, where the last inequality used the fact that dim(ρmax) ≤ G1/2. 2.2 Basic Clifford theory Clifford theory describes the way the irreducible representations of a group H break up when restricted to a normal subgroup N , which is a particularly well-structured and well-understood scenario. Elements of H act on the set Irr(N ) as follows: (h · λ)(n) = λ(hnh−1), for λ ∈ Irr(N ). Let O1, . . . ,Oℓ be the orbits of this H-action on Irr(N ). Clifford theory states for each σ ∈ Irr(H), there is a positive integer eσ and an index iσ for which the restriction ResH N (σ) is equivalent to eσ Mλ∈Oiσ λ. In particular, this implies that all λ ∈ Irr(N ) that occur in the restriction have the same dimension, dσ, and multiplicity, eσ, and that dim(σ) = dσeσOiσ. We can also define the following subsets, which partition Irr(H): Sℓ = {σ ∈ Irr(H) : the irreps in Oℓ occur in σ} = {σ ∈ Irr(H) : iσ = ℓ}. We will need the following proposition: Proposition 2.3. For a finite group H and normal subgroup N , and sets Sℓ as defined above, the following holds for each ℓ: Xσ∈Sℓ dim(σ)eσ/dσ = H/N. 3 Proof. Fix λ ∈ Oℓ, and note that the induced representation IndH Let mσ,λ be the number of times σ ∈ Irr(H) occurs in IndH N (λ) has dimension dim(λ)H/N. N (λ). Then we have Xσ∈Irr(H) dim(σ)mσ,λ = dim(λ)H/N. By Frobenius reciprocity, mσ,λ equals the number times λ occurs in ResH N (σ). Thus the summand dim(σ)mσ,λ equals dim(σ)eσ, whenever mσ,λ 6= 0 (and zero otherwise). The proposition follows. 2.3 Generalized DFTs and inverse generalized DFTs We assume by default that we are computing generalized DFTs with respect to an arbitary chosen basis for each ρ ∈ Irr(G). Sometimes we need to refer to the special basis in the following definition: Definition 2.4. Let H be a subgroup of G. An H-adapted basis is a basis for each ρ ∈ Irr(G), so that the restriction of ρ to H respects the direct sum decomposition into irreps of H. In concrete terms, this implies that for each ρ ∈ Irr(G), while for general g ∈ G, ρ(g) is a dim(ρ)× dim(ρ) matrix, for g ∈ H, ρ(g) is a block-diagonal matrix with block sizes coming from the set {dim(σ) : σ ∈ Irr(H)}. An H-adapted basis always exists. A general trick that we will rely on is that if one can compute generalized DFTs with respect to G for an input α supported on a subset S ⊆ G, then with an additional multiplicative factor of roughly G/S, one can compute generalized DFTs with respect to G. Theorem 2.5. Fix a finite group G and a subset S ⊆ G, and suppose a generalized DFT with respect to G can be computed in m operations, for inputs α supported on S. Then generalized DFTs with respect to G can be computed using operations, for any ǫ > 0. O(m + Gω/2+ǫ) · G log G S Proof. First observe that by multiplying by ⊕ρ∈Irr(G)ρ(g) we can compute a generalized DFT supported on Sg, for an additive extra cost of O(dim(ρ)ω+ǫ) Xρ∈Irr(G) operations, for all ǫ > 0, and by applying Proposition 2.2 with α = ω + ǫ this is at most O(Gω/2+ǫ). A probablistic argument shows that G log G/S different translates g suffice to cover G, so we need only repeat the DFT supported on Sg translated by each such g, and sum the resulting DFTs. The inverse generalized DFT maps a collection of matrices M σ ∈ Cdim(σ)×dim(σ), one for each σ ∈ Irr(G), to the vector α for which αg Mσ∈Irr(G) Xg∈G ρ(G) = Mσ∈Irr(G) M σ. In the arithmetic circuit model, the inverse DFT can be computed efficiently if the DFT can: Theorem 2.6 (Baum, Clausen; Cor. 13.40 in [BCS97]). Fix a generalized DFT with respect to finite group G and suppose it can be computed in m operations. Then the inverse DFT with respect to G (and the same basis), can be computed in at most m + G operations. 4 3 General strategy: reduction to subgroups One way to organize the main algorithmic ideas in the quest for a fast DFT for all finite groups is according to the subgroup structure they exploit. The algorithms themselves are recursive, with the main content of the algorithm being the reduction to smaller instances: DFTs over subgroups of the original group. When aiming for generalized DFTs for all finite groups, such a reduction is paired with a group-theoretic structural result, which guarantees the existence of certain subgroups that are used by the reduction. In the exposition below, it is helpful to assume that ω = 2 and seek an "exponent 1" algorithm under this assumption (in general, the exponent achieved will be a function of ω, and in our main result this function is ω/2). By the term overhead we mean the extra multiplicative factor in the operation count of the reduction, beyond the nearly-linear operation count that would be necessary for an exponent 1 algorithm. 3.1 The single subgroup reduction The seminal Beth-Clausen algorithm reduces computing a DFT over a group G to computing several DFTs over a subgroup H of G. We call this the "single subgroup reduction". Roughly speaking, the overhead in this reduction is proportional to the index of H in G. The companion structural result is Lev's Theorem [Lev92], which shows that every finite group G (except cyclic of prime order which can be handled separately) has a subgroup of order at least √G (and this is tight, hence the overhead is pG in the worst case). As noted in the introduction, this reduction together with Lev's Theorem implies exponent 3/2 (assuming ω = 2) for all finite groups. Here is a more detailed description, together with results we will need later. Let H be a subgroup of G and let X be a set of distinct coset representatives. We first compute several H-DFTs, one for each x ∈ X: sx = Xh∈H αhx Mσ∈Irr(H) σ(h) and by using an H-adapted basis (Definition 2.4), we can lift each sx to sx = Xh∈H αhx Mρ∈Irr(G) ρ(h) by just copying entries (which is free of cost in the arithmetic model). Then to complete the DFT we need to compute Xx∈X sx Mρ∈Irr(G) ρ(x). Generically, this final computation requires an overhead proportional to X = [G : H], even when just considering the outermost summation. See Corollary 4 in [HU18b] for the details to complete this sketch, yielding the following: Theorem 3.1 (single subgroup reduction). Let G be a finite group and let H be a subgroup. Then we can compute a generalized DFT with respect to G at a cost of [G : H] many H-DFTs plus O([G : H]Gω/2+ǫ) operations, for all ǫ > 0. In the special case that H is normal in G and G/H is cyclic of prime order, the overhead of [G : H] can be avoided, by using knowledge about the way representations σ ∈ Irr(H) extend to ρ ∈ Irr(G). This insight is the basis for the Beth-Clausen algorithm for solvable groups. We need it here to handle the case of G/H cyclic of prime order, which is the single exceptional case not handled by our main reduction. The following theorem can be inferred from the proof of Theorem 7.7 in Clausen and Baum's monograph [CB93]: 5 Theorem 3.2 (Clausen, Baum [CB93]). Let H be a normal subgroup of G with prime index p. We can compute a generalized DFT with respect to G and an H-adapted basis, at a cost of p many H-DFTs plus O(p log p) · Xσ∈Irr(H) dim(σ)ω+ǫ operations, for all ǫ > 0. For our purposes the following slightly coarser bound suffices, which accomodates an arbitary basis change (hence obviating the need for an H-adapted basis): Corollary 3.3. Let H be a normal subgroup of G with prime index p. Generalized DFTs with respect to G can be computed at a cost of p many H-DFTs plus O(Gω/2+ǫ) operations, for all ǫ > 0. Proof. Applying Proposition 2.2 to Theorem 3.2 with α = ω + ǫ yields an operation count of O(p log p)Hω+ǫ/2, which is at most O(Gω/2+ǫ). Performing an arbitary basis change costs O(dim(ρ)ω+ǫ) Xρ∈Irr(G) operations which is again at most O(Gω/2+ǫ) by Proposition 2.2. 3.2 The double subgroup reduction Recently, Hsu and Umans proposed a "double subgroup reduction" [HU18a] which reduces computing a DFT over a group G to computing several DFTs over two subgroups, H and K. This reduction is especially effective for linear groups (see [HU18a]). Roughly speaking, the overhead in this reduction is proportional to G/HK and H ∩ K. The companion structural result shows that every finite group G (except p-groups which can be handled separately) has two proper subgroups H and K for which G/HK is negligible. However, H ∩ K might still be large, which is the one thing standing in the way of deriving an "exponent ω/2" algorithm from this reduction. To illustrate the bottleneck in this reduction, we describe it in more detail. Let H, K be subgroups of G and assume G/HK is negligible. We first compute an intermediate represen- tation Xg=hk∈HK αg Mσ∈Irr(H) τ∈Irr(K) σ(h) ⊗ τ (k) in two steps (and then lift it to a G-DFT). The first of the two steps is to compute at most [G : H] many H-DFTs, yielding, for each k ∈ K′ ⊆ K (where K′ is a set of distinct coset representatives of H in G): sk = Xh∈H αhk Mσ∈Irr(H) σ(h). The second step is as follows: for each entry of the block-diagonal matrix sk, we use this entry (as k varies) as the data for a K-DFT. There are Pσ∈Irr(H) dim(σ)2 = H such entries in general. Thus the second step entails H many K-DFTs, and this represents the key bottleneck. Note that when G/HK is negligible, HK is approximately GH ∩ K, and this explains the overhead of roughly H ∩ K which prevents obtaining an "exponent ω/2" algorithm from this reduction. For completeness we record the main theorem of [HU18b] here: Theorem 3.4 (Theorem 12 in [HU18b]). Let G be a finite group and let H, K be subgroups. Then we can compute generalized DFTs with respect to G at the cost of H many K-DFTS, K many H-DFTs, plus operations, all repeated O(G log G HK O(Gω/2+ǫ + (HK)ω/2+ǫ) ) times, for all ǫ > 0. 6 Xn∈N M σ1 n [5, 2] · J σ1 · σ1(n) λ1(n) λ2(n) λ3(n) = M σ2 n [1, 1] · J σ2 λ4(n) λ5(n) σ2(n) M σ1 M σ2 Figure 1: Illustration of the proof of Theorem 3.5. In this example Irr(H) = {σ1, σ2}, Irr(N ) = {λ1, λ2, λ3, λ4, λ5}; the orbits are O1 = {λ1, λ2, λ3} and O2 = {λ4, λ5}; S1 = {σ1} and S2 = {σ2}; and the multiplicities are eσ1 = 2 and eσ2 = 1. In the figure, we highlight the parts of the matrices that give rise to the system of equations solved with a single inverse N -DFT, corresponding to the value a = f1(σ1, 5, 2) = f2(σ2, 1, 1). This inverse N -DFT with the highlighted blocks of M σ1 and M σ2 as input data yields the scalars M σ1 n [1, 1] that satisfy the simultaneous equations. n [5, 2] = M σ2 Our main innovation, described in the next section, is a way to overcome the bottleneck: when H ∩ K = N is a normal subgroup of G, we are able to rewrite each sk as a sum of N matrices with special structure: effectively, there are only H/N many non-zero "entries" for which we need to compute a K-DFT, and as we will show, this exactly removes the overhead factor. 3.3 The triple subgroup reduction In this section we give our main new result. We devise a "triple subgroup reduction" which reduces computing a DFT over G to computing several DFTs over two subgroups, H and K, and several inverse DFTs over the intersection N = H ∩ K, when N is normal in G. Roughly speaking, the overhead is proportional to G/HK. The companion structural result (Theorem 3.10) shows that for every finite group G, if N is a maximal normal subgroup in G then (except for the case of G/N cyclic of prime order, which can be handled separately) there exist two proper subgroups H and K with H ∩ K = N , such that G/HK is negligible. This is the key to the claimed exponent ω/2 algorithm. Let H be a group with normal subgroup N . The main technical theorem shows how to rewrite the output of an H-DFT as the sum of N matrices each of which only has "H/N degrees of freedom". In the following theorem we adopt the notation introduced in Section 2.2. Theorem 3.5. Let H be a group and N a normal subgroup. For every M = Mσ∈Irr(H) M σ ∈ Mσ∈Irr(H) Cdim(σ)×dim(σ), the following holds with respect to an N -adapted basis: there exist matrices M σ for which n ∈ Cdim(σ)/dσ×eσ Xn∈N (M σ n ⊗ J σ) · σ(n) = M σ, where J σ is the dσ × dim(σ)/eσ matrix (IdσIdσ···Idσ ). Moreover, given injective functions fℓ from {(σ, i, j) : σ ∈ Sℓ, i ∈ [dim(σ)/dσ], j ∈ [eσ]} to [r], the M σ n can be taken to satisfy fℓ(σ, i, j) = fℓ′(σ′, i′, j′) ⇒ ∀n M σ n [i, j] = M σ′ n [i′, j′], and these matrices M σ n can be obtained from M by computing r inverse N -DFTs. 7 One should think of the functions fℓ as labeling the entries of the M σ n matrices for the σ in a given Sℓ. This labeling is then used to ensure that entries of M σ n with σ ∈ Sℓ and the entries of M σ′ n with σ′ ∈ Sℓ′ are equal, if they have the same labels. In Section 3.3.1 we will show how to choose this labeling so that the final "lifting" step of our algorithm can be efficiently computed. For now, we note that Proposition 2.3 implies that there exist labellings fℓ with r = H/N, and indeed our actual choice of fℓ in Section 3.3.1 will have r = O(H/N log H/N), which is not much larger. Proof. Fix σ ∈ Irr(H), and recall that there is a unique Sℓ containing σ. Since we are using an N -adapted basis, σ(n) has the form Ieσ ⊗ Mλ∈Oℓ λ(n), and thus Xn∈N (M σ n ⊗ J σ) · σ(n) = Xn∈N M σ n ⊗ (λ1(n)λ2(n)···λOℓ(n)) (1) where λ1, . . . , λOℓ is an enumeration of Oℓ. Since these are pairwise inequivalent irreps, the span of {(λ1(n)λ2(n)···λOℓ(n)) : n ∈ N} is the full matrix algebra Cdσ×dim(σ)/eσ . Hence we can choose the M σ equals an arbitrary M σ ∈ Cdim(σ)×dim(σ). In particular, for each σ, the (i, j) entries of the M σ n so that expression (1) n should satisfy M σ n [i, j] Xn∈N   λ1(n) λ2(n) ... λOℓ(n)   =   M σ[i, j · Oℓ] M σ[i, j · Oℓ + 1] ... M σ[i, j · Oℓ + Oℓ − 1]   (2) where M σ on the right-hand-side is blocked into dσ × dσ submatrices and indexed accordingly. Thus the values of a given entry of M σ n as n ranges over N , can be found in an inverse N -DFT with the appropriate blocks of M σ as input data. Observe however that in general, Oℓ is a proper subset of Irr(H), and hence the aforemen- tioned inverse N -DFT is underdetermined; for example Equation (2) remains satisfied if we n [i, j]λ(n) = 0 for all λ ∈ Irr(H) \ Oℓ. require Pn∈N M σ Indeed, we can simultaneously solve Equation (2) with respect to several σ ∈ Irr(H) via a single inverse N -DFT, provided the associated orbits Oiσ are different. To prove the "moreover" part of the theorem statement, then, we set up the following system of equations, for a given a ∈ [r]: for each ℓ for which fℓ(σ, i, j) = a we simultaneously require that Equation (2) holds with respect to σ, i, j (and note these are determined by a since fℓ is injective). Since the Sℓ partition Irr(H), selecting at most one σ from each Sℓ results in a system that mentions each λ ∈ Irr(N ) at most once. Hence a single inverse N -DFT solves this system of equations. See Figure 1. We do this once for each a ∈ [r], to produce the matrices M σ n from the original M , using r inverse N -DFTs. 3.3.1 Choosing the labelings fℓ To make use of Theorem 3.5, we need to define injective functions fℓ from {(σ, i, j) : σ ∈ Sℓ, i ∈ [dim(σ)/dσ], j ∈ [eσ]} to [r]. We identify the domain of fℓ with the entries of a block-diagonal matrix, with rectangular blocks of size dim(σ)/dσ × eσ, as σ ranges over Sℓ. Recall that by Proposition 2.3, the total number of entries in these blocks is H/N. 8 We will describe functions fℓ associating the entries of a block-diagonal matrix of this format (which depends on ℓ) with a target block-diagonal matrix whose format is fixed as follows: 2 · H/N ⌈2 · H/N/4⌉ ⌈2 · H/N/16⌉ (cid:6)2 · H/N/22i(cid:7) 2 blocks of size blocks of size blocks of size ... blocks of size ... 1 × 1 2 × 2 4 × 4 2i × 2i blocks of size 2⌈log2 H/N⌉ × 2⌈log2 H/N⌉ Note that the number of entries of this target matrix is O(H/N log H/N), and this will be our r. The asssociation specifying the map fℓ is quite simple: we take one column at a time of the source block-diagonal matrix, and if it has height w, we associate it, top-aligned, with the next-available column among the blocks of size 2i × 2i, for the i such that 2i/2 < w ≤ 2i. See Figure 2. Since there can be at most H/N/w < 2H/N/2i columns of height w in the source matrix (which has H/N entries in total), and the target block-diagonal matrix has at least 2 · H/N/2i columns of width i, this association is possible. We will use these mappings when applying Theorem 3.5 to facilitate an efficient "lift" from an intermediate representation to the final G-DFT. The key benefit of the mappings is that they allow us to combine several matrix-vector products with incompatible formats into one, as illustrated in Figure 2. In order to be able to speak precisely about this combined object, we make the following definition: Definition 3.6 (parent matrix). Given a partition of Irr(H) into sets Sℓ, matrices Aσ with dimensions dim(σ)/dσ × eσ (one for each σ ∈ Irr(H)), and functions fℓ as above, satisfying fℓ(σ, i, j) = fℓ′(σ′, i′, j′) ⇒ Aσ[i, j] = Aσ′ [i′, j′], define the parent matrix of the Aσ to be the matrix with the format of the target matrix above, and with entry (x, y) equal to the value of Aσ[i, j] if there exists ℓ for which fℓ(σ, i, j) = (x, y), and zero otherwise. See Figure 3 for an example parent matrix. 3.3.2 Computing the intermediate representation We are at the point now where we can compute the intermediate representation, which we then lift to the final G-DFT, making critical use of the just-described labellings fℓ. The setup is as follows: H and K are proper subgroups of group G, and H ∩ K = N is normal in G. Let X be a system of distinct coset representatives of N in H and let Y be a system of distinct coset representatives of N in K. Thus H = XN and K = N Y . Note that HK = XN Y with uniqueness of expression. When applying the triple subgroup reduction in our final result, it will happen that G HK = GN HK is negligible, and notice that in this case, if H-DFTs, K-DFTs, and N -DFTS have nearly-linear algorithms, then indeed the cost of applying the next lemma is nearly-linear in G as desired. Lemma 3.7. With Y many H-DFTs, O(H/N log H/N) · Y many inverse N -DFTs, and O(H/N log H/N) many K-DFTs, we can compute, from α ∈ C[G] supported on HK, the following expression: (3) Xn∈N Xy∈Y Mτ∈Irr(K) Pn,y ⊗ τ (ny)T 9 where Pn,y is the parent matrix of the matrices {M σ satisfy (with respect to an N -adapted basis for Irr(H)): n,y : σ ∈ Irr(H)}, and for each σ, y, the M σ n,y Xn∈N (M σ n,y ⊗ J σ)σ(n) = Xh∈H αhyσ(h). (4) where J σ is the dim(σ)/eσ × dσ matrix (IdσIdσ···Idσ ) as in Theorem 3.5. Proof. First, compute for each y ∈ Y and σ ∈ Irr(H) the matrices M σ y = Xh∈H αhyσ(h), using Y different H-DFTs. Next, apply Theorem 3.5, once for each y, to the matrices Mσ∈Irr(H) M σ y ∈ Mσ∈Irr(H) Cdim(σ)×dim(σ), together with the labelings fℓ from Section 3.3.1, to obtain matrices M σ which n,y ∈ Cdim(σ)/dσ×eσ for Xn∈N (M σ n,y ⊗ J σ)σ(n) = M σ y , at a cost of O(H/N log H/N) · Y many inverse N -DFTs. Note that these M σ Equation (4). Let Pn,y be the parent matrix of the matrices {M σ For each (i, j), the vector β with β[ny] = Pn,y[i, j] is an element of C[K] and we perfom a K-DFT on it; this entails computing at most O(H/N log H/N) different K-DFTs because this is the number of entries in the blocks of the block-diagonal matrices Pn,y. At this point we hold, in the aggregate, all of the entries of Expression (3) in the statement of the lemma, and the proof is complete. n,y : σ ∈ Irr(H)}. n,y satisfy 3.3.3 Lifting to a G-DFT In this section we show how to efficiently lift the intermediate representation, Expression 3 computed via Lemma 3.7, to a G-DFT. We continue with the notation of the previous section. Let Irr∗(H) denote the multiset of irreps of H that occur in the restrictions of the irreps of G to H (with the correct multiplicities), and similarly let Irr∗(K) denote the multiset of irreps of K that occur in the restrictions of the irreps of G to K. Let S and T be the change of basis matrices that satisfy: S  Mσ∈Irr∗(H) T   Mτ∈Irr∗(K) σ(h) τ (k)  S−1 = Mρ∈Irr(G)  T −1 = Mρ∈Irr(G) ρ(h) ∀h ∈ H ρ(k) ∀k ∈ K. We further specify that S should be with respect to an N -adapted basis for Irr(H). Notice that for n ∈ N = H ∩ K, we have: S  Mσ∈Irr∗(H) τ (n)  T −1, σ(n)  S−1 = T   Mτ∈Irr∗(K) σ(n)  S−1T = S−1T   Mτ∈Irr∗(K) or equivalently   Mσ∈Irr∗(H) τ (n)  , (5) 10 a fact we will use shortly. A G-DFT with input α supported on HY = HK is the expression: Xh∈H y∈Y αhy Mρ∈Irr(G) ρ(hy) = Xy∈Y = Xy∈Y  Xh∈H S Xh∈H αhy Mρ∈Irr(G) αhy Mσ∈Irr∗(H) ρ(h)  ·  Mρ∈Irr(G) σ(h)  S−1T  ρ(y)   Mτ∈Irr∗(K) τ (y)  T −1 Now for each y ∈ Y , the left-most parenthesized expression is an H-DFT, with certain blocks repeated. By Equation (4) in the statement of Lemma 3.7, each such expression can be rewritten in terms of matrices M σ n,y, yielding: S  Mσ∈Irr∗(H) S  Mσ∈Irr∗(H) (M σ (M σ n,y ⊗ J σ)σ(n)  S−1T  n,y ⊗ J σ)  S−1T   Mτ∈Irr∗(K) {z  Mτ∈Irr∗(K) τ (ny)  } (∗) τ (y)  T −1 T −1 (6) Xh∈H y∈Y αhy Mρ∈Irr(G) ρ(hy) = Xy∈Y = Xy∈Y n∈N n∈N where the last line invoked Equation (5) to move σ(n) past S−1T . We now focus on Expression (∗). By Proposition 2.1 we can express Expression (∗) as   Mσ∈Irr∗(H),τ∈Irr∗(K)(cid:0)(M σ n,y ⊗ J σ) ⊗ τ (ny)T(cid:1)  · vec(S−1T ) = vec(∗). (7) We next apply two types of simplifications to the block-diagonal matrix on the left. In each, we observe that equalities among blocks allow us to simplify that block-diagonal matrix, at the expense of arranging portions of vecS−1T and vec(∗) into block-diagonal matrices and summing certain entries. The first such observation is that computing (cid:18) A A (cid:19) ·(cid:18) x1 x2 (cid:19) = (cid:18) y1 y2 (cid:19) is equivalent to computing A · (x1x2) = (y1y2). The second observation is that computing (AA) ·(cid:18) x1 x2 (cid:19) = y is equivalent to computing A · (x1 + x2) = y. Using the first observation we can thus simplify Equation 7 to:   Mσ∈Irr(H),τ∈Irr(K)(cid:0)(M σ n,y ⊗ J σ) ⊗ τ (ny)T(cid:1)  · X0 = Y0, where X0 is a block-diagonal matrix whose entries coincide with the entries of S−1T . Next, we notice that J σ = Idσ ⊗ (1, 1, . . . 1). The first observation then allows us to simplify Equation 7 futher to:   Mσ∈Irr(H),τ∈Irr(K)(cid:0)(M σ n,y ⊗ (1, 1, . . . 1)) ⊗ τ (ny)(cid:1)  · X1 = Y1 11 where again the entries of X1 coincide with the entries of S−1T , and the second observation allows us to simplify to:   Mσ∈Irr(H),τ∈Irr(K) n,y ⊗ τ (ny)T M σ  · X2 = Y2, (8) where now X2 is a block-diagonal matrix whose entries are sums of entries of S−1T . {M σ As in the statement of Lemma 3.7, for each n, y, let Pn,y be the parent matrix of the matrices n,y : σ ∈ Irr(H)}. We can rewrite Expression (8) as Pn,y ⊗ τ (ny)T (9)   Mτ∈Irr(K)  · X3 = Y3, where X3 is a block-diagonal matrix whose entries are sums of entries of S−1T . The square blocks of the block-diagonal matrix   Mτ∈Irr(K) Pn,y ⊗ τ (ny)T  have dimensions ai with the property that Xi a2 i = O(H/N log H/N) · K, using our earlier accounting for the block sizes of a parent matrix, together with the fact that Pτ∈Irr(K) dim(τ )2 = K. Each ai × ai block is multiplied by an ai × wi block of X3, to yield an ai × wi block of the product matrix Y3. We now argue that the wi satisfy Pi aiwi = 4G. Each of the two transformations applied to obtain block-diagonal matrices Y0, Y1 and then Y2 preserve the number of entries of the result matrix; these matrices therefore have G entries in the blocks. The final transformation results in a block-diagonal matrix Y3 which may have more entries than G, but this number can be larger by only a factor of four, as illustrated in Figure 2. This is because each column of a block of Y2 may need to be padded to at most twice its original length, and repeated up to two times (and no more, because the blocks of the M σ n,y have no more columns than rows, and thus can spill over at most two blocks in the parent matrix). Thus the number of entries in the blocks of Y3 which equals Pi aiwi, is at most 4G as stated. We conclude that the block-matrix multiplication in Expression (9) can be performed effi- ciently as summarized in the following lemma. Lemma 3.8. The map from Xn∈N Xy∈Y Mτ∈Irr(K) Pn,y ⊗ τ (ny)T as computed from input α supported on HY = HK in Lemma 3.7, to a G-DFT with, can be computed at a cost of O(Gω/2+ǫ) operations, for all ǫ > 0. Proof. We describe how to map a summand Lτ∈Irr(K) Pn,y ⊗ τ (ny)T to the corresponding summand of Expression (6). This map will be linear and will not depend on n, y, so we apply it once to the entire sum computed by Lemma 3.7, to obtain Expression (6), which is the promised G-DFT. We need to perform matrix multiplications of format hai, ai, wii, and we know that Pi a2 O(H/N log H/N) · K = L and Pi aiwi = 4G. The cost of such a multiplication is at most i = 12 max(O(aω+ǫ amax = maxi ai, we obtain an upper bound on the number of operations of wi)) for all ǫ > 0. Replacing the maximum with a sum, and letting i ), O(aω−1+ǫ i Xi O(aω+ǫ i ) + O(aω−1+ǫ i wi) = O(aω−2+ǫ max )Xi a2 i + aiwi ≤ L(ω−2+ǫ)/2 · (L + 4G). (10) We need to pre-multiply by S and post-multiply by T −1 to obtain a summand of Expression (6). Both S and T −1 are block-diagonal with one block for each ρ ∈ Irr(G), with dimension dim(ρ). Thus the cost of this final pre- and post- multiplication is O(dim(ρ)ω+ǫ) Xρ∈Irr(G) which is at most O(Gω/2+ǫ) by Proposition 2.2 with α = ω + ǫ. The theorem follows from the fact that HK/N ≤ G, and thus Expression (10) is also upper-bounded by O(Gω/2+ǫ) (absorbing logarithmic terms into Gǫ/2). We now have the main theorem putting together the entire triple subgroup reduction: Theorem 3.9 (triple subgroup reduction). Let G be a finite group and let H, K be proper subgroups with N = H ∩ K normal in G. Then we can compute generalized DFTs with respect to G at the cost of • K/N many H-DFTs, • O(HK/N2 log H/N) many inverse N -DFTs, • O(H/N log H/N) many K-DFTs, plus O(Gω/2+ǫ) operations, all repeated O(G log G/HK) many times, for all ǫ > 0. Proof. By Lemma 3.7 we can compute the intermediate representation of a G-DFT supported on HK, and applying the map of Lemma 3.8 to this intermediate representation yields a G-DFT supported on HK. ByTheorem 2.5 we can compute a general G-DFT at the cost of repeating these two steps O(G log G/HK) many times. 3.3.4 Triple subgroup structure in finite groups Our main structural theorem on finite groups is the following Theorem 3.10. There exists a monotone increasing function f (x) ≤ 2c√log x log log x for a uni- versal constant c ≥ 1, such that, for every nontrivial finite group G one of the following holds 1. G has a (possibly trivial) normal subgroup N and G/N is cyclic of prime order, or 2. G has a (possibly trivial) normal subgroup N and G/N has proper subgroups X, Y with X ∩ Y = {1} and for which XNY ≥ G/f (G). To connect this theorem to our usage in the previous sections, think of H as being the sub- group XN and K as being the subgroup N Y , where X and Y are lifts of X and Y , respectively, from G/N to G. Proof. Let N be a maximal normal subgroup of G. Then G/N is simple. If it is cyclic of prime order, then we are done. Otherwise we have the following cases, by the Classification Theorem: 1. G/N is an alternating group An for n ≥ 5. In this case, let X be the subgroup of G/N isomorphic to An−1 and Y the trivial subgroup of G/N . 13 2. G/N is a finite group of Lie Type. In this case, we refer to Table 4, and we have the following description from Carter [Car89]. For Chevalley and exceptional Chevalley groups, we have that there are subgroups B and U−w (for each w in the associated Weyl group W ) so that elements of G/N can be expressed uniquely as bnwuw, where b ∈ B, nw is a lift of w ∈ W to G, and uw ∈ U−w (see Corollary 8.4.4 in Carter [Car89]). Uniqueness implies that the conjugate subgroup nwU−w n−1 w has trivial intersection with B; also, by an averaging argument, there exists w ∈ W for which BnwU−w n−1 w ≥ G/N/W. We take X = B and Y = nwU−w n−1 w . For twisted Chevalley groups, we have an identical situation (see Corollary 13.5.3 in Carter [Car89]), with subgroup B replaced by B1 and subgroup U−w replaced by (U−w )1 (in Carter's notation). Again by an averaging argument there exists w ∈ W for which B1nw(U−w )1n−1 w ≥ G/N/W, and subgroups B1 and nw(U−w )1n−1 w have trivial intersection; so we take them as our X and Y , respectively. Finally we verify from Table 4 that in all cases we have f (G/N) ≥ W. Thus XNY ≥ NG/N/W ≥ NG/N/f (G/N) ≥ G/f (G) where we used the fact that f is increasing. 3. G/N is a one of the 26 sporadic groups or the Tits group. In this case, we can take X = Y = {1}, by choosing c in the definition of f (x) sufficiently large. 3.3.5 Putting it together Using the structural theorem and the new triple-subgroup reduction recursively, we obtain our final result: Theorem 3.11 (main). For any finite group G, there is an arithmetic algorithm computing generalized DFTs with respect to G, using O(Gω/2+ǫ) operations, for any ǫ > 0. Proof. Fix an arbitrary ǫ > 0. Consider the following recursive algorithm to compute a G-DFT. If G is trivial then computing a G-DFT is as well. If G has a proper subgroup H of order larger than G1−ǫ/2 then we apply Theorem 3.1 to compute a G-DFT via several H-DFTs. Otherwise, applying Theorem 3.10, we obtain a (possibly trivial) normal subgroup N , and two proper subgroups of G, H and K, with N = H ∩ K. If G/N is cyclic of prime order, we apply Corollary 3.3 to compute a G-DFT via several N -DFTs. Otherwise, we apply Theorem 3.9 to compute a G-DFT via several H-DFTs, K-DFTS, and inverse N -DFTs. Let T (n) denote an upper bound on the operation count of this recursive algorithm for any group of order n. We will prove by induction on n, that there is a universal constant Cǫ for which T (n) ≤ Cǫnω/2+ǫ log n. In the case that we apply Theorem 3.1, the cost is the cost of [G : H] many H-DFTs plus A0[G : H]Gω/2+ǫ/2 operations (where A0 is the constant hidden in the big-oh), and by induction this is at most: Cǫ[G : H]Hω/2+ǫ log H + A0[G : H]Gω/2+ǫ/2 ≤ CǫGω/2+ǫ(log G − 1) + A0Gω/2+ǫ which is indeed less than CǫGω/2+ǫ log G provided Cǫ ≥ A0. operations, which by induction is at most In the case that we apply Corollary 3.3, our cost is p many N -DFTs, plus A1Gω/2+ǫ) Cǫp(G/p)ω/2+ǫ log(G/p) + A1Gω/2+ǫ ≤ CǫGω/2+ǫ(log G − 1) + A1Gω/2+ǫ, which is indeed less than CǫGω/2+ǫ log G provided Cǫ ≥ A1. 14 Finally, in the case that we apply Theorem 3.9, let A2 be the maximum of the constants hidden in the big-ohs in the statement of the Theorem (applied with ǫ/2). Note that by selecting Cǫ sufficiently large, we may assume that G is sufficiently large, so that two inequalities hold: A2H/N logH/N ≤ K/N ≤ H/Nω/2+ǫ 4A2f (G) log G K/Nω/2+ǫ 4A2f (G) log G and this is possible because Theorem 3.10 implies that H/N (resp. K/N) are at least H) would exceed G1−ǫ/2. Our cost is K/N many Gǫ/2/f (G), as otherwise K (resp. H-DFTs, A2HK/N2 log H/N many inverse N -DFTs, A2H/N log H/N many K-DFTs, plus A2Gω/2+ǫ/2 operations, all repeated A2G log G/HK ≤ A2f (G) log G times. By induction, this is at most (cid:16)CǫK/NHω/2+ǫ log H + CǫA2HK/N2 log H/NNω/2+ǫ log N CǫA2H/N log H/NKω/2+ǫ log K + A2Gω/2+ǫ/2(cid:17) · A2f (G) log G Now the first three summands are each at most CǫGω/2+ǫ log G 4A2f (G) log G as is the fourth summand provided G is sufficiently large. Thus the entire expression is at most CǫGω/2+ǫ log G, as required. This completes the proof. 4 Open problems Is there a proof of Theorem 3.10 that does not need the Classification Theorem? A second question is whether the dependence on ω can be removed. Alternatively, can one show that a running time that depends on ω is necessary by showing that an exponent-one DFT for a certain family of groups would imply ω = 2? Acknowledgements. We thank Jonah Blasiak, Tom Church, and Henry Cohn for useful discussions during an AIM SQuaRE meeting. References [Bau91] Ulrich Baum. Existence and efficient construction of fast Fourier transforms on su- persolvable groups. computational complexity, 1(3):235 -- 256, Sep 1991. [BCS97] P. Burgisser, M. Clausen, and M. A. Shokrollahi. Algebraic Complexity Theory, volume 315 of Grundlehren der mathematischen Wissenschaften. Springer-Verlag, 1997. [Bet84] Thomas Beth. Verfahren der schnellen Fourier-Transformation. Teubner, 1984. [Car89] Roger W Carter. Simple groups of Lie type, volume 22. John Wiley & Sons, 1989. [CB93] Michael Clausen and Ulrich Baum. Fast Fourier transforms. Wissenschaftsverlag, 1993. [Cla89] Michael Clausen. Fast generalized Fourier transforms. Theoretical Computer Science, 67(1):55 -- 63, 1989. 15 [CT65] [HJ91] James W. Cooley and John W. Tukey. An algorithm for the machine calculation of complex fourier series. Mathematics of Computation, 19(90):297 -- 301, 1965. Roger A. Horn and Charles R. Johnson. Topics in Matrix Analysis. Cambridge University Press, 1991. [HU18a] Chloe Ching-Yun Hsu and Chris Umans. A fast generalized DFT for finite groups of lie type. In Artur Czumaj, editor, Proceedings of the Twenty-Ninth Annual ACM- SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 1047 -- 1059. SIAM, 2018. [HU18b] Chloe Ching-Yun Hsu and Chris Umans. A new algorithm for fast generalized DFTs. CoRR, abs/1707.00349v3, 2018. Full version of [HU18a]. [Lev92] Arieh Lev. On large subgroups of finite groups. Journal of Algebra, 152(2):434 -- 438, 1992. [Mas98] David Keith Maslen. The efficient computation of Fourier transforms on the sym- metric group. Math. Comput., 67(223):1121 -- 1147, 1998. [MR97a] David Maslen and Daniel Rockmore. Separation of variables and the computation of Fourier transforms on finite groups, I. Journal of the American Mathematical Society, 10(1):169 -- 214, 1997. [MR97b] David K Maslen and Daniel N Rockmore. Generalized FFTs -- a survey of some recent results. In Groups and Computation II, volume 28, pages 183 -- 287. American Mathematical Soc., 1997. [MRW16] David Maslen, Daniel N Rockmore, and Sarah Wolff. The efficient computation of Fourier transforms on semisimple algebras. arXiv preprint arXiv:1609.02634, 2016. To appear in Journal of Fourier Analysis and Applications. [Roc95] Daniel N. Rockmore. Fast Fourier transforms for wreath products. Applied and Computational Harmonic Analysis, 2(3):279 -- 292, 1995. [Roc02] Daniel N Rockmore. Recent progress and applications in group FFTs. In Signals, Systems and Computers, 2002. Conference Record of the Thirty-Sixth Asilomar Con- ference on, volume 1, pages 773 -- 777. IEEE, 2002. [Wik17] Wikipedia. List of finite simple groups -- wikipedia, the free encyclopedia, 2017. [Online; accessed 30-June-2017]. 16 x1 x2 x3 x′ 4 x′′ 4 · = y1 y2 y3 1 2 3 · u1 u2 u3 = v1 v2 v3 4 5 y4 (= y′ 4 + y′′ 4 ) 2 1 x1 u1 x2 u2 y2 v1 y1 v2 · 3 4 5 x3 u3 x′ 4 = x′′ 4 y3 y′ 4 v3 y′′ 4 Figure 2: How the fℓ functions are defined and used. The bold columns of the block-diagonal matrix in the upper-left are associated to the columns of the target block-diagonal matrix on the bottom-left. The columns of the block-diagonal matrix in the upper-right are also associated the manner described in Section 3.3.1, although this association is not shown in the figure. We see that the two matrix-vector multiplications at the top can be combined into the single matrix product on the bottom, provided that similarly labeled entries of the two source matrices are guaranteed to contain identical values. Unlabeled cells of the middle-bottom matrix contain zeros. Note that in the bottom-right matrix each segment of the original vectors y and v may be padded up to twice 4 and y′′ its original length (but not more), and it may be repeated up to twice and summed (as y′ 4 are) if the columns of the associated block are mapped to two different blocks in the target matrix. More than two repetitions are not possible because the source blocks all have at most as many columns as rows. 17 a b c d e f g h i Aσ j k l m a b c d e f g n p q r h i Aσ′ p q r a b c d e f g n h i j k l m parent of {Aσ′ , Aσ} Figure 3: An example parent matrix. Unlabeled entries are zero. Name Chevalley W Family (ℓ + 1)! Aℓ(q) 2ℓℓ! Bℓ(q) 2ℓℓ! Cℓ(q) 2ℓ−1ℓ! Dℓ(q) O(1) Exceptional E6(q) O(1) E7(q) Chevalley O(1) E8(q) O(1) F4(q) O(1) G2(q) 2Aℓ(q2) 2⌈ℓ/2⌉⌈ℓ/2⌉! 2ℓ−1(ℓ − 1)! 2Dℓ(q2) 2E6(q2) O(1) 3D4(q3) O(1) 2B2(q), q = 22n+1 O(1) 2F4(q), q = 32n+1 O(1) 2G2(q), q = 32n+1 O(1) Steinberg Suzuki Ree G qΘ(ℓ2) qΘ(ℓ2) qΘ(ℓ2) qΘ(ℓ2) qΘ(1) qΘ(1) qΘ(1) qΘ(1) qΘ(1) qΘ(ℓ2) qΘ(ℓ2) qΘ(1) qΘ(1) qΘ(1) qΘ(1) qΘ(1) Figure 4: Families of finite groups G of Lie type, together with the size of their associated Weyl group W . These include all simple finite groups other than cyclic groups, the alternating groups, the 26 sporadic groups, and the Tits group. See [Lev92, Wik17, Car89] for sources. The Suzuki, Steinberg and Ree families are also called the twisted Chevalley groups. 18
1011.1168
2
1011
2011-03-21T13:38:25
Santa Claus Schedules Jobs on Unrelated Machines
[ "cs.DS" ]
One of the classic results in scheduling theory is the 2-approximation algorithm by Lenstra, Shmoys, and Tardos for the problem of scheduling jobs to minimize makespan on unrelated machines, i.e., job j requires time p_{ij} if processed on machine i. More than two decades after its introduction it is still the algorithm of choice even in the restricted model where processing times are of the form p_{ij} in {p_j, \infty}. This problem, also known as the restricted assignment problem, is NP-hard to approximate within a factor less than 1.5 which is also the best known lower bound for the general version. Our main result is a polynomial time algorithm that estimates the optimal makespan of the restricted assignment problem within a factor 33/17 + \epsilon \approx 1.9412 + \epsilon, where \epsilon > 0 is an arbitrarily small constant. The result is obtained by upper bounding the integrality gap of a certain strong linear program, known as configuration LP, that was previously successfully used for the related Santa Claus problem. Similar to the strongest analysis for that problem our proof is based on a local search algorithm that will eventually find a schedule of the mentioned approximation guarantee, but is not known to converge in polynomial time.
cs.DS
cs
Santa Claus Schedules Jobs on Unrelated Machines Ola Svensson ([email protected]) Royal Institute of Technology - KTH Stockholm, Sweden October 23, 2018 Abstract One of the classic results in scheduling theory is the 2-approximation algorithm by Lenstra, Shmoys, and Tardos for the problem of scheduling jobs to minimize makespan on unrelated machines, i.e., job j requires time pij if processed on machine i. More than two decades after its introduction it is still the algorithm of choice even in the restricted model where processing times are of the form pij ∈ {pj,∞}. This problem, also known as the restricted assignment problem, is NP-hard to approximate within a factor less than 1.5 which is also the best known lower bound for the general version. Our main result is a polynomial time algorithm that estimates the optimal makespan of the restricted assignment problem within a factor 33/17 +  ≈ 1.9412 + , where  > 0 is an arbitrarily small constant. The result is obtained by upper bounding the integrality gap of a certain strong linear program, known as configuration LP, that was previously successfully used for the related Santa Claus problem. Similar to the strongest analysis for that problem our proof is based on a local search algorithm that will eventually find a schedule of the mentioned approximation guarantee, but is not known to converge in polynomial time. Introduction 1 Scheduling on unrelated machines is the model where we are given a set J of jobs to be processed without interruption on a set M of unrelated machines, where the time a machine i ∈ M needs to process a job j ∈ J is specified by a machine and job dependent processing time pij ≥ 0. When considering a scheduling problem the most common and perhaps most natural objective function is makespan minimization. This is the problem of finding a schedule, also called an assignment, σ : J (cid:55)→ M so as to minimize the time maxi∈M(cid:80) j∈σ−1(i) pij required to process all the jobs. A classic result in scheduling theory is Lenstra, Shmoys, and Tardos' 2-approximation algorithm for this basic problem [13]. Their approach is based on several nice structural properties of the extreme point solutions of a natural linear program and has become a text book example of such techniques (see, e. g., [18]). Complementing their positive result they also proved that the problem is NP-hard to approximate within a factor less than 1.5 even in the restricted case when pij ∈ {pj,∞} (i. e., when job j has processing time pj or ∞ for each machine). This problem is also known as the restricted assignment problem and, although it looks easier than the general version, the algorithm of choice has been the same 2-approximation algorithm as for the general version. Despite being a prominent open problem in scheduling theory, there has been very little progress on either the upper or lower bound since the publication of [13] over two decades ago. One of the biggest hurdles for improving the approximation guarantee has been to obtain a good lower bound on the optimal makespan. Indeed, the considered linear program has been useful for generalizations 1 such as introducing job and machine dependent costs [16, 17] but is known to have an integrality gap of 2 − 1/M even in the restricted case. We note that Shchepin and Vakhania [15] presented a rounding achieving this gap slightly improving upon the approximation ratio of 2. In a relatively recent paper, Ebenlendr et al. [6] overcame this issue in the special case of the restricted assignment problem where a job can be assigned to at most two machines. Their strategy was to add more constraints to the studied linear program, which allowed them to prove a 1.75- approximation algorithm for this special case that they named Graph Balancing. The name arises naturally when interpreting the restricted assignment problem as a hypergraph with a vertex for each machine and a hyperedge Γ(j) = {i ∈ M : pij = pj} for each job j ∈ J that is incident to the machines it can be assigned to. As pointed out by the authors of [6] it seems difficult to extend their techniques to hold for more general cases. In particular, it can be seen that the considered linear program has an integrality gap of 2 when we allow jobs that can be assigned to 3 machines. In this paper we overcome this obstacle by considering a certain strong linear program, often referred to as configuration LP. In particular, we obtain the first asymptotic improvement on the approximation factor of 2. Theorem 1.1 There is a polynomial time algorithm that estimates the optimal makespan of the restricted assignment problem within a factor of 33/17+ ≈ 1.9412+, where  > 0 is an arbitrarily small constant. We note that our proof gives a local search algorithm to also find a schedule with performance guarantee 33 17 but it is not known to converge in polynomial time. find an assignment σ so as to maximize mini∈M(cid:80) Our techniques are based on the recent development on the related Santa Claus problem. In the Santa Claus problem we are given the same input as in the considered scheduling problem but instead of wanting to minimize the maximum we wish to maximize the minimum, i. e., to j∈σ−1(i) pij. The playful name now follows from associating the machines with kids and jobs with presents. Santa Claus' problem then becomes to distribute the presents so as to make the least happy kid as happy as possible. The problem was first considered under this name by Bansal and Sviridenko [3]. They for- mulated and used the configuration LP to obtain an O(log log log M/ log log M)-approximation algorithm for the restricted Santa Claus problem, where pij ∈ {pj, 0}. They also proved several structural properties that were later used by Feige [7] to prove that the integrality gap of the con- figuration LP is in fact constant in the restricted case. The proof is based on repeated use of Lov´asz local lemma and was only recently turned into a polynomial time algorithm [9]. The approximation guarantee obtained by combining [7] and [9] is a large constant and the techniques do not seem applicable to the considered problem. This is because the methods rely on structural properties that are obtained by rounding the input and such a rounding applied to the scheduling problem would rapidly eliminate any advantage obtained over the current approximation ratio of 2. Instead, our techniques are mainly inspired by a paper of Asadpour et al. [1] who gave a tighter analysis of the configuration LP for the restricted Santa Claus problem. More specifically, they proved that the integrality gap is lower bounded by 1/4 by designing a local search algorithm that eventually finds a solution with the mentioned approximation guarantee, but is not known to converge in polynomial time. Similar to their approach, we formulate the configuration LP and show that its integrality gap is upper bounded by 33/17 by designing a local search algorithm. As the configuration LP can be solved in polynomial time up to any desired accuracy [3], this implies Theorem 1.1. Although we cannot prove that the local search converges in polynomial time, our results imply that the configuration LP gives a polynomial time computable lower bound on the optimal makespan that 2 is strictly better than two. We emphasize that all the results related to hardness of approximation remain valid even for estimating the optimal makespan. Before proceeding, let us mention that unlike the restricted assignment problem, the special case of uniform machines and that of a fixed number of machines are both significantly easier to approximate and are known to admit polynomial time approximation schemes [10, 11, 12]. Also scheduling jobs on unrelated machines to minimize weighted completion time instead of makespan has a better approximation algorithm with performance guarantee 1.5 [14]. The Santa Claus problem has also been studied under the name Max-Min Fair Allocation and there have been several recent results for the general version of the problem (see e.g. [2, 4, 5]). Compared to [1], our analysis is more complex and relies on the special structure of the dual of the linear program. To illustrate the main techniques, we have therefore chosen to first present the analysis for the case of only two job sizes (Section 3) followed by the general case in Section 4. 2 Preliminaries As we consider the restricted case with pij ∈ {pj,∞}, without ambiguity, we refer to pj as the size j∈J (cid:48) pj and often write p(j) for p({j}), which of of job j. For a subset J (cid:48) ⊆ J we let p (J (cid:48)) =(cid:80) course equals pj. We now give the definition of the configuration LP for the restricted assignment problem. Its intuition is that a solution to the scheduling problem with makespan T assigns a set of jobs, referred to as a configuration, to each machine of total processing time at most T . Formally, we say that a subset C ⊆ J of jobs is a configuration for a machine i ∈ M if it can be assigned without violating a given target makespan T , i.e., C ⊆ {j : i ∈ Γ(j)} and p(C) ≤ T . Let C(i, T ) be the set of configurations for machine i ∈ M with respect to the target makespan T . The configuration LP has a variable xi,C for each configuration C for machine i and two sets of constraints: (cid:88) (cid:88) (cid:88) C∈C(i,T ) C(cid:51)j i [C-LP] xi,C ≤ 1 i ∈ M j ∈ J xi,C ≥ 1 x ≥ 0 The first set of constraints ensures that each machine is assigned at most one configuration and the second set of constraints says that each job should be assigned (at least) once. Note that if [C-LP] is feasible with respect to some target makespan T0 then it is also feasible with respect to all T ≥ T0. Let OP TLP denote the minimum over all such values of T . Since an optimal schedule of makespan OP T defines a feasible solution to [C-LP] with T = OP T , we have OP TLP ≤ OP T . To simplify notation we will assume throughout the paper that OP TLP = 1 and denote C(i, 1) by C(i). This is without loss of generality since it can be obtained by scaling processing times. Although [C-LP] might have exponentially many variables, it can be solved (and OP TLP can be found by binary search) in polynomial time up to any desired accuracy  > 0 [3]. The strategy of [3] is to design a polynomial time separation oracle for the dual and then solve it using the ellipsoid method. To obtain the dual, we associate a dual variable yi with i ∈ M for each constraint from the first set of constraints and a dual variable zj with j ∈ J for each constraint from the second set of constraints. Assuming that the objective of [C-LP] is to maximize an objective function with zero coefficients then gives the dual: 3 Dual of [C-LP] min zj i ∈ M, C ∈ C(i) zj yi −(cid:88) j∈J (cid:88) yi ≥(cid:88) i∈M j∈C y, z ≥ 0 Let us remark that, given a candidate solution (y∗, z∗), the separation oracle has to find a violated constraint if any in polynomial time and this is just m knapsack problems: for each i ∈ M solve the knapsack problem with capacity 1 and an item with weight pj and profit zj for each j ∈ J with i ∈ Γ(j). By rounding job sizes as explained in [3], we can thus solve [C-LP] in polynomial time up to any desired accuracy. 3 Overview of Techniques: Jobs of Two Sizes We give an overview of the main techniques used by considering the simpler case when we have jobs of two sizes: small jobs of size  and big jobs of size 1. Already for this case all previously considered linear programs have an integrality gap of 2. In contrast we show the following for [C-LP]. Theorem 3.1 If an instance of the scheduling problem only has jobs of sizes  ≥ 0 and 1 then [C-LP] has integrality gap at most 5/3 + . Throughout this section we let R = 2/3 + . The proof strategy is to design a local search algorithm that returns a solution with makespan at most 1 + R, assuming the [C-LP] is feasible. The algorithm starts with a partial schedule σ with no jobs assigned to any machine. It will then repeatedly call a procedure, summarized in Algorithm 1, that extends the schedule by assigning a new job until all jobs are assigned. When assigning a new job we need to ensure that σ will still have a makespan of at most 1 + R. This might require us to also update the schedule σ by moving already assigned jobs. For an example, consider Figure 1 where we have a partial schedule and wish to assign a new big job jnew. In the first step we try to assign jnew to M1 but discover that M1 has too high load, i.e., the set of jobs assigned to M1 have total processing time such that assigning jnew to M1 would violate the target makespan 1 + R. Therefore, in the second step we try to move jobs from M1 to M2 but M2 has also too high load. Instead, we try to move jnew to M3. As M3 already has a big job assigned we need to first reassign it. We try to reassign it to M4 in the fourth step. In the fifth step we manage to move small jobs from M4 to M3, which makes it possible to also move the big job assigned to M3 to M4 and finally assign jnew to M3. Valid schedule and move. As alluded to above, the algorithm always maintains a valid partial schedule by moving already assigned jobs. Let us formally define these concepts. Definition 3.2 A partial schedule is an assignment σ : J (cid:55)→ M ∪ {T BD} with the meaning that a job j with σ(j) = T BD is not assigned. A partial schedule is valid if each machine i ∈ M is assigned at most one big job and p(σ−1(i)) ≤ 1 + R. That i is assigned at most one big job is implied here by p(σ−1(i)) ≤ 1 + R but will be used for the general case in Section 4. Note also that with this notation a normal schedule is just a partial schedule σ with σ−1(T BD) = ∅. 4 Figure 1: Possible steps when moving jobs to assign a new job jnew. Big and small jobs depicted in dark and light grey, respectively. Definition 3.3 A move is a tuple (j, i) of a job j ∈ J and a machine i ∈ Γσ(j), where Γσ(j) = Γ(j) \ {σ(j)} denotes the machines to which j can be assigned apart from σ(j). The main steps of the algorithm are the following. At the start it will try to choose a valid assignment of jnew to a machine, i.e., that can be made without violating the target makespan. If no such assignment exists then the algorithm adds the set of jobs that blocked the assignment of jnew to the set of jobs we wish to move. It then repeatedly chooses a move of a job j from the set of jobs that is blocking the assignment of jnew. If the move of j is valid then this will intuitively make more space for jnew. Otherwise the set of jobs blocking the move of j is added to the list of jobs we wish to move and the procedure will in the next iteration continue to move jobs recursively. To ensure that we will be able to eventually assign a new job jnew it is important which moves we choose. The algorithm will choose between certain moves that we call potential moves, defined so as to guarantee (i) that the procedure terminates and that (ii) if no potential move exists then we shall be able to prove that the dual of [C-LP] is unbounded, contradicting the feasibility of the primal. For this reason, we need to remember to which machines we have already tried to move jobs and which jobs we wish to move. We next describe how the algorithm keeps track of its history and how this affects which move we choose. We then describe the types of potential moves that the algorithm will choose between. Tree of blockers. To remember its history, Algorithm 1 has a dynamic tree T of so-called blockers that "block" moves we wish to do. Blockers of T have both tree and linear structure. The linear structure is simply the order in time the blockers were added to T . To distinguish between the two we will use child and parent to refer to the tree structure; and after and before to refer to the linear structure. We also use the convention that the blockers B0, B1, . . . , Bt of T are indexed according to the linear order. Definition 3.4 A blocker B is a tuple that contains a subset J (B) ⊆ J of jobs and a machine M(B) that takes value ⊥ if no machine is assigned to the blocker. To simplify notation, we refer to the machines and jobs in T by M(T ) and J (T ), respectively. We will conceptually distinguish between small and big blockers and use MS(T ) and MB(T ) to 5 123456M1M2M3M1M2M1M2M1M4M3M4M3M4M3M2M1M2M1jnewjnewjnewjnewjnew refer to the subsets of M(T ) containing the machines in small and big blockers, respectively. To be precise, this convention will add a bit to the description of a blocker so as to keep track of whether a blocker is small or big. The algorithm starts by initializing the tree T with a special small blocker B as root. Blocker B is special in the sense that it is the only blocker with no machine assigned, i.e., M(B) = ⊥. Its job set J (B) includes the job jnew we wish to assign. The next step of the procedure is to repeatedly try to move jobs, until we can eventually assign jnew. During its execution, the procedure also updates T based on which move that is chosen so that 1. MS(T ) contains those machines to which the algorithm will not try to move any jobs; 2. MB(T ) contains those machines to which the algorithm will not try to move any big jobs; 3. J (T ) contains those jobs that the algorithm wishes to move. Potential moves. For a move (j, i) to be useful it should be of some job j ∈ J (T ) as this set contains those jobs we wish to move to make space for the unassigned job jnew. In addition, the move (j, i) should have a potential of succeeding and be to a machine i where j is allowed to be moved according to T . We refer to such moves as potential moves and a subset of them as valid moves. The difference is that for a potential move to succeed it might be necessary to recursively move other jobs whereas a valid move can be done immediately. With this intuition, let us now define these concepts formally. Definition 3.5 A move (j, i) of a job j ∈ J (T ) is a potential small move: if j is small and i (cid:54)∈ MS(T ); big-to-small move: if j is big, i (cid:54)∈ M(T ), p(Si) ≤ R, and no big job is assigned to i; big-to-big move: where Si = {j ∈ σ−1(i) : j is small with Γσ(j) ⊆ MS(T )}. A potential move (j, i) is valid if the update σ(j) ← i results in a valid schedule. if j is big, i (cid:54)∈ M(T ), p(Si) ≤ R, and a big job is assigned to i; Note that Si refers to those small jobs assigned to i with no potential moves with respect to the current tree. The condition p(Si) ≤ R for big moves enforces that we do not try to move big jobs to machines where the load cannot decrease to at most R without removing a blocker already present in T . The algorithm's behavior depends on the type of the chosen potential move, say (j, i) of a job j ∈ J (B) for some blocker B: • If (j, i) is a valid move then the schedule is updated by σ(j) ← i. Moreover, T is updated by removing B and all blockers added after B. This will allow us to prove that the procedure terminates with the intuition being that B blocked some move (j(cid:48), i(cid:48)) that is more likely to succeed now after j was reassigned. • If (j, i) is a potential small or big-to-small move that is not valid then the algorithm adds a small blocker BS as a child to B that consists of the machine i and contains all jobs assigned to i that are not already in T . Note that after this, since BS is a small blocker no other jobs will be tried to be moved to i. The intuition of this being that assigning more jobs to i would make it less likely to be able to assign j to i in the future. 6 • If (j, i) is a potential big-to-big move then the algorithm adds a big blocker BB as child to B that consists of the machine i and the big job that is assigned to i. Since BB is a big blocker this prevents us from trying to assign more big jobs to i but at the same time allow us to try to assign small jobs. The intuition being that this will not prevent us from assigning j to i if the big job currently assigned to i is reassigned. We remark that the rules on how to update T are so that a job can be in at most one blocker whereas a machine can be in at most two blockers (this happens if it is first added in a big blocker and then in a small blocker). Returning to the example in Figure 1, we can see that after Step 4, T consists of the special root blocker with two children, which in turn have a child each. Machines M1, M2 and M4 belong to small blockers whereas M3 belongs to a big blocker. Moreover, the moves chosen in the first, second, and the third step are big-to-small, small, and big-to-big, respectively, and from Step 5 to 6 a sequence of valid moves is chosen. In a specific iteration there might be several potential moves available. For Values of moves. the analysis it is important that they are chosen in a specific order. Therefore, we assign a vector in R2 to each move and Algorithm 1 will then choose the move with minimum lexicographic value. Definition 3.6 If we let Li = σ−1(i) then a potential move (j, i) has value  Val(j, i) = (0, 0) (1, p(Li)) (2, p(Li)) (3, 0) if valid, if small move, if big-to-small, if big-to-big, Note that as the algorithm chooses moves of minimum lexicographic value, it always chooses a valid move if available and a potential small move before a potential move of a big job. The algorithm. Algorithm 1 summarizes the algorithm discussed above in a concise definition. Given a valid partial schedule σ and an unscheduled job jnew, we prove that the algorithm preserves a valid schedule by moving jobs until it can assign jnew. Repeating the procedure by choosing a unassigned job in each iteration until all jobs are assigned then yields Theorem 3.1. 3.1 Analysis Since the algorithm only updates σ if a valid move was chosen we have that the schedule stays valid throughout the execution. It remains to verify that the algorithm terminates and that there always is a potential move to choose. T we will let Before proceeding with the proofs, we need to introduce some notation. When arguing about • Tt be the subtree of T induced by the blockers B0, B1, . . . , Bt; • S(Tt) = {j ∈ J : j is small with Γσ(j) ⊆ MS(Tt)} and often refer to S(T ) by simply S; and • Si(Tt) = σ−1(i) ∩ S(Tt) (often refer to Si(T ) by Si). 7 Choose a potential move (j, i) with j ∈ J (T ) of minimum lexicographic value Let B be the blocker in T such that j ∈ J (B) if (j, i) is valid then Update the schedule by σ(j) ← i Update T by removing B and all blockers added after B Add a small blocker BS as child to B with M(BS) = i and J (BS) = σ−1(i) \ J (T ) else if (j, i) is either a potential small move or a potential big-to-small move then else {(j, i) is a big-to-big move} Algorithm 1 SimpleExtendSchedule(σ, jnew) 1: Initialize T with the root J (B) = {jnew} and M(B) = ⊥ 2: while σ(jnew) is TBD do 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: end while 15: return σ Let jB be the big job such that σ(jB) = i Add a big blocker BB as a child to B with J (BB) = {jB} and M(BB) = i end if The set S(Tt) contains the set of small jobs with no potential moves with respect to Tt. Therefore no job in S(Tt) has been reassigned since Tt became a subtree of T , i.e., since Bt was added. We can thus omit the dependence on σ when referring to S(Tt) and Si(Tt) without ambiguity. A related observation that will be useful throughout the analysis is the following. No job in a blocker B of T has been reassigned after B was added since that would have caused the algorithm to remove B (and all blockers added after B). We now continue by first proving that there always is a potential move to choose if [C-LP] is feasible followed by the proof that the procedure terminates in Section 3.1.2. 3.1.1 Existence of potential moves We prove that the algorithm never gets stuck if the [C-LP] is feasible. Lemma 3.7 If [C-LP] is feasible then Algorithm 1 can always choose a potential move. Proof. Suppose that the algorithm has reached an iteration where no potential move is available. We will show that this implies that the dual of [C-LP] is unbounded and we can thus deduce as required that the primal is infeasible in the case of no potential moves. As each solution (y, z) of the dual can be scaled by a scalar α to obtain a new solution (αy, αz), j∈J zj implies unboundedness. We proceed by defining such any solution such that(cid:80) a solution (y∗, z∗): i∈M yi <(cid:80) 2/3 (cid:40) (cid:80) j∈σ−1(i) z∗ pj =  0 ∗ i = y ∗ j = z 1 j if j ∈ J (T ) is big, if j ∈ J (T ) ∪ S is small, otherwise, if i ∈ MS(T ), otherwise. and Let us first verify that (y∗, z∗) is indeed a feasible solution. Claim 3.8 Assuming no potential moves are available, (y∗, z∗) is a feasible solution. 8 i ≥(cid:80) j∈C z∗ Since z∗ j∈C(i) z∗ j ≤(cid:80) i = 1 and (cid:80) j ≤ pj for all j ∈ J , we have that no constraint involving the variable y∗ j for each i ∈ M and each C ∈ C(i). Recall Proof of Claim. We need to verify that y∗ that the total processing time of the jobs in a configuration is at most 1. Also observe that z∗ j = 0 for jobs not in J (T ) ∪ S and we can thus omit such jobs when verifying the constraints. i for i ∈ MS(T ) j∈C(i) pj ≤ 1 for any is violated. Indeed for such a machine i we have y∗ C ∈ C(i). As a small job j ∈ J (T ) with a move (j, i) is a potential move if i (cid:54)∈ MS(T ) and no such moves exist by assumption, no small jobs in J (T ) can be moved to machines in M \ MS(T ). Also, by definition, no small jobs in S can be moved to a machine i (cid:54)∈ MS. This together with the fact that a big job jB has processing time 1 and is thus alone in a configuration gives us that a constraint involving y∗ i ≥ 2/3. Now consider the final case when i (cid:54)∈ M(T ). If a big job in J (T ) has a move to i then since it is not a potential j ≥ p(Si) ≥ move p(Si) > R ≥ 2/3. As z∗ j∈σ−1(i) z∗ 2/3, as required. We can thus conclude that no constraint is violated and (y∗, z∗) is a feasible solution. (cid:3) Having proved that (y∗, z∗) is a feasible solution, the proof of Lemma 3.7 is now completed by As a machine i ∈ MB(T ) has a big job assigned, we have that for those y∗ i for i (cid:54)∈ MS(T ) can only be violated if y∗ j = pj =  for small jobs, we have then y∗ i =(cid:80) i < z∗ jB = 2/3. showing that the value of the solution is negative. i∈M y∗ i <(cid:80) Claim 3.9 We have that(cid:80) Proof of Claim. By the definition of y∗,(cid:88) We proceed by bounding(cid:80) ∗ i = y i∈M j∈J z∗ j . (cid:88) 1 + i∈MS (T ) i∈MS (T ) 1 from above by (cid:88) (cid:88) ∗ z j . i∈MS (T ) j∈σ−1(i) (cid:88) (cid:88) i(cid:54)∈MS (T ) j∈σ−1(i) ∗ z j (1) Let B0, B1, . . . , B(cid:96) be the blockers of T and consider a small blocker Bt for some t = 1, . . . , (cid:96). By the definition of Algorithm 1, Bt was added in an iteration when either a potential small or big-to-small move (j0, it) was chosen with M(Bt) = it. Suppose first that (j0, it) was a potential small move. Then as it was not valid, p(j0) + p(σ−1(it)) > 1 + R. This inequality together with the fact that it is assigned at most one big job jB gives us that if (j0, it) is a small move then (cid:88) j∈σ−1(it) −1(it)) −(cid:0)p(jB) − z ∗ jB ∗ j = p(σ z < R < p(σ −1(it)) = 2 3 = 4 3 . (cid:1) ≥ 1 + R − p(j0) − 1 (cid:88) 3 ∗ j , z j∈σ−1(it) (2) (3) On the other hand, if (j0, it) is a potential big-to-small move then as it was not valid From (2) and (3) we can see that(cid:80) (cid:80) where the equality follows from that it is only assigned small jobs (since we assumed (j0, it) was a big-to-small move). j∈σ−1(i) z∗ j if the number of small blockers added because of small moves is greater than the number of small blockers added because of big-to-small moves. i∈MS (T ) 1 is bounded from above by(cid:80) i∈MS (T ) 9 We proceed by proving this by showing that if Bt is a small blocker added because of a potential big-to-small move then Bt+1 must be a small blocker added because of a small move. Indeed, the definition of a potential big-to-small move (j0, it) and the fact that it was not valid imply that p (Sit(Tt)) ≤ R and p(cid:0)σ −1(it)(cid:1) > R. As there are no big jobs assigned to it (using that (j0, it) was a big-to-small move), the above inequalities give us that there is always a potential small move of a small job assigned to it with respect to Tt. In other words, we have that Bt was not the last blocker added to T and as small potential moves have the smallest lexicographic value (apart from valid moves), Bt+1 must be a small blocker added because of a small move. We can thus "amortize" the load of Bt+1 to increase the load j ≥ 2. (cid:80) Pairing each small blocker Bt added because of a big-to-small moves with the small blocker Bt+1 j∈σ−1(i) z∗ j . of Bt. Indeed, if we let M(Bt+1) = it+1 then (2) and (3) yield(cid:80) j +(cid:80) added because of a small move as above allows us to deduce that MS(T ) ≤(cid:80) j∈σ−1(it+1) z∗ i∈MS (T ) Combining this inequality with (1) yields i ≤ (cid:88) ∗ y (cid:88) i∈M (cid:88) i∈M j∈σ−1(i) (cid:88) j∈J ∗ j = z j − z ∗ z ∗ jnew < j∈σ−1(it) z∗ (cid:88) ∗ z j , j∈J as required. (cid:3) We have proved that there is a solution (y∗, z∗) to the dual that is feasible (Claim 3.8) and has negative value (Claim 3.9) assuming there are no potential moves. In other words, the [C-LP] cannot be feasible if no potential moves can be chosen which completes the proof of the lemma. (cid:3) 3.1.2 Termination We continue by proving that Algorithm 1 terminates. As the algorithm only terminates when a new job is assigned, Theorem 3.1 follows from Lemma 3.10 together with Lemma 3.7 since then we can, as already explained, repeat the procedure until all jobs are assigned. The intuition that the procedure terminates, assuming there always is a potential move, is the following. As every time the algorithm chooses a potential move that is not valid a new blocker is added to the tree and as each machine can be in at most 2M blockers, we have that the algorithm must choose a valid move after at most 2M steps. Such a move will perhaps trigger more valid moves and each valid move makes a potential move previously blocked more "likely". We can now guarantee progress by measuring the "likeliness" in terms of the lexicographic value of the move. Lemma 3.10 Assuming there is always a potential move to choose, Algorithm 1 terminates. Proof. To prove that the procedure terminates we associate a vector, for each iteration, with the dynamic tree T . We will then show that the lexicographic order of these vectors decreases. The vector associated to T is defined as follows. Let B0, B1, . . . , B(cid:96) be the blockers of T . With blocker Bi we will associate the value vector, denoted by Val(Bi), of the move that was chosen in the iteration when Bi was added. The vector associated with T is then simply (Val(B0), Val(B1), . . . , Val(B(cid:96)),∞). If the algorithm adds a new blocker then the lexicographic order clearly decreases as the vector ends with ∞. It remains to verify what happens when blockers are removed from T . In that case 10 let the algorithm run until it chooses a potential move that is not valid or terminates. As blockers will be removed in each iteration until it either terminates or chooses a potential move that is not valid we will eventually reach one of these cases. If the algorithm terminates we are obviously done. Instead, suppose that starting with σ and T the algorithm does a sequence of steps where blockers are removed until we are left with an updated schedule σk, a tree of blockers Tk with k + 1 < (cid:96) blockers, and a potential move (j(cid:48), i(cid:48)) that is not valid is chosen. As a blocker B is removed if a blocker added earlier is removed, we have that Tk equals the subtree of T induced by B0, B1, . . . , Bk. We will thus concentrate on comparing the lexicographic value of (j(cid:48), i(cid:48)) with that of Bk+1. Recall that Val(Bk+1) equals the value of the move that was chosen when Bk+1 was added, say (jt, ik+1) for jt ∈ J (Bt) with 1 ≤ t ≤ k and M(Bk+1) = ik+1. A key observation is that since blocker Bk+1 was removed but not Bk, the most recent move was of a job jk+1 ∈ J (Bk+1) and we have σ(jk+1) = ik+1 and σk(jk+1) (cid:54)= ik+1. Moreover, as (jt, ik+1) was a potential move when Bk+1 was added, it is a potential move with respect to Tk (using that Sik+1 (Tk) has not changed). Using these observations we now show that the lexicographic value of (jt, ik+1) has decreased. As the algorithm always chooses the move of minimum lexicographic value, this will imply Val(j(cid:48), i(cid:48)) < Val(Bk+1) as required. If (jt, ik+1) was a small or big-to-small move then Bk+1 was a small blocker. As no jobs −1 k (ik+1)) < p(σ−1(ik+1)) and we have that the were moved to ik+1 after Bk+1 was added, p(σ lexicographic value of (jt, ik+1) has decreased. Otherwise if (jt, ik+1) was a big-to-big move then jk+1 must be a big job. As we only have jobs of two sizes, the move of the big job jk+1 implies that (jt, ik+1) now is a valid move which contradicts the assumption that the algorithm has chosen a potential but not valid move (j(cid:48), i(cid:48)). We have thus proved that the vector associated to T always decreases. As there are at most 2M blockers in T (one small and one big blocker for each machine) and a vector associated to a (cid:3) blocker can take a finite set of values, we conclude that the algorithm terminates. 4 Proof of Main Result In this section we extend the techniques presented in Section 3 to prove our main result, i.e., that there is a polynomial time algorithm that estimates the optimal makespan of the restricted assignment problem within a factor of 33 constant. More specifically, we shall show the following theorem which clearly implies Theorem 1.1. The small loss of  is as mentioned because the known polynomial time algorithms only solve [C-LP] up to any desired accuracy. 17 +  ≈ 1.9412 + , where  > 0 is an arbitrarily small Theorem 4.1 The [C-LP] has integrality gap at most 33 17 . Throughout this section we let R = 16 17 . The proof follows closely the proof of Theorem 3.1, i.e., we design a local search algorithm that returns a solution with makespan at most 1 + R, assuming the [C-LP] is feasible. The strategy is again to repeatedly call a procedure, now summarized in Algorithm 2, that extends a given partial schedule by assigning a new job while maintaining a valid schedule. Recall that a partial schedule is valid if each machine i ∈ M is assigned at most one big job and p(σ−1(i)) ≤ 1 + R, where now R = 16 17 . We note that a machine is only assigned at most one big job will be a restriction here. Since we allow jobs of any sizes we need to define what big and small jobs are. In addition, we have medium jobs and partition the big jobs into large and huge jobs. 11 Definition 4.2 A job j is called big if pj ≥ 11/17, medium if 11/17 > pj > 9/17, and small if pj ≤ 9/17. Let the sets JB,JM ,JS contain the big, medium, and small jobs, respectively. We will also call a big job j huge if pj ≥ 14/17 and otherwise large. The job sizes are chosen so as to optimize the achieved approximation ratio with respect to the analysis and were obtained by solving a linear program. We shall also need to extend and change some of the concepts used in Section 3. The final goal is still that the procedure shall choose potential moves so as to guarantee (i) that the procedure terminates and that (ii) if no potential move exists then we shall be able to prove that the dual of [C-LP] is unbounded. The main difficulty compared to the case in Section 3 of two job sizes is the following. A key step of the analysis in the case with only small and big jobs was that if small jobs blocked the move of a big job then we guaranteed that one of the small jobs on the blocking machine had a potential small move. This was to allow us to amortize the load when analyzing the dual. In the general case, this might not be possible when a medium job is blocking the move of a huge job. Therefore, we need to introduce a new conceptual type of blockers called medium blockers that will play a similar role as big blockers but instead of containing a single big job they contain at least one medium job that blocks the move of a huge job. Rather unintuitively, we allow for technical reasons large but not medium or huge jobs to be moved to machines in medium blockers. Let us now point out the modifications needed starting with the tree T of blockers. Tree of blockers. Similar to Section 3, Algorithm 2 remembers its history by using the dynamic tree T of blockers. As already mentioned, it will now also have medium blockers that play a similar role as big blockers but instead of containing a single big job they contain a set of medium jobs. We use MM (T ) to refer to the subset of M(T ) containing the machines in medium blockers. As in the case of two job sizes, Algorithm 2 initializes tree T with the special small blocker as root that consists of the job jnew. The next step of the procedure is to repeatedly choose valid and potential moves until we can eventually assign jnew. During its execution, the procedure now updates T based on which move that is chosen so that 1. MS(T ) contains those machines to which the algorithm will not try to move any jobs; 2. MB(T ) contains those machines to which the algorithm will not try to move any huge, large, or medium jobs; 3. MM (T ) contains those machines to which the algorithm will not try to move any huge or medium jobs; 4. J (T ) contains those jobs that the algorithm wishes to move. We can see that small jobs are treated as in Section 3, i.e., they can be moved to all machines apart from those in MS(T ). Similar to big jobs in that section, huge and medium jobs can only be moved to a machine not in M(T ). The difference lies in how large jobs are treated: they are allowed to be moved to machines not in M(T ) but also to those machines only in MM (T ). Potential moves. As before a potential move (j, i) will be called valid if the update σ(j) ← i results in a valid schedule, but the definition of potential moves needs to be extended to include the different job sizes. The definition for small jobs remains unchanged: a move (j, i) of a small job j ∈ J (T ) is a potential small move if i (cid:54)∈ MS(T ). A subset of the potential moves of medium and large jobs will also be called potential small moves. 12 Definition 4.3 A move (j, i) of a medium or large job j ∈ J (T ) satisfying i (cid:54)∈ M(T ) if j is medium and i (cid:54)∈ MB(T ) ∪ MS(T ) if j is large is a potential small move: if i is not assigned a big job. medium/large-to-big: if i is assigned a big job. Note that the definition takes into account the convention that large jobs are allowed to be assigned to machines not in MB(T ) ∪ MS(T ) whereas medium jobs are only allowed to be assigned to machines not in M(T ). The reason for distinguishing between whether i is assigned a big (huge or large) job will become apparent in the analysis. The idea is that if a machine i is not assigned a big job then if it blocks a move of a medium or large job then the dual variables z∗ will satisfy j ≥ 1, which we cannot guarantee if i is assigned a big job since when setting the dual variables we will round down the sizes of big jobs which might decrease the sum by as much as 6/17. (cid:80) j∈σ−1(i) z∗ It remains to define the potential moves of huge jobs. Definition 4.4 A move (j, i) of a huge job j ∈ J (T ) to a machine i (cid:54)∈ M(T ) is a potential huge-to-small move: if no big job is assigned to i and p(j) + p(Si ∪ Mi) ≤ 1 + R; huge-to-big move: if a big job is assigned to i and p(j) + p(Si ∪ Mi) ≤ 1 + R; huge-to-medium move: if p(j) + p(Si) ≤ 1 + R and p(j) + p(Si ∪ Mi) > 1 + R; where Si = {j ∈ σ−1(i) : j is small with Γσ(j) ⊆ MS(T )} and Mi = JM ∩ σ−1(i). Again Si denotes the set of small jobs assigned to i with no potential moves with respect to the current tree. The set Mi contains the medium jobs currently assigned to i. Moves huge-to-small and huge-to-big correspond to the moves big-to-small and big-to-big in Section 3, respectively. The constraint p(j) + p(Si ∪ Mi) ≤ 1 + R says that such a move should only be chosen if it can become valid by not moving any medium jobs assigned to i. The additional move called huge-to-medium covers the case when moving the medium jobs assigned to i is necessary for the move to become valid. Similar to before, the behavior of the algorithm depends on the type of the chosen potential move. The treatment compared to that in Section 3 of valid moves and potential small moves is unchanged; the huge-to-small move is treated as the big-to-small move; and the medium/large-to- big and huge-to-big moves are both treated as the big-to-big move were in Section 3. It remains to specify what Algorithm 2 does in the case when a potential huge-to-medium move (that is not valid) is chosen, say (j, i) of a job j ∈ J (B) for some blocker B. In that case the algorithm adds a medium blocker BM as child to B that consists of the machine i and the medium jobs assigned to i. This prevents other huge or medium jobs to be assigned to i. Also note that constraints p(j) + p(Si) ≤ 1 + R and p(j) + p(Si ∪ Mi) > 1 + R imply that there is at least one medium job assigned to i. We remark that the rules on how to update T is again so that a job can be in at most one blocker whereas a machine can now be in at most three blockers (this can happen if it is first added in a medium blocker, then in a big blocker, and finally in a small blocker). 13 Values of moves. As in Section 3, it is important in which order the moves are chosen, Therefore, we assign a value vector to each potential move and Algorithm 2 chooses then, in each iteration, the move with smallest lexicographic value. Definition 4.5 If we let Li = σ−1(i) then a potential move (j, i) has value  Val(j, i) = (0, 0) (p(j), p(Li)) (2, 0) (3, p(Li)) (4, 0) (5,Li ∩ JM) if valid, if small move, if medium/large-to-big, if huge-to-small, if huge-to-big, if huge-to-medium. Note that as before, the algorithm chooses a valid move if available and a potential small move before any other potential move. Moreover, it chooses the potential small move of the smallest job available. The algorithm. Algorithm 2 summarizes the algorithm concisely using the concepts described previously. Given a valid partial schedule σ and an unscheduled job jnew, we shall prove that it preserves a valid schedule by moving jobs until it can assign jnew. Repeating the procedure until all jobs are assigned then yields Theorem 4.1. Choose a potential move (j, i) with j ∈ J (T ) of minimum lexicographic value Let B be the blocker in T such that j ∈ J (B) if (j, i) is valid then Update the schedule by σ(j) ← i Update T by removing B and all blockers added after B Add a small blocker BS as child to B with M(BS) = i and J (BS) = σ−1(i) \ J (T ); else if (j, i) is either a potential small or huge-to-small move then Algorithm 2 ExtendSchedule(σ, jnew): 1: Initialize T with the root J (B) = {jnew} and M(B) = ⊥ 2: while σ(jnew) is TBD do 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: end while 17: return σ else {(j, i) is a potential huge-to-medium move} end if else if (j, i) is either a potential large/medium-to-big or huge-to-big move then Let jB be the big job such that σ(jB) = i Add a big blocker BB as a child to B in T with J (BB) = {jB} and M(BB) = i Add a medium blocker BM as child to B with M(BM ) = i and J (BM ) = σ−1(i) ∩ JM 4.1 Analysis As Algorithm 1 for the case of two job sizes, Algorithm 2 only updates the schedule if a valid move is chosen so it follows that the schedule stays valid throughout the execution. It remains to verify that the algorithm terminates and that the there always is a potential move to choose. arguing about T we again let The analysis is similar to that of the simpler case but involves more case distinctions. When 14 • Tt be the subtree of T induced by the blockers B0, B1, . . . , Bt; • S(Tt) = {j ∈ J : j is small with Γσ(j) ⊆ MS(Tt)} and often refer to S(T ) by simply S; and • Si(Tt) = σ−1(i) ∩ S(Tt) (often refer to Si(T ) by Si). As in the case of two job sizes, the set S(Tt) contains the set of small jobs with no potential moves with respect to Tt. Therefore no job in S(Tt) has been reassigned since Tt became a subtree of T , i.e., since Bt was added. We can thus again omit without ambiguity the dependence on σ when referring to S(Tt) and Si(Tt). The following observation will again be used throughout the analysis. No job in a blocker B of T has been reassigned after B was added since that would have caused the algorithm to remove B (and all blockers added after B). In Section 4.1.1 we start by presenting the proof that the algorithm always can choose a potential move if [C-LP] is feasible. We then present the proof that the algorithm always terminates in Section 4.1.2. As already noted, by repeatedly calling Algorithm 2 until all jobs are assigned we will, assuming [C-LP] feasible, obtain a schedule of the jobs with makespan at most 1 + R which completes the proof of Theorem 4.1. 4.1.1 Existence of potential moves We prove that the algorithm never gets stuck if the [C-LP] is feasible. Lemma 4.6 If [C-LP] is feasible then Algorithm 2 can always pick a potential move. Proof. Suppose that the algorithm has reached an iteration where no potential move is available. Similar to the proof of Lemma 3.7 we will show that this implies that the dual is unbounded and hence the primal is not feasible. We will do so by defining a solution (y∗, z∗) to the dual with (cid:80) i∈M y∗ i <(cid:80) j∈J z∗ j . Define z∗ and y∗ by ∗ j = z  11/17, 9/17, pj, 0, (cid:40) (cid:80) 1 if j ∈ J (T ) is big, if j ∈ J (T ) is medium, if j ∈ J (T ) ∪ S is small, otherwise, and ∗ i = y if i ∈ MS(T ), otherwise. j∈σ−1(i) z∗ j A natural interpretation of z∗ is that we have rounded down processing times where big jobs with processing times in [11/17, 1] are rounded down to 11/17; medium jobs with processing times in [9/17, 11/17] are rounded down to 9/17; and small jobs are left unchanged. The proof of the lemma is now completed by showing that (y∗, z∗) is a feasible solution (Claim 4.7) and that the objective value is negative (Claim 4.8). Claim 4.7 Assuming no potential moves are available, (y∗, z∗) is a feasible solution. j for each i ∈ M and each C ∈ C(i). Recall Proof of Claim. We need to verify that y∗ that the total processing time of the jobs in a configuration is at most 1. Also observe as in the j = 0 for jobs not in J (T ) ∪ S and we can thus omit them when verifying the simpler case that z∗ constraints. i ≥(cid:80) j∈C z∗ 15 i = 1 and(cid:80) j ≤(cid:80) i j∈C(i) z∗ As in the previous case, no constraint involving the variable y∗ for i ∈ MS(T ) is violated. j∈C(i) pj ≤ 1 for any configuration We continue by distinguishing between the remaining cases when i (cid:54)∈ M(T ), i ∈ MB(T ) \ Indeed, for such a machine i we have y∗ C ∈ C(i). MS(T ), and i ∈ MM (T ) \ (MS(T ) ∪ MB(T )). i (cid:54)∈ M(T ): A move (j, i) to machine i (cid:54)∈ M(T ) is a potential move if j ∈ J (T ) is a small, medium, or large job. By assumption we have thus that no such jobs in J (T ) have any moves to i. We also have, by definition, that no job in S has a move to i (cid:54)∈ MS(T ). Now consider the final case when a huge job jH ∈ J (T ) has a move (jH , i). Then since it is not a potential huge-to-small, huge-to-medium, or huge-to-big move p(jH ) + p(Si) > 1 + R and hence p(Si) > R. Since p(jH ) ≥ 14/17 but z∗ = 11/17 a configuration C ∈ C(i) with jH ∈ C satisfy (cid:18) (cid:19) + (1 − p(jH )) ≤ 11 17 + 1 − 14 17 = 14 17 , (4) jH (cid:88) 17 = R < p(Si) ≤(cid:80) j ≤ z ∗ z j∈C ∗ jH (cid:88) j∈C (cid:88) (cid:88) j∈σ−1(i) z∗ j ≤ y∗ i where we used that Si only contains small which is less than 16 jobs for the second inequality. i ∈ MB(T ) \ MS(T ): A move to machine i (cid:54)∈ MS(T ) is a potential move if j ∈ J (T ) is a small job. By the assumption that there are no potential moves and by the definition of S, we have thus that there is no small job in J (T ) ∪ S with a move to i. In other words, all small jobs with z∗ j > 0 that can be moved to i are already assigned to i. Now let jB be the big job such that σ(jB) = i which must exist since machine i is contained in a big blocker. As both medium and big (large and huge) jobs have processing time strictly greater than 1/2, a configuration C ∈ C(i) can contain at = 11/17 we have that a configuration C ∈ C(i) most one such job j0. Since z∗ with j0 ∈ C cannot violate feasibility. Indeed, ≤ 11/17 and z∗ jB j0 j ≤ z ∗ z ∗ j0 + j ≤ z ∗ z ∗ jB + j∈σ−1(i)\jB j∈σ−1(i)\jB ∗ j = y z ∗ i . (5) If j0 is medium then z∗ ≤ z∗ i ∈ MM (T ) \ (MS(T ) ∪ MB(T )) : By the definition of S and the assumption that there are no potential moves, no small or large jobs in J (T ) ∪ S have any moves to i. As i is contained in a medium blocker, there is a medium job jM such that σ(jM ) = i. As both medium and huge jobs have processing time strictly greater than 1/2, a configuration C ∈ C(i) can contain at most one such job j0. have that(cid:80) j0 jM and we have by Inequality (5) (substituting jB with jM ) that the constraint is not violated. Otherwise if j0 is huge then from (4) (substituting jH with j0) we 17 for any configuration C ∈ C(i) with j0 ∈ C. j ≤ 14 j∈C z∗ If i is assigned more than one i ≥ 1. Instead suppose that the only medium job assigned to i is jM . Since the medium job then y∗ medium blocker BM , with M(BM ) = i and J (BM ) = {jM}, was added to T because the algorithm chose a potential huge-to-medium move we have We shall now show that y∗ 17 which completes this case. i ≥ 14 p(Si(T (cid:48))) + p(jM ) > R. 16 where T (cid:48) refer to the tree of blockers at the time when BM was added. As each blocker in T (cid:48) is also in T , p(Si) ≥ p(Si(T (cid:48))) and the above inequality yields, i ≥ p(Si) + p(jM ) − (p(jM ) − z ∗ y ∗ jM ) ≥ R − − 9 17 ≥ 14 17 , (cid:19) (cid:18) 11 17 as required. (cid:3) We have thus verified all the cases which completes the proof of the claim. Having verified that (y∗, z∗) is a feasible solution, the proof is now completed by showing that the value of the solution is negative. i∈M y∗ Claim 4.8 We have that(cid:80) i <(cid:80) Proof of Claim. By the definition of y∗,(cid:88) Similar to the case with two job sizes in Section 3, we proceed by bounding(cid:80) by (cid:80) j∈J z∗ j . (cid:88) (cid:80) j∈σ−1(i) z∗ (cid:88) (cid:88) i(cid:54)∈MS (T ) i∈MS (T ) j∈σ−1(i) ∗ i = y ∗ z j . i∈M i∈MS (T ) 1 + Bt for some t = 1, . . . , (cid:96) with M(Bt) = it. i∈MS (T ) 1 from above j . Let B0, B1, . . . , B(cid:96) be the blockers of T and consider a small blocker (6) By the definition of the procedure, small blocker Bt has been added in an iteration when either a potential small or huge-to-small move (j0, it) was chosen. Let us distinguish between the three cases when (j0, it) was a small move of a small job, (j0, it) was a small move of a medium or large job, and (j0, it) was a huge-to-small move. (j0, it) was a small move of a small job: Since the move was not valid, p(j0) + p(σ −1(it)) > 1 + R. processing time in [9/17, 11/17] is rounded down to 9/17, the sum (cid:80) (cid:18) 11 As a big job with processing time in [11/17, 1] is rounded down to 11/17 and a medium job with j will depend of Indeed, if we let Lit = σ−1(it) ∩ JB and the number of big and medium jobs assigned to it. (cid:19) Mit = σ−1(it)∩JM be the big and medium jobs assigned to it, respectively. Then on the one hand, Lit − (cid:19) j ≥ 1 + R − p(j0) − ∗ z (cid:18) j∈σ−1(it) z∗ (cid:19) 1 − 11 17 which equals (cid:88) − 9 17 Mit, j∈σ−1(it) (cid:18) 17 33 17 − 6 17 Lit + Mit 3 − p(j0). On the other hand, if (i) Lit ≥ 2, (ii) Lit ≥ 1 and Mi ≥ 1 or (iii) Mit ≥ 3 then clearly Combining these two bounds we get (since j0 is small and thus p(j0) ≤ 9/17) that (cid:88) j∈σ−1(it) (cid:20) 27 17 j ≥ min ∗ z − p(j0), 20 17 ≥ 18 17 if (j0, it) was a small move of a small job. (7) 17 j ≥ 11 ∗ z 17 + 9 17 ≥ 20 17 . j∈σ−1(it) (cid:88) (cid:21) (jo, it) was a small move of a medium or large job: Since the move was not valid, we have again By the definition of potential small moves it must be that there is no big job assigned to it. If there p(j0) + p(σ are more than one medium job assigned to i then clearly(cid:80) j∈σ−1(it) z∗ (cid:19) down from 11/17 to 9/17 we use the inequality p(j0) + p(σ−1(it)) > 1 + R to derive j ≥ 1. Otherwise, if there is at most one medium job assigned to it that might have been rounded −1(it)) > 1 + R. j ≥ 1 + R − p(j0) − ∗ z − 9 17 = 31 17 − p(j0) ≥ 1, (cid:18) 11 17 (cid:88) j∈σ−1(it) For the final inequality we used that the processing time of medium and large jobs is at most 14/17. Summarizing again, we have j ≥ 1 ∗ z if (j0, it) was a potential small move of a medium or large job. (8) (cid:88) j∈σ−1(it) (j0, it) was a huge-to-small move: Similar to the case of two job sizes in Section 3 where we considered the big-to-small move, we will show that we can amortize the cost from the blocker Bt+1. Indeed, since the move (j0, it) was not valid and by the definition of a potential huge-to-small move we have p(j0) + p(σ −1(it)) > 1 + R and p(j0) + p (Sit(Tt) ∪ Mit) ≤ 1 + R, (9) where we let Mit contain the medium jobs assigned to it at the time when Bt was added. Recall that Sit(Tt) contains those small jobs that have no potential moves with respect to the tree of blockers Tt after Bt was added. As Bt has not been removed from T both these sets have not changed. In particular, since it is not assigned a big job (using the definition of huge-to-small move) we have that there must be a small job j(cid:48) ∈ σ−1(it) \ (Sit(Tt) ∪ Mit) that has a potential small (j(cid:48), i(cid:48)) move with respect to Tt. The above discussion implies that t < (cid:96). Moreover, the value of (j(cid:48), i(cid:48)) equals (p(j(cid:48)), p(σ−1(i(cid:48)))). As the procedure always chooses a potential move with minimum lexicographic value we have that Bt+1 is a small blocker added because a potential small move was chosen of a small job with processing time at most p(j(cid:48)). We proceed by showing that we can use this fact to again amortize the cost as done in the simpler analysis, i.e., that ∗ j + z j ≥ 2. ∗ z j∈σ−1(it) j∈σ−1(it+1) (11) For this reason, let us distinguish between three subcases depending on the number of medium jobs assigned to it. it is assigned at least two medium jobs: Since medium jobs have value 9/17 in the dual this clearly j∈σ−1(it) z∗ j ≥ 18/17 so no amortizing is needed and (11) holds in this case. implies that(cid:80) 18 (cid:88) If we let M(Bt+1) = it+1 we have thus by (7) j ≥ min ∗ z (cid:88) j∈σ−1(it+1) (cid:20) 27 17 (cid:88) (cid:21) − p(j (cid:48)), 20 17 ≥ 18 17 . (10) it is assigned one medium job: Let jM denote the medium job assigned to it. In addition we have j ≥ 9/17 + p(j(cid:48)). So if that the small job j(cid:48) is assigned to it. We have thus that(cid:80) p(j(cid:48)) ≥ 7/17 then we can amortize because(cid:80) j∈σ−1(it+1) z∗ Now consider the case when p(j(cid:48)) < 7/17. By the assumption that only one medium job is (cid:19) assigned to it and since p(j0) + p(σ−1(it)) ≥ 1 + R we have j is at least 18/17. j∈σ−1(i) z∗ Moreover, as the case when p(j(cid:48)) < 7/17 is considered, we have from (10) that (cid:88) j∈σ−1(it) (cid:18) 11 17 − 9 17 = 14 17 . j ≥ R − ∗ z (cid:88) j∈σ−1(it+1) j ≥ 20 ∗ 17 , z which implies that (11) is valid also in this case. it is not assigned any medium jobs: As it in this case is not assigned any medium or big jobs and the huge-to-small move (j0, it) was not valid,(cid:88) That we can amortize now follows from (10) that we always have(cid:80) j > R ≥ 16 ∗ z 17 j∈σ−1(it) . j∈σ−1(it+1) z∗ j ≥ 18 17 . We have thus shown that a blocker Bt added because of a huge-to-small move can be paired with the following blocker Bt+1 that was added because of a potential small move of a small job. As seen above this give us that we can amortize the cost exactly as done in the simpler case and we deduce that MS(T ) ≤(cid:80) (cid:88) i∈MS (T ) ∗ i ≤ (cid:88) y (cid:80) j∈σ−1(i) z∗ (cid:88) ∗ j = z (cid:88) j∈J i∈M i∈M j∈σ−1(i) j − z ∗ ∗ jnew < z ∗ z j , (cid:88) j∈J j . Combining this inequality with (1) yields as required. (cid:3) We have proved that there is a solution (y∗, z∗) to the dual that is feasible (Claim 4.7) and has negative value (Claim 4.8) assuming there are no potential moves. In other words, the [C-LP] cannot be feasible if no potential moves can be chosen which completes the proof of the lemma. (cid:3) 4.1.2 Termination As the algorithm only terminates when a new job is assigned, Theorem 4.1 follows from the lemma below together with Lemma 4.6 since then we can, as already explained, repeat the procedure until all jobs are assigned. Lemma 4.9 Assuming there is always a potential move to choose, Algorithm 2 terminates. Proof. As in the proof of Lemma 3.10, we consider the i'th iteration of the algorithm and associate the vector (Val(B1), Val(B2), . . . , Val(B(cid:96)),∞). 19 with T where the blockers are ordered in the order they were added and Val(Bi) equals the value of the move chosen when Bi was added. We shall now prove that the value of the vector associated with T decreases no matter the step chosen in the next iteration. If a new blocker is added in the i + 1'th iteration the lexicographic order clearly decreases as the vector ends with ∞. It remains to verify what happens when blockers are removed from T . In that case let the algorithm run until it chooses a potential move that is not valid or terminates. As blockers will be removed in each iteration until it either terminates or chooses a potential move that is not valid we will eventually reach one of these cases. If the algorithm terminates we are obviously done. Instead, suppose that starting with σ and T the algorithm does a sequence of steps where blockers are removed until we are left with an updated schedule σk, a Tk with k + 1 < (cid:96) blockers, and a potential move (j(cid:48), i(cid:48)) that is not valid is chosen. As a blocker B is removed if a blocker added earlier is removed, we have that Tk equals the subtree of T induced by B0, B1, . . . , Bk. We will thus concentrate on comparing the lexicographic value of (j(cid:48), i(cid:48)) with that of Bk+1. The value of Bk+1 equals of the value of the move chosen when Bk+1 was added, say (jt, ik+1) for jt ∈ J (Bt) with 1 ≤ t ≤ k and M(Bk+1) = ik+1. A key observation is that since blocker Bk+1 was removed but not Bk, the most recent move was of a job jk+1 ∈ J (Bk+1) and we have σ(jk+1) = ik+1 and σk(jk+1) (cid:54)= ik+1. Moreover, as (jt, ik+1) was a potential move when Bk+1 was added, it is a potential move with respect to Tk (using that Sik+1 (Tk) has not changed). Using these observations we now show that the lexicographic value of (jt, ik+1) has decreased. As the algorithm always picks the move of minimum lexicographic value, this will imply Val(j(cid:48), i(cid:48)) < Val(Bk+1) as required. If (jt, ik+1) was a small or huge-to-small move then Bk+1 was a small blocker. As no jobs were −1 k (ik+1)) < p(σ−1(ik+1) and we have that the lexicographic moved to ik+1 after Bk+1 was added, p(σ value of (jt, ik+1) has decreased. If (jt, ik+1) was a medium/large-to-big (or huge-to-big move) then jk+1 must be a big job and hence the machine ik+1 has no longer a big job assigned. This implies that the move (jt, ik+1) is now a potential small (or huge-to-small using that no medium jobs are moved to machines in big blockers) with smaller lexicographic value. Finally, if (jt, ik+1) was a huge-to-medium move then jk+1 must be a medium job and since no −1 medium jobs have potential moves to machines in medium blockers we have that σ k (i) ∩ JM < σ−1(i) ∩ JM which implies that the lexicographic value of (jt, ik+1) also decreased in this case. We have thus proved that the vector associated to T always decreases. As there are at most 3M blockers in T (one small, medium, and big blocker for each machine) and a vector associated to a blocker can take a finite set of values, we conclude that the algorithm eventually terminates. (cid:3) 5 Conclusions We have shown that the configuration LP gives a polynomial time computable lower bound on the optimal makespan that is strictly better than two. Our techniques are mainly inspired by recent developments on the related Santa Claus problem and gives a local search algorithm to also find a schedule of the same performance guarantee, but is not known to converge in polynomial time. Similar to the Santa Claus problem, this raises the open question whether there is an efficient rounding of the configuration LP that matches the bound on the integrality gap (see also [8] for a comprehensive discussion on open problems related to the difference between estimation and approximation algorithms). Another interesting direction is to improve the upper or lower bound 20 on the integrality gap for the restricted assignment problem: we show that it is no worse than 33/17 and it is only known to be no better than 1.5 which follows from the NP-hardness result. One possibility would be to find a more elegant generalization of the techniques, presented in Section 3 for two job sizes, to arbitrary processing times (instead of the exhaustive case distinction presented in this paper). To obtain a tight analysis, it would be natural to start with the special case of graph balancing for which the 1.75-approximation algorithm by Ebenlendr et al. [6] remains the best known. We remark that the restriction pij ∈ {pj,∞} is necessary as the integrality gap of the configuration LP for the general case is known to be 2 even if a job can be assigned to at most 2 machines [19]. 6 Acknowledgements I am grateful to Johan Hastad for many useful insights and comments. I also wish to thank Tobias Momke and Luk´as Pol´acek for useful comments on the exposition. This research is supported by ERC Advanced investigator grant 226203. References [1] A. Asadpour, U. Feige, and A. Saberi. Santa claus meets hypergraph matchings. In Proceed- ings of the 11th international workshop and 12th international workshop on Approximation, Randomization and Combinatorial Optimization, 2008. See authors' homepages for the lower bound of 1/4 instead of the claimed 1/5 in the conference version. [2] A. Asadpour and A. Saberi. An approximation algorithm for max-min fair allocation of indi- visible goods. SIAM Journal on Computing, 39(7):2970 -- 2989, 2010. [3] N. Bansal and M. Sviridenko. The santa claus problem. In Proceedings of the thirty-eighth annual ACM symposium on Theory of computing (STOC), pages 31 -- 40, 2006. [4] M. Bateni, M. Charikar, and V. Guruswami. Maxmin allocation via degree lower-bounded arborescences. In Proceedings of the 41st annual ACM symposium on Theory of computing (STOC), pages 543 -- 552, 2009. [5] D. Chakrabarty, J. Chuzhoy, and S. Khanna. On allocating goods to maximize fairness. In Proceedings of the 2009 50th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 107 -- 116, 2009. [6] T. Ebenlendr, M. Krc´al, and J. Sgall. Graph balancing: a special case of scheduling unrelated parallel machines. In Proceedings of the nineteenth annual ACM-SIAM symposium on Discrete algorithms (SODA), pages 483 -- 490, 2008. [7] U. Feige. On allocations that maximize fairness. In Proceedings of the Nineteenth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 287 -- 293, 2008. [8] U. Feige. On estimation algorithms vs approximation algorithms. In IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS), pages 357 -- 363, 2008. [9] B. Haeupler, B. Saha, and A. Srinivasan. New constructive aspects of the lovasz local lemma. To appear in Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science (FOCS), 2010. 21 [10] D. S. Hochbaum and D. B. Shmoys. A polynomial approximation scheme for scheduling on uniform processors: Using the dual approximation approach. SIAM Journal on Computing, pages 539 -- 551, 1988. [11] E. Horowitz and S. Sahni. Exact and approximate algorithms for scheduling nonidentical processors. Journal of the ACM, 23(2):317 -- 327, 1976. [12] K. Jansen and L. Porkolab. Improved approximation schemes for scheduling unrelated parallel machines. Mathematics of Operations Research, 26:324 -- 338, 2001. [13] J. K. Lenstra, D. B. Shmoys, and E. Tardos. Approximation algorithms for scheduling unre- lated parallel machines. Mathematical Programmming, 46(3):259 -- 271, 1990. [14] A. S. Schulz and M. Skutella. Scheduling unrelated machines by randomized rounding. SIAM Journal on Discrete Mathematics, 15(4):450 -- 469, 2002. [15] E. V. Shchepin and N. Vakhania. An optimal rounding gives a better approximation for scheduling unrelated machines. Operations Research Letters, 33(2):127 -- 133, 2005. [16] D. B. Shmoys and T. ´E. Scheduling unrelated machines with costs. In Proceedings of the Fourth Annual Symposium on Discrete Algorithms (SODA), pages 448 -- 454, 1993. [17] M. Singh. Iterative Rounding and Relaxation. PhD thesis, Carnegie Mellon University, 2008. [18] V. V. Vazirani. Approximation Algorithms. Springer, 2001. [19] J. Verschae and A. Wiese. On the Configuration-LP for scheduling on unrelated machines. CoRR, abs/1011.4957, 2010. 22
1512.00442
3
1512
2017-04-06T06:51:49
Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing
[ "cs.DS", "cs.AI", "cs.IR", "cs.LG", "stat.ML" ]
Existing methods for retrieving k-nearest neighbours suffer from the curse of dimensionality. We argue this is caused in part by inherent deficiencies of space partitioning, which is the underlying strategy used by most existing methods. We devise a new strategy that avoids partitioning the vector space and present a novel randomized algorithm that runs in time linear in dimensionality of the space and sub-linear in the intrinsic dimensionality and the size of the dataset and takes space constant in dimensionality of the space and linear in the size of the dataset. The proposed algorithm allows fine-grained control over accuracy and speed on a per-query basis, automatically adapts to variations in data density, supports dynamic updates to the dataset and is easy-to-implement. We show appealing theoretical properties and demonstrate empirically that the proposed algorithm outperforms locality-sensitivity hashing (LSH) in terms of approximation quality, speed and space efficiency.
cs.DS
cs
Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing Ke Li Jitendra Malik University of California, Berkeley, CA 94720, United States [email protected] [email protected] Abstract Existing methods for retrieving k-nearest neigh- bours suffer from the curse of dimensionality. We argue this is caused in part by inherent de- ficiencies of space partitioning, which is the un- derlying strategy used by most existing methods. We devise a new strategy that avoids partitioning the vector space and present a novel randomized algorithm that runs in time linear in dimensional- ity of the space and sub-linear in the intrinsic di- mensionality and the size of the dataset and takes space constant in dimensionality of the space and linear in the size of the dataset. The proposed algorithm allows fine-grained control over accu- racy and speed on a per-query basis, automati- cally adapts to variations in data density, supports dynamic updates to the dataset and is easy-to- implement. We show appealing theoretical prop- erties and demonstrate empirically that the pro- posed algorithm outperforms locality-sensitivity hashing (LSH) in terms of approximation quality, speed and space efficiency. 1. Introduction The k-nearest neighbour method is commonly used both as a classifier and as subroutines in more complex algorithms in a wide range domains, including machine learning, com- puter vision, graphics and robotics. Consequently, finding a fast algorithm for retrieving nearest neighbours has been a subject of sustained interest among the artificial intelli- gence and the theoretical computer science communities alike. Work over the past several decades has produced a rich collection of algorithms; however, they suffer from one key shortcoming: as the ambient or intrinsic dimen- Proceedings of the 33 rd International Conference on Machine Learning, New York, NY, USA, 2016. JMLR: W&CP volume 48. Copyright 2016 by the author(s). sionality1 increases, the running time and/or space com- plexity grows rapidly; this phenomenon is often known as the curse of dimensionality. Finding a solution to this prob- lem has proven to be elusive and has been conjectured to be fundamentally impossible (Minsky & Seymour, 1969). In this era of rapid growth in both the volume and dimension- ality of data, it has become increasingly important to devise a fast algorithm that scales to high dimensional space. We argue that the difficulty in overcoming the curse of di- mensionality stems in part from inherent deficiencies in space partitioning, the strategy that underlies most exist- ing algorithms. Space partitioning is a divide-and-conquer strategy that partitions the vector space into a finite number of cells and keeps track of the data points that each cell con- tains. At query time, exhaustive search is performed over all data points that lie in cells containing the query point. This strategy forms the basis of most existing algorithms, including k-d trees (Bentley, 1975) and locality-sensitive hashing (LSH) (Indyk & Motwani, 1998). While this strategy seems natural and sensible, it suffers from critical deficiencies as the dimensionality increases. Because the volume of any region in the vector space grows exponentially in the dimensionality, either the number or the size of cells must increase exponentially in the number of dimensions, which tends to lead to exponential time or space complexity in the dimensionality. In addition, space partitioning limits the algorithm's "field of view" to the cell containing the query point; points that lie in adjacent cells have no hope of being retrieved. Consequently, if a query point falls near cell boundaries, the algorithm will fail to retrieve nearby points that lie in adjacent cells. Since the number of such cells is exponential in the dimensionality, it is intractable to search these cells when dimensionality is high. One popular approach used by LSH and spill trees (Liu et al., 2004) to mitigate this effect is to partition the space using overlapping cells and search over all points that lie in any of the cells that contain the query point. Because 1We use ambient dimensionality to refer to the original dimen- sionality of the space containing the data in order to differentiate it from intrinsic dimensionality, which measures density of the dataset and will be defined precisely later. Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing the ratio of surface area to volume grows in dimension- ality, the number of overlapping cells that must be used increases in dimensionality; as a result, the running time or space usage becomes prohibitively expensive as dimen- sionality increases. Further complications arise from vari- ations in data density across different regions of the space. If the partitioning is too fine, most cells in sparse regions of the space will be empty and so for a query point that lies in a sparse region, no points will be retrieved. If the partitioning is too coarse, each cell in dense regions of the space will contain many points and so for a query point that lies in a dense region, many points that are not the true nearest neighbours must be searched. This phenomenon is notably exhibited by LSH, whose performance is highly sensitive to the choice of the hash function, which essen- tially defines an implicit partitioning. A good partitioning scheme must therefore depend on the data; however, such data-dependent partitioning schemes would require possi- bly expensive preprocessing and prohibit online updates to the dataset. These fundamental limitations of space parti- tioning beg an interesting question: is it possible to devise a strategy that does not partition the space, yet still enables fast retrieval of nearest neighbours? In this paper, we present a new strategy for retrieving k-nearest neighbours that avoids discretizing the vector space, which we call dynamic continuous indexing (DCI). Instead of partitioning the space into discrete cells, we con- struct continuous indices, each of which imposes an order- ing on data points such that closeness in position serves as an approximate indicator of proximity in the vector space. The resulting algorithm runs in time linear in ambient di- mensionality and sub-linear in intrinsic dimensionality and the size of the dataset, while only requiring space con- stant in ambient dimensionality and linear in the size of the dataset. Unlike existing methods, the algorithm allows fine-grained control over accuracy and speed at query time and adapts to varying data density on-the-fly while permit- ting dynamic updates to the dataset. Furthermore, the algo- rithm is easy-to-implement and does not rely on any com- plex or specialized data structure. 2. Related Work Extensive work over the past several decades has produced a rich collection of algorithms for fast retrieval of k-nearest neighbours. Space partitioning forms the basis of the ma- jority of these algorithms. Early approaches store points in deterministic tree-based data structures, such as k-d trees (Bentley, 1975), R-trees (Guttman, 1984) and X-trees (Berchtold et al., 1996; 1998), which effectively partition the vector space into a hierarchy of half-spaces, hyper- rectangles or Voronoi polygons. These methods achieve query times that are logarithmic in the number of data to tame the curse of dimensionality, points and work very well for low-dimensional data. Un- fortunately, their query times grow exponentially in ambi- ent dimensionality because the number of leaves in the tree that need to be searched increases exponentially in ambi- ent dimensionality; as a result, for high-dimensional data, these algorithms become slower than exhaustive search. More recent methods like spill trees (Liu et al., 2004), RP trees (Dasgupta & Freund, 2008) and virtual spill trees (Dasgupta & Sinha, 2015) extend these approaches by randomizing the dividing hyperplane at each node. Un- fortunately, the number of points in the leaves increases exponentially in the intrinsic dimensionality of the dataset. In an effort re- searchers have considered relaxing the problem to allow - approximate solutions, which can contain any point whose distance to the query point differs from that of the true nearest neighbours by at most a factor of (1 + ). Tree- based methods (Arya et al., 1998) have been proposed for this setting; unfortunately, the running time still exhibits exponential dependence on dimensionality. Another pop- ular method is locality-sensitive hashing (LSH) (Indyk & Motwani, 1998; Datar et al., 2004), which relies on a hash function that implicitly defines a partitioning of the space. Unfortunately, LSH struggles on datasets with varying den- sity, as cells in sparse regions of the space tend to be empty and cells in dense regions tend to contain a large number of points. As a result, it fails to return any point on some queries and requires a long time on some others. This moti- vated the development of data-dependent hashing schemes based on k-means (Paulev´e et al., 2010) and spectral parti- tioning (Weiss et al., 2009). Unfortunately, these methods do not support dynamic updates to the dataset or provide correctness guarantees. Furthermore, they incur a signifi- cant pre-processing cost, which can be expensive on large datasets. Other data-dependent algorithms outside the LSH framework have also been proposed, such as (Fukunaga & Narendra, 1975; Brin, 1995; Nister & Stewenius, 2006; Wang, 2011), which work by constructing a hierarchy of clusters using k-means and can be viewed as performing a highly data-dependent form of space partitioning. For these algorithms, no guarantees on approximation quality or running time are known. One class of methods (Orchard, 1991; Arya & Mount, 1993; Clarkson, 1999; Karger & Ruhl, 2002) that does not rely on space partitioning uses a local search strategy. Start- ing from a random data point, these methods iteratively find a new data point that is closer to the query than the previ- ous data point. Unfortunately, the performance of these methods deteriorates in the presence of significant varia- tions in data density, since it may take very long to navigate a dense region of the space, even if it is very far from the query. Other methods like navigating nets (Krauthgamer & Lee, 2004), cover trees (Beygelzimer et al., 2006) and rank Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing cover trees (Houle & Nett, 2015) adopt a coarse-to-fine strategy. These methods work by maintaining coarse sub- sets of points at varying scales and progressively searching the neighbourhood of the query with decreasing radii at in- creasingly finer scales. Sadly, the running times of these methods again exhibit exponential dependence on the in- trinsic dimensionality. We direct interested readers to (Clarkson, 2006) for a com- prehensive survey of existing methods. 3. Algorithm Algorithm 1 Algorithm for data structure construction Require: A dataset D of n points p1, . . . , pn, the number of sim- ple indices m that constitute a composite index and the number of composite indices L function CONSTRUCT(D, m, L) {ujl}j∈[m],l∈[L] ← mL random unit vectors in Rd {Tjl}j∈[m],l∈[L] ← mL empty binary search trees or skip for j = 1 to m do lists for l = 1 to L do for i = 1 to n do jl ← (cid:104)pi, ujl(cid:105) pi Insert (pi i being the value end for end for end for return {(Tjl, ujl)}j∈[m],l∈[L] end function jl, i) into Tjl with pi jl being the key and The proposed algorithm relies on the construction of continuous indices of data points that support both fast searching and online updates. To this end, we use one- dimensional random projections as basic building blocks and construct mL simple indices, each of which orders data points by their projections along a random direction. Such an index has both desired properties: data points can be efficiently retrieved and updated when the index is imple- mented using standard data structures for storing ordered sequences of scalars, like self-balancing binary search trees or skip lists. This ordered arrangement of data points ex- ploits an important property of the k-nearest neighbour search problem that has often been overlooked: it suffices to construct an index that approximately preserves the rel- ative order between the true k-nearest neighbours and the other data points in terms of their distances to the query point without necessarily preserving all pairwise distances. This observation enables projection to a much lower di- mensional space than the Johnson-Lindenstrauss transform (Johnson & Lindenstrauss, 1984). We show in the follow- ing section that with high probability, one-dimensional ran- dom projection preserves the relative order of two points whose distances to the query point differ significantly re- gardless of the ambient dimensionality of the points. Algorithm 2 Algorithm for k-nearest neighbour retrieval Require: Query point q in Rd, binary search trees/skip lists and their associated projection vectors {(Tjl, ujl)}j∈[m],l∈[L], and maximum tolerable failure probability  function QUERY(q,{(Tjl, ujl)}j,l, ) Cl ← array of size n with entries initialized to 0 ∀l ∈ [L] qjl ← (cid:104)q, ujl(cid:105) ∀j ∈ [m], l ∈ [L] Sl ← ∅ ∀l ∈ [L] for i = 1 to n do for l = 1 to L do for j = 1 to m do (p(i) jl , h(i) jl ) ← the node in Tjl whose key is the ith closest to qjl Cl[h(i) jl ] ← Cl[h(i) jl ] + 1 end for for j = 1 to m do if Cl[h(i) jl ] = m then Sl ← Sl ∪ {h(i) jl } end if end for end for if IsStoppingConditionSatisfied(i, Sl, ) then break end if return k points in(cid:83) end for end function l∈[L] Sl that are the closest in Euclidean distance in Rd to q We combine each set of m simple indices to form a com- posite index in which points are ordered by the maximum difference over all simple indices between the positions of the point and the query in the simple index. The compos- ite index enables fast retrieval of a small number of data points, which will be referred to as candidate points, that are close to the query point along several random directions and therefore are likely to be truly close to the query. The composite indices are not explicitly constructed; instead, each of them simply keeps track of the number of its con- stituent simple indices that have encountered any particular point and returns a point as soon as all its constituent simple indices have encountered that point. At query time, we retrieve candidate points from each com- posite index one by one in the order they are returned until some stopping condition is satisfied, while omitting points that have been previously retrieved from other composite indices. Exhaustive search is then performed over candi- date points retrieved from all L composite indices to iden- tify the subset of k points closest to the query. Please refer to Algorithms 1 and 2 for a precise statement of the con- struction and querying procedures. Because data points are retrieved according to their posi- tions in the composite index rather than the regions of space Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing (a) (b) (c) Figure 1. (a) Examples of order-preserving (shown in green) and order-inverting (shown in red) projection directions. Any projection direction within the shaded region inverts the relative order of the vectors by length under projection, while any projection directions outside the region preserves it. The size of the shaded region depends on the ratio of the lengths of the vectors. (b) Projection vectors whose endpoints lie in the shaded region would be order-inverting. (c) Projection vectors whose endpoints lie in the shaded region would invert the order of both long vectors relative to the short vector. Best viewed in colour. they lie in, the algorithm is able to automatically adapt to changes in data density as dynamic updates are made to the dataset without requiring any pre-processing to esti- mate data density at construction time. Also, unlike ex- isting methods, the number of retrieved candidate points can be controlled on a per-query basis, enabling the user to easily trade off accuracy against speed. We develop two versions of the algorithm, a data-independent and a data- dependent version, which differ in the stopping condition that is used. In the former, the number of candidate points is indirectly preset according to the global data density and the maximum tolerable failure probability; in the latter, the number of candidate points is chosen adaptively at query time based on the local data density in the neighbourhood of the query. We analyze the algorithm below and show that its failure probability is independent of ambient dimension- ality, its running time is linear in ambient dimensionality and sub-linear in intrinsic dimensionality and the size of the dataset and its space complexity is independent of am- bient dimensionality and linear in the size of the dataset. 3.1. Properties of Random 1D Projection First, we examine the effect of projecting d-dimensional vectors to one dimension, which motivates its use in the proposed algorithm. We are interested in the probability that a distant point appears closer than a nearby point under projection; if this probability is low, then each simple index approximately preserves the order of points by distance to the query point. If we consider displacement vectors be- tween the query point and data points, this probability is then is equivalent to the probability of the lengths of these vectors inverting under projection. Lemma 1. Let vl, vs ∈ Rd such that (cid:13)(cid:13)vl(cid:13)(cid:13)2 > (cid:13)(cid:13)vs(cid:13)(cid:13)2 , and u ∈ Rd be a unit vector drawn uniformly at random. π cos−1(cid:0)(cid:13)(cid:13)vs(cid:13)(cid:13)2 /(cid:13)(cid:13)vl(cid:13)(cid:13)2(cid:1). Then the probability of vs being at least as long as vl under projection u is at most 1 − 2 Proof. Assuming that vl and vs are not collinear, consider the two-dimensional subspace spanned by vl and vs, which we will denote as P . (If vl and vs are collinear, we define P to be the subspace spanned by vl and an arbitrary vector that's linearly independent of vl.) For any vector w, we use w(cid:107) and w⊥ to denote the components of w in P and P ⊥ such that w = w(cid:107) + w⊥. For w ∈ {vs, vl}, because w⊥ = 0, (cid:104)w, u(cid:105) = (cid:104)w, u(cid:107) (cid:105). So, we can limit our attention to P for this analysis. We parameterize u(cid:107) in terms of its angle relative to vl, which we denote as θ. Also, we denote the angle of u(cid:107) relative to vs as ψ. Then, (cid:16)(cid:12)(cid:12)(cid:12)(cid:104)vl, u(cid:105)(cid:12)(cid:12)(cid:12) ≤(cid:12)(cid:12)(cid:12)(cid:104)vs, u(cid:105)(cid:12)(cid:12)(cid:12)(cid:17) (cid:107)(cid:105)(cid:12)(cid:12)(cid:12) ≤(cid:12)(cid:12)(cid:12)(cid:104)vs, u (cid:16)(cid:12)(cid:12)(cid:12)(cid:104)vl, u (cid:107)(cid:105)(cid:12)(cid:12)(cid:12)(cid:17) (cid:16)(cid:13)(cid:13)(cid:13)vl(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)u (cid:107)(cid:13)(cid:13)(cid:13)2 cos θ ≤(cid:13)(cid:13)(cid:13)vs(cid:13)(cid:13)(cid:13)2 (cid:18) (cid:19) cos θ ≤ (cid:107)vs(cid:107)2 (cid:19) (cid:20) (cid:18) (cid:18)(cid:107)vs(cid:107)2 (cid:107)vl(cid:107)2 (cid:19) (cid:18)(cid:107)vs(cid:107)2 θ ∈ −1 (cid:107)vl(cid:107)2 cos ψ(cid:17) (cid:19)(cid:21)(cid:19) (cid:18)(cid:107)vs(cid:107)2 (cid:13)(cid:13)(cid:13)u (cid:107)(cid:13)(cid:13)(cid:13)2 , π − cos −1 (cid:107)vl(cid:107)2 = Pr ≤ Pr = Pr = 2Pr cos Pr = 1 − 2 π −1 cos (cid:107)vl(cid:107)2 Observe that if(cid:12)(cid:12)(cid:104)vl, u(cid:105)(cid:12)(cid:12) ≤(cid:12)(cid:12)(cid:104)vs, u(cid:105)(cid:12)(cid:12), the relative order of vl and vs by their lengths would be inverted when projected along u. This occurs when u(cid:107) is close to orthogonal to vl, which is illustrated in Figure 1a. Also note that the probability of inverting the relative order of vl and vs is small when vl is much longer than vs. On the other hand, vsPrhvl,uihvs,uihvs,uihvl,uivlvlvsU(vs,vl)vsvl1vl2U(vs,vl1)\U(vs,vl2) Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing this probability is high when vl and vs are similar in length, which corresponds to the case when two data points are almost equidistant to the query point. So, if we consider a sequence of vectors ordered by length, applying random one-dimensional projection will likely perturb the ordering locally, but will preserve the ordering globally. Next, we build on this result to analyze the order-inversion probability when there are more than two vectors. Consider the sample space B = (cid:8) u ∈ Rd(cid:12)(cid:12)(cid:107)u(cid:107)2 = 1(cid:9) and the set U (vs, vl) =(cid:8)u ∈ B(cid:12)(cid:12) cos θ ≤(cid:13)(cid:13)vs(cid:13)(cid:13)2 /(cid:13)(cid:13)vl(cid:13)(cid:13)2(cid:9), which is illustrated in Figure 1b, where θ is the angle between u(cid:107) and vl. If we use area(U ) to denote the area of the region formed by the endpoints of all vectors in the set U, then we can rewrite the above bound on the order-inversion proba- bility as: (cid:16)(cid:12)(cid:12)(cid:12)(cid:104)vl, u(cid:105)(cid:12)(cid:12)(cid:12) ≤(cid:12)(cid:12)(cid:12)(cid:104)vs, u(cid:105)(cid:12)(cid:12)(cid:12)(cid:17) ≤ Pr (cid:16) Pr u ∈ U (vs, vl) (cid:17) (cid:18)(cid:107)vs(cid:107)2 (cid:107)vl(cid:107)2 (cid:19) = area(V s l ) area(B) = 1 − 2 π −1 cos 1 i=1 if k(cid:48) = N, this probability is at most be a set of vectors such that Then the probabil- ity that that are all not at most thermore, π cos−1(cid:0)(cid:13)(cid:13)vs(cid:13)(cid:13)2 /(cid:13)(cid:13)vl i(cid:13)(cid:13)2(cid:1)(cid:9). Lemma 2. Let (cid:8)vl i(cid:9)N i(cid:13)(cid:13)2 > (cid:13)(cid:13)vs(cid:13)(cid:13)2 (cid:13)(cid:13)vl ∀i ∈ [N ]. there is a subset of k(cid:48) vectors from (cid:8)vl i(cid:9)N i=1 longer than vs under projection is i(cid:13)(cid:13)2(cid:1)(cid:1). Fur- i=1(cid:0)1 − 2 k(cid:48)(cid:80)N π cos−1(cid:0)(cid:13)(cid:13)vs(cid:13)(cid:13)2 /(cid:13)(cid:13)vl mini∈[N ](cid:8)1 − 2 Proof. For a given subset I ⊆ [N ] of size k(cid:48), the probability that indexed by ele- than vs under pro- ments in I at most Pr(cid:0)u ∈(cid:84)i∈I U (vs, vl i)(cid:1) = jection u is area(cid:0)(cid:84)i∈I U (vs, vl i)(cid:1) /area (B). Pr(cid:16)u ∈(cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs, vl i)(cid:17) area(cid:16)(cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs, vl i)(cid:17) /area (B). Observe that each point in (cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs, vl  ≤ N(cid:88)  (cid:91) (cid:16) (cid:17) the this occurs on some subset I must be covered by at least k(cid:48) U (vs, vl ability that most prob- is at = all vectors i)'s. So, U (vs, vl i) U (vs, vl i) are not (cid:48) · area (cid:92) longer area So, i) k I⊆[N ]:I=k(cid:48) i∈I i=1 It follows that the probability this event occurs on some subset I is bounded above by 1 1 k(cid:48)(cid:80)N i(cid:13)(cid:13)2(cid:1)(cid:1). π cos−1(cid:0)(cid:13)(cid:13)vs(cid:13)(cid:13)2 /(cid:13)(cid:13)vl k(cid:48)(cid:80)N If k(cid:48) = N, we use the fact that area(cid:16)(cid:84)i∈[N ] U (vs, vl i=1(cid:0)1 − 2 area(U (vs,vl area(B) i)(cid:17) ≤ i)) i=1 = mini∈[N ](cid:8)area(cid:0)U (vs, vl sult. i)(cid:1)(cid:9) to obtain the desired re- (cid:48) i=1 i=1 i(cid:48)=1 be sets of vectors illustrate this region in Figure 1c for the case of d = 3. Intuitively, if this event occurs, then there are at least k(cid:48) vectors that rank above vs when sorted in nondecreasing order by their lengths under projection. This can only oc- cur when the endpoint of u falls in a region on the unit i). We Proof. The probability that this event occurs is at most We sphere corresponding to(cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs, vl i(cid:48)(cid:9)N and(cid:8)vs i(cid:9)N Theorem 3. Let(cid:8)vl i(cid:13)(cid:13)2 > (cid:107)vs such that(cid:13)(cid:13)vl i(cid:48)(cid:107)2 ∀i ∈ [N ], i(cid:48) ∈ [N(cid:48)]. Then the probability that there is a subset of k(cid:48) vectors from(cid:8)vl i(cid:9)N i(cid:48) under projection is that are all not longer than some vs i(cid:13)(cid:13)2(cid:1)(cid:1), where max(cid:13)(cid:13)2 /(cid:13)(cid:13)vl π cos−1(cid:0)(cid:13)(cid:13)vs i=1(cid:0)1 − 2 k(cid:48)(cid:80)N at most 1 max(cid:13)(cid:13)2 ≥ (cid:107)vs (cid:13)(cid:13)vs ∈ [N(cid:48)]. i(cid:48)(cid:107)2 ∀i(cid:48) Pr(cid:16)u ∈(cid:83)i(cid:48)∈[N(cid:48)](cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs i)(cid:17). i(cid:48)(cid:107)2 /(cid:13)(cid:13)vl observe that for all i, i(cid:48), (cid:8)θ(cid:12)(cid:12)cos θ ≤ (cid:107)vs max(cid:13)(cid:13)2 /(cid:13)(cid:13)vl (cid:8)θ(cid:12)(cid:12)cos θ ≤(cid:13)(cid:13)vs i(cid:13)(cid:13)2(cid:9), which both sides, we obtain (cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs (cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs i(cid:48), (cid:83)i(cid:48)∈[N(cid:48)](cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs (cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs Pr(cid:16)u ∈(cid:83)I⊆[N ]:I=k(cid:48)(cid:84)i∈I U (vs i=1(cid:0)1 − 2 k(cid:48)(cid:80)N U (vs If we take the intersection followed by union on i) ⊆ Because this is true i) ⊆ i)(cid:17). By Lemma 2, i(cid:13)(cid:13)2(cid:1)(cid:1). max(cid:13)(cid:13)2 /(cid:13)(cid:13)vl π cos−1(cid:0)(cid:13)(cid:13)vs this probability is bounded above by i(cid:13)(cid:13)2(cid:9) ⊆ this is at most 1 i) ⊆ U (vs Therefore, i). max, vl i). max, vl i). max, vl for all max, vl implies i(cid:48), vl i(cid:48), vl i(cid:48), vl i(cid:48), vl that 3.2. Data Density We now formally characterize data density by defining the following notion of local relative sparsity: Definition 4. Given a dataset D ⊆ Rd, let Bp(r) be the set of points in D that are within a ball of radius r around a point p. We say D has local relative sparsity of (τ, γ) at a point p ∈ Rd if for all r such that Bp(r) ≥ τ, Bp(γr) ≤ 2Bp(r), where γ ≥ 1. Intuitively, γ represents a lower bound on the increase in ra- dius when the number of points within the ball is doubled. When γ is close to 1, the dataset is dense in the neighbour- hood of p, since there could be many points in D that are al- most equidistant from p. Retrieving the nearest neighbours of such a p is considered "hard", since it would be difficult to tell which of these points are the true nearest neighbours without computing the distances to all these points exactly. Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing We also define a related notion of global relative sparsity, which we will use to derive the number of iterations the outer loop of the querying function should be executed and a bound on the running time that is independent of the query: Definition 5. A dataset D has global relative sparsity of (τ, γ) if for all r and p ∈ Rd such that Bp(r) ≥ τ, Bp(γr) ≤ 2Bp(r), where γ ≥ 1. Note that a dataset with global relative sparsity of (τ, γ) has local relative sparsity of (τ, γ) at every point. Global relative sparsity is closely related to the notion of expan- sion rate introduced by (Karger & Ruhl, 2002). More specifically, a dataset with global relative sparsity of (τ, γ) has (τ, 2(1/ log2 γ))-expansion, where the latter quantity is known as the expansion rate. If we use c to denote the ex- pansion rate, the quantity log2 c is known as the intrinsic dimension (Clarkson, 2006), since when the dataset is uni- formly distributed, intrinsic dimensionality would match ambient dimensionality. So, the intrinsic dimension of a dataset with global relative sparsity of (τ, γ) is 1/ log2 γ. 3.3. Data-Independent Version In the data-independent version of the algorithm, the outer loop in the querying function executes for a preset number of iterations k. The values of L, m and k are fixed for all queries and will be chosen later. We apply the results obtained above to analyze the algo- rithm. Consider the event that the algorithm fails to return the correct set of k-nearest neighbours – this can only oc- cur if a true k-nearest neighbour is not contained in any of the Sl's, which entails that for each l ∈ [L], there is a set of k − k + 1 points that are not the true k-nearest neighbours but are closer to the query than the true k-nearest neigh- bours under some of the projections u1l, . . . , uml. We an- alyze the probability that this occurs below and derive the parameter settings that ensure the algorithm succeeds with high probability. Please refer to the supplementary material for proofs of the following results. Lemma rel- is ative ∈ Ω(max(k log(n/k), k(n/k)1−log2 γ)) the probability that the candidate points retrieved from a given composite index do not include some of the true k-nearest neighbours is at most some constant α < 1. Theorem 7. For a dataset with global relative spar- sity (k, γ), for any  > 0, there is some L and k ∈ Ω(max(k log(n/k), k(n/k)1−log2 γ)) such that the algo- rithm returns the correct set of k-nearest neighbours with probability of at least 1 − . The above result suggests that we should choose k ∈ Ω(max(k log(n/k), k(n/k)1−log2 γ)) to ensure the algo- global k that dataset with some such there 6. For a (k, γ), sparsity 8. The rithm succeeds with high probability. Next, we analyze the time and space complexity of the algorithm. Proofs of the following results are found in the supplementary material. Theorem algorithm takes O(max(dk log(n/k), dk(n/k)1−1/d (cid:48) )) time to retrieve the k-nearest neighbours at query time, where d(cid:48) denotes the intrinsic dimension of the dataset. Theorem 9. The algorithm takes O(dn + n log n) time to preprocess the data points in D at construction time. Theorem 10. The algorithm requires O(d + log n) time to insert a new data point and O(log n) time to delete a data point. Theorem 11. The algorithm requires O(n) space in addi- tion to the space used to store the data. 3.4. Data-Dependent Version Conceptually, performance of the proposed algorithm de- pends on two factors: how likely the index returns the true nearest neighbours before other points and when the algo- rithm stops retrieving points from the index. The preceding sections primarily focused on the former; in this section, we take a closer look at the latter. One strategy, which is used by the data-independent ver- sion of the algorithm, is to stop after a preset number of it- erations of the outer loop. Although simple, such a strategy leaves much to be desired. First of all, in order to set the number of iterations, it requires knowledge of the global relative sparsity of the dataset, which is rarely known a pri- ori. Computing this is either very expensive in the case of datasets or infeasible in the case of streaming data, as global relative sparsity may change as new data points ar- rive. More importantly, it is unable to take advantage of the local relative sparsity in the neighbourhood of the query. A method that is capable of adapting to local relative sparsity could potentially be much faster because query points tend to be close to the manifold on which points in the dataset lie, resulting in the dataset being sparse in the neighbour- hood of the query point. Ideally, the algorithm should stop as soon as it has re- trieved the true nearest neighbours. Determining if this is the case amounts to asking if there exists a point that we have not seen lying closer to the query than the points we have seen. At first sight, because nothing is known about unseen points, it seems not possible to do better than ex- haustive search, as we can only rule out the existence of such a point after computing distances to all unseen points. Somewhat surprisingly, by exploiting the fact that the pro- jections associated with the index are random, it is possible to make inferences about points that we have never seen. We do so by leveraging ideas from statistical hypothesis testing. Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing After each iteration of the outer loop, we perform a hypoth- esis test, with the null hypothesis being that the complete set of the k-nearest neighbours has not yet been retrieved. Rejecting the null hypothesis implies accepting the alterna- tive hypothesis that all the true k-nearest neighbours have been retrieved. At this point, the algorithm can safely ter- minate while guaranteeing that the probability that the al- gorithm fails to return the correct results is bounded above by the significance level. The test statistic is an upper bound on the probability of missing a true k-nearest neigh- bour. The resulting algorithm does not require any prior knowledge about the dataset and terminates earlier when the dataset is sparse in the neighbourhood of the query; for this reason, we will refer to this version of the algorithm as the data-dependent version. More concretely, as the algorithm retrieves candidate points, it computes their true distances to the query and maintains a list of k points that are the closest to the query among the points retrieved from all composite in- dices so far. Let p(i) and pmax denote the ith closest candidate point to q retrieved from all composite indices and the farthest candidate point from q retrieved from the lth composite index respectively. When the number of candidate points exceeds k, the algorithm checks if , where  is the maximum tolerable failure probability, af- ter each iteration of the outer loop. If the condition is satis- π cos−1(cid:0)(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 /(cid:13)(cid:13)pmax l=1(cid:16)1 −(cid:0) 2 (cid:81)L fied, the algorithm terminates and returns(cid:8)p(i)(cid:9)k l − q(cid:13)(cid:13)2(cid:1)(cid:1)m(cid:17) ≤ We show the correctness and running time of this algorithm below. Proofs of the following results are found in the sup- plementary material. Theorem 12. For any  > 0, m and L, the data-dependent algorithm returns the correct set of k-nearest neighbours of the query q with probability of at least 1 − . Theorem 13. On (cid:32) ative m and L, dataset with fixed global rel- parameters algorithm takes (cid:17)d(cid:48) √ 1− L√ 1− m data-dependent (cid:16) (cid:32) dk log(cid:0) n (cid:1)1−1/d(cid:48) a (k, γ), (cid:1) , dk(cid:0) n k (cid:33)(cid:33) the k sparsity given . i=1 l O max , d  time with high probability to retrieve the k-nearest neighbours at query time, where d(cid:48) denotes the intrinsic dimension of the dataset. Note that we can make the denominator of the last argu- ment arbitrarily close to 1 by choosing a large L. 4. Experiments We compare the performance of the proposed algorithm to that of LSH, which is arguably the most popular method for fast nearest neighbour retrieval. Because LSH is designed for the approximate setting, under which the performance metric of interest is how close the points returned by the al- gorithm are to the query rather than whether the returned points are the true k-nearest neighbours, we empirically evaluate performance in this setting. Because the distance metric of interest is the Euclidean distance, we compare to Exact Euclidean LSH (E2LSH) (Datar et al., 2004), which uses hash functions designed for Euclidean space. We compare the performance of the proposed algorithm and LSH on the CIFAR-100 and MNIST datasets, which consist of 32 × 32 colour images of various real-world ob- jects and 28 × 28 grayscale images of handwritten digits respectively. We reshape the images into vectors, with each dimension representing the pixel intensity at a particular lo- cation and colour channel of the image. The resulting vec- tors have a dimensionality of 32×32×3 = 3072 in the case of CIFAR-100 and 28× 28 = 784 in the case of MNIST, so the dimensionality under consideration is higher than what traditional tree-based algorithms can handle. We combine the training set and the test set of each dataset, and so we have a total of 60, 000 instances in CIFAR-100 and 70, 000 instances in MNIST. We randomize the instances that serve as queries using cross-validation. Specifically, we randomly select 100 in- stances to serve as query points and the designate the re- maining instances as data points. Each algorithm is then used to retrieve approximate k-nearest neighbours of each query point among the set of all data points. This procedure is repeated for ten folds, each with a different split of query vs. data points. We compare the number of candidate points that each algo- rithm requires to achieve a desired level of approximation quality. We quantify approximation quality using the ap- proximation ratio, which is defined as the ratio of the radius of the ball containing approximate k-nearest neighbours to the radius of the ball containing true k-nearest neighbours. So, the smaller the approximation ratio, the better the ap- proximation quality. Because dimensionality is high and exhaustive search must be performed over all candidate points, the time taken for compute distances between the candidate points and the query dominates the overall run- ning time of the querying operation. Therefore, the number of candidate points can be viewed as an implementation- independent proxy for the running time. Because the hash table constructed by LSH depends on the desired level of approximation quality, we construct a dif- ferent hash table for each level of approximation quality. On the other hand, the indices constructed by the proposed method are not specific to any particular level of approxi- mation quality; instead, approximation quality can be con- trolled at query time by varying the number of iterations of the outer loop. So, the same indices are used for all levels of approximation quality. Therefore, our evaluation scheme is Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing (a) (b) (c) Figure 2. (a-b) Comparison of the speed of the proposed method (labelled as DCI) and LSH on (a) CIFAR-100 and (b) MNIST. Each curve represents the mean number to candidate points required to achieve varying levels of approximation quality over ten folds and the shaded area represents ±1 standard deviation. (c) Comparison of the space efficiency of the proposed method and LSH on CIFAR-100 and MNIST. The height of each bar represents the average amount of memory used by each method to achieve the performance shown in (a) and (b). biased towards LSH and against the proposed method. We adopt the recommended guidelines for choosing param- eters of LSH and used 24 hashes per table and 100 tables. For the proposed method, we used m = 25 and L = 2 on CIFAR-100 and m = 15 and L = 3 on MNIST, which we found to work well in practice. In Figures 2a and 2b, we plot the performance of the proposed method and LSH on the CIFAR-100 and MNIST datasets for retrieving 25- nearest neighbours. For the purposes of retrieving nearest neighbours, MNIST is a more challenging dataset than CIFAR-100. This is be- cause the instances in MNIST form dense clusters, whereas the instances in CIFAR-100 are more visually diverse and so are more dispersed in space. Intuitively, if the query falls inside a dense cluster of points, there are many points that are very close to the query and so it is difficult to distinguish true nearest neighbours from points that are only slightly farther away. Viewed differently, because true nearest neighbours tend to be extremely close to the query on MNIST, the denominator for computing the approxima- tion ratio is usually very small. Consequently, returning points that are only slightly farther away than the true near- est neighbours would result in a large approximation ratio. As a result, both the proposed method and LSH require far more candidate points on MNIST than on CIFAR-100 to achieve comparable approximation ratios. We find the proposed method achieves better performance than LSH at all levels of approximation quality. Notably, the performance of LSH degrades drastically on MNIST, which is not surprising since LSH is known to have difficul- ties on datasets with large variations in data density. On the other hand, the proposed method requires 61.3% − 78.7% fewer candidate points than LSH to achieve the same ap- proximation quality while using less than 1/20 of the mem- ory. 5. Conclusion In this paper, we delineated the inherent deficiencies of space partitioning and presented a new strategy for fast retrieval of k-nearest neighbours, which we dub dynamic continuous indexing (DCI). Instead of discretizing the vec- tor space, the proposed algorithm constructs continuous in- dices, each of which imposes an ordering of data points in which closeby positions approximately reflect proximity in the vector space. Unlike existing methods, the proposed algorithm allows granular control over accuracy and speed on a per-query basis, adapts to variations to data density on-the-fly and supports online updates to the dataset. We analyzed the proposed algorithm and showed it runs in time linear in ambient dimensionality and sub-linear in intrinsic dimensionality and the size of the dataset and takes space constant in ambient dimensionality and linear in the size of the dataset. Furthermore, we demonstrated empirically that the proposed algorithm compares favourably to LSH in terms of approximation quality, speed and space efficiency. Acknowledgements. Ke Li thanks the Berkeley Vision and Learning Center (BVLC) and the Natural Sciences and Engineering Research Council of Canada (NSERC) for fi- nancial support. The authors also thank Lap Chi Lau and the anonymous reviewers for feedback. References Arya, Sunil and Mount, David M. Approximate nearest In SODA, vol- neighbor queries in fixed dimensions. ume 93, pp. 271–280, 1993. 1.151.201.251.301.351.40Approximation Ratio020040060080010001200Number of Candidate PointsLSHDCI1.161.181.201.221.241.261.281.30Approximation Ratio02000400060008000100001200014000Number of Candidate PointsLSHDCICIFAR-100MNIST0.00.51.01.52.02.53.0Memory Usage1e8LSHDCI Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing Arya, Sunil, Mount, David M, Netanyahu, Nathan S, Sil- verman, Ruth, and Wu, Angela Y. An optimal algo- rithm for approximate nearest neighbor searching fixed dimensions. Journal of the ACM (JACM), 45(6):891– 923, 1998. Bentley, Jon Louis. Multidimensional binary search trees used for associative searching. Communications of the ACM, 18(9):509–517, 1975. Berchtold, Stefan, Keim, Daniel A., and peter Kriegel, Hans. The X-tree : An Index Structure for High- Dimensional Data. In Very Large Data Bases, pp. 28–39, 1996. Berchtold, Stefan, Ertl, Bernhard, Keim, Daniel A, Kriegel, H-P, and Seidl, Thomas. Fast nearest neighbor search in high-dimensional space. In Data Engineering, 1998. Proceedings., 14th International Conference on, pp. 209–218. IEEE, 1998. Beygelzimer, Alina, Kakade, Sham, and Langford, John. Cover trees for nearest neighbor. In Proceedings of the 23rd international conference on Machine learning, pp. 97–104. ACM, 2006. Brin, Sergey. Near neighbor search in large metric spaces. VLDB, pp. 574584, 1995. Clarkson, Kenneth L. Nearest neighbor queries in metric spaces. Discrete & Computational Geometry, 22(1):63– 93, 1999. Clarkson, Kenneth L. Nearest-neighbor searching and met- ric space dimensions. Nearest-neighbor methods for learning and vision: theory and practice, pp. 15–59, 2006. Dasgupta, Sanjoy and Freund, Yoav. Random projection trees and low dimensional manifolds. In Proceedings of the fortieth annual ACM symposium on Theory of com- puting, pp. 537–546. ACM, 2008. Dasgupta, Sanjoy and Sinha, Kaushik. Randomized parti- tion trees for nearest neighbor search. Algorithmica, 72 (1):237–263, 2015. Datar, Mayur, Immorlica, Nicole, Indyk, Piotr, and Mir- rokni, Vahab S. Locality-sensitive hashing scheme based on p-stable distributions. In Proceedings of the twenti- eth annual symposium on Computational geometry, pp. 253–262. ACM, 2004. Fukunaga, Keinosuke and Narendra, Patrenahalli M. A branch and bound algorithm for computing k-nearest neighbors. Computers, IEEE Transactions on, 100(7): 750–753, 1975. Guttman, Antonin. R-trees: a dynamic index structure for spatial searching, volume 14. ACM, 1984. Houle, Michael E and Nett, Michael. Rank-based similarity search: Reducing the dimensional dependence. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 37(1):136–150, 2015. Indyk, Piotr and Motwani, Rajeev. Approximate nearest neighbors: towards removing the curse of dimensional- ity. In Proceedings of the thirtieth annual ACM sympo- sium on Theory of computing, pp. 604–613. ACM, 1998. Johnson, William B and Lindenstrauss, Joram. Extensions of Lipschitz mappings into a Hilbert space. Contempo- rary mathematics, 26(189-206):1, 1984. Karger, David R and Ruhl, Matthias. Finding nearest neighbors in growth-restricted metrics. In Proceedings of the thiry-fourth annual ACM symposium on Theory of computing, pp. 741–750. ACM, 2002. Krauthgamer, Robert and Lee, James R. Navigating nets: simple algorithms for proximity search. In Proceedings of the fifteenth annual ACM-SIAM symposium on Dis- crete algorithms, pp. 798–807. Society for Industrial and Applied Mathematics, 2004. Liu, Ting, Moore, Andrew W, Yang, Ke, and Gray, Alexan- der G. An investigation of practical approximate nearest neighbor algorithms. In Advances in Neural Information Processing Systems, pp. 825–832, 2004. Minsky, Marvin and Seymour, Papert. Perceptrons: an in- troduction to computational geometry. pp. 222, 1969. Nister, David and Stewenius, Henrik. Scalable recognition with a vocabulary tree. In Computer Vision and Pattern Recognition, 2006 IEEE Computer Society Conference on, volume 2, pp. 2161–2168. IEEE, 2006. Orchard, Michael T. A fast nearest-neighbor search al- gorithm. In Acoustics, Speech, and Signal Processing, 1991. ICASSP-91., 1991 International Conference on, pp. 2297–2300. IEEE, 1991. Paulev´e, Loıc, J´egou, Herv´e, and Amsaleg, Laurent. Lo- cality sensitive hashing: A comparison of hash function types and querying mechanisms. Pattern Recognition Letters, 31(11):1348–1358, 2010. Wang, Xueyi. A fast exact k-nearest neighbors algorithm for high dimensional search using k-means clustering In Neural Networks (IJCNN), and triangle inequality. The 2011 International Joint Conference on, pp. 1293– 1299. IEEE, 2011. Weiss, Yair, Torralba, Antonio, and Fergus, Rob. Spectral hashing. In Advances in Neural Information Processing Systems, pp. 1753–1760, 2009. Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing Supplementary Material Ke Li Jitendra Malik University of California, Berkeley, CA 94720, United States [email protected] [email protected] i=1 to denote a re-ordering of the points {pi}n Below, we present proofs of the results shown in the paper. We first prove two intermediate results, which are used to derive results in the paper. Throughout our proofs, we use i=1 so {p(i)}n that p(i) is the ith closest point to the query q. For any given projection direction ujl associated with a simple index, we also consider a ranking of the points {pi}n i=1 by their dis- tance to q under projection ujl in nondecreasing order. We say points are ranked before others if they appear earlier in this ranking. Lemma 14. The probability that simple indices of a composite index, points exist bours but are ranked before some of them, for all constituent fewer than n0 the true k-nearest neigh- is at least that are not (cid:107)p(i)−q(cid:107)2(cid:21)m i=2k+1 (cid:107)p(k)−q(cid:107)2 . (cid:20)1 − 1 n0−k(cid:80)n Proof. For any given simple index, we will refer to the points that are not the true k-nearest neighbours but are ranked before some of them as extraneous points. We fur- thermore categorize the extraneous points as either reason- able or silly. An extraneous point is reasonable if it is one of the 2k-nearest neighbours, and is silly otherwise. Since there can be at most k reasonable extraneous points, there must be at least n0 − k silly extraneous points. Therefore, the event that n0 extraneous points exist must be contained in the event that n0 − k silly extraneous points exist. We find the probability that such a set of silly extraneous points exists for any given simple index. By Theorem 3, i=1, {vl i(cid:48)=1 to be {p(i) − q}k i=1 to where we take {vs i}N i=2k+1 and k(cid:48) to be n0 − k, the probability be {p(i) − q}n that there are at least n0 − k silly extraneous points is at i=2k+1(cid:18)1 − 2 (cid:107)p(i)−q(cid:107)2(cid:19)(cid:19). This π cos−1(cid:18)(cid:107)p(k)−q(cid:107)2 n0−k(cid:80)n most implies that the probability that at least n0 extraneous points exist is bounded above by the same quantity, and so the probability that fewer than n0 extraneous points exist is at least 1 − 1 the Hence, π cos−1(cid:18)(cid:107)p(k)−q(cid:107)2 i=2k+1(cid:18)1 − 2 (cid:107)p(i)−q(cid:107)2(cid:19)(cid:19). n0−k(cid:80)n probability than n0 i(cid:48)}N fewer that ex- 1 (cid:48) traneous ples indices the Using x (cid:20)1 − 1 (cid:20)1 − 1 n0−k(cid:80)n n0−k(cid:80)n ∀x points of exist a for all composite constituent at is index sim- least i=2k+1(cid:18)1 − 2 π cos−1(cid:18)(cid:107)p(k)−q(cid:107)2 (cid:107)p(i)−q(cid:107)2(cid:19)(cid:19)(cid:21)m 1 − (2/π) cos−1 (x) fact this at ∈ (cid:107)p(i)−q(cid:107)2(cid:21)m i=2k+1 (cid:107)p(k)−q(cid:107)2 that [0, 1], quantity is . . ≤ least . that are not the probability that Lemma 15. On a dataset with global relative spar- for all constituent sity (k, γ), simple indices of a composite index, fewer than n0 the true k-nearest neigh- points exist bours but are ranked before some of them, is at least n0−k O(cid:0)max(k log(n/k), k(n/k)1−log2 γ)(cid:1)(cid:105)m (cid:104)1 − 1 Proof. By definition of global relative sparsity, for all i ≥ 2k + 1, (cid:13)(cid:13)p(i) − q(cid:13)(cid:13)2 > γ(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 . By applying this k + 1,(cid:13)(cid:13)p(i) − q(cid:13)(cid:13)2 > recursively, we see that for all i ≥ 2i i=2k+1 (cid:107)p(k)−q(cid:107)2 (cid:48)(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 . It follows that(cid:80)n γi (cid:107)p(i)−q(cid:107)2 than(cid:80)(cid:100)log2(n/k)(cid:101)−1 most k log2(cid:0) n k(cid:1). If 1 ≤ γ < 2, this quantity is: (cid:33) (cid:19)(cid:32)(cid:18) 2 (cid:19)(cid:100)log2(n/k)(cid:101)−1 − 1 (cid:19) (cid:18) 2 (cid:18) 2 (cid:32) (cid:19)(cid:100)log2(n/k)(cid:101)−1(cid:33) (cid:18) 2 (cid:17)1−log2 γ(cid:19) (cid:18) (cid:16) n is less . If γ ≥ 2, this quantity is at kγ−i − 1 i(cid:48)=1 = O 2i k k γ γ γ γ / (cid:48) (cid:48) (cid:48) = O k k Combining this bound with Lemma 14 yields the desired result. sparsity 6. For Lemma rel- ative is ∈ Ω(max(k log(n/k), k(n/k)1−log2 γ)) the probability that the candidate points retrieved from a given global k that dataset with a (k, γ), some such there Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing composite index do not include some of the true k-nearest neighbours is at most some constant α < 1. query constants. projections Proof. Computing the point of since m and L along all ujl's takes O(d) time, Searching in the binary search are trees/skip lists Tjl's takes O(log n) time. The to- tal number of candidate points retrieved is at most Θ(max(k log(n/k), k(n/k)1−log2 γ)). Computing the distance between each candidate point and the query point takes at most O(max(dk log(n/k), dk(n/k)1−log2 γ)) time. We can find the k closest points to q in the set of candidate points using a selection algorithm like quicks- elect, which takes O(max(k log(n/k), k(n/k)1−log2 γ)) time on average. Since the time taken to compute distances to the query point dominates, the entire al- gorithm takes O(max(dk log(n/k), dk(n/k)1−log2 γ)) time. Since d(cid:48) = 1/ log2 γ, this can be rewritten as O(max(dk log(n/k), dk(n/k)1−1/d (cid:48) Theorem 9. The algorithm takes O(dn + n log n) time to preprocess the data points in D at construction time. )). Proof. Computing projections of all n points along all ujl's takes O(dn) time, since m and L are constants. Inserting all n points into mL self-balancing binary search trees/skip lists takes O(n log n) time. Theorem 10. The algorithm requires O(d + log n) time to insert a new data point and O(log n) time to delete a data point. Proof. In order to insert a data point, we need to compute its projection along all ujl's and insert it into each binary search tree or skip list. Computing the projection takes O(d) time and inserting an entry into a self-balancing bi- nary search tree or skip list takes O(log n) time. In order to delete a data point, we simply remove it from each of the binary search trees or skip lists, which takes O(log n) time. Theorem 11. The algorithm requires O(n) space in addi- tion to the space used to store the data. Proof. The only additional information that needs to be stored are the mL binary search trees or skip lists. Since n entries are stored in each binary search tree/skip list, the additional space required is O(n). Theorem 12. For any  > 0, m and L, the data-dependent algorithm returns the correct set of k-nearest neighbours of the query q with probability of at least 1 − . Proof. We analyze the probability that the algorithm fails to return the correct set of k-nearest neighbours. Let p∗ denote a true k-nearest neighbour that was missed. If the algorithm fails, then for any given composite index, p∗ is Proof. We will refer to points ranked in the top k positions that are the true k-nearest neighbours as true positives and those that are not as false positives. Additionally, we will refer to points not ranked in the top k positions that are the true k-nearest neighbours as false negatives. When not all the true k-nearest neighbours are in the top k positions, then there must be at least one false negative. Since there are at most k − 1 true positives, there must be at least k − (k − 1) false positives. Since false positives are not the true k-nearest neighbours but are ranked before the false negative, which is a true k- nearest neighbour, we can apply Lemma 15. By taking n0 to be k−(k−1), we obtain a lower bound on the probability of the existence of fewer than k− (k− 1) false positives for all constituent simple indices of the composite index, which is (cid:104)1 − . If each simple index has fewer than k − (k − 1) false positives, then the top k positions must contain all the true k-nearest neighbours. Since this is true for all constituent simple indices, all the true k-nearest neighbours must be among the candidate points after k iterations of the outer loop. The failure probability is therefore at most 1 − (cid:104)1 − O(cid:0)max(k log(n/k), k(n/k)1−log2 γ)(cid:1)(cid:105)m O(cid:0)max(k log(n/k), k(n/k)1−log2 γ)(cid:1)(cid:105)m So, some Ω(max(k log(n/k), k(n/k)1−log2 γ)) quantity strictly less than 1. that makes k−2k+1 ∈ this 1 k−2k+1 . there is k 1 Theorem 7. For a dataset with global relative spar- sity (k, γ), for any  > 0, there is some L and k ∈ Ω(max(k log(n/k), k(n/k)1−log2 γ)) such that the algo- rithm returns the correct set of k-nearest neighbours with probability of at least 1 − . Proof. By Lemma 6, the first k points retrieved from a given composite index do not include some of the true k- nearest neighbours with probability of at most α. For the algorithm to fail, this must occur for all composite indices. Since each composite index is constructed independently, the algorithm fails with probability of at most αL, and so must succeed with probability of at least 1 − αL. Since α < 1, there is some L that makes 1 − αL ≥ 1 − . Theorem algorithm takes O(max(dk log(n/k), dk(n/k)1−1/d (cid:48) )) time to retrieve the k-nearest neighbours at query time, where d(cid:48) denotes the intrinsic dimension of the dataset. The 8. Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing i=1 − q(cid:107)2 /(cid:107)pmax − q(cid:107)2 /(cid:107)pmax For the algorithm to fail, this must occur for all com- posite indices; so the failure probability is at most index. By Lemma 2, if we take(cid:8)vl i(cid:9)N not among the candidate points retrieved from the said in- dex. In other words, the composite index must have re- turned all these points before p∗, implying that at least one constituent simple index returns all these points before p∗. This means that all these points must appear closer to q than p∗ under the projection associated with the simple to be displace- ment vectors from q to the candidate points that are far- ther from q than p∗ and vs to be the displacement vec- tor from q to p∗, the probability of this occurring for a given constituent simple index of the lth composite index is at most 1 − 2 probability that this occurs for some constituent simple in- dex is at most 1−(cid:0) 2 l=1(cid:0)1 −(cid:0) 2 (cid:81)L We observe that(cid:13)(cid:13)p∗ since there can be at most k − 1 points in the the dataset failure by l=1(cid:16)1 −(cid:0) 2 (cid:81)L When the algorithm terminates, we know this quantity is at most . Therefore, the algorithm returns the correct set of k-nearest neighbours with probability of at least 1 − . Theorem 13. On global rel- (cid:33)(cid:33) (cid:32) parameters ative m and L, algorithm takes (cid:17)d(cid:48) √ 1− L√ 1− m π cos−1(cid:0)(cid:107)p∗ l − q(cid:107)2(cid:1). The π cos−1(cid:0)(cid:107)p∗ l − q(cid:107)2(cid:1)(cid:1)m. l − q(cid:107)2(cid:1)(cid:1)m(cid:1). − q(cid:13)(cid:13)2 ≤(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 ≤(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 l − q(cid:13)(cid:13)2(cid:1)(cid:1)m(cid:17). π cos−1(cid:0)(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 /(cid:13)(cid:13)pmax data-dependent (cid:16) π cos−1(cid:0)(cid:107)p∗ (cid:32) dk log(cid:0) n to q than p∗. be bounded that are closer probability can dataset with fixed (cid:1) , dk(cid:0) n − q(cid:107)2 /(cid:107)pmax (cid:1)1−1/d(cid:48) a (k, γ), So, above sparsity given max the O k k d ,  time with high probability to retrieve the k-nearest neighbours at query time, where d(cid:48) denotes the intrinsic dimension of the dataset. Proof. In order to bound the running time, we bound the total number of candidate points retrieved until the stopping condition is satisfied. We divide the execution of the algorithm into two stages and analyze the algo- rithm's behaviour before and after it finishes retrieving all the true k-nearest neighbours. We first bound the number of candidate points the algorithm retrieves be- fore finding the complete set of k-nearest neighbours. By Lemma 15, there exist fewer than n0 points that are not the k-nearest neighbours but are ranked before some of them in all constituent simple indices of any given composite index is at least the probability that We can choose n0−k O(cid:0)max(k log(n/k), k(n/k)1−log2 γ)(cid:1)(cid:105)m (cid:104)1 − 1 Θ(cid:0)max(k log(n/k), k(n/k)1−log2 γ)(cid:1) Θ(cid:0)max(k log(n/k), k(n/k)1−log2 γ)(cid:1) this probability arbitrarily close to 1. n0 that So, such some . ∈ makes there are points (cid:48) in each constituent bility, implying that simple index with high proba- the algorithm retrieves at most (cid:48) (cid:48) . . Since all Θ(cid:0)max(k log(n/k), k(n/k)1−log2 γ)(cid:1) extraneous points from any given composite index before finishing fetching all the true k-nearest neighbours. Since the number of composite indices is constant, the total number of candi- date points retrieved from all composite indices during this stage is k + Θ(cid:0)max(k log(n/k), k(n/k)1−log2 γ)(cid:1) = Θ(cid:0)max(k log(n/k), k(n/k)1−log2 γ)(cid:1) with high probabil- ity. After retrieving all the k-nearest neighbours, if the stopping condition has not yet been satisfied, the algorithm would continue retrieving points. We analyze the number of ad- ditional points the algorithm retrieves before it terminates. l − q(cid:13)(cid:13)2 l − q(cid:13)(cid:13)(cid:13)2 ≥ l − q(cid:13)(cid:13)2 ≤ in terms of the number of candidate points retrieved so far. the true k-nearest neighbours have . Suppose the algorithm has already retrieved n(cid:48) − 1 candidate points and is about to retrieve a new candidate point. Since this new candidate point must be different from By definition of global relative sparsity, for all n(cid:48) (cid:48) 2i ≥ . It follows that (cid:48)−1)/k)(cid:99) for all n(cid:48). By combining the above inequalities, we find an upper bound on the test statistic: To this end, we bound the ratio(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 /(cid:13)(cid:13)pmax been retrieved, (cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 = (cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 any of the existing candidate points, (cid:13)(cid:13)(cid:13)pmax (cid:13)(cid:13)(cid:13)p(n ) − q(cid:13)(cid:13)(cid:13)2 Hence, (cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 /(cid:13)(cid:13)pmax ) − q(cid:13)(cid:13)(cid:13)2 /(cid:13)(cid:13)(cid:13)p(n (cid:13)(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)(cid:13)2 k + 1,(cid:13)(cid:13)(cid:13)p(n ) − q(cid:13)(cid:13)(cid:13)2 (cid:48)(cid:13)(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)(cid:13)2 /(cid:13)(cid:13)(cid:13)p(n ) − q(cid:13)(cid:13)(cid:13)2  1 −  2 (cid:13)(cid:13)(cid:13)p(k) − q (cid:13)(cid:13)(cid:13)2 L(cid:89) (cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)pmax m 1 − 1 − (cid:13)(cid:13)(cid:13)p(k) − q (cid:13)(cid:13)(cid:13)2 ≤ L(cid:89) (cid:13)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)pmax −(cid:98)log2((n(cid:48)−1)/k)(cid:99)(cid:17)m(cid:105)L 1 −(cid:16) (cid:104) (cid:104) 1 −(cid:16) − log2((n(cid:48)−1)/k)+1(cid:17)m(cid:105)L (cid:48)−1)/k)+1(cid:17)m(cid:105)L π cos−1(cid:0)(cid:13)(cid:13)p(k) − q(cid:13)(cid:13)2 /(cid:13)(cid:13)pmax Hence, if (cid:104)1 −(cid:16)1 − γ− log2((n l=1(cid:16)1 −(cid:0) 2 (cid:81)L for some n(cid:48) that makes the former inequal- . So, ity true, the stopping condition would be satisfied and so the algorithm must have terminated by this point, if not earlier. By rearranging the former inequality, we find that in order for it to hold, n(cid:48) must be at least . Therefore, the number of l − q(cid:13)(cid:13)2(cid:1)(cid:1)m(cid:17) <  m < γ−(cid:98)log2((n ≤ , then 1 − γ 1 − γ l − q l − q > γi 2/(cid:16)1 − m(cid:112)1 − L√(cid:17)1/ log2 γ cos −1 l=1 l=1 < < π (cid:48) Fast k-Nearest Neighbour Search via Dynamic Continuous Indexing points the algorithm retrieves before terminating cannot ex- Combining the analysis for both stages, the number of points retrieved is at most . ceed 2/(cid:16)1 − m(cid:112)1 − L√(cid:17)1/ log2 γ max (cid:17)1−log2 γ k log (cid:16) n (cid:16) n (cid:17) , k O k k (cid:16) , 1 − m(cid:112)1 − L 1 √  (cid:17) 1 log2 γ     with high probability. Since the time taken to compute distances between the query point and candidate points dominates, the running time is max dk log (cid:16) n (cid:17) k O (cid:16) n (cid:17)1−log2 γ , dk k (cid:16) , 1 − m(cid:112)1 − L d √  (cid:17) 1 log2 γ with high probability. Applying the definition of intrinsic dimension yields the desired result.
1708.06127
2
1708
2017-08-27T08:25:54
Practical Minimum Cut Algorithms
[ "cs.DS", "cs.DC" ]
The minimum cut problem for an undirected edge-weighted graph asks us to divide its set of nodes into two blocks while minimizing the weight sum of the cut edges. Here, we introduce a linear-time algorithm to compute near-minimum cuts. Our algorithm is based on cluster contraction using label propagation and Padberg and Rinaldi's contraction heuristics [SIAM Review, 1991]. We give both sequential and shared-memory parallel implementations of our algorithm. Extensive experiments on both real-world and generated instances show that our algorithm finds the optimal cut on nearly all instances significantly faster than other state-of-the-art algorithms while our error rate is lower than that of other heuristic algorithms. In addition, our parallel algorithm shows good scalability.
cs.DS
cs
Practical Minimum Cut Algorithms Monika Henzinger1, Alexander Noe1, Christian Schulz2 and Darren Strash3 {monika.henzinger, alexander.noe}@univie.ac.at 2 Karlsruhe Institute of Technology, Karlsruhe, Germany and University of Vienna, Vienna, Austria 1 University Vienna, Vienna, Austria christian.schulz@{kit.edu, univie.ac.at} 3 Department of Computer Science, Colgate University, Hamilton, NY, USA [email protected] Abstract. The minimum cut problem for an undirected edge-weighted graph asks us to divide its set of nodes into two blocks while minimizing the weight sum of the cut edges. Here, we introduce a linear-time algorithm to compute near-minimum cuts. Our algorithm is based on cluster contraction using label propagation and Padberg and Rinaldi's contraction heuristics [SIAM Review, 1991]. We give both sequential and shared-memory parallel implementations of our algorithm. Extensive experiments on both real-world and generated instances show that our algorithm finds the optimal cut on nearly all instances significantly faster than other state-of-the-art algorithms while our error rate is lower than that of other heuristic algorithms. In addition, our parallel algorithm shows good scalability. 1 Introduction Given an undirected graph with non-negative edge weights, the minimum cut problem is to partition the vertices into two sets so that the sum of edge weights between the two sets is minimized. A minimum cut is often also referred to as the edge connectivity of a graph [14, 26]. The problem has applications in many fields. In particular, for network reliability [17, 32], assuming equal failure chance on edges, the smallest edge cut in the network has the highest chance to disconnect the network; in VLSI design [23], to minimize the number of connections between microprocessor blocks; and as a subproblem in the branch-and-cut algorithm for solving the Traveling Salesman Problem and other combinatorial problems [29]. For minimum cut algorithms to be viable for these (and other) applications they must be fast on small data sets-and scale to large data sets. Thus, an algorithm should have either linear or near-linear run- ning time, or have an efficient parallelization. Note that all existing exact algorithms have non-linear run- ning time [13, 14, 18], where the fastest of these is the deterministic algorithm of Henzinger et al. [14] with running time O(cid:0)m log2 n log log2 n(cid:1). Although this is arguably near-linear theoretical running time, Stein [18] which finds a minimum cut only with high probability, requires O(cid:0)n2 log3 n(cid:1) time, later im- proved by Karger [16] to O(cid:0)m log3 n(cid:1). There is a linear time approximation algorithm, namely the (2 + ε)- it is not known how the algorithm performs in practice. Even the randomized algorithm of Karger and approximation algorithm by Matula [25]. However, the quality of Matula's algorithm in practice is currently unknown-no experiments have been published, although Chekuri et al. provide an implementation [7, 37]. To the best of our knowledge, there exists only one parallel algorithm for the minimum cut problem: Karger and Stein present a parallel variant for their random contraction algorithm [18] which computes a minimum cut with high probability in polylogarithmic time on n2 processors. However, we are unaware of any implementation of this algorithm, or any variant that may be suitable for running in a shared-memory setting. Furthermore, no experiments have been published with any parallelizations. This is not altogether surprising, as previous experimental studies of the minimum cut problem only include instances of up to 85 900 vertices and 1 024 000 edges [24, Table 4.2, Table A.22], which can be solved in milliseconds even without parallelization. 1 Our Results. In this paper, we give the first practical shared-memory parallel algorithm for the minimum cut problem. Our algorithm is heuristic, randomized and has running time O(n + m) when run sequentially. The algorithm works in a multilevel fashion: we repeatedly reduce the input graph size with both heuristic and exact techniques, and then solve the smaller remaining problem with exact methods. Our heuristic technique identifies edges that are unlikely to be in a minimum cut using label propagation introduced by Raghavan et al. [31] and contracts them in bulk. We further combine this technique with the exact reduction routines from Padberg and Rinaldi [28]. We perform extensive experiments comparing our algorithm with other heuristic algorithms as well as exact algorithms on real-world and generated instances, which include graphs on up to 70 million vertices and 5 billion edges-the largest graphs ever used for experiments for the minimum cut problem. Results indicate that our algorithm finds optimal cuts on almost all instances and also that the empirically observed error rate is lower than competing heuristic algorithms that come with guarantees on the solution quality. At the same time, even when run sequentially, our algorithm is significantly faster (up to a factor of 4.85) than other state-of-the-art algorithms. 2 Related Work We review algorithms for the global minimum cut and related problems. A closely related problem is the minimum s-t-cut problem, which asks for a minimum cut with nodes s and t in different partitions. Ford and Fulkerson [9] proved that minimum s-t-cut is equal to maximum s-t-flow. Gomory and Hu [12] observed that the (global) minimum cut can be computed with n−1 minimum s-t-cut computations. For the following decades, this result by Gomory and Hu was used to find better algorithms for global minimum cut using improved maximum flow algorithms [18]. One of the fastest known maximum flow algorithms is the push- relabel algorithm [11] by Goldberg and Tarjan. Hao and Orlin [13] adapt the push-relabel algorithm to pass information to future flow computations. When a push-relabel iteration is finished, they implicitly merge the source and sink to form a new sink and find a new source. Vertex heights are maintained over multiple iterations of push-relabel. With these techniques they achieve a total running time of O(mn log n2 m ) for a graph with n vertices and m edges, which is asymptotically equal to a single run of the push-relabel algorithm. Padberg and Rinaldi [28] give a set of heuristics for edge contraction. Chekuri et al. [7] give an imple- mentation of these heuristics that can be performed in time linear in the graph size. Using these heuristics it is possible to sparsify a graph while preserving at least one minimum cut in the graph. If their algorithm does not find an edge to contract, it performs a maximum flow computation, giving the algorithm worst case running time O(n4). However, the heuristics can also be used to improve the expected running time of other algorithms by applying them on interim graphs [7]. Nagamochi et al. [26, 27] give a minimum cut algorithm which does not use any flow computations. Instead, their algorithm uses maximum spanning forests to find a non-empty set of contractible edges. This contraction algorithm is run until the graph is contracted into a single node. The algorithm has a running time of O(mn + n2 log n). Wagner and Stoer [38] give a simpler variant of the algorithm of Nagamochi, Ono and Ibaraki [27], which has a the same asymptotic time complexity. The performance of this algorithm on real- world instances, however, is significantly worse than the performance of the algorithms of Nagamochi, Ono and Ibaraki or Hao and Orlin, as shown in experiments conducted by Jünger et al. [15]. Both the algorithms of Hao and Orlin or Nagamochi, Ono and Ibaraki achieve close to linear running time on most benchmark instances [7, 15]. There are no parallel implementation of either algorithm known to us. Kawarabayashi and Thorup [20] give a deterministic near-linear time algorithm for the minimum cut problem, which runs in O(m log12 n). Their algorithm works by growing contractible regions using a variant of PageRank [30]. It was later improved by Henzinger et al. [14] to run in O(m log2 n log log2 n) time. 2 Based on the algorithm of Nagamochi, Ono and Ibaraki, Matula [25] gives a (2+ε)-approximation algo- rithm for the minimum cut problem. The algorithm contracts more edges than the algorithm of Nagamochi, Ono and Ibaraki to guarantee a linear time complexity while still guaranteeing a (2 + ε)-approximation fac- tor. Karger and Stein [18] give a randomized Monte Carlo algorithm based on random edge contractions. This algorithm returns the minimum cut with high probability and a larger cut otherwise. c(A) = (cid:80) of the edges; that is, c(E(cid:48)) :=(cid:80) 3 Preliminaries Basic Concepts. Let G = (V, E, c) be a weighted undirected graph with vertex set V , edge set E ⊂ V × V and non-negative edge weights c : E → N. We extend c to a set of edges E(cid:48) ⊆ E by summing the weights e={u,v}∈E(cid:48) c(u, v). We apply the same notation for single nodes and sets of nodes. Let n = V be the number of vertices and m = E be the number of edges in G. The neighborhood N (v) of a vertex v is the set of vertices adjacent to v. The weighted degree of a vertex is the sum of the weight of its incident edges. For brevity, we simply call this the degree of the vertex. For a set of vertices A ⊆ V , we denote by E[A] := {(u, v) ∈ E u ∈ A, v ∈ V \ A}; that is, the set of edges in E that start in A and end in its complement. A cut (A, V \ A) is a partitioning of the vertex set V into two non- empty partitions A and V \ A, each being called a side of the cut. The capacity of a cut (A, V \ A) is (u,v)∈E[A] c(u, v). A minimum cut is a cut (A, V \ A) that has smallest weight c(A) among all cuts in G. We use λ(G) (or simply λ, when its meaning is clear) to denote the value of the minimum cut over all A ⊂ V . At any point in the execution of a minimum cut algorithm, λ(G) (or simply λ) denotes the lowest upper bound of the minimum cut that an algorithm discovered until that point. For a vertex u ∈ V with minimum vertex degree, the size of the trivial cut ({u}, V \ {u}) is equal to the vertex degree of u. Hence, the minimum vertex degree δ(G) can serve as initial bound. When clustering a graph, we are looking for blocks of nodes V1,. . . ,Vk that partition V , i.e., V1 ∪ ··· ∪ Vk = V and Vi ∩ Vj = ∅ for i (cid:54)= j. The parameter k is usually not given in advance. Many algorithms tackling the minimum cut problem use graph contraction. Given an edge (u, v) ∈ E, we define G/(u, v) to be the graph after contracting edge (u, v). In the contracted graph, we delete vertex v and all edges incident to this vertex. For each edge (v, w) ∈ E, we add an edge (u, w) with c(u, w) = c(v, w) to G or, if the edge already exists, we give it the edge weight c(u, w) + c(v, w). The Minimum Cut Algorithm of Nagamochi, Ono and Ibaraki. We discuss the algorithms by Nag- amochi, Ono and Ibaraki [26, 27] in greater detail since our work makes use of the tools proposed by those authors. The minimum cut algorithm of Nagamochi, Ono and Ibaraki works on graphs with positive integer weights and computes a minimum cut by building edge-disjoint maximum spanning forests and contracting all edges that are not in one of the λ − 1 first spanning forests. There is at least one minimum cut that con- tains no contracted edges. The algorithm has worst case running time O(cid:0)mn + n2 log n(cid:1). In experimental evaluations [7, 15] it is one of the fastest minimum cut algorithms on real-world instances. The algorithm uses a modified breadth-first graph traversal (BFS) algorithm [26, 27] to find edges that can be contracted without increasing the minimum cut. The algorithm starts at an arbitrary vertex. In each step, the algorithm then visits the vertex that is most strongly connected to the already visited vertices. Using the modified BFS routine, the algorithm computes a lower bound q(e) for each edge e = (v, w) for the smallest cut λ(G, v, w), which places v and w on different sides of the cut. After finishing the BFS, all edges with q(e) ≥ λ are contracted as there exists at least one minimum cut without these edges. Afterwards, the algorithm continues on the contracted graph. A single iteration of the subroutine can be performed in O(m + n log n). The authors show that in each BFS run, at least one edge of the graph can be 3 contracted [26]. This yields a total running time of O(mn + n2 log n). However, in practice the number of iterations is typically much less than n − 1, often scaling proportional to log n. 4 VieCut: A Parallel Heuristic Minimum-Cut Algorithm In this section we explain our new approach to the minimum cut problem. Our algorithm is based on edge contractions: we find densely connected vertices in the graph and contract those into single vertices. Due to the way contractions are defined, we ensure that a minimum cut of the contracted graph corresponds to a minimum cut of the input graph. Once the graph is contracted, we apply exact reductions. These two contraction steps are repeated until the graph has a constant number of vertices. We apply an exact minimum cut algorithm to find the optimal cut in the contracted graph. Throughout our algorithm we maintain a variable λ, which denotes the current lowest upper bound for the minimum cut. In the beginning, λ equals the minimum node degree of G. After every contraction, if the minimum node degree in the contracted graph is smaller than λ, we set λ to the minimum node degree of the contracted graph. As we only perform contractions and thus do not introduce any new cuts¸ we can guarantee that our algorithm will never output a value that is lower than the minimum cut. The rest of this section is organized as follows: first we give a general overview of our algorithm. Then we introduce the label propagation algorithm [31], which we use to find clusters in the input graph. Note that cluster contraction is an aggressive contraction technique. In contrast to previous approaches, it enables us to drastically shrink the size of the input graph. The intuition behind this technique is that each cluster consists of a set of nodes that all belong to the same side of the cut; as there are usually many edges inside the clusters and only a few between clusters. Thus we contract each cluster. We continue this section with the description of the Padberg-Rinaldi heuristics [28]. These are a set of conditions that can be used to find edges that can be contracted without increasing the value of the minimum cut. We use these contractions to further contract the graph after the label propagation step. Both contractions are repeated until the graph has a constant number of vertices. Then, we apply an exact minimum cut algorithm. We finish the section with a discussion of our parallelization. 4.1 Fast Minimum Cuts The algorithm of Karger and Stein spends a large amount of time computing graph contractions recursively. One idea to speed up their algorithm therefore, is to increase the number of contracted edges per level. However, this strategy is undesirable: it increases the error both in theory and in practice, as their algorithm selects edges for contraction at random. We solve this problem by introducing an aggressive coarsening strategy that contracts a large number of edges that are unlikely to be in a minimum cut. We first give a high level overview before diving into the details of the algorithm. Our algorithm starts by using a label propagation algorithm to cluster the vertices into densely connected clusters. We then use a correcting algorithm to find misplaced vertices that should form a singleton cluster. Finally, we contract the graph and apply the exact reductions of Padberg and Rinaldi [28]. We repeat these contraction steps until the graph has at most a constant number n0 of vertices. When the contraction step is finished we apply the algorithm of Nagamochi, Ono and Ibaraki [27] to find the minimum cut of the contracted graph. Finally, we transfer the resulting cut into a cut in the original graph. Pseudocode can be found in Appendix A. The label propagation algorithm (LPA) was proposed by Raghavan et al. [31] for graph clustering. It is a fast algorithm that locally minimizes the number of edges cut. We outline the algorithm briefly. Initially, each node is in its own cluster/block, i.e. the initial block ID of a node is set to its node ID. The algorithm then works in rounds. In each round, the nodes of the graph are traversed in a random order. When a node 4 v is visited, it is moved to the block that has the strongest connection to v, i.e. it is moved to the cluster C that maximizes c({(v, u) u ∈ N (v)∩ C}). Ties are broken uniformly at random. The block IDs of round i are used as initial block IDs of round i + 1. In the original formulation [31], the process is repeated until the process converges and no vertices change their labels in a round. Kothapalli et al. [21] show that label propagation finds all clusters in few iterations with high probability, when the graph has a distinct cluster structure. Hence, we perform at most (cid:96) iterations of the algorithm, where (cid:96) is a tuning parameter. One LPA round can be implemented to run in O(n + m) time. As we only perform (cid:96) iterations, the algorithm runs in O(n + m) time as long as (cid:96) is a constant. In this formulation the algorithm has no bound on the number of clusters. However, we can modify the first iteration of the algorithm, so that a vertex i is not allowed to change its label when another vertex already moved to block i. In a connected graph this guarantees that each cluster has at least two vertices and the contracted graph has at most V 2 vertices. The only exception are connected components consisting of only a single vertex, i.e. isolated vertices with a degree of 0, which can not be contracted by the label propagation algorithm. However, when such a vertex is detected, our minimum cut algorithm terminates immediately. In practice we do not use the modification, as the label propagation usually returns far fewer than V Once we have computed the clustering with label propagation, we search for single misplaced vertices using a correcting algorithm. A misplaced vertex is a vertex, whose removal from its cluster improves the minimum weighted degree of the contracted graph. Figure 1 gives an example in which the clustering misplaces a vertex. To find misplaced vertices, we sweep over all vertices and check for each vertex whether it is misplaced. We only perform this correcting algorithm on small clusters, which have a size of up to log2(n) vertices, as it is likely that large clusters would have more than a single node misplaced at a time. In general, one can enhance this algorithm by starting at any node whose removal would lower the cluster degree and greedily adding neighbors whose removal further lowers the remaining cluster degree. However, even when performing this greedy search on all clusters, this did not yield further improvement over the single vertex version on small clusters. 2 clusters. After we computed the final clustering, we contract it to obtain a coarser graph. Contracting the cluster- ing works as follows: each block of the clustering is contracted into a single node. There is an edge between two nodes u and v in the contracted graph if the two corresponding blocks in the clustering are adjacent to each other in G, i.e. block u and block v are connected by at least one edge. The weight of an edge (A, B) is set to the sum of the weight of edges that run between block A and block B of the clustering. Our contractions ensure that a minimum cut of the coarse graph corresponds to a cut of the finer graph with the same value, but not vice versa: we can not guarantee that a minimum cut of the contracted graph is equal to a minimum cut of the original graph. It is possible that a single cluster contains nodes from both sides of the cut. In this case, contracting the cluster eliminates this minimum cut. If all minimum cuts are eliminated, λ(GC) > λ(G). Thus our newly introduced reduction for the minimum cut problem is inexact. However, the following lemma holds (the proof can be found in Appendix B): Lemma 1. If there exist a minimum cut of G such that each cluster of the clustering C is completely con- tained in one side of the minimum cut of G and VC > 1, then λ(G) = λ(GC). Exact Reductions by Padberg and Rinaldi. We use the Padberg-Rinaldi reductions to further shrink the size of the graph. These are exact reductions, which do not modify the size of the minimum cut. Our algorithm contracts all edges which are marked by the Padberg-Rinaldi heuristics. In our experiments, we also tried run the exact reductions first and cluster contraction last. However, this resulted in a slower algorithm since not many exact reductions could be applied on the initial unweighted network. We now briefly discuss the exact reductions by Padberg and Rinaldi [28]: 5 Fig. 1: A case in which label propagation misplaces vertices. Left: label propagation assigns the centered vertex correctly to the left (red) cluster. However, this results in a situation in which the contracted graph does not contain the minimum cut anymore. Setting the centered vertex to be a singleton fixes this problem. Lemma 2 (Padberg-Rinaldi). If two vertices v, w ∈ V with an edge (v, w) ∈ E satisfy at least one of the following four conditions and (v, w) is not the only edge adjacent to either v or w, then they can be contracted without increasing the value of the minimum cut: 1) c(v, w) ≥ λ, 2) c(v) ≤ 2c(v, w) or c(w) ≤ 2c(v, w), 3) ∃u ∈ V such that c(v) ≤ 2{c(v, w) + c(v, u)} and c(w) ≤ 2{c(v, w) + c(w, u)}, or 4) c(v, w) +(cid:80) u∈V min{c(v, u), c(w, u)} ≥ λ. We use this lemma to find contractible edges in the graph. In our implementation, we perform so-called "runs" of the Padberg-Rinaldi heuristics similar to the implementation of Chekuri et al. [7], where each run takes linear time and is split into two passes. In the first pass of a run, we iterate over all edges of G and check conditions 1 and 2. Whenever we encounter an edge (u, v), that satisfies either condition 1 or 2, we mark it as contractible. After finishing the pass, we build the contracted graph. More precisely, we perform contraction in linear time by deleting all unmarked edges, contracting connected components and then re- adding the deleted edges as defined in the contraction process. In practice, we achieve better performance using a union-find data structure [10], which results in a running time of O(nα(n) + m) 3 It is not possible to perform an exhaustive check for conditions 3 and 4 on all triangles in G in linear time, as a graph might have as many as Θ(m 2 ) triangles [33]. In the beginning of a pass, we mark each vertex as unscanned. When scanning two adjacent unscanned vertices v and w, we check condition 3 for all vertices u in the common neighborhood N (v) ∩ N (w). As we iterate over all vertices in the common neighborhood, we can compute the sum in condition 4 by adding up the smaller of the two edge weights for each vertex in the common neighborhood. Afterwards we mark both v and w as scanned. This ensures a time complexity of O(n + m), as each edge is processed at most twice. However, not for all possible edges (v, w) it is tested whether the vertices v and w can be contracted. Final Step: Exact Minimum Cut Algorithm. To find the minimum cut of the final problem kernel, we use the minimum cut algorithm of Nagamochi, Ono and Ibaraki, as described in Section 3. Lemma 3. The algorithm VieCut has a running time complexity of O(n + m). (Proof in Appendix B) 4.2 Parallelization We describe how to parallelize VieCut. We parallelize each part of the algorithm, except the final invoca- tion of the algorithm of Nagamochi, Ono, and Ibaraki. 6 2222232 Parallel Label Propagation. To perform the label update for vertex v, we only need to consider vertices in the neighborhood N (v). Therefore the label propagation algorithm can be implemented in parallel on shared-memory machines [35] using the parallel for directive from the OpenMP [8] API. We store the cluster affiliation for all vertices in an array of size n, where position i denotes the cluster affiliation of vertex i. We explicitly do not perform label updates in a critical section, as each vertex is only traversed once and the race conditions are not critical but instead introduce another source of randomness. Parallel Correcting Step. As the clusters are independent of each other for this correcting step, we parallelize it a cluster level, i.e. a cluster is checked by a single thread but each thread can check a different cluster without the need for locks or mutexes. Parallel Graph Contraction. After label propagation has partitioned the graph into c clusters, we build the cluster graph. As the time to build this contracted graph is not negligible, we parallelize graph contraction as well. One of the p threads performs the memory allocations to store the contracted graph, while the other p − 1 threads prepare the data for this contracted graph. When c2 > n, we parallelize the graph on a cluster level. To build the contracted vertex for cluster C, we iterate over all outgoing edges e = (u, v) for all vertices randomness and graph locality by randomly shuffling small blocks of vertex IDs but traversing these shuffled blocks successively. If v ∈ C, we discard the edge, otherwise we add c(u, v) to the edge weight between C and the cluster of vertex v. When c2 < n, we achieve lower running time and better scaling when every thread builds a temporary graph data structure. In this contraction step, the vertices are assigned to thread at runtime. These temporary graphs are then combined by a single thread. Parallel Padberg-Rinaldi. In parallel, we run the Padberg-Rinaldi reductions 1, 3 and 4 on the contracted graph. As these criteria are local and independent, they can be parallelized trivially. Updates to the union- find data structure are inside of a critical section. Performing reduction 2 in parallel would entail in additional locks, as the vertex weights need to be updated on edge contraction. 4.3 Further Details The label propagation algorithm by Raghavan et al. [31] traverses the graph vertices in random order. Other implementations of the algorithm [35] omit this explicit randomization and rely on implicit randomization through parallelism, as the vertex processing order in parallel label propagation is non-deterministic. Our implementation to find the new label of a vertex v in uses an array, in which we sum up the weights for all clusters in the neighborhood N (v). Therefore randomizing the vertex traversal order would destroy any graph locality, leading to many random reads in the large array, which is very cache inefficient. Thus we trade off randomness and graph locality by randomly shuffling small blocks of vertex ids but traversing these shuffled blocks successively. Using a time-forward processing technique [40] the label propagation as well as the contraction algo- rithm can be implemented in external memory [1] using Sort(E) I/Os overall. Hence, if we only use the label propagation contraction technique in external memory and use the whole algorithm as soon as the graph fits into internal memory, we directly obtain an external memory algorithm for the minimum cut problem. We do not further investigate this variant of the algorithm as our focus is on fast internal memory algorithms for the problem. 7 5 Experiments In this section we compare our algorithm VieCut with existing algorithms for the minimum cut problem on real-world and synthetic graphs. We compare the sequential variant of our algorithm to efficient imple- mentations of existing algorithms and show how our algorithm scales on a shared-memory machine. Experimental Setup and Methodology. We implemented the algorithms using C++-17 and compiled all codes using g++-7.1.0 with full optimization (-O3). All of our experiments are conducted on a machine with two Intel Xeon E5-2643 v4 with 3.4GHz with 6 CPU cores each and 1.5 TB RAM in total. In general, we perform five repetitions per instance and report the average running time as well as cut. Algorithms. We compare our algorithm with our implementations of the algorithm of Nagamochi, Ono and Ibaraki (NOI) [27] and the (2 + ε)-approximation algorithm of Matula (Matula) [25]. In addition, we compare against the algorithm of Hao and Orlin (HO) [13] by using the implementation of Chekuri et al. [7]. We also performed experiments with Chekuri et al. 's implementations of NOI, but our implementation is generally faster. For HO, Chekuri et al. give variants with and without Padberg-Rinaldi tests and with an excess detection heuristic [7], which contracts nodes with large pre-flow excess. We use three variants of the algorithm of Hao and Orlin in our experiments: HO_A uses Padberg-Rinaldi tests, HO_B uses excess detection and HO_C uses both. We also use their implementation of the algorithm of Karger and Stein [7, 18, 37] (KS) without Padberg-Rinaldi tests. We only perform a single iteration of their algorithm, as this is already slower than all other algorithms. Note that performing more iterations yields a smaller error probability, but also makes the algorithm even slower. The implementation crashes on very large instances due to overflows in the graph data structure used to for edge contractions. We do not include the algorithm by Stoer and Wagner [38], as it is far slower than NOI and HO [7, 15] and was also slower in preliminary experiments we conducted. We also do not include the near-linear algorithm of Henzinger et al. [14], as the other algorithms are quasi linear in most instances examined and the algorithm of Henzinger et al. has large constants. We performed preliminary experiments with the core of the algorithm, which indicate that the algorithm is slower in practice. Instances. We perform experiments on clustered Erdos-Rényi graphs that are generated using the generator from Chekuri et al. [7], which are commonly used in the literature [7, 15, 27, 28]. We also perform experi- ments on random hyperbolic graphs [22, 39] and on large undirected real-world graphs taken from the 10th DIMACS Implementation Challenge [2] as well as the Laboratory for Web Algorithmics [4, 5]. As these graphs contain vertices with low degree (and therefore trivial cuts), we use the k-core decomposition [3], which gives the largest subgraph, in which each vertex has a degree of at least k, to generate input graphs. We use the largest connected components of these core graphs to generate graphs in which the minimum cut is not trivial. For every real-world graph, we use k-cores for four different values of k. Appendix C shows basic properties of all graph instances in more detail. The graphs used in our experiments have up to 70 million vertices and up to 5 billion edges. To the best of our knowledge, these graphs are the largest instances reported in literature to be used for experiments on global minimum cuts. Configuring the Algorithm. In preliminary experiments we tuned the parameters of our algorithm on smaller random hyperbolic graphs. These experiments have been performed on instances not used for the evaluation here. We detail these experiments in Appendix D, and omit them here due to space constraints. In further experiments conducted in this section, we use the configuration of VieCut given by the parameter 8 n = 12.5K - 200K, d = 10%, k = 2 n = 100K, d = 10%, k = 2 - 128 n = 100K, d = 2.5% - 100%, k = 2 29 28 27 26 25 ) s n ( e g d E r e p i e m T g n i n n u R 12.5K 25K 50K 100K 150K Number of Vertices 211 210 29 28 27 26 25 24 200K 29 28 27 26 25 KS HO_A HO_B HO_C NOI Matula seqVieCut 2 8 16 32 64 128 2.510 25 50 75 100 Number of Clusters Density [%] Fig. 2: Total running time in nanoseconds per edge in clustered Erdos-Rényi graphs tuning in Appendix D, which performs two iterations of LPA and randomly shuffles blocks of 128 vertices each. We set the bound n0 to 10 000 and did not encounter a single instance with more than a single bulk contraction step. 5.1 Experimental Results Clustered Erdos-Rényi Graphs. Clustered Erdos-Rényi graphs have distinct small cuts between the clusters and do not have any other small cuts. We perform three experiments varying one parameter of the graph class and use default parameters for the other two parameters. Our default parameters are n = 100 000, d = 10% and k = 2. The code of Chekuri et al. [7] uses 32 bit integers to store vertices and edges. We could therefore not perform the experiments with m ≥ 231 with HO. Figure 2 shows the results for these experiments. First of all, on 20% of the instances KS returns non-optimal results. No other algorithm returned any non-optimal minimum cuts on any graph of this dataset. Moreover, seqVieCut is the fastest algorithm on all of these instances, followed by Matula, which is 40 to 100% slower on these instances. seqVieCut is faster on graphs with a lower number of vertices, as the array containing cluster af- filiations – which has one entry per vertex and is accessed for each edge – fits into cache. In graphs with k = 2, 4, 8, the final number of clusters in the label propagation algorithm is equal to k, as label propagation correctly identifies the clusters. In the graph contraction step, we iterate over all edges and check whether the incident vertices are in different clusters. For this branch, the compiler assumes that they are indeed in different cluster. However, in these graphs, the chance for any two adjacent nodes being in the same cluster is 1 k , which is far from zero. This results in a large amount of branch misses (for n = 100 000, d = 10%, k = 2: average 14% branch misses, in total 1.5 billion missed branches). Thus the performance is better with higher values of k. The fastest exact algorithm is NOI. This matches the experiments by Chekuri et al. [7]. Random Hyperbolic Graphs. We now perform experiments on random hyperbolic graphs with n = 220−225 and an average degree of 25 − 28. We generated 3 graphs for each of the 24 possible combinations yielding a total of 72 RHG graphs. Note that these graphs are hard instances for the inexact algorithms, as they contain few – usually only one – small cuts and both sides of the cut are large. From a total of 360 runs, seqVieCut does not return the correct minimum cut in 1% of runs and Matula does not return the correct minimum cut in 31% of runs. KS, which crashes on large instances, returns non-optimal cuts in 52% of the runs where it ran to completion. Figure 3 shows the results for these experiments. On nearly all of these 9 Average Node Degree: 25 Average Node Degree: 26 Average Node Degree: 27 Average Node Degree: 28 ] ) s n ( [ e g d E r e p e m T g n i n n u R i 29 28 27 26 220 211 210 29 28 27 26 225 220 222 221 224 Number of Vertices 223 28 27 26 225 220 222 221 224 Number of Vertices 223 29 28 27 26 25 225 220 222 221 224 Number of Vertices 223 222 221 224 Number of Vertices 223 KS HO_A HO_B HO_C NOI Matula seqVieCut 225 Fig. 3: Total running time in nanoseconds per edge in RHG graphs graphs, NOI is faster than HO. On the sparse graphs with an average degree of 25, seqVieCut, Matula and NOI nearly have equal running time. On denser graphs with an average degree of 28, seqVieCut is 40% faster than Matula and 4 to 10 times faster than NOI. HO_A and HO_C use preprocessing with the Padberg-Rinaldi heuristics. Multiple iterations of this preprocessing contract the RHG graph into two nodes. The running time of those algorithms is 50% higher on sparse graphs and 4 times higher on dense graphs compared to seqVieCut. Figure 7 shows a time breakdown for seqVieCut on large RHG graphs with n = 225. Around 80% of the running time is in the label propagation step and the rest is mostly spent in graph contraction. The correcting step has low running time on most graphs, as it is not performed on large clusters. Real-World Graphs. We now run experiments on six large real-world social and web graphs. Most of these graphs have many small cuts. On these graphs, there are no non-optimal minimum cuts for any algorithm except for KS, which has 36% non-optimal results. Figure 4 gives slowdown plots to the fastest algorithm (seqVieCut in each case) for the real-world graphs. On these graphs, seqVieCut is the fastest algorithm, far faster than the other algorithms. Matula is not much faster than NOI, as most of the running time is in the first iteration of their BFS algorithm, which is similar for both algorithms. On the largest real-world graphs, seqVieCut is approximately 3 times faster than the next fastest algorithm Matula. We also see that seqVieCut, Matula and NOI all perform better on denser graphs. For Matula and NOI, this can most likely be explained by the smaller vertex priority queue. For seqVieCut, this is mainly due to better cache locality. As HO does not benefit from denser graphs, it has high slow down on dense graphs. The highest speedup in our experiments is in the 10-core of gsh-2015-host, where seqVieCut is faster than the next fastest algorithm (Matula) by a factor of 4.85. The lowest speedup is in the 25-core of twitter-2010, where seqVieCut is 50% faster than the next fastest algorithm (HO_B). The average speedup factor of seqVieCut to the next fastest algorithm is 2.37. NOI and Matula perform badly on the cores of the graph twitter-2010. This graph has a very low diameter (average distance is 4.46), and as a consequence the priority queue used in these algorithms is filled far quicker than in graphs with higher diameter. Therefore the priority queue operations become slow and the total running time is very high. To summarize, both in generated and real-world graphs, even in sequential runs seqVieCut is up to a factor of 6 faster than the state of the art, while achieving a high solution quality even for hard instances such as the hyperbolic graphs. The performance of seqVieCut is especially good on the real-world graphs, presumably as these graphs have high locality. Shared-Memory Parallelism. Figure 5 shows the speedup of parVieCut compared to the sequential vari- ant and to the next fastest algorithm, which is Matula in all of the large graph examined. We examine the largest graphs from each of the three graph classes and perform parallel runs using 1, 2, 3, . . . , 12 threads. 10 Fig. 4: Slowdowns of competitors to VieCut in large real-world graphs. We display slowdowns based on the absolute number of edges (left), and by the average vertex degree (right) in the graph RHG, n ≈ 225, m ≈ 232 gsh-2015-host, k = 10 uk-2007-05, k = 10 n = 200K, d = 10%, k = 2 n = 100K, d = 100%, k = 2 l a i t n e u q e S o t p u d e e p S 4 3 2 1 0 4 3 2 1 0 24 12 4 6 8 12 Number of Threads 12 4 6 8 12 Number of Threads 6 5 4 3 2 1 0 24 12 8 6 4 2 1 24 12 4 6 8 12 Number of Threads 12 8 6 4 2 1 24 parVieCut Matula 12 4 6 8 12 Number of Threads 24 12 4 6 8 12 Number of Threads Fig. 5: Speedup on large graphs over our algorithm using 1 thread. We also perform experiments with 24 threads, as the machine has 12 cores and supports multi-threading. On average, parVieCut with 12 is 6.3 times faster than seqVieCut (24 threads: 7.9x faster), while still having a low error rate even on hard instances. On large RHG graphs we have 2 non-optimal results out of 195 runs. All other results of parVieCut on large graphs were optimal. Compared to the next fastest sequential algorithm Matula, this is an average speedup factor of 13.2 (24 threads: 15.8x faster). parVieCut scales better on the graph uk-2007-05 (k = 10) and especially on the clustered Erdos- Rényi graphs, presumably as these graphs contain many vertices with high degree. Figure 8 shows average running time breakdowns averaged over all graphs. For this figure, the correcting algorithm is turned off for the two Erdos-Rényi graphs. We can see that label propagation scales better than graph contraction. With one thread, label propagation uses 81% of the total running time, with 24 threads, it uses 71% of the total running time. 6 Conclusions and Future Work We presented the linear-time heuristic algorithm VieCut for the minimum cut problem. VieCut is based on the label propagation algorithm [31] and the Padberg-Rinaldi heuristics [28]. Both on real-world graphs and a varied family of generated graphs, VieCut is significantly faster than the state of art. Our algorithm has far higher solution quality than other heuristic algorithms while also being faster. Important future work includes checking whether using better clustering techniques affect the observed error probability. However, these clustering algorithms generally have higher running time. 11 20212223241071081091010Slow DownNumber of EdgesKSHOAHOBHOCNOIMatula2021222324101102103104Slow DownAverage DegreeKSHOAHOBHOCNOIMatula Acknowledgements The research leading to these results has received funding from the European Research Council under the Eu- ropean Community's Seventh Framework Programme (FP7/2007-2013) /ERC grant agreement No. 340506 References [1] Y. Akhremtsev, P. Sanders, and C. Schulz. (semi-) external algorithms for graph partitioning and clus- tering. In 2015 Proceedings of the Seventeenth Workshop on Algorithm Engineering and Experiments (ALENEX), pages 33–43. SIAM, 2014. [2] D. Bader, A. Kappes, H. Meyerhenke, P. Sanders, C. Schulz, and D. Wagner. Benchmarking for Graph Clustering and Partitioning. In Encyclopedia of Social Network Analysis and Mining. Springer, 2014. [3] V. Batagelj and M. Zaversnik. An O(m) algorithm for cores decomposition of networks. arXiv preprint cs/0310049, 2003. [4] P. Boldi, M. Rosa, M. Santini, and S. Vigna. Layered label propagation: A multiresolution coordinate- free ordering for compressing social networks. In S. Srinivasan, K. Ramamritham, A. Kumar, M. P. Ravindra, E. Bertino, and R. Kumar, editors, Proceedings of the 20th International Conference on World Wide Web, pages 587–596. ACM Press, 2011. [5] P. Boldi and S. Vigna. The WebGraph framework I: Compression techniques. In Proc. of the Thirteenth International World Wide Web Conference (WWW 2004), pages 595–601, Manhattan, USA, 2004. ACM Press. [6] D. Chakrabarti and C. Faloutsos. Graph mining: Laws, generators, and algorithms. ACM Computing Surveys, 38(1):2, 2006. [7] C. S. Chekuri, A. V. Goldberg, D. R. Karger, M. S. Levine, and C. Stein. Experimental study of mini- mum cut algorithms. In Proceedings of the 8th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA '97), pages 324–333. SIAM, 1997. [8] L. Dagum and R. Menon. OpenMP: An industry standard API for shared-memory programming. IEEE Computational Science and Engineering, 5(1):46–55, 1998. [9] L. R. Ford and D. R. Fulkerson. Maximal flow through a network. Canadian Journal of Mathematics, 8(3):399–404, 1956. [10] B. A. Galler and M. J. Fisher. An improved equivalence algorithm. Communications of the ACM, 7(5):301–303, 1964. [11] A. V. Goldberg and R. E. Tarjan. A new approach to the maximum-flow problem. Journal of the ACM, 35(4):921–940, 1988. [12] R. E. Gomory and T. C. Hu. Multi-terminal network flows. Journal of the Society for Industrial and Applied Mathematics, 9(4):551–570, 1961. [13] J. Hao and J. B. Orlin. A faster algorithm for finding the minimum cut in a graph. In Proceedings of the 3rd Annual ACM-SIAM Symposium on Discrete Algorithms, pages 165–174. Society for Industrial and Applied Mathematics, 1992. [14] M. Henzinger, S. Rao, and D. Wang. Local flow partitioning for faster edge connectivity. In Proceed- ings of the 28th Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1919–1938. SIAM, 2017. [15] M. Jünger, G. Rinaldi, and S. Thienel. Practical performance of efficient minimum cut algorithms. Algorithmica, 26(1):172–195, 2000. 12 [16] D. R. Karger. Minimum cuts in near-linear time. Journal of the ACM, 47(1):46–76, 2000. [17] D. R. Karger. A randomized fully polynomial time approximation scheme for the all-terminal network reliability problem. SIAM Review, 43(3):499–522, 2001. [18] D. R. Karger and C. Stein. A new approach to the minimum cut problem. Journal of the ACM, 43(4):601–640, 1996. [19] G. Karypis and V. Kumar. Metis: A software package for partitioning unstructured graphs, partitioning meshes, and computing fill-reducing orderings of sparse matrices, version 4, 1998. [20] K.-i. Kawarabayashi and M. Thorup. Deterministic global minimum cut of a simple graph in near- linear time. In Proceedings of the 47th Annual ACM on Symposium on Theory of Computing, pages 665–674. ACM, 2015. [21] K. Kothapalli, S. V. Pemmaraju, and V. Sardeshmukh. On the analysis of a label propagation algo- rithm for community detection. In Proceedings of the 14th International Conference on Distributed Computing and Networking (ICDCN 2013), volume 7730 of LNCS, pages 255–269. Springer, 2013. [22] D. Krioukov, F. Papadopoulos, M. Kitsak, A. Vahdat, and M. Boguná. Hyperbolic geometry of complex networks. Physical Review E, 82(3):036106, 2010. [23] B. Krishnamurthy. An improved min-cut algorithm for partitioning VLSI networks. IEEE Transactions on Computers, 33(5):438–446, 1984. [24] M. S. Levine. Experimental study of minimum cut algorithms. Master's thesis, Massachusetts Institute of Technology, 1997. [25] D. W. Matula. A linear time 2 + ε approximation algorithm for edge connectivity. In Proceedings of the 4th annual ACM-SIAM Symposium on Discrete Algorithms, pages 500–504. SIAM, 1993. [26] H. Nagamochi and T. Ibaraki. Computing edge-connectivity in multigraphs and capacitated graphs. SIAM Journal on Discrete Mathematics, 5(1):54–66, 1992. [27] H. Nagamochi, T. Ono, and T. Ibaraki. Implementing an efficient minimum capacity cut algorithm. Mathematical Programming, 67(1):325–341, 1994. [28] M. Padberg and G. Rinaldi. An efficient algorithm for the minimum capacity cut problem. Mathemat- ical Programming, 47(1):19–36, 1990. [29] M. Padberg and G. Rinaldi. A branch-and-cut algorithm for the resolution of large-scale symmetric traveling salesman problems. SIAM Review, 33(1):60–100, 1991. [30] L. Page, S. Brin, R. Motwani, and T. Winograd. The PageRank citation ranking: Bringing order to the web. Technical report, Stanford InfoLab, 1999. [31] U. N. Raghavan, R. Albert, and S. Kumara. Near linear time algorithm to detect community structures in large-scale networks. Physical Review E, 76(3):036106, 2007. [32] A. Ramanathan and C. J. Colbourn. Counting almost minimum cutsets with reliability applications. Mathematical Programming, 39(3):253–261, 1987. [33] T. Schank and D. Wagner. Finding, counting and listing all triangles in large graphs, an experimental study. In Proceedings of the 4th International Workshop on Experimental and Efficient Algorithms (WEA 2005), volume 3503 of LNCS, pages 606–609. Springer, 2005. [34] S. B. Seidman. Network structure and minimum degree. Social Networks, 5(3):269–287, 1983. [35] C. L. Staudt and H. Meyerhenke. Engineering high-performance community detection heuristics for massive graphs. In Proceedings of the 42nd International Conference on Parallel Processing (ICPP 2013), pages 180–189. IEEE, 2013. [36] C. L. Staudt, A. Sazonovs, and H. Meyerhenke. NetworKit: An interactive tool suite for high- performance network analysis. CoRR, abs/1403.3005, 2014. [37] C. Stein and M. Levine. Minimum cut code. http://www.columbia.edu/~cs2035/code. html, 1996. Accessed: 2017-06-09. 13 [38] M. Stoer and F. Wagner. A simple min-cut algorithm. Journal of the ACM, 44(4):585–591, 1997. [39] M. von Looz, H. Meyerhenke, and R. Prutkin. Generating random hyperbolic graphs in subquadratic time. In Proceedings of the 26th International Symposium on Algorithms and Computation (ISAAC 2015), volume 9472 of LNCS, pages 467–478. Springer, 2015. [40] N. Zeh. I/o-efficient graph algorithms. EEF Summer School on Massive Data Sets, 2002. A Algorithm Overview Algorithm 1: VieCut 1 input graph G = (V, E, c : V → N>0), n0 : bound for exact algorithm 3 G ← G 4 while VG > n0 do 2 // compute inexact kernel C ← computeClustering(G) C(cid:48) ← fixMisplacedVertices(G, C) GC(cid:48) ← contractClustering(G, C(cid:48)) 5 6 7 8 // further apply exact reductions E ← findContractableEdges(GC(cid:48)) G ← contractEdges(GC(cid:48), E) 9 10 11 end 12 (A, B) ← NagamochiOnoIbaraki(G) 13 (A(cid:48), B(cid:48)) ← solutionTransfer(A, B) 14 15 return (A(cid:48), B(cid:48)) // label propagation clustering // fix misplaced vertices // perform contraction // find contractable edges with Padberg-Rinaldi // perform contraction // solve minimum cut problem on final kernel // transfer solution to input network B Proofs Lemma 1. If there exist a minimum cut of G such that each cluster of the clustering C is completely con- tained in one side of the minimum cut of G and VC > 1, then λ(G) = λ(GC). Proof. As node contraction removes cuts but does not add any new cuts, λ(GC) ≥ λ(G) for each contraction with VC > 1. For an edge e in G, which is not part of some minimum cut of G, λ(G) = λ(G/e) [18]. Contraction of a cluster C in G can also be represented as the contraction of all edges in any spanning tree of C. If the cluster C is on one side of the minimum cut, none of the spanning edges are part of the minimum cut. Thus we can contract each of the edges without affecting the minimum cut of G. We can perform this (cid:3) contraction process on each of the clusters and λ(GC) = λ(G). Lemma 3. The algorithm VieCut has a running time complexity of O(n + m). Proof. One round of all reduction and contraction steps (Algorithm 1, lines 4-11) can be performed in O(n + m). The label propagation step contracts the graph by at least a factor of 2, which yields geometri- cally shrinking graph size and thus a total running time of O(n + m). We break this loop when the contracted 14 graph has less than some constant n0 number of vertices. The exact minimum cut of this graph with con- stant size can therefore be found in constant time. The solution transfer can be performed in linear time by performing the coarsening in reverse and pushing the two cut sides from each graph to the next finer graph. When the graph is not connected, throughout the algorithm one of the contracted graphs can contain isolated vertices, which our algorithm does not contract. However, when we discover an isolated vertex, our (cid:3) algorithm terminates, as the graph certainly has a minimum cut of 0. C Instances 2 Clustered Erdos-Rényi Graphs. Many previous experimental studies of minimum cut algorithms used a family of clustered Erdos-Rényi graphs with m = O(n2) [7, 15, 27, 28]. This family of graphs is specified by the following parameters: number of vertices n = V , d the graph density as a percentage where m = E = n·(n−1) · d 100 and the number of clusters k. For each edge (u, v), the integral edge weight c(u, v) is generated independently and uniformly in the interval [1, 100]. When the vertices u and v are in the same cluster, the edge weight is multiplied by n, resulting in edge weights in the interval [n, 100n]. Therefore the minimum cut can be found between two clusters with high probability. We performed three experiments on this family of graphs. In each of these experiments we varied one of the graph parameters and fixed the other two parameters. These experiments are similar to older experiments [7, 15, 27, 28] but scaled to larger graphs to account for improvements in machine hardware. We use the generator noigen of Andrew Goldberg [37] to generate the clustered Erdos-Rényi graphs for these experiments. This generator was also used in the study conducted by Chekuri et al. [7]. As our code uses the METIS [19] graph format, we use a script to translate the graph format. All experiments exclude I/O times. Random Hyperbolic Graphs (RHG) [22]. Random hyperbolic graphs replicate many features of real- world networks [6]: the degree distribution follows a power law, they often exhibit a community structure and have a small diameter. In denser hyperbolic graphs, the minimum cut is often equal to the minimum degree, which results in a trivial minimum cut. In order to prevent trivial minimum cuts, we use a power law exponent of 5. We use the generator of von Looz et al. [39], which is a part of NetworKIT [36], to generate unweighted random hyperbolic graphs with 220 to 225 vertices and an average vertex degree of 25 to 28. These graphs generally have very few small cuts and the minimum cut has two partitions with similar sizes. Real-world Graphs. We use large real-world web graphs and social networks from [2, 4, 5], detailed in Table 1. The minimum cut problem on these web and social graphs can be seen as a network reliability problem. As these graphs are generally disconnected and contain vertices with very low degree, we use a k-core decomposition [3, 34] to generate versions of the graphs with a minimum degree of k. The k-core of a graph G = (V, E) is the maximum subgraph G(cid:48) = (V (cid:48), E(cid:48)) with V (cid:48) ⊆ V and E(cid:48) ⊆ E, which fulfills the condition that every vertex in G(cid:48) has a degree of at least k. We perform our experiments on the largest connected component of G(cid:48). For every real-world graph we use, we compute a set of 4 different k-cores, in which the minimum cut is not equal to the minimum degree k. We generate a diverse set of graphs with different sizes. On the large graphs gsh-2015-host and uk-2007-05, we use cores with k in 10, 50, 100 and 1000. In the smaller graphs we use cores with k in 10, 30, 50 and 100. twitter-2010 and com-orkut only had few cores where the minimum cut is not trivial. Therefore we used those cores. As hollywood-2011 is very dense, we multiplied the k value of all cores by a factor of 2. 15 k n n m 18M 262M 10 uk-2002 [2, 4, 5] com-orkut [4, 5] graph δ m λ 20 hollywood-2011 2.2M 114M 20 1.3M 109M 1 [4, 5] 60 576K 87M 6 60 100 328K 71M 77 100 200 139K 47M 27 200 16 3.1M 117M 16 2.4M 112M 14 95 95 114K 18M 89 98 107K 17M 76 98 100 103K 17M 70 100 10 9M 226M 1 30 30 2.5M 115M 1 50 783K 51M 1 50 100 98K 11M 1 100 25 25 13M 958M 1 30 10M 884M 1 30 50 50 4.3M 672M 3 60 60 3.5M 625M 3 10 10 25M 1.3B 1 50 5.3M 944M 1 50 100 2.6M 778M 1 100 1000 104K 188M 1 1000 10 10 68M 3.1B 1 50 16M 1.7B 1 50 100 3.9M 862M 1 100 1000 222K 183M 1 1000 gsh-2015-host [4, 5] twitter-2010 [4, 5] uk-2007-05 [2, 4, 5] 106M 3.3B 69M 1.8B 42M 1.2B Table 1: Statistics of real-world web graphs used in experiments. Original graph size and k-cores used in experiments with their respective minimum cuts D Algorithm Configuration We performed experiments to tune the number of label propagation iterations and to find an appropriate amount of randomness for our algorithm. We conducted these experiments with different configurations on generated hyperbolic graphs (see Section C) with 215 to 219 vertices with an average degree of 25 to 28 and compared error rate and running time. The instances used here are different to the one used in the main text. Table 2 shows the number of non-optimal cuts returned by VieCut with different numbers of label propagation iterations indicated by the integer in the name. Each implementation traverses the graph in blocks of 256 randomly shuffled elements as described in Section 4.3. The variant VieCut25 performs up to 25 iterations or until the label propagation converges so that only up to 10000 of all nodes change their cluster. On average the variant performed 20.4 iterations. The results for all variants with 2 to 25 iterations are very similar with 14 to 19 non-optimal results and 2.44% and 3.80% average distance to the optimum. As the largest part of the total running time is in the label propagation step, running the algorithm with a 1 VieCut1 VieCut2 VieCut3 VieCut4 VieCut5 VieCut10 VieCut25 # of non optimal cuts average distance to opt. Table 2: Error rate for configurations of VieCut in RHG graphs (out of 300 instances) 16.2% 2.44% 2.46% 3.30% 3.80% 3.37% 3.14% 29 14 15 16 19 19 18 16 Average Node Degree: 25 Average Node Degree: 26 Average Node Degree: 27 Average Node Degree: 28 ] ) s n ( [ e g d E r e p e m T g n i n n u R i 27 26 25 24 23 22 27 26 25 24 23 22 27 26 25 24 23 22 215 216 218 Number of Vertices 217 219 215 216 218 Number of Vertices 217 219 215 216 218 Number of Vertices 217 219 27 26 25 24 23 22 21 215 218 216 Number of Vertices 217 219 KS VieCut_global Matula VieCut1024 VieCut512 VieCut256 VieCut128 VieCut_fast VieCut_cons parVieCut128 parVieCut_cons Fig. 6: Total running time in nanoseconds per edge in RHG graphs lower amount of iterations is obviously faster. Therefore we use 2 iterations of label propagation in all of our experiments. To compare the effect of graph traversal strategies, we compared different configurations of our al- gorithm. Configuration VieCut_cons does not randomize the traversal order, i.e. it traverses vertices consecutively by their ID, VieCut_global performs global shuffling, VieCut_fast swaps each ver- tex with a random vertex with a index distance up to 20. The configurations VieCut128, VieCut256, VieCut512, VieCut1024 randomly shuffle blocks of 128, 256, 512, or 1024 vertices and introduce ran- domness without losing too much data locality. We also include the configurations parVieCut_cons and parVieCut128, which are shared-memory parallel implementation with 12 threads. As a comparison, we also include the approximation algorithm of Matula and a single run of the randomized algorithm of Karger and Stein. Figure 6 shows the total running time for different configurations of VieCut. From the sequential algorithms, VieCut_cons has the lowest running time for all algorithms. The algorithm, however, returns non-optimal cuts in more than 1 3 of all instances, with an average distance to the minimum cut of 44% over all graphs. The best results were obtained by VieCut128, which has an average distance of 0.83% and only 10 non-optimal results out of 300 instances. The results are very good compared to Matula, which has 57 non-optimal results in these 300 instances and an average distance of 5.57%. VieCut128 is 20% faster on most graphs than Matula, regardless of graph size or density. In the main text we use the configuration VieCut128 with 2 iterations, there named VieCut. On these small graphs, the parallel versions have a speedup factor of 2 to 3.5 compared to their sequential version. parVieCut128 has 17 non-optimal results and an average distance of 4.91% while parVieCut_cons has 29 non-optimal results and 20% average distance to the minimum cut. Therefore we use parVieCut128 for all parallel experiments in the main text (named parVieCut). 17 E Additional Figures NOI Algorithm Padberg-Rinaldi Tests Graph Contraction Fix Misplaced Vertices Label Propagation i e m T g n i n n u R 100% 80% 60% 40% 20% 0 Fig. 7: Running Time Breakdown for RHG Graphs with n = 225 and m = 232 e g a t n e c r e P e m T g n i n n u R i 100% 80% 60% 40% 20% 0 1 2 3 4 6 7 5 Number of Threads 8 9 10 11 12 24 NOI Algorithm Padberg-Rinaldi Tests Graph Contraction Fix Misplaced Vertices Label Propagation Fig. 8: Parallel Running Time Breakdown in Large Graphs 18
1606.05608
2
1606
2016-11-08T06:05:51
Explicit correlation amplifiers for finding outlier correlations in deterministic subquadratic time
[ "cs.DS" ]
We derandomize G. Valiant's [J. ACM 62 (2015) Art. 13] subquadratic-time algorithm for finding outlier correlations in binary data. Our derandomized algorithm gives deterministic subquadratic scaling essentially for the same parameter range as Valiant's randomized algorithm, but the precise constants we save over quadratic scaling are more modest. Our main technical tool for derandomization is an explicit family of correlation amplifiers built via a family of zigzag-product expanders in Reingold, Vadhan, and Wigderson [Ann. of Math. 155 (2002) 157--187]. We say that a function $f:\{-1,1\}^d\rightarrow\{-1,1\}^D$ is a correlation amplifier with threshold $0\leq\tau\leq 1$, error $\gamma\geq 1$, and strength $p$ an even positive integer if for all pairs of vectors $x,y\in\{-1,1\}^d$ it holds that (i) $|\langle x,y\rangle|<\tau d$ implies $|\langle f(x),f(y)\rangle|\leq(\tau\gamma)^pD$; and (ii) $|\langle x,y\rangle|\geq\tau d$ implies $\bigl(\frac{\langle x,y\rangle}{\gamma d}\bigr)^pD \leq\langle f(x),f(y)\rangle\leq \bigl(\frac{\gamma\langle x,y\rangle}{d}\bigr)^pD$.
cs.DS
cs
EXPLICIT CORRELATION AMPLIFIERS FOR FINDING OUTLIER CORRELATIONS IN DETERMINISTIC SUBQUADRATIC TIME MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN Abstract. We derandomize G. Valiant's [J. ACM 62 (2015) Art. 13] sub- quadratic-time algorithm for finding outlier correlations in binary data. Our derandomized algorithm gives deterministic subquadratic scaling essentially for the same parameter range as Valiant's randomized algorithm, but the pre- cise constants we save over quadratic scaling are more modest. Our main technical tool for derandomization is an explicit family of correlation ampli- fiers built via a family of zigzag-product expanders by Reingold, Vadhan, and Wigderson [Ann. of Math. 155 (2002) 157 -- 187]. We say that a function f : {−1, 1}d → {−1, 1}D is a correlation amplifier with threshold 0 ≤ τ ≤ 1, error γ ≥ 1, and strength p an even positive integer if for all pairs of vectors x, y ∈ {−1, 1}d it holds that (i) hx, yi < τ d implies hf (x), f (y)i ≤ (τ γ)pD; and (ii) hx, yi ≥ τ d implies (cid:0) hx,yi Keywords. correlation, derandomization, outlier, similarity search, expander graph AMS classification. 68W01, 05C85 γd (cid:1)pD ≤ hf (x), f (y)i ≤ (cid:0) γhx,yi (cid:1)pD. d 1. Introduction We consider the task of identifying outlier-correlated pairs from large collections In more precise terms, we are of weakly correlated binary vectors in {−1, 1}d. interested in the following computational problem. Problem 1 (Outlier correlations). We are given as input two sets X, Y ⊆ {−1, 1}d with X = Y = n, and two thresholds, the outlier threshold ρ > 0 and the background threshold τ < ρ. Our task is to output all outlier pairs (x, y) ∈ X × Y with hx, yi ≥ ρd, subject to the assumption that at most q of the pairs (x, y) ∈ X × Y satisfy hx, yi > τ d. Remark. This setting of binary vectors and (Pearson) correlation is directly motivated, among others, by the connection to Hamming distance. Indeed, for two vectors x, y ∈ {−1, 1}d we have hx, yi = d − 2DH (x, y), where DH(x, y) = {u = 1, 2, . . . , d : x(u) 6= y(u)} is the Hamming distance between x and y. A naıve way to solve Problem 1 is to compute the n2 inner products hx, yi for (x, y) ∈ X × Y and filter out everything but the outliers. Our interest is in algorithms that scale subquadratically in n, when both d and q are bounded from above by slowly growing functions of n. That is, we seek running times of the form Helsinki Institute for Information Technology HIIT and Department of Computer Science, Aalto University, Helsinki, Finland ([email protected]). The last author's current address is [email protected]. This research was funded by the European Research Council, under the European Union's Seventh Framework Programme (FP/2007-2013) / ERC Grant Agreement 338077 "Theory and Practice of Advanced Search and Enumeration" (M.K., P.K., J.K.); and Academy of Finland, Grants 276031, 282938, 283262 and 283437 (P. ´O C.). Work done in part while the second author was visiting the Simons Institute for the Theory of Computing. 1 2 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN O(n2−ǫ) for a constant ǫ > 0. Furthermore, we seek to do this without a priori knowledge of q. Running times of the form O(n2−cρ) for a constant c > 0 are immediately ob- tainable using techniques such as the seminal locality-sensitive hashing of Indyk and Motwani [20] and its variants (see §1.5). However, such algorithms converge to quadratic running time in n unless ρ is bounded from below by a positive constant. Our interest is in algorithms that avoid such a "curse of weak outliers" and run in subquadratic time essentially independently of the magnitude of ρ, provided that ρ is sufficiently separated from τ . Such ability to identify weak outliers from large amounts of data is useful, among others, in machine learning from noisy data. One strategy to circumvent the curse of weak outliers is to pursue the following intuition: (i) partition the input vectors into buckets of at most s vectors each, (ii) aggregate each bucket into a single vector by taking the vector sum, and (iii) com- pute the inner products between the ⌈n/s⌉×⌈n/s⌉ pairs of aggregate vectors. With sufficient separation between τ and ρ, at most q of these inner products between aggregates will be large, and every outlier pair is discoverable among the at most s × s input pairs that correspond to each large inner product of aggregates. Fur- thermore, a strategy of this form is oblivious to q until we actually start searching inside the buckets, which enables adjusting ρ and τ based on the number of large aggregate inner products. 1.1. Randomized amplification. Such bucketing strategies have been studied before with the help of randomization. In 2012, G. Valiant [36] presented a break- through algorithm that, before bucketing, replaces each input vector with a ran- domly subsampled1 version of its pth Kronecker power. Because of the tensor-power identity (1) hx⊗p, y⊗pi = hx, yip , the ratio between outlier and background correlations gets amplified to essentially its pth power, assuming that the sample is large enough so that sufficient concen- tration bounds hold with high probability. This amplification makes the outliers stand out from the background even after bucketing, which enables detection in subquadratic time using fast matrix multiplication. A subset of the present authors [23] further improved on Valiant's algorithm by a modified sampling scheme that simultaneously amplifies and aggregates the input by further use of fast matrix multiplication. With this improvement, Problem 1 can be solved in subquadratic time if the logarithmic ratio logτ ρ = (log ρ)/(log τ ) is bounded from above by a constant less than 1. Also this improved algorithm relies on randomization. 1.2. Explicit amplification. In this paper we seek deterministic subquadratic algorithms. As with the earlier randomized algorithms, we seek to map the d- dimensional input vectors to a higher dimension D so that inner products are sufficiently amplified in the process. Towards this end, we are interested in ex- plicit functions f : {−1, 1}d → {−1, 1}D that approximate the tensor-power iden- tity eq. (1). Definition 2 (Correlation amplifier). Let d, D and p be positive integers, with p even, and let 0 ≤ τ ≤ 1 and γ ≥ 1. A function f : {−1, 1}d → {−1, 1}D is a correlation amplifier with parameters (d, D, p, τ, γ) if for all pairs of vectors 1The dimension is reduced by subsampling because the full dp-dimensional Kronecker power is too large to be manipulated explicitly to yield subquadratic running times. EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 3 x, y ∈ {−1, 1}d we have (2) (3) if (cid:12)(cid:12)hx, yi(cid:12)(cid:12) < τ d, then (cid:12)(cid:12)hf (x), f (y)i(cid:12)(cid:12) ≤ (τ γ)pD ; and γd (cid:17)p if (cid:12)(cid:12)hx, yi(cid:12)(cid:12) ≥ τ d, then (cid:16)hx,yi d (cid:17)p D ≤ hf (x), f (y)i ≤ (cid:16)γhx,yi D . Remark. A correlation amplifier f guarantees by eq. (2) that correlations below τ in absolute value stay bounded; and by eq. (3) that correlations at least τ in absolute value become positive and are governed by the two-sided approximation In particular, eq. (3) implies that correlations with multiplicative error γ ≥ 1. at least τ cannot mask outliers under bucketing because all such correlations get positive sign under amplification. It is immediate that correlation amplifiers exist. For example, take f (x) = x⊗p, with p even, to obtain a correlation amplifier with D = dp, τ = 0, and γ = 1 by eq. (1). For our present purposes, however, we seek correlation amplifiers with D substantially smaller than dp. Furthermore, we seek constructions that are explicit in the strong2 form that there exists a deterministic algorithm that computes any individual coordinate of f (x) in time poly(log D, p) by accessing poly(p) coordinates of a given x ∈ {−1, 1}d. In what follows explicitness always refers to this strong form. 1.3. Our results. The main result of this paper is that sufficiently powerful explicit amplifiers exist to find outlier correlations in deterministic subquadratic time. Theorem 3 (Explicit amplifier family). There exists an explicit correlation ampli- fier f : {−1, 1}d → {−1, 1}2K with parameters (d, 2K, 2ℓ, τ, γ) whenever 0 < τ < 1, γ > 1, and d, K, ℓ are positive integers with 2K ≥ d(cid:18)210(cid:0)1 − γ−1/2(cid:1)−1(cid:19)20ℓ+1(cid:18) γ τ(cid:19)60 · 2ℓ . As a corollary we obtain a deterministic algorithm for finding outlier correlations in subquadratic time using bucketing and fast matrix multiplication. Let us write α for the limiting exponent of rectangular integer matrix multiplication. That is, for all constants η > 0 there exists an algorithm that multiplies an m × ⌊mα⌋ integer matrix with an ⌊mα⌋ × m integer matrix in O(m2+η) arithmetic operations. In particular, it is known that 0.3 < α ≤ 1 [25]. Theorem 4 (Deterministic subquadratic algorithm for outlier correlations). For any constants 0 < ǫ < 1, 0 < τmax < 1, 0 < δ < α, and C > 60, there exists a deterministic algorithm that solves a given instance of Problem 1 in time (4) (5) O(cid:18)n2− 0.99ǫ(α−δ) 4C+1 + qnδ+ 1.99ǫ(α−δ) 4C+1 (cid:19) assuming that the parameters n, d, ρ, τ satisfy the following three constraints (1) d ≤ nδ, (2) c1n−c2 ≤ τ ≤ τmax, where c1 = τ −ǫ/100000 (3) logτ ρ ≤ 1 − ǫ. Remarks. Observe in particular that eq. (5) is subquadratic regardless of the magnitude of ρ provided that the separation between ρ and τ via logτ ρ ≤ 1 − ǫ holds.3 The constants in eq. (4) and eq. (5) have not been optimized beyond our , c2 =(cid:16)1 − 0.99ǫ 4C+1(cid:17) α−δ C , and max 2In comparison, a weaker form of explicitness could require, for example, that there exists a de- terministic algorithm that computes the entire vector f (x) from a given x in time D·poly(log D, p). 3The technical constraint c1n−c2 ≤ τ only affects inputs where the dimension d grows essen- tially as a root function of n since τ ≥ 1/d. 4 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN desired goal of obtaining deterministic subquadratic running time when d and q are bounded by slowly growing functions of n. In particular, eq. (5) gives substantially worse subquadratic running times compared with the existing randomized strate- gies [23, 36]. The algorithm in theorem 4 needs no a priori knowledge of q and is oblivious to q until it starts searching inside the buckets. 1.4. Overview and discussion of techniques. A straightforward application of the probabilistic method establishes (lemma 21) that low-dimensional correlation amplifiers can be obtained by subsampling uniformly at random the dimensions of the tensor power x⊗p as long as the sample size D is large enough. Thus, in essence our theorem 3 amounts to derandomizing such a subsampling strategy by presenting an explicit sample that is, up to the error bounds eq. (2) and eq. (3), indistinguishable from the "perfect" amplifier x 7→ x⊗p under taking of inner prod- ucts. The construction underlying theorem 3 amounts to an ℓ-fold composition of ex- plicit squaring amplifiers (p = 2) with increasingly strong control on the error (γ) and the interval of amplification ([τ, 1]) at each successive composition. To- wards this end, we require a flexible explicit construction of squaring amplifiers with strong control on the error and the interval. We obtain such a construction from an explicit family of expander graphs (lemma 11) obtainable from the explicit zigzag-product constructions of Reingold, Vadhan, and Wigderson [34]. In partic- ular, the key to controlling the error and the interval is that the expander family gives Ramanujan-like 4 concentration λ/∆ ≤ 16∆−1/4 of the normalized second eigenvalue λ/∆ by increasing the degree ∆. In essence, since we are working with {−1, 1}-valued vectors, by increasing the degree we can use the Expander Mixing Lemma (lemma 10) and the Ramanujan-like concentration to control (lemma 13) how well the restriction xG to the edges of an expander graph G approximates the full tensor square x⊗2 under taking of inner products. Our construction has been motivated by the paradigm of gradually increasing independence [9, 14, 15, 21] in the design of pseudorandom generators. Indeed, we obtain the final amplifier gradually by successive squarings, taking care that the degree ∆i of the expander that we apply in each squaring i = 0, 1, . . . , ℓ−1 increases with a similar squaring schedule given by eq. (11) and eq. (15) to simultaneously control the error and the interval, and to bound the output dimension roughly by the square of the degree of the last expander in the sequence. Here the term "gradual" is not particularly descriptive since growth under successive squaring amounts to doubly exponential growth in the number of squarings. Yet such growth can be seen as gradual and controlled in the following sense: we obtain strong amplification compared with the final output dimension precisely because the first ℓ− 1 squarings "come for free" as ∆0∆1 ··· ∆ℓ−2 is (up to low-order multiplicative terms) no more than ∆2 ℓ−1, essentially because we are taking the sum of powers of 2 in the exponent. The analogy with pseudorandom generators can in fact be pushed somewhat further. Namely, a correlation amplifier can be roughly seen as a pseudorandom generator that by eq. (3) seeks to fool a "truncated family of uniform combina- torial rectangles" with further control requested by eq. (2) below the truncation threshold τ . To see the rough analogy, let z ∈ {−1, 1}d be the Hadamard prod- uct of the vectors x, y ∈ {−1, 1}d and observe that eq. (3) seeks to approximate (with multiplicative error) the expectation of a uniform random entry in the dp- length Kronecker power z⊗p by instead taking the expectation over an explicit D-dimensional sample given by f . The Kronecker power z⊗p is a uniform special 4Actual Ramanujan graphs (see [18, 26]) would give somewhat stronger concentration λ/∆ = O(∆−1/2) and hence improved constants in eq. (4). However, we are not aware of a sufficiently fine-grained family of explicit Ramanujan graphs to comfortably support successive squaring. EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 5 case (with z = z1 = z2 = ··· = zp) of a "combinatorial rectangle" formed by a Kronecker product z1 ⊗ z2 ⊗ ··· ⊗ zp, and truncation means that we only seek ap- proximation in cases where Pd u=1 z(u) ≥ τ d, and accordingly want constructions that take this truncation into account -- that is, we do not seek to fool all combina- torial rectangles and accordingly want stronger control on the dimension D (that is, the "seed length" log D). For a review of the state of the art in pseudorandom generators we refer to Gopalan, Kane, and Meka [14] and Kothari and Meka [24]. Our goal to obtain a small output dimension D roughly corresponds to optimizing the seed length of a pseudorandom generator. While our explicit construction eq. (4) does not reach the exact output dimension obtainable by lemma 21, it should be observed that in our parameter range of interest (with γ > 1 a constant and 0 < τ ≤ τmax for a constant 0 < τmax < 1), both eq. (4) and eq. (32) are of the form D ≥ dτ −Θ(p); only the constants hidden by the asymptotic notation differ between the explicit and nonconstructive bounds. Moreover, using results of Alon [4] we show a lower bound (lemma 26) on the output dimension D of any correlation amplifier: namely, that D ≥ 1 γτ )p, when p is in the range governed by (γτ )p ≤ 1/100 and p ≤ (log e)τ 2d γτ ) . Thus, viewed as a pseudorandom generator with "seed length" log D, theorem 3 essentially does not admit improvement except possibly at the multiplicative constants. 5 ( 1 8 log( 1 1.5. Related work and applications. Problem 1 is a basic problem in data analysis and machine learning admitting many extensions, restrictions, and vari- ants. A large body of work exists studying approximate near neighbour search via techniques such as locality-sensitive hashing (e.g. [5, 7, 6, 20, 13, 29, 30]), with recent work aimed at derandomization (see Pagh [31] and Pham and Pagh [33]) and resource tradeoffs (see Kapralov [22]) in particular. However, these techniques enable subquadratic scaling in n only when ρ is bounded from below by a positive constant, whereas the algorithm in theorem 4 remains subquadratic even in the case of weak outliers when ρ tends to zero with increasing n, as long as ρ and τ are separated. Ahle, Pagh, Razenshteyn, and Silvestri [1] show that subquadratic scaling in n is not possible for logτ ρ = 1− o(1/√log n) unless both the Orthogonal Vectors Conjecture and the Strong Exponential Time Hypothesis [19] fail. In small dimensions, Alman and Williams [3] present a randomized algorithm that finds exact Hamming-near neighbours in a batch-query setting analogous to Problem 1 in subquadratic time in n when the dimension is constrained to d = O(log n). Recently, Chan and Williams [10] show how to derandomize related algorithm designs; also, Alman, Chan and Williams [2] derandomize the probabilis- tic polynomials for symmetric Boolean functions used in [3], achieving deterministic subquadratic batch queries in small dimensions. One special case of Problem 1 is the problem of learning a weight 2 parity function in the presence of noise, or the light bulb problem. Problem 5 (Light bulb problem, L. Valiant [37]). Suppose we are given as input a parameter 0 < ρ < 1 and a set of n vectors in {−1, 1}d such that one planted pair of vectors has inner product at least ρd in absolute value, and all other n − 2 vectors are chosen independently and uniformly at random. Our task is to find the planted pair among the n vectors. Remark. From e.g. the Hoeffding bound eq. (7) it follows that there exists a constant c such that when d ≥ cρ−2 log n the planted pair is with high probability (as n increases) the unique pair in the input with the maximum absolute correlation. 6 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN For a problem whose instances are drawn from a random ensemble, we say that an algorithm solves almost all instances of the problem if the probability of drawing an instance where the algorithm fails tends to zero as n increases. Paturi, Rajasekaran, and Reif [32], Dubiner [11], and May and Ozerov [27] present randomized algorithms that can be used to solve almost all instances of the light bulb problem in subquadratic time if we assume that ρ is bounded from below by a positive constant; if ρ tends to zero these algorithms converge to qua- dratic running time in n. G. Valiant [36] showed that a randomized algorithm can identify the planted correlation in subquadratic time on almost all inputs even when ρ tends to zero as n increases. As a corollary of theorem 4, we can derandomize Valiant's design and still retain subquadratic running time (but with a worse constant) for almost all inputs, except for extremely weak planted correlations with ρ ≤ n−Ω(1) that our amplifier is not in general able to amplify with sufficiently low output dimension to enable an overall subquadratic running time. Corollary 6 (Deterministic subquadratic algorithm for the light bulb problem). For any constants 0 < δ < α, C > 60, 0 < ρmax < 1, and κ > 1, there exists a deterministic algorithm that solves almost all instances of Problem 5 in time assuming the parameters n, d, ρ satisfy the two constraints O(cid:18)n2− 0.99(1−1/κ)(α−δ) 4C+1 (cid:19) (1) 5ρ−2κ log n ≤ d ≤ nδ and (2) c1n−c2/κ ≤ ρ ≤ ρmax, where c1 = ρ−κǫ/100000 max and c2 =(cid:16)1 − 0.99(1−1/κ) 4C+1 C . (cid:17) α−δ Corollary 6 extends to parity functions of larger (constant) weight in the presence of noise (cf. [16, 23, 36]). This generalized version of the problem is as follows. Problem 7 (Learning parity with noise). Let S ⊆ [v] with S = k be the support of a parity function and 0 < η < 1 the noise level. Our task is to determine the set S by drawing independent random examples (x, y) such that x ∈ {−1, 1}v is chosen uniformly at random, and the label y ∈ {−1, 1} is y = zQℓ∈S x(ℓ) where z ∈ {−1, 1} is an independent random variable with Pr(z = −1) = η. With no information on k, the trivial solution is to enumerate all 2v subsets of [v] to locate the support S. Blum, Kalai, and Wasserman [8] provide a non-trivial solu- tion which runs in time and sample complexity poly(cid:0)1 − 2η2a , 2b(cid:1) for any positive integers a, b with ab ≥ v; this is 2O(v/ log v) when η 6= 1/2 is a constant independent of v. If we assert that k is a constant independent of v, the trivial complexity drops from exponential to vk, and non-trivial speed-ups seek to lower the coefficient 1 of k in the exponent. Randomized solutions for constant k include Valiant's break- through algorithm [36] and our subsequent randomized improvement [23] which runs in time O(v 3 ) for any constant 0 < ǫ < ω/3. 9ǫ − 4 ω+ǫ Our present contribution is a deterministic algorithm for learning constant- weight parity functions with noise. Our interest is in the case where the noise level η approaches 1/2, and accordingly we assume that 1 − 2η is bounded from above by a constant less than 1. We say that a deterministic algorithm solves al- most all instances of Problem 7 if the probability of drawing an instance on which the algorithm fails tends to zero as v increases.5 3 k1 − 2η− 8ω 5Observe that from an information-theoretic perspective it is a positive-but-negligible- probability event that the drawn examples do not uniquely identify S. EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 7 Corollary 8 (Deterministic algorithm for learning parity with noise). For all con- stants 0 < δ < α, C > 60, ξ > 1, 0 < θ < 1, there exists a constant k0 and a deterministic algorithm that for all constants k ≥ k0 draws d examples and finds the support of almost all instances of Problem 7 in time (6) O(cid:18)vk(cid:0)1−0.245025(α−δ)2(1−1/ξ)2(1+4C)−2(cid:1)(cid:19) , assuming the parameters v, d, η satisfy the constraints 6k 1−2η2(ξ2+1)(1−θξ−1)2 log v, and (1) d ≥ (2) c1v−c2ξ−2k/2 ≤ 1 − 2η ≤ θ, where c1 = θ−(1−1/ξ)/100000 and c2 =(cid:16)1 − 0.99(1−1/ξ) 4C+1 C . (cid:17) α−δ Algorithms for learning parity functions enable extensions to further classes of Boolean functions such as sparse juntas and DNFs (cf. [12, 28, 36]). 2. Preliminaries All vectors in this paper are integer-valued. For a vector x ∈ Zd we denote the entry u = 1, 2, . . . , d of x by x(u). For two vectors x, y ∈ Zd we write hx, yi = Pd u=1 x(u)y(u) for the inner product of x and y. We write log for the logarithm with base 2 and ln for the logarithm with base exp(1). In our proofs, we need the following bound due to Hoeffding [17, Theorem 2] which provides an exponentially small upper bound on the deviation of a sum of bounded independent random variables from its expectation. Theorem 9 (Hoeffding [17, Theorem 2]). Let Z1, Z2, . . . , ZD be independent ran- i=1 Zi. dom variables satisfying ℓi ≤ Zi ≤ ui for all 1 ≤ i ≤ D, and let Z = PD Then, for all c > 0, the following holds: (7) Pr (Z − E[Z] ≥ c) ≤ exp − 2c2 i=1(ui − ℓi)2! . PD 3. Explicit amplifiers by approximate squaring This section proves theorem 3. We start with preliminaries on expanders, show an approximate squaring identity using expander mixing, and then rely on repeated approximate squaring for our main construction. The proof is completed by some routine preprocessing. 3.1. Preliminaries on expansion and mixing. We work with undirected graphs, possibly with self-loops and multiple edges. A graph G is ∆-regular if every vertex is incident to exactly ∆ edges, with each self-loop (if present) counting as one edge. Suppose that G is ∆-regular with vertex set V , and let L be a set of ∆ labels such that the ∆ edge-ends incident to each vertex have been labeled with unique labels from L. The rotation map RotG : V × L → V × L is the bijection such that for all u ∈ V and i ∈ L we have RotG(u, i) = (v, j) if the edge incident to vertex u and labeled with i at u leads to the vertex v and has the label j at v. For S, T ⊆ V (G), let us write E(S, T ) for the set of edges of G with one end in S and the other end in T . Suppose that G has D vertices and let λ1, λ2, . . . , λD be the eigenvalues of the adjacency matrix of G with λ1 ≥ λ2 ≥ ··· ≥ λD. Let us say that a graph G is a (D, ∆, λ)-graph if G has D vertices, G is ∆-regular, and λ2 ≤ λ. For an excellent survey on expansion and expander graphs, we refer to Hoory, Linial, and Wigderson [18]. 8 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN Lemma 10 (Expander mixing lemma, [18, Lemma 2.5]). For all S, T ⊆ V (G) we have E(S, T ) − (cid:12)(cid:12)(cid:12)(cid:12) ∆ST D (cid:12)(cid:12)(cid:12)(cid:12) ≤ λpST . We work with the following family of graphs obtained from the zig-zag product of Reingold, Vadhan, and Wigderson [34]. In particular lemma 11 gives us λ/∆ ≤ 16∆−1/4, which will enable us to control relative inner products by increasing ∆. Lemma 11. For all integers t ≥ 1 and b ≥ 10 there exists a (216bt, 24b, 16 · 23b)- graph whose rotation map can be evaluated in time poly(b, t).6 Proof. See appendix A. (cid:3) 3.2. Main construction. The main objective of this section is to prove the fol- lowing lemma, which we will then augment to theorem 3 by routine preprocessing of the input dimension. Lemma 12 (Repeated approximate squaring). There exists an explicit correlation amplifier f : {−1, 1}2k with parameters (2k, 2K, 2ℓ, τ0, γ0) whenever 0 < τ0 < 1, γ0 > 1, and k, K, ℓ are positive integers with → {−1, 1}2K 2K ≥ 2k(cid:18)210(cid:0)1 − γ−1 0 (cid:1)−1(cid:19)20ℓ(cid:18) γ0 τ0(cid:19)40 · 2ℓ−20 . Approximate squaring via expanders. For a vector x ∈ {−1, 1}D, x⊗2 ∈ {−1, 1}D2 for correlation amplifiers will rely on approximating the squaring identity let us write for the Kronecker product of x with itself. Our construction (8) hx⊗2, y⊗2i = hx, yi2 , for vectors in {−1, 1}D. In more precise terms, let G be a (D, ∆, λ)-graph and let xG ∈ {−1, 1}∆D be a vector that contains each coordinate x(u)x(v) of x⊗2 with (u, v) ∈ V (G)× V (G) exactly once for each edge of G that joins the vertex u to the vertex v. Equivalently, let RotG : V × L → V × L be a rotation map for G, and define xG for all u ∈ V and all i ∈ L by xG(u, i) = x(u)x(v) where v ∈ V is given by RotG(u, i) = (v, j). In particular, xG has exactly ∆D coordinates. Lemma 13 (Approximate squaring). For all x, y ∈ {−1, 1}D we have hxG, yGi − (cid:12)(cid:12)(cid:12)(cid:12) ∆ Dhx⊗2, y⊗2i(cid:12)(cid:12)(cid:12)(cid:12) ≤ 2λD . Proof. Let S = {u ∈ V (G) : x(u) = y(u)} and let us write ¯S = V (G) \ S. Since x, y are {−1, 1}-valued, we have hxG, yGi = E(S, S) + E( ¯S, ¯S) − E(S, ¯S) − E( ¯S, S) . Observing that and applying lemma 10 four times, we have S2 + ¯S2 − S ¯S − ¯SS =(cid:0)2S − D(cid:1)2 (cid:12)(cid:12)(cid:12)(cid:12) hxG, yGi − Dhx⊗2, y⊗2i(cid:12)(cid:12)(cid:12)(cid:12) ∆ = hx, yi2 = hx⊗2, y⊗2i ≤ λ(cid:0)D + 2pS(D − S)(cid:1) ≤ 2λD . (cid:3) 6Caveat. Reingold, Vadhan, and Wigderson [34] work with eigenvalues of the normalized adja- cency matrix (with λ1 = 1) whereas we follow Hoory, Linial, and Wigderson [18] and work with unnormalized adjacency matrices (with λ1 = ∆) in the manuscript proper. appendix A works with normalized adjacency matrices for compatibility with Reingold, Vadhan, and Wigderson [34]. EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 9 The amplifier function. We now construct an amplifier function f that uses ℓ ap- proximate squarings, ℓ ≥ 1, with the graphs drawn from the graph family in lemma 11. Accordingly, we assume that all vectors have lengths that are posi- tive integer powers of 2. The input x = x0 ∈ {−1, 1}d0 to the amplifier has dimension d0 = 2k for a positive integer k. For i = 0, 1, . . . , ℓ− 1, suppose we have the vector xi ∈ {−1, 1}di. Let bi be a positive integer whose value will be fixed later. Let ti be the unique positive integer with di ≤ Di = 216biti < 216bidi . Note in particular that di divides Di since di is a power of 2. Let Gi be a (216biti , 24bi, 16 · 23bi)-graph from lemma 11. Take Di/di copies of xi to obtain the vector xi ∈ {−1, 1}Di. Let xi+1 = xGi i ∈ {−1, 1}di+1 with di+1 = ∆iDi and ∆i = 24bi . The amplifier outputs f (x) = xℓ with xℓ ∈ {−1, 1}dℓ. Since the graph family in lemma 11 admits rotation maps that can be computed in time poly(b, t), we observe that f is explicit. Indeed, from the construction it is immediate that to compute any single coordinate of f (x) it suffices to (i) perform in total 2ℓ−1−i evaluations of the rotation map of the graph Gi for each i = 0, 1, . . . , ℓ− 1, and (ii) access at most 2ℓ coordinates of x. Since biti = O(log dℓ) for all i = 0, 1, . . . , ℓ − 1, we have that we can compute any coordinate of f (x) in time poly(log dℓ, 2ℓ) and accessing at most 2ℓ coordinates of x. Parameterization and analysis. Fix τ0 > 0 and γ0 > 1. To parameterize the am- plifier (that is, it remains to fix the values bi), let us track a pair of vectors as it proceeds through the ℓ approximate squarings for i = 0, 1, . . . , ℓ − 1. We start by observing that copying preserves relative inner products. That is, for any pair of vectors xi, yi ∈ {−1, 1}di we have hxi, yii = νidi if and only if hxi, yii = νiDi for 0 ≤ νi ≤ 1. An easy manipulation of lemma 13 using the parameters in lemma 11 gives us additive control over an approximate squaring via ≤ νi+1 ≤ ν2 i − 32∆−1/4 ν2 i + 32∆−1/4 (9) . For all inner products that are in absolute value above a threshold, we want to turn this additive control into multiplicative control via 0 ≤ νi+1 ≤ ν2 (10) Let us insist this multiplicative control holds whenever νi ≥ τi for the threshold parameter τi defined for all i = 0, 1, . . . , ℓ − 1 by 0 τ 2 (11) i . τi+1 = γ−1 i γ−1 ν2 i γ0 . Enforcing eq. (10) via eq. (9) at the threshold, let us assume that (12) i γ−1 τ 2 0 ≤ τ 2 i − 32∆−1/4 i . The next lemma confirms that assuming eq. (12) gives two-sided control of inner products which is retained to the next approximate squaring. The following lemma shows that small inner products remain small. Lemma 14. If τi ≤ νi, then ν2 Proof. From eq. (9) and eq. (12), we have i γ0 and τi+1 ≤ νi+1. 0 ≤ νi+1 ≤ ν2 i γ−1 (cid:12)(cid:12)νi+1 − ν2 (13) Observe that 1 − γ−1 νi+1 ≤ ν2 i(cid:12)(cid:12) ≤ 32∆−1/4 i + (1 − γ−1 0 )ν2 i . 0 ≤ γ0 − 1. Thus, from eq. (13) we conclude that i ≤ (1 − γ−1 ≤ (1 − γ−1 0 )τ 2 i = γ0ν2 i . i ≤ ν2 i + (γ0 − 1)ν2 0 )ν2 i i i 10 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN In the converse direction, from eq. (13) and eq. (11) we conclude that νi+1 ≥ ν2 i − (1 − γ−1 0 )ν2 i ≥ γ−1 0 ν2 i ≥ γ−1 0 τ 2 i = τi+1 . Lemma 15. If νi < τi, then νi+1 ≤ τ 2 Proof. From eq. (9) and eq. (12), we have i γ0. (14) Since 1 − γ−1 ≤ (1 − γ−1 0 ≤ γ0 − 1, from eq. (14) we conclude that (cid:12)(cid:12)νi+1 − ν2 i + (1 − γ−1 i(cid:12)(cid:12) ≤ 32∆−1/4 i ≤ τ 2 νi+1 ≤ ν2 i + (γ0 − 1)τ 2 0 )τ 2 i 0 )τ 2 i . i = γ0τ 2 i . (cid:3) (cid:3) Let us now make sure that eq. (12) holds. Solving for ∆i in eq. (12), we have (15) ∆i ≥(cid:0)32(1 − γ−1 0 )−1τ −2 . i (cid:1)4 In particular, we can make sure that eq. (15) and hence eq. (12) holds by simply choosing a large enough ∆i (that is, a large enough bi). . 0 0 Before proceeding with the precise choice of bi for i = 0, 1, . . . , ℓ−1, let us analyze the input -- output relationship of the amplifier f using lemma 14 and lemma 15. Let x, y ∈ {−1, 1}d0 be two vectors given as input with hx, yi = ν0d0. The outputs f (x), f (y) ∈ {−1, 1}dℓ then satisfy h f (x), f (y)i = νℓdℓ, where the following two lemmas control νℓ via ν0. Lemma 16. If ν0 ≥ τ0, then ν2ℓ ≤ νℓ ≤ ν2ℓ 0 γ−2ℓ+1 Proof. Use induction on i, where lemma 14 gives the inductive step. Lemma 17. If ν0 < τ0, then νℓ ≤ τ 2ℓ Proof. From eq. (11) we have τi = τ 2i . Let us show by induction on i that νi ≤ τ 2i . The base case i = 0 is immediate. For i ≥ 1, there are two cases to consider. First suppose that νi < τi. Then, by lemma 15 we have γ−2i+1+3 γ2i+1−1 νi+1 ≤ τ 2 since γ0 > 1. Next suppose that 0 0 i γ0 ≤ τ 2i+1 νi ≥ τi. Then, by lemma 14 we have νi+1 ≤ ν2 (cid:3) 0 γ2ℓ−1 . 0 γ−2i+1 i γ0 ≤ τ 2i+1 ≤ τ 2i+1 γ2i+1−1 0 0 γ2i−1 0 γ2ℓ−1 Since γ0 > 1, from lemma 16 and lemma 17 it now follows that f meets the required amplification constraints eq. (2) and eq. (3) with p = 2ℓ, τ = τ0, and γ = γ0. (cid:3) 0 0 0 0 0 0 . Let us now complete the parameterization and derive an upper bound for dℓ. For each i = 0, 1, . . . , ℓ − 1, take bi to be the smallest nonnegative integer so that bi ≥ 10 and ∆i = 24bi satisfies eq. (15). Since Di ≤ 216bidi = ∆4 i di, we have di+1 = ∆iDi ≤ ∆5 i di, and hence dℓ ≤ (∆ℓ−1∆ℓ−2 ··· ∆0)5d0 . Since τi = τ 2i by eq. (11), it follows that Recall that d0 = 2k. From eq. (15) we have that 0 )−1τ −2 0 0 γ−2i+1 ∆i = 24bi ≤ max(cid:0)240, 24(cid:0)32(1 − γ−1 dℓ ≤ 2k(cid:18)210(cid:0)1 − γ−1 0 (cid:1)−1(cid:19)20ℓ(cid:18) γ0 τ0(cid:19)20(2ℓ+1−1) . i (cid:1)4(cid:1) ≤(cid:0)210(1 − γ−1 0 )−1τ −2 . i (cid:1)4 Repeatedly taking two copies of the output as necessary, for all 2K with 2K ≥ dℓ we obtain a correlation amplifier with parameters (2k, 2K, 2ℓ, τ0, γ0). This completes the proof of lemma 12. (cid:3) EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 11 3.3. Copy-and-truncate preprocessing of the input dimension. We still want to remove the assumption from lemma 12 that the input dimension is a pos- itive integer power of 2. The following copy-and-truncate preprocessing will be sufficient towards this end. Let x ∈ {−1, 1}d and let k be a positive integer. Define the vector x ∈ {−1, 1}2k by concatenating ⌈2k/d⌉ copies of x one after another, and truncating the result to the 2k first coordinates to obtain x. Let us study how the map x 7→ x operates on a pair of vectors x, y ∈ {−1, 1}d. For notational compactness, let us work with relative inner products ν, ν with hx, yi = νd and hx, yi = ν2k. Lemma 18. For any 0 < τ0 < 1, γ0 > 1, and 2k ≥ 2dτ −1 0 )−1 we have that 0 (1− γ−1 (1) ν < τ0 implies ν ≤ γ0τ0, (2) ν ≥ τ0 implies γ−1 0 ν ≤ ν ≤ γ0ν. Proof. Let ℓ and t be the unique integers such that 2k + ℓ = td with 0 ≤ ℓ < d. Since we are leaving out ℓ coordinates, we have 2−k(νtd − ℓ) ≤ ν ≤ 2−k(νtd + ℓ) . Suppose that ν < τ0. We have ν ≤ 2−k(cid:0)νtd + ℓ(cid:1) ≤ 2−k(cid:0)ν2k + 2ℓ(cid:1) ≤ τ0 + 21−kd . Observe that 1 − γ−1 0 ≤ γ0 − 1. Since by hypothesis 2k ≥ 2dτ −1 0 )−1 ≥ 2dτ −1 0 (1 − γ−1 0 (γ0 − 1)−1 , we thus have ν ≤ γ0τ0. For ν ≥ τ0 we have ν − 2−kd ≤ 2−k(ν2k − d) ≤ ν ≤ 2−k(ν2k + 2d) ≤ ν + 21−kd . Similarly, for ν ≤ −τ0 we have ν − 21−kd ≤ 2−k(ν2k − 2d) ≤ ν ≤ 2−k(ν2k + d) ≤ ν + 2−kd . By hypothesis we have 2k ≥ 2dτ −1 0 )−1, (γ0 − 1)−1(cid:1) . 0 ν ≤ ν ≤ γ0ν if ν ≥ τ0, and γ0ν ≤ ν ≤ γ−1 0 max(cid:0)(1 − γ−1 Thus we have both γ−1 0 ν if ν ≤ −τ0. (cid:3) 3.4. Completing the proof of theorem 3. Let d, K, ℓ, τ, γ be parameters meet- ing the constraints in theorem 3, in particular the constraint eq. (4). To construct a required amplifier f , we preprocess each input vector x with copy-and-truncate, obtaining a vector x of length 2k. We then then apply an amplifier f : {−1, 1}2k → {−1, 1}2K given by lemma 12. In symbols, we define f : {−1, 1}d → {−1, 1}2K for all x ∈ {−1, 1}d by f (x) = f (x). It is immediate from lemma 12 and lemma 18 that the resulting composition is explicit. We begin by relating the given parameters of theorem 3 to those of lemma 12. Take γ0 = γ1/2, τ0 = τ γ−1, and select the minimal value of k so that the constraint in lemma 18 is satisfied; that is 2k is constrained as follows, 2d(1 − γ−1/2)−1γτ −1 ≤ 2k < 4d(1 − γ−1/2)−1γτ −1 . Substituting this upper bound into the bound of lemma 12, we get a lower bound for 2K, (16) 2K ≥ 2−8d(cid:16)210(1 − γ−1/2)−1(cid:17)20ℓ+1 γ τ 40(cid:19)2ℓ τ (cid:18) γ60 τ 20 γ30 . 12 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN Observe that an integer 2K satisfying eq. (4) also satisfies eq. (16). We have not attempted to optimise our construction, and prefer the the statement of theorem 3 as it is reasonably clean and is sufficient to prove theorem 4. Let us study how the map x 7→ f (x) operates on a pair of vectors x, y ∈ {−1, 1}d. For notational compactness, again we work with relative inner products ν, ν, φ with hx, yi = νd, hx, yi = ν2k, and hf (x), f (y)i = φ2K. Observe that in the notation of the proof of lemma 12, we have ν = ν0 and φ = νℓ. Lemma 19. If ν < τ then φ ≤ (γτ )2ℓ Proof. First we show that ν ≤ γ0τ , dividing into cases as in Lemma 18. If ν < τ0 then ν < γ0τ0 = γ−1 0 τ ≤ γ0τ . If τ0 ≤ ν < τ then ν ≤ γ0ν ≤ γ0τ . If −τ < ν ≤ τ0 then ν ≥ γ0ν ≥ −γ0τ . To complete the proof, we condition on ν. If ν ≤ τ0 then Lemma 17 applies, and we have . φ = νℓ ≤ τ 2ℓ 0 γ2ℓ−1 0 < (τ γ)2ℓ . Otherwise, τ0 ≤ ν < τ and by Lemma 16 we have 0 < φ = νℓ ≤ ν2ℓ 0 γ2ℓ−1 0 ≤ τ 2ℓ γ2ℓ−1 0 ≤ (τ γ)2ℓ . (cid:3) Lemma 20. If ν ≥ τ then (νγ−1)2ℓ Proof. It will be convenient to split the analysis according to whether ν is positive or negative. Suppose first that ν ≥ τ . Then by Lemma 18 we have that ≤ φ ≤ (νγ)2ℓ . (17) Since ν ≥ νγ−1 γ−1 0 ν ≤ ν ≤ γ0ν . 0 ≥ τ γ−1 0 = τ0γ0 ≥ τ0, Lemma 16 applies, yielding Now, we substitute φ = νℓ and bound ν as in eq. (17), νγ−2ℓ+1 0 ≤ νℓ ≤ ν2ℓ γ2ℓ−1 0 . Substituting γ = γ1/2 0 γ−2ℓ+1 0 0 (cid:1)2ℓ (cid:0)νγ−1 and observing that γ ≥ 1 provides the required bound γ2ℓ−1 0 . 0 (cid:1)2ℓ ≤ φ ≤(cid:0)νγ−1 ≤ φ ≤ (νγ)2ℓ . (cid:0)νγ−1(cid:1)2ℓ The case that ν ≤ −τ essentially follows from multiplying all inequalities in the (cid:3) positive case by −1. Now, f satisfies eq. (2) and eq. (3) with p = 2ℓ by lemmas 19 and 20 respectively. (cid:3) This completes the proof of theorem 3. 4. A deterministic algorithm for outlier correlations This section proves theorem 4. We start by describing the algorithm, then param- eterize it and establish its correctness, and finally proceed to analyze the running time. EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 13 4.1. The algorithm. Fix the constants ǫ, τmax, δ, C as in theorem 4. Based on these constants, fix the constants 0 < σ < 1 and γ > 1. (We fix the precise values of σ and γ later during the analysis of the algorithm, and stress that σ, γ do not depend on the given input.) Suppose we are given as input the parameters 0 < τ < ρ < 1 and X, Y ⊆ {−1, 1}d with X = Y = n so that the requirements in theorem 4 hold. We work with a correlation amplifier f : {−1, 1}d → {−1, 1}D with parameters (d, D, p, τ, γ). (We fix the precise values of the parameters p and D later during the analysis of the algorithm so that f originates from theorem 3.) The algorithm proceeds as follows. First, apply f to each vector in X and Y to obtain the sets Xf and Yf . Let s = ⌊nσ⌋. Second, partition the n vectors in both Xf and Yf into ⌈n/s⌉ buckets of size at most s each, and take the vector sum of the vectors in each bucket to obtain the sets Xf , Yf ⊆ {−s,−s + 1, . . . , s − 1, s}D with Xf, Yf ≤ ⌈n/s⌉. Third, using fast rectangular matrix multiplication on Xf and Yf , compute the matrix Z whose entries are the inner products hx, yi for all x ∈ Xf and all y ∈ Yf . Fourth, iterate over the entries of Z, and whenever the detection inequality (18) holds, brute-force search for outliers among the at most s2 inner products in the corresponding pair of buckets. Output any outliers found. hx, yi > n2σ(τ γ)pD 4.2. Parameterization and correctness. Let us now parameterize the algorithm and establish its correctness. Since γ > 1 is a constant and assuming that p is large enough, by theorem 3 we can select D to be the integer power of 2 with 1 2 τ(cid:19)Cp d(cid:18) γ < D ≤ d(cid:18) γ τ(cid:19)Cp . Recall that we write α for the exponent of rectangular matrix multiplication. To apply fast rectangular matrix multiplication in the third step of the algorithm, we want (19) so recalling that d ≤ nδ and nσ − 1 < s, it suffices to require that , s(cid:19)α D ≤ 2(cid:18) n τ(cid:19)Cp (cid:18) γ ≤ n(1−σ)α−δ . (We will justify this Let us assume for the time being that (1 − σ)α − δ > 0. assumption later when we choose a value for σ.) Let p be the unique positive- integer power of 2 such that (20) ((1 − σ)α − δ) log n 2C log γ τ < p ≤ ((1 − σ)α − δ) log n C log γ τ . We will later, when fixing σ and γ, make sure that the right-hand side in eq. (20) is at least 1, so that p exists and is positive. Let us now consider a single entry hx, yi in Z, and analyze how the corresponding (at most s2) inner products hx, yi between the two buckets of input vectors relate to the detection inequality eq. (18). We make two claims: Claim 1 (background case). If all of the inner products have hx, yi ≤ τ d, then eq. (18) does not hold, so the algorithm will not search inside this pair of buckets. This claim will be used to control the running time. The claim follows directly from eq. (2) and eq. (3), since there are at most s2 ≤ n2σ inner products, each having hf (x), f (y)i ≤ (τ γ)pD. 14 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN Claim 2 (outlier case). If at least one of the inner products has hx, yi ≥ ρd, then eq. (18) holds, so the algorithm searches inside this pair of buckets. This guarantees that the outliers are detected. Note that in the third case, namely, if some inner products have hx, yi > τ d but none has hx, yi ≥ ρd, we make no claim on whether (18) holds or not. The algorithm is not required to search inside such pairs of buckets (since there are no outliers there), but may so do without hindering our overall running time bound. We proceed to parameterize the algorithm so that Claim 2 holds. In the outlier case, by eq. (2) and eq. (3), there is at least one inner product with hf (x), f (y)i ≥ (ργ−1)pD, and the remaining at most n2σ inner products have hf (x), f (y)i ≥ −(τ γ)pD. Thus in the outlier case we have (21) hx, yi ≥ (ργ−1)pD − n2σ(τ γ)pD. For Claim 2 we need the detection inequality eq. (18) to hold whenever eq. (21) holds. Towards this end, it suffices to require that Rearranging and solving for p, we require that (cid:0)ργ−1(cid:1)p − n2σ(cid:0)τ γ(cid:1)p > n2σ(cid:0)τ γ(cid:1)p . (22) p > 1 + 2σ log n log ρ τ γ2 . From eq. (20) and eq. (22) we thus see that it suffices to have p > ((1 − σ)α − δ) log n 2C log γ τ ≥ 1 + 2σ log n log ρ τ γ2 , or equivalently, (23) log ρ τ γ2 log γ τ ≥ 2C log n + 4Cσ (1 − σ)α − δ . Let us derive a lower bound for the left-hand side of eq. (23). Fix the constant γ > 1 so that log γ = − ǫ log τmax 100000 . By our assumptions we have τ ≤ τmax and 1−logτ ρ ≥ ǫ, so we have the lower bound log ρ τ γ2 log γ τ = log ρ − log τ − 2 log γ log γ − log τ = 1 − logτ ρ + 2 log γ log τ 1 − log γ log τ ≥ ǫ + 2 log γ log τmax 1 − log γ log τmax > 0.99ǫ . Thus, eq. (23) holds for all large enough n when we require Since αǫ < 1, we have that eq. (23) holds when we set 0.99ǫ ≥ 4Cσ (1 − σ)α − δ . σ = 0.99ǫ(α − δ) 4C + 1 ≤ 0.99ǫ(α − δ) 4C + 0.99αǫ . We also observe that (1 − σ)α − δ > 0, or equivalently, σ < (α − δ)/α holds for our choice of σ. Having now fixed σ and γ, we observe that in terms of assumption 2 of the statement of theorem 4, we have γ = c1 and (1−σ)α−δ = c2. Thus the assumption τ ≥ c1n−c2 guarantees that the right-hand side of eq. (20) is at least 1, which was required for the existence of p. This completes the parameterization of the algorithm. C EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 15 4.3. Running time. Let us now analyze the running time of the algorithm. The first and second steps run in time O(nD) since p = O(log n) by eq. (20) and f originates from theorem 3 and hence is explicit. From eq. (19) and nσ − 1 < s, we have nD ≤ 4n1+(1−σ)α ≤ 4n2−σ. Since eq. (19) holds, the third step of the algorithm runs in time O(cid:0)(n/s)2+η(cid:1) for any constant η > 0 that we are free to choose. Since n/s ≤ 2n1−σ for all large enough n, we can choose η > 0 so that (2 + η)(1 − σ) ≤ 2 − σ. Thus, the first, second, and third steps together run in time O(n2−σ). The fourth step runs in time O(n2−σ + qs2d). Indeed, observe from Claim 1 in §4.2 that the detection inequality eq. (18) holds for at most q entries in Z. We have qs2d ≤ qn2σ+δ, which completes the running time analysis and the proof of theorem 4. (cid:3) This section proves corollaries 6 and 8. 5. Applications 5.1. The light bulb problem. A useful variant of the Problem 1 asks for all outlier pairs of distinct vectors drawn from a single set S ⊆ {−1, 1}d rather than two sets X, Y . We observe that the single-set variant reduces to ⌈log S⌉ instances of the two-set variant by numbering the vectors in S with binary numbers from 0 to S − 1 and splitting S into two sets Xi, Yi based on the value of the ith bit for each i = 0, 1, . . . ,⌈logS⌉ − 1. Proof of corollary 6. We reduce to (the single-set version of) Problem 1 and apply theorem 4. Towards this end, in theorem 4 set ǫ = 1 − 1/κ and τmax = ρκ max. Suppose we are given an instance of Problem 5 whose parameters n, d, ρ satisfy the constraints. Set τ = ρκ. We observe that the constraints in theorem 4 are satisfied since (i) d ≤ nδ holds by assumption, (ii) τ ≤ τmax holds since τ = ρκ ≤ ρκ max, (iii) the constants c1 and c2 here match those in theorem 4, and the constraint c1n−c2/κ ≤ ρ implies c1n−c2 ≤ τ , and (iv) logτ ρ = log ρ log ρκ = 1/κ ≤ 1 − ǫ. We claim that q = 1 in almost all instances of Problem 5 whose parameters satisfy the constraints in Corollary 6. Indeed, by the Hoeffding bound eq. (7) and the union bound, the probability that some other pair than the planted pair in an instance has inner product that exceeds τ d in absolute value is at most log τ = log ρ 2n2 exp(cid:0)−τ 2d/2(cid:1) ≤ 2n2 exp(cid:0)−ρ2κ · 5ρ−2κ log n(cid:1) = 2n−1/2 , so q = 1 with high probability as n increases. The claimed running time follows by substituting the chosen constants and q = 1 to eq. (5). (cid:3) 5.2. Learning parities with noise. We now generalize the result for parity func- tions of larger constant weight, and prove corollary 8. Proof of corollary 8. Fix the constants 0 < δ < α, C > 60, ξ > 1, 0 < θ < 1. We will fix the value of the constant k0 later. Let k ≥ k0 be a constant. The algorithm first draws d examples from a given instance of Problem 7 and then transforms these to two collections of vectors that we feed to the algorithm of theorem 4 and then proceed to mimic the proof of corollary 6. Let us first set up some notation. For A, B ⊆ [v], let A△B = (A\B)∪(B\A) de- note the symmetric difference of A and B. Let x = (x(1), x(2), . . . , x(v)) ∈ {−1, 1}v be a Boolean n-vector. Let xA = Qℓ∈A x(ℓ) be the product of elements indexed by A, with x∅ = 1. Observe that xAxB = Qi∈A x(i)Qj∈B x(j) = Qℓ∈A△B x(ℓ) = xA△B. Let us write (cid:0)[n] Suppose we are now given as input an instance of Problem 7 with noise level η that satisfies 1 − 2η ≤ θ < 1. Furthermore, we assume that η is part of the input. (If this is not the case, at the cost of increasing time complexity, we can search for v(cid:1) for the set of all k-subsets of [v]. 16 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN η using a geometric progression with limit 1/2.) With the objective of eventually applying theorem 4, set (24) and ρ = 1 − 2ηξ (25) In particular, we have τ < ρ since 0 < 1 − 2η < 1 and ξ > 1. Let d be the least positive integer that satisfies τ = ρξ = 1 − 2ηξ2 . (26) d ≥ (2k + 1 + 4kζ)τ −2(1 − 2η − ρ)−2 log v , where 0 < ζ < 1/2 is constant whose value we will fix later. Draw from the given instance d example -- label pairs (xi, yi) ∈ {−1, 1}v × {−1, 1} with i = 1, 2, . . . , d. We use these examples to define two collections X, Y ⊆ {−1, 1}d of vectors of sizes (cid:0) v ⌊k/2⌋(cid:1) and(cid:0) v ⌈k/2⌉(cid:1), respectively. For all k ≥ ⌈1/(2ζ)⌉ and all v ≥ 2k it is immediate that we have (cid:18) v ⌊k/2⌋(cid:19) ≤(cid:18) v ⌈k/2⌉(cid:19) ≤ vk(1/2+ζ) . In particular, we can assume that X,Y ≤ n for n = ⌊vk(1/2+ζ)⌋. The set X consists of all the vectors 1 , aJ1 aJ1 = (aJ1 i 1 , bJ2 with bJ1 2 , . . . , aJ1 i = xJ1 i = xJ2 bJ2 = (bJ2 with aJ1 vectors d ) ∈ {−1, 1}d for all i = 1, 2, . . . , d and J1 ∈(cid:0) [v] ⌊k/2⌋(cid:1). The set Y consists of all the i yi for all i = 1, 2, . . . , d and J2 ∈(cid:0) [v] ⌈k/2⌉(cid:1). 2 , . . . , bJ2 d ) Let us now study the distribution of inner products between vectors in X and Y . We write Bin±1(d, β) for a random variable that is the sum of d independent random variables, each of which takes the value −1 with probability β, and the value 1 otherwise. Observe that the expectation of Bin±1(d, β) is (1 − 2β)d. Let S ⊆ [v] with S = k be the support of the parity function that is unknown to us. Recall that yi = zixS i with zi ∈ {−1, 1} getting value −1 with probability η. For all J1 ∈(cid:0) [v] ⌈k/2⌉(cid:1) we have d ⌊k/2⌋(cid:1) and J2 ∈(cid:0) [v] haJ1 , bJ2i = i xJ2 xJ1 d i yi = xJ1△J2 i xS i zi = xJ1△J2△S i zi . Xi=1 d Xi=1 Xi=1 Now observe that there are two distinct cases: If J1 △ J2 6= S, then (27) If J1 △ J2 = S, then haJ1, bJ2i ∼ Bin±1(d, 1/2) . (28) haJ1 , bJ2i = xJ1△J2△S i zi = zi ∼ Bin±1(d, η) . d Xi=1 d Xi=1 Hence, our task of finding the support S reduces to that of locating the inner products with distribution Bin±1(d, η) from among those with Bin±1(d, 1/2). We now argue that our choices eq. (24), eq. (25), and eq. (26) suffice for the algorithm in theorem 4 to distinguish between the two cases eq. (27) and eq. (28) for almost all draws of the d examples. Here we stress that the algorithm is deter- ministic, the randomness is over the draw of the examples. From the perspective of the algorithm in theorem 4, it suffices that (a) no pair with eq. (27) exceeds τ d in absolute-value inner product, and (b) at least one of EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 17 the at most kk = O(1) pairs with eq. (28) has absolute-value inner product at least ρd. To control (a), from eq. (7) we observe that Pr(cid:0) Bin±1(d, 1/2) ≥ τ d(cid:1) ≤ 2 exp(cid:18)− ≤ 2 exp(cid:18)− τ 2d 2 (cid:19) 2(1 − 2η − ρ)2 (cid:19) (2k + 1 + 4kζ) log v = 2v−(2k+1+4kζ)(1−2η−ρ)−2/2 . Since there are at most n2 ≤ (vk(1/2+ζ))2 = vk+2ζ such pairs, we observe by the union bound that (a) holds with high probability as v increases since (29) n2 · 2v−(2k+1+4kζ)(1−2η−ρ)−2/2 ≤ 2v−(1/2)(1−2η−ρ)−2 . To control (b), select any fixed pair with eq. (28). From eq. (7) we have (30) (1 − 2η − ρ)2d Pr(cid:0) Bin±1(d, η) − (1 − 2η)d ≥ (1 − 2η − ρ)d(cid:1) ≤ 2 exp(cid:18)− ≤ 2 exp(cid:18)− (2k + 1 + 4kζ) log v (cid:19) (cid:19) 2τ 2 2 = 2v− 2k+1+4kζ 2τ 2 . Thus, (b) holds with high probability as v increases. It remains to verify the constraints for the parameters n, d, ρ, τ in theorem 4. Suppressing the constants, our choice of d in eq. (26) is Θ(k) · 1 − 2η−Θ(1) · log v. For theorem 4 to apply, this must be bounded from above by nδ = vΘ(k), which holds if 1 − 2η ≥ v−Θ(k). This holds by assumption for sufficiently large k. Select k0 so that this constraint holds and k0 ≥ ⌈1/(2ζ)⌉. We can choose τmax = θ and ǫ = 1 − 1/ξ. We then have τ = 1 − 2ηξ2 < τmax < 1 by assumption, as required. Since n ≥ vk/2, we also have by assumption τ = 1 − 2ηξ2 ≥ c1 ξ2 v−c2k/2 ≥ c1n−c2 as required. The constants c1 and c2 here match those in theorem 4. Furthermore by the choice of ǫ we have log ρ log τ = log ρ log ρξ = 1/ξ = 1 − ǫ , as required. So the constraints of theorem 4 are satisfied. For brevity, let E = 0.99ǫ(α−δ) and take ζ = E/4. Thus, we have 4C+1 (31) n2−E ≤(cid:16)vk(1/2+ζ)(cid:17)2−E ≤ vk(1−0.245025(α−δ)2(1−1/ξ)2(1+4C)−2) . The claimed running time eq. (6) follows by observing that eq. (31) subsumes the time it takes to construct the collections X and Y together with the time it takes to search the q pairs of buckets with q ≤ kk = O(1) inside the algorithm of theorem 4. Inserting our choices eq. (24) and eq. (25) into eq. (26) and approximating up- wards with ζ ≤ 1 and 1 − 2η2ξ2+2(1 − θξ−1)2 ≤ τ 2(1 − 2η − ρ)2 yields 6k d ≥ 1 − 2η2(ξ2+1)(1 − θξ−1)2 log v . (cid:3) 18 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN 6. Nonconstructive existence and a lower bound This section shows that nontrivial correlation amplifiers exist and establishes a lower bound on the output dimension D of any correlation amplifier. The former is done by a routine application of the Hoeffding bound and the latter by applying results of Alon [4]. 6.1. Low-dimensional amplifiers exist. By combining the Hoeffding bound with the union bound, we observe that low-dimensional amplifiers exist. Lemma 21 (Existence). There exists a correlation amplifier f : {−1, 1}d → {−1, 1}D with parameters (d, D, p, τ, γ) whenever 0 < τ < 1, γ > 1, and d, p, D are positive integers satisfying (32) τ(cid:17)2p D ≥ 3d (γp − 1)−2(cid:16) γ . Proof. Let f : {−1, 1}d → {−1, 1}D be the function which maps x onto D entries of x⊗p chosen independently at random. That is, each entry of the vector f (x) is the product of p entries of x, chosen independently and uniformly at random. Let x, y ∈ {−1, 1}d be a fixed pair of vectors, set c = D(1− γ−p)τ p, and suppose that the following inequality holds, (33) d (cid:19)p(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12) hf (x), f (y)i − D(cid:18)hx, yi Observe that if hx, yi < τ d then eq. (33) implies d (cid:19)p hf (x), f (y)i ≤ D(cid:18)hx, yi ≤ Dτ p + D(1 − γ−p)τ p ≤ (τ γ)pD . ≤ c . + D(1 − γ−p)τ p The final inequality holds because 2−γ−p ≤ γp is logically equivalent to (γp−1)2 ≥ 0. Similarly, if hx, yi ≥ τ d then eq. (33) implies the following upper bound, D . d (cid:19)p hf (x), f (y)i ≤ D(cid:18)hx, yi d (cid:19)p ≤ D(cid:18)hx, yi d (cid:19)p ≤(cid:18) γhx, yi d (cid:19)p hf (x), f (y)i ≥ D(cid:18)hx, yi d (cid:19)p ≥ D(cid:18)hx, yi γd (cid:19)p ≥(cid:18)hx, yi D . + D(1 − γ−p)τ p d (cid:19)p + D(1 − γ−p)(cid:18)hx, yi − D(1 − γ−p)τ p d (cid:19)p − D(1 − γ−p)(cid:18)hx, yi We also obtain a lower bound from eq. (33) when hx, yi ≥ τ d, In fact, eq. (33) implies conditions eq. (2) and eq. (3) in definition 2. So if the func- tion f satisfies eq. (33) for all x, y ∈ {−1, 1}d, then f is a correlation amplifier. We use theorem 9 to bound the probability that eq. (33) fails, and take a union bound over the range of f to establish a non-constructive existence result for sufficiently large D. EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 19 Define the random variable Zf = hf (x), f (y)i. Since f (x) is a restriction onto D entries of x⊗p chosen uniformly at random, we have d (cid:19)p E[Zf ] = D(cid:18)hx, yi . Observe that Zf = PD i=1 Zf,i where Zf,i is the product of the ith entries of f (x) and f (y). In particular, −1 ≤ Zf,i ≤ 1 holds for i = 1, 2, . . . , D. Summing over the Zf,i in eq. (7), the probability that eq. (33) fails to hold is bounded above by Pr (Zf − E[Zf ] ≥ c) ≤ e− c2 2D . Taking a union bound over all x, y ∈ {−1, 1}d, there exists a correlation amplifier with parameters (d, D, p, τ, γ) whenever 22de− c2 2D < 1 . Solving for D, we get D ≥ d ln 16 τ 2p (1 − γ−p)2 . Simplifying this expression and approximating ln 16 by 3 completes the proof. (cid:3) 6.2. Lower bound on output dimension. We next show a lower bound on the output dimension D of any correlation amplifier, when the other parameters d, p, τ and γ are given. The proof is based on taking a collection of N vectors xi ∈ {−1, 1}d, with all pairs below the background threshold τ , and then bounding the number of their images f (xi) ∈ {−1, 1}D, whose absolute pairwise correlations are required to be below ǫ = (τ γ)p by definition 2. Lemma 22. There is a collection of N = exp(τ 2d/4) vectors x1, x2, . . . , xN ∈ {−1, 1}d such that hxi, xji < τ d for all i 6= j. Proof. We show this by the probabilistic argument. We call a pair of vectors bad if hxi, xji ≥ τ d. Let a collection of vectors X1, X2, . . . , XN be chosen uniformly at random from {−1, 1}d. Consider a pair Xi, Xj with i 6= j, and let Zij = hXi, Xji. Now Zij is a sum of d independent random variables in [−1, 1], with E[Zij ] = 0. Applying the two-sided Hoeffding bound with c = τ d, we observe that the pair Xi, Xj is bad with probability Pr(hXi, Xji ≥ τ d) = Pr(Zij − E[Zij] ≥ τ d) ≤ 2 exp(−τ 2d/2). Since there are less than N 2/2 = (1/2) exp(τ 2d/2) pairs of vectors, the expected number of bad pairs is less than 1. Thus in at least one collection there are no bad pairs. (cid:3) To bound the number of the image vectors, we use a combinatorial result from Alon [4] to bound the rank of their correlation matrix. Lemma 23. Let A = (aij) be an N × N real, symmetric matrix with aii = 1 and aij ≤ 1/√N for all i 6= j. Then rank(A) ≥ N/2. Proof. Apply Alon's Lemma 9.1 [4] with ǫ = 1/√N . Lemma 24. Let B = (bij ) be an N × N matrix with rank(B) = D′, and let A = (bk (cid:3) ij), where k is a positive integer. Then rank(A) ≤(cid:0)D′+k−1 Proof. Apply Alon's Lemma 9.2 [4] with the polynomial P (x) = xk. (cid:1). (cid:3) k The next lemma is in essence Alon's Theorem 9.3 [4], modified to avoid any asymptotic notation. All logarithms here are in base 2. 20 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN Lemma 25. Let B = (bij ) be an N × N real, symmetric matrix with bii = 1 and bij ≤ ǫ for all i 6= j, where 1/√N ≤ ǫ ≤ 1/100, and rank(B) = D′. Then (34) D′ ≥(cid:18) r 5(cid:19)(cid:18) 1 ǫ(cid:19)2r/(r+1) where r = (log N )/(2 log(1/ǫ)). Let A = (aij ) = (bk Proof. Choose r as stated. Note that by the assumed range of ǫ, we have r ≥ 1. Let further k = ⌈r⌉, so in particular 1 ≤ r ≤ k < r + 1. ij ). Since the off-diagonal elements of B satisfy bij < ǫ, it follows from the choice of k that the off-diagonal elements of A satisfy aij ≤ ǫk ≤ ǫr = 1/√N . Combining lemma 23 and lemma 24, we have (cid:19)k N/2 ≤ rank(A) ≤(cid:18)D′ + k − 1 (cid:19) ≤(cid:18) e(D′ + k − 1) ≤(cid:18) e(D′ + r) (cid:19)r+1 k k r . Taking logarithms and rearranging the inequality we obtain log(cid:18)1 + D′ r (cid:19) ≥ log(N/2) r + 1 − log e ≥ log N r + 1 − 2, implying 1 + D′ r ≥ 2(log N )/(r+1) 4 . Observing that log N = r log(1/ǫ2), we get 1 1 + D′ r ≥ ǫ(cid:19)2r/(r+1) 4(cid:18) 1 and, since ǫ ≤ 1/100 and r ≥ 1, this implies 5(cid:19)(cid:18) 1 ǫ(cid:19)2r/(r+1) D′ ≥(cid:18) r as stated. (cid:3) Remark. The parameter r measures, in a sense, the distance from the case of an extremely low correlation requirement ǫ = 1/√N . If r tends to infinity, the exponent 2r/(r + 1) approaches 2, matching the asymptotic form given by Alon [4]. However, with small r the exponent diminishes, reaching 1 in the limiting case r = 1, that is, when ǫ = 1/√N . In the limiting case a direct application of lemma 23 would give the better linear bound D′ ≥ N/2. We can now combine lemma 22 and 25 to get a lower bound on output dimension. Lemma 26 (Lower bound on output dimension). The output dimension of a cor- relation amplifier with parameters (d, D, p, τ, γ) is bounded by 1 γτ(cid:19)p 5(cid:18) 1 D ≥ when (γτ )p ≤ 1/100 and p ≤ (log e)τ 2d Proof. By lemma 22 there is a collection of N = exp(τ 2d/4) vectors x1, x2, . . . , xN ∈ {−1, 1}d with correlations below τ in absolute value. By Definition 2 their images ui = f (xi) ∈ {−1, 1}D have correlations below ǫ = (γτ )p in absolute value. 8 log( 1 γτ ) . EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 21 Consider the N × N correlation matrix B = (bij) = (hui, uji/D). It is real and symmetric, with diagonal elements bii = 1 and off-diagonals satisfying bij ≤ ǫ. We observe that D′ = rank(B) ≤ D. Applying lemma 25 we have r = log N 2 log(1/ǫ) = (log e)τ 2d 8p log( 1 γτ ) ≥ 1, and (35) as claimed. D ≥ D′ ≥(cid:18) r 5(cid:19)(cid:18) 1 ǫ(cid:19)2r/(r+1) 1 γτ(cid:19)p 5(cid:18) 1 ≥ (cid:3) Remark. At the limiting case where p = (log e)τ 2d γτ ) , we have r = 1 and ǫ = 1/√N = exp(−t2d/8), and the bound eq. (35) becomes D ≥ exp(τ 2d/8). For p greater than the limit, one can essentially map all of the N = exp(τ 2d/4) input vectors to orthogonal output vectors of dimension D ≤ 2N using a Hadamard matrix, in which case eq. (2) holds for arbitrary p > 1. 8 log( 1 Appendix A. An expander family This section proves lemma 11 following Reingold, Vadhan and Wigderson [34]; we present the proof for completeness of exposition only with no claim of original- ity. Following Reingold, Vadhan and Wigderson [34] we will work with normalized eigenvalues. To avoid confusion with the unnormalized treatment in the manu- script proper, we say that a graph is a [D, ∆, λ]-graph if the graph has D vertices, is ∆-regular, and λ2/∆ ≤ λ. (Here λ2 is the unnormalized second eigenvalue as defined in the manuscript proper.) We refer to Sections 2.3 and 3.1 of Reingold, Vadhan, and Wigderson [34] for the definition of the square G2 of a graph G, the tensor product G1 ⊗ G2 of graphs G1, G2, and the zigzag product G Z(cid:13) H of graphs G, H. The following omnibus result collects elements of Propositions 2.3, Proposition 2.4, Theorem 3.2 and The- orem 4.3 of [34] which will be sufficient to control the second normalized eigenvalue for our present purposes. (We choose to omit the details of the rotation maps with the understanding that they can be found in [34].) Lemma 27 (Reingold, Vadhan, and Wigderson [34]). The following bounds hold. (1) If G is a [D, ∆, λ]-graph, then G2 is a [D, ∆2, λ2]-graph. (2) If G1 is a [D1, ∆1, λ1]-graph and G2 is a [D2, ∆2, λ2]-graph, 1 f (λ1, λ2) = (3) If G is a [D1, ∆1, λ1]-graph and H a [∆1, ∆2, λ2]-graph, 2, f (λ1, λ2)]-graph with then G1 ⊗ G2 is a [D1D2, ∆1∆2, max(λ1, λ2)]-graph. then G Z(cid:13) H is a [D1∆1, ∆2 2(cid:1) λ1 + 2q(1 − λ2 G1 = H 2, G2 = H ⊗ H, and for t = 3, 4, . . . let 2 ⌋(cid:17)2 2 ⌉ ⊗ G⌊ t−1 (36) Gt =(cid:16)G⌈ t−1 2(cid:0)1 − λ2 2)2 λ2 1 + 4λ2 Z(cid:13) H . Let us study the following sequence of graphs. Let H be a [D, ∆, λ]-graph. Let 1 2 ≤ λ1 + λ2 . From lemma 27 it is easily seen that Gt is a [Dt, ∆2, λt]-graph with λt defined by λ1 = λ2 , λ2 = λ , λ2t−1 = λ + λ2 t−1 , λ2t = max(λ + λ2 t , λ + λ2 t−1) , for t = 2, 3 . . . , and for t = 2, 3, . . . . 22 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN Lemma 28 (Reingold, Vadhan, and Wigderson [34, Theorem 3.3]). The rotation map RotGt can be computed in time poly(t, log D) and by making poly(t) evalua- tions of RotH . Lemma 29. If 0 ≤ λ ≤ 1/4 then λt ≤ λ + 4λ2 for all t ≥ 1. Proof. The conclusion is immediate for t ≤ 2. So suppose that the conclusion holds up to 2t − 2. We need to show that the conclusion holds for λ2t−1 and λ2t. By induction, it suffices to show that λ2t−1 ≤ λ + (λ + 4λ2)2 ≤ λ + 4λ2 . Observing that λ2 + 8λ3 + 16λ4 ≤ 4λ2 holds for 0 ≤ λ ≤ 1/4 yields the desired conclusion. The proof for λ2t is identical. (cid:3) Finally, we construct the expanders that we require in the manuscript proper. Lemma 30 (lemma 11 stated with normalized eigenvalue notation). For all inte- gers t ≥ 1 and b ≥ 10 there exists a [216bt, 24b, 16 · 2−b]-graph whose rotation map can be evaluated in time poly(b, t). Proof. Take q = 2b and d = 15 in Proposition 5.3 of Reingold, Vadhan, and Wigder- son [34] to obtain a [216b, 22b, 15 · 2−b]-graph H whose rotation map can be com- puted in time poly(b). (Indeed, observe that an irreducible polynomial to perform the required arithmetic in the finite field of order 2b can be constructed in deter- ministic time poly(b) by an algorithm of Shoup [35].) Let us study the sequence Gt given by eq. (36). The time complexity of the rotation map follows immediately from lemma 28. Since b ≥ 10, lemma 29 gives that λt ≤ λ + 4λ2 for all t ≥ 1. Take λ = 15 · 2−b and observe that since b ≥ 10 we have 2−b < 1/900. Thus, λt ≤ 15 · 2−b + 4(15 · 2−b)2 = 15 · 2−b + 900 · 2−2b ≤ 16 · 2−b. (cid:3) References [1] Thomas D. Ahle, Rasmus Pagh, Ilya Razenshteyn, and Francesco Silvestri. On the complexity of inner product similarity join. arXiv, abs/1510.02824, 2015. [2] Josh Alman, Timothy M. Chan, and Ryan Williams. Polynomial representations of threshold functions and algorithmic applications. arXiv, abs/1608.04355, 2016. [3] Josh Alman and Ryan Williams. Probabilistic polynomials and Hamming nearest neighbors. In Proc. 56th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 136 -- 150, Los Alamitos, CA, USA, 2015. IEEE Computer Society. [4] Noga Alon. Problems and results in extremal combinatorics -- I. Discrete Math., 273(1-3):31 -- 53, 2003. [5] Alexandr Andoni, Piotr Indyk, Huy L. Nguyen, and Ilya Razenshteyn. Beyond locality- sensitive hashing. In Proc. 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1018 -- 1028, Philadelphia, PA, USA, 2014. Society for Industrial and Applied Mathematics. [6] Alexandr Andoni, Thijs Laarhoven, Ilya P. Razenshteyn, and Erik Waingarten. Optimal hashing-based time-space trade-offs for approximate near neighbors. arXiv, abs/1608.03580, 2016. [7] Alexandr Andoni and Ilya Razenshteyn. Optimal data-dependent hashing for approximate near neighbors. In Proc. 47th ACM Annual Symposium on the Theory of Computing (STOC), pages 793 -- 801, New York, NY, USA, 2015. Association for Computing Machinery. [8] Avrim Blum, Adam Kalai, and Hal Wasserman. Noise-tolerant learning, the parity problem, and the statistical query model. J. ACM, 50(4):506 -- 519, 2003. [9] L. Elisa Celis, Omer Reingold, Gil Segev, and Udi Wieder. Balls and bins: Smaller hash families and faster evaluation. SIAM J. Comput., 42(3):1030 -- 1050, 2013. [10] Timothy M. Chan and Ryan Williams. Deterministic APSP, orthogonal vectors, and more: Quickly derandomizing Razborov-Smolensky. In Robert Krauthgamer, editor, Proc. 27th An- nual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1246 -- 1255, Arlington, VA, USA, 2016. Society for Industrial and Applied Mathematics. [11] Moshe Dubiner. Bucketing coding and information theory for the statistical high-dimensional nearest-neighbor problem. IEEE Trans. Inf. Theory, 56(8):4166 -- 4179, 2010. EXPLICIT AMPLIFIERS FOR OUTLIER CORRELATIONS 23 [12] Vitaly Feldman, Parikshit Gopalan, Subhash Khot, and Ashok Kumar Ponnuswami. On agnostic learning of parities, monomials, and halfspaces. SIAM J. Comput., 39(2):606 -- 645, 2009. [13] Aristides Gionis, Piotr Indyk, and Rajeev Motwani. Similarity search in high dimensions via hashing. In Malcolm P. Atkinson, Maria E. Orlowska, Patrick Valduriez, Stanley B. Zdonik, and Michael L. Brodie, editors, Proc. 25th International Conference on Very Large Data Bases (VLDB'99), pages 518 -- 529, Edinburgh, Scotland, UK, 1999. Morgan Kaufmann. [14] Parikshit Gopalan, Daniek Kane, and Raghu Meka. Pseudorandomness via the Discrete Fourier Transform. In Proc. IEEE 56th Annual Symposium on Foundations of Computer Science (FOCS), pages 903 -- 922, Berkeley, CA, USA, 2015. IEEE Computer Society. [15] Parikshit Gopalan, Raghu Meka, Omer Reingold, and David Zuckerman. Pseudorandom generators for combinatorial shapes. SIAM J. Comput., 42(3):1051 -- 1076, 2013. [16] Elena Grigorescu, Lev Reyzin, and Santosh Vempala. On noise-tolerant learning of sparse par- ities and related problems. In Proc. 22nd International Conference on Algorithmic Learning Theory (ALT), pages 413 -- 424, Berlin, Germany, 2011. Springer. [17] Wassily Hoeffding. Probability inequalities for sums of bounded random variables. J. Amer. Statist. Assoc., 58:13 -- 30, 1963. [18] Shlomo Hoory, Nathan Linial, and Avi Wigderson. Expander graphs and their applications. Bull. Amer. Math. Soc., 43(4):439 -- 561, 2006. [19] Russell Impagliazzo and Ramamohan Paturi. On the complexity of k-SAT. J. Comput. Syst. Sci., 62(2):367 -- 375, 2001. [20] Piotr Indyk and Rajeev Motwani. Approximate nearest neighbors: Towards removing the curse of dimensionality. In Proc. 30th Annual ACM Symposium on the Theory of Computing (STOC), pages 604 -- 613, New York, NY, USA, 1998. Association for Computing Machinery. [21] Daniel M. Kane, Raghu Meka, and Jelani Nelson. Almost optimal explicit Johnson- Lindenstrauss families. In Proc. 14th International Workshop on Approximation, Random- ization, and Combinatorial Optimization, RANDOM and 15th International Workshop on Algorithms and Techniques, APPROX, pages 628 -- 639, Princeton, NJ, USA, 2011. [22] Michael Kapralov. Smooth tradeoffs between insert and query complexity in nearest neighbor search. In Proc. 34th ACM Symposium on Principles of Database Systems (PODS), pages 329 -- 342, New York, NY, USA, 2015. Association for Computing Machinery. [23] Matti Karppa, Petteri Kaski, and Jukka Kohonen. A faster subquadratic algorithm for finding outlier correlations. In Proc. 27th Annual ACM-SIAM Symposium on Discrete Algorithms, (SODA), pages 1288 -- 1305, Arlington, VA, USA, 2016. Society for Industrial and Applied Mathematics. [24] Pravesh K. Kothari and Raghu Meka. Almost optimal pseudorandom generators for spherical caps. In Proc. 47th Annual ACM Symposium on Theory of Computing (STOC), pages 247 -- 256, Portland, OR, USA, 2015. [25] Fran¸cois Le Gall. Faster algorithms for rectangular matrix multiplication. In Proc. 53rd An- nual IEEE Symposium on Foundations of Computer Science (FOCS), pages 514 -- 523, Los Alamitos, CA, USA, 2012. IEEE Computer Society. [26] A. Lubotzky, R. Phillips, and P. Sarnak. Ramanujan graphs. Combinatorica, 8:261 -- 277, 1988. [27] Alexander May and Ilya Ozerov. On computing nearest neighbors with applications to de- coding of binary linear codes. In Proc. EUROCRYPT 2015 - 34th Annual International Conference on the Theory and Applications of Cryptographic Techniques, pages 203 -- 228, Berlin, Germany, 2015. Springer. [28] Elchanan Mossel, Ryan O'Donnell, and Rocco A. Servedio. Learning functions of k relevant variables. J. Comput. Syst. Sci., 69(3):421 -- 434, 2004. [29] Rajeev Motwani, Assaf Naor, and Rina Panigrahy. Lower bounds on locality sensitive hashing. SIAM J. Discrete Math., 21(4):930 -- 935, 2007. [30] Ryan O'Donnell, Yi Wu, and Yuan Zhou. Optimal lower bounds for locality-sensitive hashing (except when q is tiny). ACM Trans. Comput. Theory, 6(1):Article 5, 2014. [31] Rasmus Pagh. Locality-sensitive hashing without false negatives. In Proc. 27th Annual ACM- SIAM Symposium on Discrete Algorithms (SODA), pages 1 -- 9, Philadelphia, PA, USA, 2016. Society for Industrial and Applied Mathematics. [32] Ramamohan Paturi, Sanguthevar Rajasekaran, and John H. Reif. The light bulb problem. In Proc. 2nd Annual Workshop on Computational Learning Theory (COLT), pages 261 -- 268, New York, NY, USA, 1989. Association for Computing Machinery. [33] Ninh Pham and Rasmus Pagh. Scalability and total recall with fast CoveringLSH. arXiv, abs/1602.02620, 2016. [34] Omer Reingold, Salil Vadhan, and Avi Wigderson. Entropy waves, the zig-zag graph product, and new constant-degree expanders. Ann. of Math., 155(1):157 -- 187, 2002. 24 MATTI KARPPA, PETTERI KASKI, JUKKA KOHONEN, AND PADRAIG ´O CATH ´AIN [35] Victor Shoup. New algorithms for finding irreducible polynomials over finite fields. Math. Comp., 54:435 -- 447, 1990. [36] Gregory Valiant. Finding correlations in subquadratic time, with applications to learning parities and the closest pair problem. J. ACM, 62(2):Article 13, 2015. [37] Leslie G. Valiant. Functionality in neural nets. In Proc. 1st Annual Workshop on Computa- tional Learning Theory (COLT), pages 28 -- 39, New York, NY, USA, 1988. Association for Computing Machinery.
1706.07475
1
1706
2017-06-22T19:56:51
Parameterized Approximation Algorithms for some Location Problems in Graphs
[ "cs.DS" ]
We develop efficient parameterized, with additive error, approximation algorithms for the (Connected) $r$-Domination problem and the (Connected) $p$-Center problem for unweighted and undirected graphs. Given a graph $G$, we show how to construct a (connected) $\big(r + \mathcal{O}(\mu) \big)$-dominating set $D$ with $|D| \leq |D^*|$ efficiently. Here, $D^*$ is a minimum (connected) $r$-dominating set of $G$ and $\mu$ is our graph parameter, which is the tree-breadth or the cluster diameter in a layering partition of $G$. Additionally, we show that a $+ \mathcal{O}(\mu)$-approximation for the (Connected) $p$-Center problem on $G$ can be computed in polynomial time. Our interest in these parameters stems from the fact that in many real-world networks, including Internet application networks, web networks, collaboration networks, social networks, biological networks, and others, and in many structured classes of graphs these parameters are small constants.
cs.DS
cs
Parameterized Approximation Algorithms for some Location Problems in Graphs Arne Leitert and Feodor F. Dragan Department of Computer Science, Kent State University, Kent, Ohio, USA [email protected], [email protected] Given a graph G, we show how to construct a (connected)(cid:0)r + O(µ)(cid:1)- Abstract. We develop efficient parameterized, with additive error, ap- proximation algorithms for the (Connected) r-Domination problem and the (Connected) p-Center problem for unweighted and undirected graphs. dominating set D with D ≤ D∗ efficiently. Here, D∗ is a minimum (connected) r-dominating set of G and µ is our graph parameter, which is the tree-breadth or the cluster diameter in a layering partition of G. Additionally, we show that a +O(µ)-approximation for the (Connected) p-Center problem on G can be computed in polynomial time. Our interest in these parameters stems from the fact that in many real-world networks, including Internet application networks, web networks, collaboration net- works, social networks, biological networks, and others, and in many structured classes of graphs these parameters are small constants. 1 Introduction The (Connected) r-Domination problem and the (Connected) p-Center problem, along with the p-Median problem, are among basic facility location problems with many applications in data clustering, network design, operations research -- to name a few. Let G = (V, E) be an unweighted and undirected graph. Given a radius r(v) ∈ N for each vertex v of G, indicating within what radius a vertex v wants to be served, the r-Domination problem asks to find a set D ⊆ V of minimum cardinality such that dG(v, D) ≤ r(v) for every v ∈ V . The Connected r-Domination problem asks to find an r-dominating set D of minimum cardinality with an additional requirement that D needs to induce a connected subgraph of G. When r(v) = 1 for every v ∈ V , one gets the classical (Connected) Domination problem. Note that the Connected r-Domination problem is a natural generalization of the Steiner Tree problem (where each vertex t in the target set has r(t) = 0 and each other vertex s has r(s) = diam(G)). The connectedness of D is important also in network design and analysis applications (e. g. in finding a small backbone of a network). It is easy to see also that finding minimum connected dominating sets is equivalent to finding spanning trees with the maximum possible number of leaves. The (closely related) p-Center problem asks to find in G a set C ⊆ V of at most p vertices such that the value maxv∈V dG(v, C) is minimized. If, additionally, C is required to induce a connected subgraph of G, then one gets the Connected p-Center problem. The domination problem is one of the most well-studied NP-hard problems in algorithmic graph theory. To cope with the intractability of this problem it has been studied both in terms of approximability (relaxing the optimality) and fixed-parameter tractability (relaxing the runtime). From the approximability prospective, a logarithmic approximation factor can be found by using a simple greedy algorithm, and finding a sublogarithmic approximation factor is NP- hard [19]. The problem is in fact Log-APX-complete [14]. The Domination problem is notorious also in the theory of fixed-parameter tractability (see, e. g., [11,18] for an introduction to parameterized complexity). It was the first problem to be shown W[2]-complete [11], and it is hence unlikely to be FPT, i. e., unlikely to have an algorithm with runtime f(k)nc for f a computable function, k the size of an optimal solution, c a constant, and n the number of vertices of the input graph. Similar results are known also for the connected domination problem [17]. The p-Center problem is known to be NP-hard on graphs. However, for it, a simple and efficient factor 2 approximation algorithm exists [16]. Furthermore, it is a best possible approximation algorithm in the sense that an approximation with factor less than 2 is proven to be NP-hard (see [16] for more details). The NP-hardness of the Connected p-Center problem is shown in [20]. Recently, in [7], a new type of approximability result (call it a parameterized approximability result) was obtained: there exists a polynomial time algorithm which finds in an arbitrary graph G having a minimum r-dominating set D a set D′ such that D′ ≤ D and each vertex v ∈ V is within distance at most r(v) + 2δ from D′, where δ is the hyperbolicity parameter of G (see [7] for details). We call such a D′ an (r + 2δ)-dominating set of G. Later, in [13], this idea was extended to the p-Center problem: there is a quasi-linear time algorithm for the p-Center problem with an additive error less than or equal to six times the input graph's hyperbolicity (i. e., it finds a set C′ with at most p vertices such that maxv∈V dG(v, C′) ≤ minC⊆V,C≤p maxv∈V dG(v, C) + 6δ). We call such a C′ a +6δ-approximation for the p-Center problem. In this paper, we continue the line of research started in [7] and [13]. Un- fortunately, the results of [7,13] are hardly extendable to connected versions of the r-Domination and p-Center problems. It remains an open question whether similar approximability results parameterized by the graph's hyperbolicity can be obtained for the Connected r-Domination and Connected p-Center problems. Instead, we consider two other graph parameters: the tree-breadth ρ and the cluster diameter ∆ in a layering partition (formal definitions will be given in the next sections). Both parameters (like the hyperbolicity) capture the metric tree-likeness of a graph (see, e. g., [2] and papers cited therein). As demonstrated in [2], in many real-world networks, including Internet application networks, web networks, collaboration networks, social networks, biological networks, and others, as well as in many structured classes of graphs the parameters δ, ρ, and ∆ are small constants. 2 We show here that, for a given n-vertex, m-edge graph G, having a minimum r-dominating set D and a minimum connected r-dominating set C: -- an (r + ∆)-dominating set D′ with D′ ≤ D can be computed in linear -- a connected (r + 2∆)-dominating set C′ with C′ ≤ C can be computed in O(cid:0)m α(n) log ∆(cid:1) time (where α(n) is the inverse Ackermann function); in O(cid:0)m α(n) log min(∆, p)(cid:1) time. -- a +∆-approximation for the p-Center problem can be computed in linear -- a +2∆-approximation for the connected p-Center problem can be computed time; time; Furthermore, given a tree-decomposition with breadth ρ for G: -- an (r + ρ)-dominating set D′ with D′ ≤ D can be computed in O(nm) -- a connected(cid:0)r + 5ρ(cid:1)-dominating set C′ with C′ ≤ C can be computed in time; O(nm) time; -- a +ρ-approximation for the p-Center problem can be computed in O(nm log n) -- a +5ρ-approximation for the Connected p-Center problem can be computed time; in O(nm log n) time. To compare these results with the results of [7,13], notice that, for any graph G, its hyperbolicity δ is at most ∆ [2] and at most two times its tree-breadth ρ [6], and the inequalities are sharp. Note that, for split graphs (graphs in which the vertices can be partitioned into a clique and an independent set), all three parameters are at most 1. Additionally, as shown in [8], there is (under reasonable assumptions) no polynomial-time algorithm to compute a sublogarithmic-factor approximation for the (Connected) Domination problem in split graphs. Hence, there is no such algorithm even for constant δ, ρ, and ∆. One can extend this result to show that there is no polynomial-time algo- rithm A which computes, for any constant c, a +c log n-approximation for split graphs. Hence, there is no polynomial-time +c∆ log n-approximation algorithm in general. Consider a given split graph G = (C ∪ I, E) with n vertices where C induces a clique and I induces an independent set. Create a graph H = (CH ∪ IH , EH) by, first, making n copies of G. Let CH = C1 ∪ C2 ∪ . . . ∪ Cn and IH = I1 ∪ I2 ∪ . . . ∪ In. Second, make the vertices in CH pairwise adjacent. Then, CH induces a clique and IH induces an independent set. If there is such an algo- rithm A, then A produces a (connected) dominating set DA for H which hast at most 2c log n more vertices that a minimum (connected) dominating set D. Thus, by pigeonhole principle, H contains a clique Ci for which Ci ∩ DA = Ci ∩ D. Therefore, such an algorithm A would allow to solve the (Connected) Domination problem for split graphs in polynomial time. 3 2 Preliminaries All graphs occurring in this paper are connected, finite, unweighted, undirected, without loops, and without multiple edges. For a graph G = (V, E), we use n = V and m = E to denote the cardinality of the vertex set and the edge set of G, respectively. G[v] =(cid:8) u dG(u, v) ≤ r(cid:9) is called the r- The length of a path from a vertex v to a vertex u is the number of edges in the path. The distance dG(u, v) in a graph G of two vertices u and v is the length of a shortest path connecting u and v. The distance between a vertex v and a set S ⊆ V is defined as dG(v, S) = minu∈S dG(u, v). For a vertex v of G and some positive integer r, the set N r neighbourhood of v. The eccentricity eccG(v) of a vertex v is maxu∈V dG(u, v). For a set S ⊆ V , its eccentricity is eccG(S) = maxu∈V dG(u, S). For some function r: V → N, a vertex u is r-dominated by a vertex v (by a set S ⊆ V ), if dG(u, v) ≤ r(u) (dG(u, S) ≤ r(u), respectively). A vertex set D is called an r-dominating set of G if each vertex u ∈ V is r dominated by D. Additionally, for some non-negative integer ϕ, we say a vertex is (r+ϕ)-dominated by a vertex v (by a set S ⊆ V ), if dG(u, v) ≤ r(u) + ϕ (dG(u, S) ≤ r(u) + ϕ, respectively). An (r + ϕ)-dominating set is defined accordingly. For a given graph G and function r, the (Connected) r-Domination problem asks for the smallest (connected) vertex set D such that D is an r-dominating set of G. where each vertex of T, called bag, is a subset of V such that: (i) V =S The degree of a vertex v is the number of vertices adjacent to it. For a vertex set S, let G[S] denote the subgraph of G induced by S. A vertex set S is a separator for two vertices u and v in G if each path from u to v contains a vertex s ∈ S; in this case we say S separates u from v. A tree-decomposition of a graph G = (V, E) is a tree T with the vertex set B B∈B B, (ii) for each edge uv ∈ E, there is a bag B ∈ B with u, v ∈ B, and (iii) for each vertex v ∈ V , the bags containing v induce a subtree of T. A tree-decomposition T of G has breadth ρ if, for each bag B of T, there is a vertex v in G with B ⊆ N ρ G[v]. The tree-breadth of a graph G is ρ, written as tb(G) = ρ, if ρ is the minimal breadth of all tree-decomposition for G. A tree-decomposition T of G has length λ if, for each bag B of T and any two vertices u, v ∈ B, dG(u, v) ≤ λ. The tree- length of a graph G is λ, written as tl(G) = λ, if λ is the minimal length of all tree-decomposition for G. For a rooted tree T, let Λ(T) denote the number of leaves of T. For the case when T contains only one node, let Λ(T) := 0. With α, we denote the inverse Ackermann function (see, e. g., [9]). It is well known that α grows extremely slowly. For x = 1080 (estimated number of atoms in the universe), α(x) ≤ 4. 3 Using a Layering Partition The concept of a layering partition was introduced in [4,5]. The idea is the following. First, partition the vertices of a given graph G = (V, E) in distance layers Li = { v dG(s, v) = i} for a given vertex s. Second, partition each layer Li 4 into clusters in such a way that two vertices u and v are in the same cluster if and only if they are connected by a path only using vertices in the same or upper layers. That is, u and v are in the same cluster if and only if, for some i, {u, v} ⊆ Li and there is a path P from u to v in G such that, for all j < i, P ∩ Lj = ∅. Note that each cluster C is a set of vertices of G, i. e., C ⊆ V , and all clusters are pairwise disjoint. The created clusters form a rooted tree T with the cluster {s} as the root where each cluster is a node of T and two clusters C and C′ are adjacent in T if and only if G contains an edge uv with u ∈ C and v ∈ C′. Figure 1 gives an example for such a partition. A layering partition of a graph can be computed in linear time [5]. (a) A graph G. (b) A layering partition T for G. Fig. 1. Example of a layering partition. A given graph G (a) and the layering partition of G generated when starting at vertex s (b). Example taken from [5]. For the remainder of this section, assume that we are given a graph G = (V, E) and a layering partition T of G for an arbitrary start vertex. We denote the largest diameter of all clusters of T as ∆, i. e., ∆ := max(cid:8) dG(x, y) x, y are in a cluster C of T (cid:9). For two vertices u and v of G contained in the clusters Cu and Cv of T , respectively, we define dT (u, v) := dT (Cu, Cv). Lemma 1. For all vertices u and v of G, dT (u, v) ≤ dG(u, v) ≤ dT (u, v) + ∆. Proof. Clearly, by construction of a layering partition, dT (u, v) ≤ dG(u, v) for all vertices u and v of G. Next, let Cu and Cv be the clusters containing u and v, respectively. Note that T is a rooted tree. Let C′ be the lowest common ancestor of Cu and Cv. Therefore, dT (u, v) = dT (u, C′) + dT (C′, v). By construction of a layering partition, C′ contains a vertex u′ and vertex v′ such that dG(u, u′) = dT (u, u′) and dG(v, v′) = dT (v, v′). Since the diameter of each cluster is at most ∆, dG(u, v) ≤ dT (u, u′) + □ ∆ + dT (v, v′) = dT (u, v) + ∆. 5 ss Theorem 1 below shows that we can use the layering partition T to compute an (r+∆)-dominating set for G in linear time which is not larger than a minimum r-dominating set for G. This is done by finding a minimum r-dominating set of T where, for each cluster C of T , r(C) is defined as minv∈C r(v). Theorem 1. Let D be a minimum r-dominating set for a given graph G. An (r+ ∆)-dominating set D′ for G with D′ ≤ D can be computed in linear time. Proof. First, create a layering partition T of G and, for each cluster C of T , set r(C) := minv∈C r(v). Second, find a minimum r-dominating set S for T , i. e., a set S of clusters such that, for each cluster C of T , dT (C,S) ≤ r(C). Third, create a set D′ by picking an arbitrary vertex of G from each cluster in S. All three steps can be performed in linear time, including the computation of S (see [3]). Next, we show that D′ is an (r + ∆)-dominating set for G. By construction of S, each cluster C of T has distance at most r(C) to S in T . Thus, for each vertex u of G, S contains a cluster CS with dT (u, CS) ≤ r(u). Additionally, by Lemma 1, dG(u, v) ≤ r(u)+ ∆ for any vertex v ∈ CS. Therefore, for any vertex u, dG(u, D′) ≤ r(u) + ∆, i. e., D′ is an (r + ∆)-dominating set for G. It remains to show that D′ ≤ D. Let D be the set of clusters of T that contain a vertex of D. Because D is an r-dominating set for G, it follows from Lemma 1 that D is an r-dominating set for T . Clearly, since clusters are pairwise disjoint, D ≤ D. By minimality of S, S ≤ D and, by construction of D′, D′ = S. Therefore, D′ ≤ D. □ We now show how to construct a connected (r + 2∆)-dominating set for G using T in such a way that the set created is not larger than a minimum connected r-dominating set for G. For the remainder of this section, let Dr be a minimum connected r-dominating set of G and let, for each cluster C of T , r(C) be defined as above. Additionally, we say that a subtree T ′ of some tree T is an r-dominating subtree of T if the nodes (clusters in case of a layering partition) of T ′ form a connected r-dominating set for T. The first step of our approach is to construct a minimum r-dominating subtree Tr of T . Such a subtree Tr can be computed in linear time [12]. Lemma 2 below shows that Tr gives a lower bound for the cardinality of Dr. Lemma 2. If Tr contains more than one cluster, each connected r-dominating set of G intersects all clusters of Tr. Therefore, Tr ≤ Dr. Proof. Let D be an arbitrary connected r-dominating set of G. Assume that Tr has a cluster C such that C∩D = ∅. Because D is connected, the subtree of T induced by the clusters intersecting D is connected, too. Thus, if D intersects all leafs of Tr, then it intersects all clusters of Tr. Hence, we can assume, without loss of generality, that C is a leaf of Tr. Because Tr has at least two clusters and by minimality of Tr, T contains a cluster C′ such that dT (C′, C) = dT (C′, Tr) = r(C′). Note that each path in G from a vertex in C′ to a vertex in D intersects C. Therefore, by Lemma 1, there is a vertex u ∈ C′ with r(u) = dT (u, C) < dT (u, D) ≤ dG(u, D). That contradicts with D being an r-dominating set. 6 these clusters are pairwise disjoint, it follows that Tr ≤ Dr. Because any r-dominating set of G intersects each cluster of Tr and because □ As we show later in Corollary 1, each connected vertex set S ⊆ V that intersects each cluster of Tr gives an (r + ∆)-dominating set for G. It follows from Lemma 2 that, if such a set S has minimum cardinality, S ≤ Dr. However, finding a minimum cardinality connected set intersecting each cluster of a layering partition (or of a subtree of it) is as hard as finding a minimum Steiner tree. The main idea of our approach is to construct a minimum (r + δ)-dominating subtree Tδ of T for some integer δ. We then compute a small enough connected set Sδ that intersects all cluster of Tδ. By trying different values of δ, we eventually construct a connected set Sδ such that Sδ ≤ Tr and, thus, Sδ ≤ Dr. Additionally, we show that Sδ is a connected (r + 2∆)-dominating set of G. For some non-negative integer δ, let Tδ be a minimum (r + δ)-dominating subtree of T . Clearly, T0 = Tr. The following two lemmas set an upper bound for the maximum distance of a vertex of G to a vertex in a cluster of Tδ and for the size of Tδ compared to the size of Tr. Lemma 3. For each vertex v of G, dT (v, Tδ) ≤ r(v) + δ. Proof. Let Cv be the cluster of T containing v and let C be the cluster of Tδ closest to Cv in T . By construction of Tδ, dT (v, C) = dT (Cv, C) ≤ r(Cv) + δ ≤ □ r(v) + δ. imply the following. Because the diameter of each cluster is at most ∆, Lemma 1 and Lemma 3 Corollary 1. If a vertex set intersects all clusters of Tδ, it is an (cid:0)r + (δ + ∆)(cid:1)- dominating set of G. Lemma 4. Tδ ≤ Tr − δ · Λ(Tδ). Proof. First, consider the case when Tδ contains only one cluster, i. e., Tδ = 1. Then, Λ(Tδ) = 1 and, thus, the statement clearly holds. Next, let Tδ contain more than one cluster, let Cu be an arbitrary leaf of Tδ, and let Cv be a cluster of Tr with maximum distance to Cu such that Cu is the only cluster on the shortest path from Cu to Cv in Tr, i. e., Cv is not in Tδ. Due to the minimality of Tδ, dTr(Cu, Cv) = δ. Thus, the shortest path from Cu to Cv in Tr contains δ clusters (including Cv) which are not in Tδ. Therefore, Tδ ≤ Tr − δ · Λ(Tδ). □ Now that we have constructed and analysed Tδ, we show how to construct Sδ. First, we construct a set of shortest paths such that each cluster of Tδ is intersected by exactly one path. Second, we connect these paths with each other to from a connected set using an approach which is similar to Kruskal's algorithm for minimum spanning trees. either λ = Λ(Tδ) − 1 if the root of Tδ is a leaf, or with λ = Λ(Tδ) otherwise. We (cid:9) be the leaf clusters of Tδ (excluding the root) with (cid:9) of paths as follows. Initially, P is empty. Let L =(cid:8)C1, C2, . . . , Cλ construct a set P =(cid:8)P1, P2, . . . , Pλ 7 For each cluster Ci ∈ L, in turn, find the ancestor C′ i of Ci which is closest to the root of Tδ and does not intersect any path in P yet. If we assume that the indices of the clusters in L represent the order in which they are processed, then 1 is the root of Tδ. Then, select an arbitrary vertex v in Ci and find a shortest C′ i. Add Pi to P and continue with the next cluster in L. path Pi in G form v to C′ Figure 2 gives an example. Fig. 2. Example for the set P for a subtree of a layering partition. Paths are shown in red. Each path Pi, with 1 ≤ i ≤ 5, starts in the leaf Ci and ends in the cluster C′i. For i = 2 and i = 5, Pi contains only one vertex. Lemma 5. For each cluster C of Tδ, there is exactly one path Pi ∈ P intersect- ing C. Additionally, C and Pi share exactly one vertex, i. e., C ∩ Pi = 1. Proof. Observe that, by construction of a layering partition, each vertex in a cluster C is adjacent to some vertex in the parent cluster of C. Therefore, a shortest path P in G from C to any of its ancestors C′ only intersects clusters on the path from C to C′ in T and each cluster shares only one vertex with P. It remains to show that each cluster intersects exactly one path. Without loss of generality, assume that the indices of clusters in L and paths in P represent the order in which they are processed and created, i. e., assume that the algorithms first creates P1 which starts in C1, then P2 which starts in C2, and so on. Additionally, let Li = {C1, C2, . . . , Ci} and Pi = {P1, P2, . . . , Pi}. To proof that each cluster intersects exactly one path, we show by induction over i that, if a cluster Ci of Tδ satisfies the statement, then all ancestors of Ci satisfy it, too. Thus, if Cλ satisfies the statement, each cluster satisfies it. First, consider i = 1. Clearly, since P1 is the first path, P1 connects the leaf C1 with the root of Tδ and no cluster intersects more than one path at this point. Therefore, the statement is true for C1 and each of its ancestors. Next, assume that i > 1 and that the statement is true for each cluster in Li−1 and their respective ancestors. Then, the algorithm creates Pi which connects the leaf Ci with the cluster C′ i. Assume that there is a cluster C on the path from Ci to C′ i is an ancestor of C. Thus, by induction hypothesis, C′ i is also intersected by some i in T such that C intersects a path Pj with j < i. Clearly, C′ 8 C1C2=C′2C3C4C5=C′5C′1C′3C′4 S Because i > 1, C′ Now, create a partition V = (cid:8)V1, V2, . . . , Vλ (cid:9) of V such that, for each i, (cid:0)v, P(v)(cid:1). Such a partition as well as P(v) and d(v) can be path P = Pi. This contradicts with the way C′ i is selected by the algorithm. i in T only intersects Pi and Pi Therefore, each cluster on the path from Ci to C′ does not intersect any other clusters. i has a parent cluster C′′ in Tδ that is intersected by a path Pj with j < i. By induction hypothesis, each ancestor of C′′ is intersected by a path in Pi−1. Therefore, each ancestor of Ci is intersected by exactly one path in Pi. □ Next, we use the paths in P to create the set Sδ. As first step, let Sδ := Pi∈P Pi. Later, we add more vertices into Sδ to ensure it is a connected set. Pi ⊆ Vi, Vi is connected, and dG(v, Pi) = minP∈P dG(v, P) for each vertex v ∈ Vi. That is, Vi contains the vertices of G which are not more distant to Pi in G than to any other path in P. Additionally, for each vertex v ∈ V , set P(v) := Pi if and only if v ∈ Vi (i. e., P(v) is the path in P which is closest to v) and set d(v) := dG computed by performing a BFS on G starting at all paths Pi ∈ P simultaneously. Later, the BFS also allows us to easily determine the shortest path from v to P(v) for each vertex v. To manage the subsets of V, we use a Union-Find data structure such that, for two vertices u and v, Find(u) = Find(v) if and only if u and v are in the same set of V. A Union-Find data structure additionally allows us to easily join two set of V into one by performing a single Union operation. Note that, whenever we join two sets of V into one, P(v) and d(v) remain unchanged for each vertex v. Next, create an edge set E′ = { uv Find(u) = Find(v)}, i. e., the set of edges uv such that u and v are in different sets of V. Sort E′ in such a way that an edge uv precedes an edge xy only if d(u) + d(v) ≤ d(x) + d(y). The last step to create Sδ is similar to Kruskal's minimum spanning tree algorithm. Iterate over the edges in E′ in increasing order. If, for an edge uv, Find(u) = Find(v), i. e., if u and v are in different sets of V, then join these sets into one by performing Union(u, v), add the vertices on the shortest path from u to P(u) to Sδ, and add the vertices on the shortest path from v to P(v) to Sδ. Repeat this, until V contains only one set, i. e., until V = {V }. Algorithm 1 below summarises the steps to create a set Sδ for a given subtree of G, Algorithm 1 constructs, in O(cid:0)m α(n)(cid:1) time, a connected set Sδ with Sδ ≤ of a layering partition subtree Tδ. Lemma 6. For a given graph G and a given subtree Tδ of some layering partition Tδ + ∆ · Λ(Tδ) which intersects each cluster of Tδ. Proof (Correctness). First, we show that Sδ is connected at the end of the algorithm. To do so, we show by induction that, at any time, Sδ ∩ V ′ is a connected set for each set V ′ ∈ V. Clearly, when V is created, for each set Vi ∈ V, Sδ ∩ Vi = Pi. Now, assume that the algorithm joins the set Vu and Vv in V into one set based on the edge uv with u ∈ Vu and v ∈ Vv. Let Su = Sδ ∩ Vu and Sv = Sδ ∩ Vv. Note that P(u) ⊆ Su and P(v) ⊆ Sv. The algorithm now adds all 9 Algorithm 1: Computes a connected vertex set that intersects each cluster of a given layering partition. at most Tδ +(cid:0)Λ(Tδ) − 1(cid:1) · ∆ vertices. Input: A graph G = (V, E) and a subtree Tδ of some layering partition of G. Output: A connected set Sδ ⊆ V that intersects each cluster of Tδ and contains (cid:9) be the set of clusters excluding the root that are leaves 1 Let L =(cid:8)C1, C2, . . . , Cλ of Tδ. 2 Create an empty set P. 3 foreach cluster Ci ∈ L do 4 5 Select an arbitrary vertex v ∈ Ci. Find the highest ancestor C′i of Ci (i. e., the ancestor which is closest to the root of Tδ) that is not flagged. Find a shortest path Pi from v to an ancestor of v in C′i (i. e., a shortest path from Ci to C′i in G that contains exactly one vertex of each cluster of the corresponding path in Tδ). Add Pi to P. Flag each cluster intersected by Pi. 6 7 8 9 Create a set Sδ :=S a partition V =(cid:8)V1, V2, . . . , Vλ Pi∈P Pi. 10 Perform a BFS on G starting at all paths Pi ∈ P simultaneously. This results in (cid:9) of V with Pi ⊆ Vi for each Pi ∈ P. For each vertex v, set P (v) := Pi if and only if v ∈ Vi and let d(v) := dG(v, P (v)). Find(v) = i if and only if v ∈ Vi. 11 Create a Union-Find data structure and add all vertices of G such that 12 Determine the edge set E′ = { uv Find(u) = Find(v)}. 13 Sort E′ such that uv ≤ xy if and only if d(u) + d(v) ≤ d(x) + d(y). Let 14 for i := 1 to E′ do 15 16 17 18 19 ⟨e1, e2, . . . , eE′ Let uv = ei. if Find(u) = Find(v) then Add the shortest path from u to P (u) to Sδ. Add the shortest path from v to P (v) to Sδ. Union(u, v) ⟩ be the resulting sequence. 20 Output Sδ. vertices to Sδ which are on a path from P(u) to P(v). Therefore, Sδ ∩ (Vu ∪ Vv) is a connected set. Because V = {V } at the end of the algorithm, Sδ is connected eventually. Additionally, since Pi ⊆ Sδ for each Pi ∈ P, it follows that Sδ intersects each cluster of Tδ. Next, we show that the cardinality of Sδ is at most Tδ + ∆ · Λ(Tδ). When first created, the set Sδ contains all vertices of all paths in P. Therefore, by Pi∈P Pi = Tδ. Then, each time two sets of V are joined into one set based on an edge uv, Sδ is extended by the vertices on the shortest paths from u to P(u) and from v to P(v). Therefore, the size of Sδ increases by d(u) + d(v), i. e., Sδ := Sδ + d(u) + d(v). Let X denote the set of all edges used to join two sets of V into one at some point during the algorithm. Note that Lemma 5, Sδ =P 10 X = P − 1 ≤ Λ(Tδ). Therefore, at the end of the algorithm, (cid:0)d(u) + d(v)(cid:1) ≤ Tδ + Λ(Tδ) · max (cid:0)d(u) + d(v)(cid:1). uv∈X Sδ =X Pi +X Pi∈P uv∈X Claim. For each edge uv ∈ X, d(u) + d(v) ≤ ∆. Proof (Claim). To represent the relations between paths in P and vertex sets in V, we define a function f : P → V such that f(Pi) = Vj if and only if Pi ⊆ Vj. Directly after constructing V, f is a bijection with f(Pi) = Vi. At the end of the algorithm, after all sets of V are joined into one, f(Pi) = V for all Pi ∈ P. Recall the construction of P and assume that the indices of the paths in P represent the order in which they are created. Assume that i > 1. By construction, the path Pi ∈ P connects the leaf Ci with the cluster C′ i in Tδ. Because i > 1, i has a parent cluster in Tδ that is intersected by a path Pj ∈ P with j < i. C′ We define Pj as the parent of Pi. By Lemma 5, this parent Pj is unique for each Pi ∈ P with i > 1. Based on this relation between paths in P, we can construct a rooted tree T with the node set { xi Pi ∈ P } such that each node xi represents the path Pi and xj is the parent of xi if and only if Pj is the parent of Pi. Because each node of T represents a path in P, f defines a colouring for the nodes of T such that xi and xj have different colours if and only if f(Pi) = f(Pj). As long as V > 1, T contains two adjacent nodes with different colours. Let xi and xj be these nodes with j < i and let Pi and Pj be the corresponding paths in P. Note that xj is the parent of xi in T and, hence, Pj is the parent of Pi. Therefore, Pi ends in a cluster C′ i which has a parent cluster C that intersects Pj. By properties of layering partitions, it follows that dG(Pi, Pj) ≤ ∆ + 1. Recall that, by construction, d(v) = minP∈P dG(v, P) for each vertex v. Thus, for each edge uv on a shortest path from Pi to Pj in G (with u being closer to Pi than to Pj), d(u)+d(v) ≤ dG(u, Pi)+dG(v, Pj) ≤ ∆. Therefore, because f(Pi) = f(Pj), and d(u) + d(v) ≤ ∆. ♢ From the claim above, it follows that, as long as V contains multiple sets, there is an edge uv ∈ E′ such that d(u) + d(v) ≤ ∆ and Find(u) = Find(v). □ Therefore, maxuv∈X Proof (Complexity). First, the algorithm computes P (line 2 to line 8). If the parent of each vertex from the original BFS that was used to construct T is still known, P can be constructed in O(n) total time. After picking a vertex v in Ci, i is reached. Computing V simply follow the parent pointers until a vertex in C′ as well as P(v) and d(v) for each vertex v of G (line 10) can be done with single BFS and, thus, requires at most O(n + m) time. there is an edge uv on a shortest path from Pi to Pj such that f(cid:0)P(u)(cid:1) = f(cid:0)P(v)(cid:1) (cid:0)d(u) + d(v)(cid:1) ≤ ∆ and Sδ ≤ Tδ +(cid:0)Λ(Tδ) − 1(cid:1) · ∆. requires at most O(cid:0)α(n)(cid:1) amortised time. Therefore, initialising such a data most O(cid:0)m α(n)(cid:1) time. Note that, for each vertex v, d(v) ≤ V . Thus, sorting E′ Recall that, for a Union-Find data structure storing n elements, each operation structure to store all vertices (line 11) and computing E′ (line 12) requires at (line 13) can be done in linear time using counting sort. When iterating over E′ 11 operations is at most O(cid:0)m α(n)(cid:1). (line 14 to line 19), for each edge uv ∈ E′, the Find-operation is called twice and the Union-operation is called at most once. Thus, the total runtime for all these Let Pu = {u, . . . , x, y, . . . , p} be the shortest path in G from a vertex u to P(u). Assume that y has been added to Sδ in a previous iteration. Thus, {y, . . . , p} ⊆ Sδ and, when adding Pu to Sδ, the algorithm only needs to add {u, . . . , x}. Therefore, by using a simple binary flag to determine if a vertex is contained in Sδ, constructing Sδ (line 9, line 17, and line 18) requires at most O(n) time. □ Because, for each integer δ ≥ 0, Sδ ≤ Tδ + ∆ · Λ(Tδ) (Lemma 6) and In total, Algorithm 1 runs in O(cid:0)m α(n)(cid:1) time. Tδ ≤ Tr − δ · Λ(Tδ) (Lemma 4), we have the following. Corollary 2. For each δ ≥ ∆, Sδ ≤ Tr and, thus, Sδ ≤ Dr. To the best of our knowledge, there is no algorithm known that computes ∆ in less than O(nm) time. Additionally, under reasonable assumptions, computing the diameter or radius of a general graph requires Ω(cid:0)n2(cid:1) time [1]. We conjecture that the runtime for computing ∆ for a given graph has a similar lower bound. To avoid the runtime required for computing ∆, we use the following approach shown in Algorithm 2 below. First, compute a layering partition T and the subtree Tr. Second, for a certain value of δ, compute Tδ and perform Algorithm 1 on it. If the resulting set Sδ is larger than Tr (i. e., Sδ > Tr), increase δ; otherwise, if Sδ ≤ Tr, decrease δ. Repeat the second step with the new value of δ. One strategy to select values for δ is a classical binary search over the number of vertices of G. In this case, Algorithm 1 is called up-to O(log n) times. Empirical analysis [2], however, have shown that ∆ is usually very small. Therefore, we use a so-called one-sided binary search. Consider a sorted sequence ⟨x1, x2, . . . , xn⟩ in which we search for a value xp. We say the value xi is at position i. For a one-sided binary search, instead of starting in the middle at position n/2, we start at position 1. We then processes position 2, then position 4, then position 8, and so on until we reach position j = 2i and, next, position k = 2i+1 with xj < xp ≤ xk. Then, we perform a classical binary search on the sequence ⟨xj+1, . . . , xk⟩. Note that, because xj < xp ≤ xk, 2i < p ≤ 2i+1 and, hence, j < p ≤ k < 2p. Therefore, a one-sided binary search requires at most O(log p) iterations to find xp. Because of Corollary 2, using a one-sided binary search allows us to find a value δ ≤ ∆ for which Sδ ≤ Tr by calling Algorithm 1 at most O(log ∆) times. Algorithm 2 below implements this approach. Theorem 2. For a given graph G, Algorithm 2 computes a connected (r + 2∆)- dominating set D with D ≤ Dr in O(cid:0)m α(n) log ∆(cid:1) time. Proof. Clearly, the set D is connected because D = Sδ for some δ and, by Lemma 6, the set Sδ is connected. By Corollary 2, for each δ ≥ ∆, Sδ ≤ Tr. 12 Algorithm 2: Computes a connected (r + 2∆)-dominating set for a given graph G. Input: A graph G = (V, E) and a function r : V → N. Output: A connected (r + 2∆)-dominating set D for G with D ≤ Dr. 1 Create a layering partition T of G. 2 For each cluster C of T , set r(C) := minv∈C r(v). 3 Compute a minimum r-dominating subtree Tr for T (see [12]). 4 One-Sided Binary Search over δ, starting with δ = 0 5 Create a minimum δ-dominating subtree Tδ of Tr (i. e., Tδ is a minimum (r + δ)-dominating subtree for T ). Run Algorithm 1 on Tδ and let the set Sδ be the corresponding output. if Sδ ≤ Tr then 6 7 8 Decrease δ. else 9 10 11 Output Sδ with the smallest δ for which Sδ ≤ Tr. Increase δ. Thus, for each δ ≥ ∆, the binary search decreases δ and, eventually, finds some δ such that δ ≤ ∆ and Sδ ≤ Tr. Therefore, the algorithm finds a set D with D ≤ Dr. Note that, because D = Sδ for some δ ≤ ∆ and because Sδ intersects each cluster of Tδ (Lemma 6), it follows from Lemma 3 that, for each vertex v of G, dT (v, D) ≤ r(v) + ∆ and, by Lemma 1, dG(v, D) ≤ r(v) + 2∆. Thus, D is an (r + 2∆)-dominating set for G. Creating a layering partition for a given graph and computing a minimum connected r-dominating set of a tree can be done in linear time [12]. The one- sided binary search over δ has at most O(log ∆) iterations. Each iteration of the binary search requires at most linear time to compute Tδ, O(cid:0)m α(n)(cid:1) time decrease δ. Therefore, Algorithm 2 runs in O(cid:0)m α(n) log ∆(cid:1) total time. to compute Sδ (Lemma 6), and constant time to decide whether to increase or □ 4 Using a Tree-Decomposition Theorem 1 and Theorem 2 respectively show how to compute an (r + ∆)- dominating set in linear time and a connected (r + 2∆)-dominating set in O(cid:0)m α(n) log ∆(cid:1) time. It is known that the maximum diameter ∆ of clusters of any layering partition of a graph approximates the tree-breadth and tree-length of this graph. Indeed, for a graph G with tl(G) = λ, ∆ ≤ 3λ [10]. Corollary 3. Let D be a minimum r-dominating set for a given graph G with tl(G) = λ. An (r + 3λ)-dominating set D′ for G with D′ ≤ D can be computed in linear time. Corollary 4. Let D be a minimum connected r-dominating set for a given graph G with tl(G) = λ. A connected (r+6λ)-dominating set D′ for G with D′ ≤ D can be computed in O(cid:0)m α(n) log λ(cid:1) time. 13 dominating set as well as a connected (cid:0)r + min(3λ, 5ρ)(cid:1)-dominating set in In this section, we consider the case when we are given a tree-decomposition with breadth ρ and length λ. We present algorithms to compute an (r + ρ)- O(nm) time. For the remainder of this section, assume that we are given a graph G = (V, E) and a tree-decomposition T of G with breadth ρ and length λ. We assume that ρ and λ are known and that, for each bag B of T , we know a vertex c(B) with B ⊆ N ρ G[c(B)]. Let T be minimal, i. e., B ⊈ B′ for any two bags B and B′. Thus, the number of bags is not exceeding the number vertices of G. Additionally, let each vertex of G store a list of bags containing it and let each bag of T store a list of vertices it contains. One can see this as a bipartite graph where one subset of vertices are the vertices of G and the other subset are the bags of T . Therefore, the total input size is in O(n + m + M) where M ≤ n2 is the sum of the cardinality of all bags of T . 4.1 Preprocessing Before approaching the (Connected) r-Domination problem, we compute a sub- tree T ′ of T such that, for each vertex v of G, T ′ contains a bag B with dG(v, B) ≤ r(v). We call such a (not necessarily minimal) subtree an r-covering subtree of T . Let Tr be a minimum r-covering subtree of T . We do not know how to compute Tr directly. However, if we are given a bag B of T , we can compute the smallest r-covering subtree TB which contains B. Then, we can identify a bag B′ in TB for which we know it is a bag of Tr. Thus, we can compute Tr by computing the smallest r-covering subtree which contains B′. The idea for computing TB is to determine, for each vertex v of G, the bag Bv of T for which dG(v, Bv) ≤ r(v) and which is closet to B. Then, let TB be the smallest tree that contains all these bags Bv. Algorithm 3 below implements this approach. Additionally to computing the tree TB, we make it a rooted tree with B as the root, give each vertex v a pointer β(v) to a bag of TB, and give each bag B′ a counter σ(B′). The pointer β(v) identifies the bag Bv which is closest to B in TB and intersects the r-neighbourhood of v. The counter σ(B′) states the number of vertices v with β(v) = B′. Even though setting β and σ as well as rooting the tree are not necessary for computing TB, we use it when computing an (r + ρ)-dominating set later. Lemma 7. For a given tree-decomposition T and a given bag B of T , Al- gorithm 3 computes an r-covering subtree TB in O(nm) time such that TB contains B and has a minimal number of bags. Proof (Correctness). Note that, by construction of the set B (line 5 to line 7), B contains a bag Bu for each vertex u of G such that dG(u, Bu) ≤ r(u). Thus, each subtree of T which contains all bags of B is an r-covering subtree. To show the correctness of the algorithm, it remains to show that the smallest r-covering 14 Algorithm 3: Computes the smallest r-covering subtree TB of a given tree-decomposition T that contains a given bag B of T . 1 Make T a rooted tree with the bag B as the root. 2 Create a set B of bags and initialise it with B := {B}. 3 For each bag B′ of T , set σ(B′) := 0 and determine dT (B′, B). 4 For each vertex u, determine the bag B(u) which contains u and has minimal 5 foreach u ∈ V do 6 (cid:0)B(v), B(cid:1) is minimal distance to B. Determine a vertex v such that dG(u, v) ≤ r(u) and dT and let Bu := B(v). Add Bu to B, set β(u) := Bu, and increase σ(Bu) by 1. 7 8 Output the smallest subtree TB of T that contains all bags in B. subtree of T which contains B has to contain each bag from the set B. Then, the subtree TB constructed in line 8 is the desired subtree. By properties of tree-decompositions, the set of bags which intersect the r-neighbourhood of some vertex u induces a subtree Tu of T . That is, Tu contains exactly the bags B′ with dG(u, B′) ≤ r(u). Note that T is a rooted tree with B as the root. Clearly, the bag Bu ∈ B (determined in line 6) is the root of Tu since it is the bag closest to B. Hence, each bag B′ with dG(u, B′) ≤ r(u) is a descendant of Bu. Therefore, if a subtree of T contains B and does not contain Bu, then it also cannot contain any descendant of Bu and, thus, contains no bag intersecting □ the r-neighbourhood of u. Proof (Complexity). Recall that T has at most n bags and that the sum of the cardinality of all bags of T is M ≤ n2. Thus, line 3 and line 4 require at most O(M) time. Using a BFS, it takes at most O(m) time, for a given vertex u, to determine a vertex v such that dG(u, v) ≤ r(u) and dT(cid:0)B(v), B(cid:1) is minimal (line 6). Therefore, the loop starting in line 5 and, thus, Algorithm 3 run in at most O(nm) total time. □ Lemma 8 and Lemma 9 below show that each leaf B′ = B of TB is a bag of a minimum r-covering subtree Tr of T . Note that both lemmas only apply if TB has at least two bags. If TB contains only one bag, it is clearly a minimum r-covering subtree. Lemma 8. For each leaf B′ = B of TB, there is a vertex v in G such that B′ is the only bag of TB with dG(v, B′) ≤ r(v). Proof. Assume that Lemma 8 is false. Then, there is a leaf B′ such that, for each vertex v with dG(v, B′) ≤ r(v), TB contains a bag B′′ = B′ with dG(v, B′′) ≤ r(v). Thus, for each vertex v, the r-neighbourhood of v is intersected by a bag of the tree-decomposition TB − B′. This contradicts with the minimality of TB. □ Lemma 9. For each leaf B′ = B of TB, there is a minimum r-covering sub- tree Tr of T which contains B′. 15 Proof. Assume that Tr is a minimum r-covering subtree which does not contain B′. Because of Lemma 8, there is a vertex v of G such that B′ is the only bag of TB which intersects the r-neighbourhood of v. Therefore, Tr contains only bags which are descendants of B′. Partition the vertices of G into the sets V ↑ and V ↓ such that V ↓ contains the vertices of G which are contained in B′ or in a descendant of B′. Because Tr is an r-covering subtree and because Tr only contains descendants of B′, it follows from properties of tree-decompositions that, for each vertex v ∈ V ↑, there is a path of length at most r(v) from v to a bag of Tr passing through B′ and, thus, dG(v, B′) ≤ r(v). Similarly, since TB is an r-covering subtree, it follows that, for each vertex v ∈ V ↓, dG(v, B′) ≤ r(v). Therefore, for each vertex v of G, dG(v, B′) ≤ r(v) and, thus, B′ induces an r-covering subtree Tr of T with Tr = 1. □ Algorithm 4 below uses Lemma 9 to compute a minimum r-covering subtree Tr of T . Algorithm 4: Computes a minimum r-covering subtree Tr of a given tree-decomposition T . 1 Pick an arbitrary bag B of T . 2 Determine the subtree TB of T using Algorithm 3. 3 if TB = 1 then 4 5 else 6 7 8 Select an arbitrary leaf B′ = B of TB. Determine the subtree TB′ of T using Algorithm 3. Output Tr := TB′. Output Tr := TB. Lemma 10. Algorithm 4 computes a minimum r-covering subtree Tr of T in O(nm) time. Proof. Algorithm 4 first picks an arbitrary bag B and then uses Algorithm 3 to compute the smallest r-covering subtree TB of T which contains B. By Lemma 9, for each leaf B′ of TB, there is a minimum r-covering subtree Tr which contains B′. Thus, performing Algorithm 3 again with B′ as input creates such a subtree Tr. Clearly, with exception of calling Algorithm 3, all steps of Algorithm 4 require only constant time. Because Algorithm 3 requires at most O(nm) time (see Lemma 7) and is called at most two times, Algorithm 4 runs in at most O(nm) □ total time. Algorithm 4 computes Tr by, first, computing TB for some bag B and, second, computing TB′ = Tr for some leaf B′ of TB. Note that, because both trees are computed using Algorithm 3, Lemma 8 applies to TB and TB′. Therefore, we can slightly generalise Lemma 8 as follows. 16 Corollary 5. For each leaf B of Tr, there is a vertex v in G such that B is the only bag of Tr with dG(v, B) ≤ r(v). 4.2 r-Domination In this subsection, we use the minimum r-covering subtree Tr to determine an (r + ρ)-dominating set S in O(nm) time using the following approach. First, compute Tr. Second, pick a leaf B of Tr. If there is a vertex v such that v is not dominated and B is the only bag intersecting the r-neighbourhood of v, then add the center of B into S, flag all vertices u with dG(u, B) ≤ r(u) as dominated, and remove B from Tr. Repeat the second step until Tr contains no more bags and each vertex is flagged as dominated. Algorithm 5 below implements this approach. Note that, instead of removing bags from Tr, we use a reversed BFS-order of the bags to ensure the algorithm processes bags in the correct order. Algorithm 5: Computes an (r + ρ)-dominating set S for a given graph G with a given tree-decomposition T with breadth ρ. 1 Compute a minimum r-covering subtree Tr of T using Algorithm 4. 2 Give each vertex v a binary flag indicating if v is dominated. Initially, no vertex is dominated. 3 Create an empty vertex set S0. 4 Let ⟨B1, B2, . . . , Bk⟩ be the reverse of a BFS-order of Tr starting at its root. 5 for i = 1 to k do 6 7 if σ(Bi) > 0 then Determine all vertices u such that u has not been flagged as dominated and that dG(u, Bi) ≤ r(u). Add all these vertices into a new set Xi. Let Si = Si−1 ∪(cid:8)c(Bi)(cid:9). For each vertex u ∈ Xi, flag u as dominated, and decrease σ(cid:0)β(u)(cid:1) by 1. 8 9 10 11 else Let Si = Si−1. 12 Output S := Sk. Theorem 3. Let D be a minimum r-dominating set for a given graph G. Given a tree-decomposition with breadth ρ for G, Algorithm 5 computes an (r + ρ)- dominating set S with S ≤ D in O(nm) time. Proof (Correctness). First, we show that S is an (r + ρ)-dominating set for G. Note that a vertex v is flagged as dominated only if Si contains a vertex c(Bj) with dG(v, Bj) ≤ r(v) (see line 7 to line 9). Thus, v is flagged as dominated only if dG(v, Si) ≤ dG Algorithm 3), for each vertex v, Tr contains a bag B with β(v) = B, σ(B) states the number of vertices v with β(v) = B, and σ(B) is decreased by 1 only if such (cid:0)v, c(Bj)(cid:1) ≤ r(v) + ρ. Additionally, by construction of Tr (see 17 Let V S i i ⊆ V S algorithm sets Si = Si−1 ∪(cid:8)c(Bi)(cid:9) and flags all such u as dominated (see line 7 a vertex v is flagged as dominated (see line 9). Therefore, if G contains a vertex v with dG(v, Si) > r(v) + ρ, then v is not flagged as dominated and Tr contains a bag Bi with β(v) = Bi and σ(Bi) > 0. Thus, when Bi is processed by the algorithm, c(Bi) will be added to Si and, hence, dG(v, Si) ≤ r(v) + ρ. i = { u dG(u, Bj) ≤ r(u), c(Bj) ∈ Si } be the set of vertices which are flagged as dominated after the algorithm processed Bi, i. e., each vertex is (r + ρ)-dominated by Si. Similarly, for some set Di ⊆ D, let V D in V S i = { u dG(u, Di) ≤ r(u)} be the set of vertices dominated by Di. To show that S ≤ D, we show by induction over i that, for each i, (i) there is a set Di ⊆ D i , (ii) Si = Di, and (iii) if, for some vertex v, β(v) = Bj such that V D with j ≤ i, then v ∈ V S i . For the base case, let S0 = D0 = ∅. Then, V S0 = V D0 = ∅ and all three statements are satisfied. For the inductive step, first, consider the case when σ(Bi) = 0. Because σ(Bi) = 0, each vertex v with β(v) = Bi is flagged as dominated, i. e., v ∈ V S i−1. Thus, by setting Si = Si−1 (line 11) and Di = Di−1, all three statements are satisfied for i. Next, consider the case when σ(Bi) > 0. Therefore, G contains a vertex u with β(u) = Bi and u /∈ V S i−1. Then, the to line 9). Thus, u ∈ V S i and statement (iii) is satisfied. Let du be a vertex in D with minimal distance to u. Thus, dG(du, u) ≤ r(u), i. e., du is in the r-neighbourhood of u. Note that, because u /∈ V S i−1, du /∈ Di−1. Therefore, by setting Di = Di−1 ∪ {du}, Si = Si−1 + 1 = Di−1 + 1 = Di and statement (ii) is satisfied. Recall that β(u) points to the bag closest to the root of Tr which intersects the r-neighbourhood of u. Thus, because β(u) = Bi, each bag B = Bi with dG(u, B) ≤ r(u) is a descendant of Bi. Therefore, du is in Bi or in a descendant of Bi. Let v be an arbitrary vertex of G such that v /∈ V S i−1 and dG(v, du) ≤ r(v), i. e., v is dominated by du but not by Si−1. Due to statement (iii) of the induction hypothesis, β(v) = Bj with j ≥ i, i. e., Bj ↓ ↑ cannot be a descendant of Bi. Partition the vertices of G into the sets V i and V i ↓ i contains the vertices which are contained in Bi or in a descendant such that V ↓ of Bi. If v ∈ V i , then there is a path of length at most r(v) from v to Bj passing ↓ through Bi. If v ∈ V i , there is a path of length at most r(v) from v to du passing through Bi. Therefore, dG(v, Bi) ≤ r(v). That is, each vertex r-dominated by du, is (r + ρ)-dominated by some c(Bj) ∈ Si. i ∩ V D □ and, thus, statement (i) is satisfied. Therefore, because Si = Si−1 ∪(cid:8)c(Bi)(cid:9) and Di = Di−1 ∪ {du}, v ∈ V S ↑ i , then, because du ∈ V i−1 and V D i−1 ⊆ V S i dG(u, Bi) ≤ r(u), flagging u as dominated, and decreasing σ(cid:0)β(u)(cid:1) (line 7 to Proof (Complexity). Computing Tr (line 1) takes at most O(nm) time (see Lemma 10). Because Tr has at most n bags, computing a BFS-order of Tr (line 4) takes at most O(n) time. For some bag Bi, determining all vertices u with line 9) can be done in O(m) time by performing a BFS starting at all vertices of Bi simultaneously. Therefore, because Tr has at most n bags, Algorithm 5 requires at most O(nm) total time. □ 18 4.3 Connected r-Domination In this subsection, we show how to compute a connected (r + 5ρ)-dominating set and a connected (r+3λ)-dominating set for G. For both results, we use almost the same algorithm. To identify and emphasise the differences, we use the label (♡) for parts which are only relevant to determine a connected (r+5ρ)-dominating set and use the label (♢) for parts which are only relevant to determine a connected (r + 3λ)-dominating set. For the remainder of this subsection, let Dr be a minimum connected r- dominating set of G. For (♡) ϕ = 3ρ or (♢) ϕ = 2λ, let Tϕ be a minimum (r + ϕ)-covering subtree of T as computed by Algorithm 4. The idea of our algorithm is to, first, compute Tϕ and, second, compute a small enough connected set Cϕ such that Cϕ intersects each bag of Tϕ. Lemma 11 below shows that such a set Cϕ is an(cid:0)r + (ϕ + λ)(cid:1)-dominating set. leaf of Tϕ. Then, Cϕ is an (cid:0)r + (ϕ + λ)(cid:1)-dominating set. r(v) + ϕ + λ, i. e., Cϕ is an(cid:0)r + (ϕ + λ)(cid:1)-dominating set. Lemma 11. Let Cϕ be a connected set that contains at least one vertex of each Proof. Clearly, since Cϕ is connected and contains a vertex of each leaf of Tϕ, Cϕ contains a vertex of every bag of Tϕ. By construction of Tϕ, for each vertex v of G, Tϕ contains a bag B such that dG(v, B) ≤ r(v) + ϕ. Therefore, dG(v, Cϕ) ≤ □ To compute a connected set Cϕ which intersects all leaves of Tϕ, we first con- sider the case when Tρ contains only one bag B. In this case, we can construct Cϕ by simply picking an arbitrary vertex v ∈ B and setting Cϕ = {v}. Similarly, if Tρ contains exactly two bags B and B′, pick a vertex v ∈ B ∩ B′ and set Cϕ = {v}. with Cϕ ≤ Dr. assume that Tϕ is a rooted tree such that its root R is a leaf. In both cases, due to Lemma 11, Cϕ is clearly an(cid:0)r + (ϕ + λ)(cid:1)-dominating set Now, consider the case when Tϕ contains at least three bags. Additionally, Notation. Based on its degree in Tϕ, we refer to each bag B of Tϕ either as leaf, as path bag if B has degree 2, or as branching bag if B has a degree larger than 2. Additionally, we call a maximal connected set of path bags a path segment of Tϕ. Let L denote the set of leaves, P denote the set of path segments, and B denote the set of branching bags of Tϕ. Clearly, for any given tree T, the sets L, P, and B are pairwise disjoint and can be computed in linear time. Let B and B′ be two adjacent bags of Tϕ such that B is the parent of B′. We call S = B ∩ B′ the up-separator of B′, denoted as S↑(B′), and a down-separator of B, denoted as S↓(B), i. e., S = S↑(B′) = S↓(B). Note that a branching bag has multiple down-separators and that (with exception of R) each bag has exactly one up-separator. For each branching bag B, let S↓(B) be the set of down-separators of B. Accordingly, for a path segment P ∈ P, S↑(P) is the up-separator of the bag in P closest to the root and S↓(P) is the down separator of the bag in P furthest from the root. Let ν be a function that assigns a vertex of G to a given separator. Initially, ν(S) is undefined for each separator S. 19 Algorithm. Now, we show how to compute Cϕ. We, first, split Tϕ into the sets L, P, and B. Second, for each P ∈ P, we create a small connected set CP , and, third, for each B ∈ B, we create a small connected set CB. If this is done properly, the union Cϕ of all these sets forms a connect set which intersects each bag of Tϕ. Note that, due to properties of tree-decompositions, it can be the case that there are two bags B and B′ which have a common vertex v, even if B and B′ are non-adjacent in Tϕ. In such a case, either v ∈ S↓(B) ∩ S↑(B′) if B is an ancestor of B′, or v ∈ S↑(B) ∩ S↑(B′) if neither is ancestor of the other. To avoid problems caused by this phenomena and to avoid counting vertices multiple times, we consider any vertex in an up-separator as part of the bag above. That is, whenever we process some segment or bag X ∈ L ∪ P ∪ B, even though we add a vertex v ∈ S↑(X) to Cϕ, v is not contained in CX. Processing Path Segments. First, after splitting Tϕ, we create a set CP for each path segment P ∈ P as follows. We determine S↑(P) and S↓(P) and then find a shortest path QP from S↑(P) to S↓(P). Note that QP contains exactly one vertex from each separator. Let x ∈ S↑(P) and y ∈ S↓(P) be these vertices. into Cϕ and define CP as QP \ S↑(P). Let CP be the union of all sets CP , i. e., Then, we set ν(cid:0)S↑(P)(cid:1) = x and ν(cid:0)S↓(P)(cid:1) = y. Last, we add the vertices of QP CP =S Lemma 12. CP ≤ Dr − ϕ · Λ(cid:0)Tϕ P∈P CP . (cid:1). (cid:1). Proof. Recall that Tϕ is a minimum (r + ϕ)-covering subtree of T . Thus, by Corollary 5, for each leaf B ∈ L of Tϕ, there is a vertex v in G such that B is the only bag of Tϕ with dG(v, B) ≤ r(v)+ ϕ. Because Dr is a connected r-dominating set, Dr intersects the r-neighbourhood of each of these vertices v. Thus, by properties of tree-decompositions, Dr intersects each bag of Tϕ. Additionally, for each such v, Dr contains a path Dv with Dv ≥ ϕ such that Dv intersects the r-neighbourhood of v, intersects the corresponding leaf B of Tϕ, and does not intersect S↑(B) (S↓(B) if B = R). Let DL be the union of all such sets Dv. Therefore, DL ≥ ϕ · Λ(cid:0)Tϕ Because Dr intersects each bag of Tϕ, Dr also intersects the up- and down- separators of each path segment. For a path segment P ∈ P, let x and y be two vertices of Dr such that x ∈ S↑(P), y ∈ S↓(P), and for which the distance in G[Dr] is minimal. Let DP be the set of vertices on the shortest path in G[Dr] from x to y without x, i. e., x /∈ DP . Note that, by construction, for each P ∈ P, DP contains exactly one vertex in S↓(P) and no vertex in S↑(P). Thus, for all P, P ′ ∈ P, P∈P DP . By P∈P DP and DL ∩ DP = ∅. Therefore, Dr ≥ DP+DL DP ∩ DP ′ = ∅. Let DP be the union of all such sets DP , i. e., DP =S construction, DP =P X DP ≤ Dr − DL ≤ Dr − ϕ · Λ(cid:0)Tϕ and, hence, P∈P (cid:1). Recall that, for each P ∈ P, the sets CP and DP are constructed based on a path from S↑(P) to S↓(P). Since CP is based on a shortest path in G, it follows 20 that CP = dG (cid:0)S↑(P), S↓(P)(cid:1) ≤ DP. Therefore, CP ≤X CP ≤X DP ≤ Dr − ϕ · Λ(cid:0)Tϕ P∈P P∈P (cid:1). □ tor S ∈ S↓(B)∪(cid:8)S↑(B)(cid:9). If ν(S) is defined, we set s = ν(S). Otherwise, we pick t = ν(cid:0)S↑(B)(cid:1). We then connect these vertices as follows. (See Figure 3 for an Processing Branching Bags. After processing path segments, we process the branching bags of Tϕ. Similar to path segments, we have to ensure that all sepa- rators are connected. Branching bags, however, have multiple down-separators. To connect all separators of some bag B, we pick a vertex s in each separa- an arbitrary s ∈ S and set ν(S) = s. Let S↓(B) = {S1, S2, . . .}, si = ν(Si), and illustration.) (♡) Connect each vertex si via a shortest path Qi (of length at most ρ) with the center c(B) of B. Additionally, connect c(B) via a shortest path Qt (of length at most ρ) with t. Add all vertices from the paths Qi and from the path Qt into Cϕ and let CB be the union of these paths without t. (♢) Connect each vertex si via a shortest path Qi (of length at most λ) with t. Add all vertices from the paths Qi into Cϕ and let CB be the union of these paths without t. Let CB be the union of all created sets CB, i. e., CB =S B∈B CB. (♡) (♢) Fig. 3. Construction of the set CB for a branching bag B. Before analysing the cardinality of CB in Lemma 14 below, we need an axillary lemma. Lemma 13. For a tree T which is rooted in one of its leaves, let b denote the number of branching nodes, c denote the total number of children of branching nodes, and l denote the number of leaves. Then, c + b ≤ 3l − 1 and c ≤ 2l − 1. Proof. Assume that we construct T by starting with only the root and then step by step adding leaves to it. Let Ti be the subtree of T with i nodes during 21 ρρρS↑S↓iS↓jλλS↑S↓iS↓j this construction. We define bi, ci, and li accordingly. Now, assume by induction over i that Lemma 13 is true for Ti. Let v be the leaf we add to construct Ti+1 and let u be its neighbour. First, consider the case when u is a leaf of Ti. Then, u becomes a path node of Ti+1. Therefore, bi+1 = bi, ci+1 = ci, and li+1 = li. Next, assume that u is path node of Ti. Then, u is a branch node of Ti+1. Thus, bi+1 = bi + 1, ci+1 = ci + 2, and li+1 = li + 1. Therefore, ci+1 + bi+1 = ci + bi + 3 ≤ 3(li + 1) − 1 = 3li+1 − 1 and ci+1 = ci + 2 ≤ 2(li + 1) − 1 = 2li+1 − 1. It remains to check the case when u is a branch node of Ti. Then, bi+1 = bi, ci+1 = ci + 1, and li+1 = li + 1. Thus, ci+1 + bi+1 = ci + bi +1 ≤ 3li −1+1 ≤ 3li+1 −1 and ci+1 = ci +1 ≤ 2li −1+1 ≤ 2li+1 − 1. Therefore, in all three cases, Lemma 13 is true for Ti+1. □ Lemma 14. CB ≤ ϕ · Λ(cid:0)Tϕ path of length at most λ for each Si ∈ S↓(B). Thus, (♡) CB ≤ ρ·(cid:12)(cid:12)S↓(B)(cid:12)(cid:12)+ ρ or (♢) CB ≤ λ ·(cid:12)(cid:12)S↓(B)(cid:12)(cid:12). Recall that S↓(B) contains exactly one down-separator Proof. For some branching bag B ∈ B, the set CB contains (♡) a path of length at most ρ for each Si ∈ S↓(B) and a path of length at most ρ to S↑(B), or (♢) a for each child of B in Tϕ and that CB is the union of all sets CB. Therefore, Lemma 13 implies the following. CB (cid:1). □ Properties of Cϕ. We now analyse the created set Cϕ and show that Cϕ is a connected (r + ϕ)-dominating set for G. Lemma 15. Cϕ contains a vertex in each bag of Tϕ. Proof. Clearly, by construction, Cϕ contains a vertex in each path bag and in each branching bag. Now, consider a leaf L of Tϕ. L is adjacent to a path segment or branching bag X ∈ P ∩ B. Whenever such an X is processed, the algorithm ensures that all separators of X contain a vertex of Cϕ. Since one of these separators is also the separator of L, it follows that each leaf L and, thus, each □ bag of Tϕ contains a vertex of Cϕ. Lemma 16. Cϕ ≤ Dr. Proof. Note that, for each vertex u we add to Cϕ, we also add u to a unique set CX for some X ∈ P∩B. The exception is the vertex v in S↓(R) which is added to no such set CX. It follows from our construction of the sets CX that there 22 B∈B CB ≤ X (♡) ≤ ρ ·X (♢) ≤ λ ·X ≤ ϕ · Λ(cid:0)Tϕ B∈B B∈B (cid:12)(cid:12)S↓(B)(cid:12)(cid:12) + ρ · B ≤ 3ρ · Λ(cid:0)Tϕ (cid:12)(cid:12)S↓(B)(cid:12)(cid:12) ≤ 2λ · Λ(cid:0)Tϕ (cid:1) − 1. (cid:1) − 1 (cid:1) − 1 is only one such vertex v and that v = ν(cid:0)S↓(R)(cid:1). Thus, Cϕ = CP + CB + 1. Now, it follows from Lemma 12 and Lemma 14 that □ Cϕ ≤ Dr − ϕ · Λ(cid:0)Tϕ (cid:1) + ϕ · Λ(cid:0)Tϕ (cid:1) − 1 + 1 ≤ Dr. Lemma 17. Cϕ is connected. Proof. First, note that, by maximality, two path segments of Tϕ cannot share a common separator. Also, note that, when processing a branching bag B, the algorithm first checks if, for any separator S of B, ν(S) is already defined; if this is the case, it will not be overwritten. Therefore, for each separator S in Tϕ, ν(S) is defined and never overwritten. Next, consider a path segment or branching bag X ∈ P ∪ B and let S and S′ be two separators of X. Whenever such an X is processed, our approach ensures that Cϕ connects ν(S) with ν(S′). Additionally, observe that, when processing X, each vertex added to Cϕ is connected via Cϕ with ν(S) for some separator S of X. Thus, for any two separators S and S′ in Tϕ, Cϕ connects ν(S) with ν(S′) and, additionally, each vertex v ∈ Cϕ is connected via Cϕ with ν(S) for some □ separator S in Tϕ. Therefore, Cϕ is connected. follows: From Lemma 15, Lemma 16, Lemma 17, and from applying Lemma 11 it Corollary 6. Cϕ is a connected (cid:0)r + (ϕ + λ)(cid:1)-dominating set for G with Cϕ ≤ Dr. Implementation. Algorithm 6 below implements our approach described above. This also includes the case when Tϕ contains at most two bags. Theorem 4. Algorithm 6 computes a connected (cid:0)r +(ϕ+ λ)(cid:1)-dominating set Cϕ with Cϕ ≤ Dr in O(nm) time. Proof. Since Algorithm 6 constructs a set Cϕ as described above, its correctness follows from Corollary 6. It remains to show that the algorithm runs in O(nm) time. Computing Tϕ (line 2) can be done in O(nm) time (see Lemma 10). Picking a vertex u in the case when Tϕ contains at most two bags (line 3 to line 6) can be easily done in O(n) time. Recall that Tϕ has at most n bags. Thus, splitting Tϕ in the sets L, P, and B can be done in O(n) time. Determining all up-separators in Tϕ can be done in O(M) time as follows. Process all bags of Tϕ in an order such that a bag is processed before its descendants, e. g., use a preorder or BFS-order. Whenever a bag B is processed, determine a set S ⊆ B of flagged vertices, store S as up-separator of B, and, afterwards, flag all vertices in B. Clearly, S is empty for the root. Because a bag B is processed before its descendants, all flagged vertices in B also belong to its parent. Thus, by properties of tree-decompositions, these vertices are exactly the vertices in S↑(B). Clearly, processing a single bag B takes at most O(B) 23 Algorithm 6: Computes (♡) a connected (r + 5ρ)-dominating set or (♢) a connected (r + 3λ)-dominating set for a given graph G with a given tree- decomposition T with breadth ρ and length λ. 1 (♡) Set ϕ := 3ρ. (♢) Set ϕ := 2λ. 2 Compute a minimum (r + ϕ)-covering subtree Tϕ of T using Algorithm 4. 3 if Tϕ contains only one bag B then 4 5 if Tϕ contains exactly two bags B and B′ then 6 7 Pick a leaf of Tϕ and make it the root of Tϕ. 8 Split Tϕ into a set L of leaves, a set P of path segments, and a set B of branching Pick an arbitrary vertex u ∈ B ∩ B′, output Cϕ := {u}, and stop. Pick an arbitrary vertex u ∈ B, output Cϕ := {u}, and stop. bags. 9 Create an empty set Cϕ. 10 foreach P ∈ P do 11 12 13 foreach B ∈ B do 14 ↑(P ) to S ↑(P ) be the start vertex and y ∈ S Find a shortest path QP from S Let x ∈ S Set ν(cid:0)S ↑(P )(cid:1) := x and ν(cid:0)S ↓(P )(cid:1) := y. ↑(B)(cid:1) is defined, let u := ν(cid:0)S If ν(cid:0)S ↑(B)(cid:1) := u. ↑(B) and set ν(cid:0)S ↓(P ) and add its vertices into Cϕ. ↓(P ) be the end vertex of QP . ↑(B)(cid:1). Otherwise, let u be an arbitrary vertex in S (♡) Let v := c(B) be the center of B. (♢) Let v := u. Find a shortest path from u to v and add its vertices into Cϕ. foreach Si ∈ S↓(B) do 15 16 17 18 19 If ν(Si) is defined, let wi := ν(Si). Otherwise, let wi be an arbitrary vertex in Si and set ν(Si) := wi. Find a shortest path from wi to v and add the vertices of this path into Cϕ. 20 Output Cϕ. time. Thus, processing all bags takes at most O(M) time. Note that it is not necessary to determine the down-separators of a (branching) bag. They can easily be accessed via the children of a bag. Processing a single path segment (line 11 and line 12) can be easily done in O(m) time. Processing a branching bag B (line 13 to line 19) can be implemented to run in O(m) time by, first, determining ν(S) for each separator S of B and, second, running a BFS starting at v (defined in line 15) to connect v with each vertex ν(S). Because Tϕ has at most n bags, it takes at most O(nm) time to process all path segments and branching bags of Tϕ. Therefore, Algorithm 6 runs in O(nm) total time. □ 24 5 Implications for the p-Center Problem The (Connected) p-Center problem asks, given a graph G and some integer p, for a (connected) vertex set S with S ≤ p such that S has minimum eccentricity, i. e., there is no (connected) set S′ with eccG(S′) < eccG(S). It is known (see, e. g., [3]) that the p-Center problem and r-Domination problem are closely related. Indeed, one can solve each of these problems by solving the other problem a logarithmic number of times. Lemma 18 below generalises this observation. Informally, it states that we are able to find a +ϕ-approximation for the p-Center problem if we can find a good (r + ϕ)-dominating set. Lemma 18. For a given graph G, let Dr be an optimal (connected) r-dominating set and Cp be an optimal (connected) p-center. If, for some non-negative inte- ger ϕ, there is an algorithm to compute a (connected) (r + ϕ)-dominating set D with D ≤ Dr in O(cid:0)T(G)(cid:1) time, then there is an algorithm to compute a (connected) p-center C with eccG(C) ≤ eccG(Cp) + ϕ in O(cid:0)T(G) log n(cid:1) time. set D = A(G, r) for G with D ≤ Dr in O(cid:0)T(G)(cid:1) time. Then we can compute a Proof. Let A be an algorithm which computes a (connected) (r + ϕ) dominating (connected) p-center for G as follows. Make a binary search over the integers i ∈ [0, n]. In each iteration, set ri(u) = i for each vertex u of G and compute the set Di = A(G, ri). Then, increase i if Di > p and decrease i otherwise. Note that, by construction, eccG(Di) ≤ i + ϕ. Let D be the resulting set, i. e., out of all computed sets Di, D is the set with minimal i for which Di ≤ p. It is easy to see that finding D requires at most O(cid:0)T(G) log n(cid:1) time. Clearly, Cp is a (connected) r-dominating set for G when setting r(u) = eccG(Cp) for each vertex u of G. Thus, for each i ≥ eccG(Cp), Di ≤ Cp ≤ p and, hence, the binary search decreases i for next iteration. Therefore, there is an i ≤ eccG(Cp) such that D = Di. Hence, D ≤ Cp and eccG(D) ≤ □ eccG(Cp) + ϕ. From Lemma 18, the results in Table 1 and Table 2 follow immediately. Table 1. Implications of our results for the p-Center problem. Approx. Approach +∆ O(m log n) Layering Partition Tree-Decomposition +ρ O(nm log n) Time In what follows, we show that, when using a layering partition, we can achieve the results from Table 1 and Table 2 without the logarithmic overhead. Theorem 5. For a given graph G, a +∆-approximation for the p-Center problem can be computed in linear time. 25 Table 2. Implications of our results for the Connected p-Center problem. Approach Layering Partition Tree-Decomposition + min(5ρ, 3λ) Approx. +2∆ Time O(m α(n) log ∆ log n) O(nm log n) Proof. First, create a layering partition T of G. Second, find an optimal p-center S for T . Third, create a set S by picking an arbitrary vertex of G from each cluster in S. All three steps can be performed in linear time, including the computation of S (see [15]). Let C be an optimal p-center for G. Note that, by Lemma 1, C also induces a p-center for T . Therefore, because S induces an optimal p-center for T , Lemma 1 implies that, for each vertex u of G, dG(u, C) ≤ dG(u, S) ≤ dT (u,S) + ∆ ≤ dT (u, C) + ∆ ≤ dG(u, C) + ∆. Center problem can be computed in O(cid:0)m α(n) log min(∆, p)(cid:1) time. Theorem 6. For a given graph G, a +2∆-approximation for the connected p- □ Proof. Recall Algorithm 2 for computing a connected (r+2∆)-dominating set. We create Algorithm 2∗ by slightly modifying Algorithm 2 as follows. In line 3, instead of computing an r-dominating subtree Tr of T , compute an optimal connected p-center Tp of T (see [20]). Accordingly, in line 5, compute a δ-dominating subtree of Tp, check in line 7 if Sδ ≤ Tp (i. e., if Sδ ≤ p), and output in line 11 the set Sδ with the smallest δ for which Sδ ≤ p. Let S be the set computed by Algorithm 2∗. As shown in the proof of Theorem 2, it follows from Lemma 6 and Corollary 2 that S is connected, S ≤ p, and S = Sδ for some δ ≤ ∆. Now, let C be an optimal connected p-center for G. Clearly, by definition of C and by Lemma 1, eccG(C) ≤ eccG(Sδ) ≤ eccT (Tδ) + ∆. Because Tδ is a δ-dominating subtree of Tp, eccT (Tδ) ≤ eccT (Tp) + δ. Let TC be the subtree of T induced by C, i. e., the subtree of T induced by the clusters which contain vertices of C. Then, because Tp is an optimal connected p-center for T and, clearly, TC ≤ p, eccT (Tp) ≤ eccT (TC). Therefore, since δ ≤ ∆, eccG(C) ≤ eccG(Sδ) ≤ eccT (TC) + 2∆ and, by Lemma 1, eccG(C) ≤ eccG(Sδ) ≤ eccG(C) + 2∆. As shown in the proof of Theorem 2, the one-sided binary search of Al- gorithm 2∗ has at most O(log ∆) iterations. Because Tp ≤ p, Tp contains a cluster with eccentricity at most ⌈p/2⌉ in Tp. Therefore, for any δ ≥ ⌈p/2⌉, Tδ = Sδ = 1 and, thus, the algorithm decreases δ. Hence, the one-sided binary search of Algorithm 2∗ has at most O(log p) iterations. Therefore, the algorithm □ runs in at most O(cid:0)m α(n) log min(∆, p)(cid:1) total time. References 1. Abboud, A., Williams, V.V., Wang, J., Approximation and fixed parameter sub- quadratic algorithms for radius and diameter in sparse graphs, Proceedings of the 26 Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, 377 -- 391, 2016. 2. Abu-Ata, M., Dragan, F.F., Metric tree-like structures in real-life networks: an empirical study Networks 67 (1), 49 -- 68, 2016. 3. Brandstädt, A., Chepoi, V., and Dragan, F.F., The Algorithmic Use of Hypertree Structure and Maximum Neighbourhood Orderings. Discrete Applied Mathematics 82 (1 -- 3), 43 -- 77, 1998. 4. Brandstädt, A., Chepoi, V., and Dragan, F.F., Distance approximating trees for chordal and dually chordal graphs. Journal of Algorithms 30, 166 -- 184, 1999. 5. Chepoi, V., Dragan, F.F., A note on distance approximating trees in graphs. European Journal of Combinatorics 21, 761 -- 766, 2000. 6. Chepoi, V.D., Dragan, F.F., Estellon, B., Habib, M., Vaxes, Y., Diameters, centers, and approximating trees of δ-hyperbolic geodesic spaces and graphs, Proceedings of the 24th Annual ACM Symposium on Computational Geometry (SoCG 2008), 59 -- 68, 2008. 7. Chepoi, V., Estellon, B., Packing and Covering δ-Hyperbolic Spaces by Balls, Lecture Notes in Computer Science 4627, 59 -- 73, 2007. 8. Chlebík, M., Chlebíková, J., Approximation hardness of dominating set problems in bounded degree graphs, Information and Computation 206, 1264 -- 1275, 2008. 9. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C., Introduction to Algorithms (3. ed.), MIT Press, 2009. 10. Dourisboure, Y., Dragan, F.F., Gavoille, C., and Yan, C., Spanners for bounded tree-length graphs, Theoretical Computer Science 383 (1), 34 -- 44, 2007. 11. Downey, R.G., Fellows, M.R., Parameterized Complexity, Springer, 1999. 12. Dragan, F.F., HT-graphs: centers, connected r-domination and Steiner trees, Com- puter Science Journal of Moldova 1 (2), 64 -- 83, 1993. 13. Edwards, K., Kennedy, K., Saniee, I., Fast Approximation Algorithms for p-centers in Large δ-hyperbolic Graphs, WAW 2016, Lecture Notes in Computer Science 10088, 60 -- 73, 2016. 14. Escoffier, B., Paschos, V.Th., Completeness in approximation classes beyond APX. Theoretical Computer Science 359 (1 -- 3), 369 -- 377, 2006. 15. Frederickson, G.N.: Parametric Search and Locating Supply Centers in Trees. WADS 1991, Lecture Notes in Computer Science 519, 299 -- 319, 1991. 16. Gonzalez, T., Clustering to minimize the maximum intercluster distance, Theoretical 17. Guha, S., Khuller, S., Approximation algorithms for connected dominating sets, Computer Science, 38, 293 -- 306, 1985. Algorithmica 20 (4), 374 -- 387, 1998. 18. Niedermeier, R., Invitation to fixed-parameter algorithms, Oxford Lecture Series in Mathematics and Its Applications, Oxford University Press, 2006. 19. Raz, R., Safra, S., A sub-constant error-probability low-degree test, and sub-constant error-probability PCP characterization of NP, Proc. 29th Annual ACM Symposium on Theory of Computing, 475 -- 484, 1997. 20. Yen, W.C.-K., Chen, C.-T.: The p-center problem with connectivity constraint. Applied Mathematical Sciences 1 (27), 1311 -- 1324, 2007. 27
1501.05801
1
1501
2015-01-23T13:50:56
Online Submodular Maximization with Preemption
[ "cs.DS" ]
Submodular function maximization has been studied extensively in recent years under various constraints and models. The problem plays a major role in various disciplines. We study a natural online variant of this problem in which elements arrive one-by-one and the algorithm has to maintain a solution obeying certain constraints at all times. Upon arrival of an element, the algorithm has to decide whether to accept the element into its solution and may preempt previously chosen elements. The goal is to maximize a submodular function over the set of elements in the solution. We study two special cases of this general problem and derive upper and lower bounds on the competitive ratio. Specifically, we design a $1/e$-competitive algorithm for the unconstrained case in which the algorithm may hold any subset of the elements, and constant competitive ratio algorithms for the case where the algorithm may hold at most $k$ elements in its solution.
cs.DS
cs
Online Submodular Maximization with Preemption Niv Buchbinder∗ Moran Feldman† Roy Schwartz‡ August 27, 2018 Abstract Submodular function maximization has been studied extensively in recent years under various constraints and models. The problem plays a major role in various disciplines. We study a natural online variant of this problem in which elements arrive one-by-one and the algorithm has to maintain a solution obeying certain constraints at all times. Upon arrival of an element, the algorithm has to decide whether to accept the element into its solution and may preempt previously chosen elements. The goal is to maximize a submodular function over the set of elements in the solution. We study two special cases of this general problem and derive upper and lower bounds on the competitive ratio. Specifically, we design a 1/e-competitive algorithm for the unconstrained case in which the algorithm may hold any subset of the elements, and constant competitive ratio algorithms for the case where the algorithm may hold at most k elements in its solution. 5 1 0 2 n a J 3 2 ] S D . s c [ 1 v 1 0 8 5 0 . 1 0 5 1 : v i X r a ∗Statistics and Operations Research Dept., Tel Aviv University, Israel. E-mail: [email protected]. Research supported by ISF grant 954/11 and BSF grant 2010426. †School of Computer and Communication Sciences, EPFL, Switzerland. E-mail: [email protected]. Re- search supported in part by ERC Starting Grant 335288-OptApprox. ‡Dept. of Computer Science, Princeton University, Princeton, NJ. E-mail: [email protected]. 1 Introduction Submodular function maximization has been studied extensively in recent years under various con- straints and models. Submodular functions, which capture well the intuitive idea of diminishing returns, play a major role in various disciplines, including combinatorics, optimization, economics, information theory, operations research, algorithmic game theory and machine learning. Sub- modular maximization captures well known combinatorial optimization problems such as: Max- Cut [32, 36, 39, 40, 53], Max-DiCut [20, 32, 34], Generalized Assignment [11, 12, 24, 29], and Max-Facility-Location [2, 14, 15]. Additionally, one can find submodular maximization problems in many other settings. In machine learning, maximization of submodular functions has been used for document summarization [46, 47], sensor placement [41, 42, 44], and information gather- ing [43]. In algorithmic game theory, calculating market expansion [16] and computing core values of certain types of games [52] are two examples where the problem can be reduced to submodular maximization. It is natural to consider online variants of submodular maximization, such as the following set- ting. There is an unknown ground set of elements N = {u1, u2, . . . , un}, a non-negative submodular function f : 2N → R+ and perhaps a constraint determining the feasible sets of elements that may be chosen. The elements of N arrive one by one in an online fashion. Upon arrival, the online algorithm must decide whether to accept each revealed element into its solution and this decision is irrevocable. As in the offline case, the algorithm has access to the function f via a value oracle, but in the online case it may only query subsets of elements that have already been revealed. For a concrete example, consider a soccer team manager preparing his team for the 2014 World Cup and hiring k (= 11) players. Occasionally, the manager gets an additional application from a new potential player, and may recruit him to the team. The goal is to maximize the quality of the team. The quality of the team is indeed a (non-monotone) submodular function of the chosen players. Although natural, it is not difficult to see that no algorithm has a constant competitive ratio for the above naıve model even with a simple cardinality constraint. Therefore, in order to obtain meaningful results, one must relax the model. One possible relaxation is to consider a random arrival model in which elements arrive at a random order [7, 26, 33]. This relaxation leads to "secretary type" algorithms. We propose here a different approach that still allows for an adversarial arrival. Here, we allow the algorithm to reject (preempt) previously accepted elements. Preemption appears as part of many online models (see, e.g., [1, 17, 18, 30]). The use of preemption in our model is mathematically elegant and fits well with natural scenarios. For example, it is natural to assume that a team manager may release one of the players (while hiring another instead) if it benefits the quality of the team. 1.1 Our Results We study online submodular maximization problems with two simple constraints on the feasible sets. The unconstrained case in which no restrictions are inflicted on the sets of elements that the algorithm may choose, and the cardinality constraint in which the online algorithm may hold at any time at most k elements. We provide positive results as well as hardness results. Our hardness results apply both to polynomial and non-polynomial time algorithms, but all our algorithms are polynomial (in some of them, a polynomial time implementation losses an ε in the competitive ratio). The unconstrained case: The first special case we consider is, arguably, the most basic case in which there is no constraint on the sets of elements that may be chosen. In this case the problem is 1 trivial if the submodular function f is monotone1 as the algorithm may take all elements. Therefore, we only consider non-monotone functions f . One simple candidate algorithm is an algorithm that selects each revealed element independently with probability 1/2. Feige et al. [23] proved that this algorithm, which does not use preemption, is 1/4-competitive. We prove that this is essentially optimal without using the additional power of preemption. Theorem 1.1. An online algorithm using no preemption cannot be (1/4 + ε)-competitive for any constant ε > 0, even if f is guaranteed to be a cut function of a weighted directed graph. On the positive side we prove that preemption is beneficial for the unconstrained-model. Theorem 1.2. There exists a 1/e-competitive algorithm for the unconstrained-model, which can be implemented in polynomial time at the cost of an ε loss in the competitive ratio (for an arbitrary small constant ε > 0). A special case of the unconstrained-model that we study is the dicut-model. In this model every set is feasible and the objective function f is a cut function of a weighted directed graph G = (V, A) having N ⊆ V (i.e., a subset of the nodes of G form the ground set). We assume an algorithm for the dicut-model knows V (but not N ) and can query the weight (and existence) of every arc leaving a revealed node. Observe that the algorithm can in fact calculate the value of f for every set of revealed elements using this information and never needs to query f via the oracle. The dicut-model can be viewed as an online model of the well-known Max-DiCut problem (see Section 1.2 for a discussion of another online model of Max-DiCut). Additionally, since the dicut-model is a special case of the unconstrained-model (with more power for the algorithm), it inherits the positive result given by Theorem 1.2. The next theorem gives a stronger result. Theorem 1.3. There exists a polynomial time 0.438-competitive algorithm for the dicut-model. Theorem 1.3 is proved by showing that an offline algorithm suggested by [21] can be implemented under the dicut-model. We complement Theorems 1.2 and 1.3 by the following theorem which gives hardness results for the dicut-model (and thus, also for the unconstrained-model). Theorem 1.4. No randomized (deterministic) algorithm for the dicut-model has a competitive ratio better than 4/5 ( 5−√17 2 ≈ 0.438).2 Notice that for polynomial time algorithms a hardness result of 1/2 proved by [23] for offline algorithms extends immediately to the unconstrained-model. For the dicut-model there exists a polynomial time 0.874-approximation offline algorithm [45], thus, polynomial time offline algorithms are strictly stronger than online algorithms in this model. Cardinality constraint: The second case we consider is the cardinality-model in which a set is feasible if and only if its size is at most k, for some parameter 0 ≤ k ≤ n. Our positive results for the cardinality-model are summarized by the following theorem. Theorem 1.5. There exists a randomized (56/627 ≈ 0.0893)-competitive algorithm for the cardi- nality-model, which can be implemented in polynomial time at the cost of an ε loss in the compet- itive ratio (for an arbitrary small constant ε > 0). Moreover, if the objective function is restricted to be monotone, then there exists a polynomial time deterministic (1/4)-approximation algorithm for this model. 1A set function f : 2N → R is monotone if A ⊆ B ⊆ N implies f (A) ≤ f (B). 2Theorem 1.4 holds even if we allow the algorithm access to all arcs of G, including arcs leaving unrevealed elements. 2 Monotone Objective General Objective Deterministic Randomized Deterministic Randomized Algorithm 1/4 [10, 54] 1/4 [10, 54] Hardness 1/2 + ε (1.6) 3/4 + ε (1.6) Polynomial time hardness 1/2 + ε (1.6) 1 − 1/e [50] 5 − 5 − √17 2 ≈ 0.438 2 ≈ 0.438 √17 (1.4) 1/2 + ε (1.4) 0.491 − 56 627 ≈ 0.0893 (1.5) (1.6) [31] Table 1: Summary of the results for the cardinality-model. To the right of each result appears the number of the theorem (or references) proving it. The second part of Theorem 1.5 follows from the works of Ashwinkumar [54] and Chakrabarti and Kale [10]. More specifically, these works present a streaming 1/4-competitive algorithm for maximizing a monotone submodular function subject to a cardinality constraint,3 and this al- gorithm can be implemented also under the cardinality-model. We describe a different 1/4- competitive algorithm for monotone objectives under the cardinality-model, and then use addi- tional ideas to prove the first part of Theorem 1.5. It is interesting to note that both algorithms guaranteed by Theorem 1.5 can be implemented in the streaming model of Chakrabarti and Kale [10]. Thus, we give also the first algorithm for maximizing a general non-negative submodular function subject to a cardinality constraint under this streaming model. On the negative side, notice that the cardinality-model generalizes the unconstrained-model (by setting k = n). Hence, both hardness results given by Theorem 1.4 extend to the cardinal- ity-model. The following theorem gives a few additional hardness results for this model. Theorem 1.6. No algorithm for the cardinality-model is (1/2 + ε)-competitive for any constant ε > 0. Moreover, even if the objective function is restricted to be monotone, no randomized (deter- ministic) algorithm for the cardinality-model is (3/4 + ε)-competitive ((1/2 + ε)-competitive). Notice that polynomial time hardness results of 0.491 and 1 − 1/e for the cardinality-model and the cardinality-model with a monotone objective follow from [31] and [50], respectively. All the results for the cardinality-model are summarized in Table 1. 1.2 Related Work The literature on submodular maximization problems is very large, and therefore, we mention below only a few of the most relevant works. The classical result of [51] states that the simple discrete greedy algorithm is a (1 − 1/e)-approximation algorithm for maximizing a monotone submodular function subject to a cardinality constraint. This result is known to be tight [50], even in the case where the objective function is a coverage function [19]. However, when one considers submodular objectives which are not monotone, less is known. An approximation of 0.309 was given by [56], which was later improved to 0.325 [31] using a simulated annealing technique. Extending the continuous greedy algorithm of [9] to general non-negative submodular objectives, [28] obtained an improved approximation of 1/e − o(1). Finally, [25] gave a fast 1/e-approximation algorithm and a much slower (1/e + 0.004)-approximation algorithm, demonstrating that 1/e is not the right approximation ratio for the problem. On the hardness side, it is known that no polynomial time algorithm can have an approximation ratio better than 0.491 [31]. 3In fact the algorithm of [54] and [10] is (4m)−1-competitive for the more general constraint of m-matroids intersection. 3 For the problem of maximizing a non-negative submodular function subject to no constraints, the first approximation algorithm was presented by Feige et al. [23] who gave a 2/5-approximation. This was improved in [31] and [27] to 0.41 and 0.42, respectively. Finally, [8] described a 1/2- approximation linear time algorithm, matching the hardness result given by [23]. Huang and Borodin [37] study an online model of this problem where the algorithm can access both f and ¯f . This model is powerful enough to implement the randomized 1/2-approximation algorithm of [8], and therefore, [37] consider only deterministic algorithms. Azar et al. [3] consider the Submodular Max-SAT problem, and provide a 2/3-approximation algorithm for it that can be implemented also in a natural online model. We are not aware of any additional works on online models of submodular maximization. For the problem of Max-DiCut, Goemans and Williamson [32] obtained 0.796-approximation using semi-definite programming. This was improved through a series of works [20, 45, 48] to 0.874. On the hardness side, a (12/13 + ε)-approximation algorithm will imply P = NP [36]. Assuming the Unique Games Conjecture, the best possible approximation for Max-Cut is 0.878 [40, 49], and this hardness result holds also for Max-DiCut since the last generalizes Max-Cut. Bar-Noy and Lampis [6] gave a (1/3)-competitive deterministic algorithm for an online model of Max-Cut where every revealed node is accompanied by its input and output degrees. For the case of a directed acyclic graph, they provide an improved deterministic algorithm with a competitive ratio of 2/31.5 ≈ 0.385, which is optimal against an adaptive adversary. Huang and Borodin [37] notice that the (1/3)-competitive deterministic algorithm of [6] is in fact identical to the (1/3)- approximation deterministic algorithm of [8] for unconstrained submodular maximization. Using the same ideas, it is not difficult to show that the (1/2)-approximation randomized algorithm of [8] implies a (1/2)-competitive algorithm in this online model. Finally, Feige and Jozeph [21] consider oblivious algorithms for Max-DiCut -- algorithms in which every node is selected into the cut independently with a probability depending solely on its input and output degrees. They show a 0.483-approximation oblivious algorithm, and prove that no oblivious algorithm has an approximation ratio of 0.4899. Finally, the vast literature on buyback problems considers problems that are similar to our model, but assume a linear objective function. Many of these problems are non-trivial only when preemption has a cost, which is usually assumed to be either constant or linear in the value of the preempted element. The work from this literature most closely related to ours is the work of Babaioff et al. [4, 5] who considered a matroid constraint. For other buyback results see, e.g., [13, 35, 38, 54, 55]. Paper Organization. Section 2 defines additional notation. Section 3 gives our results for the unconstrained-model and the dicut-model, except for Theorem 1.1 whose proof is deferred to Appendix A. Finally, Section 4 describes our results for the cardinality-model. 2 Preliminaries We study the following online variant of the submodular maximization problem. There is an unknown ground set of elements N = {u1, u2, . . . , un}, a non-negative submodular function f : 2N → R+ and and a down-monotone4 collection of feasible sets I ⊆ 2N . The objective of the instance is to find a feasible set maximizing f . The elements of N are revealed one by one. The algorithm creates n + 1 feasible solutions: S0, S1, . . . , Sn (each Si ∈ I). The solution S0 is the empty set ∅. For every 1 ≤ i ≤ n, Si is the solution selected by the algorithm immediately after 4A collection I of sets is down-monotone if A ⊆ B ⊆ N and B ∈ I imply A ∈ I. 4 5. It element ui is revealed and the algorithm can choose it to be any feasible subset of Si−1 + ui is important to note that the algorithm does not know n (the size of the ground set) in advance, hence, the input might end after every element from the algorithm's point of view. 3 The unconstrained-model and the dicut-model Our positive results for the unconstrained-model and the dicut-model (i.e., Theorems 1.2 and 1.3) are proved in Section 3.1. The negative result for the dicut-model (Theorem 1.4), which applies also to the unconstrained-model, is proved in Section 3.2. 3.1 Algorithms for the unconstrained-model and the dicut-model Before describing our algorithm for the unconstrained-model, we need some notation. For two vectors x, y ∈ [0, 1]N , we use x ∨ y and x ∧ y to denote the coordinate-wise maximum and mini- mum, respectively, of x and y (formally, (x ∨ y)u = max{xu, yu} and (x ∧ y)u = min{xu, yu}). We abuse notation both in the description of the algorithm and in its analysis, and unify a set with its characteristic vector and an element with the singleton set containing it. The multilinear extension of a set function f : 2N → R+ is a function F : [0, 1]N → R+ defined by F (x) = E[f (R(x))], where R(x) is a random set containing every element u ∈ N with probability xu, independently. The mul- tilinear extension is an important tool used in many previous works on submodular maximization (see, e.g., [9, 28, 56]). We denote by ∂uF (x) the derivative of F at point x with respect to the coordinate corresponding to u. It can be checked that F is a multilinear function, and thus: ∂uF (x) = F (x ∨ u) − F (x ∧ (N − u)) . Consider Algorithm 1. Recall that Si is the solution that the algorithm produces after seeing element ui. Algorithm 1: Marginal Choice 1 foreach element ui revealed do 2 3 4 Choose a uniformly random threshold θi ∈ [0, 1]. Let Ni ← {u1, u2, . . . , ui}. Let Si ← {uj ∈ Ni ∂uj F (θj · Ni) ≥ 0}. Our first objective is to show that Algorithm 1 is an online algorithm according to the unconst- rained-model. Lemma 3.1. For every 1 ≤ i ≤ n, Si ⊆ Si−1 + ui. Proof. By definition, Si contains only elements of Ni. Fix an element uj ∈ Ni − ui. Then: uj ∈ Si ⇒ ∂uj F (θj · Ni) ≥ 0 ⇒ ∂uj F (θj · Ni−1) ≥ 0 ⇒ uj ∈ Si−1 , where the second derivation follows from submodularity. Next, we bound the competitive ratio of Algorithm 1. Fix an element ui ∈ N . By submodularity, g(z) = ∂uiF (z · N ) is a continuous non-increasing function of z. Hence, by the intermediate value 5Given a set S and an element u, we use S + u and S − u as shorthands for S ∪ {u} and S \ {u}, respectively. 5 theorem, one of the following must hold: g(z) is always positive in the range [0, 1], g(z) is always negative in the range [0, 1] or g(z) has at least one root z0 ∈ [0, 1]. In the last case, the set I0 ⊆ [0, 1] of the roots of g(z) is non-empty. Moreover, by the monotonicity and continuity of g(z), I0 is a closed range. Using these observations, we define a vector y ∈ [0, 1]N as follows: 0 1 max I0 if ∂uiF (0 · N ) < 0 , if ∂uiF (1 · N ) > 0 , otherwise . yui =  Remark: Notice that the case ∂uiF (0 · N ) < 0 in the definition of y can happen only when f (∅) > 0. Observation 3.2. Every element ui ∈ N belongs to Sn with probability yui, independently. Hence, E[f (Sn)] = F (y). Proof. An element ui ∈ N belongs to Sn if and only if ∂uiF (θi · N ) ≥ 0, which is equivalent to the condition θi ≤ yui. Clearly, the last condition happens with probability yui, and is independent for different elements. The last observation implies that analyzing Algorithm 1 is equivalent to lower bounding F (y). Lemma 3.3. For every λ ∈ [0, 1], F (y ∧ (λ · N )) ≥ F (λ · N ). Proof. Observe that: F (y ∧ (λ · N )) = f (∅) +Z λ 0 dF (y ∧ (z · N )) dz dz = f (∅) +Z λ 0 Xu∈Nz≤yu ∂uF (y ∧ (z · N ))dz , where the second equality is due to the chain rule. By submoduliry and the observation that ∂uF (z · N ) is non-positive for every z > yu, we get: Xu∈Nz≤yu ∂uF (y ∧ (z · N )) ≥ Xu∈Nz≤yu ∂uF (z · N ) ≥ Xu∈N ∂uF (z · N ) . Combining the above equality and inequality, and using the chain rule again, gives: F (y ∧ (λ · N )) ≥ f (∅) +Z λ 0 "Xu∈N ∂uF (z · N )# dz = f (∅) +Z λ 0 dF (z · N ) dz dz = F (λ · N ) . We also need a lemma proved by [28]. Lemma 3.4 (Lemma III.5 of [28]). Consider a vector x ∈ [0, 1]N . Assuming xu ≤ a for every u ∈ N , then for every set S ⊆ N , F (x ∨ S) ≥ (1 − a)f (S). The following corollary follows from the last two lemmata. Corollary 3.5. F (y) ≥ e−1 · F (OP T ), where OP T is the subset of N maximizing f (OP T ). 6 Proof. Fix two values 0 ≤ a ≤ b ≤ 1. By the chain rule: F (y ∧ (b · N )) − F (y ∧ (a · N )) = Z b = Z b a dF (y ∧ (z · N )) dz dz (1) a Xu∈Nz≤yu ∂uF (y ∧ (z · N ))dz ≥Z b a Xu∈Nz≤yu ∂uF (z · N )dz , where the inequality follows from submodularity. We use two ways to lower bound the rightmost hand side of the above inequality. First, observe that ∂uF (z · N ) ≥ 0 whenever z < yu. Thus, F (y ∧ (z · N )) is a non-decreasing function of z. Additionally, ∂uF (z ·N ) ≤ 0 whenever z > yu and ∂uF (z · N ) ≥ 0 whenever z < yu. This allows us to derive the second lower bound, which holds whenever z is not equal to any coordinate of y (i.e., for every value of z except for a finite set of values): Xu∈Nz≤yu ∂uF (z · N ) ≥ Xu∈OP T ∂uF (z · N ) = Pu∈OP T [F (u ∨ (z · N )) − F (z · N )] F (y ∧ (z · N )) F (OP T ∨ (z · N )) − F (z · N ) 1 − z , ≥ f (OP T ) − ≥ 1 − z 1 − z where the last inequality follows from Lemmata 3.3 and 3.4. Plugging this lower bound and a = 0 into (1) gives: F (y ∧ (b · N )) ≥ f (∅) +Z b 0 (cid:20)f (OP T ) − F (y ∧ (z · N )) 1 − z (cid:21) dz . The solution of this differential equation is: F (y ∧ (b · N )) ≥ −(1 − b) · ln(1 − b) · f (OP T ) . The rightmost hand side of the last inequality is maximized for b = 1 − e−1. Recalling that F (y ∧ (z · N )) is a non-decreasing function of z, we get: F (y) = F (y ∧ (1 · N )) ≥ F (y ∧ ((1 − e−1) · N )) ≥ e−1 · f (OP T ) . The last corollary completes the proof of the first part of Theorem 1.2. A naıve implementation of Algorithm 1 requires an exponential time to evaluate F . However, for every constant c > 0 it is possible to approximate, in polynomial time, ∂uj F (θj · Ni) with probability 1 − cεi−2 up to an additive error of cεi−2 · f (OP T ) using sampling (see [9] for an example of a similar estimate).6 For a small enough c, such an approximation is good enough to affect the competitive ratio of the algorithm by only an ε. To keep the algorithm within the unconstrained-model, the samples used to approximate ∂uj F (θj · Ni) for different values of i need to be correlated to guarantee that the approximation is a decreasing function of i. For more details, see Appendix B. The rest of this section considers the dicut-model and is devoted for proving Theorem 1.3. Recall that in this model f is the cut function of some weighted directed graph G = (V, A). Let win(u) (wout(u)) denote the total weight of the arcs entering (leaving) element u. Throughout this section we assume there are no arcs of G leaving nodes of V \ N . Removing such arcs does not affect the value of any solution, and thus, our results hold also without the assumption. Feige and Jozeph [22] proved the following theorem (we rephrased it in our notation). 6It is not possible to decrease the error to something that depends on n because n is unknown to the algorithm when it calculates these estimations. 7 Theorem 3.6. There exists a non-decreasing function h : [0, 1] → [0, 1] such that the vector y ∈ [0, 1]N defined by: yu = h(cid:18) wout(u) win(u) + wout(u)(cid:19) obeys F (y) ≥ 0.483 · f (OP T ). Moreover, h is independent of G and can be computed in constant time (assuming numbers comparison takes constant time). Notice that in the last theorem yu is undefined when win(u) = wout(u) = 0. The theorem holds regardless of the value used for yu in this case because such an element u is isolated. We can now present our algorithm for the dicut-model which is depicted as Algorithm 2. Algorithm 2: Degrees Ratio Choice 1 foreach element ui revealed do 2 3 4 5 6 7 Choose a uniformly random threshold θi ∈ [0, 1]. Initialize Si ← ∅. for j = 1 to i do Let win(uj, i) denote the total weight of arcs from revealed elements to uj. if win(uj, i) + wout(uj) > 0 then Let yuj (i) ← h(cid:16) yuj (i) ← 1. if yuj (i) ≥ θj then Add uj to Si. wout(uj ) win(uj ,i)+wout(uj )(cid:17). else Let Observation 3.7. The competitive ratio of Algorithm 2 is at least 0.483. Proof. Notice that the vector y(n) defined by the algorithm is equal to the vector y defined by Theorem 3.6 (wherever the last is defined). Notice also that every element u ∈ N belongs to Sn with probability yu(n), independently. Hence, E[f (Sn)] = F (y). The observation now follows from Theorem 3.6. To complete the proof of Theorem 1.3, we only need the following lemma which shows that Algorithm 2 is an online algorithm of the dicut-model. Lemma 3.8. For every 1 ≤ i ≤ n, Si ⊆ Si−1 + ui. Proof. For i = 1 there is nothing to prove since S1 ⊆ {u1}. Thus, we assume from now on i ≥ 2. By definition, Si contains only elements of Ni. Fix an element uj ∈ Ni − ui. We have to show that uj ∈ Si−1. First, let us prove that: yuj (i) ≤ yuj (i − 1) . (2) If win(uj, i − 1) + wout(uj) ≤ 0 then yuj (i − 1) = 1, which There are two cases to consider. proves (2) since yuj (i) ∈ [0, 1]. Otherwise, since win(uj, i) is a non-decreasing function of i we get win(uj, i) + wout(uj) > 0. Inequality (2) now follows since h is also non-decreasing. Using (2) we now get: uj ∈ Si ⇒ yuj (i) ≥ θj ⇒ yuj (i − 1) ≥ θj ⇒ uj ∈ Si−1 . 8 1 1 √17 4 − 3 v1 u1 u2 v2 √17 4 − 3 1 √17+1 4 1 √17+1 4 w1 w2 Figure 1: Graph for Lemma 3.9. The number beside each arc represents its weight. 3.2 Hardness results for the dicut-model In this section we prove Theorem 1.4. The proof of the theorem is split between two lemmata. Lemma 3.9 proves the part of Theorem 1.4 referring to deterministic algorithms, and Lemma 3.10 proves the part referring to randomized algorithms. Both lemmata present an absolute graph G = (V, A), and then fix an algorithm ALG and describe an adversary that reveals some of the nodes of V . The choice which nodes to reveal is done iteratively, i.e., the adversary initially reveals some nodes and then can reveal additional nodes based on the decisions of ALG (or the probabilities of various decisions in case ALG is randomized). Formally, in the hard instance for ALG, the set N is the set of nodes revealed by the adversary, and the hard instance reveals these nodes in the same order they are revealed by the adversary. Lemma 3.9. No deterministic online algorithm has a competitive ratio better than (5 − √17)/2 for the dicut-model. Proof. Consider the directed graph G describe in Figure 1, and fix a deterministic algorithm ALG for the dicut-model. We describe an adversary that reveals some of the nodes of G and forces ALG to be no better than ((5 − √17)/2)-competitive. For every pair of nodes x and y of G, we denote by c(xy) the weight of the arc from x to y. Our adversary begins by revealing u1 and u2 and stops if ALG's solution at this point is either empty or equal to {u1, u2}. If ALG's solution is empty then ALG is not competitive at all. On the other hand, if ALG's solution is {u1, u2} then its solution has a value of: c(u1v1) + c(u2v2) = 2 · √17 − 3 4 √17 − 3 2 . = On the other hand, the optimal solution is {u1}, whose value is: c(u1v1) + c(u1u2) = + 1 = √17 − 3 4 √17 + 1 4 Thus, in this case, the competitive ratio of ALG is at most: √17 − 3 2 : √17 + 1 4 2√17 − 6 √17 + 1 5 − √17 2 = = . . By the above discussion, the only interesting case is when ALG's solution contains exactly one of the elements u1 or u2. Notice that G is symmetric in the sense that switching every node having the index 1 with the corresponding node having the weight 2 does not change the graph. Hence, it is safe to assume ALG's solution is exactly {u1}. The next step of the adversary is to reveal v1. If 9 w1 u1 u2 w2 Figure 2: Graph for Lemma 3.10. All arcs have an identical weight assumed to be 1. v1 enters the solution of ALG, then, regardless of weather u1 is kept in the solution, the value of ALG's solution is c(u1u2) = c(v1u1) = 1. On the other hand, the optimal solution at this point is {u2, v1} whose value is: c(u2u1) + c(u2v2) + c(v1u1) = 1 + Hence, the competitive ratio of ALG is at most: √17 − 3 4 + 1 = √17 + 5 . 4 4 √17 + 5 = 5 − √17 2 . We are left to handle the case in which v1 does not enter ALG's solution. In this case, the adversary reveals also w1. ALG's solution at this point must be a subset of {u1, w1} and every such subset has a value of at most: c(u1v1) + c(u1u2) = c(w1u1) = √17 + 1 . 4 On the other hand, the optimal solution at this point is {u2, v1, w1} whose value is: √17 − 3 4 + 1 + √17 + 1 √17 + 3 4 = 2 . c(u2u1) + c(u2v2) + c(v1u1) + c(w1u1) = 1 + Hence, the competitive ratio of ALG is at most: √17 + 1 4 : √17 + 3 2 √17 + 1 2√17 + 6 7 − √17 8 = 5 − √17 2 . < = Lemma 3.10. No randomized online algorithm has a competitive ratio better than 4/5 for the dicut-model. Proof. Consider the directed graph G describe in Figure 2, and fix an algorithm ALG for the dicut-model. We describe an adversary that reveals some of the nodes of G and forces ALG to be no better than 4/5-competitive. The adversary begins by revealing the nodes u1 and u2 of the graph. At this point, let p1 be the probability that u1 is alone in the solution of ALG and p2 be the probability that u2 is alone in this solution. If p1 + p2 ≤ 4/5 then the adversary stops here, and the competitive ratio of ALG is no better than 4/5 since the optimal solution at this point has a value of 1 and the expected value of the ALG's solution is only p1 + p2. Thus, we may assume from now on p1 + p2 > 4/5. By symmetry, we may also assume, without loss of generality, p2 ≤ p1, which implies: 2p1 ≥ p1 + p2 > 4/5. The next step of the adversary is revealing w1. The optimal solution at this point is {u2, w1}, whose value is 2. Let analyze the best solution ALG can produce. With probability p1, ALG must pick a subset of {u1, w1}, and thus, cannot end up with a solution of value better than 1. With the remaining probability, ALG produces a solution no better than the optimal solution, i.e., its value is at most 2. Hence, the expected value of ALG's solution is at most: p1 + 2(1 − p1) = 2 − p1 < 2 − 2/5 = 2 · (4/5) . 10 4 The cardinality-model Our positive and negative results for the cardinality-model (i.e., Theorems 1.5 and 1.6, respec- tively) are proved in Sections 4.1 and 4.2, respectively. 4.1 Algorithms for the cardinality-model We first consider the special case of the cardinality-model where the objective function f is monotone (in addition to being non-negative and submodular). For this case it is possible to derive a 1/4-competitive algorithm from the works of Ashwinkumar [54] and Chakrabarti and Kale [10] on streaming algorithms. We describe an alternative algorithm which achieves the same competitive ratio and has an easier analysis. A variant of this algorithm is applied later in this section to the general cardinality-model. Our alternative algorithm has a parameter c > 0 and is given as Algorithm 3. Intuitively the algorithm gets the first k revealed elements unconditionally. For every element ui arriving after the first k elements, the algorithm finds the best swap replacing an element of the current solution with ui. If this swap increases the value of the current solution by enough to pass a given threshold, then it is carried out and ui enters the solution. Algorithm 3: Greedy with Theshold(c) 1 Let S0 ← ∅. 2 foreach element ui revealed do 3 4 5 6 7 8 9 10 if i ≤ k then Let Si ← Si−1 + ui. else Let u′i be the element of Si−1 maximizing f (Si−1 + ui − u′i). if f (Si−1 + ui − u′i) − f (Si−1) ≥ c · f (Si−1)/k then Let Si ← Si−1 + ui − u′i. else Let Si ← Si−1. Let us define some notation. For every 0 ≤ i ≤ n, let Ai = ∪i j=1Sj. Informally, Ai is the set of all elements of {u1, u2, . . . , ui} originally accepted by Algorithm 3, regardless of whether they are preempted at a later stage or not. We also use f (u S) to denote the marginal contribution of an element u to a set S. Formally, f (u S) = f (S + u) − f (S). The following technical lemma is used later in the proof. Lemma 4.1. For every k < i ≤ n, f (Si−1 + ui − u′i) − f (Si−1) ≥ f (ui Ai−1) − f (Si−1)/k. Proof. By the choice of u′i and an averaging argument, f (Si−1 + ui − u′i) − f (Si−1) ≥ Pu′∈Si−1 ≥ Pu′∈Si−1 k [f (Si−1 + ui) − f (Si−1)] k [f (Si−1 + ui − u′) − f (Si−1)] + Pu′∈Si−1 [f (Si−1 − u′) − f (Si−1)] k , where the second inequality follows from submodularity. The first term on the rightmost hand side is f (ui Si−1), which can be lower bounded by f (ui Ai−1) because Si−1 ⊆ Ai−1. The second term 11 on the rightmost hand side can be lower bounded using the submodularity and non-negativity of f as follows: Pu′∈Si−1 [f (Si−1 − u′) − f (Si−1)] k f (∅) − f (Si−1) k f (Si−1) k ≥ − . ≥ The following lemma relates Si and Ai. c+1 · f (Ai). Lemma 4.2. For every 0 ≤ i ≤ n, f (Si) ≥ c Proof. For i = 0, the lemma clearly holds since f (A0) = f (∅) = f (S0). Thus, it is enough to prove that for every 1 ≤ i ≤ n, f (Si)− f (Si−1) ≥ c c+1 · [f (Ai)− f (Ai−1)]. If the algorithm does not accept ui then Si = Si−1 and Ai = Ai−1, and the claim is trivial. Hence, we only need to consider the case in which the algorithm accepts element ui. Ai−1) = f (Ai) − f (Ai−1), where the inequality follows from submodularity since Si−1 ⊆ Ai−1. If i > k, then it is possible to lower bound f (Si) − f (Si−1) = f (Si−1 + ui − u′i) − f (Si−1) in two ways. First, a lower bound of f (ui Ai−1) − f (Si−1)/k is given by Lemma 4.1. A second lower bound of c · f (Si−1)/k follows since the algorithm accepts ui. Using both lower bounds, we get: If i ≤ k then f (Si) − f (Si−1) = f (ui Si−1) ≥ f (ui f (Si) − f (Si−1) ≥ max{f (ui Ai−1) − f (Si−1)/k, c · f (Si−1)/k} c · [f (ui Ai−1) − f (Si−1)/k] + 1 · [c · f (Si−1)/k] c c + 1 · f (ui Ai−1) = c + 1 c c + 1 · [f (Ai) − f (Ai−1)] . ≥ ≥ We are now ready to prove the competitive ratio of Algorithm 3, and thus, also the second part of Theorem 1.5. Corollary 4.3. The competitive ratio of Algorithm 3 is at least competitive ratio of Algorithm 3 is at least 1/4. c (c+1)2 . Hence, for c = 1 the Proof. Let OP T be the optimal solution, and consider an element ui ∈ OP T \ Ai. Since ui was rejected by Algorithm 3, the following inequality must hold: c · f (Si−1) > f (Si−1 + ui − u′i) − f (Si−1) ≥ f (ui Ai−1) − where the second inequality follows from Lemma 4.1. Rearranging yields: k f (Si−1) k , f (ui Ai−1) < c + 1 k · f (Si−1) ≤ c + 1 k · f (Sn) , where the last inequality uses the monotonicity of f (Si) (as a function of i). In conclusion, by the submodularity and monotonicity of f and Lemma 4.2, f (OP T ) ≤ f (An) + Xu∈OP T\An f (u An) < f (An) + Xu∈OP T\An(cid:18) c + 1 k · f (Sn)(cid:19) ≤ f (An) + (c + 1) · f (Sn) ≤ · f (Sn) . (c + 1)2 c 12 At this point we return the focus to the general cardinality-model allowing the objective f to be non-monotone. For the algorithm and analysis we present we need the notation described at the beginning of Section 3. More specifically, we use the multilinear extension F of f and the assumption that a set S ⊆ N represents also its characteristic vector. As a first step, consider a variant of Algorithm 3 modified in two ways: • The value k is replaced with pk for an integer parameter p ≥ 1. • The algorithm uses an auxiliary function g : 2N → R+ instead of the real objective function f . The auxiliary function g is defined as g = F (p−1 · S). Notice that the modified algorithm does not produce a feasible solution. Still, we are interested in analyzing it for reasons that are explained later. The proofs of Lemmata 4.1 and 4.2 do not use the monotonicity of f . Hence, both lemmata still hold with pk and g taking the roles of k and f , respectively (notice that g is non-negative and submodular). The resulting lemmata after the replacements are given below. Lemma 4.4. For every pk < i ≤ n, g(Si−1 + ui − u′i) − g(Si−1) ≥ g(ui Ai−1) − g(Si−1)/(pk). Lemma 4.5. For every 0 ≤ i ≤ n, g(Si) ≥ c We also need the following lemma of [23]. c+1 · g(Ai). Lemma 4.6 (Lemma 2.3 of [23]). Let f : 2N → R be submodular, A, B ⊆ N two (not necessarily disjoint) sets and A(p), B(q) their independently sampled subsets, where each element of A appears in A(p) with probability p and each element of B appears in B(q) with probability q. Then E[f (A(p) ∪ B(q))] ≥ (1 − p)(1 − q) · f (∅) + p(1 − q) · f (A) + (1 − p)q · f (B) + pq · f (A ∪ B) . Using the above lemmata, it is possible to get a guarantee on g(Sn). Corollary 4.7. Let OP T be the optimal solution. The modified Algorithm 3 guarantees: g(Sn) ≥ cp−1(1 − p−1) (c + 1)(1 + p−1c) · f (OP T ) . Hence, for c = 7/4 and p = 3, g(Sn) ≥ (56/627) · f (OP T ). Proof. Consider an element ui ∈ OP T \ Ai. Since ui was rejected by Algorithm 3, the following inequality must hold: c · g(Si−1) > g(Si−1 + ui − u′i) − g(Si−1) ≥ g(ui Ai−1) − where the second inequality follows from Lemma 4.4. Rearranging yields: pk g(Si−1) pk , g(ui Ai−1) < c + 1 pk · g(Si−1) ≤ c + 1 pk · g(Sn) , where the last inequality uses the monotonicity of g(Si) (as a function of i) for i ≥ pk. By the submodularity of g and Lemma 4.5, we now get: g(An ∪ OP T ) ≤ g(An) + Xu∈OP T\An ≤ g(An) + p−1(c + 1) · g(Sn) ≤ g(ui An) < g(An) + Xu∈OP T\An(cid:18) c + 1 · g(Sn) . (c + 1)(1 + p−1c) c pk · g(Sn)(cid:19) On the other hand, by Lemma 4.6, g(An ∪ OP T ) = F (p−1 · OP T + p−1 · (An \ OP T )) ≥ p−1(1 − p−1) · f (OP T ) . 13 A naıve implementation of Algorithm 3 requires an exponential time to evaluate F . However, this can be fixed, at a loss of an arbitrary small constant ε > 0 in the guarantee of Corollary 4.7. See the above discussion about a polynomial time implementation of Algorithm 1 for the main ideas necessary for such an implementation. For more details, see Appendix C. i=0 obtained from the sets {Si}n Consider a collection of vectors {yi}n i=0 via the following rule: yi = p−1 · Si. The vectors {yi}n i=0 form a fractional solution for the cardinality-model in the following sense. First, for every 0 ≤ i ≤ n, the sum of the coordinates of yi is at most k. Second, for every 1 ≤ i ≤ n, yi ≤ yi−1 ∨ u, where the inequality is element-wise. To convert the vectors {yi}n i=0 for the cardinality-model, we need an online rounding method. i=0 into an integral solution { ¯Si}n The rounding we suggest works as follows. For every 1 ≤ ℓ ≤ k, select a uniformly random value rℓ from the range {p(ℓ− 1) + 1, p(ℓ− 1) + 2, . . . , pℓ}. Intuitively, the values rℓ specify the indexes of the elements from the set {uj}pk j=1 that get into the rounded solution. Later elements can get into the rounded solution only if they "take the place" of one of these elements. More formally, we say that an element uj ∈ Si uses place a if there exists a series of indexes: j1, j2, . . . , jm such that: j = j1 , u′ji = uji−1 (i.e., uji replaced uji−1 in Sji) and jm = a . The element uj ∈ Si gets into ¯Si if and only if it uses a place a equal to rℓ for some ℓ ∈ {1, 2, . . . , k}. Observation 4.8. For every 0 ≤ i ≤ n, at most one element of Si uses every place a ∈ {1, 2, . . . , pk}. Proof. The observation follows immediately from the definition when i ≤ pk because for every 1 ≤ j ≤ i, the element uj uses place j. For larger values of i we prove the observation by induction. Assume the claim holds for i− 1 ≥ pk, and let us prove it for i. Since ui got into Si, the place used by ui is defined as the place used by u′i. As Si = Si−1 + ui − u′i, every place is used at most once also in Si. Corollary 4.9. The sets { ¯Si}n Proof. Observation 4.8 implies immediately that ¯Si ≤ k since only k places make elements of Si using them appear in ¯Si. Observe also that the rule whether an element of Si gets into { ¯Si} is independent of i. Hence, for every 1 ≤ i ≤ k, ¯Si ⊆ ¯Si−1 + ui simply because Si ⊆ Si−1 + ui. i=0 form a feasible online solution for the cardinality-model. Next, we want to show that f ( ¯Sn) is as good approximation for f (OP T ) as g(Sn). This is done by the following lemma. Lemma 4.10. E[f ( ¯Sn)] ≥ g(Sn). Proof. For every 1 ≤ ℓ ≤ k, let Rℓ be the set of elements of Sn using places from {p(ℓ− 1) + 1, p(ℓ− 1) + 2, pℓ}. By Observation 4.8, the size of Rℓ is at most p. Let ¯Rℓ be a set containing the single element of Rℓ using the place rℓ, or the empty set if no element uses this place. By definition, Sn =Sk Recall also that given a vector x ∈ [0, 1]N , R(x) is a random set containing every element u ∈ Ri ¯Rℓ. ℓ=1 with probability xu. Using this notation, g(Sn) = E[f (R(p−1 · Sn))] = E"f k [ℓ=1 R(p−1 · Rℓ)!# . 14 Hence, the lemma is equivalent to the inequality: E"f k [ℓ=1 ¯Rℓ!# ≥ E"f k [ℓ=1 R(p−1 · Rℓ)!# . (3) As a step toward proving Inequality (3), fix 1 ≤ ℓ ≤ k, and let Dℓ be a random subset of N \ Rℓ with an arbitrary distribution. We use the notation v1, v2, . . . , vp′ to denote the elements of Rℓ (p′ = Rℓ ≤ p), and Rℓ,i to denote the set {v1, v2, . . . , vi} ⊆ Rℓ. By submodularity, E(cid:2)f(cid:0)Dℓ ∪ ¯Rℓ(cid:1)(cid:3) = E[f (Dℓ)] + Pp′ ≥ E[f (Dℓ)] + Pp′ i=1 E[f (vi Dℓ)] p = E(cid:2)f(cid:0)Dℓ ∪ R(p−1 · Rℓ)(cid:1)(cid:3) . Inequality (3) follows by repeated applications of the above inequality, once for every 1 ≤ ℓ ≤ k. i=1 p E[f (vi Dℓ ∪ R(p−1 · Rℓ,i−1)] The first part of Theorem 1.5 follows by combining the modified Algorithm 3 with the rounding method described above. 4.2 Hardness results for the cardinality-model In this section we prove Theorem 1.6. The proof of the theorem is split between two lemmata. Lemma 4.11 proves the part of Theorem 1.6 referring to monotone objectives, and Lemma 4.12 proves the part referring to general objective functions. Lemma 4.11. No deterministic (randomized) online algorithm has a competitive ratio better than 1/2 + ε (3/4 + ε) for the cardinality-model, even if the objective function is restricted to be monotone. Proof. Let k = ⌈(2ε)−1⌉ and consider the ground set N = {ui}k submodular function f : 2N → R+ defined as follows: i=1∪{w} and the monotone i=1∪{vi}k f (S) = S ∩ {ui}k i=1 + min{k,S ∩ {vi}k i=1 + k · S ∩ {w}} . Intuitively, f gains a "point" for every element of the forms ui and vi. The element w gives k "points", but these are the same points of the elements of the form vi, i.e., vi gives no "points" once w is in the solution. i=1 and {vi}k Fix an algorithm ALG, and set the element w to be revealed after all the other elements of N . Observe that as long as w is not revealed, there is no way for ALG to distinguish between the elements of {ui}k i=1. Thus, if ALG is deterministic, the set S2k is determined solely based on the order in which the elements are revealed. By choosing the right order, one can i=1, which implies that S2k+1 is a subset of {vi}k guarantee that S2k ⊆ {vi}k i=1 ∪ {w}, and thus, has a value of at most k. On the other hand, the optimal solution is {ui}k−1 i=1 ∪ {w}, and its value is 2k − 1. Hence, the competitive ratio of ALG is at most: 1 2 k + 1 2k ≤ + ε . k 2k − 1 ≤ If ALG is randomized, S2k depends also on the random choices of ALG. However, by symmetry, i=1 guaranteeing it is still possible to choose a revelation order for the elements of {ui}k i=1 and {vi}k 15 that in expectation S2k contains no more than k/2 elements of {ui}k of f (S2k+1) can be upper bounded by 3k/2, and the competitive ratio of ALG is no more than: i=1. Thus, the expected value 3k/2 2k − 1 ≤ 3k/2 + 1 2k 3 4 ≤ + ε . Lemma 4.12. No online algorithm has a competitive ratio better than 1/2 + ε for the cardinal- ity-model. Proof. Intuitively, the proof of Lemma 4.12 provides a weaker bound for randomized algorithms because the number of elements of the form vi in the ground set is quite small. In this proof we fix this problem. Let k = ⌈ε−1⌉ and h = 2k·⌈ε−1⌉. Consider the ground set N = {ui}k i=1∪{w} and the non-negative submodular function f : 2N → R+ defined as follows: i=1∪{vi}h f (S) =(S k + S ∩ {ui}k if w 6∈ S , i=1 otherwise . Fix an algorithm ALG, and set the element w to be revealed after all the other elements of N . Observe that as long as w is not revealed, there is no way for ALG to distinguish between the elements of {ui}k i=1. Hence, by symmetry, it is possible to choose a revelation order for these elements guaranteeing that in expectation Sk+h contains no more than k2/(k + h) elements of {ui}k i=1. The final solution of ALG is a subset of Sk+h + w. Since the size of Sk+h is at most k, no element of Sk+h + w has a negative marginal contribution, and thus, the value of ALG's solution can be upper bounded by f (Sk+h + w). Hence, the total expected value ALG achieves is at most: i=1 and {vi}h E[f (Sk+h + w)] = k + E[Sk+h ∩ {ui}k i=1] ≤ k + k2 k + h . On the other hand, the optimal solution is {ui}k−1 competitive ratio of ALG is at most: i=1 ∪ {w}, and its value is 2k − 1. Hence, the k + k2 k+h 2k − 1 ≤ k + 1 2k + k k + h ≤ 1 2 + ε . References [1] Ran Adler and Yossi Azar. Beating the logarithmic lower bound: Randomized preemptive disjoint paths and call control algorithms. In SODA, pages 1 -- 10, 1999. [2] A. A. Ageev and M. I. Sviridenko. An 0.828 approximation algorithm for the uncapacitated facility location problem. Discrete Appl. Math., 93:149 -- 156, July 1999. [3] Yossi Azar, Iftah Gamzu, and Ran Roth. Submodular max-sat. In ESA, pages 323 -- 334, 2011. [4] Moshe Babaioff, Jason D. Hartline, and Robert D. Kleinberg. Online algorithms with buyback. In Workshop on Ad Auctions, 2008. [5] Moshe Babaioff, Jason D. Hartline, and Robert D. Kleinberg. Selling ad campaigns: online algorithms with cancellations. In EC, pages 61 -- 70, 2009. [6] Amotz Bar-Noy and Michael Lampis. Online maximum directed cut. Journal of Combinatorial Optimization, 24(1):52 -- 64, 2012. 16 [7] Mohammad Hossein Bateni, Mohammad Taghi Hajiaghayi, and Morteza Zadimoghaddam. Submodular secretary problem and extensions. In Maria Serna, Ronen Shaltiel, Klaus Jansen, and Jos´e Rolim, editors, Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, Lecture Notes in Computer Science, pages 39 -- 52. Springer Berlin / Heidelberg, 2010. [8] Niv Buchbinder, Moran Feldman, Joseph (Seffi) Naor, and Roy Schwartz. A tight linear time (1/2)-approximation for unconstrained submodular maximization, 2012. FOCS 2012. [9] Gruia Calinescu, Chandra Chekuri, Martin Pal, and Jan Vondr´ak. Maximizing a mono- tone submodular function subject to a matroid constraint. SIAM Journal on Computing, 40(6):1740 -- 1766, 2011. [10] Amit Chakrabarti and Sagar Kale. Submodular maximization meets streaming: Matchings, matroids, and more. CoRR, abs/1309.2038, 2013. [11] Chandra Chekuri and Sanjeev Khanna. A polynomial time approximation scheme for the multiple knapsack problem. SIAM J. Comput., 35(3):713 -- 728, September 2005. [12] Reuven Cohen, Liran Katzir, and Danny Raz. An efficient approximation for the generalized assignment problem. Information Processing Letters, 100(4):162 -- 166, 2006. [13] Florin Constantin, Jon Feldman, S. Muthukrishnan, and Martin P´al. An online mechanism for ad slot reservations with cancellations. In SODA, pages 1265 -- 1274, 2009. [14] G. Cornuejols, M. L. Fisher, and G. L. Nemhauser. Location of bank accounts to optimize float: an analytic study of exact and approximate algorithms. Management Sciences, 23:789 -- 810, 1977. [15] G. Cornuejols, M. L. Fisher, and G. L. Nemhauser. On the uncapacitated location problem. Annals of Discrete Mathematics, 1:163 -- 177, 1977. [16] Shaddin Dughmi, Tim Roughgarden, and Mukund Sundararajan. Revenue submodularity. In EC, pages 243 -- 252, 2009. [17] Matthias Englert and Matthias Westermann. Lower and upper bounds on fifo buffer manage- ment in QoS switches. Algorithmica, 53(4):523 -- 548, 2009. [18] Leah Epstein, Asaf Levin, Danny Segev, and Oren Weimann. Improved bounds for online preemptive matching. In STACS, pages 389 -- 399, 2013. [19] Uriel Feige. A threshold of ln n for approximating set cover. J. ACM, 45(4):634 -- 652, 1998. [20] Uriel Feige and Michel X. Goemans. Aproximating the value of two prover proof systems, with applications to max 2sat and max dicut. In ISTCS, pages 182 -- 189, 1995. [21] Uriel Feige and Shlomo Jozeph. Oblivious algorithms for the maximum directed cut problem. CoRR, abs/1010.0406, 2010. [22] Uriel Feige and Shlomo Jozeph. Oblivious algorithms for the maximum directed cut problem. Algorithmica, pages 1 -- 20, 2013. [23] Uriel Feige, Vahab S. Mirrokni, and Jan Vondr´ak. Maximizing non-monotone submodular functions. SIAM Journal on Computing, 40(4):1133 -- 1153, 2011. 17 [24] Uriel Feige and Jan Vondr´ak. Approximation algorithms for allocation problems: Improving the factor of 1 − 1/e. In FOCS, pages 667 -- 676, 2006. [25] Moran Feldman, Joseph (Seffi) Naor, and Roy Schwartz. Submodular maximization with cardinality constraints. [26] Moran Feldman, Joseph (Seffi) Naor, and Roy Schwartz. Improved competitive ratios for submodular secretary problems. In APPROX, pages 218 -- 229, 2011. [27] Moran Feldman, Joseph (Seffi) Naor, and Roy Schwartz. Nonmonotone submodular maxi- mization via a structural continuous greedy algorithm. In ICALP, pages 342 -- 353, 2011. [28] Moran Feldman, Joseph (Seffi) Naor, and Roy Schwartz. A unified continuous greedy algorithm for submodular maximization. In FOCS, 2011. [29] Lisa Fleischer, Michel X. Goemans, Vahab S. Mirrokni, and Maxim Sviridenko. Tight ap- proximation algorithms for maximum general assignment problems. In SODA, pages 611 -- 620, 2006. [30] Stanley P.Y. Fung. Online scheduling with preemption or non-completion penalties. Journal of Scheduling, 17(2):173 -- 183, 2014. [31] Shayan Oveis Gharan and Jan Vondr´ak. Submodular maximization by simulated annealing. In SODA, pages 1098 -- 1117, 2011. [32] Michel X. Goemans and David P. Williamson. Improved approximation algorithms for max- imum cut and satisfiability problems using semidefinite programming. Journal of the ACM, 42(6):1115 -- 1145, 1995. [33] Anupam Gupta, Aaron Roth, Grant Schoenebeck, and Kunal Talwar. Constrained non- monotone submodular maximization: offline and secretary algorithms. In WINE, pages 246 -- 257. Springer-Verlag, 2010. [34] Eran Halperin and Uri Zwick. Combinatorial approximation algorithms for the maximum directed cut problem. In SODA, pages 1 -- 7, 2001. [35] Xin Han, Yasushi Kawase, and Kazuhisa Makino. Online unweighted knapsack problem with removal cost. Algorithmica, pages 1 -- 16, 2013. [36] Johan Hastad. Some optimal inapproximability results. J. ACM, 48:798 -- 859, July 2001. [37] Norman Huang and Allan Borodin. Bounds on double-sided myopic algorithms for uncon- strained non-monotone submodular maximization. CoRR, abs/1312.2173, 2013. [38] Kazuo Iwama and Shiro Taketomi. Removable online knapsack problems. In ICALP, pages 293 -- 305, 2002. [39] Richard M. Karp. Reducibility among combinatorial problems. In R. E. Miller and J. W. Thatcher, editors, Complexity of Computer Computations, pages 85 -- 103. Plenum Press, 1972. [40] Subhash Khot, Guy Kindler, Elchanan Mossel, and Ryan O'Donnell. Optimal inapproxima- bility results for max-cut and other 2-variable csps? SIAM J. Comput., 37:319 -- 357, April 2007. 18 [41] Andreas Krause, AjitSingh, and Carlos Guestrin. Near-optimal sensor placements in gaussian processes: Theory, efficient algorithms and empirical studies. J. Mach. Learn. Res., 9:235 -- 284, January 2008. [42] Andreas Krause and Carlos Guestrin. Near-optimal nonmyopic value of information in graph- ical models. In UAI, page 5, 2005. [43] Andreas Krause and Carlos Guestrin. Near-optimal observation selection using submodular functions. In AAAI, pages 1650 -- 1654. AAAI Press, 2007. [44] Andreas Krause, Jure Leskovec, Carlos Guestrin, Jeanne VanBriesen, and Christos Faloutsos. Efficient sensor placement optimization for securing large water distribution networks. Journal of Water Resources Planning and Management, 134(6):516 -- 526, November 2008. [45] Michael Lewin, Dror Livnat, and Uri Zwick. Improved rounding techniques for the max 2-sat and max di-cut problems. In IPCO, pages 67 -- 82, 2002. [46] Hui Lin and Jeff Bilmes. Multi-document summarization via budgeted maximization of sub- modular functions. In North American chapter of the Association for Computational Linguis- tics/Human Language Technology Conference (NAACL/HLT-2010), Los Angeles, CA, June 2010. [47] Hui Lin and Jeff Bilmes. A class of submodular functions for document summarization. In HLT, pages 510 -- 520, 2011. [48] Shiro Matuura and Tomomi Matsui. 0.863-approximation algorithm for max dicut. In AP- PROX, pages 138 -- 146, 2001. [49] Elchanan Mossel, Ryan O'Donnell, and Krzysztof Oleszkiewicz. Noise stability of functions with low influences: invariance and optimality. In FOCS, pages 21 -- 30, 2005. [50] G. L. Nemhauser and L. A. Wolsey. Best algorithms for approximating the maximum of a submodular set function. Mathematics of Operations Research, 3(3):177 -- 188, 1978. [51] G. L. Nemhauser, L. A. Wolsey, and M. L. Fisher. An analysis of approximations for maxi- mizing submodular set functions -- I. Mathematical Programming, 14:265 -- 294, 1978. [52] Andreas S. Schulz and Nelson A. Uhan. Approximating the least core value and least core of cooperative games with supermodular costs. Discrete Optimization, 10(2):163 -- 180, 2013. [53] Luca Trevisan, Gregory B. Sorkin, Madhu Sudan, and David P. Williamson. Gadgets, approx- imation, and linear programming. SIAM J. Comput., 29:2074 -- 2097, April 2000. [54] Ashwinkumar Badanidiyuru Varadaraja. Buyback problem - approximate matroid intersection with cancellation costs. In Luca Aceto, Monika Henzinger, and Jir´ı Sgall, editors, Automata, Languages and Programming, volume 6755 of Lecture Notes in Computer Science, pages 379 -- 390. Springer Berlin Heidelberg, 2011. [55] Ashwinkumar Badanidiyuru Varadaraja and Robert Kleinberg. Randomized online algorithms for the buyback problem. In WINE, pages 529 -- 536, 2009. [56] Jan Vondr´ak. Symmetry and approximability of submodular maximization problems. SIAM J. Comput., 42(1):265 -- 304, 2013. 19 A Proof of Theorem 1.1 In this section we prove Theorem 1.1. Namely, we need to show that no algorithm using no preemption is (1/4 + ε)-competitive for any constant ε > 0 even when f is guaranteed to be a cut function of a weighted directed graph and there is no constraint on the set of elements that can be picked. Assume for the sake of contradiction that there exists such an algorithm ALG for some, fixed, ε > 0. We design an adversary that constructs an instance for ALG that leads to a contradiction. The adversary uses a ground set N with n = n(ε) elements (where n(ε) is function that depends only on ε and is described later). Each time an element ui is revealed the adversary uses the properties of ALG to choose the weighted set Ei of arcs that leaves ui. The objective function f is defined as the weighted cut function of the graph (N ,Sn i=1 Ei). Notice that any query of f made by ALG before ui is revealed does not depend on Ei, and thus, the behavior of ALG up to the point when ui is revealed can be described before Ei, Ei+1, . . . , En are determined. An exact description of the adversary is given as Algorithm 4. For ease of notation, we denote by Ni the set {uj 1 ≤ j ≤ i} for every 0 ≤ i ≤ n. Algorithm 4: Adversary for ALG 1 Let m ← 1 + 4/ε, n0 ← ⌈8/ε⌉ and n = ⌈e8/ε · n0⌉. 2 Let Mode ← A. 3 for i = 1 to n do 4 if Mode = A then 5 6 7 8 9 10 11 12 13 Reveal element ui with arcs of weight mi going to all nodes revealed so far. else // If Mode = B Reveal element ui with no exiting arcs. for every set S ⊆ Vi−1 do Let Ai,S be the event that the algorithm accepted exactly the elements of S before ui is revealed. Let pi,S be the probability of Ai,S. Let qi,S be the probability ui is accepted given Ai,S. if i ≥ n0 and PS⊆Ni−1hpi,S · qi,S ·(cid:16)1 − S Mode ← B. i−1(cid:17)i < 1/4 + ε/4 then Observe that Algorithm 4 operates in two modes. In mode A every revealed element has an arc going to every previously revealed element. In mode B the revealed elements have no exiting arcs (i.e., their output degrees are 0). The adversary starts in mode A and then switches permanently to mode B when some condition holds for the first time. Lemma A.1. The adversary given by Algorithm 4 never switches to mode B. Proof. Assume for the sake of contradiction that the adversary switches to mode B immediately after element ui is revealed. Let us upper bound the weight of the cut C produced by ALG in this case. If ALG accepted a set S ⊆ Si−1 of elements before ui is revealed, then the expected number i−1(cid:17). By the linearity of the expectation, the of arcs leaving ui crossing C is (i − 1) · qi,S ·(cid:16)1 − S 20 expected number of arcs leaving ui crossing C is: (i − 1) · XS⊆Ni−1(cid:20)pi,S · qi,S ·(cid:18)1 − S i − 1(cid:19)(cid:21) < (i − 1) · (1/4 + ε/4) . The total weight of all arcs leaving elements other than ui is: i−1 Xj=1 [(j − 1) · mj] ≤ (i − 1) · i−1 Xj=1 mj ≤ (i − 1) · ∞ Xj=0 mi−1−j = (i − 1) · mi m − 1 = (i − 1)mi · ε 4 . Hence, even if all the above arcs cross C, the total weight of C is still less than (i−1)mi·(1/4+ε/2). On the other hand, the optimal solution may accept ui and no other elements, which results in a cut of weight (i − 1)mi. Hence, the competitive ratio of ALG cannot be 1/4 + ε. Let us denote ti,S = 1 − S n0 ≤ i ≤ n: i−1 . Using this notation the previous lemma implies that for every XS⊆Ni−1 (pi,S · qi,S · ti,S) ≥ 1/4 + ε/2 . i,S(cid:17). Consider the potential function Φ(i) =PS⊆Ni−1(cid:16)pi,S · t2 Observation A.2. For every 1 ≤ i ≤ n − 1, Φ(i + 1) − Φ(i) = XS⊆Ni−1(cid:18)pi,S ·(cid:20) [(i − 1)ti,S + (1 − qi,S)]2 i2 i,S(cid:21)(cid:19) − t2 = XS⊆Ni−1 pi,S · (1 − 2i)t2 i,S + 2(i − 1)ti,S(1 − qi,S) + (1 − qi,S)2 i2 ! . Proof. Let Bi be the expected set of elements accepted by ALG immediately after ui is revealed. Notice that: Observe also that E[Bi Ai,S] = E[S + qi,S Ai,S]. Hence, by the linearity of the expectation. Ai,S#! . Φ(i + 1) = E"(cid:18)1 − Bi Φ(i + 1) = XS⊆Ni−1 pi,S · E"(cid:18)1 − S + qi,S i (cid:19)2 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i (cid:19)2# = XS⊆Ni−1 pi,S · E"(cid:18)1 − Bi (cid:19)2 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Ai,S#! (cid:19)2! = XS⊆Ni−1 pi,S ·(cid:18)1 − (1 − ti,S)(i − 1) + qi,S = XS⊆Ni−1 pi,S ·(cid:18) ti,S(i − 1) + (1 − qi,S) (cid:19)2! . i i i The observation follows by combining the above equality with the definition of Φ(i). Using the above observation, we can now prove the following lemma. 21 Lemma A.3. For every n0 ≤ i ≤ n − 1, Φ(i + 1) − Φ(i) ≤ −ε/(4i). Proof. By Observation A.2, Φ(i + 1) − Φ(i) = XS⊆Ni−1 pi,S · (1 − 2i)t2 i,S + 2(i − 1)ti,S(1 − qi,S) + (1 − qi,S)2 i2 ! i,S + i · ti,S · (1 − qi,S) + 1 i2 ! ≤ 2 · XS⊆Ni−1 pi,S · −i · t2 i · XS⊆Ni−1 = 2 (pi,S · ti,S · (1 − qi,S − ti,S)) + 2 i2 . Notice that ti,S · (1− qi,S − ti,S) = ti,S · (1− ti,S)− ti,S · qi,S ≤ 1/4− ti,S · qi,S. Plugging this inequality into the previous one yields: Φ(i + 1) − Φ(i) ≤ (pi,S · (1/4 − ti,S · qi,S)) + 2 i2 = 2 i · XS⊆Ni−1 2 i · [1/4 − (1/4 + ε/4)] + + 2 i2 ≤ − 2 i · 1/4 − XS⊆Ni−1  = − ε 4i ε 2i ε 4i + pi,S · ti,S · qi,S  , + 2 i2 ≤ 2 ε i2 = − 2i where the third inequality holds since i ≥ n0 ≥ 8/ε. Corollary A.4. Φ(n) ≤ Φ(n0) − 2. Proof. By Lemma A.3, Φ(n) − Φ(n0) = n−1 Xi=n0 [Φ(i + 1) − Φ(i)] ≤ − 4 ·Z n ≤ − = − dx x n0 ε ε 4i n−1 Xi=n0 ε 4 · ln(n/n0) ≤ − ε 4 · ln(n0 · e8/ε/n0) = −2 . Corollary A.4 leads to an immediate contradiction since Φ can only take values from the range [0, 1]. B A Polynomial Time Implementation of Algorithm 1 In this section we prove the second part of Theorem 1.2 by giving a polynomial time implemen- tation of Algorithm 1 having the same competitive ratio up to an arbitrary constant ε > 0. Our implementation is given as Algorithm 5. This algorithms uses the notation Tθ(x), where x is a vector and θ ∈ [0, 1]. This notation stands for {u xu ≥ θ}, i.e., the set of all elements whose coordinate in x is at least θ. Our first objective is to show that Algorithm 5 is an online algorithm according to the unconst- rained-model. Lemma B.1. For every 1 ≤ i ≤ n, Si ⊆ Si−1 + ui. 22 Algorithm 5: Marginal Choice - Polynomial Time Implementation 1 foreach element ui revealed do 2 3 4 5 6 7 8 9 10 Choose a uniformly random threshold θi ∈ [0, 1]. Let Ni ← {u1, u2, . . . , ui}. Let Vi be a collections of ⌈3072 · ε−2i4 ln[2ε−1(4i)2]⌉ random vectors from [0, 1]Ni . for j = 1 to i − 1 do for every vector v ∈ Vj do Extend v to be a vector of [0, 1]Ni by setting vui to be an independent uniformly random value from [0, 1]. for j = 1 to i do mj ← Vj−1 ·Pv∈Vj Let Si ← {uj ∈ Ni mj ≥ 0}. [f (Tθj (v) + uj) − f (Tθj (v) − uj)]. /* mj ≈ ∂uj F (θj · Ni). */ Proof. For i = 1 the claim is trivial since S1 can contain only u1. Thus, we assume from now on i > 1. For every 1 ≤ j ≤ i − 1, let mj and Vj denote the value mj and the set Vj after iteration i − 1, and let m′j and V′j denote these entities after iteration i. By definition, Si contains only elements of Ni. Fix an element uj ∈ Ni − ui. Then: j uj ∈ Si ⇒ Pv∈V ′ ⇒ Pv∈Vj [f (Tθj (v) + uj) − f (Tθj (v) − uj)] [f (Tθj (v) + uj) − f (Tθj (v) − uj)] Vj Vj = m′j ≥ 0 = mj ≥ 0 ⇒ uj ∈ Si−1 , where the second derivation follows from submodularity since V′j is produced from Vj by extending vectors. To bound the loss in the competitive ratio of Algorithm 5, we need the following claims. Observation B.2. For every 1 ≤ i ≤ n, each set in Vi is an independent sample of [0, 1]N . Proof. Follows immediately by the way Algorithm 5 constructs Vi and the way this collection is updated when new elements arrive. Lemma B.3. Let X1, X2, . . . , Xℓ be independent random variables such that for each i, Xi ∈ [−1, 1]. Let X = 1 ℓ Pℓ i=1 Xi and µ = E[X]. Then Pr[X > µ + α] ≤ e− α2ℓ 12 and Pr[X < µ − α] ≤ e− α2ℓ 8 , for every α > 0. Proof. For every 1 ≤ i ≤ ℓ, let Yi = (1 + Xi)/2. Additionally, let Y =Pℓ Hence, by the Chernoff bound: i=1 Yi. Clearly, Yi ∈ [0, 1]. Pr[X > µ + α] = Pr[2Y /ℓ − 1 > 2E[Y ]/ℓ − 1 + α] = Pr(cid:20)Y > E[Y ] + αℓ 2 (cid:21) ≤ e− E[Y ](αℓ/(2·E[Y ]))2 3 = e− α2ℓ2 12·E[Y ] ≤ e− α2ℓ 12 , 23 and Pr[X < µ − α] = Pr[2Y /ℓ − 1 < 2E[Y ]/ℓ − 1 − α] = Pr(cid:20)Y < E[Y ] − αℓ 2 (cid:21) ≤ e− E[Y ](αℓ/(2·E[Y ]))2 2 = e− α2ℓ2 8·E[Y ] ≤ e− α2ℓ 8 . Let mi(z) be the value that mi gets after the last iteration of Algorithm 5 if the random variable θi is z. Lemma B.4. For every 1 ≤ i ≤ n and z ∈ [0, 1], Pr[mi(z) − ∂uiF (z · N ) > ε(4i)−2 · f (OP T )] ≤ ε(4i)−2. Proof. Observe that mi is obtained by averaging Vi independent samples of f (R(z · N ) + ui) − f (R(z·N )−ui), and the expectation of the last expression is ∂uiF (z·N ). Additionally, observe that every sample belongs to the range [−f (OP T ), f (OP T )] since f (OP T ) = maxS⊆N f (S). Hence, by Lemma B.3, −Vi·[ε(4i)−2]2 12 Pr[mi(z) − ∂uiF (z · N ) > ε(4i)−2 · f (OP T )] ≤ 2e Fix the vectors V = (V1,V2, . . . ,Vn). For every element ui ∈ N , mi(z) is continuous non- increasing function of z by submodularity. Hence, by the intermediate value theorem, one of the following must hold: mi(z) is always positive in the range [0, 1], mi(z) is always negative in the range [0, 1] or mi(z) has at least one root z0 ∈ [0, 1]. In the last case, the set I0 ⊆ [0, 1] of the roots of mi(z) is non-empty. Moreover, by the monotonicity and continuity of mi(z), I0 is a closed range. Using these observations, we define a vector y(V) ∈ [0, 1]N as follows: ≤ 2e− ln[2ε−1(4i)2] = ε(4i)−2 . 0 1 max I0 if mi(0) < 0 , if mi(1) > 0 , otherwise . y(V)ui =  Let Ei be the event that ∂uiF (z·N ) ≥ −ε(4i)−2·f (OP T ) for every z < y(V)ui and ∂uiF (z·N ) ≤ ε(4i)−2 · f (OP T ) for every z > y(V)ui. Lemma B.5. For every 1 ≤ i ≤ n, the event Ei holds with probability at least 1 − 2ε(4i)−2. Proof. Let us first bound the probability that ∂uiF (z·N ) ≥ −ε(4i)−2·f (OP T ) for every z < y(V)ui. If ∂uiF (z · N ) is always at least −ε(4i)−2 · f (OP T ), then there is nothing to prove. Otherwise, if ∂uiF (z · N ) is always at most −ε(4i)−2 · f (OP T ), then ∂uiF (∅) ≤ 0, which guarantees that y(V)ui = 0, and thus, makes the claim that we want to prove void. Hence, it is enough to consider the case in which ∂uiF (z · N ) is at least −ε(4i)−2 · f (OP T ) for some value of z and at most −ε(4i)−2 · f (OP T ) for another value of z. In this case the intermediate value theorem and the continuity of ∂uiF (z·N ) imply the existence of a value y′i such that ∂uiF (y′i·N ) = −ε(4i)−2·f (OP T ). By Lemma B.4, mi(y′i) ≤ 0 with probability at least 1 − ε(4i)−2, which implies y(V)ui ≤ y′i, and thus: ∂uiF (y(V)ui · N ) ≥ ∂uiF (y′i · N ) = −ε(4i)−2 · f (OP T ) . Observe that the last inequality implies that ∂uiF (z·N ) ≥ −ε(4i)−2· f (OP T ) for every z < y(V)ui. A similar argument shows that ∂uiF (z · N ) ≤ ε(4i)−2 · f (OP T ) for every z > y(V)ui with probability at least 1 − ε(4i)−2. The lemma now follow by the union bound. Let E be the event that Ei holds for every 1 ≤ i ≤ n at the same time. 24 Corollary B.6. E happens with probability at least 1 − ε/2. Proof. Combining Lemma B.5 and the union bound gives: Pr[E] ≥ 1 − n Xi=1 2ε(4i)−2 ≥ 1 − ε 8 −Z n 1 2ε(4x)−2dx = 1 − ε 8 + 1 ≥ 1 − ε 2 . n ε 8x(cid:12)(cid:12)(cid:12) It is important to notice that the event E depends only on the vectors V. Thus, fixing the vectors V does not affect the distribution of θ1, θ2, . . . , θn. Next, we analyze the competitive ratio of Algorithm 5 assuming V is fixed in a way that makes the event E hold. The next observation corresponds to Observation 3.2. Observation B.7. For every given vectors V, every element ui ∈ N belongs to Sn with probability y(V)ui, independently. Hence, E[f (Sn)] = F (y(V)). Proof. An element ui ∈ N belongs to Sn if and only if mi(θi) ≥ 0, which is equivalent to the condition θi ≤ y(V)ui since mi is a non-increasing function. Clearly, the last condition happens with probability y(V)ui, and is independent for different elements. The last observation implies that analyzing Algorithm 5 is equivalent to lower bounding F (y(V)). The next lemma and corollary correspond to Lemma 3.3 and Corollary 3.5, respectively. Lemma B.8. For every given vectors V for which the event E holds and for every λ ∈ [0, 1], F (y(V) ∧ (λ · N )) ≥ F (λ · N ) − ε ·Pn Proof. For ease of notation, we use y as a shorthand for y(V) in this proof. Observe that: i=1(4i)−2 · f (OP T ). F (y ∧ (λ · N )) = f (∅) +Z λ 0 dF (y ∧ (z · N )) dz dz = f (∅) +Z λ 0 Xu∈Nz≤yu ∂uF (y ∧ (z · N ))dz , where the second equality is due to the chain rule. By submodularity and the observation that E implies ∂uiF (z · N ) ≤ ε(4i)−2 · f (OP T ) for every z > yui, we get: Xu∈Nz≤yu ∂uF (y ∧ (z · N )) ≥ Xu∈Nz≤yu ∂uF (z · N ) ≥ Xu∈N ∂uF (z · N ) − ε · n Xi=1 (4i)−2 · f (OP T ) . Combining the above equality and inequality, and using the chain rule again, gives: 0 "Xu∈N F (y ∧ (λ · N )) ≥ f (∅) +Z λ = f (∅) +Z λ = F (λ · N ) − ε · 0 n dF (z · N ) n dz dz − ε · Xi=1 Xi=1 (4i)−2 · f (OP T ) . ∂uF (z · N )# dz − ε · n Xi=1 (4i)−2 · f (OP T ) (4i)−2 · f (OP T ) Corollary B.9. For every given vectors V for which the event E holds, F (y(V)) ≥ (e−1 − ε/2) · F (OP T ). 25 Proof. Again, we use y as a shorthand for y(V) in this proof. Fix two values 0 ≤ a ≤ b ≤ 1. By the chain rule: F (y ∧ (b · N )) − F (y ∧ (a · N )) = Z b = Z b a dF (y ∧ (z · N )) dz dz (4) a Xu∈Nz≤yu ∂uF (y ∧ (z · N ))dz ≥Z b a Xu∈Nz≤yu ∂uF (z · N )dz , where the inequality follows from submodularity. We use two ways to lower bound the rightmost hand side of the above inequality. First, observe that ∂uiF (z · N ) ≥ −ε(4i)−2 · f (OP T ) whenever z < yui. Thus, F (y ∧ (b · N )) − F (y ∧ (a · N )) ≥ −ε(b − a) ·Pn i=1(4i)−2 · f (OP T ). Additionally, ∂uF (z · N ) ≤ ε(4i)−2 · f (OP T ) whenever z > yu and ∂uF (z · N ) ≥ −ε(4i)−2 · f (OP T ) whenever z < yu. This allows us to derive the second lower bound, which holds whenever z is not equal to any coordinate of y (i.e., for every value of z except for a finite set of values): Xu∈Nz≤yu ∂uF (z · N ) ≥ Xu∈OP T ∂uF (z · N ) − ε · n Xi=1 (4i)−2 · f (OP T ) n 1 − z = Pu∈OP T [F (u ∨ (z · N )) − F (z · N )] (4i)−2 · f (OP T ) Xi=1 − ε · F (OP T ∨ (z · N )) − F (z · N ) Xi=1 (4i)−2 · f (OP T ) − ε · ≥ − ε ·(cid:18)1 + 1 − b(cid:19) · 1 1 − z F (y ∧ (z · N )) ≥ f (OP T ) − 1 − z n n Xi=1 (4i)−2 · f (OP T ) , where the last inequality follows from Lemmata B.8 and 3.4. Plugging this lower bound and a = 0 into (4) gives: F (y ∧ (b·N )) ≥ f (∅) +Z b 0 "f (OP T ) − 1 − z The solution of this differential equation is: F (y ∧ (z · N )) − ε ·(cid:18)1 + 1 1 − b(cid:19) · n Xi=1 (4i)−2 · f (OP T )# dz . F (y ∧ (b · N )) ≥ −(1 − b) · ln(1 − b) · 1 − ε ·(cid:18)1 + 1 1 − b(cid:19) · n Xi=1 (4i)−2! · f (OP T ) . Choosing b = 1 − e−1, we get: n n F (y) = F (y ∧ (1 · N )) ≥ F (y ∧ ((1 − e−1) · N )) − εe−1 · Xi=1 Xi=1 (4i)−2 · f (OP T ) (4i)−2! · f (OP T ) − εe−1 · ≥ e−1 1 − 4ε · Xi=1 (4i)−2! · f (OP T ) . ≥ e−1 − 4ε · Xi=1 n n (4i)−2 · f (OP T ) 26 The corollary now follows by observing that: n 4 · (4i)−2 ≥ Xi=1 1 4 + 4 ·Z n 1 dx (4x)2 = 1 4 − n 1 < 1 4 + 1 4 = 1 2 . 1 4x(cid:12)(cid:12)(cid:12)(cid:12) We are now ready to prove the competitive ratio of Algorithm 5, and complete the proof of Theorem 1.2. Lemma B.10. Algorithm 5 has a competitive ratio of at least e−1 − ε. Proof. By Observation B.7, the expected value of the set produced by Algorithm 5 is E[F (y(V))]. By the law of total expectation: E[F (y(V))] ≥ Pr[E] · E[F (y(V)) E] ≥ (1 − ε/2) · (e−1 − ε/2) · f (OP T ) ≥ (e−1 − ε) · f (OP T ) , where the second inequality holds by Corollaries B.6 and B.9. C A Polynomial Time Implementation of Algorithm 3 for the Ob- jective g(S) In this section we present a polynomial time implementation of Algorithm 3 that can be used to get a set S obeying g(S) ≥ (56/627 − ε) · f (OP T ), for any constant ε > 0, and thus, together with the rounding described in Section 4, proves the second part of Theorem 1.5. The polynomial time implementation is given as Algorithm 6. Algorithm 6: Greedy with Theshold for Non-monotone Functions - Polynomial Time Implemen- tation(c, p) 1 Let S0 ← ∅. 2 foreach element ui revealed do 3 4 5 6 7 8 9 10 11 12 if i ≤ pk then Let Si ← Si−1 + ui. else for each u ∈ Si−1 do Approximate mu,i = g(Si−1 + ui − u′i) − (1 + c/(pk)) · g(Si−1) = E[f (R(p−1(Si−1 + ui − u′i))) − (1 + c/(pk)) · f (R(p−1 · Si−1))] using ℓ = ⌈50000ε−2i6(p + c)2 ln[2ε−1pk(2i)2]⌉ samples. Let u′i be the element of Si−1 maximizing mu′ i,i. if mu′ i,i ≥ 0 then Let Si ← Si−1 + ui − u′i. else Let Si ← Si−1. 27 Lemma C.1. Every value mu,i calculated by Algorithm 6 obeys: Pr[mu,i − g(Si−1 + ui − u′i) + (1 + c/(pk)) · g(Si−1) ≤ ε(4i)−3 · f (OP T )] ≤ εp−1k−1(2i)−2 . Proof. The value mu,i is calculated by averaging ℓ samples. For every set S of size at most pk, submodularity implies f (S) ≤ p · f (OP T ). Hence, each sample must belong to the range [−(p + c/k) · f (OP T ), p · f (OP T )]. Thus, by Lemma B.3, Pr[mu,i − g(Si−1 + ui − u′i) + (1 + c/(pk)) · g(Si−1) ≤ ε(4i)−3 · f (OP T )] ≤ 2e− ℓ[ε(4i)−3/(p+c)]2 12 ≤ 2e− ln[2ε−1pk(2i)2] = εp−1k−1(2i)−2 . Corollary C.2. With probability at least 1− ε/2, all the values mu,i calculated by Algorithm 6 are accurate approximations up to an error of ε(4i)−3 · f (OP T ). Proof. For every 1 ≤ i ≤ n, Algorithm 6 approximates at most pk different mu,i values. Hence, by the union bound, the probability that all these approximations are correct up to an error of ε(4i)−3 · f (OP T ) is at least: 1 − pk · n Xi=1 (εp−1k−1(2i)−2) = 1 − ε · n Xi=1 (2i)−2 ≥ 1 − ε 4 − ε ·Z n 1 dx 4x = 1 − ε 4 + n 1 > 1 − ε 2 . ε 4x(cid:12)(cid:12)(cid:12) Let E be the event that Corollary C.2 holds. As in Section 4, for every 0 ≤ i ≤ n we define j=1Sj. The following two lemmata correspond to Lemmata 4.4 and 4.5. Ai = ∪i Lemma C.3. Assuming E holds, then for every pk < i ≤ n, g(Si−1 + ui − u′i) − g(Si−1) ≥ g(ui Ai−1) − g(Si−1)/(pk) − 2ε(4i)−3 · f (OP T ). Proof. By the choice of u′i and an averaging argument, i,i + c/(pk) · g(Si−1) − ε(4i)−3 · f (OP T ) [mu′,i + c/(pk) · g(Si−1) − ε(4i)−3 · f (OP T )] [g(Si−1 + ui − u′) − g(Si−1) − 2ε(4i)−3 · f (OP T )] g(Si−1 + ui − u′i) − g(Si−1) ≥ mu′ ≥ Pu′∈Si−1 ≥ Pu′∈Si−1 ≥ Pu′∈Si−1 [g(Si−1 + ui) − g(Si−1)] pk pk + Pu′∈Si−1 [g(Si−1 − u′) − g(Si−1)] pk − 2ε(4i)−3 · f (OP T ) , where the last inequality follows from submodularity. The first term on the rightmost hand side is g(ui Si−1), which can be lower bounded by g(ui Ai−1) because Si−1 ⊆ Ai−1. The second term on the rightmost hand side can be lower bounded using the submodularity and non-negativity of g as follows: pk Pu′∈Si−1 [g(Si−1 − u′) − g(Si−1)] pk g(∅) − g(Si−1) pk g(Si−1) pk ≥ − . ≥ The following lemma relates Si and Ai. Lemma C.4. Assuming E holds, then for every 0 ≤ i ≤ n, g(Si) ≥ c f (OP T ) ≥ g(Ai) − ε/4 · f (OP T ). c+1 · g(Ai) − 2ε ·Pi j=1(4j)−3 · 28 Proof. The second inequality holds since Pi +Z i (4j)−3 ≤ 1 32 2 · 1 i Xj=1 j=1(4j)−3 = 0 for i = 0 and for i > 0: dx 32x3 = 1 32 − < 1 32 + 1 64 < 1 4 . i 1 1 64x2(cid:12)(cid:12)(cid:12)(cid:12) Hence, in the rest of the proof we concentrate on proving the first inequality. For i = 0, the inequality clearly holds since g(A0) = g(∅) = g(S0). Thus, it is enough to prove that for every 1 ≤ i ≤ n, g(Si) − g(Si−1) ≥ c c+1 · [g(Ai) − g(Ai−1)] − 2ε(4i)−3 · f (OP T ). If the algorithm does not accept ui then Si = Si−1 and Ai = Ai−1, and the claim is trivial. Hence, we only need to consider the case in which the algorithm accepts element ui. If i ≤ k then g(Si) − g(Si−1) = g(ui Si−1) ≥ g(ui Ai−1) = g(Ai) − g(Ai−1), where the inequality follows from submodularity since Si−1 ⊆ Ai−1. If i > k, then it is possible to lower bound g(Si) − g(Si−1) = g(Si−1 + ui − u′i) − g(Si−1) in two ways. First, a lower bound of g(ui Ai−1)− g(Si−1)/k− 2ε(4i)−3 · f (OP T ) is given by Lemma 4.1. The second lower bound states that, since the algorithm accepts ui, g(Si−1 + ui − u′i) − g(Si−1) ≥ mu′ i,i + c · g(Si−1)/(pk) − ε(4i)−3 · f (OP T ) ≥ c · g(Si−1)/(pk) − ε(4i)−3 · f (OP T ) . Using both lower bounds, we get: g(Si) − g(Si−1) ≥ max(cid:26)g(ui Ai−1) − g(Si−1) pk , c · g(Si−1) pk (cid:27) − 2ε(4i)−3 · f (OP T ) ≥ ≥ = c · [g(ui Ai−1) − g(Si−1)/(pk)] + 1 · [c · g(Si−1)/(pk)] c c + 1 · g(ui Ai−1) − 2ε(4i)−3 · f (OP T ) c c + 1 · [g(Ai) − g(Ai−1)] − 2ε(4i)−3 · f (OP T ) . c + 1 − 2ε(4i)−3 · f (OP T ) We also need to show that g(Si) is roughly monotone as a function of i. Lemma C.5. Assuming E holds, then for pk < i ≤ n, g(Si) − g(Si−1) ≥ −ε(4i)−3 · f (OP T ). Proof. If Si = Si−1 then the claim is trivial. Otherwise, we must have mu′ i,i ≥ 0, and thus, g(Si) − g(Si−1) ≥ c · g(Si) pk − ε(4i)−3 · f (OP T ) ≥ −ε(4i)−3 · f (OP T ) . Corollary C.6. Assuming E holds, then for pk ≤ i ≤ n, g(Si) ≥ g(Sn) − ε(8i)2 · f (OP T ). Proof. By Lemma C.5, g(Sn) − g(Si) ≥ − ε · (4i)−3 · f (OP T ) ≥ −ε ·Z n i · f (OP T ) ≥ − ε n i n 1 Xj=i+1 128x2(cid:12)(cid:12)(cid:12)(cid:12) = ε · dx 64x3 · f (OP T ) 128i2 · f (OP T ) ≥ − ε (8i)2 · f (OP T ) . Using the above claims, it is possible to get a guarantee on g(Sn) assuming E holds. The following corollary corresponds to Corollary 4.7. 29 Corollary C.7. Assuming E holds, Algorithm 6 produces a set Sn such that: g(Sn) ≥(cid:18) cp−1(1 − p−1) (c + 1)(1 + p−1c) − ε 2(cid:19) · f (OP T ) . Proof. Consider an element ui ∈ OP T \ Ai. Since ui was rejected by Algorithm 6, we must have mu′ i,i < 0, which implies: c · g(Si−1) pk + ε(4i)−3 · f (OP T ) > g(Si−1 + ui − u′i) − g(Si−1) ≥ g(ui Ai−1) − g(Si−1) pk − 2ε(4i)−3 · f (OP T ) , where the second inequality follows from Lemma C.3. Rearranging yields: g(ui Ai−1) < c + 1 pk · g(Si−1) + 3ε(4i)−3 · f (OP T ) ≤ c + 1 pk · g(Sn) + 4ε(8i)−2 · f (OP T ) , where the last inequality uses Corollary C.6. By the submodularity of g and Lemma C.4, we now get: g(An ∪ OP T ) ≤ g(An) + Xu∈OP T\An g(ui An) pk · g(Sn)(cid:19) + 4ε · < g(An) + Xu∈OP T\An(cid:18) c + 1 ≤ g(An) + p−1(c + 1) · g(Sn) + 4ε · c + 1 (c + 1)(1 + p−1c) n · g(Sn) + c ≤ c n Xi=1 (8i)−2 · f (OP T ) (8i)−2 · f (OP T ) Xi=1 ε 4 · f (OP T ) + 4ε · · n Xi=1 (8i)−2 · f (OP T ) . Observe now that: n 4ε · Xi=1 (8i)−2 · f (OP T ) ≤ ε 16 +Z n 1 dx 16x2 = ε 16 − and, by Lemma 4.6, n 1 ≤ 1 16x(cid:12)(cid:12)(cid:12)(cid:12) ε 16 + 1 16 < ε 4 , g(An ∪ OP T ) = F (p−1 · OP T + p−1 · (An \ OP T )) ≥ p−1(1 − p−1) · f (OP T ) . Combining the three last inequalities yields: (cid:20)p−1(1 − p−1) − c + 1 c · ε 2(cid:21) · f (OP T ) ≤ (c + 1)(1 + p−1c) c · g(Sn) . The corollary now follow by dividing the last inequality by (c+1)(1+p−1c) p−1c ≥ 1. Corollary C.8. Algorithm 6 produces a set Sn such that: c and observing that 1 + E[g(Sn)] ≥(cid:18) cp−1(1 − p−1) (c + 1)(1 + p−1c) − ε(cid:19) · f (OP T ) . Hence, for c = 7/4 and p = 3, g(Sn) ≥ (56/627 − ε) · f (OP T ). 30 Proof. By the law of total expectation, E[g(Sn)] ≥ Pr[E] · E[g(Sn) E] ≥ (1 − ε/2) ·(cid:18) cp−1(1 − p−1) (c + 1)(1 + p−1c) − ≥ (cid:18) cp−1(1 − p−1) (c + 1)(1 + p−1c) − ε(cid:19) · f (OP T ) , ε 2(cid:19) · f (OP T ) where the second inequality holds by Corollaries C.2 and C.7. 31
1807.11538
2
1807
2018-11-18T19:13:46
On Approximating (Sparse) Covering Integer Programs
[ "cs.DS" ]
We consider approximation algorithms for covering integer programs of the form min $\langle c, x \rangle $ over $x \in \mathbb{N}^n $ subject to $A x \geq b $ and $x \leq d$; where $A \in \mathbb{R}_{\geq 0}^{m \times n}$, $b \in \mathbb{R}_{\geq 0}^m$, and $c, d \in \mathbb{R}_{\geq 0}^n$ all have nonnegative entries. We refer to this problem as $\operatorname{CIP}$, and the special case without the multiplicity constraints $x \le d$ as $\operatorname{CIP}_{\infty}$. These problems generalize the well-studied Set Cover problem. We make two algorithmic contributions. First, we show that a simple algorithm based on randomized rounding with alteration improves or matches the best known approximation algorithms for $\operatorname{CIP}$ and $\operatorname{CIP}_{\infty}$ in a wide range of parameter settings, and these bounds are essentially optimal. As a byproduct of the simplicity of the alteration algorithm and analysis, we can derandomize the algorithm without any loss in the approximation guarantee or efficiency. Previous work by Chen, Harris and Srinivasan [12] which obtained near-tight bounds is based on a resampling-based randomized algorithm whose analysis is complex. Non-trivial approximation algorithms for $\operatorname{CIP}$ are based on solving the natural LP relaxation strengthened with knapsack cover (KC) inequalities [5,24,12]. Our second contribution is a fast (essentially near-linear time) approximation scheme for solving the strengthened LP with a factor of $n$ speed up over the previous best running time [5]. Together, our contributions lead to near-optimal (deterministic) approximation bounds with near-linear running times for $\operatorname{CIP}$ and $\operatorname{CIP}_{\infty}$.
cs.DS
cs
On Approximating (Sparse) Covering Integer Programs∗ Chandra Chekuri Kent Quanrud November 20, 2018 Abstract We consider approximation algorithms for covering integer programs of ≥0 , b ∈ Rm ≥0 s.t. Ax ≥ b and x ≤ d; where A ∈ Rm×n the form min hc, xi over x ∈ Zn ≥0, and c, d ∈ Rn ≥0 all have nonnegative entries. We refer to this problem as CIP, and the special case without the multiplicity constraints x ≤ d as CIP∞. These problems generalize the well-studied Set Cover problem. We make two algorithmic contributions. First, we show that a simple algorithm based on randomized rounding with alteration im- proves or matches the best known approximation algorithms for CIP and CIP∞ in a wide range of parameter settings, and these bounds are essentially optimal. As a byproduct of the simplicity of the alteration algorithm and analysis, we can derandomize the algorithm without any loss in the approximation guarantee or efficiency. Previous work by Chen, Harris and Srinivasan [12] which obtained near-tight bounds is based on a resampling-based randomized algorithm whose analysis is complex. Non-trivial approximation algorithms for CIP are based on solving the natural LP relaxation strengthened with knapsack cover (KC) inequalities [5, 25, 12]. Our second contribution is a fast (essentially near-linear time) approximation scheme for solving the strengthened LP with a factor of n speed up over the previous best running time [5]. To achieve this fast algorithm we combine recent work on accelerating the multiplicative weight update framework with a partially dynamic approach to the knapsack covering problem. Together, our contributions lead to near-optimal (deterministic) approximation bounds with near-linear running times for CIP and CIP∞. ∗This work is partially supported by NSF grant CCF-1526799. University of Illinois, Urbana-Champaign, IL 61801. {chekuri,quanrud2}@illinois.edu. 1 Introduction Set Cover is a fundamental problem in discrete optimization with many applications and connections to other problems. A number of variants and generalization of Set Cover have been studied over the years. In this paper we consider a general problem that captures many of these as special cases. This is the minimum cost covering integer program problem (CIP for short). It is a class of integer programs of the form minimize hc, xi over x ∈ Zn ≥0, and c, d ∈ Rn ≥0 s.t. Ax ≥ b and x ≤ d, (CIP) ≥0 , b ∈ Rm where A ∈ Rm×n ≥0 all have nonnegative coefficients. We let N = kAk0 + kbk0 + kck0 + kdk0 > m + n denote the total number of nonzeroes in the input. Let C ≥ 1 be such that Ai,j ∈ {0} ∪ [1/C, C] for all i and j; log C reflects the number of bits required to write down a coefficient of Ai,j. Since we are interested in integer solutions we can assume, without loss of generality, that d ∈ Zn and Ai,j ≤ bi for all i, j. An important special case of CIP is when there are no multiplicity constraints, in other words, dj = ∞ for all j. We refer to this problem as CIP∞. CIP and CIP∞ can be understood combinatorially as multiset multicover problems, particularly if we assume for convenience that A and b have integer entries. The elements that need to be covered correspond to the rows of A, (say) the element ei for row i, for a total of m elements. For each element ei, bi is the requirement on the number of times ei needs to be covered. Each column j of A correspond to a multiset Sj. For each element ei and multiset Sj, Ai,j is the number of times Sj covers ei. Multiplicity constraints are specified by d; dj is the maximum number of copies of Sj that can be chosen. The cost of one copy of Sj is cj. The goal is to pick a minimum cost collection of multisets (with copies allowed) that together cover all the requirements of the elements, while respecting the multiplicity bounds on the sets. i Set Cover is a special case of CIP∞ where A is a {0, 1}-matrix and b = 1; Ai,j = 1 implies that element ei is in set Sj. In this setting the multiplicity bounds are irrelevant since at most one copy of a set is ever needed. Set Cover is NP-Hard and its approximability has been extensively studied. A simple greedy algorithm achieves an approximation of Hk ≤ (1 + ln k) ≤ (1 + ln m) Si is the maximum set size [39, 41]; here Hk = 1 + 1/2 + . . . + 1/k is the k'th where k = max harmonic number1. Unles P = N P there is no (1−δ) ln m approximation for any fixed δ > 0 [30, 18] where m is the number of elements2. Another approximation bound for Set Cover is f where f is the maximum frequency [22]; the frequency of an element is the number of sets that contain it. This bound is achieved via the natural LP relaxation. For any fixed f , Set Cover instances with maximum frequency f are hard to approximate to within a f − ǫ factor under UGC [2], and to within f − 1 − ǫ under P 6= N P [16]. The greedy algorithm for Set Cover can be easily generalized to CIP. Dobson [17] analyzed this extension and showed that, when all entries of A, b are integers, it has an approximation bound of Hd, Ai,j ≥ C is the maximum column sum3. The analysis for the greedy bound where d = max is tight, and the dependency on the maximum coordinate C is undesirable for several reasons. In particular, the entries in A and b can be rational, and the greedy algorithm's approximation 1≤j≤nXi 1We will be concerned with the setting of arbitrary costs for the sets. Unit-cost Set Cover admits some improved bounds and those will not be the focus here. 2It is common to use n for the number of elements and m for the number of sets. However, in the setting of covering integer programs, it is natural to use our notation in accordance with the usual notation for optimization where n is the number of decision variables and m is the number of constraints. See [25] among others. 3Wolsey's analysis [42] for the Submodular Set Cover problem further generalizes Dobson's result. 1 ratio can be as large as m [17] 4. The question of obtaining an improved approximation ratio that did not depend on C was raised in [17]. For CIP∞, when there are no multiplicity constraints, Raghavan and Thompson, in their influential work on randomized rounding, used the LP relaxation of (CIP) (which we refer to as Basic-LP) to obtain an O(log m) approximation [32]. Subsequent work has refined and improved this bound, and later we will describe recent approximation bounds by Chen et al. [12] that are much tighter w/r/t the sparsity of a given instance. In the presence of multiplicity constraints, Basic-LP has an un- Stronger LP Relaxation: bounded integrality gap even when m = 1, which corresponds to the Knapsack Cover problem. The input to this problem consists of n items with item i having cost ci and size ai, and the goal is to find a minimum cost subset of the items whose total size is at least a given quantity b. To illustrate the integrality gap of the LP relaxation consider the following simple example from [5]. min x1 over x1, x2 ≥ 0 s.t. Bx1 + (B − 1)x2 ≥ B and x1, x2 ≤ 1. It is easy to see that the optimum integer solution has value 1 while the LP relaxation has value 1/B, leading to an integrality gap of B. The example shows that the integrality gap is large even when d = 1, a natural and important setting. To overcome this gap, Carr et al. [5] suggested the use of knapsack cover (KC) inequalities to strengthen the LP. We describe the idea. For each S ⊆ [n], one can consider the residual covering constraints if we force xi = di for all i ∈ S. The residual system is called the knapsack covering con- , straint for S and written as ASx ≥ bS, where bS ∈ Rn is defined by bS,i = max and for j ∈ [m], AS,i,j is defined by Ai,jdj 0, bi −Xj∈S AS,i,j =(0 if j ∈ S, min{Ai,j, bS,i} otherwise. That is, for S ⊆ [n], we compute the residual demand bS, zero the coefficients in A of any contracted coordinate j ∈ S, and reduce each remaining coefficient in A to be at most the residual covering demand. A feasible integral solution x to (CIP) satisfies ASx ≥ bS for all S ⊆ [n]. The following LP, then, is a valid linear relaxation of the integer program (CIP). minimize hc, xi over x ∈ Rn ≥0 s.t. x ≤ d and ASx ≥ bS for all S ⊆ [n]. (KC-LP) Note that the knapsack cover constraints made the packing constraints x ≤ d redundant and expendable; (KC-LP) is a pure covering problem. Given a feasible solution x to (KC-LP), one can (randomly) round x to a feasible integer solution y to (CIP). Kolliopoulos and Young [25] obtain an O(log ∆0) approximation via (KC-LP) where ∆0 is the maximum number of non-zeroes in any column of A; note that ∆0 ≤ m. Recent tighter bounds [12] will be discussed shortly. 4Dobson also described a variant of greedy for rational data whose approximation ratio is 1+max j (Hdj +ln X Ai,j); i dj is the number of non-zeroes in column j and the entries of A are assumed to be scaled such that the minimum non-zero entry of each row is at least 1. 2 Sparsity bounds and motivation: We are motivated by the following high-level question. Can one obtain near-tight approximation bounds for CIP and CIP∞ that are efficient, simple and de- terministic? Set Cover is the model here where a simple greedy algorithm or a simple primal-dual algorithm gives provably optimal worst-case approximation ratios with near-linear running time. We briefly discuss some existing results before stating our results. The first issue is regarding the approximation ratios for CIP and CIP∞. Currently the best bounds in terms of column sparsity are from the recent work of Chen, Harris, and Srinivasan [12]. To describe the bounds, we assume, without loss of generality, that the problem is normalized such that entries of A are in [0, 1] and b ≥ 1. Following [12], we let ∆0 denote the maximum number of Ai,j denote the maximum column sum. ∆0 non-zeroes in any column of A, and let ∆1 = max j∈[n] mXi=1 and ∆1 are the ℓ0 and ℓ1 measures of column sparsity of A. Similarly we let Γ0 and Γ1 denote the corresponding measures for row sparsity of A. In the context of Set Cover, ∆0 is the maximum set size and Γ0 is the maximum frequency. Under the normalization5 that Ai,j ∈ [0, 1]m×n, we have ∆1 ≤ ∆0 ≤ m, and in some cases ∆1 ≪ ∆0. We let bmin denote min bi, and this measures the so-called "width" of the system. As bmin increases, the problem gets easier in the case of CIP∞. We summarize the relevant approximation ratios from [12], all of which are randomized6. i∈[m] ln(1 + ∆1) bmin + 4s ln(1 + ∆1) • A(cid:16)1 + ln ∆0 + O(cid:16)pln ∆0(cid:17)(cid:17)-approximation for CIP via (KC-LP). • A1 + with cost at most1 + 4 bmin  approximation for CIP∞ via Basic-LP. multiplicity constraints to within a (1 + ǫ)-factor, that is z ≤ ⌈(1 + ǫ)d⌉. + 5s ln(1 + ∆1) bmin · ǫ  times the LP value, and satisfies the • A bicriteria algorithm for CIP: given ǫ > 0, the algorithm outputs an integer solution z ln(1 + ∆1) bmin · ǫ The algorithmic framework of [12] is based on resampling, which is motivated by the developments on the constructive version of the Lovász Local Lemma starting with the work of Moser and Tardos and continuing through several subsequent developments. Although the high-level algorithmic idea is not that complicated, the analysis is technically involved and randomization seems inherently necessary. One of the significant and novel contributions of [12] is to show, for the first time, that approximation bounds based on ∆1 are feasible. Not only can ∆1 be much smaller than ∆0, it is also more robust to noise and perturbation. Noise is typically not an issue for combinatorial instances such as those arising in Set Cover but can be relevant in instances of CIP that arise from data with real numbers. We note that there are two regimes of interest for ∆1. One regime is when ∆1 is large (at least some fixed constant) in which case the approximation bounds tend towards ln ∆1 plus lower order terms. The other regime is when ∆1 is small and tends to 0; in this regime the approximation ratio guarantees from preceding bounds for CIP∞ tend to 1 + O(p∆1). Approximation bounds in terms of row sparsity are also known for CIP. Pritchard and Chakrabarty [31] describe a Γ0 approximation for CIP (previous results obtained a similar bound in more restricted settings). For CIP∞ a bound of (1 + Γ1) is implicit in [31] (see Proposition 7). 5Note that the result of Dobson is based on a very different normalization. 6These bounds were based on the latest version of [12] at the time of our work. Chen, Harris, and Srinivasan have · · · terms with improved their bounds in a recently updated preprint [13], essentially replacing the second order √ O(ln ln(· · ·)) terms. We plan to do a careful comparison with the results in [13] in a future version of this work. 3 obtained in near-linear O(N/ǫ2) time [43] or O(cid:0)N/ǫ + m/ǫ2 + n/ǫ3(cid:1) randomized time [9] (and more The second issue is with regards to efficiency. A (1 − ǫ)-approximation for the Basic-LP can be efficiently if there are no multiplicity constraints [26, 40]). On the other hand, (KC-LP) is not as simple to solve because of the exponential number of implicit constraints. Carr et al. [5] describe two methods to solve (KC-LP). The first is to use the Ellipsoid method via an approximate separation oracle7. The other is to use a Lagrangean relaxation based approximation scheme which yields a running time of O(cid:18)nN poly(cid:18) 1 ǫ(cid:19) log C(cid:19) for a (1 + ǫ)-approximate solution. Kolliopoulos and Young [25] explicitly raise the question of a fast approximation algorithm for CIP. The recent work of Chen et al. [12] discussed above shows that a randomized rounding technique via a resampling framework yields near-optimal approximations, and they run in expected near-linear time. This is in contrast to some previous rounding algorithms [35, 37] that were rather complex and slow. Hence the bottleneck for CIP is solving the LP relaxation (KC-LP). 1.1 Our Results In this paper we address both the approximability and efficiency of CIP and CIP∞. Our first set of results is on rounding the fractional solution to the Basic-LP and (KC-LP). Our main contribution is to show that a very simple combination of randomized rounding followed by alteration, that has been previously considered for covering integer programs [36, 34, 20], yields clean and (in some cases) improved bounds when compared to those of [12]. Our focus in this paper is in the regime where ∆0 and ∆1 are larger than some fixed (modest) constant. Under this assumption, we obtain the following improved approximation bounds: • A (ln ∆0 + ln ln ∆0 + O(1))-approximation for CIP via (KC-LP). • A (ln ∆1 + ln ln ∆1 + O(1))-approximation for CIP∞ via Basic-LP. When bmin is large the is sufficiently + O(1)(cid:19) under the assumption that ln ∆1 bmin ratio improves to(cid:18) ln ∆1 bmin ln ∆1 bmin + ln large. • A bicriteria algorithm for CIP via (KC-LP): given an error parameter ǫ > 0, the algorithm + O(cid:18)ln 1 ǫ(cid:19)(cid:19) times the LP value, and outputs a solution with cost at most(cid:18) ln ∆1 bmin + ln ln ∆1 bmin satisfies the multiplicity constraints to within a (1 + ǫ)-factor8. When ∆0 is large, [12] established a hardness lower bound of the form ln ∆0 − c ln ln ∆0 for some constant c by extending a result of Trevisan [38] for Set Cover. Thus our improved bounds in this regime get closer to the lower bound in the second order term. We obtain a more substantial improvement for the bicriteria approximation as a function of ǫ, and it is important to observe that it is based on (KC-LP) while [12] uses Basic-LP. Perhaps of greater interest than the precise improvements is the fact that the alteration algorithm is simple and easy to analyze. All we really need is a careful use of the lower tail of the standard Chernoff bound. A significant consequence of the simple analysis is that we are able to easily and efficiently derandomize the algorithm via the standard method of conditional expectations. This leads to simple deterministic algorithms without loss in the approximation bounds. We also believe that our analysis is insightful for the bound based on ∆1; it is not easy to see why such a bound should be feasible in the first place. 7The LP is not solved exactly but the fractional solution output by the algorithm provides a lower bound and suffices for the current randomized rounding algorithms. 8It is not hard to show that bounds based on ∆1 are not feasible for CIP if multiplicity constraints are not violated. 4 Finally we note that our bound for CIP based on ∆0 is quite elementary and direct, and does not rely on the more involved analysis for the bound based on ∆1; this is not the case in [12]. Remark 1.1. For CIP∞ when ∆1 is sufficiently small we can show that the alteration approach gives an approximation ratio of O(cid:18)1 + O(cid:18)r∆1 log ∆1(cid:19)(cid:19), which tends to 1 as ∆1 → 0. This is slightly weaker than the bound from [12], which gives an approximation ratio of O(cid:16)1 + O(p∆1)(cid:17). We believe that our analysis is of the alteration algorithm is not tight. 1 Remark 1.2. The alteration based algorithms have a single parameter α that controls the scaling of the variables in the randomized rounding step. Depending on the regime of interest we choose an appropriate α to obtain the best theoretical guarantee. One can try essentially all possible values of α (by appropriate discretization) and take the best solution. This makes the algorithm oblivious to the input parameters. The fixing step in the alteration algorithm depends on the objective function c and is deterministic. One can make the fixing step oblivious to c via randomization and known results on the Knapsack Cover problem9. Our second result is a fast approximation scheme for solving (KC-LP), improving upon the pre- vious bound in [5] by a factor of n. For polynomially-bounded C (which is a reasonable assumption in many settings) the running time is near-linear for any fixed ǫ. The precise result is stated in the theorem below. To achieve the result we develop an incremental dynamic data structure for the Knapsack Cover problem and combine it with other data structures following our recent line of work on speeding up MWU based approximation schemes for implicit positive linear programs. Theorem 1.3. Let ǫ > 0 be fixed, and consider an instance of (KC-LP) and let OPT be the value of an optimum solution. There is a deterministic algorithm that in O(cid:18) N log C ǫ5 time outputs x ∈ Rn such that hc, xi ≤ OPT, x ≤ d, and for all S ⊆ [n], ASx ≥ (1 − ǫ)bS. (m + n) log C (cid:19) + ǫ3 Together, our results yield deterministic and fast approximation algorithms for CIP and CIP∞ that are near-optimal in a wide range of parameter settings. Our analysis demonstrates that random rounding plus alteration provides near-tight bounds for Set Cover, CIP and CIP∞. The rounding algorithm and analysis can be considered textbook material. 1.2 Techniques and other related work Approximation algorithms and hardness results for Set Cover, its generalizations, and important special cases have been extensively studied in the literature. We refer the reader to approximation books for standard and well-known results [39, 41]. CIP and CIP∞ have been primarily addressed in previous work via LP relaxations and randomized rounding starting with the well-known work of Raghavan and Thompson [32]. Srinivasan has used sophisticated probabilistic techniques based on the Lovász Local Lemma (LLL) and its derandomization via pessimistic estimators to obtain bounds that depend on the sparsity of A [35, 37]. These were also used, in a black box fashion, for CIP by Kolliopoulos and Young [25]. The more recent work by Chen et al. [12] is inspired by the ideas surrounding the Moser-Tardos resampling framework [29, 21] that led to constructive versions of LLL. They were the first to consider ℓ1-sparsity based bounds. Srinivasan [36] used randomized rounding with alteration for covering and packing problems. For packing problems the 9In retrospect, the algorithms in [12] appear to be randomized and oblivious fixing schemes. However, the analysis is involved for various technical reasons. 5 alteration approach has led to a broad framework on contention resolution with several applications [3, 10]. For covering we are also inspired by the paper of Saket and Sviridenko [34] who described ln ∆0 an alteration based algorithm for Set Cover that achieves an approximation ratio of Γ0(1 − e Γ0−1 ) that addresses both column sparsity and row sparsity in a clean and unified fashion. The known hardness of approximation result of Set Cover that we already mentioned carries over to CIP when ∆0 is the parameter of interest. Chen et al. [12], building upon the results for Set Cover, showed near-optimal integrality gaps and hardness results for CIP and CIP∞ in various sparsity regimes as a function of the parameter ∆1. Together these results show that the current upper bounds for CIP and CIP∞ in terms of column and row sparsity are essentially optimal up to lower order terms. KC inequalities are well-known in integer programming, and since the work of Carr et al. [5], there have been several uses in approximation algorithms. MWU based Lagrangean relaxation methods have been extensively studied to derive FPTAS's for solving packing, covering and mixed packing and covering linear programs. We refer the reader to some recent papers [43, 28, 8, 9] for pointers. Building upon some earlier work of Young [43], we have recently demonstrated, via several applications [8, 7, 9], some techniques to speed up MWU based approximation schemes for a variety of explicit and implicit problems. The key idea is the use of appropriate data structures that mesh with the analysis and flexibility of the high-level MWU based algorithm. There are certain general principles in this approach and there are problem specific parts. In this paper our technical contribution is to adapt the FPTAS for the Knapsack Cover problem and make it dynamic in a manner that is suitable to the needs of the MWU based updates. This allows us to speed up the basic approach outlined in Carr et al. [5] and obtain a fast running time. Note that the rounding step for CIP loses a large factor in the approximation, and hence solving the LP to high-precision is not the main focus. Moroever, the large dependence on ǫ is mainly due to the FPTAS for knapsack cover. A different line of work based on Nesterov's accelerated gradient descent achieve running time with a better dependence on O(1/ǫ) for solving positive LPs [4, 14]. Until recently, the running time of these algorithms did not have a good dependence on the combinatorial parameters. The work of Allen-Zhu and Orecchia has remedied this for explicit pure packing and covering LPs [1, 40]. However, it is not clear how well these techniques can be applied to implicit problems like the ones we consider here. Organization: The paper has several technical results, and broadly consists of two parts. Section 2 describes approximation results obtained via randomized rounding plus alteration and its derandomization. Section 3 describes our fast approximation scheme to solve (KC-LP) and proves Theorem 1.3. The two parts can be read independently. We made the paper modular to keep it both readable and detailed, and suggest that the reader skip to section of interest rather than read the paper sequentially. 2 Randomized Rounding with Alteration In this section we formally describe two versions of randomized rounding with alteration and analyze it for CIP∞ and CIP. The algorithms are simple and have been proposed and analyzed previously. We analyze them in a tighter fashion, especially in terms of the ℓ1 sparsity of A. Recall that we have normalized the problem such that all entries of A are in [0, 1] and b ≥ 1. It is convenient to simplify the problem further and assume that b = 1. This can be done by scaling each row i by bi. This setting captures the essence of the problem and simplifies notation and the analysis. As a preliminary step we state some known facts about the Knapsack Cover problem (which is the special case of CIP with m = 1) in the lemma below. 6 Lemma 2.1 (Carr et al. [5]). Consider an instance of Knapsack Cover of the form minhc, xi subject to ajxj ≥ 1, x ≤ d, and x ∈ Zn ≥0. nXj=1 • Suppose y is a feasible solution to the Basic-LP relaxation. Then there is an integer solution z in the support of y such that hc, zi ≤ 2hc, yi and yj ≤ ⌈2xj⌉. • Suppose y is a feasible solution to (KC-LP) (satisfying knapsack cover inequalities). Then there is an integer solution z in the support of y such that hc, zi ≤ 2hc, yi and z ≤ d. Given y, an integer vector z satisfying the stated conditions can be found in near-linear time. ≥0 , a cost vector c ∈ Rn The input consists of a nonnegative matrix A ∈ Rm×n x ∈ Rn vector z ∈ Zn randomized rounding step, step (2) in Figure 1, and an alteration step, step (3). The first algorithm we present is called round-and-fix, and pseudocode is given in Figure 1. ≥0, a nonnegative vector ≥0 such that Ax ≥ 1, and a positive parameter α > 0. The goal is to output an integer ≥0 such that Ax ≥ 1 with cost hc, zi comparable to hc, xi. The algorithm consists of a In the randomized rounding step, round-and-fix scales up the fractional solution x by α and independently rounds each coordinate i to ⌊αxi⌋ or ⌈αxi⌉ such that the expectation is αxi. Let z be the random vector picked in the first step. z may leave several covering constraints i ∈ [m] unsatisfied (that is (Az)i < 1). These constraints are fixed in the subsequent alteration step. In the alteration step, each unsatisfied covering constraint i is addressed separately. Let y(i) be an approximately optimum solution to cover the i'th constraint by itself; we can find a constant factor approximation since this is the knapsack cover problem. Letting U ⊆ [m] denote the subset of unsatisfied constraints, we output the solution z′ where z′ j = max{zj, max i∈U y(i) j } for each j ∈ [n]. Remark 2.2. The fixing step for an unsatisfied constraint i can be done more carefully. The residual requirement after the randomized step is 1 − (Az)i, and we can solve a Knapsack Cover problem to satisfy this requirement. This is crucial when ∆1 is small but makes the analysis complex. For the bounds we seek in the regime when ∆0 and ∆1 are sufficiently large constants, it suffices to fix each unsatisfied constraint ignoring the contribution from the first step. The alterations guarantee that all of the covering constraints are met. The cost of the solution is a random variable. Large values of α decrease the expected cost for alterations but increase the initial cost of randomized rounding; small values of α decrease the initial cost of randomized rounding but increase the expected cost of alterations. A careful choice of α leads to an approximation guarantee j∈[n] {i ∈ [m] : Ai,j 6= 0}, independent of m and relative to either the ℓ0-column sparsity of A, ∆0 def = max or the ℓ1-column sparsity of A, ∆1 def = max j∈[n] Ai,j. mXi=1 In the sequel we will assume that ∆0 and ∆1 are greater than some fixed constant. We believe that this is the main regime of interest. Moreover, the assumption avoids notational and technical complexity. In Appendix A we consider the case when ∆1 is small. We now state the specific theorems for CIP and CIP∞ and prove them in subsequent sections. The first theorem analyzes the performance of round-and-fix in terms of ℓ1 sparsity of A. Note that the theorem is directly relevant for CIP∞. The bounds on the multiplicities in Theorem 2.3 are insufficient for CIP, but will prove useful for CIP when discussing the second algorithm later. Theorem 2.3. Let A ∈ [0, 1]m×n, c ∈ Rn ≥0 such that Ax ≥ 1. Let α = ln ∆1 + ln ln ∆1 + O(1). In O(kAk0) time, round-and-fix(A,c,x,α) returns a randomized integral vector ≥0, and x ∈ Rn 7 round-and-fix(A ∈ [0, 1]m×n, c ∈ Rn ≥0, x ∈ Rn // goal: given a fractional point x ∈ Rn ≥0, α ≥ 1) ≥0 with Ax ≥ 1, output an integral point z ∈ Zn ≥0 with Az ≥ 1 and hc, zi comparable to hc, xi. 1. z ← ⌊αx⌋, x′ ← αx − z 2. for j = 1 to n A. with probability x′ j i. zj ← zj + 1 3. for all i such that (Az)i < 1: // fix z s.t. (Az)i ≥ 1 A. Find (approximate) solution y(i) for knapsack cover problem induced by constraint i B. z ← z ∨ y(i) 4. return z Figure 1: An alteration based rounding algorithm for covering programs. contract-round-fix(A ∈ [0, 1]m×n, c ∈ Rn ≥0, α ≥ 1, ǫ ∈ [0, 1]) // goal: given a fractional point x ∈ [0, d] satisfying all knapsack covering constraints w/r/t the program {Ay ≤ 1, 0 ≤ y ≤ d}, output an integral point z ∈ Zn ≥0 with Az ≥ (1 − ǫ)1, z ≤ ⌈(1 + ǫ)d⌉, and hc, zi comparable to hc, xi. ≥0, d ∈ Nn, x ∈ Rn 1. S ← {j ∈ [n] : αxj ≥ dj}, z′′ ← d ∧ S // where (d ∧ S)j = dj if j ∈ S and 0 otherwise 2. b ← 1 − Az′′ 3. M ← {i ∈ [m] : bi > ǫ}, N ← [n] \ S 4. define A′ ∈ [0, 1]M×N by A′ i,j = min{Ai,j/bi, 1} 5. z′ ← round-and-fix(A′,c ∧ N ,x ∧ N ,d − z′′) 6. return z′ + z′′. Figure 2: An alteration based rounding algorithm for covering programs with knapsack covering con- straints. 8 ≥0 with coverage Az ≥ 1, expected cost E[hc, zi] ≤ (α + O(1))hc, xi, and multiplicities z < z ∈ Zn ⌈αx⌉. The following theorem is an easy corollary of the preceding theorem since ∆1 ≤ ∆0 when entries of A are from [0, 1]. Nevertheless we state it separately since its proof is simpler and more direct and there is a tighter bound on the additive constant. We encourage a reader new to the alteration analysis to read the proof of this theorem before that of Theorem 2.3. Theorem 2.4. Let A ∈ [0, 1]m×n, c ∈ Rn ≥0 such that Ax ≥ 1. Let α = ln ∆0 + ln ln ∆0 + O(1). In O(kAk0) time, round-and-fix(A,c,x) returns a randomized integral vector z ∈ Zn ≥0 with coverage Az ≥ 1, expected cost E[hc, zi] ≤ (α + O(1))hc, xi, and multiplicities z ≤ ⌈αx⌉. ≥0, and x ∈ Rn We prove Theorem 2.4 in Section 2.1 and we prove Theorem 2.3 in Section 2.2. The upper bounds on the multiplicities, z < αx + 1, are useful for handling multiplicity con- straints via knapsack covering constraints. The second algorithm, called contract-round-fix and given in Figure 2, adds a preprocessing step to round-and-fix. The basic idea is by now standard and first proposed by Carr et al. [5] to take advantage of the KC inequalities. At a high level, we want to simulate the standard randomized rounding without violating the multiplicity constraints. Note that if αx ≤ d, then round-and-fix already returns an integral solution meeting the multi- plicity constraints. If ⌈αxj⌉ ≥ dj for some coordinate j, then the algorithm deterministically sets zj = dj. After contracting the large coordinates, the knapsack covering constraints ensure that the remaining small coordinates still satisfy the residual covering problem. We apply round-and-fix to the residual instance. We prove the following theorems on the performance of contract-round-fix in terms of the ℓ0 and ℓ1 sparsity of A. Theorem 2.5. Let A ∈ [0, 1]m×n, c ∈ Rn covering constraints w/r/t A and d. Let α = ln ∆0 + ln ln ∆0 + O(1). ≥0 such that x covers all the knapsack ≥0, d ∈ Nn and x ∈ Rn In kAk0 time, contract-round-fix(A,c,d,x,α,0) returns a randomized integral vector z ∈ Zn ≥0 with coverage Az ≥ 1, expected cost E[hc, zi] ≤ (ln ∆0 + ln ln ∆0 + O(1))hc, xi and multiplicities z ≤ d. Theorem 2.6. Let A ∈ [0, 1]m×n, c ∈ Rn the knapsack covering constraints w/r/t A and x ≤ d. Let α = ln ∆1 + ln ln ∆1 + O(cid:18)ln(cid:18) 1 ≥0, ǫ ∈ (0, 1], d ∈ Nn, and x ∈ Rn In kAk0 time, contract-round-fix(A,c,d,x,α,ǫ) returns a randomized integral vector z ∈ Zn ≥0 with coverage (1 + ǫ)Az ≥ 1, expected cost E[hc, zi] ≤ (ln ∆1 + ln ln ∆1 + O(ln(1/ǫ)))hc, xi, and multiplicities z ≤ d. ≥0 such that x covers all ǫ(cid:19)(cid:19). Scaling up the output to Theorem 2.6 by a (1 + ǫ)-multiplicative factor and then rounding up to an integral vectors shifts the approximation error from the coverage constraints to the multiplicity constraints, as follows. Corollary 2.7. Let A ∈ [0, 1]m×n, c ∈ Rn the knapsack covering constraints w/r/t A and d. ≥0, ǫ ∈ (0, 1], d ∈ Zn, and x ∈ Rn In kAk0 time, one can compute a randomized integral vector z ∈ Zn ≥0 with coverage Az ≥ 1, expected cost E[hc, zi] ≤ ((1 + ǫ) ln ∆1 + O(ln(1/ǫ)))hc, xi, and multiplicities z ≤ ⌈(1 + ǫ)d⌉. ≥0 such that x covers all In Section 2.3, we analyze contract-round-fix and prove Theorem 2.6. Proofs of Theorem 2.3 and Theorem 2.6 can be adapted to obtain improved approximations when one considers Ax ≥ b with bmin > 1. We prove the stronger bound in Section 2.5. We deran- domize the algorithm from Theorem 2.3 in Section 2.4. The other results can be made deterministic in the same fashion. 9 2.1 ℓ0-column sparse covering problems In this section, we prove Theorem 2.4. The main point of interest is the expected cost, and the high level approach is as follows. The expected cost of the rounded solution comes from either the randomized rounding step or the subsequent alterations, where the expected cost of randomized rounding is immediate. To analyze the expected cost of alterations, we first bound the fixing cost of any constraint i, with cost proportional to the restriction of the fractional solution x to coordinates j with nonzero coefficients (Ai,j > 0). Then, we analyze the probability of a constraint i being unmet, and obtain a probability inversely proportional to ∆0. The expected cost of alteration is the sum, over each constraint i, of the product of probability of failing to meet the ith constraint and the cost of repairing z to fix it. This sum cancels out nicely and shows that the expected cost of alteration is at most hc, xi. Lemma 2.8. Let i ∈ [m], and let a = max Ai,j. After randomized rounding in steps (2.*), i,j P[(Az)i < 1] ≤ exp(cid:18) 1 + ln(α) − α a (cid:19). 1 . 2∆0 For α ≥ ln ∆0 + ln ln ∆0 + O(1), we have P[(Az)i < 1] ≤ Proof. We apply the Chernoff inequality Lemma B.3 with β = 1 and µ = (Ax)i ≥ α. One can easily verify (numerically for instance) that if we choose α = ln ∆0 + ln ln ∆0 + 4, then the inequality is satisfied for ∆0 ≥ 2. (cid:4) Proof of Theorem 2.4. Let z ∈ Zn ≥0 be the randomized integral vector output by round-and-fix. By the alteration step, we have Az ≥ 1. We need to bound the expected cost by E[hc, zi] ≤ (α + O(1))hc, xi, and the multiplicities by z ≤ ⌈αx⌉. The cost of z comes from the randomized rounding in steps (2.*) and from alterations for unmet constraints in steps (3.*). The expected cost of the rounding step of αhc, xi. For each i ∈ [m], the ith constraint is unmet with probability ≤ by Lemma 2.8. When a constraint i is unmet, by Lemma 2.1, we can fix z so that (Az)i ≥ 1 with additional cost at most 2 Xj:Ai,j6=0 over all i, by (a) interchanging sums and (b) definition of ∆0, the expected cost from alteration is cjxj. Summed 1 2∆0 1 2∆0 mXi=1 2 Xj:Ai,j6=0 cjxj (a) = nXj=1 cj Xi:Ai,j6=0 xj ∆0 (b) ≤ hc, xi, as desired. Between randomized rounding and alterations, the expected cost of z is (α + 1)hc, xi, as desired. It remains to bound the multiplicities of z. For a fixed coordinate j ∈ [n], zj is set by either the randomized rounding in steps (2.*) or by an alteration in (3.A). The randomized rounding step sets zj to at most ⌈αxj⌉. By Lemma 2.1, an alteration sets zj to at most ⌈2xj⌉. Thus zj ≤ ⌈αxj⌉ for α ≥ 2. (cid:4) 2.2 ℓ1-column sparse covering programs In this section, we analyze the alteration-based algorithm round-and-fix for covering programs (without multiplicity constraints) and prove Theorem 2.3. To build some intuition for our analysis, 10 suppose all of the nonzero coordinates in A are big (and close to 1). Then we essentially have the ∆0 setting analyzed more simply in Section 2.1. On the other hand, suppose Ai,j = a for all nonzero Ai,j, for some small a < 1. Here the gap between ∆0 and ∆1 is a multiplicative factor of fixing costs from the ℓ0-setting sum to O(cid:18) ∆1 a hc, xi(cid:19). To offset the increased costs, observe that because the coordinates are uniformly bounded by a, the Chernoff bound tightens exponentially , and the by a -factor, giving a much better bound the probability of needing to fix each constraint i. In general, the coefficients in a row i can be non-uniform, with some close to 1 and some much less than 1. The key to the analysis is identifying a certain threshold ρi for each covering constraint i that divides the coordinates in the ith row between "big" and "small". We call ρi the ith (weighted) median coefficient. 1 a 1 a Lemma 2.9. Suppose Ax ≥ 1. For each i, there exists ρi ∈ (0, 1] such that Xj:Ai,j≥ρi Ai,jxj ≥ 1 2 and Xj:Ai,j≤ρi Ai,jxj ≥ 1 2 . Proof. Let ρi = inf ρ : XAi,j >ρ XAi,j≤ρi 1 2 Ai,jxj < . By choice of ρi, we have XAi,j≥ρi Ai,jxj ≥ 1 2 and Ai,jxj = (Ax)i − XAi,j >ρi Ai,jxj > 1 − 1 2 = 1 2 . The next two lemma's consider the fixing cost for constraint i, obtaining a value inversely (cid:4) proportional to ρi. Lemma 2.10. Let i ∈ [m]. There exists a vector y ∈ Rn ≥0 with coverage Xj Ai,jyj ≥ 1, cost cjAi,jxj, and coordinates bounded above by y ≤ 2x. 2 hc, yi ≤ ρiXj Proof. Let y ∈ Rn (Ay)i = 2 Xj:Ai,j≥ρi ≥0 be defined by yj = 2xj if Ai,j ≥ ρi, and yj = 0 otherwise. We have 0 ≤ y ≤ 2x, Ai,jxj ≥ 1 by choice of ρi, and hc, yi = 2 Xj:Ai,j≥ρi cjxj ≤ 2 ρi Xj:Ai,j≥ρi cjAi,jxj ≤ 2 ρiXj cjAi,jxj, as desired. (cid:4) Lemma 2.11. Let i ∈ [m]. In time near-linear in the number of nonzero coefficients in row i, one can find an integral vector z ⊆ [n] with coverage cjAi,jxj, and multiplicities z ≤ ⌈4x⌉. Ai,jzj ≥ 1, cost nXj=1 nXj=1 nXj=1 cjzj ≤ 4 ρi 11 Proof. Applying Lemma 2.1 to the vector y of Lemma 2.10 gives the desired result. (cid:4) The expected cost incurred from repairing z for the sake of constraint i is the probability of failing to meet constraint i times the cost given in Lemma 2.11. When ρi goes to zero the expected . For small ρi, we require a cost of fixing constraint i is dominated by the multiplicative factor of stronger concentration bound then Lemma 2.8 that decays exponentially in α and proportionately with ρi, to offset the increasing fixing costs. 1 ρi Lemma 2.12. Let i ∈ [m]. After randomized rounding in steps (2.*), P[(Az)i < 1] ≤ exp(cid:18) 1 + ln(α/2) − α/2 ρi (cid:19). Proof. From Lemma 2.9 Xj:Ai,j≤ρi (Lemma B.4 with γ = ρi and µ = Ai,jxj ≥ 1/2. Applying the Chernoff inequality to this sum α 2 ), we have P[(Az)i < 1] ≤ P XAi,j ≤ρi Ai,jzj < 1 ≤ exp(cid:18) 1 ρi(cid:16)1 + ln α 2 − α 2(cid:17)(cid:19), (cid:4) as desired. ρi ∆1 for some constant C > 1. Lemma 2.13. Let i ∈ [m] and α = ln ∆1 + ln ln ∆1 + O(1). After randomized rounding in steps (2.*), P[(Az)i < 1] ≤ C Proof. Let C > 0 be a constant to be determined later. We divide the analysis into two cases, depending on if ρi ≥ 1 C . In this case we simply use Lemma 2.8 as if for a = 1. We have Suppose ρi ≥ or ρi ≤ 1 C 1 C . as desired. Suppose now that ρi ≤ P[(Az)i < 1] ≤ 1 ∆1 ≤ C ρi ∆1 , 1 C . By Lemma 2.12, we have P[(Az)i < 1] ≤ ρi ∆1 if α ≥ 2ρi ln(∆1) + 2ρi ln(cid:18) 1 ρi(cid:19) + 2 ln(α/2) + 2. For α = ln(∆1) + γ, as γ → ∞ and ρi → 0, the left side dominates the right side. In particular, for C sufficiently large, and γ a sufficiently large constant, we have P[(Az)i < 1] ≤ (cid:4) ρi ∆1 . We conclude the section by completing the proof of Theorem 2.3. Proof of Theorem 2.3. The algorithm ensures that Az ≥ 1. The upper bound on the multiplicities of z follows by the same argument as in proving Theorem 2.4. It remains to bound the expected cost E[hc, zi]. The expected cost is the sum of the expected cost from the randomized rounding in steps (2.*) and the expected cost from alterations in steps (2.*). The expected cost of the rounding step is αhc, xi. For each i ∈ [m], the expected cost incurred by alterations for the ith covering constraint is 12 the product of the fixing cost for the ith constraint, bounded by Lemma 2.11, and the probability of failing to meet the ith constraint, bounded by Lemma 2.13. Summing over all i, (a) interchanging sums, and (b) definition of ∆1, the expected cost of alteration is at most ρi ∆1 ·Pn C mXi=1 j=1 cjAi,jxj ρi (a) = C cjxj ∆1 nXj=1 mXi=1 Ai,j (b) ≤ Chc, xi for some constant C ≥ 1. Summing the expected costs from randomized rounding and alterations, the expected cost of the output z is (α + C)hc, xi, as desired. (cid:4) 2.3 Handling multiplicity constraints In this section, we analyze the second algorithm, contract-round-fix. contract-round-fix takes as input a fractional solution that satisfies all the knapsack covering constraints w/r/t a system of covering constraints Ax ≥ 1 and multiplicity constraints x ≤ d and adds a preprocessing step to round-and-fix to handle multiplicity constraints. We obtain different approximation factors depending on whether one desires a pure approxi- mation, meeting the multiplicity constraints exactly, or a bicriteria factor that approximates the multiplicity constraints by a (1 + ǫ)-multiplicative factor. We obtain an ℓ0-sparse bound in the former setting and an ℓ1-sparse bound in the latter. The algorithms for either setting are similar, with a slight difference in the choice of parameters α and ǫ. We adopt the following common notation when proving either bound. • Let S = {j ∈ [n] : αxj ≥ dj} be the set of coordinates that are deterministically set to their multiplicity, and let z′′ = d ∧ S denote the corresponding integral vector. • Let N = [n]\S = {j : xj < α} be the set of coordinates that are not deterministically rounded up to d. • Let M =(cid:8)i : (Az′′)i < 1 − ǫ(cid:9) be the constraints that are not (sufficiently) covered by z′′. • Let x′ = x ∧ N restrict x to the remaining coordinates in N , and let x′′ = x \ x′ = x ∧ S denote the part of x deterministically rounded up. • Let A′ be the residual covering matrix w/r/t z′′. • Let z′ be the random vector output by round-and-fix w/r/t A′ and x′. • Let z = z′ + z′′ be the combined output. Proof of Theorem 2.5. Consider contract-round-fix with ǫ = 0 and α = ln ∆0 + ln ln ∆0 + O(1). The cost of z′′ is bounded above by (cid:10)c, z′′(cid:11) =Xj∈S cjdj ≤Xj∈S where x′′ restricts x to the coordinates in S. cjαxj = α(cid:10)c, x′′(cid:11), The second vector, z′, is the output of round-and-fix for the residual covering system w/r/t z′′. Since x satisfies the knapsack covering constraints, and A′ ∈ [0, 1]M×N is (rescaled) the resid- ual system after deterministically rounding up the coordinates in S, we have A′x′ ≥ 1. All the coordinates in A′ lie between 0 and 1, and the L0 column sparsity of A′ is bounded above by j∈[n]{i ∈ [m] : Aij > 0} = ∆0. j∈N {i ∈ M : Aij > 0} ≤ max max j∈N(cid:12)(cid:12)(cid:8)i ∈ M : A′ ij > 0(cid:9)(cid:12)(cid:12) = max 13 By Theorem 2.4, round-and-fix returns a vector z′′ with coverage A′z′′ ≥ 1, multiplicities z′′ ≤ (cid:6)αx′′(cid:7) ≤ d ∧ N , and expected cost E(cid:2)(cid:10)c, z′(cid:11)(cid:3) ≤ (α + O(1))(cid:10)c, x′(cid:11). It remains to combine the bounds for z′ and z′′ and analyze z. The expected cost of z is E[hc, zi] = E(cid:2)(cid:10)c, z′(cid:11)(cid:3) +(cid:10)c, z′′(cid:11) ≤ (α + O(1))(cid:10)c, x′(cid:11) + α(cid:10)c, x′′(cid:11) = (α + O(1))hc, xi. For the multiplicity constraints, we have z = z′ + z′′ ≤ d ∧ S + d ∧ N = d. For the coverage, for each i ∈ [m], we consider two cases depending on whether i ∈ M or not. If i /∈ M, then If i ∈ M, then for bi = 1 − (Az′′)i, we have (Az)i ≥ (Az′′)i ≥ 1. (Az)i = (Az′)i + (Az′′)i = 1 − bi + bi(A′z′′)i ≥ 1 − bi + bi = 1, as desired. (cid:4) Now we consider the bicriteria approximation based on ℓ1 sparsity. Proof of Theorem 2.6. Consider contract-round-fix for a given ǫ > 0. The max column sum of A′ is Ai,j ≤ 1 ǫ max j∈[n] Ai,j = ∆1 ǫ . mXi=1 ∆′ 1 = max j∈N Xi∈M A′ i,j ≤ max j∈N Xi∈M Ai,j bi ≤ max j∈N 1 ǫ Xi∈M 1 + ln ln ∆′ z′ < αx′ + 1 for α′ = ln ∆′ 1 + O(1). Observe that, plugging in ∆1/ǫ for ∆′ By, Theorem 2.3, z′ has coverage A′z′ ≥ 1, expected cost E(cid:2)(cid:10)c, z′(cid:11)(cid:3) ≤ α′(cid:10)c, x′(cid:11), and multiplicities α′ = ln ∆1 + ln ln ∆1 + O(ln(1/ǫ)) = α. Thus, E(cid:2)(cid:10)c, z′(cid:11)(cid:3) ≤ α(cid:10)c, x′(cid:11) and z′ ≤(cid:6)αx′(cid:7) ≤ d. Then z′′ has costXj∈S E(cid:2)(cid:10)c, z′ + z′′(cid:11)(cid:3) = E(cid:2)(cid:10)c, z′(cid:11)(cid:3) +(cid:10)c, z′′(cid:11) ≤ α(cid:0)(cid:10)c, x′(cid:11) +(cid:10)c, x′′(cid:11)(cid:1) = αhc, xi. cjdj ≤ α(cid:10)c, x′′(cid:11), so the expected total cost is Since z′ and z′′ have disjoint support, and both z′ ≤ d and z′′ ≤ d individually, we have z′ + z′′ ≤ d. Finally, for each constraint i, we have either i /∈ M, in which case A(z′ + z′′) ≥ Az′′ ≥ 1 − ǫ by definition of M; or i ∈ M, in which case 1, we have A(z′ + z′′)i ≥ (Az′′)i + (1 − (Az′′)i)(A′z′)i ≥ 1 − bi + bi ≥ 1, as desired. 2.4 Derandomization (cid:4) In this section, we apply the method of conditional expectations to derandomize the alteration-based rounding schemes for column sparse covering problems. Recall that the round-and-fix algorithm consists of a randomized rounding step followed by an alteration step. In particular, randomization only enters when deciding whether to round a coordinate up or down initially. We thus apply the method of conditional expectations to the sequence of coin tosses that round each coordinate up or down. 14 For ease of exposition, we focus on derandomizing w/r/t ∆1. Fix a scalar α > 0 and fractional ≥0 with Ax ≥ 1. For each i ∈ [m], we define ψi(y) : {0, 1}n → R≥0 as the minimum solution x ∈ Rn of two functions, ψi(y) def = min(cid:8)ψ′ i(y), ψ′′ i (y)(cid:9), where ψ′ i(y) def= α(Ax)i ψ′ (αAx) −(Ai,j ⌊αxj ⌋+Ai,jyj ) i , i : {0, 1}n → R≥0 is defined by nYj=1 and ψ′′ i : {0, 1}n → R≥0 is defined by = (cid:18) α(Ax)i i (y) ψ′′ def We define Φ : {0, 1}n → R≥0 by 2 (cid:19)1/ρi Yj:Ai,j≤ρi(cid:18) α(Ax)i mXi=1 Φ(y) = hc,⌊αx⌋i + hc, yi + C ψi(y) 2 (cid:19)− Ai,j⌊αxj⌋+Ai,j yj ρi ! . cjAijxj. nXj=1 where C ∈ R>0 is the constant specified by Lemma 2.11. The formula for Φ(y) appears involved, but has a simple interpretation as a pessimistic estimator for the expected cost as a function of the randomized rounding in steps (2.*). Lemma 2.14. Let α = ln(∆1) + ln ln(∆1) + O(1), and let z ∈ Zn ≥0 be the randomized integral vector produced by round-and-fix. Let y ∈ {0, 1}n be the random vector with independent coordinates where yi = 1 if zi is rounded up in step (2.A.i), and yi = 0 otherwise. Then E[Φ(y)] ≤ (α + O(1))hc, xi. Proof sketch. The claim is implicit in the proof of Theorem 2.3, as E[Φ(y)] is an intermediate upper bound on E[hc, zi] in the full chain of inequalities in the proof. The expectation of the first two terms, hc,⌊αx⌋i + E[hc, yi], gives the cost from the randomized rounding. For each i, ψi is a pessimistic estimator for the probability that (Az)i < 1, occurring in the proof of the Chernoff inequality and implicitly bounded from above when we invoked Lemma 2.8 and Lemma 2.12. The full relationship between E[Φ(y)] and Theorem 2.3 is: E[hc, zi] ≤ E[Φ(y)] ≤ (α + O(1))hc, xi. (cid:4) Lemma 2.15. hc,⌊x⌋i + hc, yi + C Xi:(A(⌊αx⌋+y))i<1 nXj=1 cjAi,jxj ≤ Φ(y). Proof. Subtracting out common terms, the claim is equivalent to showing that C Xi:(A(⌊αx⌋+y))i<1 nXj=1 cjAi,jxj ≤ C mXi=1 ψi(y) nXj=1 cjAi,jxj. Since ψi(y) ≥ 0 for all i, it suffices to show that ψi(y) ≥ 1 whenever (A(⌊αx⌋ + y))i < 1. Indeed, if this is the case, then ψ′ i(y) = (αAx) 1−(A(⌊αx⌋+y))i i > (αAx)0 i = 1, and as desired. ψ′′ i (y) =(cid:18) αAx ρi (cid:19) 1−(A(⌊αx⌋+y))i ρi i ρi (cid:19)0 >(cid:18) αAx i = 1, (cid:4) 15 Theorem 2.16. Let x ∈ Rn ≥0 with Ax ≥ 1. In nearly linear deterministic time, one can compute a vector z with coverage Az ≥ 1, cost hc, zi ≤ (ln ∆1 + ln ln ∆1 + O(1)), and multiplicities z < αx + 1. Proof. We apply the method of conditional expectations to Φ(y), where initially y ∈ {0, 1}n is a randomized vector with independent coordinates and E[y] = αx − ⌊αx⌋. For j = 1, . . . , m, we fix yj to either 0 or 1 as to not increase the conditional expectation E[Φ(y) y1, . . . , yj]. is easily computable. Moreover, one can arrange a simple data structure such that upon advancing i to the next index, the next conditional expectation E[Φ(y) y1, . . . , yj] can be recomputed in time that is linear in the number of nonzeroes in the jth column of A. At the end, by Lemma 2.14, we have a fixed point y ∈ {0, 1}n such that Φ(y) ≤ E[Φ(y)] ≤ (α + O(1))hc, xi. We take the integral vector ⌊αx⌋ + y and fix the unmet constraints with Lemma 2.11. By Lemma 2.15, this solution has cost at most Φ(y) ≤ (α + O(1))hc, xi, as desired. Note that E[Φ(y) y1, . . . , yj] (cid:4) 2.5 Improved bound for CIP∞ when bmin is large We now consider the case when Ax ≥ b where bi ≥ bmin > 1 for i ∈ [m]. Recall that ∆1 is the maximum column sum of A. We can scale each row i by bi to obtain a system A′x ≥ 1. If we let ∆′ 1 denote the maximum column sum of A′, we see that ∆′ 1 ≤ ∆1/bmin. The analysis that we have already seen would yield an approximation ration of ln ∆′ 1 + O(1) assuming that ∆′ 1 + ln ln ∆′ 1 + O(1). is sufficiently large. In fact one can obtain a better bound of the form + ln ln ∆1 bmin ln ∆1 bmin Here we assume that is sufficiently large constant. The analysis closely mimics the one in ln ∆1 bmin Section 2.2 and we only highlight the main changes. The algorithm round-and-fix generalizes in the obvious fashion to the setting when b ≥ 1. After the randomized rounding step each constraint i that is uncovered, that is, (Az)i < bi is greedily fixed by solving a Knapsack Cover problem. We analyze as follows. Lemma 2.9 easily generalizes to Ai,jxj ≥ bi/2 show that for each row i, there is a median coefficient ρi (w/r/t x) such that Xj:Ai,j≤ρi and Xj:Ai,j≥ρi nXj=1 Ai,jxj ≥ bi/2. Lemma 2.11 also generalizes to show that the fixing cost for i is at most cjAi,jxj. We address the changes to Lemma 2.12 and Lemma 2.13. The probability that 4 ρi constraint i is not covered is: P[(Az)i < bi] ≤ exp(cid:18) bi(1 + ln(α/2) − α/2) ρi (cid:19). where we used the Chernoff inequality given by Lemma B.5 with γ = ρi, µ = αbi/2 and β = bi. We also have the following bound. P[(Az)i < bi] ≤ exp(bi(1 + ln(α) − α)). Our goal is to show that if α = +ln ln ∆1 bmin ln ∆1 bmin +O(1) then P[(Az)i < bi] ≤ C ρi ∆1 for sufficiently large but fixed constant C. We consider two cases as before. If ρi ≥ 1/C then . P[(Az)i < bi] ≤ exp(bi(1 + ln(α) − α)) ≤ 1 ∆1 ≤ C ρi ∆1 16 Now suppose ρi < 1/C. We see that P[(Az)i < bi] ≤ ρi/∆1 if α ≥ 2 ρi bi ln(∆1) + 2 ρi bi ln(cid:18) 1 ρi(cid:19) + 2 ln(α/2) + 2. One can argue as before that with C and the O(1) term in α chosen sufficiently large the inequality holds true. With these facts in place, the expected cost of the solution is (α + C)hc, xi. 3 Fast Algorithm for Solving the Knapsack-Cover LP In this section we develop a fast approximation scheme for (KC-LP). The algorithm is based on speeding up an MWU based scheme by a combination of technical ingredients. 3.1 Reviewing the MWU framework and its bottlenecks In this section, we give an overview of a width-independent version of the multiplicative weight update (MWU) framework, as applied to the dual of (KC-LP). Along the way, we review the techniques of Carr et al. [5] and recover their running time. With some standard techniques, we improve the running time to nearly quadratic, and we identify two bottlenecks that we need to overcome to remove the quadratic factor. For the remainder of this paper, we assume that ǫ ≥ use the ellipsoid algorithm instead. 1 poly(n) , since beyond this point one can Following Carr et al. [5], we apply the MWU framework to the dual of the LP (KC-LP), which is the following pure packing problem. maximize XS,i s.t. mXi=1 XS⊆[n] yS,ibS,i over y : P([n]) × m → R AS,i,jyS,i ≤ cj for all j ∈ [n] (D) Here P([n]) = {S : S ⊆ [n]} denotes the power set of [n]. The preceding LP has one variable for every constraint i and every set S ⊆ [n], and corresponds to a single knapsack covering constraint in the primal LP (KC-LP). The LP (D) can be interpretted as packing knapsack covering constraints into the variables. The MWU framework is a monotonic and width-independent algorithm that starts with an empty solution y = 0 to the LP (D) and increases y along a sequence of Lagrangian relaxations to (D). Each Lagrangian relaxation is designed to steer y away from items j for which the packing constraint is tight. For each item j, the framework maintains a weight wj that (approximately) exponentiates the load of the jth constraint with the current solution y; i.e., ln(cjwj) ≈ ·Pm i=1PS⊆n AS,i,jyS,i cj (1) for each j. Each iteration, the framework solves the log n ǫ 1 cj for each j ∈ [n]. Initially, we have wj = following Lagrangian relaxation of (D): maximize XS⊆[n],i∈[m] yS,ibS,i over z : P([n]) × [m] → R≥0 17 s.t. wj nXj=1 mXi=1 XS⊆[n] AS,i,jzS,i ≤ wjcj. nXj=1 (R) Observe that the above relaxation biases the solution z away from items j with large weight wj, which are the items j for which the packing constraint w/r/t y is tight. Given an approximate solution z to the above, we add δz to y for a carefully chosen value δ > 0 (discussed in greater detail below). The next iteration encounters a different relaxation, where the weights are increased to account for the loads increased by z. Note that the weights wj are monotonically increasing over the course of the algorithm. At the end of the algorithm, standard analysis shows that the vector y satisfies hb, yi ≥ (1 − O(ǫ)) OPT and that (1 − O(ǫ))y satisfies all the packing constraints (see for example [43, 11]). The error can be made one-sided by scaling y up or down. Moreover, it can be shown that at some point in the algorithm, an easily computable rescaling of w is an (1 ± ǫ)-relative approximation for the original LP (KC-LP) (see for example [5, 7]). Thus, although we may appear more interested in solving the dual packing LP (D), we are approximating the desired LP (KC-LP) as well. The choice of δ differentiates this "width-independent" MWU framework from other MWU-type algorithms in the literature. The step size δ is chosen small enough that no weight increases by more than an exp(ǫ)-multiplicative factor, and large enough that some weight increases by (about) an exp(ǫ)-multiplicative factor. The analysis of the MWU framework reveals that ln(hw, ci) ≤ nO(1/ǫ) In particular, each weight can increase by an exp(ǫ)-multiplicative factor at most at all times. O(cid:18) ln n ǫ2 (cid:19) times, so there are most O(cid:18) n ln n ǫ2 (cid:19) iterations total. 3.1.1 Reduction to knapsack cover An important aspect of the Lagrangian approach is that the 1-constraint packing problem (R) is much simpler to solve than the many-constraint packing problem (D). It suffices to approximately identify the best bang-for-buck coordinate indexed by S ⊆ [n] and i ∈ [m]; i.e., approximately maximizing the ratio bS,i , PS,i,j wjAS,i,j and setting z = γeS,i for γ as large as possible within the single packing constraint. Carr et al. [5] calls this choice of S and i the "most violated inequality". Carr et al. [5] reduces the above search problem to a family of knapsack cover problems as follows. Fix i ∈ [m]. Expanding out the definitions of bS,i and AS,i,j, finding the set S maximizing the above is shown to be equivalent to minimize 1 αXj /∈S wj min{Ai,j, α} over α > 0 and S ⊆ [n] s.t. Xj∈S Ai,jdj ≤ bi − α. If we let bi = Ai,jdj − bi denote the total "excess" for the ith covering constraint, then we can rewrite the above as follows: nXj=1 αXj∈S 1 minimize wj min{Ai,j, α} over α > 0 and S ⊆ [n] s.t. Xj∈S Ai,jdj ≥ bi + α. (KC) 18 For fixed i and α > 0, (KC) is a knapsack covering problem. For the sake of a (1 + O(ǫ))- multiplicative approximation to (R), we can approximate the objective by a (1 + O(ǫ))- multiplicative factor, but we must satisfy the covering constraint exactly. A few basic observations by Carr et al. [5] allow us to guess α by exhaustive search. To obtain a (1 + ǫ)-multiplicative approximation to (R), we can afford to round α up to the next integer power of (1 + ǫ). Since the nonzero coefficients Ai,j all lie in the range [1/C, C], it suffices to check α for just log(1+ǫ) C = O(log(C)/ǫ) powers of (1 + ǫ). We let A denote the set of O(cid:18) log C ǫ (cid:19) values of α of interest. A constant factor approximation to (KC) can be obtained in O(ni log ni) time [15], and there are approximation schemes (discussed in greater detail in Section 3.3) with running times on the order of O(ni + poly(1/ǫ)), where ni is the number of nonzeroes in the ith row of A. Carr et al. [5] solves the relaxation (R) by applying a FPTAS for knapsack cover to each choice of i and α. For larger values of m, by multiplying the running time of the FPTAS with the number of choices of α per i, In a straight forward implementation of the MWU framework, each iteration also requires O(n) time poly(ǫ)(cid:19) time to approximate. and summing over i ∈ [m], each instance of (R) takes O(cid:18) N log C to adjust the weight of each item. With O(cid:0)n log(n)/ǫ2(cid:1) iterations total, we achieve a running time of O(cid:18) nN log C poly(ǫ) (cid:19). This gives the running time described in Carr et al. [5]. mn log C m log C ǫ3 + ǫ + 3.1.2 Thresholding A standard technique called "lazy greedy", "thresholded greedy", or "lazy bucketing" in the literature immediately reduces the running time to O(cid:0)(cid:0)N log C + n2(cid:1) poly(1/ǫ)(cid:1). Observe that the optimum ratio is monotonically decreasing as the weights wj are monotonically increasing; equivalently, the optimum value of (KC) is monotonically increasing for each α and i as the weights wj are increasing. This allows us to employ the following thresholding technique, also used within MWU frameworks in [19, 8, 7, 9]. We maintain a threshold λ > 0 such that λ is less than the optimal value of (KC) for all i ∈ [m] and α ∈ A. The first value of λ is obtained by applying a constant factor approximation algorithm to (KC) for each i ∈ [m] and α ∈ A and setting λ to be a constant factor less than the minimum cost over all i ∈ [m] and α ∈ A. If λ is a lower bound for (KC), then any solution S and i with ratio ≤ (1 + O(ǫ))λ leads to a (1 + O(ǫ))-multiplicative approximation to (R). Thus, for a fixed value of λ, we solve each i ∈ [m] and α ∈ A in round-robin fashion, taking any (1 + ǫ)-approximation S with value ≤ (1 + O(ǫ))λ, or continuing to the next choice of i and α if the returned approximation has value ≥ (1 + O(ǫ))λ. If all i ∈ [m] and α ∈ A generate approximations of value ≥ (1 + O(ǫ))λ, then we can safely increase λ to (1 + ǫ)λ. Observe that since each weight wj increases by at most a nO(1/ǫ)-multiplicative factor over the entire algorithm, and then initial choice of λ is within a constant factor of the optimal value for the initial values of wj, λ stays within a nO(1/ǫ)-multiplicative value of its initial value. In particular, λ is bumped up at most log(1+ǫ)(cid:16)nO(1/ǫ)(cid:17) = O(cid:18)log n Each time we approximate an instance of (KC-LP) for i ∈ [m] and α ∈ A, we either (a) find a good approximation to the relaxation (R), or (b) declare that no solution has value ≤ (1 + ǫ)λ for this choice of i and α and put the choice of i and α aside until the next value of λ. That is, each approximated knapsack cover problem can by charged to either an iteration of the framework, of ǫ2 (cid:19) times. which there are O(cid:18) n log n ǫ2 (cid:19), or a new threshold for this choice of i and α. This leads to a running 19 time on the order of O(cid:18) n2 ǫ2 + N log C ǫ3 + (m + n) poly(cid:18) 1 ǫ(cid:19)(cid:19). 3.2 Two bottlenecks Our goal, as stated in Theorem 1.3, is a fast running time on the order of O(cid:18) N log C ǫ3 + (m + n) poly(1/ǫ)(cid:19). The bottleneck of O(cid:18) n2 ǫ2(cid:19) appears necessary for at least two basic reasons. First, there are Ω(cid:18) n log n ǫ2 (cid:19) iterations, and each iteration requires a solution z to the relaxation (R). Here z is a vector indexed by [m] and the power set of [n] -- an m2n-dimensional space. Even the index of a nonempty coordinate (S, i) ∈ support z requires Ω(log(m2n)) ≥ Ω(n) bits to write down. Thus writing out explicitly a solution to (R) in each iteration -- let alone computing it -- generates a ǫ2 (cid:19) lower bound. Stepping out of the MWU framework, LP duality tells us that (D) Ω(cid:18) n2 log n in a sparse explicit representation of y, we need Ω(cid:0)n2(cid:1) to list the supporting indices. Thus the descriptive complexity of optimal solutions to (D) is seemingly at least Ω(cid:0)n2(cid:1). A second bottleneck arises from the weight updates. By the formula (1), the logs of the weights should track the loads of each packing constraint. However, each iteration may increase the load of every packing constraint, so updating each weight explicitly can require Ω(n) time per iteration. Thus even the innocuous weight updates makes a faster running time discouraging. can be minimized by a vector y with support support y ≤ n. If y has n nonzeroes, then even 3.3 Approximation schemes for knapsack cover In this section, we review a classical FPTAS for knapsack cover and set the stage for a more sophisticated integration with the MWU framework. In the knapsack cover problem, we are given positive costs and sizes for n items and a positive real-valued size b of a knapsack; we want to find the minimum (sum) cost subset of items whose sizes sum to at least the size of the knapsack. In our setting, we have a sequence of such problems, and the costs and sizes are dictated via the MWU framework per equation (KC) for fixed i ∈ [m] and α > 0. The cost of an item j is cost(j) def= min{Ai,j, α}, and the size of an item j is size(j) = Ai,jdj. For each j, cost(j) depends linearly on the weight wj and size(j) is held constant throughout the algorithm. We want to update our solution quickly when a weight wj is increased by the framework. We are allowed to output solutions that are within a (1 + O(ǫ))-multiplicative factor greater than the optimal objective, but insist on filling the knapsack completely. wj α Fix i ∈ [m] and α > 0 and consider equation (KC). We let ni denote the number of nonzeroes in the row Ai,j. Ignoring j ∈ [n] such that Ai,j = 0, ni is the effective number of items in the current knapsack cover problem. There are several known approximation schemes for knapsack cover that run in time O(ni + poly(1/ǫ)). Here we focus on the similar approaches of Ibarra and Kim [23] and Lawler [27].10 A sketch of the algorithm (following [27] in particular) is given in Figure 3. The algorithm combines two basic ideas. First, a greedy heuristic can work fairly well. If every item has small 10[23, 27] actually consider the more common maximum knapsack problem, where the goal is to take the maximum sum cost of items that fit within the knapsack. Their ideas extend here by using the modified greedy algorithm of 20 DP+greedy(cost(1), . . . , cost(n); size(1), . . . , size(n); b, β) // we assume without loss of generality that each item has size size(j) ≤ b, and that β is a constant factor approximation for OPT. 1. Compute a collection of O(cid:18) 1 (with cost cost(j) ≥ ǫβ) w/r/t the truncated costs gcost(j) =(cid:22) cost(j) ǫ2(cid:19) pareto optimal sets S over the expensive items ǫ2β (cid:23)ǫ2β. 2. For each pareto-optimal set S ∈ S, greedily add cheap items (with cost cost(j) < ǫβ) to S in increasing order of cost-to-size ratio until S fills the knapsack. 3. Return the best solution S ∈ S Figure 3: High-level sketch of the algorithm by Lawler [27] for approximating knapsack cover problems. cost relative to the optimum value, then the greedy algorithm repeatedly taking the item with minimum cost-to-size ratio until the knapsack is filled is a good approximation. When costs are large, the greedy heuristic can be modified to provide a constant factor approximation within the same O(n log n) running time [15]. For expensive items (relative to the optimum value), one can take advantage of the fact that (a) only a few expensive items can fit in any optimum solution, and that (b) expensive items can have their costs discretized while changing their costs by only a small relative factor. After discretization, the expensive items in the optimum solution can be efficiently guessed by dynamic programming, and the discretization only introduces a small relative error. We require the following facts about the algorithm DP+greedy. We state the running time w/r/t the total number of items in a generic problem, denoted by n, which would be replaced by ni in our particular setting. Lemma 3.1 ([23, 27]). 1. If β is a constant factor approximation of the optimum value, then DP+greedy returns a (1 + O(ǫ))-multiplicative approximation to the minimum cost knapsack cover. 2. If the items are sorted in increasing order of cost-to-size ratio, and the prefix sums over the sorted list w/r/t size are precomputed, the greedy algorithm can be simulated in O(log n) time. After preprocessing all the cheap items (with cost cost(j) < ǫβ) in this way, the greedy aug- mentation in line 3 can be implemented in O(log n) time for each set S ∈ S. 3. If, for each k ∈ N, the expensive items of truncated cost gcost(j) = kǫ2β are sorted in decreasing ǫ4(cid:19) time. order of size, then line 2 can be computed in O(cid:18) 1 Marrying DP+greedy with the MWU framework in O(cid:18)poly(cid:18) 1 ǫ(cid:19)(cid:19) time per iteration has two components. First, we want to make DP+greedy partially dynamic as the costs cost(j) are increased via increments to weights wj. Second, after computing a good solution, we want to be able to [15] to obtain a constant factor approximation. Faster or incomparable running times for maximum knapsack have been achieved since by more sophisticated techniques [24, 33, 6]; we follow [23, 27] for the sake of simplicity. 21 simulate a weight update along the solution in O(cid:18)poly(cid:18) 1 ǫ(cid:19)(cid:19) amortized time. There are basic reasons (discussed earlier in Section 3.2) why neither component should be feasible. 3.4 Dynamically updating the minimum cost knapsack The first goal is to be able to respond to weight updates and generate the solution to the next knapsack cover problem quickly. By Lemma 3.1, this boils down to two basic data structures. First, we need to be able to maintain items in increasing order of cost-to-size ratio along with the prefix sums w/r/t size in order to reduce the greedy algorithm to a binary search. This allows us to greedily augment each candidate set S ∈ S with inexpensive items in line 3 in O(log n) time per set. Second, we need to maintain, for each expensive item, all the expensive items with the same truncated cost in descending order of size. Note that a constant factor approximation β is provided by the threshold λ from the lazy greedy thresholding scheme of Section 3.1.2. Since only a constant factor is required, we actually set and maintain β to be the next power of 2 of λ, β = 2⌈log λ⌉. We address the second point first, because it is much simpler. We need to maintain, for each k ∈ N, the set of items with truncated cost gcost(j) = kǫ2β sorted in descending order of size. This is very easy -- when an item's cost increases, we reinsert it into the appropriate sorted list in O(ni) time; when β increases, we rebuild all the lists, from scratch, in O(ni log n) time. Lemma 3.2. In O(log n) time per weight update, and O(ni log n) time per update to β, one can order of size. maintain, for each k ∈ N, the expensive items of truncated cost gcost(j) = kǫ2β sorted in descending The next step is a data structure to facilitate the greedy algorithm in lines 1 and 3. If the items are sorted in ascending order or cost-to-size ratio, and the prefix sums w/r/t size are precomputed, then the greedy algorithm can be implemented by a binary search. In the face of dynamically changing costs, we can maintain both these values with dynamic tree data structures. Our setting is simpler because the range of possible costs of a particular item is known in advance, as follows. Observation 3.3. For fixed j ∈ [n] with Ai,j 6= 0, let Cj =( (1 + ǫ)k α min{Ai,j, α} : k ∈(cid:26)0, 1, . . . , O(cid:18) log m ǫ2 (cid:19)(cid:27)). Then cost(j) ∈ Cj. For j ∈ [n] with Ai,j 6= 0, let Rj = {α/ size(j) : α ∈ Cj} be the set of possible cost-to-size ratios for j. For any j with Ai,j 6= 0, we have Rj = Cj ≤ O(cid:18)log n ǫ2 (cid:19). Knowing all the possible ratios in advance allows for a simpler data structure. We will benefit from the simplicitly later when we need to incorporate efficient weight updates. Consider the set L = {(j, α) : Ai,j 6= 0 and α ∈ Rj}. L consists of all possible assignments of ratios to items. We ǫ2 (cid:19) and consider L as a sorted set based on the ratio, breaking ties arbitrarily. have L ≤ O(cid:18) ni log n We build a balanced binary tree over L. We mark a leaf (j, α) as occupied iff cost(j) ≤ ǫβ and cost(j)/ size(j) = α. For each internal node, we track the sum size of all items in leaves marked as occupied. The tree has depth O(log n), and in particular we can update the tree in O(log n) time when an item's weight increases. The tree can be rebuilt O(ni log n) time per update to β. As the leaves are in ascending order of cost-to-size ratio, any set of items considered by the greedy algorithm corresponds to the occupied leaves of an interval in the range tree. The total size 22 of a greedy set is the total size of occupied leaves in the corresponding interval. To compute the sum size of a set of greedily selected items, we first decompose the corresponding interval in the range tree to the disjoint union of O(log n) subtrees. For each subtree, the root is labeled with the sum size of all occupied leaves in the subtree. Summing together these O(log n) values gives us the total size of the greedy sequence. With this data structure, we can simulate the greedy algorithm in O(log n) time by running a binary search for the shortest prefix that fills the knapsack. Lemma 3.4. In O(cid:18) ni log n ǫ2 (cid:19) time initially, O(log n) time per weight update, and O(ni log n) time per update to β, one can maintain a data structure that simulates the greedy algorithm over the cheap items (with cost cost(j) < ǫβ) in O(log n) time. 3.5 Updating weights along a knapsack cover solution In Section 3.4, we showed how to modify known FPTAS's for knapsack cover so that it can respond to increases in costs quickly without redoing everything from scratch. This removes one bottleneck from the overall MWU framework, in that the Lagrangian relaxations can now be solved in O(poly(1/ǫ)) amortized time per weight update. There is still another bottleneck just as important as computing a approximation S to the knapsack cover problem; namely, simulating a weight update w/r/t the solution S. Let S be a solution to (KC) for fixed i and α. The MWU framework dictates that the weights w should update to a new set of weights w′ per the following formula: w′ j = wj exp(cid:18) ǫAS,i,j/cj max∈S AS,i,/c(cid:19)wj if j /∈ S if j ∈ S. We circumvent this lower bound by taking advantage of the structure of our solution S. A The basic problem is as follows. By the above formula, every coordinate j ∈ S has its weight adjusted. Updating these weights directly requires O(S) time to visit each item. Since S may be as large as n, and there are O(cid:18) n log n O(cid:0)n2 log n/ǫ2(cid:1). With no assumptions on S, this is seemingly the best that one can expect. solution S to the knapsack cover problem (KC) for fix i and α consists of O(cid:18) 1 and a greedily selected sequence of cheap items. Since there are only O(cid:18)1 can spend O(cid:18) 1 ǫ2 (cid:19) iterations, this already leads to a running time of ǫ(cid:19) expensive items ǫ(cid:19) expensive items, we ǫ(cid:19) time to update each of them individually. By contrast, there is no upper bound on the number of cheap items in our solution. Recall the data structure by which we simulate the greedy algorithm in the previous section. The items in greedy order in a balanced binary tree so that any subsequence of this order decomposes into the leaf sets of O(log n) disjoint subtrees. The subtrees implicitly define canonical intervals such that 1. There are a total of O(cid:18) ni log n ǫ2 (cid:19) canonical intervals. 2. Any item appears in at most O(log n) canonical intervals. 23 3. Any greedy sequence decomposes into O(log n) canonical intervals. This is essentially the same setup as in [8], where intervals are fractionally packed into capacitated points on the real line. Similar techniques are also employed in [7]. We briefly discuss the high-level ideas and refer to previous work [8, 7] for complete details. There is a small technical adjustment required that is discussed at the end. Decomposing the solution into a small number of known static sets is important because weight updates can be simulated over a fixed set efficiently. More precisely, the data structure lazy-inc, defined in [8] and inspired by techniques by Young [43], simulates a weight update over a fixed set of weights in such a way that the time can be amortized against the logarithm of the increase in each of the weights. The total increase of any weight is bounded above by invariants revealed in the analysis of the MWU framework. It is easy to make lazy-inc dynamic, allowing insertion and deletion into the underlying set, in O(log n) time per insertion or deletion [7]. We define an instance of lazy-inc at each node in the balanced binary tree over cheap items as defined above. Whenever a leaf is marked as occupied, it is inserted into each of O(log n) instances of lazy-inc at the ancestors of the leaf; when a leaf is marked as unoccupied, it is removed from each of these instances as well. Each instance of lazy-inc can then simulate a weight update over the marked leaves at its nodes in O(log n) amortized time. Given a greedy sequence of cheap items, we divide the sequence into the disjoint union of the marked leaves of O(log n) subtrees as discussed above. For each subtree, we simulate a weight update over the leaves via the instance of lazy-inc at the root of the subtree. One final technical modification is required to make the algorithm sound. Each instance of lazy-inc accrues a small amount of error. Within a fixed choice of i and α, the sum of errors for a single weight is small because an item is tracked by only O(log n) instances of lazy-inc. Across all the choices of i and α, however, a single weight may be managed by O(m log(C) log(n)/ǫ) instances of lazy-inc. A similar accrual of error across instances of lazy-inc also arises in [7]. A final feature of the lazy-inc data structure, made explicit in [7], is that one can "flush" the error of an instance in O(1) time per tracked item. We use this feature within the context of the overall lazy greedy algorithm. Recall that by thresholding the optimum value and trying choices of i and α in round robin fashion, we move on from a fixed choice of i and α iff the optimum value for these parameters have gone up by a full O(1 + ǫ)-multiplicative factor, which occurs for any particular i and α at most O(cid:0)log(n)/ǫ2(cid:1) times. Thus, whenever we move on from a fixed choice of i and α, we "flush" all the lazy-inc data structures for this choice of i and α in O(ni log n) time, so that no error is carried across different values of i and α. Lemma 3.5. One can extend the data structures of Lemma 3.4 such that, given a solution S generated by Lemma 3.2 and Lemma 3.4 to an instance of (KC) for i ∈ [m] and α > 0, one can simulate a weight update over (i, S) in O(log n) amortized time per iteration. The extension induces an overhead of O(cid:0)log2 n(cid:1) per weight update, O(ni log n) per (1 + ǫ)-factor increase to λ, and O(cid:0)ni log2 n(cid:1) per constant factor increase to λ. 3.6 Putting things together In this section, we summarize the main points of the algorithm and account for the running time claimed in Theorem 1.3. Proof of Theorem 1.3. By known analyses (e.g., [8, Theorem 2.1]), the MWU framework returns a (1 − O(ǫ))-multiplicative approximation to the packing LP (D) as long as we can approximate at most a mO( 1 ǫ )-multiplicative factor, and we can afford to approximate wj by a multiplicative the relaxation (R) in each of O(cid:0)n log n/ǫ2(cid:1) iterations. Moreover, each weight wj increases by 24 (1 ± O(1))-multiplicative factor and to obtain (1 ± O(1))-multiplicative approximation to each re- laxation. Thus, if we only propagate a change to wj when it increases by a (1 + ǫ)-multiplicative factor, correctness still holds, and we can assume that each wj changes at most O(cid:0)log(n)/ǫ2(cid:1) times. In Section 3.1.1, solving (R) is reduced to O(m log(C)/ǫ) instances of minimum knapsack cover. The instances of minimum knapsack cover are visited in a round robin fashion, where an instance is given a value λ > 0 and only needs to output a set S with ratio ≤ (1 + O(ǫ))λ if there exists a set with ratio ≤ (1 + ǫ)λ. For each instance of knapsack cover, we maintain an (1 + ǫ)-approximate ǫ4(cid:19) time. By solution that outputs an approximate solution (in the thresholded sense) in O(cid:18) 1 weight update from the framework, O(cid:0)ni log2 n(cid:1) time to update every time λ increases by a power of 2, and O(ni log n) time every time λ increases by a (1 + ǫ)-multiplicative factor. Moreover, if an instance returns a solution within an (1 + O(ǫ))-multiplicative factor of the threshold S, then it can simulate a weight update along the corresponding knapsack cover constraint (S, i) in O(log) amortized time (per iteration). Lemma 3.1, Lemma 3.4, and Lemma 3.5, the data structure takes O(log n) time to update per The threshold λ increases by a constant factor O(log(n)/ǫ) times and by a (1 + ǫ)-multiplicative time, can be charged to either an iteration of the MWU framework or bumping the instance up factor O(cid:0)log(n)/ǫ2(cid:1) times. The total time spent updating the data structure for a single instance of knapsack cover for the ith constraint is O(cid:0)ni log3 n/ǫ + ni log2 n/ǫ2(cid:1). The total time over all in- stances is thus O(cid:0)N log3(n) log(C)/ǫ2 + N log2(n) log(C)/ǫ3(cid:1). Querying an instance takes O(cid:0)1/ǫ4(cid:1) ǫ6 (cid:19) time is spent querying instances of knapsack to the next threshold. Thus O(cid:18) m log C cover. The total running time is at most O(cid:18)N log3(n) log(C) ǫ6 (cid:19), as desired. m log C n log n n log n + + ǫ5 (cid:4) + ǫ5 ǫ3 Acknowledgments: We thank Neal Young for bringing the paper of Chen, Harris and Srinivasan [12] to our attention. References [1] Zeyuan Allen Zhu and Lorenzo Orecchia. Nearly-linear time positive LP solver with faster convergence rate. In Proceedings of ACM STOC, pages 229 -- 236, 2015. [2] Nikhil Bansal and Subhash Khot. Inapproximability of hypergraph vertex cover and applica- tions to scheduling problems. In Proc. of ICALP, pages 250 -- 261, 2010. [3] Nikhil Bansal, Nitish Korula, Viswanath Nagarajan, and Aravind Srinivasan. Solving packing integer programs via randomized rounding with alterations. Theory of Computing, 8(1):533 -- 565, 2012. [4] Daniel Bienstock and Garud Iyengar. Approximating fractional packings and coverings in o(1/ǫ) iterations. SIAM J. Comput., 35(4):825 -- 854, 2006. Preliminary version in STOC 2004. [5] Robert D. Carr, Lisa Fleischer, Vitus J. Leung, and Cynthia A. Phillips. Strengthening integral- ity gaps for capacitated network design and covering problems. In Proceedings of ACM-SIAM SODA, pages 106 -- 115, 2000. [6] Timothy M. Chan. Approximation schemes for 0-1 knapsack. In 1st Symposium on Simplicity in Algorithms, SOSA, pages 5:1 -- 5:12, 2018. 25 [7] Chandra Chekuri and Kent Quanrud. Approximating the Held-Karp bound for metric TSP in nearly-linear time. In Proceedings of IEEE FOCS, pages 789 -- 800, 2017. [8] Chandra Chekuri and Kent Quanrud. Near-linear time approximation schemes for some implicit fractional packing problems. In Proceedings of ACM-SIAM SODA, pages 801 -- 820, 2017. [9] Chandra Chekuri and Kent Quanrud. Randomized MWU for positive LPs. In Proceedings of ACM-SIAM SODA, pages 358 -- 377, 2018. [10] Chandra Chekuri, Jan Vondrák, and Rico Zenklusen. Submodular function maximization via the multilinear relaxation and contention resolution schemes. SIAM Journal on Computing, 43 (6):1831 -- 1879, 2014. Preliminary version in STOC 2011. [11] Chandra Chekuri, T. S. Jayram, and Jan Vondrák. On multiplicative weight updates for concave and submodular function maximization. In Proceedings of ITCS, pages 201 -- 210, 2015. [12] Antares Chen, David G Harris, and Aravind Srinivasan. Partial resampling to approximate covering integer programs. In Proceedings of 27th ACM-SIAM SODA, pages 1984 -- 2003, 2016. [13] Antares Chen, David G. Harris, and Aravind Srinivasan. Partial resampling to ap- proximate covering integer programs. CoRR, abs/1507.07402v7, September 2018. URL http://arxiv.org/abs/1507.07402v7. [14] Fabián A. Chudak and Vânia Eleutério. Improved approximation schemes for linear program- ming relaxations of combinatorial optimization problems. In Proceedings of IPCO, pages 81 -- 96, 2005. [15] János Csirik, J. B. G. Frenk, Martine Labbé, and Shuzhong Zhang. Heuristic for the 0-1 min-knapsack problem. Acta Cybern., 10(1-2):15 -- 20, 1991. [16] Irit Dinur, Venkatesan Guruswami, Subhash Khot, and Oded Regev. A new multilayered PCP and the hardness of hypergraph vertex cover. SIAM Journal on Computing, 34(5):1129 -- 1146, 2005. Preliminary version in STOC 2003. [17] Gregory Dobson. Worst-case analysis of greedy heuristics for integer programming with non- negative data. Mathematics of Operations Research, 7(4):515 -- 531, 1982. [18] Uriel Feige. A threshold of ln n for approximating set cover. J. ACM, 45(4):634 -- 652, 1998. Preliminary version in STOC 1996. [19] Lisa Fleischer. Approximating fractional multicommodity flow independent of the number of commodities. SIAM J. Discrete Math., 13(4):505 -- 520, 2000. Preliminary version in FOCS 2000. [20] Anupam Gupta and Viswanath Nagarajan. Approximating sparse covering integer programs online. Math. Oper. Res., 39(4):998 -- 1011, 2014. Preliminary version in ICALP 2012. [21] David G Harris and Aravind Srinivasan. The Moser-Tardos framework with partial resampling. In Proceedings of IEEE FOCS, pages 469 -- 478. IEEE, 2013. [22] Dorit S Hochbaum. Approximation algorithms for the set covering and vertex cover problems. SIAM Journal on computing, 11(3):555 -- 556, 1982. 26 [23] Oscar H. Ibarra and Chul E. Kim. Fast approximation algorithms for the knapsack and sum of subset problems. J. ACM, 22(4):463 -- 468, 1975. [24] Hans Kellerer and Ulrich Pferschy. Improved dynamic programming in connection with an FPTAS for the knapsack problem. J. Comb. Optim., 8(1):5 -- 11, 2004. [25] Stavros G. Kolliopoulos and Neal E. Young. Approximation algorithms for covering/packing integer programs. J. Comput. Syst. Sci., 71(4):495 -- 505, 2005. Preliminary version in FOCS 2001. [26] C. Koufogiannakis and N. E. Young. A nearly linear-time PTAS for explicit fractional packing and covering linear programs. Algorithmica, 70(4):648 -- 674, 2014. Preliminary version in FOCS 2007. [27] Eugene L. Lawler. Fast approximation algorithms for knapsack problems. Math. Oper. Res., 4 (4):339 -- 356, 1979. [28] Michael W Mahoney, Satish Rao, Di Wang, and Peng Zhang. Approximating the solution to mixed packing and covering LPs in parallel O(ǫ−3) time. In Proc. of ICALP, 2016. [29] Robin A Moser and Gábor Tardos. A constructive proof of the general Lovász local lemma. Journal of the ACM (JACM), 57(2):11, 2010. [30] Dana Moshkovitz. The projection games conjecture and the NP-hardness of ln n-approximating set-cover. Theory of Computing, 11:221 -- 235, 2015. Preliminary version in APPROX -- RANDOM 2-12. [31] David Pritchard and Deeparnab Chakrabarty. Approximability of sparse integer programs. Algorithmica, 61(1):75 -- 93, 2011. [32] Prabhakar Raghavan and Clark D. Thompson. Randomized rounding: a technique for provably good algorithms and algorithmic proofs. Combinatorica, 7(4):365 -- 374, 1987. [33] Donguk Rhee. Faster fully polynomial approximation schemes for knapsack problems. Master's thesis, MIT, 2015. [34] Rishi Saket and Maxim Sviridenko. New and improved bounds for the minimum set cover problem. In Proceedings of APPROX, pages 288 -- 300, 2012. [35] Aravind Srinivasan. Improved approximation guarantees for packing and covering integer pro- grams. SIAM J. Comput., 29(2):648 -- 670, 1999. [36] Aravind Srinivasan. New approaches to covering and packing problems. In Proceedings of ACM-SIAM SODA, pages 567 -- 576, 2001. [37] Aravind Srinivasan. An extension of the Lovász local lemma, and its applications to integer programming. SIAM J. Comput., 36(3):609 -- 634, 2006. [38] Luca Trevisan. Non-approximability results for optimization problems on bounded degree instances. In Proceedings on 33rd ACM STOC, pages 453 -- 461, 2001. [39] Vijay V Vazirani. Approximation algorithms. Springer Science & Business Media, 2013. 27 [40] Di Wang, Satish Rao, and Michael W. Mahoney. Unified acceleration method for packing and covering problems via diameter reduction. In Proc. of ICALP, pages 50:1 -- 50:13, 2016. [41] David P. Williamson and David B. Shmoys. The design of approximation algorithms. Cambridge university press, 2011. [42] Laurence A Wolsey. An analysis of the greedy algorithm for the submodular set covering problem. Combinatorica, 2(4):385 -- 393, 1982. [43] Neal E. Young. for mixed pack- ing/covering and facility-location linear programs. CoRR, abs/1407.3015, 2014. URL http://arxiv.org/abs/1407.3015. approximation linear-time schemes Nearly A The regime of small ∆1 Let δ > 0 be a small parameter to be determined later. In this section, we consider the regime where ∆1 is asymptotically small. For ∆1 sufficiently small, we show that round-and-fix obtains an approximation ratio of 1 + O(cid:16)p∆1 ln(1/∆1)(cid:17). Note that this bound is slightly weaker than the 1 + O(cid:16)p∆1(cid:17) bound obtained by Chen et al. [12]. cp∆1 ln(1/∆1) for some constant c > 0.) We set the scaling factor α to Note that α ≤ (1 + (1 + δ)δ)(cid:18)1 + δ + 2(cid:19) ≤ 1 + 2δ + O(cid:0)δ2(cid:1) for sufficiently small δ > 0. The analysis again depends on identifying a "threshold" coefficient ρi for each row i, but is no longer the weighted median coordinate (weighted by x). One basic reason that the definition of ρi must be modified is as follows. Recall that considering only the coverage induced by ρi-small . (This in coefficients allows us to amplify the Chernoff inequality exponentially by a factor of (We will eventually set δ = 1 + δ + δ2/2 1 − δ δ2 α = . 1 ρi 1 ρi turn offsets the multiplicative factor in the fixing cost.) To apply the Chernoff bound, we required that the expected coverage of ρi-small (when scaling by up α and rounding) is greater than 1. In our case, α = 1 + O(δ) is very close to 1. To apply the Chernoff inequality to ρi-small coordinates, we require that the fractional coverage of ρi-small coordinates is at least 1/α; that is, very close to 1, rather than just 1/2. Thus, for i in [m], we let ρi be the weighted rank-δ largest coefficient as follows. Lemma A.1. For each i ∈ [m], there exists a value ρi ∈ [0, ∆1] such that XAij ≤ρi Aijxj ≥ 1 − δ and XAij ≥ρi Aijxj ≥ δ. Choosing ρi to be the rank-δ coefficient boosts the randomized rounding, since the expected coverage from rounding ρi-small coordiantes is at least (1 − δ)α. On the other hand, rounding the ρi-big coordinates (which have only δ fractional coverage) leads to an integral vector with coverage δ. To obtain an integral vector with coverage 1, one can take 1/δ copies of the integral vector with coverage δ, increasing the cost by a 1 δ -multiplicative factor. 28 Lemma A.2. For each i ∈ [m], one can compute in near-linear time an integral vector z ∈ Zn with cost ≥0 hc, zi ≤ O 1 δρi nXj=1 cjAijxj and coverage (Az)i ≥ 1. Proof. Consider the problem minhc, zi over z ∈ Zn ≥0 s.t. (Az)i ≥ 1. Observe that each coefficient Aij is ≤ ∆1, so this is just an instance of Knapsack Cover for which there is a PTAS and a simple constant factor greedy algorithm, and the integrality gap is 2. Thus it suffices to find a fractional vector y ∈ Rn (Ay)i ≥ 1. ≥0 with (say) hc, yi ≤ cjAijxj and coverage nXj=1 1 δρi Define y ∈ Rn ≥0 by First, y has coverage yj = Xj Aijyj = xj 1 δ 0 if Aij ≥ ρi, otherwise. 1 δ XAij≥ρi Aijxj (a) ≥ 1, by (a) choice of ρi. Second, y has cost hc, yi = 1 δ XAij≥ρi cjxj ≤ 1 δρi XAij ≥ρi cjAijxj ≤ 1 δρiXj cjAijxj, as desired. (cid:4) Lemma A.2 establishes an upper bound on the fixing cost. It remains to obtain concentration bounds for the probability of the ith constraint failing to be covered. Note that we need a probability factor in Lemma A.2. In fact, if we can of failure proportional to ρi for each i to cancel the show that P[(Az)i < 1] ≤ ρi for all i, then the total expected fixing cost over all i would sum to (cid:18) ∆1 δ (cid:19)hc, xi, as desired. We first obtain the following. 1 ρi − δ2 Lemma A.3. For each i ∈ [m], P[(Az)i < 1] ≤ e Proof. We apply the Chernoff inequality to the ρi-small coordinates. From the choice of α and ρi 2ρi . we have E Xj:Aij≤ρi α 1 − δ ≥ 1 + δ + Aijzj ≥ P[(Az)i < 1] ≤ P XAij ≤ρi δ2 2 . Therefore, Aijzj < 1 − ǫ 29 (a) δ2 ≤ exp(cid:18) 1 ≤ exp(cid:18) 1 = exp(cid:18)− ρi(cid:18)1 + ln(cid:18)1 + δ + ρi(cid:18)1 + ln(cid:16)eδ(cid:17) − 1 − δ − 2ρi(cid:19). 2(cid:19) − 1 − δ − 2(cid:19)(cid:19) δ2 δ2 δ2 2(cid:19)(cid:19) by (a) Taylor expansion of eδ for δ > 0. (cid:4) It remains to choose δ such that the upper bound in Lemma A.3 is at most O(ρi). For sufficiently small ∆1, it suffices to take δ ≥ 2p∆1 ln(1/∆1), as follows. Lemma A.4. Let δ ≥ 2p∆1 ln(1/∆1). For sufficiently small ∆1, we have Proof. By Lemma A.3, it suffices to show that exp(cid:18)− (cid:19) ≤ 1 ln2(1/∆1) ≤ ρi, P[(Az)i < 1] ≤ ρi. exp(cid:18)− ∆1 ln(1/∆1) ∆1 ln(1/∆1) 2∆2 ρ2 i ρi ρi (cid:19) ≤ ρi. If ρi ≤ ∆2 1, then we have as desired. If ρi ≥ ∆2 1, then since ρi ≤ ∆1, we have exp(cid:18)− 2∆1 ln(1/∆1) ρi (cid:19) ≤ exp(−2 ln(1/∆1)) = ∆2 1 ≤ ρi, as desired. (cid:4) We now add up the various costs and obtain the desired approximation factor. Theorem A.5. round-and-fix returns a randomized vector z with Az ≥ 1 and E[hc, zi] ≤(cid:16)1 + (4 + o(1))p∆1 ln(1/∆1)(cid:17)hc, xi. Proof. Let δ = 2p∆1 ln(1/∆1). The total expected cost is sum of the expected cost of randomized rounding, P[(Az)i < 1] and the total expected fixing cost. The total expected fixing cost is at most αhc, xi =(cid:0)1 + 2δ + O(cid:0)δ2(cid:1)(cid:1)hc, xi =(cid:16)1 + (4 + o(1))p∆1 ln(1/∆1)(cid:17)hc, xi,  OXi Aij ≤ O(cid:18)√∆1hc, xi ln(1/∆1)(cid:19) cjAijxj = O 1 ≤ O 1 up to(cid:16)1 + (4 + o(1))p∆1 ln(1/∆1)(cid:17)hc, xi, as desired. mXi=1 mXi=1 nXj=1 nXj=1 AijP[(Az)i < 1] nXj=1 1 δρi cjxj cjxj ρi (a) δ δ by (a) Lemma A.4. Thus the expected costs of randomized rounding and subsequently fixing add (cid:4) 30 Remark A.6. Our preceding analysis does not appear to be tight. The expected fixing cost is balanced. We note that our analysis did not take into account a more careful fixing process that considers the expected value of the residual requirement after the initial random step. Our efforts in O(cid:18)√∆1hc, xi ln(1/∆1)(cid:19) for the choice of α = 1 + Ω(cid:16)p∆1 log(1/∆1)(cid:17). The two terms in the cost are not doing such a careful analysis have not so far succeeded in obtaining the bound (1+ O(cid:16)p∆1(cid:17)) which we believe is the right bound for the algorithm. In fact it is quite conceivable that the resampling framework from [12] implies such a bound for the alteration algorithm. B Chernoff inequalities The standard lower tail bound in multiplicative Chernoff inequalities is the following. e−δ Xi#, and δ ∈ (0, 1). Then Lemma B.1. Let X1, . . . , Xn ∈ [0, 1] be independent with µ = E" nXi=1 Xi < (1 − δ)µ# ≤(cid:18) P" nXi=1 scaling, improves to P" nXi=1 Typically a simplified version of the upper bound, namely, exp(cid:0)−δ2µ/2(cid:1) is used. However, in the interest of leading constants, we need to employ Lemma B.1 carefully. For this reason, and also for use as pessimistic estimators for derandomization in Section 2.4, we isolate explicit (intermediate) forms that we need. Several of the following inequalities are standard and we include proofs for the sake of completeness. (1 − δ)1−δ(cid:19)µ Xi < (1 − δ)µ# ≤(cid:18) . If X1, . . . , Xn ∈ [0, γ] for some γ ≤ 1 then the bound, by e−δ (1 − δ)1−δ(cid:19)µ/γ . Lemma B.2. Let X ∈ [0, 1] be a random variable and t ∈ R. Then E[exp(tZ)] ≤ exp(cid:0)E[Z](et − 1)(cid:1). Proof. Consider the function f (x) = exp(tx). f is convex. By (a) convexity of f , for any fixed value of Z, we have exp(tZ) = f ((1 − Z) · 0 + Z · 1) (a) ≤ (1 − Z)f (0) + Zf (1) = 1 − Z + Zet = 1 + Z(et − 1). By (b) taking expectations of both sides and (c) applying 1 + x ≤ ex, we have E[tZ] as desired. (b) ≤ 1 + E[Z](cid:0)et − 1(cid:1) (c) ≤ exp(cid:0)E[Z](cid:0)et − 1(cid:1)(cid:1), Lemma B.3. Let X1, . . . , Xn ∈ [0, 1]n be independent random variables, let µ = E" nXi=1 β ∈ R>0. If β < µ, then P" nXi=1 Xi < β# ≤(cid:18) µ β(cid:19)β nYi=1 E"(cid:18) β µ(cid:19)Xi# ≤ exp(cid:18)β + β ln µ β − µ(cid:19). 31 (cid:4) Xi#, and Proof. This lemma can be proven by appropriate substitutions into the standard Chernoff inequality, but we instead prove it directly. Let t > 0 be determined later. By (a) Markov's inequality, (b) independence of the Yi's, (c) Lemma B.2 w/r/t Z = Xi, we have P" nXi=1 Xi < β# = P"exp −t nXi=1 Xi!# exp(tβ) Xi! > exp(−tβ)# (a) ≤ E"exp −t exp(cid:0)E[Xi]e−t − 1(cid:1)! exp(tβ) ≤ nYi=1 nXi=1 (c) (b) E[exp(−tXi)]! exp(tβ) = nYi=1 = exp(cid:0)µ(cid:0)e−t − 1(cid:1) + tβ(cid:1). f ′(t) = 0 ⇐⇒ µ exp(−t) = β ⇐⇒ t = ln µ β . Consider the exponent as a function of t, f (t) = µ(exp(−t) − 1) + tβ. We have (cid:4) let µ = > 0, as required when t was declared above. β(cid:19). Note that µ > β =⇒ t = ln µ β Xi < β# ≤ ··· ≤ exp(cid:18)β − µ + β ln µ β(cid:19). Consider t = ln(cid:18) µ For this choice of t, we have P" nXi=1 E" nXi=1 Xi#. Then Lemma B.4. Let X1, . . . , Xn ∈ [0, γ] be independent random variables for γ > 0, P" nXi=1 Xi < 1# ≤ µ1/γ Ehµ−Xi/γi ≤ exp(cid:18) 1 γ nYi=1 (1 + ln(µ) − µ)(cid:19). Proof. By (a) scaling up and each Xi by a factor of 1/γ, (b) applying Lemma B.3 (with µ scaled up by a factor of 1/γ and β = 1/γ), and (c) canceling terms, we have P" nXi=1 Xi < 1# (a) = P" nXi=1 Xi γ < as desired. 1 γ# (b) ≤ exp(cid:18) 1 γ + 1 γ ln µ/γ 1/γ − µ = exp(cid:18) 1 γ(cid:19) (c) γ (1 + ln µ − µ)(cid:19), Lemma B.5. Let X1, . . . , Xn ∈ [0, γ] be independent random variables for γ > 0, (cid:4) let µ = E" nXi=1 Xi#, and β ∈ R>0. If β < µ, then β(cid:19)β/γ nYi=1 Xi < β# ≤(cid:18) µ P" nXi=1 E"(cid:18)β µ(cid:19)Xi/γ# ≤ exp(cid:18) β − µ + β ln(µ/β) γ (cid:19). Proof. For each i, we have Xi/γ ≤ 1. By (a) Lemma B.3, with β, µ, and the Xi's scaled by a factor of , we have 1 γ P" nXi=1 Xi < β# = P" 1 γ nXi=1 Xi < as desired. β γ# (a) ≤ exp(cid:18) β γ + β γ ln µ β − µ γ(cid:19) = exp(cid:18) 1 γ(cid:18)β + β ln µ β − µ(cid:19)(cid:19), (cid:4) 32 Lemma B.6. Let X1, . . . , Xn ∈ [0, γ] be independent with µ = E" nXi=1 Xi < 1# ≤ δ. µ γ ≥ ln 1 + ln ln(1/δ) ln(1/δ) − 1 , then P" nXi=1 + ln ln + 1 + and 1 δ 1 δ Xi#, and δ ∈ (0, 1). If µ > γ µ γ 1 δ 1 δ = ln + ln ln Proof. We set + 1 + ǫ for a variable ǫ ∈ R, and find the minimum the choice of ǫ that obtains the desired tail inequality. By Lemma B.4, it suffices to choose ǫ such that µ γ − ln µ γ − 1 ≥ ln(1/δ). We have µ γ − ln µ γ − 1 = ln = ln 1 δ 1 δ + ln ln + ln ln 1 δ 1 δ 1 δ + 1 + ǫ − ln(cid:18)ln + ǫ − ln(cid:18)ln 1 δ + ln ln + ln ln 1 δ + 1 + ǫ(cid:19) − 1 + 1 + ǫ(cid:19). 1 δ Set ǫ such that 1 + ǫ + ln ln(1/δ) = ǫ ln(1/δ); namely, set ǫ = requirement that δ ∈ (0, 1) ensures that ln(1/δ) > 1.) Then, continuing the above, we have . (Note that the 1 + ln ln(1/δ) ln(1/δ) − 1 1 δ 1 δ + ln ln µ γ − ln = ln(cid:18) 1 µ γ − 1 = ··· = ln δ(cid:19) + ǫ − ln(1 + ǫ) + ǫ − ln(cid:18)(1 + ǫ) ln(cid:18) 1 δ(cid:19)(cid:19) ≥ ln(cid:18) 1 δ(cid:19), Lemma B.7. Let X1, . . . , Xn ∈ [0, 1] be independent with µ = E" nXi=1 Xi < β# ≤ δ. where (a) uses the inequality 1 + ǫ ≤ exp(ǫ). µ γ ≥ ln 1 + ln ln(1/δ) ln(1/δ) − 1 + ln ln + 1 + 1 δ 1 δ (a) If (cid:4) Xi#, δ ∈ (0, 1), and β ∈ [0, µ). Proof. By Lemma B.3, we have P" nXi=1 Consider setting µ β = ln(1/δ) β µ β − ln µ β − 1 − Set ǫ such that ln(1/δ) β β + β ln µ β − ln µ β − 1 ≥ ln(1/δ) β . µ β − µ ≤ − ln(cid:18)1 + ln(cid:18) ln(1/δ) = ln(cid:18) ln(1/δ) ln(cid:18) ln(1/δ) β (cid:19) + 1 + ǫ for a value ǫ to be determined. Then β (cid:19) + 1 + ǫ(cid:19). β (cid:19) + ǫ − ln(cid:18) ln(1/δ) β (cid:19) + 1 + ǫ = + ln(cid:18) ln(1/δ) ǫ ln(1/δ) β β ; (3) , then P" nXi=1 Xi < β# ≤ δ if δ(cid:19) ⇐⇒ 33 namely, Then ǫ = ln(ln(1/δ)/β) + 1 ln(1/δ)/β − 1 . (3) = ln(cid:18) ln(1/δ) β (cid:19) + ǫ − ln(cid:18)(1 + ǫ) β (cid:19) (a) where (a) uses the inequality 1 + ǫ ≤ eǫ. Plugging back in, we have ln(1/δ)/β − 1(cid:18)ln(cid:18) ln(1/δ) ln(1/δ)/β ln(ln(1/δ)/β) + 1 ln(1/δ)/β − 1 µ β = ln(cid:18) ln(1/δ) β (cid:19) + 1 + ln(1/δ) = ǫ − ln(1 + ǫ) ≥ 0, = β (cid:19) + 1(cid:19) (cid:4) 34
1211.1857
1
1211
2012-11-08T14:13:04
Simple I/O-efficient flow accumulation on grid terrains
[ "cs.DS" ]
The flow accumulation problem for grid terrains takes as input a matrix of flow directions, that specifies for each cell of the grid to which of its eight neighbours any incoming water would flow. The problem is to compute, for each cell c, from how many cells of the terrain water would reach c. We show that this problem can be solved in O(scan(N)) I/Os for a terrain of N cells. Taking constant factors in the I/O-efficiency into account, our algorithm may be an order of magnitude faster than the previously known algorithm that is based on time-forward processing and needs O(sort(N)) I/Os.
cs.DS
cs
Simple I/O-efficient flow accumulation on grid terrains Herman Haverkort∗ Jeffrey Janssen† Abstract The flow accumulation problem for grid terrains takes as input a matrix of flow directions, that specifies for each cell of the grid to which of its eight neighbours any incoming water would flow. The problem is to compute, for each cell c, from how many cells of the terrain water would reach c. We show that this problem can be solved in O(Scan(N )) i/o's for a terrain of N cells. Taking constant factors in the i/o-efficiency into account, our algorithm may be an order of magnitude faster than the previously known algorithm that is based on time-forward processing and needs O(Sort(N )) i/o's. 1 Introduction Current remote-sensing technology provides high-resolution terrain data for geographic information sys- tems (gis). In particular, with lidar technology one can get detailed elevation models of the earth surface. These are usually made available in the form of a triangulated irregular network (tin) or a grid: a matrix with elevation values for points in a regular grid on the surface of the earth. One important application of such models are hydrological studies: analysing the flow of water on a terrain, for example to study the effects of possible human intervention or to estimate risks of erosion. The grid models may be as large as several dozen gigabytes so that they do not fit in the main memory of a computer at once. Therefore hydrological analysis requires efficient algorithms that scale well and are designed to minimise the swapping of data between main memory and disk. Throughout the current decade Arge et al. have designed and published such algorithms for the following pipeline of computations on terrain data: to be interrupted by virtual dams that result from sampling errors [2, 4, 7]; • constructing an elevation model from raw elevation samples [1, 7]; • (partial) flooding: eliminating spurious depressions from the model, so that streams do not appear • flow routing: determining in what direction water could flow on each point of the terrain, in such a way that from every point of the terrain water would follow a non-ascending path to the lowest point of the watershed that contains that point [4, 7]; flows to that point [4, 6, 7]; • flow accumulation: computing for every point of the terrain the size of the region from which water • hierarchical watershed labelling: giving each point of the terrain a label that indicates its position in the watershed hierarchy [5, 7]. Arge et al. implemented these algorithms in the form of a system called TerraStream [7]. While the published algorithms have been shown to be very effective, in this paper we will show that for some of these algorithms alternatives exist that may process grid models (but not tins) up to an order of magnitude faster. Analysing I/O-efficiency In this paper we analyse the efficiency of algorithms with the standard model that was defined by Aggarwal and Vitter [3]. In this model, a computer has a memory of size M and a disk of unbounded size. The disk is divided into blocks of size B. Data is transferred between memory and disk by transferring complete blocks: transferring one block is called an "i/o". Algorithms can only operate on data that is currently in main memory; to access the data in any block that is not in main memory, it first has to be copied from disk. If data in the block is modified, it has to be copied back to disk later, at the latest when it is evicted from memory to make room for another block. In this paper we will be concerned with the i/o-efficiency of algorithms: the number of i/o's they need as a function of the ∗TU Eindhoven, the Netherlands, [email protected] †Realworld Systems, Culemborg, the Netherlands, [email protected] input size N , the memory size M , and the block size B. As a point of reference, scanning N consecutive records from disk takes Scan(N ) = Θ(N/B) i/o's; sorting takes Sort(N ) = Θ((N/B) logM/B(N/B)) i/o's in the worst case [3]. It is sometimes assumed that M = Ω(B2). We distinguish cache-aware algorithms and cache-oblivious algorithms. Cache-aware algorithms may use knowledge of M and B (and to some extent even control B) and they may use this to control which blocks are kept in memory and which blocks are evicted. Cache-oblivious algorithms do not know M and B and cannot control which blocks are kept in memory: the caching policy is left to the hardware and the operating system. Nevertheless cache-oblivious algorithms can often be designed and proven to be i/o-efficient [8]. The idea is to design the algorithm's pattern of access to locations in input and output files such that effective caching is achieved by any reasonable general-purpose caching policy (such as least-recently-used replacement) for any values of M and B. As a result, any bounds that can be proven on the i/o-efficiency of a cache-oblivious algorithm do not only apply to the transfer of data between disk and main memory, but also to the transfer of data between main memory and the various levels of smaller caches. However, in practice cache-oblivious algorithms cannot always match the performance of cache-aware algorithms that are tuned to specific values of M and B. Our results We present and analyse several algorithms for flow accumulation on grid terrains: • an "i/o-naıve" algorithm that processes the grid row by row; • a variant of the above that processes the row-by-row data in so-called Z-order; • a variant of the above that processes data that is stored in Z-order; • a cache-aware i/o-efficient algorithm based on separators; • a variant of the above that processes data that is stored in Z-order; • a cache-oblivious variant of the above; • and for comparison: the algorithm based on time-forward processing from Arge et al. [4, 6, 7] Our results are summarised in Table 1. We find that the last algorithm induces a significant overhead from sorting the input cells into topological order. This is not only because the sorting itself takes i/o, but also because sorting the cells makes it necessary to store the coordinates in the grid for each cell: the coordinates are needed to sort the cells back into row-by-row order when the computation is complete. Our new algorithms avoid this overhead: they do not sort. The best of our algorithms are asymptotically more efficient than time-forward processing (under mild assumptions), and because the coordinates of a grid cell can always be deduced from its location in the file, there is no overhead from storing coordinates. In practice the difference in performance may be up to an order of magnitude, and preliminary experimental results indicate that our algorithms are fast indeed. For comparison: the authors of TerraStream reported 455 minutes for flow accumulation by time-forward processing, working on a grid of similar size and hardware that appeared to be slightly faster than ours. This suggests that, while the time-forward processing algorithms are more flexible (they are easier to adapt to triangulated terrains and to so-called multiple-flow-direction models), their flexibility comes at a price when processing grid terrains. Simple alternatives such as our algorithms based on Z-order or our cache-aware algorithm are therefore worth to be considered for practical applications. In the following section we discuss some preliminaries: we introduce the confluence assumption which is helpful when analysing the i/o-efficiency of algorithms on realistic inputs, and we discuss how to traverse a grid in Z-order and how to convert a grid file from row-by-row order to Z-order and back. In the next section we present and analyse our flow accumulation algorithms and experimental results. In Section 4 we discuss possible applications of our ideas to other stages of the hydrological analysis pipeline. 2 Preliminaries 2.1 The parameters of the I/O-model Sometimes we will require the tall-cache assumption (M ≥ cB2 for some constant c); when this is the case we will indicate this explicitly. When estimating i/o-volumes, we will explicitly consider the scenarios M = 230 bytes, B = 216 bytes, and M = 230 bytes, B = 214 bytes, in both cases with an input grid of size N = 232 cells (this is roughly the size of the largest grid we experimented with). files asymptotic number of i/o's realistic worst case i/o-volume / running time (in+output) N = 3.5 · 109 algorithm flow accumulation algorithms "naıve" row-by-row scan "naıve" Z-order-scan "naıve" Z-order-scan cache-aware separators cache-aware separators cache-oblivious separators cache-oblivious separators O(N/√B) C R O(N ) O(Scan(N )) CT R O(N ) Z O(N/√B) O(Scan(N )) C R Z R Z O(Scan(N )) AT O(Scan(N )) A O(Scan(N )) T O(Scan(N )) T O(Sort(N )) 111 min. 41 min. 39 min. 118 min. 88 min. 2.0 -- 6.6 A 1.1 A 7.8 -- 32.0 A 2.0 4.0 -- 6.0 A time-forward proc. [4, 6, 7] RZ conversion to/from Z-order Z-order scan row-by-row scan by sorting O(Scan(N )) T O(Scan(N )) S O(Sort(N )) Table 1: R: input/output files in row-by-row order; Z: input/output files in Z-order; RZ: results hold for both formats. A: requires knowledge of M and/or knowledge or tuning of B; C: requires the confluence assumption (see Section 2.2); S: requires that Θ(√B) rows of the input fit in memory; T: requires tall-cache assumption (M ≥ cB2 for some constant c). The i/o-volume is the number of bytes transferred relative to the size of the input and output files, for a range of reasonable values for N , M , and B (see Section 2.1). 2.2 The confluence assumption In the next section we will see that some algorithms would perform very poorly when given a grid of √N × √N cells in which a river flows from the right to the left, making c1√N meanders with an amplitude of c2√N cells (see Figure 1, left), for some constants c1 and c2. However, it does not seem to make all that much sense to take such cases into account in asymptotic analysis: that would suggest that with growing resolution and size of our grids, rivers would get more and larger meanders. But the major features of real drainage networks would never change just because our grids get bigger. To capture this intuition, we pose the confluence assumption, defined as follows. For any square Q of d × d cells, let Q(cid:48) be the square of 3d × 3d cells centered on Q. Let the first far cells of Q be the cells c(cid:48) on the boundary of Q(cid:48) such that from at least one cell c of Q water reaches c(cid:48) before leaving Q(cid:48). The confluence assumption states that there is a constant γ, independent of N and d, such that any square Q has at most γ different first far cells (see Figure 1, middle). We call γ the confluence constant. Informally, the confluence assumption says that the water that flows from any square region will collect into a small number of river valleys before it gets very far. We will use the confluence assumption in the analysis of some of our algorithms. 2.3 Storing grids in Z-order Some of our algorithms will benefit from processing or storing the grid cells in Z-order. This order is defined as follows. Say our input is a grid G of height h and width w. This grid is contained in a matrix G(cid:48) of k × k cells, where k is the smallest power of 2 such that k ≥ h and k ≥ w. Let the first cell of G (in the upper left corner) also be the first cell of G(cid:48). The matrix G(cid:48) has four quadrants of k/2 × k/2 cells. When storing G in Z-order, we first store the part of G in the upper left quadrant of G(cid:48), then the part of G in the upper right quadrant of G(cid:48), then the part of G in the lower left quadrant of G(cid:48), and finally the part of G in the lower right quadrant of G(cid:48). Within each quadrant, the cells of G are ordered recursively in the same way (see Figure 1, right). Computing Z-order coordinates from row/column coordinates and vice versa Assume, for now, that k = h = w, and consider the cell c in row y and column x of the grid. Let y1y2...ym and x1x2...xm be the binary representations of y and x (where m = log2 k). Then the position of c in a Figure 1: Left: an unrealistic grid with a river with Θ(√N ) meanders with an amplitude of Θ(√N ). Middle: a realistic grid. The white encircled cells are the first far cells of Q; it has only few first far cells. Right: Z-order. row-by-row file is y1y2...ymx1x2...xm, and its position in a Z-order file is y1x1y2x2...ymxm. It is therefore quite easy to obtain, for any cell, its position in a row-by-row file from its position in a Z-order file and vice versa. When the input grid is not square or when its height and width are not integral powers of two, the conversion is slightly more difficult, but in practice it can still be done efficiently as follows. Let G be a grid of size h × w stored in Z-order. Then G(cid:48) has size 2m × 2m, where m = max((cid:100)log h(cid:101),(cid:100)log w(cid:101)). of cells outside G. We can now construct two arrays F [1..t] and Z[1..t], where F [i] = (cid:80)i−1 The sequence of cells of the matrix G(cid:48) in Z-order can now be divided into Θ(w + h) subsequences Z[i] =(cid:80)i−1 D1, N1, D2, N2, ..., Dt, Nt, such that each sequence Di consists of cells in G and each sequence Ni consists j=1 Dj and j=1(Dj +Nj). Thus F [i] and Z[i] store, for each segment Di, its offset in the file (which only An offset p in the Z-order file can now be converted to row and column coordinates as follows: find the highest i such that F [i] ≤ p, compute y1x1y2x2...ymxm = Z[i] + (p − F [i]), and extract the row and column coordinates y1y2...ym and x1x2...xm. Row and column coordinates can be converted to an offset in the Z-order file in a symmetric way. stores the cells in G) and its offset in the Z-order traversal of G(cid:48), respectively. Note that F and Z can be computed without reading the input grid. For all reasonable grid sizes F and Z easily fit in main memory. When this is not the case, the number of i/o's incurred by swapping blocks of F and Z is always dominated by the number of i/o's incurred by accessing the cells whose offsets or coordinates are being computed. The costs of converting coordinates can therefore be ignored in the i/o-efficiency analysis of the algorithms in this paper. From a practical point of view one should also consider the effort involved in the bit manipulations that are needed to extract y1y2...ym and x1x2...xm from y1x1y2x2...ymxm, and to find the Z-order offsets of the neighbours of a given cell y1x1y2x2...ymxm. This can also be done efficiently with a method called dilated arithmetic and another set of look-up tables of size Θ(w + h) [9]. Converting grids from/to Z-order efficiently To convert a grid from row-by-row order to Z-order, we consider two very simple cache-oblivious algorithms: (A) read each cell from the row-by-row file and write it to the Z-order file, going through the grid in Z-order, and (B) read each cell from the row-by-row file and write it to the Z-order file, going through the grid row by row. Algorithm (A), the Z-order scan, is efficient when we assume a tall cache. Then there is a z = Ω(B) such that z is a power of two, a square of z2 cells occupies O(z2/B) blocks of the row-by-row file on disk, and these blocks fit in memory. The algorithm processes roughly N/z2 such squares that each form a contiguous section of the Z-order file. For each such section the necessary blocks from the row-by-row file can be read and kept in memory until the section is completely processed. The total number of i/o's for the conversion thus becomes at most O(N/z2 · z2/B) = O(Scan(N )) for reading plus O(Scan(N )) for writing, making a total of O(Scan(N )). If (cid:112)B/s rows of the grid fit in memory, where s is the number of bytes per cell, then algorithm row-by-row file) once and it would be able to keep every output block (which is (cid:112)B/s rows high) in once. In practice the assumption that(cid:112)B/s rows of the grid fit in memory seems reasonable; therefore (B) is even more efficient. Algorithm (B), the row-by-row scan, would read every input block (from the memory until all of its cells have been read. Thus every output-block only needs to be written to disk QQ0 we assume that the i/o-volume of the conversion from row-by-row to Z-order is twice the input size. When (cid:112)B/s rows do not fit in memory, algorithm (B) may cause every output block to be reloaded (cid:112)B/s times, so that the algorithm uses Θ(N/√B) i/o's. Alternatively, one may adapt merge sort to convert a row-by-row file to Z-order in Θ(Sort(N )) i/o's, making two or three read/write passes over the input in practice. To convert a grid from Z-order to row-by-row order, the same algorithms can be used while substi- tuting reading for writing and vice versa. 3 Algorithms for flow accumulation We assume that the input to the flow accumulation problem consists of a file FlowDir that contains one byte for each cell, stored row-by-row. The byte for cell c indicates the flow direction of c: to which of the eight neighbours of c (if any) any water that arrives at c will flow. This neighbour is called the out-neighbour of c. The required output is a file FlowAcc with eight bytes per cell, stored row-by-row, that specify each cell's flow accumulation. The flow accumulation of a cell c is the number of cells that lie upstream of c, including c itself. We can picture the flow accumulation of c as the total number of units of rain that arrive at or pass through c when each cell receives one unit of rain from the sky, which then flows down over the surface from cell to cell, following the flow directions, until it arrives at a cell that does not have an out-neighbour. In the following we describe several algorithms for the flow accumulation problem and also discuss their i/o-volume (number of i/o's times block size) divided by the total size of the input and the output files. With input and output as defined above, the input+output size is 9 bytes times the number of cells in the grid. 3.1 An I/O-naıve flow accumulation algorithm Our first algorithm is just clever enough to run in linear time, but utterly naıve from an i/o point of view. In this algorithm, let c be the index (offset in the input file) of a cell in FlowAcc, and let out(c) be the index of the neighbour of cell c to which the incoming water of c flows. Note that out(c) can be computed from c and the flow direction stored for c in FlowDir . NaiveAccumulation for each cell c (in row-by-row order) do if c is not marked then d ← c 1 Create a file FlowAcc with flow value (initially 1) and marking bit (initially not set) for each cell 2 3 4 5 6 7 8 while all in-neighbours of d are marked and d has an out-neighbour out(d) FlowAcc[out(d)] ← FlowAcc[out(d)] + FlowAcc[d] d ← out(d) do mark d The algorithm goes through all cells and gives each of them one unit of water; this water is then forwarded downstream until a cell is reached that is still waiting for incoming water from some of its neighbours. The accumulated flow then waits there until the cell has received the incoming flow from all neighbours, so that for each cell, all incoming flow is forwarded downstream in a single operation. Thus the algorithm runs in linear time. However, the i/o-behaviour of this simple algorithm can be quite bad: consider processing the terrain shown in Figure 1 (left) in row-by-row order. None of the cells on the meandering river can have their flow forwarded downstream until the scan reaches the last cell in the lower right corner. At that point the while-loop of lines 5 to 8 will follow the whole river back to the upper left corner, possibly requiring one i/o almost every step of the way. The worst-case i/o-efficiency is therefore Θ(N ). Fortunately, under the confluence assumption the situation does not look so grim: Theorem 1 Under the confluence assumption algorithm NaiveAccumulation uses O(N/√B) I/O's. Proof: Consider the grid to consist of square subgrids of √B × √B cells. While running the algorithm, we maintain that at line 3, the subgrid that contains c and the eight subgrids around it are in memory. When in line 5 -- 8 we access a cell d that is currently not in memory, we load the subgrid that contains d and the subgrids around it into memory; upon termination of this loop we reload the subgrids that were in memory before entering the loop. Ignoring the loop in line 5 -- 8, each disk block of the row-by-row files is loaded into memory at most 3√B times, causing O(N/√B) i/o's in total. In line 5 -- 8, the nine subgrids currently in memory are replaced (and possibly reloaded afterwards) only when we reach and finish a cell on the boundary of the nine subgrids after following a path that started from the subgrid in the middle. By the confluence assumption this happens at most a constant number of times for each group of 3 × 3 subgrids. Since there are O(N/B) such groups (one centered on each subgrid) and each is stored across at most O(√B) blocks on disk, the algorithm takes O(N/√B) i/o's in total. (cid:117)(cid:116) 3.2 Flow accumulation in Z-order with row-by-row files We can make algorithm NaiveAccumulation slightly smarter by changing the loop in line 2 to go through all cells in Z-order. This does not change the worst-case i/o-efficiency of the algorithm (extreme rivers could still cause Θ(N ) i/o's). However, we would expect significantly better performance in practice: Theorem 2 Under the confluence assumption and with a tall cache of size M ≥ cB2, algorithm NaiveAccumulation, running the loop on line 2 in Z-order, needs only O(Scan(N )) I/O's. Proof: By the tall-cache assumption, there is a z = Θ(B) such that z is a power of two and the blocks containing a section of 3z × 3z cells fit in memory. Now consider the grid to consist of square subgrids of z × z cells. Thus each subgrid contains Θ(B2) cells and is stored in Θ(B) blocks in the row-by-row files. The idea is again to keep the subgrid of the current cell in memory, together with the eight subgrids around it. Ignoring the loop in line 5 -- 8, each group of 3 × 3 subgrids is loaded into memory once: each group is loaded when the Z-order scan of line 2 enters the subgrid Q in the middle of the group, and the Z-order scan then traverses Q completely before proceeding to the next subgrid. Thus each group is loaded at most once and each subgrid is loaded at most nine times, causing Θ(N/B2 · B) = Θ(Scan(N )) i/o's. Following the same analysis as before, lines 5 -- 8 cause each group of 3 × 3 subgrids to be evicted from memory at most a constant number of times, causing O(Scan(N )) i/o's as well. (cid:117)(cid:116) 3.3 Flow accumulation in Z-order with Z-order files Algorithm NaiveAccumulation can be improved further by not only processing the cells in Z-order, but also using input in Z-order and producing output in Z-order. We now get the following: Theorem 3 Algorithm NaiveAccumulation, running the loop on line 2 in Z-order and working on files in Z-order, needs only O(N/√B) I/O's in the worst case. Under the confluence assumption, the required number of I/O's is O(Scan(N )). Proof: As in the proof of Theorem 1, we consider the grid to be divided into subgrids of size √B × √B. In Z-order files, these occupy only a constant number of blocks each. Such a subgrid Q is loaded into memory when we access a cell on its boundary, or when it is reloaded after completing the loop in lines 5 -- 8 of the algorithm. In the latter case we can charge the reloading of block Q to the access to the boundary cell of Q that was last accessed before Q was evicted from memory. Since each subgrid has only O(√B) cells on its boundary and each cell of the grid is accessed only a constant number of times, each of the O(N/B) subgrids is loaded only O(√B) times, causing O(N/√B) i/o's in total. For the i/o-efficiency under the confluence assumption, see the proof of Theorem 2. (cid:117)(cid:116) 3.4 Cache-aware flow accumulation using separators We will now describe a slightly more involved algorithm that achieves an i/o-efficiency of O(Scan(N )) even in the worst case. Unlike the previous algorithms, this algorithm is cache-aware: it needs to know M and B. The algorithm is based on separators much in the same way as the single-source shortest paths algorithm of Arge et al. [6] (but with a much smaller "reduced" graph). We present a cache-oblivious variant of our algorithm in Section 3.6. Let z = Θ(√M ) be chosen such that a subgrid of size z × z fits in memory (while leaving a bit of space to store additional information about its boundary cells). Our cache-aware algorithm processes the grid in subgrids of size z × z, where the boundary cells of each subgrid are shared with the neighbouring Figure 2: Flow accumulation in three phases. The shaded cells are the cells of S. From left to right: input; contents of SNeighbours and SFlowAcc after the first phase; contents of SFlowAcc after the second phase; contents of FlowAcc after the third phase. CacheAwareAccumulation (adding it to any previously stored value) for each subgrid Q do run NaiveAccumulation on interior (Q) in memory, for each cell c on the boundary of Q do store flow accumulation of c in SFlowAcc[c] starting with zero flow on the cells of Q ∩ S, and leaving out(d) undefined for each cell of Q ∩ S 1 Create file FlowAcc with flow value (initially 1) and marking bit (initially not set) for each cell 2 Create file SNeighbours with out-neighbour (initially undefined) for each cell of S 3 Create file SFlowAcc with flow value (initially 1) and marking bit (not set) for each cell of S 4  phase one: push flow from subgrid interiors to S 5 6 7 8 9 10 11 12 13 14  phase two: compute flow accumulation for S 15 Run line 2 -- 8 of NaiveAccumulation on SFlowAcc, using neighbour relations in SNeighbours 16  phase three: recompute flow in subgrid interiors, now including flow that comes in from S 17 for each subgrid Q 18 19 20 21 22 23 do for each cell c on the boundary of Q do FlowAcc[c] ← SFlowAcc[c] if out(c) lies in interior (Q) run line 2 -- 8 of NaiveAccumulation on interior (Q), using the file FlowAcc, then FlowAcc[out(c)] ← FlowAcc[out(c)] + SFlowAcc[c] if dest(Q, c) is defined then SNeighbours[c] ← dest(Q, c) leaving out(d) undefined whenever out(d) lies on the boundary of Q Figure 3: Pseudocode for cache-aware separator-based flow accumulation. subgrids (except on the outer boundary of the grid). Let S be the set of boundary cells of all subgrids. For any such subgrid Q, let interior (Q) be the set of cells of Q that do not lie on the boundary of Q, and let R be the union of all subgrid interiors, that is, all cells except those in S. Given a subgrid Q and a cell c on its boundary, we define its local destination dest(Q, c) as follows: if the out-neighbour of c lies outside Q, then dest(Q, c) is undefined, otherwise it is the first boundary cell of Q that lies downstream of c (if it exists). The algorithm now proceeds in three phases. In the first phase, the rain that falls on each cell of R is forwarded downstream to the first cell of S that is reached (if any). The rain is only stored at that cell of S, not at the cells on the way. In the second phase, the rain that arrived at each cell c of S, together with the rain that falls on c, is forwarded to all cells of S downstream of c. In the third phase, the rain that falls on each cell of R and the rain that arrived at each cell of S is forwarded to all cells of R that lie downstream of it, until another cell of S is reached (or a cell without an out-neighbour). The result of these three phases is that the rain that falls on any grid cell c is forwarded to all cells downstream of c (see Figure 2 for an illustration, Figure 3 for pseudocode). Theorem 4 With a tall cache of size M ≥ cB2, algorithm CacheAwareAccumulation needs only O(Scan(N )) I/O's. 15111132141511111111111111111111115111194151201111111111111111111111511119415120111111111111111111111113112711245111113 Proof: In the first and the third phase, we process O(N/M ) blocks that each take O(M/B + √M ) i/o's to read, can be processed completely in main memory, and -- in the third phase -- may take another O(M/B +√M ) i/o's to write. The second phase runs a linear-time algorithm on a file of size O(N/√M ), of which each record is accessed a constant number of times in the first and the third phase. The total number of i/o's is therefore O(N/B + N/√M ). By the tall-cache assumption, this is O(Scan(N )). (cid:117)(cid:116) I/O-volume estimate for realistic values of N , M and B CacheAwareAccumulation does not depend on the interplay between B, M and γ as much as the previous algorithms. Therefore it is possible to give a good estimate of the i/o-volume. The bottleneck is the third phase. Assume we set up SFlowAcc and SNeighbours such that they first store, row by row, all rows that completely consist of cells of S, and then, column by column, the remaining cells of S. Then we need to choose z such that the blocks containing z rows of z cells from FlowAcc and FlowDir fit in memory, plus 4 rows of z cells from SFlowAcc and SNeighbours. In FlowDir we use 1 byte per cell, in the other files we use 8 bytes per cell. So z must satisfy: z(cid:100)8z/B(cid:101) + z(cid:100)z/B(cid:101) + 4(cid:100)8z/B(cid:101) + 4(cid:100)8z/B(cid:101) ≤ M/B means that z will typically be several thousands: for M = 230 and B = 214 we would get z = 8637; for M = 230 and B = 216 we would get z = 5330. Taking the number of subgrids times the number of rows times the number of blocks per row times the block size times two (for reading and writing), we find that the i/o-volume for accessing FlowAcc in From this we may subtract 8N , since the blocks of FlowAcc do not need to be read from disk the first time they are accessed. For accessing FlowDir in the first and third phase (reading only) we get roughly A sufficient (but not necessary) condition is that z is at most roughly ((cid:112)1 + 8M/B2 − 1)B/9. This the third phase is now roughly N/z2· z·(cid:100)8z/B(cid:101)· B· 2 ≤ 16N + 2N B/z ≈ N (16 + 18/((cid:112)1 + 8M/B2− 1)). N/z2 · z · (cid:100)z/B(cid:101) · B · 2 ≤ 2N + 2N B/z ≈ N (2 + 18/((cid:112)1 + 8M/B2 − 1)). The i/o-volume thus adds up to roughly N (10 + 36/((cid:112)8M/B2 + 1 − 1)), dividing this by 9N (the input+output size) we get an "overhead" of factor 10/9 + 4/((cid:112)8M/B2 + 1− 1). For the example values The remaining i/o is neglectible: for accessing SNeighbour in the first phase we get roughly N/z2 · 4· (cid:100)8z/B(cid:101) · B · 2 ≤ 64N/z + 8N B/z2, which is roughly three orders of magnitude smaller than the amount of i/o for accessing FlowAcc. The same is true for accessing SFlowAcc in the first and the third phase, and for accessing these files in the second phase: in practice S will be small enough that the second phase can be done in main memory. of M and B just mentioned, the result ranges from 2.0 to 6.6. 3.5 Cache-aware flow accumulation using separators with Z-order files The algorithm explained above depends on the tall-cache assumption. This is because the boundary of a square of z × z cells may cross Θ(z) blocks on disk, and without the tall-cache assumption, there is no guarantee that these will fit in memory for any z = Ω(√M ). The need for the tall-cache assumption can be eliminated by using files in Z-order. Then any square Q of z × z cells is contained in at most four squares of size y × y, where z/2 ≤ y < z, that are each stored contiguously on disk. The square Q is thus stored in O(4(cid:100)y2/B(cid:101)) = O(z2/B) blocks, which will always fit for some z = Ω(√M ). Thus we get: Theorem 5 Algorithm CacheAwareAccumulation on files in Z-order needs only O(Scan(N )) I/O's. I/O-volume estimate for realistic values of N , M and B To get a good i/o-volume in practice, we will now make sure that each subgrid Q is stored consecutively in the Z-order file. To achieve this, we do not let neighbouring subgrids share rows and columns anymore, but make sure the subgrids are disjoint and their height is a power of two. Furthermore, we let the loops of line 5 and line 16 go through the subgrids in Z-order. As a result, the first phase only scans each block of the FlowDir file once, and so does the third phase; in addition the third phase writes each block of FlowAcc once (reading is not necessary). There may be up to eight times more cells in S (two times more because subgrids do not share boundary cells anymore, and four times more because we need to round the subgrid width down to a power of two). However, as explained above, the accesses to SNeighbour and SFlowAcc are so few that they will still be neglectible. Thus the total i/o-volume becomes roughly N + N + 8N bytes, which is 1.1 times the input+output size. 3.6 Cache-oblivious flow accumulation using separators We can make a cache-oblivious version of the separator-based algorithm by using a hierarchy of subgrids and separators as follows. We consider k + 1 levels, numbered 0 to k, where k is the smallest integer such that the input grid is contained in a (2k + 1)× (2k + 1) grid. On level i, we consider subgrids of size (2i + 1) × (2i + 1), that each share their boundary cells with the neighbouring subgrid. Let Si be the set of boundary cells of all subgrids on level i, and let Ri be the union of all subgrid interiors on level i. Note that R0 = ∅, S0 is the full grid, and Sk is the boundary of the full grid. We can think of the subgrids as being organised in a tree H, where the leaves correspond to subgrids of size 2 × 2, and each internal node on level i corresponds to a subgrid Q on level i with four children, namely the subgrids on level i − 1 that lie inside Q. The root of H corresponds to the full grid. The algorithm now proceeds in two phases. In the first phase we do a post-order traversal of H. When processing a subgrid Q at level i, we forward the rain that falls on each cell c of Si−1 ∩ interior (Q) to the first cell of Si downstream of c, that is, to the boundary of Q. In the second phase we traverse H in reverse order (which is therefore a pre-order traversal). When processing a subgrid Q at level i, we forward the rain that arrived at each cell c on the boundary of Q to all cells of interior (Q) ∩ Si−1 that lie on the path that leads downstream from c until it reaches another cell on the boundary of Q (or a cell without an out-neighbour). These two phases together result in all rain that falls on any grid cell c to be forwarded to all cells downstream of c. To implement this approach efficiently, we use the post-order traversal to create a stack A of pointers from boundary cells to internal cells that can be retrieved during the reverse traversal. More precisely, when processing a subgrid Q at level i in the post-order traversal, we store on A the coordinates of the first cell of Si−1 that lies downstream of c, for each cell c on the boundary of Q that has an out-neighbour inside Q. Theorem 6 With a tall cache of size M ≥ cB2, separator-based cache-oblivious flow accumulation needs only O(Scan(N )) I/O's. Proof: For simplicity we assume that the input grid is square. We first analyse the number of pointers P (K) that are stored on A for a subtree of H rooted at a subgrid Q of size K (where a cell on the boundary of two/four subgrids counts for 1/2 or 1/4 to each of them). Since pointers are stored only for cells on the boundary of Q, we get P (K) = O(√K) + 4P (K/4), which solves to P (K) = O(K). Next we analyse the number of i/o's T (K) for the post-order traversal of a subtree of H rooted at a subgrid Q of size K. For a sufficiently small constant c, we have T (c · M ) = O(M/B + √M ), since we would simply load Q into memory, do all the necessary processing in memory, and then write Q back to disk while pushing O(M ) pointers for Q and its subgrids on the stack. By the tall-cache assumption, we thus have T (c · M ) = O(M/B). For subgrids Q of size K > c · M , we need to make the recursive calls, read the flow values for O(√K) cells and the O(√K) pointers stored on A for the four subgrids of Q, and then use this information to forward flow to O(√K) cells, compute O(√K) pointers for Q and push these onto A. Forwarding the flow and computing the pointers can easily be done in O(√K) time and i/o's, so that we get: T (K) = O(√K) + 4T (K/4). With base case T (c · M ) = O(M/B), this solves to T (N ) = O(N/√M + N/B) = O(Scan(N )). The analysis of the reverse traversal is similar to the analysis of the post-order traversal, so that we get O(Scan(N )) i/o's in total. (cid:117)(cid:116) Although the cache-oblivious algorithms needs only O(Scan(N )) i/o's, it is not as efficient as the cache-aware algorithm of the previous subsection. The cache-oblivious algorithm as just described is expensive in two ways. First, the number of pointers over all levels sums up to approximately 8 3 N . Except a small number on the highest levels, all of these pointers are written to and read from disk at least once. If a pointer is stored in 16 bytes (coordinates of source and destination), this amounts to an i/o-volume of almost 10 times the input+output size. To alleviate this problem, an efficient implementation should use larger subgrids as the base case (for example 17×17 instead of 2×2). Second, we need to maintain flow accumulation values for boundary cells. Doing so directly in the output file is expensive, because on a vertical subgrid boundary, every cell will be in a different block. Although in the asymptotic analysis this works out, it causes a significant constant-factor overhead. Storing the grid in Z-order helps to some extent (as confirmed by our experiments, see Section 3.8). Alternatively one could use the stack with pointers to store intermediate flow accumulation values (similar to SFlowAcc in CacheAwareAccumulation), but this would further increase the i/o-volume for stack operations. 3.7 Previous work: flow accumulation with time-forward processing In TerraFlow and TerraStream [4, 7], the following algorithm is used to compute flow accumulation. We first create a stream of cells in topological order. In principle it would suffice to sort the cells by decreasing elevation, but this would not work for flat areas. Therefore we will assume that after flooding, a flow routing phase has produced an additional file with a topological number for each cell. We now create a stream of cells that lists for each cell its location, its topological number and the topological number of its out-neighbour. We sort this stream by the first topological number. We now apply a technique called time-forward processing: we maintain a priority queue in which flow values are stored with the topological number of the cell to which the flow is going. The algorithm processes all cells one by one in topological order; when processing a cell, it extracts its incoming flow from the priority queue, adds one unit of rain, writes the resulting total to an output stream together with the coordinates of the cell, and finally forwards the total flow to the out-neighbour by entering it in the priority queue with the out-neighbour's topological number as key. The algorithm finishes by sorting the flow accumulation values from the output stream into a row-by-row grid. Using an i/o-efficient priority queue, the algorithm clearly runs in O(Sort(N )) i/o's [4, 6] I/O-volume estimate for realistic values of N , M and B For an estimate of the i/o-volume in a practical setting with a grid of size N = 232 and a memory size of M = 230, we consider two scenarios. In the optimistic scenario, we have block size B = 214, only 1/3 of the cells contain data, and the priority queue is completely maintained in memory at all times. In the pessimistic (but nevertheless quite realistic) scenario, we have block size B = 216, all cells contain data, and the records that pass through the priority queue are written to and read from disk once on average. In the optimistic scenario, we start with scanning the input file with flow directions and the file with topological numbers, scanning the latter with a window of 3 × 3 cells to be able to retrieve topological numbers of neighbours. Assuming three rows of the grid fit in memory, this amounts to scanning 9 bytes per cell. While doing so, we generate a stream of cells with location, topological number, and topological number of the out-neighbour, which is fed to the first pass of a sorting algorithm. The sorting algorithm writes the partially sorted stream to disk (24 bytes per actual data cell = 8 bytes per grid cell). Since N/3 ≤ (M/B)2, the sorting algorithm needs only two passes; the second pass results in 16 bytes of i/o per cell (24 for reading, 24 for writing, for 1/3 of the cells). The time-forward processing phase reads the sorted stream (24 bytes × 1/3 of the cells) and eventually outputs locations and flow accumulations for all data cells (16 bytes × 1/3 of the cells). The output then needs to be sorted: the first pass results in 10 2 3 bytes per cell and writes 8 bytes per grid cell (flow accumulations only, but also for non-data cells). In total, we transfer 70 1 3 bytes per grid cell. For a fair comparison, we do not count the input file with topological numbers towards the size of the input and output -- after all, all other algorithms presented in this paper do not even need such a file. So 70 1 3 bytes of i/o per cell (32 bytes per data cell). The second pass reads 5 1 3 bytes per grid cell amounts to 7.8 times the input+output size. In the pessimistic scenario, we need three sorting passes, and the priority queue needs the disk. Filling in the details of the computation above, we get an i/o-volume of 289 bytes per cell, which is 32 times the input+output size. 3.8 A brief comparison of flow-accumulation algorithms We implemented some of our algorithms and tested them on elevation models of the Netherlands and of the Neuse watershed in North Carolina, using a Dell Optiplex GX260 computer, equipped with a 3 GHz Pentium 4 processor and 1 GB of RAM, Ubuntu 7.04 (kernel 2.60.20-16) (installed on a 80 GB Samsung HD080HJ hard disk), and a 250 GB Seagate ST320506AS hard disk. We report the results for the largest data set: a grid of 70 520 × 50 220 cells modelling the Neuse basin; 35% of the grid cells contain data. Our results are shown in Table 2. For comparison, the authors of TerraStream reported 455 minutes for flow accumulation of a grid of similar size, on hardware that appeared to be faster than ours [7]. Our cache-aware flow accumulation algorithm thus seems to be an order of magnitude faster. Note that the i/o-volume estimates given in Section 3.4 and Section 3.7 would predict a difference of a factor four in the optimistic setting, where we assume that TerraStream's time-forward processing would manage to do with sorting in two passes and keeping the priority queue in main memory. Although we have not run direct comparisons with the latest version of TerraStream, our analysis indicates that the performance difference must remain significant because it is inherent to the characteristics of the different algorithms. algorithm "naıve" row-by-row scan of row-by-row file "naıve" Z-order scan of Z-order file cache-aware separator alg. on row-by-row file using Seagate disk using both disks time 111 min. 41 min. 39 min. time CPU usage 22% 26% 34 min. 18% 25 min. CPU usage 32% 26% Table 2: Running times in minutes and CPU usage for flow accumulation of a grid of 3.5 · 109 cells. Our results also indicate that our i/o-naıve algorithms perform surprisingly well, especially when working on data in Z-order. At first sight our theoretical analysis seems to explain this: under the confluence assumption the i/o-naıve algorithm on Z-order files needs only O(Scan(N )) i/o's. However, if we try to estimate the i/o-volume by filling in the constant factors in the computation of the asymptotic bound, then we end up with an i/o-volume bound of dozens (using Z-order) or thousands (using row- by-row order) times the input+output size. It seems that the surprisingly good performance in practice must be due to the fact that for modest values of c we can fit c√B rows of the grid in memory. Thus the main scan can keep blocks in memory long enough so that each block only needs to be loaded once, and apparently the inner loop of the algorithm does not cause as many disruptions as the theoretical analysis might suggest. All things considered this means that these naıve algorithms are surprisingly fast, but we cannot rule out that their efficiency may depend on the ratio of N and M and on the characteristics of the terrain. In contrast, the efficiency of our cache-aware algorithm is supported firmly by our theoretical analysis. Note that our theoretical analysis also indicates that the algorithm should be much faster still when working on Z-order files, requiring little more than two scans of the input file and a single scan of the output file (further experiments should confirm this). However, converting to Z-order takes time too (converting a grid of this size with 8 bytes per cell took 88 minutes). Whether it pays off to use files in Z-order may therefore depend on the context. Storing temporary files in the pipeline in Z-order seems to be a good idea; files that need to be processed by other software may better be kept in row-by-row order. We also implemented the cache-oblivious algorithm, but until now this was significantly slower than the cache-aware algorithm (even when the subgrid size of the latter was not tuned optimally) so the cache-oblivious implementation would need to be optimised further to be competitive. 4 Applying grid-based techniques to other parts of the pipeline 4.1 Flooding The flooding problem takes as input a file Elevation that stores the elevation of each cell. A path in the grid is a sequence of cells such that each pair of consecutive cells on the path are neighbours of each other (each cell that is not on the boundary has eight neighbours). The flooding problem in its basic form is to compute to what elevation each cell should be raised, so that from each cell there is a non-ascending path to a cell on the boundary of the grid. If we define the height of a path as the elevation of the highest cell on the path, the problem is equivalent to determining, for each cell c, the height of the lowest path from c to the boundary. The required output is a file Flooded that stores these heights for each cell c. Time-forward processing and I/O-naıve flooding In 2003 Arge et al. described two algorithms for the flooding problem [4]. The first algorithm proceeds in three phases. First we follow the path from each cell downhill until a sink, a cell without an out-neighbour, is reached. Each cell c is labelled with a pointer π(c) to the sink at the end of the path that goes downhill from c. This labelling constitutes a decomposition of the terrain into watersheds and is used to build a watershed graph W . The watershed graph has one node for every sink, and for every pair of adjacent watersheds with sinks u and v, the graph contains an edge (u, v) with height equal to the lowest pass between u and v. In other words, the elevation of (u, v) is the minimum of max(elevation(c), elevation(d)) over all pairs of neighbouring cells c, d such that π(c) = u and π(d) = v. In the second phase an algorithm is run on W to determine to what height each watershed should be flooded. In the third phase, we scan the complete terrain and replace each cell's elevation by the maximum of its original elevation and its watershed's flood height. Arge et al. use time-forward processing for the first phase, so that the complete algorithm needs O(Sort(N )) i/o's, assuming W can be kept in main memory. Instead we could consider using an i/o- naıve algorithm similar to the one described in Section 3.1 for the first phase, and get O(Scan(N )) i/o's under the confluence assumption. We found that in practice, this did not work well with row-by-row- ordered files. Using files in Z-order we could flood the Neuse grid mentioned before in 435 minutes: a running time of roughly the same order of magnitude as Terrastream's [7]. Separator-based algorithms The second algorithm sketched by Arge et al. seems quite similar to our cache-aware separator-based flow accumulation algorithm. As in Section 3.4, the idea is to first process subgrids of Θ(√M ) × Θ(√M ) cells that fit in memory. For each subgrid Q we compute a 'substitute' graph that encodes the lowest-path heights between each pair of cells on the boundary of Q. In the second phase of the algorithm we would combine the substitute graphs for all subgrids into one graph, which is used to compute the lowest-path heights from each cell of S to the boundary of the grid, where S is the set of boundary cells of all subgrids. Finally, in the third phase each subgrid Q is processed again, now to compute the lowest-path height from each cell of Q to the boundary of the grid, using the previously computed lowest-path heights for the cells on the boundary of Q. The key to success is the size of the substitute graphs. The algorithm by Arge et al. [6] for single- source shortest paths works in a similar way, but needs substitute graphs of size Θ(z2) to encode the shortest-path distances between all pairs of cells on the boundary of a z × z subgrid. However, for lowest paths substitute graphs of size Θ(z) suffice. Such a graph can be created from the elevations and neighbour relations in a subgrid Q as follows. Consider the subgrid Q as a graph, whose edges represent the neighbour relations in the grid, where each edge has elevation equal to its highest vertex. Compute the lowest paths to the boundary of Q for all cells in interior (Q). Next, contract all directed edges (u, v) of those lowest paths one by one, replacing each undirected edge (w, u) of the graph with an edge (w, v) with elevation max(elevation(w, u), elevation(u, v)). Whenever there are multiple edges between the same pair of vertices, keep only the edge with the lowest elevation. This results in a substitute graph whose vertices are the boundary vertices of Q and which preserves the lowest-path heights between each pair of vertices. Since the substitute graph thus constructed is planar, it has size Θ(z) = Θ(√M ). We implemented a separator-based flooding algorithm as described above, and found that it could process the Neuse grid in 146 minutes, using row-by-row-ordered files on one disk, or in 132 minutes on two disks. As with our flow accumulation algorithm, we believe further efficiency gains could be achieved by using files in Z-order. Partial flooding? It should be noted that a direct comparison between our algorithms and Terra- Stream cannot be made. TerraStream offers the functionality of partial flooding: eliminating only insignificant depressions while not flooding major depressions. Our algorithms do not do this. A major open question is therefore how the grid structure could be exploited to design an algorithm that can do very fast partial flooding. 4.2 Other parts of the pipeline TerraStream's hierarchical watershed labelling algorithm [5, 7] uses time-forward processing to pass labels upwards into the river network. This is not very different from how time-forward processing is used for flooding or for flow accumulation, and one may expect that grid-based algorithms (i/o-naıve or cache-aware) may help here too. Open questions include whether grid-based algorithms, maybe together with assumptions on realistic terrains, could help to simplify and speed up flow routing on flat areas and to do flow accumulation with multiple-flow directions, an approach where each cell sends water to all of its lower neighbours instead of just one of them. 5 Conclusions and remaining work We have shown that certain hydrological computations on terrain data may be sped up by an order of magnitude by exploiting the grid structure of the data and/or by storing grids in Z-order rather than row-by-row order. A striking result is that one of the algorithms with the best performance is actually so simple that it is almost naıve. Some of the most prominent questions that remain unanswered at this point are the following. What would be typical values for the confluence constant? It would be interesting to design an algorithm that can compute the confluence constant for any given grid terrain. Then we may investigate to what extent the confluence constant is indeed independent of the sampling density of a terrain, and what are typical values for the confluence constant for different types of terrains. How would the cache-aware separator-based algorithm perform on files in Z-order? Unfortunately we did not have time to implement and run these tests yet, and we hope to be able to do so some time in the future. Can we exploit the grid structure to design equally efficient flow routing algorithms? If yes, then the complete part of the pipeline from elevation model to hierarchical watershed labels could probably be sped up tremendously. In that case, even if files in row-by-row order would be desired at the input and output end of the pipeline, it could pay off to convert them to Z-order and to use files in Z-order for the intermediate stages. A disadvantage of our current algorithm is that multiple-flow direction models cannot be handled, but for hierarchical watershed labelling such models cannot be used and single-flow direction models -- those handled by our algorithms -- are exactly what is needed. Acknowledgements The authors thank Andrew Danner for providing test data and assistance with TerraStream. We thank Laura Toma and the students of the 2006 class of i/o-efficient algorithms at the TU Eindhoven for inspiring discussions. References [1] P. K. Agarwal, L. Arge, and A. Danner. From point cloud to grid DEM: a scalable approach. In Proc. 12th Int. Symp. Spatial Data Handling (SDH 2006), pages 771 -- 788, Springer, 2006. [2] P. K. Agarwal, L. Arge, and K. Yi. I/O-efficient batched union-find and its applications to terrain analysis. In Proc. 22nd Ann. Symp. Computational Geometry (SoCG 2006), pages 167 -- 176, 2006. [3] A. Aggarwal and J. S. Vitter. The input/output complexity of sorting and related problems. Communications of the ACM, 31(9):1116 -- 1127, 1988. [4] L. Arge, J. Chase, P. Halpin, L. Toma, D. Urban, J. S. Vitter, and R. Wickremesinghe. Flow computation on massive grid terrains. GeoInformatica, 7(4):283 -- 313, 2003. [5] L. Arge, A. Danner, H. Haverkort, and N. Zeh. I/O-efficient hierarchical watershed decomposition of grid terrain models. In Proc. 12th Int. Symp. Spatial Data Handling (SDH 2006), pages 825 -- 844, Springer, 2006. [6] L. Arge, L. Toma, and J. S. Vitter. I/O-efficient algorithms for problems on grid-based terrains. ACM J. Experimental Algorithmics, 6(1), 2001. [7] A. Danner, T. Mølhave, K. Yi, P. K. Agarwal, L. Arge, and H. Mitasova. TerraStream: from elevation data to watershed hierarchies. In Proc. 15th Ann. ACM Symp. Advances in Geographic Information Systems. (GIS 2007). [8] M. Frigo, C. E. Leiserson, H. Prokop, and S. Ramachandran. Cache-oblivious algorithms. In Proc. 40th Annu. IEEE Symp. Found. Comput. Sci., pages 285 -- 298, 1999. [9] J. Thiyagalingam and P. Kelly. Is Morton layout competitive for large two-dimensional arrays? In Proc. 8th Int. Euro-Par Conf. Parallel Processing, 2002, LNCS 2400:137 -- 157.
1907.04132
1
1907
2019-07-09T13:14:12
Linear MIM-Width of Trees
[ "cs.DS", "cs.CC" ]
We provide an $O(n \log n)$ algorithm computing the linear maximum induced matching width of a tree and an optimal layout.
cs.DS
cs
Linear MIM-Width of Trees (cid:63) Svein Høgemo, Jan Arne Telle, and Erlend Raa Vagset Department of Informatics, University of Bergen, Norway. {svein.hogemo, jan.arne.telle, erlend.vagset}@uib.no Abstract. We provide an O(n log n) algorithm computing the linear maximum induced matching width of a tree and an optimal layout. 1 Introduction The study of structural graph width parameters like tree-width, clique-width and rank-width has been ongoing for a long time, and their algorithmic use has been steadily increasing [12, 18]. The maximum induced matching width, denoted MIM-width, and the linear variant LMIM-width, are graph parameters having very strong modelling power introduced by Vatshelle in 2012 [20]. The LMIM- width parameter asks for a linear layout of vertices such that the bipartite graph induced by edges crossing any vertex cut has a maximum induced matching of bounded size. Belmonte and Vatshelle [2] 1 showed that interval graphs, bi- interval graphs, convex graphs and permutation graphs, where clique-width can be proportional to the square root of the number of vertices [11], all have LMIM-width 1 and an optimal layout can be found in polynomial time. Since many well-known classes of graphs have bounded MIM-width or LMIM- width, algorithms that run in XP time in these parameters will yield polynomial- time algorithms on several interesting graph classes at once. Such algorithms have been developed for many problems: by Bui-Xuan et al [5] for the class of LCVS-VP - Locally Checkable Vertex Subset and Vertex Partitioning - problems, by Jaffke et al for non-local problems like Feedback Vertex Set [15, 14] and also for Generalized Distance Domination [13], by Golovach et al [10] for output-polynomial Enumeration of Minimal Dominating sets, by Bergoug- noux and Kant´e [3] for several Connectivity problems and by Galby et al for Semitotal Domination [9]. These results give a common explanation for many classical results in the field of algorithms on special graph classes and extends them to the field of parameterized complexity. Note that very low MIM-width or LMIM-width still allows quite complex cuts compared to similarly defined graph parameters. For example, carving-width 1 allows just a single edge, maximum matching-width 1 a star graph, and rank- width 1 a complete bipartite graph. In contrast, LMIM-width 1 allows any cut (cid:63) This is the appendix of our WG submission, the long version with extra figures and full proofs 1 In [2], results are stated in terms of d-neighborhood equivalence, but in the proof, they actually gave a bound on LMIM-width. 2 S. Høgemo et al. where the neighborhoods of the vertices in a color class can be ordered linearly w.r.t. inclusion. In fact, it is an open problem whether the class of graphs having LMIM-width 1 can be recognized in polynomial-time or if this is NP-complete. Saether et al [19] showed that computing the exact MIM-width and LMIM-width of general graphs is W-hard and not in APX unless NP=ZPP, while Yamazaki [21] shows that under the small set expansion hypothesis it is not in APX unless P=NP. The only graph classes where we know an exact polynomial-time algo- rithm computing LMIM-width are the above-mentioned classes interval, bi- interval, convex and permutation that all have structured neighborhoods implying LMIM-width 1 [2]. Belmonte and Vatshelle also gave polynomial-time algorithms showing that circular arc and circular permutation graphs have LMIM-width at most 2, while Dilworth k and k-trapezoid have LMIM- width at most k [2]. Recently, Fomin et al [8] showed that LMIM-width for the very general class of H-graphs is bounded by 2E(H), and that a lay- out can be found in polynomial time if given an H-representation of the input graph. However, none of these results compute the exact LMIM-width. On the negative side, Mengel [16] has shown that strongly chordal split graphs, co-comparability graphs and circle graphs all can have MIM-width, and LMIM-width, linear in the number of vertices. Just as LMIM-width can be seen as the linear variant of MIM-width, path- width can be seen as the linear variant of tree-width. Linear variants of other well-known parameters like clique-width and rank-width have also been studied. Arguably, the linear variant of MIM-width commands a more noteworthy posi- tion, since in contrast to these other linear parameters, for almost all well-known graph classes where the original parameter (MIM-width) is bounded then also the linear variant (LMIM-width) is bounded. In this paper we give an O(n log n) algorithm computing the LMIM-width of an n-node tree. This is the first graph class of LMIM-width larger than 1 hav- ing a polynomial-time algorithm computing LMIM-width and thus constitutes an important step towards a better understanding of this parameter. The path- width of trees was first studied in the early 1990s by Mohring [17], with Ellis et al [7] giving an O(n log n) algorithm computing an optimal path-decomposition, and Bodlaender [4] an O(n) algorithm. In 2013 Adler and Kant´e [1] gave linear- time algorithms computing the linear rank-width of trees and also the linear clique-width of trees, by reduction to the path-width algorithm. Even though LMIM-width is very different from path-width, the basic framework of our al- gorithm is similar to the path-width algorithm in [7]. In Section 2 we give some standard definitions and prove the Path Layout Lemma, that if a tree T has a path P such that all components of T \ N [P ] have LMIM-width at most k then T itself has a linear layout with LMIM-width at most k +1. We use this to prove a classification theorem stating that a tree T has LMIM-width at least k + 1 if and only if there is a node v such that after rooting T in v, at least three children of v themselves have at least one child whose rooted subtree has LMIM-width at least k. From this it follows that the LMIM-width of an n-node tree is no more than log n. Our O(n log n) algorithm computing Linear MIM-Width of Trees 3 LMIM-width of a tree T picks an arbitrary root r and proceeds bottom-up on the rooted tree Tr. In Section 3 we show how to assign labels to the rooted subtrees encountered in this process giving their LMIM-width. However, as with the algorithm computing pathwidth of a tree, the label is sometimes complex, consisting of LMIM-width of a sequence of subgraphs, of decreasing LMIM- width, that are not themselves full rooted subtrees. Proposition 1 is an 8-way case analysis giving a subroutine used to update the label at a node given the labels at all children. In Section 4 we give our bottom-up algorithm, which will make calls to the subroutine underlying Proposition 1 in order to compute the complex labels and the LMIM-width. Finally, we use all the computed labels to lay out the tree in an optimal manner. 2 Classifying LMIM-width of Trees We use standard graph theoretic notation, see e.g. [6]. For a graph G = (V, E) and subset of its nodes S ⊆ V we denote by N (S) the set of neighbors of nodes in S, by N [S] = S ∪ N (S) its closed neighborhood, and by G[S] the graph induced by S. For a bipartite graph G we denote by MIM(G), or simply MIM if the graph is understood, the size of its Maximum Induced Matching, the largest number of edges whose endpoints induce a matching. Let σ be the linear order corresponding to the enumeration v1, . . . , vn of the nodes of G, this will also be called a linear layout of G. For any index 1 ≤ i < n we have a cut of σ that defines the bipartite graph on edges "crossing the cut" i.e. edges with one endpoint in {v1, . . . , vi} and the other endpoint in {vi+1, . . . , vn}. The maximum induced matching of G under layout σ is denoted mim(σ, G), and is defined as the maximum, over all cuts of σ, of the value attained by the MIM of the cut, i.e. of the bipartite graph defined by the cut. The linear induced matching width -- LMIM-width -- of G is denoted lmw(G), and is the minimum value of mim(σ, G) over all possible linear orderings σ of the vertices of G. We start by showing that if we have a path P in a tree T then the LMIM- width of T is no larger than the largest LMIM-width of any component of T \ N [P ], plus 1 . To define these components the following notion is useful. Definition 1 (Dangling tree). Let T be a tree containing the adjacent nodes v and u. The dangling tree from v in u, T(cid:104)v, u(cid:105), is the component of T \ (u, v) containing u. Given a node x ∈ T with neighbours {v1, . . . , vd}, the forest obtained by re- moving N [x] from T is a collection of dangling trees {T(cid:104)vi, ui,j(cid:105)}, where ui,j (cid:54)= x is some neighbour of vi. We can generalise this to a path P = (x1, . . . , xp) in place of x, such that T\N [P ] = {T(cid:104)vi,j, ui,j,m(cid:105)}, where vi,j ∈ N (P ) is a neigh- bour of xi and ui,j,m (cid:54)∈ N [P ]. See top part of Figure 1. This naming convention will be used in the following. Lemma 1 (Path Layout Lemma). Let T be a tree. If there exists a path P = (x1, . . . , xp) in T such that every connected component of T\N [P ] has 4 S. Høgemo et al. LMIM-width ≤ k then lmw(T ) ≤ k + 1. Moreover, given the layouts for the components we can in linear time compute the layout for T . Proof. Using the optimal linear orderings of the connected components of T\N [P ], we give the below algorithm LinOrd constructing a linear order σT on the nodes of T showing that lmwof T is ≤ k + 1. The ordering σT starts out empty and the algorithm has an outer loop going through vertices in the path P = (x1, . . . , xp). When arriving at xi it uses the concatenation operator ⊕ to add the path node xi before looping over all neighbors vi,j of xi adding the linear orders of each dangling tree from vi,j and then vi,j itself. See Figure 1 for an illustration. function LinOrd(T : tree, P = (x1, . . . , xp): path, {σT(cid:104)vi,j ,ui,j,m(cid:105)}: lin-ords) (cid:46) The list starts out empty (cid:46) For all nodes on path (x1, . . . , xp) (cid:46) Append path node (cid:46) For all nbs of xi not on path: vi,j (cid:46) For all dangling trees from vi,j σT ← σT ⊕ σT(cid:104)vi,j ,ui,j,m(cid:105) (cid:46) Append given order of T(cid:104)vi,j, ui,j,m(cid:105) (cid:46) Append vi,j σT ← ∅ for i ← 1, p do σT ← σT ⊕ xi for j ← 1,N (xi)\P do for m ← 1,N (vi,j)\xi do σT ← σT ⊕ vi,j Fig. 1. A tree with a path P = (x1, x2, x3, x4), with nodes in N [N [P ]] and dangling trees featured, and below it the order given by the Path Layout Lemma Firstly, from the algorithm it should be clear that each node of T is added exactly once to σT , that it runs in linear time, and that there is no cut containing two crossing edges from two separate dangling trees. Now we must show that σT does not contain cuts with MIM larger than k + 1. By assumption the layout of each dangling tree has no cut with MIM larger than k, and since these layouts can be found as subsequences of σT it follows that then also σT has no cut with more than k edges from a single dangling tree T(cid:104)vi,j, ui,j,m(cid:105). Also, we know that T1T2T3T4T5T6T8T7x1x2x3x4v1,1v2,1v1,2v1,3v3,1v3,2u1,1,1u2,1,1u1,1,2u1,2,1u3,1,1u3,1,2u3,2,1u3,2,2T1T2T3T4T5T6T8T7x1x2x3x4v1,1v2,1v1,2v1,3v3,1v3,2u1,1,1u2,1,1u1,1,2u1,2,1u3,1,1u3,1,2u3,2,1u3,2,2 Linear MIM-Width of Trees 5 edges from two separate dangling trees cannot both cross the same cut. The only edges of T left to account for, i.e. not belonging to one of the dangling trees, are those with both endpoints in N [N [P ]], the nodes at distance at most 2 from a node in P . For every cut of σT that contains more than a single crossing edge (xi, xi+1) there is a unique xi ∈ P and a unique vi,j ∈ N (xi) such that every edge with both endpoints in N [N [P ]] that crosses the cut is incident on either xi or vi,j, and since the edge connecting xi and vi,j also crosses the cut at most one of these edges can be taken into an induced matching. With these observations in mind, it is clear that lmw(T ) ≤ mim(σT , T ) ≤ k + 1. Definition 2 (k-neighbour and k-component index). Let x be a node in the tree T and v a neighbour of x. If v has a neighbour u (cid:54)= x such that lmw(T(cid:104)v, u(cid:105)) ≥ k, then we call v a k-neighbour of x. The k-component in- dex of x is equal to the number of k-neighbours of x and is denoted DT (x, k), or shortened to D(x, k). Theorem 1 (Classification of LMIM-width of Trees). For a tree T and k ≥ 1 we have lmw(T ) ≥ k + 1 if and only if D(x, k) ≥ 3 for some node x. Proof. We first prove the backward direction by contradiction. Thus we assume D(x, k) ≥ 3 for a node x and there is a linear order σ such that mim(σ, T ) ≤ k. Let v1, v2, v3 be the three k-neighbors of x and T1, T2, T3 the three trees of T \ N [x] each of LMIM-width k, with vi connected to a node of Ti for i = 1, 2, 3, that we know must exist by the definition of D(x, k). We know that for each i = 1, 2, 3 we have a cut Ci in σ with MIM=k and all k edges of this induced matching coming from the tree Ti. Wlog we assume these three cuts come in the order C1, C2, C3, i.e. with the cut having an induced matching of k edges of T2 in the middle. Note that in σ all nodes of T1 must appear before C2 and all nodes of T3 after C2, as otherwise, since T is connected and the distance between T2 and the two trees T1 and T3 is at least two, there would be an extra edge crossing C2 that would increase MIM of this cut to k + 1. It is also clear that v1 has to be placed before C2 and v3 has to be placed after C2, for the same reason, e.g. the edge between v1 and a node of T1 cannot cross C2 without increasing MIM. But then we are left with the vertex x that cannot be placed neither before C2 nor after C2 without increasing MIM of this cut by adding at least one of (v1, x) or (v3, x) to the induced matching. We conclude that D(x, k) ≥ 3 for a node x implies LMIM-width at least k + 1. To prove the forward direction we first show the following partial claim: if lmw(T ) ≥ k + 1 then there exists a node x ∈ T such that D(x, k) ≥ 3; or there exists a strict subtree S of T with lmw(S) ≥ k + 1. We will prove the contrapositive statement, so let us assume that every node in T has D(x, k) < 3 and no strict subtree of T has LMIM-width ≥ k + 1 and show that then lmw(T ) ≤ k. For every node x ∈ T , it must then be true that D(x, k) ≤ 2 and that D(x, k + 1) = 0. The strategy of this proof is to show that there is always a path P in T such that all the connected components in T\N [P ] have LMIM-width ≤ k − 1. When we have shown this, we proceed to use the Path 6 S. Høgemo et al. Layout Lemma, to get that lmw(T ) ≤ k. To prove this, we define the following two sets of vertices: X = {xx ∈ V (T ) and D(x, k) = 2}, Y = {yy ∈ V (T ) and D(y, k) = 1} Case 1: X (cid:54)= ∅ If xi and xj are in X, then every vertex on the path P (xi, . . . , xj) connecting xi and xj must be elements of X, as every node on this path clearly has a dangling tree with LMIM-width k in the direction of xi and in the direction of xj. The fact that every pair of vertices in X are connected by a path in X means that X must be a connected subtree of T . Furthermore, this subtree must be a path, otherwise there are three disjoint dangling trees T(cid:104)v1, u1(cid:105), T(cid:104)v2, u2(cid:105), T(cid:104)v3, u3(cid:105), each with LMIM-width k, and each hanging from a separate node. But then there is some vertex w such that T(cid:104)v1, u1(cid:105), T(cid:104)v2, u2(cid:105) and T(cid:104)v3, u3(cid:105) are subtrees of dangling trees from different neighbours of w. But this implies that D(w, k) ≥ 3, which we assumed were not the case, so this leads to a contradiction. We therefore conclude that all nodes in X must lie on some path P = (x1, . . . , xp). The final part of the argument lies in showing that we can apply the Path Layout Lemma. For some xi ∈ P, i ∈ {2, . . . , p − 1}, its k-neighbours are xi−1 and xi+1. For x1, these neighbours are x2 and some x0 (cid:54)∈ X. For xp, these neighbours are xp−1 and some xp+1 (cid:54)∈ X. x0 and xp+1 may only have one k-neighbour -- x1 and xp respectively -- or else they would be in X. If we make P (cid:48) = (x0, . . . , xp+1), we then see that every connected component in T\N [P (cid:48)] must have LMIM-width ≤ k − 1. By the Path Layout Lemma, lmw(T ) ≤ k. Case 2: X = ∅, Y (cid:54)= ∅ We construct the path P in a simple greedy manner as follows. We start with P = (y1, y2), where y1 is some arbitrary node in Y , and y2 its only k-neighbour. Then, if the highest-numbered node in P , call it yq, has a k-neighbour y(cid:48) (cid:54)∈ P , then we assign yq+1 to y(cid:48), and repeat this process exhaustively. Since we look at finite graphs, we will eventually reach some node yp such that either yp (cid:54)∈ Y or yp's k-neighbour is yp−1. We are then done and have P = (y1, . . . , yp), which must be a path in T , since every node yi+1 ∈ P is a neighbour of yi and for yi we only assign maximally one such yi+1. Also, every connected component of T\N [P ] must have LMIM-width ≤ k− 1. If not, some node yi ∈ P would have a k-neighbour y(cid:48) (cid:54)∈ P , but by the assumption X = ∅ this is impossible, since then either i < p and yi has two k-neighbours y(cid:48) and yi+1, or else i = p and yp ∈ Y and yi has the two k-neighbors y(cid:48) and yi−1 (in case i = p and yp (cid:54)∈ Y then by definition of Y the node yi could not have a k-neighbor y(cid:48)). By the Path Layout Lemma, lmw(T ) ≤ k. Case 3: X = ∅, Y = ∅ If you make P = (x) for some arbitrary x ∈ T , it is obvious that every connected component of T\N [P ] has LMIM-width ≤ k − 1. By the Path Layout Lemma, lmw(T ) ≤ k. Linear MIM-Width of Trees 7 We have proven the partial claim that if lmw(T ) ≥ k + 1 then there exists a node x ∈ T such that D(x, k) ≥ 3; or there exists a strict subtree S of T with lmw(S) ≥ k + 1. To finish the backward direction of the theorem we need to show that if lmw(T ) ≥ k + 1 then there exists a node x ∈ T with D(x, k) ≥ 3. Assume for a contradiction that there is no node with k-component index at least 3 in T . By the partial claim, there must then exist a strict subtree S with lmw(S) ≥ k + 1. But since we look at finite trees, we know that there in S must exist a minimal subtree S0, lmw(S0) = k + 1 with no strict subtree with LMIM- width > k. By the partial claim, S0 must contain a node x0 with DS0(x0, k) ≥ 3. But every dangling tree S0(cid:104)v, u(cid:105) is a subtree of T(cid:104)v, u(cid:105), and so if DS0(x0, k) ≥ 3, then DT (x0, k) ≥ 3 contradicting our assumption. Fig. 2. The smallest tree with LMIM-width 2, having a node v with three 1-neighbors u1, u2, u3 having dangling trees S1, S2, S3, respectively, so that D(v, 1) = 3 By Theorem 1, every tree with LMIM-width k ≥ 2 must be at least 3 times bigger than the smallest tree with LMIM-width k−1, which implies the following. Remark 1. The LMIM-width of an n-node tree is O(log n). 3 Rooted trees, k-critical nodes and labels Our algorithm computing LMIM-width will work on a rooted tree, processing it bottom-up. We will choose an arbitrary node r of the tree T and denote by Tr the tree rooted in r. For any node x we denote by Tr[x] the standard complete subtree of Tr rooted in x. During the bottom-up processing of Tr we will compute a label for various subtrees. The notion of a k-critical node is crucial for the definition of labels. Definition 3 (k-critical node). Let Tr be a rooted tree with lmw(Tr) = k. We call a node x in Tr k-critical if it has exactly two children v1 and v2 that each has at least one child, u1 and u2 respectively, such that lmw(Tr[u1]) = lmw(Tr[u2]) = k. Thus x is k-critical if and only if lmw(T ) = k and DTr[x](x, k) = 2. vu1u2u3S1S2S3 8 S. Høgemo et al. l, v(cid:48) l, u(cid:48) r, u(cid:48) Remark 2. If Tr has LMIM-width k it has at most one k-critical node. Proof. For a contradiction, let x and x(cid:48) be two k-critical nodes in Tr. There are then four nodes, vl, vr, v(cid:48) r, the two k-neighbours of x and x(cid:48) respectively, such that there exist dangling trees T(cid:104)vl, ul(cid:105), T(cid:104)vr, ur(cid:105), T(cid:104)v(cid:48) r(cid:105) that all have LMIM-width k. If x and x(cid:48) have a descendant/ancestor relationship in Tr, then assume wlog that x(cid:48) is a descendant of vl, and note that T(cid:104)vr, ur(cid:105), T(cid:104)v(cid:48) l(cid:105) l, u(cid:48) and T(cid:104)v(cid:48) r(cid:105) are disjoint trees in different neighbours of x(cid:48), thus DTr (x(cid:48), k) = 3 and by Theorem 1 Tr should have LMIM-width k + 1 Otherwise, all the dan- gling trees are disjoint, thus DT (x, k) = DT (x(cid:48), k) = 3 and we arrive at the same conclusion. l(cid:105), T(cid:104)v(cid:48) r, u(cid:48) Definition 4 (label). Let rooted tree Tr have lmw(Tr) = k. Then label(Tr) consists of a list of decreasing numbers, (a1, . . . , ap), where a1 = k, appended with a string called last type, which tells us where in the tree an ap-critical node lies, if it exists at all. If p = 1 then the label is simple, otherwise it is complex. The label(Tr) is defined recursively, with type 0 being a base case for singletons and for stars, and with type 4 being the only one defining a complex label. -- Type 0: r is a leaf, i.e. Tr is a singleton, then label(Tr) = (0, t.0); or all children of r are leaves, then label(Tr) = (1, t.0) -- Type 1: No k-critical node in Tr, then label(Tr) = (k, t.1) -- Type 2: r is the k-critical node in Tr, then label(Tr) = (k, t.2) -- Type 3: A child of r is k-critical in Tr, then label(Tr) = (k, t.3) -- Type 4: There is a k-critical node uk in Tr that is neither r nor a child of r. Let w be the parent of uk. Then label(Tr) = k ⊕ label(Tr\Tr[w]) In type 4 we note that lmw(Tr\Tr[w]) < k since otherwise uk would have three k-neighbors (two children in the tree and also its parent) and by Theorem 1 we would then have lmw(Tr) = k+1. Therefore, all numbers in label(Tr\Tr[w]) are smaller than k and a complex label is a list of decreasing numbers followed by last type ∈ {t.0, t.1, t.2, t.3}. We now give a Proposition that for any node x in Tr will be used to compute label(Tr[x]) based on the labels of the subtrees rooted at the children and grand-children of x. The subroutine underlying this Proposition, see the decision tree in Figure 3, will be used when reaching node x in the bottom-up processing of Tr. Proposition 1. Let x be a node of Tr with children Child(x), and given label(Tr[v]) for all v ∈ Child(x). We define (and compute) k = maxv∈Child(x) {lmw(Tr[v])} and Nk = {v ∈ Child(x) lmw(T [v]) = k} and denote by Nk = {v1, . . . , vq} and by li = label(Tr[vi]). Define (compute) tk = DTr[x](x, k) by noting that tk = {vi ∈ Nk vi has child uj with lmw(Tr[uj]) = k}. Given this informa- tion, we can find label(Tr[x]) as follows: -- Case 0: if Child(x) = 0 then label(Tr[x]) = (0, t.0); -- Case 1: Every label in Nk is simple and has last type equal to t.1 or t.0, else if k = 0 then label(Tr[x]) = (1, t.0) and tk ≤ 1. Then, label(Tr[x]) = (k, t.1) -- Case 2: Every label in Nk is simple and has last type equal to t.1 or t.0, Linear MIM-Width of Trees 9 but tk = 2. Then, label(Tr[x]) = (k, t.2) but tk ≥ 3. Then, label(Tr[x]) = (k + 1, t.1) has last type equal to either t.2 or t.3. Then, label(Tr[x]) = (k + 1, t.1) -- Case 3: Every label in Nk is simple and has last type equal to t.1 or t.0, -- Case 4: Nk ≥ 2 and for some vi ∈ Nk, either li is a complex label, or li -- Case 5: Nk = 1, l1 is a simple label and l1 has last type equal to t.2. Then, label(Tr[x]) = (k, t.3) -- Case 6: Nk = 1, l1 is either complex or has last type equal to t.3, and k (cid:54)∈ label(Tr[x]\Tr[w]), where w is the parent of the k-critical node in Tr[v1]. Then, label(Tr[x]) = k ⊕ label(Tr[x]\Tr[w]) -- Case 7: Nk = 1, l1 is either complex or has last type equal to t.3, and k ∈ label(Tr[x]\Tr[w]), where w is the parent of the k-critical node in Tr[v1]. Then, label(Tr[x]) = (k + 1, t.1) Fig. 3. A decision tree corresponding to the case analysis of Proposition 1 Proof. We show that exactly one case applies to every rooted tree and in each case we assign the label according to Definition 4. First the base case: either x is a leaf or all its children are leaves and we are in Case 0 and the label is assigned according to Def. 4. Otherwise, observe the decision tree in Figure 3. It follows from Def. 4, k, Nk and tk that cases 1 up to 7 of Prop. 1 corresponds to cases 1 up to 7 in the decision tree - we mention this correspondence in the below - and this proves that exactly one case applies to every rooted tree. The following facts simplify the case analysis: lmw(Tr[x]) is equal to either k or k + 1, and since no subtree rooted in a child of x has LMIM-width k + 1 there cannot be any (k + 1)- critical node in Tr[x], therefore if lmw(Tr[x]) = k + 1, Tr[x] is always a type 1 DTr[x](x,k)?≤1=2≥3YESIsthereachild-tree,Tr[vi],ofxNOYESlmw(Tr[x])=k+1andlmw(Tr[x])=kandTr[x]isatype1treelmw(Tr[x])=kandTr[x]isatype2treeTr[x]isatype1treelmw(Tr[x])=k+1andTr[x]isatype1treelmw(Tr[x])=kandTr[x]isatype3treeIsthelmwofthetreelmw(Tr[x])=kandTr[x]isatype4treelmw(Tr[x])=k+1andTr[x]isatype1treeNOYESNOWhatisthevalueofIsittherootv1∈Tr[v1]thatisthek-criticalnode?Tr[x]\Tr[w]equaltok?Arethereotherchild-treesthatcontainsak-criticalnode?thanTr[vi]thathaslmwk?Case6Case2Case4Case1Case5Case3Case7NOYES 10 S. Høgemo et al. tree and by Theorem 1 it must contain a node v such that DTr[x](v, k) >= 3. This node must either be a k-critical node in a rooted subtree of Tr[x], or x itself. We go through the cases 1 to 7 in order. Note that in Cases 1, 2, and 3 the condition 'Every label in Nk is simple and has last type equal to t.1 or t.0' means there are no k-critical nodes in any subtree of Tr[x], because every Tr[v] for v ∈ Child(x) is either of type 1 or has LMIM- width < k: Case 1: By definition of tk, DTr[x](x, k) ≤ 1. Therefore, lmw(Tr[x]) = k, and Tr[x] is a type 1 tree. Case 2: By definition of tk, DTr[x](x, k) = 2, and no other nodes are k-critical, therefore lmw(Tr[x]) = k. But now x is k-critical in Tr[x] so Tr[x] is a type 2 tree. Case 3: By definition of tk, DTr[x](x, k) = 3 and lmw(Tr[x]) = k + 1. For the remaining Cases 4, 5, 6 and 7, some Tr[v] for v ∈ Child(x) has LMIM- width k and is of type 2, 3 or 4, so at least one k-critical node exists in some subtree of Tr[x]: Case 4: There is a k-critical node uk in some Tr[vi] (not of type 1), and some other vj has lmw(Tr[vj]) = k (because Nk ≥ 2). Now observe w the parent of uk. The dangling tree Tr[x]\Tr[w] is a supertree of Tr[vj] and thus has LMIM-width ≥ k. Therefore w is a k-neighbour of uk and by Theorem 1 lmw(Tr[x]) = k + 1. Case 5: x has only one child v with lmw(Tr[v]) = k, and v is itself k-critical (Tr[v] is type 2). x cannot be a k-neighbour of v in the unrooted Tr[x], because every dangling tree from x is some Tr[vi], vi (cid:54)= v of x, which we know has LMIM- width < k. Since no other node in T is k-critical, lmw(Tr[x]) = k, and since v, a child of x, is k-critical in Tr[x], Tr[x] is a type 3 tree. Case 6: x has only one child v with lmw(Tr[v]) = k, and there is a k-critical node uk with parent w -- neither of which are equal to x -- in Tr[v] (Tr[v] is a type 3 or type 4 tree). Moreover, no tree rooted in another child of w, apart from uk, can have LMIM-width ≥ k, since this would imply DTr[v](uk, k) = 3 and thus lmw(Tr[v]) > k; nor can Tr[x]\Tr[w] have LMIM-width = k, since then we would have k in label(Tr[x]\Tr[w]) disagreeing with the condition of Case 6. Therefore DTr[x](u, k) = 2, and lmw(Tr[x]) = k. Tr[x] is thus a type 4 tree and the label is assigned according to the definition. Case 7: Tr[v], uk and w are as described in Case 6. But here, lmw(Tr[x]\Tr[w]) = k (since the condition says that k is in its label), and thus w is a k-neighbour of its child uk and by Theorem 1 lmw(Tr[x]) = k + 1. We conclude that label(Tr[x]) has been assigned the correct value in all possible cases. 4 Computing LMIM-width of Trees and Finding a Layout The subroutine underlying Prop. 1 will be used in a bottom-up algorithm that starts out at the leaves and works its way up to the root, computing labels Linear MIM-Width of Trees 11 Fig. 4. A rooted tree of LMIM-width 4 with labels of subtrees. We explain the labels (3, t.2), (3, t.3), (3, 2, t.2) assigned to subtrees rooted at the nodes we call a, b, c, with parent(a) = b and parent(b) = c. The sub-tree rooted at a, with label (3, t.2) has precisely two children that have a child-tree each of LMIM-width 3, hence a is 3- critical and it is a type 2 tree (Case 2 of Prop. 1). The sub-tree rooted at b, labelled (3, t.3), is thus the parent of a 3-critical node, and so it is of type 3 (Case 5 of Prop. 1). The sub-tree rooted at c with label (3, 2, t.2) has maximum LMIM-width of a child-tree being 3, and it has a 3-critical node a which is neither c nor a child of c, so it is of type 4 (Case 6 of Prop. 1); and moreover the subtree Tr[c] \ Tr[a] has LMIM-width 2 with node c as 2-critical so it is of type 2 (Case 2 of Prop. 1), and the label of Tr[c] becomes 3 ⊕ (2, t.2). of subtrees Tr[x]. However, in two cases (Case 6 and 7) we need the label of Tr[x]\Tr[w], which is not a complete subtree rooted in any node of Tr. Note that the label of Tr[x]\Tr[w] is again given by a (recursive) call to Prop. 1 and is then stored as a suffix of the complex label of Tr[x]. We will compute these labels by iteratively calling Prop. 1 (substituting the recursion by iteration). We first need to carefully define the subtrees involved when dealing with complex labels. From the definition of labels it is clear that only type 4 trees lead to a complex label. In that case we have a tree Tr[x] of LMIM-width k and a k- critical node uk that is neither x nor a child of x, and the recursive definition gives label(Tr[x]) = k⊕label(Tr[x]\Tr[w]) for w the parent of uk. Unravelling this recursive definition, this means that if label(Tr[x]) = (a1, . . . , ap, last type), we can define a list of nodes (w1, . . . , wp−1) where wi is the parent of an ai-critical node in Tr[x]\(Tr[w1] ∪ . . . ∪ Tr[wi−1]). We expand this list with wp = x, such (0)(1(cid:48))(1(cid:48))(2(cid:48))(2(cid:48))(3(cid:48))(3)(0)(0)(0)(0)(0)(0)(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))(2(cid:48))(2(cid:48))(2(cid:48))(2(cid:48))(3)(3,2)(3,2)(3,2,1)(3,2,1)(3,2,1,0)(3(cid:48))(0)(0)(1(cid:48))(1(cid:48))(1(cid:48))(1(cid:48))label(r)=(4(cid:48))y1y2y3y4 12 S. Høgemo et al. that there is one node in Tr[x] corresponding to each number in label(Tr[x]), and Tr[x]\(Tr[w1] ∪ . . . ∪ Tr[wp]) = ∅. Now, in the first level of a recursive call to Prop. 1 the role of Tr[x] is taken by Tr[x]\Tr[w1], and in the next level it is taken by (Tr[x]\Tr[w1])\Tr[w2] etc. The following definition gives a shorthand for denoting these trees. Definition 5. Let x be a node in Tr, label(Tr[x]) = (a1, a2, . . . , ap, last type) and the corresponding list of vertices (w1, . . . , wp) is as we describe in the above text. For any non-negative integer s, the tree Tr[x, s] is the subtree of Tr[x] obtained by removing all trees Tr[wi] from Tr[x], where ai ≥ s. In other words, if q is such that aq ≥ s > aq+1, then Tr[x, s] = Tr[x]\(Tr[w1]∪ Tr[w2]∪ . . .∪ Tr[wq]) Remark 3. Some important properties of Tr[x, s] are the following. Let Tr[x, s], label(Tr[x, s]), (w1, . . . , wp) and q as in the definition. Then 1. if s > a1, then Tr[x, s] = Tr[x] 2. label(Tr[x, s]) = (aq+1, . . . , ap, last type) 3. lmw(Tr[x, s]) = aq+1 < s 4. lmw(Tr[x, s + 1]) = s if and only if s ∈ label(Tr[x]) 5. Tr[x, s + 1] (cid:54)= Tr[x, s] if and only if s ∈ label(Tr[x]) Proof. These follow from the definitions, maybe the last one requires a proof: Backward direction: Let s = aq for some 1 ≤ q ≤ p. Then Tr[x, s + 1] = Tr[x]\(Tr[w1]∪ . . .∪ Tr[wq−1]) and Tr[x, s] = Tr[x]\(Tr[w1]∪ . . .∪ Tr[wq]). These two trees are clearly different. Forward direction: Let Tr[x, s] = Tr[x]\(Tr[w1] ∪ . . . ∪ Tr[wq]) and Tr[x, s + 1] = Tr[x]\(Tr[w1] ∪ . . . ∪ Tr[wq(cid:48)]) with q(cid:48) < q and aq(cid:48) > aq (because numbers in a label are strictly descending). aq < s + 1 and aq ≥ s, ergo aq = s. Note that for any s the tree Tr[x, s] is defined only after we know label(Tr[x]). In the algorithm, we compute label(Tr[x]) by iterating over increasing values of s (until s > lmw(Tr[x]) since by Remark 3.1 we then have Tr[x, s] = Tr[x]) and we could hope for a loop invariant saying that we have correctly computed label(Tr[x, s]). However, Tr[x, s] is only known once we are done. Instead, each iteration of the loop will correctly compute the label of the following subtree called Tunion[x, s], which is not always equal to Tr[x], but importantly for s > lmw(Tr[x]), we will have Tunion[x, s] = Tr[x, s] = Tr[x]. Definition 6. Let x be a node in Tr with children v1, . . . , vd. Tunion[x, s] is then equal to the tree induced by x and the union of all Tr[vi, s] for 1 ≤ i ≤ d. More technically, Tunion[x, s] = Tr[V (cid:48)] where V (cid:48) = x ∪ V (Tr[v1, s]) ∪ . . . ∪ V (Tr[vd, s]). Given a tree T , we find its LMIM-width by rooting it in an arbitrary node r, and computing labels by processing Tr bottom-up. The answer is given by the first element of label(Tr[r]), which by definition is equal to lmw(T ). At a leaf x of Tr we initialize by label(Tr[x]) ← (0, t.0), and at a node x for which all children are leaves we initialize by label(Tr[x]) ← (1, t.0), according to Definition 4. When reaching a higher node x we compute label of Tr[x] by calling function MakeLabel(Tr, x). function MakeLabel(Tr, x) cur label ← (0, t.0) {v1, . . . , vd} = children of x if 0 ∈ label(Tr[vi]) for some i then for s ← 1, maxd cur label ← (1, t.0) Linear MIM-Width of Trees 13 (cid:46) finds cur label = label(Tr[x]) (cid:46) This is label(Tunion[x, 0]) (cid:46) This is then label(Tunion[x, 1]) i=1{first element of label(Tr[vi])} do d} = {label(Tr[vi, s + 1]) 1 ≤ i ≤ d} {l(cid:48) 1, . . . , l(cid:48) Ns = {vi 1 ≤ i ≤ d, s ∈ l(cid:48) i} ts = {vi vi ∈ Ns, vi has child uj s.t. s ∈ label(Tr[uj, s + 1])} if Ns > 0 then case ← the case from Prop. 1 applying to s, {l(cid:48) d}, Ns and ts cur label ← as given by case in Prop. 1 (s ⊕ cur label if Case 6) 1, . . . , l(cid:48) Fig. 5. The same decision tree as shown in Prop. 1, but adapted to MakeLabel Lemma 2. Given labels at descendants of node x in Tr, MakeLabel(Tr, x) computes label(Tr[x]) as the value of cur label. Proof. Assume that x has the children v1, . . . , vd, and denote their set of la- bels as L = {l1, . . . , ld}. MakeLabel keeps a variable cur label that is updated maximally k times in a for loop, where k is the biggest number in any label of children of x. The following claim will suffice to prove the lemma, since for s > lmw(Tr[x]), we have Tunion[x, s] = Tr[x].. Claim: At the end of the s'th iteration of the for loop the value of cur label is equal to label(Tunion[x, s + 1]). FALSETRUEtscurlabel←Ns≥2l1=(s,t.2)s∈curlabel≤1=2≥3TRUEFALSETRUEFALSEFALSETRUE∃li∈Nss.th.atleastoneistrue:curlabel←(s+1,t.1)curlabel←curlabel←curlabel←curlabel←curlabel←(s,t.1)(s,t.2)(s+1,t.1)(s+1,t.1)(s,t.3)(s⊕curlabel)2)li=(s,t.2)1)liisacomplexlabel3)li=(s,t.3)Case1Case2Case3Case4Case5Case6Case7 14 S. Høgemo et al. Base case: We have to show that before the first iteration of the loop we have cur label = label(Tunion[x, 1]). If some label li ∈ L has 0 as an element then Tunion[x, 1] is isomorphic to a star with x as the center and vi as a leaf. By Prop. 1, in this case label(Tunion[x, 1]) = (1, t.0) and this is what cur label is initialized to. If no li ∈ L has 0 as an element, then by Remark 3.5 Tunion[x, 1] = Tunion[x, 0] which by definition is the singleton node x and by Prop. 1 the label of this tree is (0, t.0) and this is what cur label is initialized to. 1, . . . , l(cid:48) i 1 ≤ i ≤ d, l(cid:48) Induction step: We assume cur label = label(Tunion[x, s]) at the start of the s'th iteration of the for loop and show that at the end of the iteration, cur label = label(Tunion[x, s + 1]). The first thing done in the for loop is the computation of {l(cid:48) i = label(Tr[vi, s + 1])}. By Remark 3.2, label(Tr[vi, s + 1]) ⊆ label(Tr[vi]) for all i, therefore l(cid:48) d are trivial to compute. The second thing done is to set Ns as the set of all children of x whose labels contain s, and ts as the number of nodes in Ns that themselves have children whose labels contain s. Let us first look at what happens when Ns = 0: By Remark 3.5, for every child vi of x, Tr[vi, s + 1] = Tr[vi, s] if s (cid:54)∈ label(Tr[vi]). Therefore, if Ns = 0, then Tunion[x, s+1] = Tunion[x, s], and from the induction assumption, label(Tunion[x, s + 1]) = cur label, and indeed when Ns = 0 then iteration s of the loop does not alter cur label. Otherwise, we have Ns > 0 and make a call to the subroutine given by Prop. 1, see the decision tree in Figure 5, to compute label(Tunion[x, s + 1]) and argue first that the variables used in that call correspond to the variables used in Prop. 1 to compute label(Tr[x]). The correspondence is given in Ta- ble 4. Most of these are just observations: Tunion[x, s + 1] corresponds to Tr[x] Proposition 1 for loop iteration s Explanation Tr[x], k Tunion[x, s + 1], s Tree needing label, max lmw of children Tr[v1], ..., Tr[vd] Tr[vi, s], ..., Tr[vd, s] Subtrees of children 1, ..., l(cid:48) l(cid:48) l1, ..., ld, Nk, tk label(Tr[x]\Tr[w]) cur label Child labels, those with max, root comp. index This is also label(Tunion[x, s + 1]\Tr[w, s + 1]) d, Ns, ts in Prop. 1, and Tr[v1, s + 1], . . . , Tr[vd, s + 1] corresponds to Tr[v1], . . . , Tr[vd]. {l(cid:48) i = label(Tr[vi, s + 1])} correspond to {label(Tr[v]) v ∈ Child} i 1 ≤ i ≤ d, l(cid:48) in Prop. 1. Ns is defined in the algorithm so that it corresponds to Nk in Prop. 1. Since Ns > 0, some vi has s in its label l(cid:48) i. By Remark 3.3 and 3.4, we can infer that s is the maximum LMIM-width of all Tr[vi, s + 1], therefore s corresponds to k in Proposition 1. It takes a bit more effort to show that ts computed in iteration s of the for loop corresponds to tk = DTr[x](x, k) in Prop. 1 -- meaning we need to show that ts = DTunion[x,s+1](x, s). Consider vi, a child of x. In accordance with MakeLabel we say that vi contributes to ts if vi ∈ Ns and vi has a child uj with s in its label. We thus need to show that vi contributes to ts if and only if vi is an s-neighbour of x in Tunion[x, s + 1]. Observe that by Remark 3.4, Linear MIM-Width of Trees 15 lmw(Tr[vi, s + 1]) = lmw(Tr[uj, s + 1]) = s if and only if s is in the labels of both Tr[vi] and Tr[uj]. If s (cid:54)∈ label(Tr[uj, s + 1]), then lmw(Tr[uj, s + 1]) < s, and if this is true for all children of vi, then vi is not an s-neighbour of x in Tunion[x, s + 1]. If s (cid:54)∈ label(Tr[vi, s + 1]), then lmw(Tr[vi, s + 1]) < s and no sub- tree of Tr[vi, s+1] can have LMIM-width s. However, if s ∈ label(Tr[uj, s+1]) and s ∈ label(Tr[vi, s+1]) (this is when vi contributes to ts), then Tr[vi, s+1]∩Tr[uj] must be equal to Tr[uj, s+1] and Tr[uj, s+1] ⊆ Tunion[x, s+1], and we conclude that vi is an s-neighbour of x in Tunion[x, s + 1] if and only if vi contributes to ts, so ts = DTunion[x,s+1](x, s). Lastly, we show that if Tunion[x, s+1] is a Case 6 or Case 7 tree -- that is, Ns = 1, and Tr[v1, s+1] is a type 3 or type 4 tree, with w being the parent of an s-critical node -- then the algorithm has label(Tunion[x, s + 1]\Tr[w, s + 1]) available for computation, indeed that this is the value of cur label. We know, by definition of label and Remark 3.5 that Tr[vi, s+1]\Tr[vi, s] = Tr[w, s+1]. But since Ns = 1, for every j (cid:54)= i, Tr[vj, s+1]\Tr[vj, s] = ∅. Therefore Tunion[x, s+1]\Tunion[x, s] = Tr[w, s + 1] and Tunion[x, s + 1]\Tr[w, s + 1] = Tunion[x, s]. But by the induc- tion assumption, cur label = label(Tunion[x, s]). Thus cur label corresponds to label(Tr[x]\Tr[w]) in Prop. 1. We have now argued for all the correspondences in Table 4. By that, we conclude from Prop. 1 and Definition 6 and the inductive assumption that cur label = label(Tunion[x, s + 1]) at the end of the s'th iteration of the for loop in Make- Label. It runs for k iterations, where k is equal to the biggest number in any label of the children of x, and cur label is then equal to label(Tunion[x, k + 1]). Since k ≥ lmw(Tr[vi]) for all i, by definition Tr[vi, k + 1] = Tr[vi] for all i, and thus Tunion[x, k + 1] = Tr[x]. Therefore, when MakeLabel finishes, cur label = label(Tr[x]). Theorem 2. Given any tree T , lmw(T ) can be computed in O(n log(n))-time. Proof. We find lmw(T ) by bottom-up processing of Tr and returning the first element of label(Tr). After correctly initializating at leaves and nodes whose children are all leaves, we make a call to MakeLabel for each of the remaining nodes. Correctness follows by Lemma 2 and induction on the structure of the rooted tree. For the timing we show that each call runs in O(log n) time. For every integer s from 1 to m, the biggest number in any label of children of x, which is O(log n) by Remark 1, the algorithm checks how many labels of chil- dren of x contain s (to compute Ns), and how many labels of grandchildren of x contain s (to compute ts). The labels are sorted in descending order, there- fore the whole loop goes only once through each of these labels, each of length O(log n). Other than this, MakeLabel only does a constant amount of work. Therefore, MakeLabel(Tr, x), if x has a children and b grandchildren, takes time proportional to O(log n)(a + b). As the sum of the number of children and grandchildren over all nodes of Tr is O(n) we conclude that the total runtime to compute lmw(T ) is O(n · log n). Theorem 3. A layout of LMIM-width lmw(T ) of a tree T can be found in O(n · log n)-time. 16 S. Høgemo et al. Proof. Given T we first run the algorithm computing lmw(T ) by finding labels of all nodes and various subtrees. Given T we first run the algorithm computing lmw(T ) finding the label of every full rooted subtree in Tr. We give a recursive layout-algorithm that uses these labels in tandem with LinOrd presented in the Path Layout Lemma. We call it on a rooted tree where labels of all subtrees are known. For simplicity we call this rooted tree Tr even though in recursive calls this is not the original root r and tree T . The layout-algorithm goes as follows: 1) Let lmw(Tr) = k and find a path P in Tr such that all trees in Tr\N [P ] have LMIM-width < k. The path depends on the type of Tr as explained in detail below. 2) Call this layout-algorithm recursively on every rooted tree in Tr\N [P ] to ob- tain linear layouts; to this end, we need the correct label for every node in these trees. 3) Call LinOrd on Tr, P and the layouts provided in step 2. Every tree in the forest T\N [P ] is equal to a dangling tree T(cid:104)v, u(cid:105), where v is a neighbour of some x ∈ P . We observe that if lmw(T ) = k, then by definition lmw(T(cid:104)v, u(cid:105)) = k if and only if v is a k-neighbour of x. It follows that every tree in T\N [P ] has LMIM-width at most k − 1 if and only if no node in P has a k-neighbour that is not in P . We use this fact to show that for every type of tree we can find a satisfying path in the following way: Type 0 trees: Choose P = (r). Since T\N [r] = ∅ in these trees, this must be a satisfying path. Type 1 trees: These trees contain no k-critical nodes, which by definition means that for any node x in Tr, at most one of its children is a k-neighbour of x. Choose P to start at the root r, and as long as the last node in P has a k- neighbour v, v is appended to P . This set of nodes is obviously a path in Tr. No node in P can possibly have a k-neighbour outside of P , therefore all connected components of T\N [P ] have LMIM-width ≤ k− 1. Furthermore, all components of T − N [P ] are full rooted sub-trees of Tr and so the labels are already known. Type 2 trees: In these trees the root r is k-critical. We look at the trees rooted in the two k-neighbours of r, Tr[v1] and Tr[v2]. By Remark 2 these must both be Type 1 trees, and so we find paths P1, P2 in Tr[v1] and Tr[v2] respectively, as described above. Gluing these paths together at r we get a satisfying path for Tr, and we still have correct labels for the components T\N [P ]. Type 3 trees: In these trees, r has exactly one child v such that Tr[v] is of type 2 and none of its other children have LMIM-width k. We choose P as we did above for Tr[v]. r is clearly not a k-neighbour of v, or else DT (v, k) = 3. Every other node in P has all their neighbours in Tr[v]. Again, every tree in T\N [P ] is a full rooted subtree, and every label is known. Type 4 trees: In these trees, Tr contains precisely one node w (cid:54)= r such that w is the parent of a k-critical node, x. This w is easy to find using the labels, and clearly the tree Tr[w] is a type 3 tree with LMIM-width k. We find a path P Linear MIM-Width of Trees 17 that is satisfying in Tr[w] as described above. w is still not a k-neighbour of x, therefore P is a satisfying path. In this case, we have one connected component of T\N [P ] that is not a full rooted subtree of Tr, that is Tr\Tr[w]. Thus for every ancestor y of w (the blue path in Figure 6) Tr[y]\Tr[w] is not a full rooted sub- tree either, and we need to update the labels of these trees. However, Tr[y]\Tr[w] is by definition equal to Tr[y, k], whose label is equal to label(Tr[y]) without its first number. Thus we quickly find the correct labels to do the recursive call. Fig. 6. The path P in green for the proof of Theorem 3. 5 Conclusion We have given an O(n log n) algorithm computing the LMIM-width and an opti- mal layout of an n-node tree. This is the first graph class of LMIM-width larger than 1 having a polynomial-time algorithm computing LMIM-width and thus constitutes an important step towards a better understanding of LMIM-width. Indeed, for the development of FPT algorithms computing tree-width and path- width of general graphs, one could argue that the algorithm of [7] computing optimal path-decompositions of a tree in time O(n log n) was a stepping stone. The situation is different for MIM-width and LMIM-width, as it is W-hard to compute these parameters [19], but it is similar in the sense that our objective has been to achieve an understanding of how to take a graph and assemble a decomposition of it, in this case a linear one, such that it has cuts of low MIM. To achieve this objective a polynomial-time algorithm for trees has been our main goal. Bibliography [1] Isolde Adler and Mamadou Moustapha Kant´e. Linear rank-width and linear clique-width of trees. Theor. Comput. Sci., 589:87 -- 98, 2015. [2] R´emy Belmonte and Martin Vatshelle. Graph classes with structured neigh- borhoods and algorithmic applications. Theor. Comput. Sci., 511:54 -- 65, 2013. ........................Type1:Type3:Type4:<k<k<k<k<k<k<k<k<k<k<k<k<kkkkkkkkkkkkkkkkkkkkkk<k<kkType1Type1Type3...<k 18 S. Høgemo et al. [3] Benjamin Bergougnoux and Mamadou Moustapha Kant´e. Rank based ap- proach on graphs with structured neighborhood. CoRR, abs/1805.11275, 2018. [4] Hans L. Bodlaender. A linear-time algorithm for finding tree- decompositions of small treewidth. SIAM J. Comput., 25(6):1305 -- 1317, 1996. [5] Binh-Minh Bui-Xuan, Jan Arne Telle, and Martin Vatshelle. Fast dynamic programming for locally checkable vertex subset and vertex partitioning problems. Theor. Comput. Sci., 511:66 -- 76, 2013. [6] Reinhard Diestel. Graph Theory, 4th Edition, volume 173 of Graduate texts in mathematics. Springer, 2012. [7] John A. Ellis, Ivan Hal Sudborough, and Jonathan S. Turner. The vertex separation and search number of a graph. Inf. Comput., 113(1):50 -- 79, 1994. [8] Fedor V. Fomin, Petr A. Golovach, and Jean-Florent Raymond. On the In Proc. ESA 2018, tractability of optimization problems on H-graphs. pages 30:1 -- 30:14, 2018. [9] Esther Galby, Andrea Munaro, and Bernard Ries. Semitotal domina- tion: New hardness results and a polynomial-time algorithm for graphs of bounded mim-width. CoRR, abs/1810.06872, 2018. [10] Petr A. Golovach, Pinar Heggernes, Mamadou Moustapha Kant´e, Dieter Kratsch, Sigve Hortemo Saether, and Yngve Villanger. Output-polynomial enumeration on graphs of bounded (local) linear mim-width. Algorithmica, 80(2):714 -- 741, 2018. [11] Martin Charles Golumbic and Udi Rotics. On the clique-width of some perfect graph classes. Int. J. Found. Comput. Sci., 11(3):423 -- 443, 2000. [12] Petr Hlinen´y, Sang-il Oum, Detlef Seese, and Georg Gottlob. Width param- eters beyond tree-width and their applications. Comput. J., 51(3):326 -- 362, 2008. [13] Lars Jaffke, O-joung Kwon, Torstein J. F. Strømme, and Jan Arne Telle. Generalized distance domination problems and their complexity on graphs of bounded mim-width. In 13th International Symposium on Parameterized and Exact Computation, IPEC 2018, August 20-24, 2018, Helsinki, Finland, pages 6:1 -- 6:14, 2018. [14] Lars Jaffke, O-joung Kwon, and Jan Arne Telle. Polynomial-time algorithms for the longest induced path and induced disjoint paths problems on graphs of bounded mim-width. In 12th International Symposium on Parameterized and Exact Computation, IPEC 2017, September 6-8, 2017, Vienna, Austria, pages 21:1 -- 21:13, 2017. [15] Lars Jaffke, O-joung Kwon, and Jan Arne Telle. A unified polynomial- time algorithm for feedback vertex set on graphs of bounded mim-width. In 35th Symposium on Theoretical Aspects of Computer Science, STACS 2018, February 28 to March 3, 2018, Caen, France, pages 42:1 -- 42:14, 2018. [16] Stefan Mengel. Lower bounds on the mim-width of some graph classes. Discrete Applied Mathematics, 248:28 -- 32, 2018. [17] Rolf H Mohring. Graph problems related to gate matrix layout and pla folding. In Computational graph theory, pages 17 -- 51. Springer, 1990. Linear MIM-Width of Trees 19 [18] Sang-il Oum. Rank-width: Algorithmic and structural results. Discrete Applied Mathematics, 231:15 -- 24, 2017. [19] Sigve Hortemo Saether and Martin Vatshelle. Hardness of computing width parameters based on branch decompositions over the vertex set. Theor. Comput. Sci., 615:120 -- 125, 2016. [20] Martin Vatshelle. New width parameters of graphs. PhD thesis, University of Bergen, Norway, 2012. [21] Koichi Yamazaki. Inapproximability of rank, clique, boolean, and maximum induced matching-widths under small set expansion hypothesis. Algorithms, 11(11):173, 2018.
1307.1516
1
1307
2013-07-05T04:05:11
Dynamic Decremental Approximate Distance Oracles with $(1+\epsilon, 2)$ stretch
[ "cs.DS" ]
We provide a decremental approximate Distance Oracle that obtains stretch of $1+\epsilon$ multiplicative and 2 additive and has $\hat{O}(n^{5/2})$ total cost (where $\hat{O}$ notation suppresses polylogarithmic and $n^{O(1)/\sqrt{n}}$ factors). The best previous results with $\hat{O}(n^{5/2})$ total cost obtained stretch $3+\epsilon$.
cs.DS
cs
Dynamic Decremental Approximate Distance Oracles with (1 + ǫ, 2) stretch Ittai Abraham ∗ Shiri Chechik ∗ November 14, 2018 We provide a decremental approximate Distance Oracle that obtains stretch of 1 + ǫ multiplicative and 2 additive and has O(n5/2) total cost (where O notation suppresses polylogarithmic and nO(1)/√log n factors). The best previous results with O(n5/2) total cost obtained stretch 3 + ǫ. Abstract 3 1 0 2 l u J 5 ] S D . s c [ 1 v 6 1 5 1 . 7 0 3 1 : v i X r a ∗Microsoft Research Silicon Valley, Mountain View CA, USA. Email: {ittaia,schechik}@microsoft.com. 1 Introduction Dynamic graph algorithms are designed to maintain some functionalities on the network in the settings where the network changes over time. This paper considers the problem of maintaining (approximate) shortest paths in the dynamic setting, where edges are being deleted and added to the graph. Dynamic distance oracles: A dynamic distance oracle (DDO) is a data structure that is capable of efficiently processing an adver- sarial sequence of delete, insert and distance query operations. A delete operation deletes a single edge from the graph. An insert operation adds a single edge to the graph. A query operation receives a pair of nodes and returns a distance estimation. We say that a dynamic algorithm is decremental if it handles only deletion operations, incremental if it handles only insertion operations, and fully dynamic if it handles both. A dynamic approximate distance oracle has stretch k if the returned distance estimation for every pair of nodes is at least the actual distance between them and at most k times their actual distance. A single-source dynamic distance oracle (SSDDO) has a fixed source s and all distance queries must involve the source s. One can obtain a dynamic distance oracle by simply constructing a dynamic single-source distance oracle for every possible source. Even for single-source decremental dynamic distance oracles we do not know of any non-trivial bounds on worst-case operation costs. So it is natural to consider amortized costs as the next best measure. The amortized cost of a dynamic distance oracle is the average cost of a sequence of m operations taken over all possible adversarial sequences and all possible graphs with n vertices and m edges. Note that simply running Dijkstra's algorithm on queries (and trivially updating the graph data structure on delete and insert operations) gives a O(m) amortized cost DDO for exact distances. The worst case query time is the bound on the cost of any query. This bound is important when one expects significantly more query operations relative to delete and insert operation. The dynamic distance oracle problem (with its various variations) has received a lot of attention in the last three decades. We survey some of the main results: Exact Single-Source DDOs: Even and Shiloach, in 1981, presented a decremental SSDDO for undirected, unweighted graphs with O(m) amortized cost and O(1) query time with stretch 1 (exact distances). A similar scheme was independently found by Dinitz [18]. Later, King [34] generalized this result to directed graphs. The naive implementation of the dynamic distance oracle of [34] requires in the worst case O(n3) memory. King and Thorup [37] showed a technique that allows implementing a dynamic distance oracle using the algorithm of [34] with only O(n2.5) (O(n2√nb) memory, where b is the maximal edge weight). Roditty and Zwick [52] showed that incremental and decremental SSDDO for unweighted graphs are at least as hard as several basic problems such as Boolean matrix multiplication and the problem of finding all edges in a given graph that are part of a triangle. Exact DDOs: The problem of exact DDO was extensively studied. Ausiello et al. [3] presented an incre- mental DDO for weighted directed graphs with amortized cost O(n3 log n/m) and O(1) query time. Hen- zinger and King showed a decremental DDO for weighted directed graphs with amortized cost O(n2/t + n) and O(t) query time. Later, King [34] presented a fully dynamic DDO for unweighted graphs with amortized cost O(n2.5) and O(1) query time. Demetrescu and Italiano [16] presented a fully dynamic DDO for directed weighted graph with amortized cost O(n2.5√S), where S is the possible number of different weight values in the graph. Demetrescu and Italiano [15], in a major breakthrough devised a fully dynamic exact DDO for directed general graphs with non negative edge weights, with amortized cost O(n2). Thorup [46] later extended 1 the result to negative edge weights and slightly improved the update time. Thorup [47] also considered the worst case update time and presented fully dynamic DDO with worst case update time O(n2.75). Baswana et al. [4] devised a decremental DDO for unweighted directed graphs and amortized cost O(n3/m). Approximate DDOs, incremental-only and decremental-only: The dynamic distance oracle problem was also studied when approximated distances are allowed. We begin with the incremental-only and decramental-only results. Baswana et al. [4] presented a decremental DDO for unweighted graphs with amortized cost O(n2/√m), O(1) query time and (1 + ǫ) stretch. Later, Baswana et al. [5] presented several decremental algorithms for undirected graphs. They presented stretch 3 decremental DDO with amortized cost O(n10/9), stretch 5 decremental DDO with amortized cost O(n14/13), and stretch 7 decremental DDO with amortized cost O(n28/27). Roditty and Zwick [50, 51] presented extremely efficient distance oracles for the only incremental and for the only decremental cases. Each has amortized cost O(n), (1 + ǫ) stretch and O(1) query time. In a recent breakthrough Bernstein [8] obtained similar bounds for directed weighted graphs. Roditty and Zwick [50, 51] also presented a second decremental algorithm with amortized cost O(n), (2k − 1) stretch and (k) query time that uses a space of O(m + n1+1/k) (rather than a space of O(mn)). Bernstein and Roditty [10] later presented a decremental DDO for unweighted undirected graphs with (2k− 1 + ǫ) stretch, O(k) query time and amortized cost O(n2+1/k+O(1)/√log n/m). In the same paper Roditty and Bernstein also presented a very efficient decremental SSSP for unweighted undirected graphs with amortized cost O(n2+O(1/√log n)/m), (1 + ǫ) stretch and constant query time. Fully dynamic approximate DDOs: For the fully dynamic approximate DDO problem the following re- sults were achieved. King [34] presented a fully dynamic DDO with amortized cost O(n2), O(1) query time and (1 + ǫ) stretch. Roditty and Zwick [50, 51] presented a fully dynamic DDO for any fixed ǫ, δ > 0 and every t ≤ m1/2−δ, with expected amortized cost of O(mn/t) and worst case query time of O(t) and (1 + ǫ) stretch. Note that as t ≤ m1/2−δ, the best amortized cost that can be achieved using this algorithm is Ω(m1/2+δn) > Ω(m). Later, Bernstein [7] presented fully dynamic DDO with O(log log log n) query time, 2 + ǫ stretch and O(mnO(1)/ log n) amortized cost. 1.1 Our contributions We construct a decremental approximate DDO that obtains stretch of 1 + ǫ multiplicative and 2 additive. Note that this is at most 2 + ǫ multiplicative since we can answer exactly on edges. Our decremental approximate DDO has only O(n5/2) total cost1. Previously the best results for decremental approximate DDO with O(n5/2) total cost obtained stretch 3 + ǫ [10]. Theorem 1.1 One can maintain a decremental dynamic distance oracle, of size O(n5/2) with (1 + ǫ, 2) stretch, constant query time, and total cost of O(n5/2). Additional related work: A related notion of dynamic distance oracle is that of distance oracles supporting a fixed number of failures. A distance oracle supporting a single edge failure with exact distances, O(n2) size and O(log n) query time was presented in [17]. This was later generalize to handle a single edge or vertex failures [17] and then to dual failures [19]. Approximate dynamic distance oracles supporting multiple edge failures was presented in [12]. A more relaxed version of the dynamic distance oracle is that of the dynamic connectivity oracle. In this problem it is required to answer connectivity queries rather than distance queries. It is not hard to see that any result on dynamic distance oracle with any stretch automatically implies dynamic connectivity oracle 1 O(f (n)) = f (n)nO(1)/√n be a crude way to suppress poly-log and nO(1)/√log n factors. 2 with the same bounds. The problem of dynamic connectivity oracle was extensively studied. Dynamic connectivity oracle with poly-log amortized update time were first introduced by Henzinger and King [28] (see [30, 31, 43, 40] for further improvements and lower bounds). The problem of constructing dynamic connectivity problem with worst case update time was also con- sidered. Frederickson [26] introduced dynamic connectivity oracle with O(√m) update time. The sparsifi- cation technique of Eppstein et. al. [22, 23] improved the update time to O(√n). Patras¸cu and Thorup [41] considered the connectivity problem in a restricted model where all edge deletions occur in one bunch and after the deletions, distance queries arrived. They presented a data structure of size O(m) such that given a set F of of f edge failures and two nodes s and t, can decide if s and t remain connected in time O(f ). Duan and Pettie [20] later considered the same problem for vertex failures and presented a data structure of size O(f 1−2/cmn1/c−1/(c log 2f )), O(f 2c+4) update time, and O(f ) query time, where c is some integer and f is the number of vertex failures occurred. In a recent breakthrough, Kapron et al. [39] showed a construction for fully dynamic distance oracle with poly-log worst case update and query time. 2 Preliminaries 2.1 Existing Decremental SSSP algorithms Our algorithm uses the decremental SSSP algorithm of King [34] as an ingredient and modify it. The properties of King's algortihm are summarized in the following theorem. Theorem 2.1 [34] Given a directed graph with positive integer edge weights, a source node s and a distance d, one can decrementally maintains a shortest path tree T from s up to distance d in total time O(md). Moreover, given a node v, one can extract in O(1) time dist(v, s) in case v ∈ T or determine that v /∈ T . King's algorithm starts by constructing a shortest path tree T rooted at s. Each time an edge (x, y) is deleted, where x is in the same connected component as s in T \ e, an attempt is made to find a substitute edge to y that does not increase the distance from s to y. If such edge is found then the recovery phase is over. Note that in this case the distances from s to y and to all nodes in y's subtree are unchanged. In case no such edge found, the best edge is chosen, i.e., the edge that connect y on the shortest path possible. The process is continued recursively on all y's children. The crucial property of this algorithm is that it explores the edges of a node v only when the distance from s to v increases. This gives a total running time of O(md) as the distance from s to a node v may increase at most d times before exceeding d. Our algorithm also uses as an ingredient the efficient construction of Bernstein and Roditty [10] for maintaining a (1 + ǫ) decremental SSSP. The input of the algorithm is an undirected unweighted graph and a source node s. The algorithm decrementally maintains a (1 + ǫ) shortest path tree T from s in total time O(n2). More specifically, Roditty and Bernstein showed the following. They showed how to √6/ǫ √log n ) emulator H in time O(m). Let ζ = n √6/ǫ √log n and β = (2/ǫ)ζ. They show maintain a (1 + ǫ/2, n that if dist(x, y) ≥ β then dist(x, y, H) ≤ (1 + ǫ)dist(x, y). In addition, they show how to maintain a tree T (s), where the distances dist(s, x, T (s)) = dist(s, x, H) for every x ∈ V . In order to get rid of the additive term for short distances they handle short distances separately. Let distBR(s, x) be the estimated distance returned by Roditty and Bernstein's decremental SSSP algorithm. Let H be the emulator in the construction of Bernstein and Roditty [10]. We summarize the properties we need from Bernstein and Roditty's construction in the following theorem. 3 Theorem 2.2 [10] For a given graph G and a node s, one can maintain a decremental (1 + ǫ) emulator H and a shortest path tree T = T (s) from s in O(n2) total time with the following properties: √6/ǫ √log n ) emulator, namely, for every two nodes x and y, dist(x, y) ≤ (1) The graph H is a (1 + ǫ/2, n dist(x, y, H) ≤ (1 + ǫ/2)dist(x, y) + n (2) If dist(x, y) ≥ β then dist(x, y, H) ≤ (1+ǫ)dist(x, y). (this follows directly from (1) by straightforward calculations). (3) For every x ∈ V : dist(s, x, T (s)) = dist(s, x, H) √6/ǫ √log n ). For our construction we also need the following additional property from the emulator. Lemma 2.3 Consider two nodes x, y and z, if dist(x, y) ≥ 8β/ǫ and z is at distance at most β from some node on P (x, y) then dist(x, z, H) + dist(y, z, H) ≤ (1 + ǫ)dist(x, y). 3 Decremental with O(n5/2) total update time v (x, y) be the distance distBR(v, x) + distBR(v, y). In this section we present a new decremental all-pairs shortest paths algorithm with O(n5/2) total update time, with a multiplicative stretch of 1 + ǫ and additive stretch of 2. In fact the stretch is the maximum between a multiplicative 1 + ǫ and additive stretch 2, namely, let d(x, y) be the reported distance, then dist(x, y) ≤ d(x, y) ≤ dist(x, y)+max{ǫdist(x, y), 2}. For simplicity, we present a scheme that guarantees the following d(x, y) ≤ O(1 + ǫ)(dist(x, y) + 2) and with query time O(log log n). We later explain the slight modifications to improve the guarantee to d(x, y) ≤ dist(x, y) + max{ǫdist(x, y), 2} and how to reduce the query time to constant. We say that a node is heavy if it's degree is larger than n1/2 or light otherwise. Let P (s, t) be a shortest path from s to t. Let heavy dist(s, t) be the minimal distance between s and t that goes through some heavy node, namely, heavy dist(s, t) = min{dist(s, x) + dist(x, t) x is heavy}. Let light dist(s, t) be the length of the shortest path between s and t, where all nodes on that path are light. Let distv(x, y) be the length of the shortest path from x to y that goes through v, namely, distv(x, y) = dist(x, v) + dist(v, y). Let distQ(x, y) be the minimal distance distv(x, y) for some v ∈ Q. Let distBR Previous decremental algorithms used dynamic SSSP as an ingredient by including all nodes in the tree through the entire execution of the algorithm (or all nodes up to some distance). We maintain decremental SSSP that includes only some of the nodes, and nodes may be added to the tree at some later stage of the algorithm. In fact, some nodes may be added and removed from the tree many times during the algorithm. Roughly speaking, we would like to add to the tree T (v) only nodes whose shortest path to v does not contain any heavy nodes. This raises several difficulties. Note that just ignoring heavy nodes is not enough. There may be a shortest path from x to v that contains a heavy node, but also a different longer path from x to v that does not go through any heavy node. If we are not careful, we may add the node x to the tree T (v) on a path that is not the shortest. As the graph changes at some point there might be no more heavy nodes on P (x, v) anymore. At this point we may want that the distance dist(x, v, T (v)) will be optimal or close to optimal. This may result in shortening the distance from x to v in T (v), which may be problematic as usually decremental SSSP algorithms rely on the fact that distances can only increase and thus it is possible it bound the number of times the distances change. Therefore we need to be careful and add x to T (v) only if the shortest path P (x, v) does not contain any heavy nodes. Moreover, note that as P (x, v) changes over time, it might changes between having heavy nodes to not having many times. So the algorithm may need to add and remove v from the tree many times. 4 q Loosely speaking, the algorithm maintains heavy distances by sampling a set Q of O(n1/2) nodes and maintaining (1 + ǫ) shortest paths distances from all nodes in Q. This is done using the construction of Roditty and Bernstein [10]. In order to estimate distQ(x, y) the algorithm stores the distances distBR (x, y) for q ∈ Q in a heap and updates the heap each time distBR(x, q) or distBR(y, q) changes by a (1 + ǫ) factor. In order to handle light distances the algorithm picks sets Si of O(n/2i) nodes and maintain a shortest paths trees T (s) from each node s ∈ Si up to distance 2i, where the goal is to include only nodes x such that their shortest path P (s, x) does not include heavy nodes. In order for the algorithm to determine if the path P (s, x) contains heavy nodes, the algorithm uses the approximated distances for distQ(s, x). Some difficulties arise from the fact that we don't have the exact distances distQ(s, x) but rather approximated ones. In order to be able to maintain the shortest path trees from every s ∈ Si with small update time, we need to make sure that we do not decrease distances. The entire analysis of King's algorithm [34] relies on the crucial property that distances between every two nodes can be increased at most d times before exceeding the distance d. In our case since we only have approximated distances for distQ(s, x), we cannot be sure if a path P (s, x) contains a heavy node or not. We thus need to be more strict in the decision to add a node to T (s). We need to maintain the property that if y ∈ P (s, x) was not added to T (s) then x will not be added to T (s) as well. In order to do that we exploit the fact that the distances distBR(x, q) represents distances from an emulator H. Thus, if y ∈ P (s, x) was not added to T (s) since there is a good alternative path P1 that goes through an heavy node then since H also contains a good alternative path P2 from y to x, we get that by concatenating these paths there is a good alternative path from x to s that goes through Q. However some additional problems arise from the fact that H is not really a 1 + ǫ emulator but rather has an additive stretch. The emulator H has a 1 + ǫ multiplicative stretch only for distances larger than β. Our solution to bypass this problem is to store exact distances from x to small ball around it and then check if there is a good alternative path that consists of a short exact path and then a path from H. In addition, for nodes x ∈ V and s ∈ Si for some 1 ≤ i ≤ log n as will explained later on it is not enough to update the distances distBR (x, s) for q ∈ Q in the heap each time distBR(x, q) or distBR(y, q) changes by a (1 + ǫ) factor. We will rather have a more refined heaps for nodes x ∈ V and s ∈ Si that will be updated each time distBR (x, s) increases. In order to do this efficiently these refine heaps maintain only distances up to 2i. q q Consider the tree T rooted at some node s. Let v be a node such that v /∈ T . Let d(v, s, B(T, 1)) be the minimal distance dist(s, x, T ) + 1 such that x is a neighbor of v in G. The algorithm: We now describe the different components in our data structure. The first component is a subset Q of the vertices obtained by sampling every node independently with probability c ln n/n1/2, for some constant c. Claim 3.1 The expected size of the set Q is O(n1/2). The second component is a collection of subsets Si of the nodes for every 1 ≤ i ≤ log n, obtained as follows. The set Si is obtained by sampling every node independently with probability min{ c ln n Claim 3.2 For every 1 ≤ i ≤ log n, the expected size of the set Si is min{ c ln nn ǫ2i , 1}. ǫ2i , n}. Note that the number of considered graphs during the entire running of the algorithm is m (as there are m deletions from the graph). The following lemma shows that with high probability for every considered graph some useful properties occur. 5 Lemma 3.3 With probability 1 − 3/nc−3, for every considered graph G′ during the entire running of the algorithm, the following happens: (1) for every heavy node v, Γ(v) ∩ Q 6= ∅, where Γ(v) is the set of neighbours of v. (2) for every vertex v and every index i such that 1 ≤ i ≤ log n and such that there exists a node z such that dist(v, z, G) ≥ ǫ2i: Si ∩ B(v, ǫ2i, G) 6= ∅. (3) for every vertex v such that B(v, β) ≥ n1/2: Q ∩ B(v, β, G) 6= ∅. For the rest of the proof we assume that Lemma 3.3 holds for all versions of the graph. The third component, hereafter referred to as ExactQ, relies on component Q and is as follows. For every node in q ∈ Q, maintain an exact decremental shortest path tree up to distance 8β/ǫ using King's algorithm [34]. Using ExactQ for every v ∈ V and q ∈ Q, one can determine in constant time if dist(v, q) ≤ 8β/ǫ and if so extract dist(v, q). Claim 3.4 Maintaining ExactQ takes O(n1/2 · m) ≤ O(n5/2) total time. Proof: By Claim 3.1 the expected size of Q is O(n1/2). For every node q ∈ Q maintaining the shortest path tree up to distance 8β/ǫ takes O(βm) total time. The claim follows. The forth component, hereafter referred to as BRQ, relies on component Q and is as follows. For every node q ∈ Q, maintain a (1 + ǫ)-approximate decremental SSSP using the algorithm of Roditty and Bernstein [10]. Recall that the total update time for maintaining Roditty and Bernstein [10] data structure is O(n2), we thus have the following. Claim 3.5 Maintaining BRQ takes O(n5/2) total update time. component is to maintain distQ(x, y) exactly for short distances. The fifth component, hereafter referred to as H1 relies on components Q and ExactQ. The goal of this The component is done as follows. For every nodes x, y ∈ V do the following. If distQ(x, y) ≤ 8β/ǫ (x,y) containing (x,y)[q] = distq(x, y) such that distq(x, y) < 8β/ǫ. The algorithm updates the heap each (x,y) or infinity in then the distance distQ(x, y) is maintained exactly. This is done by maintaining a heap Heap(1) all values Heap(1) time dist(x, q) or dist(y, q) increases. Let min(Heap(1) case Heap(1) (x,y)) be the minimal value in Heap(1) (x,y) is null. Claim 3.6 Maintaining H1 takes O(n5/2) total update time. The sixth component, hereafter referred to as H1+ǫ, relies on components Q and BRQ. The goal of this component is to allow approximating the distances distQ(x, y) for every x, y ∈ V . The main idea is to (x, y) in a heap. Ideally, each time one of distBR(q, x) and distBR(q, y) changes, keep all distance distBR the heap should be updated. However, this may take too long as distBR(q, x) and distBR(q, y) may change many times and moreover these distances may also decrease. Thus instead we update the heap each time one of distBR(q, x) or distBR(q, y) increases by a factor of (1 + ǫ). We then show that this is enough to get a good estimation on distQ(x, y). q The component is done as follows. For every pair of nodes x and y keep all distances {distBR q (x, y) (x,y) [q] q ∈ Q} in a minimum heap Heap(1+ǫ) be the value of the key q in the heap Heap(1+ǫ) (x,y) , where the key is q and the value is distBR (x, y). Let Heap(1+ǫ) (x,y) ) be the minimum value in the heap. q (x,y) . Let min(Heap(1+ǫ) 6 For every two nodes x ∈ V and q ∈ Q store a distance dlast(x, q) initially is set to dist(x, q). Each time the distance distBR(q, x) increases the algorithm checks if distBR(q, x) ≥ dlast(x, q)(1 + ǫ), if so the algorithm updates the values Heap(1+ǫ) (x,y) [q] for every node y and set dlast(x, q) = distBR(q, x). The next lemma shows that for every nodes x, y, min((1 + ǫ) min(Heap(1+ǫ) (x,y) ), min(Heap(1) (x,y))) is a good approximation on the heavy distance from x to y. Lemma 3.7 For every nodes x, y ∈ V , dist(x, y) ≤ d(x, y) ≤ (1 + ǫ)2(heavy dist(x, y) + 2), where d(x, y) = min((1 + ǫ) min(Heap(1+ǫ) (x,y) ), min(Heap(1) (x,y))). Claim 3.8 Maintaining H1+ǫ takes O(n5/2) total update time. The seventh component, hereafter referred to as H∗,1+ǫ relies on components Q and BRQ. The goal of this component is similar to the goal of the previous component with some subtle changes. Approximating the heavy distances is useful for two main uses. The first use is for the distance queries. The second use is for deciding if a node v should be added to some tree T (s) for s ∈ Si for 1 ≤ i ≤ log n. For the latter use it is not enough to update the heap each time distBR(s, q) is increased or when distBR(q, x) is increased by a 1 + ǫ factor. We rather need that the heap to contain the correct values of distBR (s, x), as otherwise there could be a case where the value of distBR Q (s, x) for some y ∈ P (s, x). Thus the value in the heap min(Heap(1+ǫ) (s,x) ) < distBR Q (s, x) and we might decide to add x to T (s) but not y. Q (s, y) is more updated than the value distBR Q (s, y) but min(Heap(1+ǫ) (s,y) ) = distBR q q (x, y) ≤ (1 + ǫ)2i} in a minimum heap Heap(∗,1+ǫ) The component is done as follows. For every node x ∈ V , index 1 ≤ i ≤ log n and y ∈ Si. Keep all distances {distBR Q, distBR slight difference that we update Heap(∗,1+ǫ) is increased, rather than waiting until it increases by a factor of (1+ ǫ). Notice that the distance distBR may also decrease, in that case the algorithm does not update Heap(∗,1+ǫ) . When the distance distBR exceeds (1 + ǫ)2i, remove z from the heap Heap(∗,1+ǫ) (x, y) q ∈ (x,y) with the [q] when either distBR(q, x) is increased or when distBR(q, y) (x, y) (x, y) is similar to Heap(1+ǫ) . Heap(∗,1+ǫ) permanently. (x,y) (x,y) (x,y) (x,y) q z z (x,y) Claim 3.9 Maintaining H∗,1+ǫ takes O(n5/2) total update time. The eighth component, hereafter referred to as KIN G − S − L (stands for King for small distances for light balls) relies on Q, ExactQ and H1. The goal of this component is to overcome the fact that the emulator H has an additive stretch. Recall that we would like to make sure that if a node y ∈ P (s, x) is not added to T (s) then also x is not added If H was indeed a (1 + ǫ) emulator then note that if dist(s, y, H) ≤ (1 + ǫ)dist(s, y) then to T (s). also dist(s, x, H) ≤ (1 + ǫ)dist(s, x). To see this note that dist(x, y, H) ≤ (1 + ǫ)dist(x, y), therefore dist(s, x, H) ≤ dist(s, y, H) + dist(y, x, H) ≤ (1 + ǫ)dist(s, x). But H is not a (1 + ǫ) emulator and it could be that x and y are very close to one another (less than β) and thus H does not contain a (1 + ǫ)-shortest path between them. Therefore it could happen that dist(s, y, H) ≤ (1 + ǫ)dist(s, y) but dist(s, y, H) > (1 + ǫ)dist(s, y). To overcome this issue, we do the following. First if the distance dist(x, Q) ≤ β then we can show that distQ(s, x) can be well estimated by H1 and H1+ǫ for every s ∈ V . Otherwise, if the distance dist(x, Q) > β then we maintain exact distances from x 7 to all nodes at distance β from it. As dist(x, Q) > β the ball B(x, β) contains only light nodes and thus maintaining B(x, β) and their distances to x can be done efficiently. Then in order to decide if x should be added to T (s) we check all distances dist(x, w) + distQ(w, s, H) for all w ∈ B(x, β). Note that now if x and y are close (at distance less than β) then y ∈ B(x, β) and we have the exact distance between them and thus we don't need to rely on H that does not return a good approximation for close nodes. Formally, the component is done as follows. For every node x, if dist(x, Q) > β then maintain decre- mental shortest path tree from x up to depth β using King's algorithm [34]. Let B(x, β) be all nodes at distance at most β from x. Note that it could be that in the beginning of the algorithm dist(x, Q) ≤ β but at some point dist(x, Q) > β. At the point that dist(x, Q) > β, the algorithm constructs the decremental shortest path tree from x up to depth β. Claim 3.10 Maintaining KIN G − S − L takes O(n2) total update time. tances) relies on all previous eighth components as is done as follows. The ninth and main component, hereafter referred to as KIN G − L (stands for King for light dis- Consider a tree T rooted at s. The following is a key definition: Definition 1 (is not light for (s, T )) We say that v is not light for (s, T ) if one of the following holds: (1) d(v, s, B(T, 1)) ≤ 8β/ǫ and d(v, s, B(T, 1)) ≥ distQ(v, s) − 2 (recall that d(v, s, B(T, 1)) is the minimal distance dist(s, x, T ) + 1 such that x is a neighbor of v in G.); or (2) d(v, s, B(T, 1)) > 8β/ǫ, dist(v, Q) ≥ β and d(v, T ) ≥ dist(v, w) + Heap(∗,1+ǫ) (w,s) /(1 + ǫ) and w /∈ T for some w ∈ B(s, β); or (3) d(v, s, B(T, 1)) > 8β/ǫ and d(v, s, B(T, 1)) ≥ min(Heap(∗,1+ǫ) )/(1 + ǫ). (v,s) For every node s ∈ Si, maintain T (s) decremnetally according to the decremental algorithm of King [34], with the following change. When an edge e is removed from the tree T (s) do the following. Update the tree T (s) according to King's algorithm with the following change. Recall that by King's algorithm operates as follows. Each time an edge (x, y) is deleted, where x is in the same connected component as s in T \ e, an attempt is made to find a substitute edge to y that does not increase the distance from s to y. If such edge is found then the recovery phase is over. In case no such edge found, the best edge is chosen, i.e., the edge that connect y on the shortest path possible. The process is continued recursively on all y's children. Instead we do the following. First find the best edge e that connect y on the shortest path possible. If the path of y does not increase then the recovery phase is over. Otherwise, check if y is not light in (s, T (s)) and if y is not light in (s, T (s)) then do not add y to T (s) and continue recursively on y's children. If it is not the case that y is not light in (s, T (s)) then add y to T (s) using e and continue recursively on y's children. In addition, each time the distance min(Heap(∗,1+ǫ) ) increases we check if y is not light for (s, T (s)), if not then add y to T (s) with the best edge possible. (s,y) The next lemma is crucial to our analysis and its proof is quite subtle. Ideally, we would like that T (s) would contain all nodes v such that their shortest path from s to v does not go through an heavy node. However, since we don't have exact distances we might not add some of these nodes to T (s), in case Heap(1+ǫ) is already a close enough estimation on dist(v, s). The next lemma shows that if v is added to (v,s) T (s) then the distance from v to s in T is a shortest path. 8 By the next lemma we get that if a node is added to T (s) then it's path in T (s) is the shortest. This property is important as otherwise we might need to decrease the distance from u to s in T (s) in the future. Lemma 3.11 If a node u belongs to T (s) for some s ∈ Si then dist(u, s, T (s)) = dist(u, s). The next lemma shows that maintaining KIN G − L takes O(n5/2) total update time. Claim 3.12 Maintaining KIN G − L takes O(n5/2) total update time. Finally, the tenth component, hereafter referred to as P ivots is done as follows. The algorithm main- tains for every node v and index i a close node pi(v) ∈ Si. This can be achieved by storing in a heap Heapi(v) all distances dist(v, s, T (s)) for every node s such that s ∈ Si and v ∈ T (s). Claim 3.13 Maintaining pi(v) for every v ∈ V and 1 ≤ i ≤ log n takes O(n5/2) total update time. Proof: Finally, maintaining for every node v and index i the node pi(v) ∈ Si can be done by storing in a heap Heapi(v) all distances dist(v, s, T (s)) for every node s such that s ∈ Si and v ∈ T (s) for s ∈ Si. It is not hard to verify that this can also be done in O(n2) total time. The query algorithm: The query algorithm given pair of nodes s and t is done as follows. Find the minimal index i such that t ∈ T (pi(s)). Return min{dist(s, pi(s), T (pi(s)))+dist(t, pi(s), T (pi(s))), min(Heap(1) ǫ) min(Heap(1+ǫ) The query algorithm can be implemented in O(log log n) time by invoking a binary search on the indices (s,t) )}. i for 1 ≤ i ≤ log n. Lemma 3.14 Consider nodes u ∈ V and s ∈ Si for some 1 ≤ i ≤ log n. If u /∈ T (s) then (u,s))} ≤ (1 + ǫ)2(dist(u, s) + 2). min{min(Heap(∗,1+ǫ) ), min(Heap(1) (u,s) (s,t)), (1+ Proof: Consider nodes u and s ∈ Si for some 1 ≤ i ≤ log n such that u /∈ T (s). Let T = T (s). Note that u was not added to T since either u is not light for (s, T ) or some other node in P (u, s) is not light for (s, T ). Let y be the first node on P (u, s) that is not light for (s, T ). We need to consider the different cases why y is not light for (s, T ). First we claim that d(y, s, B(T, 1)) = dist(s, y). To see this, let y0 be the node before y on the path P (s, u). Note that u ∈ T . By Lemma 3.11 we have dist(s, y0, T ) = dist(s, y0). Note also that dist(s, y) ≤ d(y, s, B(T, 1)) ≤ dist(s, y0, T ) + 1 = dist(s, y). We get that d(y, s, B(T, 1)) = dist(s, y). The first case is when d(y, s, B(T, 1)) ≤ 8β/ǫ and d(y, s, B(T, 1)) ≥ distQ(y, s) − 2. In this case we have distQ(u, s) ≤ dist(u, y) + distQ(y, s) ≤ dist(u, y) + dist(y, s) + 2 = dist(u, s) + 2. In this case we get min(Heap(1) (u,s)) ≤ distQ(u, s) ≤ dist(u, s) + 2, as required. Consider the second case where d(y, s, B(T, 1)) > 8β/ǫ, dist(y, Q) ≥ β and d(y, s, B(T, 1)) ≥ dist(y, w) + min(Heap(∗,1+ǫ) (w,s) )/(1 + ǫ) and w /∈ T for some w ∈ B(s, β). min(Heap(∗,1+ǫ) (u,s) ) ≤ (1 + ǫ)distQ(u, s) ≤ (1 + ǫ)(dist(u, y) + distQ(y, s)) ≤ (1 + ǫ)(dist(u, y) + dist(y, w) + min(Heap(∗,1+ǫ) (w,s) ) ≤ (1 + ǫ)(dist(u, y) + (1 + ǫ)dist(y, s)) ≤ (1 + ǫ)2dist(u, s). Consider the third case where d(y, s, B(T, 1)) > 8β/ǫ and d(y, s, B(T, 1)) ≥ min(Heap(∗,1+ǫ) (y,s) )/(1 + ǫ). 9 In this case we have min(Heap(∗,1+ǫ) (u,s) ) ≤ (1 + ǫ)distQ(u, s) ≤ (1 + ǫ)(dist(u, y) + distQ(y, s)) ≤ (1 + ǫ)(dist(u, y) + min(Heap(∗,1+ǫ) )) ≤ 1 + ǫ)(dist(u, y) + (1 + ǫ)dist(y, s)) ≤ (1 + ǫ)2dist(u, s). The next lemma shows that the distance returned by the query algorithm is within the desired stretch. (y,s) Lemma 3.15 The distance d(s, t) returned by the query algorithm satisfies dist(s, t) ≤ d(s, t) ≤ (1 + ǫ)O(1)(dist(s, t) + 2). Proof: We first show that dist(s, t) ≤ d(s, t). In order to show this, we show that dist(s, t) ≤ dist(s, pi(s), T (pi(s)))+ dist(t, pi(s), T (pi(s))) and dist(s, t) ≤ (1+ǫ) min(Heap(1+ǫ) and dist(t, pi(s)) = dist(t, pi(s), T (pi(s))). Hence dist(s, t) ≤ dist(s, pi(s))+dist(t, pi(s)) = dist(s, pi(s), T (pi(s)))+ dist(t, pi(s), T (pi(s))). ǫ) min(Heap(1+ǫ) (s,t) ). In addition, by Lemma 3.7 we have dist(s, t) ≤ heavy dist(s, t) ≤ (1 + (s,t) ). Note that dist(s, pi(s)) = dist(s, pi(s), T (pi(s))) We are left with showing the second direction, namely, d(s, t) ≤ (1 + ǫ)c(dist(s, t) + 2). Let P (s, t) be the shortest path from s to t. Let j be the index such that 2j ≤ dist(s, t) ≤ 2j+1. By Lemma 3.3(2), Sj contains a node z in P (s, t) at distance at most ǫ2j from s. If T (z) does not contain s then by Lemma 3.14, we have Heap∗Q(s, z) ≤ (1 + ǫ)2dist(s, z). We get that (s,t) ) ≤ (1 + ǫ)3dist(s, z). So assume that T (z) contains s. It follows from the definition of the pivot that dist(s, pj(s), T (pj(s))) ≤ Let vj = pj(s). If T (vj) contains t then we have dist(s, vj, T (vj)) + dist(t, vj, T (vj)) = dist(s, vj) + (s,z) ) ≤ Heap∗Q(s, z) ≤ (1 + ǫ)2dist(s, z). Hence (1 + ǫ) min(Heap(1+ǫ) min(Heap(1+ǫ) ǫ2j. dist(t, vj ) ≤ ǫ2j + ǫ2j + dist(s, t) = (1 + 2ǫ)dist(s, t). means that distQ(t, vj) ≤ Heap∗Q(t, vj) ≤ (1 + ǫ)2dist(t, vj ). Heap∗Q(t, vj). If T (vj) does not contain t then by Lemma 3.14, we have Heap∗Q(t, vj ) ≤ (1 + ǫ)2dist(t, vj). This Let q ∈ Q be the node that obtains Heap∗Q(t, vj ), namely, the node q such that Heap∗q(t, vj) = We get that min(Heap(1+ǫ) (s,t) [q] ≤ (1+ǫ)(distq(s, t)) ≤ (1+ǫ)(dist(s, vj)+distq(t, vj)) ≤ (1 + ǫ)(ǫ2j + (1 + ǫ)2dist(t, vj)) ≤ (1 + ǫ)(ǫ2j + (1 + ǫ)2(ǫ2j + dist(s, t))) ≤ (1 + ǫ)(ǫ2j + (1 + ǫ)2(ǫ2j + dist(s, t))) ≤ (1 + ǫ)5dist(s, t) (s,t) ) ≤ Heap(1+ǫ) 3.1 Reducing the Query Time to O(1) We now explain how to reduce the query time to O(1). To get an initial estimation, we use the decremental algorithm of Bernstein and Roditty [10] with parameter k = 2 (choosing any constant parameter k ≥ 2 is sufficient for our needs). This algorithm has a total update time of O(n5/2) and can return a distance estimation within a stretch 3. We can now use the rough estimation to find the minimal index i such that t ∈ T (pi(s)). It is not hard to verify that there are only O(1) potential indices to check. References [1] I. Abraham, S. Chechik, C. Gavoille and D. Peleg. Forbidden-set distance labels for graphs of bounded doubling dimension. 29th ACM Symp. on Principles of Distributed Computing (PODC), 192 -- 200, 2010. 10 [2] I. Abraham, S. Chechik, and C. Gavoille. Fully dynamic approximate distance oracles for planar graphs via forbidden-set distance labels. 44th Annual ACM Symposium on The- ory of Computing (STOC), 1199 -- 1218, 2012. [3] G. Ausiello, G. F. Italiano, A. Marchetti-Spaccamela, and U. Nanni. Incremental algorithms for mini- mal length paths. J. Algorithms, 12(4), 615 -- 638, 1991. [4] S. Baswana, R. Hariharan, and S. Sen. Improved decremental algorithms for transitive closure and all-pairs shortest paths. In 34th ACM Symp. on Theory of Computing (STOC), 117 -- 123, 2002. [5] S. Baswana, R. Hariharan, and S. Sen. Maintaining all-pairs approximate shortest paths under deletion of edges. In 14th ACM Symp. on Discrete Algorithms (SODA), 394 -- 403, 2003. [6] S. Baswana, U. Lath, and A. S. Mehta. Single source distance oracle for planar digraphs avoiding a failed node or link. In 23rd ACM Symp. on Discrete Algorithms (SODA), 223-232, 2012. [7] A. Bernstein. Fully dynamic approximate all-pairs shortest paths with query and close to linear update time. In 50th IEEE Symp. on Foundations of Computer Science (FOCS), 50 -- 60, 2009. [8] A. Bernstein. Maintaining shortest paths under deletions in weighted directed graphs. In 45th Annual ACM Symposium on Theory of Computing (STOC), 725 -- 734, 2012. [9] A. Bernstein and D. Karger. A nearly optimal oracle for avoiding failed vertices and edges. In 41st ACM Symp. on Theory of Computing (STOC), 101 -- 110, 2009. [10] A. Bernstein, L. Roditty. Improved dynamic algorithms for maintaining approximate shortest paths under deletions. In 22nd ACM Symp. on Discrete Algorithms (SODA), 1355 -- 1365, 2011. [11] S. Chechik. Fault-tolerant compact routing schemes for general graphs. In 38th Int'l Coll. on Automata, Languages and Programming (ICALP), 101 -- 112, 2011. [12] S. Chechik, M. Langberg, D. Peleg, and L. Roditty. f -sensitivity distance oracles and routing schemes. In Proc. 18th European Symposium on Algorithms (ESA),84 -- 96, 2010. [13] B. Courcelle and D. A. Twigg. Compact forbidden-set routing. In 24th Symp. on Theoretical Aspects of Computer Science (STACS), 37 -- 48, 2007. [14] B. Courcelle and D. A. Twigg. Constrained-path labellings on graphs of bounded clique-width. Theory of Computing Systems, 47, 531 -- 567, 2010. [15] C. Demetrescu and G. F. Italiano. A new approach to dynamic all pairs shortest paths. J. of the ACM, 51, 2004. [16] C. Demetrescu and G. F. Italiano. Fully dynamic all pairs shortest paths with real edge weights. J. of Computer and System Sciences, 72(5), 813 -- 837, 2006. Special issue of FOCS '01. [17] C. Demetrescu and M. Thorup. Oracles for distances avoiding a link-failure. In 13th ACM Symp. on Discrete Algorithms (SODA), 838 -- 843, 2002. [18] Y. Dinitz. Dinitz' algorithm: The original version and Even's version. In Essays in Memory of Shimon Even, 218 -- 240, 2006 11 [19] R. Duan and S. Pettie. Dual-failure distance and connectivity oracles. In 20nd ACM Symp. on Discrete Algorithms (SODA), 506 -- 515, 2009. [20] R. Duan and S. Pettie. Connectivity oracles for failure prone graphs. In Proc. 42nd ACM Symp. on Theory of Computing (STOC), 465 -- 474, 2010. [21] D. Eppstein. Dynamic generators of topologically embedded graphs. In 14th ACM Symp. on Discrete Algorithms (SODA), 599 -- 608, 2003. [22] D. Eppstein, Z. Galil, G. F. Italiano, and A. Nissenzweig. Sparsification-a technique for speeding up dynamic graph algorithms In 33rd IEEE Symp. on Foundations of Computer Science (FOCS), 60 -- 69, 1992. [23] D. Eppstein, Z. Galil, G. F. Italiano, and A. Nissenzweig. Sparsification - a technique for speeding up dynamic graph algorithms. In J. ACM, 44(5):669 -- 696, 1997. [24] S. Even and Y. Shiloach. An on-line edge deletion problem. J. ACM, 28(1):1 -- 4, 1981. [25] P. Fraigniaud and C. Gavoille. Routing in Trees. In 28th Int'l Coll. on Automata, Languages and Programming (ICALP), 757 -- 772, 2001. [26] G. N. Frederickson. Data structures for on-line updating of minimum spanning trees, with applications. In SIAM Journal on Computing, 14(4):781 -- 798, 1985. [27] M. R. Henzinger and V. King. Fully dynamic biconnectivity and transitive closure. In 36th IEEE Symp. on Foundations of Computer Science (FOCS), 664 -- 72, 1995. [28] M. R. Henzinger and V. King. Randomized fully dynamic graph algorithms with polylogarithmic time per operation. J. ACM, 46(4):502 -- 516, 1999. [29] M. R. Henzinger and V. King. Maintaining Minimum Spanning Forests in Dynamic Graphs. SIAM J. Computing, 31(2), 364 -- 374, 2001. [30] M. R. Henzinger and M. Thorup. Sampling to provide or to bound: With applications to fully dynamic graph algorithms. Random Struct. Algorithms, 11(4):369 -- 379, 1997. [31] J. Holm, K. Lichtenberg, and M. Thorup. Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity. J. ACM, 48(4):723 -- 760, 2001. [32] K. Kawarabayashi, P. N. Klein, and C. Sommer. Linear-space approximate distance oracles for planar, bounded-genus, and minor-free graphs. In 38th Int'l Coll. on Automata, Languages and Programming (ICALP), 135 -- 146, 2011. 12 [33] N. Khanna and S. Baswana. Approximate shortest path oracle under vertex failure. In 26th Symp. on Theoretical Aspects of Computer Science (STACS), 513 -- 524, 2010. [34] V. King. Fully dynamic algorithms for maintaining all-pairs shortest paths and transitive closure in digraphs. In 40th IEEE Symp. on Foundations of Computer Science (FOCS), 81 -- 91, 1999. [35] P. Klein, and S. Subramanian. A fully dynamic approximation scheme for shortest path problems in planar graphs. Algorithmica 23, 235 -- 249, 1998. [36] P. Klein. Preprocessing an undirected planar network to enable fast approximate distance queries. In 13th ACM Symp. on Discrete Algorithms (SODA), 820 -- 827, 2002. [37] V. King and M. Thorup. A space saving trick for directed dynamic transitive closure and shortest path algorithms. In Jie Wang, editor, COCOON, volume 2108 of Lecture Notes in Computer Science, 268 -- 277, 2001. [38] R. Lipton, and R. Tarjan. A separator theorem for planar graphs. SIAM J. Appl. Math. 36, 177 -- 189, 1979. [39] B.M. Kapron. V. King, and B. Mountjoy. Dynamic graph connectivity in polylogarithmic worst case time. In 24th ACM Symp. on Discrete Algorithms (SODA), 2013. [40] M. Patras¸cu and E. D. Demaine. Lower bounds for dynamic connectivity. In 36th ACM Symp. on Theory of Computing (STOC), 546 -- 553, 2004. [41] M. Patras¸cu and M. Thorup. Planning for fast connectivity updates. In 48th IEEE Symp. on Founda- tions of Computer Science (FOCS), 263 -- 271, 2007. [42] A. Shoshan and U. Zwick. All Pairs Shortest Paths in Undirected Graphs with Integer Weights. In 40th IEEE Symp. on Foundations of Computer Science (FOCS), 605 -- 615, 1999. [43] M. Thorup. Near-optimal fully-dynamic graph connectivity. In 32nd ACM Symp. on Theory of Com- puting (STOC), 343 -- 350, 2000. [44] M. Thorup. Compact oracles for reachability and approximate distances in planar digraphs. In 42nd IEEE Symp. on Foundations of Computer Science (FOCS), 242 -- 251, 2001. [45] M. Thorup. Compact oracles for reachability and approximate distances in planar digraphs. J. of the ACM 51(6), 993 -- 1024, 2004. [46] M. Thorup. Fully-dynamic all-pairs shortest paths: faster and allowing negative cycles. In 9th Scandi- navian Workshop on Algorithm Theory (SWAT), 384 -- 396, 2004. [47] M. Thorup. Worst-case update times for fully-dynamic all-pairs shortest paths. In 37th ACM Symp. on Theory of Computing (STOC), 112 -- 119, 2005. [48] M. Thorup and U. Zwick. Compact routing schemes. In 13th ACM Symp. on Parallel Algorithms and Architectures (SPAA), 1 -- 10, 2001. [49] M. Thorup and U. Zwick. Approximate distance oracles. In Journal of the ACM, pages 1-24, 2005. 13 [50] L. Roditty and U. Zwick. Dynamic approximate all-pairs shortest paths in undirected graphs. In 45th IEEE Symp. on Foundations of Computer Science (FOCS), 499 -- 508, 2004. [51] L. Roditty and U. Zwick. Dynamic Approximate All-Pairs Shortest Paths in Undirected Graphs. SIAM J. Comput. 41(3): 670 -- 683, 2012. [52] L. Roditty and U. Zwick. On dynamic shortest paths problems. In Proc. 18th European Symposium on Algorithms (ESA), 580 -- 591, 2004. [53] V. Vassilevska Williams. Multiplying matrices faster than coppersmith-winograd In 44th Annual ACM Symposium on Theory of Computing (STOC), 887 -- 898, 2012. A Missing proofs Proof of Lemma 2.3: dist(x, z, H) + dist(y, z, H) ≤ (1 + ǫ/2)dist(x, z) + ζ + (1 + ǫ/2)dist(y, z) + ζ = (1 + ǫ/2)(dist(x, z) + dist(y, z)) + 2ζ ≤ (1 + ǫ/2)(2β + dist(x, y)) + 2ζ ≤ (1 + ǫ/2)dist(x, y)) + 2ζ + 2β(1 + ǫ/2) = (1 + ǫ/2)dist(x, y) + ǫβ + 2β(1 + ǫ/2) = (1 + ǫ/2)dist(x, y) + 2β + 2ǫβ ≤ (1 + ǫ/2)dist(x, y) + 4β ≤ (1 + ǫ/2)dist(x, y) + ǫ/2dist(x, y) = (1 + ǫ)dist(x, y). Proof of Lemma 3.3: Consider a fixed graph G′. We show that each event (1)-(3) happens with probability at least 1 − 1/nc−1. The lemma then follows by union bound on all three event. To see event (1): consider a node v, the probability that Γ(v) ∩ Q = ∅ is Pr[Γ(v) ∩ Q = ∅] ≤ (1−c ln n/n1/2)n1/2 ≤ (1/e)c ln n = 1/nc. By Union Bound on all heavy nodes we get that with probability 1/nc−1 the Lemma holds. To see event (2): consider a node v and index i such that there exists a node z such that dist(v, z, G′) ≥ ǫ2i. Note that there are at least ǫ2i nodes at distance at most ǫ2i from v, namely, B(v, ǫ2i, G′) ≥ ǫ2i. The probability that none of the nodes in B(v, ǫ2i, G′) was selected to Si is (1− c ln n/(ǫ2i))ǫ2i < n−c. By Union Bound on all nodes we get that with probability 1/nc−1 the Lemma holds. To see event (3): consider a node v such that B(v, β) ≥ n1/2, the probability that Q∩ B(v, β, G′) 6= ∅ By Union Bound on all heavy nodes we get that with probability 1 − 3/nc−1 properties (1) − (3) hold The random sets Q and Si are independent of the graph, the failure probability needs to be multiply by the number of considered graphs during the entire running of the algorithm. Note that as there are m ≤ n2 deletions, and thus at most n2 different versions of the graph. By the union bound on all considered graphs the lemma follows. Proof of Claim 3.6: By Claim 3.1 the expected size of Q is O(n1/2). For every toe nodes x, y ∈ V and node q ∈ Q. The distances dist(q, x) or dist(q, y) can be increased at most 8β/ǫ times before exceeding 8β/ǫ. Hence Heap(1) (x,y)[q] is updated at most O(β/ǫ) = O(1) time. Therefore for all nodes q ∈ Q updating Heap(1) Proof of Lemma 3.7: Let Pheavy(x, y) be the the shortest path from x to y that goes through some heavy node z. Recall that by Lemma 3.3(1) w.h.p. we have that Q ∩ Γ(z) 6= ∅. Let z1 ∈ Q ∩ Γ(z). Note that distz1(x, y) ≤ distz(x, y) + 2 = heavy dist(x, y) + 2 = dist(x, z) + dist(z, y) + 2. is Pr[Q ∩ B(v, β, G′) 6= ∅] ≤ (1 − c ln n/n1/2)n1/2 ≤ (1/e)c ln n = 1/nc. for G′. (x,y) takes O(n1/2) total time. Hence for all pairs x, y ∈ V updating H1 takes O(n5/2) total time. Let z2 ∈ Q be the node such that Heap(1+ǫ) (x,y) [z2] = min(Heap(1+ǫ) (x,y) ). 14 We claim that distBR z2 (x, y) ≤ (1 + ǫ)Heap(1+ǫ) (x,y) [z2]. To see this, recall that Heap(1+ǫ) (x,y) [z2] is updated when either distBR(z2, x) or distBR(z2, y) increases by a factor of 1 + ǫ. z2 (x, y) ≤ Heap(1+ǫ) (x,y)). To see this recall that either min(Heap(1) We get that dist(x, y) ≤ distz2(x, y) ≤ distBR dist(x, y) ≤ min(Heap(1) min(Heap(1) (x,y) [z2](1 + ǫ). In addition, note that (x,y)) = distQ(x, y) ≥ dist(x, y) or (x,y)) = (x,y)) = ∞. It follows that dist(x, y) ≤ d(x, y). distQ(x, y) = heavy dist(x, y) + 2. We left to show the other direction, namely, d(x, y) ≤ (1 + ǫ)2(heavy dist(x, y) + 2). If distQ(x, y) ≤ 8β/ǫ then recall that min(Heap(1) Otherwise, d(x, y) ≤ Heap(1+ǫ) (1 + ǫ)2(heavy dist(x, y) + 2). Proof of Lemma 3.8: Consider nodes x ∈ V and q ∈ Q. Note that the value dlast(x, q) can change at most log n times. Each time the value dlast(x, q) changes, all heap Heap(1+ǫ) (x,y) are updated. Updating a single heap takes O(1) time. As there are n such heaps Heap(1+ǫ) (x,y))) = distQ(x, y). Hence d(x, y) ≤ min(Heap(1) (x,y) [z1](1 + ǫ) ≤ (1 + ǫ)(1 + ǫ)distz1(x, y) ≤ (x,y) [z2](1 + ǫ) ≤ Heap(1+ǫ) (x,y) , updating all heaps takes (n) time. By Claim 3.1 the expected size of Q is O(n1/2). We get that the total update time for updating Heap(1+ǫ) (x,y) for all y ∈ V as a result of a change of dlast(x, q) for some q ∈ Q is O(n3/2). (x,y) is O(n5/2). Therefore, the total time for maintaining all heaps Heap(1+ǫ) (x,y) (x,y) (x,y) Proof of Lemma 3.9: Consider pair of nodes x ∈ V , y ∈ Si for some 1 ≤ i ≤ log n. Maintaining Heap(∗,1+ǫ) takes O(2in1/2) total time. To see this, note that Heap∗q(x, y) for some q ∈ Q is updated every time distBR(q, x) or distBR(q, y) increases until one of them becomes larger than 2i. This could happen at most 2i times. We get that maintaining Heap(∗,1+ǫ) takes O(2in1/2) total time. There are O(n/2i) expected number of nodes in Si. Thus maintaining all heaps Heap(∗,1+ǫ) for some nodes x ∈ V , y ∈ Si takes O(n · n/2i · 2in1/2) = O(n5/2). There are log n indices i, therefore maintaining all heap Heap(∗,1+ǫ) takes O(n5/2). Proof of Lemma 3.10: By Lemma 3.3(3) for every node v such that B(v, β) ≥ n1/2, Q∩B(v, β, G) 6= ∅. In other words, if dist(v, Q) > β then B(v, β) < n1/2. Note also that the degree of the nodes in B(v, β−1) is O(n1/2) as B(v, β) < n1/2. Thus maintaining the distances from v to all nodes in B(v, β) using King's algorithm [34] takes O(βn1/2 · n1/2) = O(n2). Thus maintaining all B(v, β) for all nodes v such that dist(v, Q) > β takes O(n2) total time. Proof of Lemma 3.11: It is not hard to verify that the distances in T (s) are the distances in the induced graph on V (T (s)). Therefore, we need to show that if v ∈ T (S) then P (v, s) ⊆ T (s). Or in other words, if there exists a node x ∈ P (v, s) such that x /∈ T (s) then v is not light for (s, T (s)). Let x be the first node on the path P (v, s) such that x /∈ T (s). Namely, x is not light for (s, T (s)). We need to consider the different cases why x is not light for (s, T (s)) and show that in each such case v is not light for (s, T (s)) as well. (x,y) Case (1) is when dist(x, s) ≤ 8β/ǫ and dist(x, s) ≥ distQ(x, s) − 2. Case (2) is when dist(x, s) > )/(1 + ǫ) and w /∈ T for some 8β/ǫ, dist(x, Q) > 8β/ǫ and dist(x, s) ≥ dist(x, w) + min(Heap(∗,1+ǫ) w ∈ B(x, β). Case (3) is when dist(x, s) > 8β/ǫ and dist(x, s) ≥ min(Heap(∗,1+ǫ) Let H be the emulator in the construction of Bernstein and Roditty [10]. For a node q ∈ Q, let Hq be )/(1 + ǫ). (w,s) (x,s) 15 the graph H when Heap(1+ǫ) (v,s) [q] was last updated. We now turn to the first case where dist(x, s) ≤ 8β/ǫ and dist(x, s) ≥ distQ(x, s) − 2. We consider two subcases, the first subcase (1.1) is when dist(v, s) ≤ 8β/ǫ and the second subcase (1.2) is when dist(v, s) > 8β/ǫ. In both subcases we have dist(v, s) = dist(v, x) + dist(x, s) ≤ distQ(v, s) + 2. Let q ∈ Q be the node such that distq(v, s) = distQ(v, s). In case (1.1) since dist(v, s) ≤ distQ(v, s) + 2 and dist(v, s) ≤ 8β/ǫ then v is not light for (s, T ) due to check (1). In case (1.2), we have min(Heap(∗,1+ǫ) ) ≤ distq(v, s, Hq) ≤ dist(v, x, Hq) + dist(x, q, Hq) + dist(q, s, Hq) ≤ (1 + ǫ/2)dist(v, x) + ζ + (1 + ǫ/2)dist(x, q) + ζ + (1 + ǫ/2)dist(q, s) + ζ ≤ (1 + ǫ/2)dist(v, s) + (1 + ǫ/2)2 + 3ζ < (1 + ǫ)dist(v, s). So v does not pass check (3). Consider case (2) where dist(x, s) > 8β/ǫ, dist(x, Q) ≥ β and dist(x, s) ≥ dist(x, w)+min(Heap(∗,1+ǫ) If v has a node q in Q at distance β from it then by Lemma 2.3 we get that min(Heap(∗,1+ǫ) ǫ) and w /∈ T for some w ∈ B(x, β). (w,s) (v,s) (v,s) ) ≤ Heap(∗,1+ǫ) (v,s) [q] = distq(v, s, Hq) ≤ (1 + ǫ)dist(v, s). We get that v does not pass test (3). So assume that dist(v, Q) > β. Let q ∈ Q be the node that Heap(∗,1+ǫ) ). Note that dist(v, q) > β. We have distq(v, s, Hq) ≤ dist(v, w, Hq) + distq(w, s, Hq) ≤ (1 + ǫ)(dist(v, x) + dist(x, w)) + min(Heap(∗,1+ǫ) ) ≤ (1 + ǫ)dist(v, x) + (1 + ǫ)dist(x, s) = (1 + ǫ)dist(v, s). It follows that v does not pass test (3) )/(1 + ǫ). If v has a node q in Q at distance β from it then similar to the analysis in previous case we can show that v does not pass test (3). So assume that dist(v, Q) > β. The last case is when dist(x, s) > 8β/ǫ and dist(x, s) > min(Heap(∗,1+ǫ) [q] = min(Heap(∗,1+ǫ) (w,s) (w,s) (w,s) (x,s) )/(1+ (v,s) dist(v, s). Hence, v does not pass test (2). If dist(v, x) ≤ β then we get that dist(v, x) + min(Heap(∗,1+ǫ) Assume dist(v, x) > β. In this case, min(Heap(∗,1+ǫ) (x,s) )/(1 + ǫ) ≤ dist(v, x) + dist(x, s) = ) = dist(v, s, H) ≤ dist(v, x, H)+dist(x, s, H) ≤ (1 + ǫ)dist(v, x) + (1 + ǫ)dist(x, s) = (1 + ǫ)dist(v, s). It follows that v does not pass test (3). Proof of Lemma 3.12: We claim that for a node v ∈ V , checking if v is not light for (s, T (s)) takes O(n1/2) time in expectation. First note that check (1) and (3) can be done in constant time. In addition, note that if v is heavy then automatically it is not light for (s, T (s′)) for any tree T (s′) for some s′ ∈ Sj for 1 ≤ j ≤ log n. To see this, recall that by Lemma 3.3 if is heavy then Γ(v) ∩ Q 6= ∅. Let q ∈ Γ(v) ∩ Q. If d(v, s, B(T, 1)) ≤ 8β/ǫ then note that distQ(v, s) ≤ distq(v, s) ≤ dist(v, s) + 2 and thus v is not light for (s, T ) due to test (1). If d(v, s, B(T, 1)) > 8β/ǫ then straight forward calculations show that d(v, s, B(T, 1)) ≥ dist(v, s) ≥ Heap∗Q(v, s)/(1 + ǫ). Thus v is not light for (s, T ) due to test (3). It follows that in case v is heavy it does not pass the property check of (s, T (s)). By Lemma 3.3(3) if dist(v, Q) ≥ β then B(v, β) ≥ n1/2. Thus checking if d(v, s, B(T, 1)) ≥ dist(v, w) + Heap∗(w, s)/(1 + ǫ) for some w ∈ B(s, β) takes O(n1/2) time. We claim that for the tree T (s), the algorithm invokes O(2i) the check if v is not light for (s, T (s)). To see this, note that the check if v is not light for (s, T (s)) is invoked when either the distance dist(v, s, T (s)) increases or when the distance the distance Heap∗Q(s, v) increases. Since we maintain the distances dist(v, s, T (s)) and Heap∗Q(s, v) up to depth 2i(1 + ǫ), we get that these may increase at most O(2i) times. In addition, the algorithm go over the edges of v at most 2i times since each time the algorithm go over v's edges then the distance dist(v, s) increases. As mentioned before, T (s) contains only light nodes as all heavy nodes are not light for (s, T (s)). Hence maintaining T (s) takes O(nn1/22i) = O(n3/22i). In expectation there 16 are O(n/2i) nodes in Si, thus maintaining all trees T (s) for all nodes s ∈ Si takes O(n5/2) time. There are log n indices i, therefore maintaining all trees T (s) for all nodes in Sj for some 1 ≤ j ≤ log n takes O(n5/2) total time. 17
1908.07076
1
1908
2019-08-19T21:29:04
Improved Job sequencing Bounds from Decision Diagrams
[ "cs.DS" ]
We introduce a general method for relaxing decision diagrams that allows one to bound job sequencing problems by solving a Lagrangian dual problem on a relaxed diagram. We also provide guidelines for identifying problems for which this approach can result in useful bounds. These same guidelines can be applied to bounding deterministic dynamic programming problems in general, since decision diagrams rely on DP formulations. Computational tests show that \mbox{Lagrangian} relaxation on a decision diagram can yield very tight bounds for certain classes of hard job sequencing problems. For example, it proves for the first time that the best known solutions for Biskup-Feldman instances are within a small fraction of 1% of the optimal value, and sometimes optimal.
cs.DS
cs
Improved Job Sequencing Bounds from Decision Diagrams J. N. Hooker Carnegie Mellon University [email protected] Abstract. We introduce a general method for relaxing decision dia- grams that allows one to bound job sequencing problems by solving a Lagrangian dual problem on a relaxed diagram. We also provide guide- lines for identifying problems for which this approach can result in useful bounds. These same guidelines can be applied to bounding deterministic dynamic programming problems in general, since decision diagrams rely on DP formulations. Computational tests show that Lagrangian relax- ation on a decision diagram can yield very tight bounds for certain classes of hard job sequencing problems. For example, it proves for the first time that the best known solutions for Biskup-Feldman instances are within a small fraction of 1% of the optimal value, and sometimes optimal. 1 Introduction In recent years, binary and multivalued decision diagrams (DDs) have emerged as a useful tool for solving discrete optimization problems [5,6,24]. A key factor in their success has been the development of relaxed DDs, which represent a superset of the feasible solutions of a problem and provide a bound on its optimal value. While an exact DD representation of a problem tends to grow exponentially with the size of the problem instance, a relaxed DD can be much more compact when properly constructed. The tightness of the relaxation can be controlled by adjusting the maximum allowed width of the DD. Relaxed DDs are normally used in conjunction with a branching procedure [5,12], much as is the linear programming (LP) relaxation in an integer program- ming solver. As branching proceeds, the relaxed diagram provides a progressively tighter bound. However, combinatorial problems are often solved with heuristic methods that do not involve branching. This is true, in particular, of job sequenc- ing problems. In such cases it is very useful to have an independently derived lower bound that can provide an indication of the quality of the solution. Recent research [20] has found that a relaxed DD can yield good bounds for hard job sequencing problems without branching. In fact, a surprisingly small relaxed DD, generally less than 10% the width of an exact DD, can yield a bound equal to the optimal value. On the other hand, since exact DDs grow rapidly with the instance size, relaxed DDs that are 10% of their width likewise grow rapidly. As a result, relaxed DDs of reasonable width tend to provide progressively weaker bounds as the instances scale up. It is suggested in [20] that Lagrangian relaxation could help strengthen the bounds obtained from smaller relaxed DDs. In this paper, we propose a general technique for relaxing a DD while preserving the ability to obtain Lagrangian bounds from the DD. The relaxed DD is constructed by merging nodes only when they agree on certain state variables that are crucial to forming the Lagrangian relaxation. We find that for certain types of job sequencing problems, Lagrangian re- laxation in relaxed DDs of reasonable width can provide very tight bounds on the optimal value. For example, we prove for the first time that the best known solution values of Biskup-Feldman single-machine scheduling instances are within a small fraction of one percent of the optimum, and sometimes optimal. Furthermore, we identify general conditions under which Lagrangian relax- ation can be implemented in a relaxed DD for purposes of obtaining bounds. The conditions are expressed in terms of structural characteristics of the dynamic pro- gramming model that defines the DD. They lead to a new tool for bounding not only job sequencing problems with suitable structure, but general deterministic dynamic programming models that satisfy the conditions. 2 Previous Work Decision diagrams were introduced as an optimization method by [15,18]. The idea of a relaxed diagram first appears in [1] as a means of enhancing propagation in constraint programming. Relaxed DDs were first used to obtain optimization bounds in [4,7]. Connections between DDs and deterministic dynamic program- ming are discussed in [19]. Bergman, Cir´e and van Hoeve first applied Lagrangian relaxation to decision diagrams in [3], where they use it successfully to strengthen bounds for the trav- eling salesman problem with time windows. They also use Lagrangian relaxation and DDs in [2] to improve constraint propagation. We advance beyond Bergman et al. [3] in two ways. First, we show how to obtain bounds on tardiness and a variety of other objective functions from a stand-alone relaxed DD. The DD in [3] represents only an all-different constraint and can provide bounds only on total travel time (without taking time windows into account). The DD is embedded in a constraint programming (CP) model that contains the time window constraints. While constraints could be added to the CP model to obtain tardiness and other kinds of bounds from the CP solver, the DD itself cannot provide them. One or more additional state variables are necessary, which results in a more complicated DD than the one used in [3]. Our contribution is to define a new node merger scheme that relaxes such a DD while allowing Lagrangian relaxation to be applied. Our second contribution is to analyze, in general, when and how Lagrangian relaxation can be combined with DDs. We introduce the concepts of an exact state and an immediate penalty function and use these concepts to formulate sufficient conditions for implementing Lagrangian relaxation in a relaxed DD. This leads to a general method for bounding dynamic programming models that satisfy the conditions. We find that while the method generates impracticably large relaxed DDs for the job sequencing problems in [3] and [20], it is quite practical for several important types of job sequencing problems. 3 Decision Diagrams For our purposes, a decision diagram can be defined as a directed, acyclic multigraph in which the nodes are partitioned into layers. Each arc of the graph is directed from a node in layer i to a node in layer i + 1 for some i ∈ {1, . . . , n}. Layers 1 and n + 1 contain a single node, namely the root r and the terminus t, respectively. Each layer i is associated with a finite-domain variable xi ∈ Di. The arcs leaving any node in layer i have distinct labels in Di, representing possible values of xi at that node. A path from r to t defines an assignment to the tuple x = (x1, . . . , xn) as indicated by the arc labels on the path. The decision diagram is weighted if there is a length (cost) associated with each arc. Any discrete optimization problem with finite-domain variables can be repre- sented by a weighted decision diagram. The diagram is constructed so that its r -- t paths correspond to the feasible solutions of the problem, and the length (cost) of any r -- t path is the objective function value of the corresponding solution. If the objective is to minimize, the optimal value is the length of a shortest r -- t path. Many different diagrams can represent the same problem, but for a given variable ordering, there is a unique reduced diagram that represents it [10,19]. As an example, consider a job sequencing problem with time windows. Each job j begins processing no earlier than the release time rj and requires processing time pj. The objective is to minimize total tardiness, where the tardiness of job j is max{0, sj + pj − dj}, and dj is the job's due date. Figure 1 shows a reduced decision diagram for a problem instance with (r1, r2, r3) = (0, 1, 1), (p1, p2, p3) = (3, 2, 2), and (d1, d2, d3) = (5, 3, 5). Variable xi represents the ith job in the sequence, and arc costs appear in parentheses. 4 Dynamic Programming Models Decicision diagrams most naturally represent problems with a dynamic program- ming formulation, because in this case a simple top-down compilation procedure yields a DD that represents the problem. A general dynamic programming formulation can be written (cid:110) hi(Si) = min xi∈Xi(Si) ci(Si, xi) + hi+1 (cid:0)φi(Si, xi)(cid:1)(cid:111) (1) Here, Si is the state in stage i of the recursion. Typically the state is a tuple Si = (Si1, . . . , Sik) of state variables. Also Xi(Si) is the set of possible controls (values of xi) in state Si, φi is the transition function in stage i, and ci(Si, xi) is the immediate cost of control xi in state Si. We assume there is single initial state S1 and a single final state Sn+1, so that hn+1(Sn+1) = 0 and φn(Sn, xn) = Sn+1 Fig. 1. Decision diagram for a small job sequencing instance, with arc labels and costs shown. States and minimum costs-to-go are indicated at nodes. for all states Sn and controls xn ∈ Xn(Sn). The quantity hi(Si) is the cost-to-go for state Si in stage i, and an optimal solution has value h1(S1). In the job sequencing problem, the state Si is the tuple (Vi, ti), where state variable Vi is the set of jobs scheduled so far, and state variable ti is the finish time of the last job scheduled. Thus the initial state is S1 = (∅, 0), and Xi(Si) is {1, . . . , n} \ Vi. The transition function φi(Si, xi) is given by φi (cid:0)(Vi, ti), xi (cid:0)(Vi, ti), xi ci (cid:1) (cid:1) =(cid:0)Vi ∪ {xi}, max{rxi, ti} + pxi (cid:17)+ (cid:16) (cid:1) = max{rxi, ti} + pxi − dxi The immediate cost is the tardiness that results from scheduling job xi in state (Vi, ti). Thus if α+ = max{0, α}, we have (2) We recursively construct a decision diagram D for the problem by associating a state with each node of D. The initial state S1 is associated with the root node t and the final state Sn+1 with the terminal node t. If state Si is associated with node u in layer i, then for each vi ∈ Xj(Si) we generate an arc with label vi leaving u. The arc terminates at a node associated with state φi(Si, vi). Nodes on a given layer are identified when they are associated with the same state. The process is illustrated for the job sequencing example in Fig. 1. Each node is labeled by its state (Vi, ti), followed (in parentheses) by the minimum cost-to-go at the node. The cost-to-go at the terminus t is zero. 5 Relaxed Decision Diagrams A weighted decision diagram D(cid:48) is a relaxation of diagram D when D(cid:48) represents every solution in D with equal or smaller cost, and perhaps other solutions x1x2x3r{}0(4){1}3(4){2}3(4){3}3(6)1(0)2(0)3(0){12}5(2){13}5(4){12}6(3){23}5(4){13}6(5)2(2)3(0)1(2)3(0)2(2)1(2)t3(2)2(4)3(3)1(4)2(5) as well. To make this more precise, suppose layers 1, . . . , n of both D and D(cid:48) correspond to variables x1, . . . , xn with domains X1, . . . , Xn. Then D(cid:48) is a relaxation of D if every assignment to x represented by an r -- t path P in D is represented by an r -- t path in D(cid:48) with length no greater than that of P . The shortest path length in D(cid:48) is a lower bound on the optimal value of the problem represented by D. We will refer to a diagram that has not been relaxed as exact. We can construct a relaxed decision diagram in top-down compilation by merging some nodes that are associated with different states. The object is to limit the width of the diagram (the maximum number of nodes in a layer). When we merge nodes with states S and T , we associate a state S ⊕ T with the resulting node. The operator ⊕ is chosen so as to yield a valid relaxation of the given recursion. The job sequencing problem discussed above uses a relaxation operator i , t(cid:48) (Vi, ti) ⊕ (V (cid:48) i) = (Vi ∩ V (cid:48) i , min{ti, t(cid:48) i}) Vi is now the set of jobs scheduled along all paths to the current node, and ti is the earliest finish time of the last scheduled jobs along these paths. The operator is illustrated in Fig. 2, which is the result of merging states ({1, 2}, 6) and ({2, 3}, 5) in layer 3 of Fig. 1. The relaxed states (V, f ) are shown at each node, followed by the minimum cost-to-go in parentheses. The shortest path now has cost 2, which is a lower bound on the optimal cost of 4 in Fig. 1. diagram are developed in [20]. A state S(cid:48) controls in state Si are feasible in state S(cid:48) given feasible control in Si is no less than its immediate cost in S(cid:48) Xi(Si) ⊆ Xi(S(cid:48) Sufficient conditions under which node merger results in a relaxed decision i relaxes a state Si when (a) all feasible i, and (b) the immediate cost of any i. That is, i), and ci(Si, xi) ≥ ci(S(cid:48) i, xi) for all xi ∈ Xi(Si). Fig. 2. A relaxation of the decision diagram in Fig. 1. x1x2x3r{}0(2){1}3(4){2}3(2){3}3(4)1(0)2(0)3(0){12}5(2){13}5(4){2}5(2){13}6(5)2(2)3(0)1(2)3(0)2(2)1(2)t3(2)2(4)3(2)1(4)2(5) i, v) relaxes φ(Si, v). Theorem 1 ([20]). If the following conditions are satisfied, the merger of nodes with states Si and Ti within a decision diagram results in a valid relaxation of the diagram. -- Si ⊕ Ti relaxes both Si and Ti. -- If state S(cid:48) i relaxes state Si, then given any control v that is feasible in Si, φ(S(cid:48) All relaxed diagrams we consider are associated with a dynamic programming model that satisfies the conditions of the theorem. The shortest path problem in the relaxed DD requires a modification of the original dynamic programming model that accounts for the merger of states. Also, it is sometimes necessary to use additional state variables to obtain a valid relaxation [5], and so we replace the state vector Si with a possibly enlarged vector ¯Si. The recursive model becomes (cid:16) (cid:0)φi( ¯Si, xi)(cid:1)(cid:17)(cid:111) (cid:110) ¯hi( ¯Si) = min xi∈Xi( ¯Si) ci( ¯Si, xi) + ¯hi+1 ρi+1 (3) where ρi+1( ¯Si+1) is a relaxation of state ¯Si+1 that reflects the merger of states in stage i+1 of the recursion. In the example, ¯Si = Si, since no additional states are necessary to formulate the relaxation. It will be convenient to distinguish exact from relaxed state variables in model (3). A state variable Sij in (3) is exact if any sequence of controls x1, . . . , xi−1 that leads to a given value of Sij in the original recursion (1) leads to that same value in the relaxed recursion (3). Otherwise Sij is relaxed. In the example, neither Vi nor ti is exact if any pair of states can be merged. However, if we permit the merger of (Vi, ti) and (V (cid:48) i, then state variable ti is exact. In general we have the following, which is easy to show. Lemma 1. A state variable Sij is exact if states Si, S(cid:48) Sij = S(cid:48) ij. i) only when ti = t(cid:48) i are merged only when i , t(cid:48) 6 Lagrangian Duality and Decision Diagrams Consider an optimization problem z∗ = min x∈X (cid:8)f (x)(cid:12)(cid:12) g(x) = 0(cid:9) where x = (x1, . . . , xn), g(x) = (g1(x), . . . , gm(x)) and 0 = (0, . . . , 0). The condition that x ∈ X is typically represented by a constraint set. A Lagrangian relaxation of (4) has the form (cid:8)f (x) + λT g(x)(cid:9) θ(λ) = min x∈X where λ = (λ1, . . . , λm). The relaxation dualizes the constraints g(x) = 0. It is easy to show that θ(λ) is a lower bound on z∗ for any λ ∈ Rm. The Lagrangian dual of (4) seeks the tightest bound θ(λ): (cid:8)θ(λ)(cid:9) max λ∈Rm (4) (5) (6) The motivation for using a Lagrangian dual is to obtain tight bonds while dualizing troublesome constraints. If g(x) depends on a very small number of state variables, then dualizing the constraint g(x) = 0 may allow one to solve the problem within time and space constraints. Lagrangian duality can be illustrated in the minimum tardiness job sequenc- ing problem discussed earlier. The variables x1, . . . , xn should have different val- ues, or equivalently, that each job j should occur in a given solution exactly once. Since a relaxed DD does not enforce this condition, we dualize the constraint g(x) = 0, where g(x) = (g1(x), . . . , gn(x)) and gj(x) = −1 + (xi = j), with (xi = j) = and subtracting (cid:80) As observed in [3], the Lagrangian penalty λjgj(x) can be represented in a relaxed DD by adding λj to the cost of each arc corresponding to control j j λj from the cost of each arc leaving the root node. Then the length of each r -- t path includes the Lagrangian penalty λT g(x) for the corresponding solution x, which is zero if x satisfies the all-different constraint. In general, g(x) can be computed recursively in a relaxed DD when there is a vector-valued immediate penalty function γi( ¯SL i , xi) for which (cid:26) 1 if xi = j 0 otherwise n(cid:88) i=1 n(cid:88) i=1 n(cid:88) g(x) = γi( ¯SL i , xi) (7) where each ¯SL is a tuple consisting of exact state variables Si(cid:96) for (cid:96) ∈ L. In i the example, the constraint function g(x) requires no state information, and ¯SL i is empty. The immediate penalty γi((Vi, ti), xi) can be written simply γi(xi), where (cid:26) (xi = j) (8) γij(xi) = for j = 1, . . . , n. if i ∈ {2, . . . , n} (xi = j) − 1 if i = 1 Implementing a Lagrangian relaxation (4) in a relaxed DD also requires that the original objective function value f (x) be computed as part of the path length. Normally, the path length is only a lower bound on f (x). To compute f (x) exactly in the relaxed recursion (3), we must have an immediate cost function that depends only on exact state variables. That is, we must have f (x) = ¯ci( ¯SK i , xi) (9) i=1 where ¯SK is a tuple consisting of exact state variables Sik for k ∈ K. In the i example, the immediate cost function (2) depends on the state variable ti, which must therefore be exact. We therefore have ¯SK i = (ti). Due to Lemma 1, we can ensure that ti is exact by merging nodes only when ti has the same value in the corresponding states. Thus Lagrangian relaxation can be implemented in the minimum tardiness example if we merge nodes in this fashion. The above observations can be summed up as follows. Theorem 2. Lagrangian relaxation (5) can be implemented in a relaxed DD if there are immediate cost functions ¯ci( ¯SK i , xi) for which (9) holds and immediate penalty functions γi( ¯SL i consist entirely of exact state variables in ¯Si. In this case the recursion for computing shortest paths in the relaxed DD becomes i , xi) for which (7) holds, where ¯SK and ¯SL i (cid:16) (cid:0)φi( ¯Si, xi)(cid:1), λ (cid:17)(cid:111) (cid:110) ¯hi( ¯Si, λ) = min xi∈Xi( ¯Si) ¯ci( ¯SK i , xi) + λT γi( ¯SL i , xi) + ¯hi+1 ρi+1 Corollary 1. Lagrangian relaxation (5) can be implemented in a relaxed DD if nodes are merged only when their states agree on the values of the state variables on which the immediate cost functions and the immediate penalty functions depend. That is, nodes with states ¯Si and ¯Ti are merged only when ¯SK i = ¯T K and ¯SL i , where K and L are in as Theorem 2. i = ¯T L i 7 Problem Classes We now examine a few classes of job sequencing problems to determine whether they are suitable for Lagrangian relaxation on a relaxed DD. All of these prob- lems have an all-different constraint that is dualized as before using the immedi- ate penalty function (8). Since this function depends on no state variables, the state variables that must be exact are simply those on which the immediate cost function depends. That is, ¯SL is empty, and suitability for relaxation depends i on which variables are in ¯SK i . We note that even when DD-based Lagrangian relaxation is not suitable for a given problem class, it may be useful when combined with branching, or when the relaxed DD is embedded in a larger model. 7.1 Sequencing with Time Windows Problems in which jobs with state-independent processing times are sequenced, possibly subject to time windows, are generally conducive to Lagrangian relax- ation on DDs. The problem of minimizing total tardiness is discussed above, and computational results are presented in Section 8. Minimizing makespan or the number of late jobs is treated similarly. A popular variation on the problem minimizes the sum of penalized earliness and tardiness with respect to a common due date [8,9,11,16,17,22,25]. Earliness of job j is weighted by αj and lateness by βj. The recursive model for an exact DD uses the same state variables (Vi, ti) as the minimum tardiness problem. However, a valid relaxed DD requires an additional state variable si that represents latest start time, while ti again represents earliest finish time. The transition and immediate cost functions are (cid:0)(Vi, si, ti), xi (cid:0)(Vi, si, ti), xi ¯φi ¯ci (cid:1) =(cid:0)Vi ∪ {xi}, si + pxi, ti + pxi (cid:1) = αxi (cid:0)si + pxi − dxi (cid:1) (cid:0)ti + pxi − dxi (cid:1)+ + βxi (cid:1)+ The merger operation is i , s(cid:48) (Vi, si, ti) ⊕ (V (cid:48) i, t(cid:48) i , max{si, s(cid:48) i}, min{ti, t(cid:48) i} i) =(cid:0)Vi ∩ V (cid:48) (cid:1) The immediate cost depends on both si and ti, which means that both of these state variables must be exact. This may appear to result in a large relaxed DD, because nodes can be merged only when they agree on both state variables. However, since si and ti are initially equal, and these state variables are exact, they remain equal throughout the relaxed DD construction. The resulting DD is therefore the same that would result if a single state variable were exact. Computational results are presented Section 8. 7.2 Time-Dependent Costs and/or Processing Times Costs and processing times can be time-dependent in two senses: they may depend on the position of each job in the sequence, or on the clock time at which the job is processed. Both senses occur in the literature, and both can be treated with Lagrangian relaxation on DDs. If the processing time pij of job j depends on the position i of the job in the sequence, then the immediate cost in the relaxation is ¯ci((Vi, ti), xi) =(cid:0) max{ti, rxi} + pixi − dxi (cid:1)+ which depends only on the state variable ti. Since ¯ci is already indexed by the position i, any other element of cost that depends on i is easily incorporated into the function. Thus we need only ensure that states are merged only when they agree on ti, a condition that is already satisfied in the relaxed model described above for minimum-tardiness sequencing problems. If the processing time pj(s) of job j depends on the time s at which job j starts, the immediate cost is ¯ci((Vi, ti), xi) =(cid:0) max{ti, rxi} + pxi (max{ti, rxi}) − dxi (cid:1)+ which again depends only on state variable ti. Any other time-dependent element of cost likewise depends only on ti, and so states can be merged whenever they agree on ti. 7.3 Sequence-Dependent Processing Times We refer to a job j's processing time as sequence dependent when its processing time pj(cid:48)j depends on the immediately preceding job j(cid:48) in the sequence. When there are no time windows and the objective is to minimize travel time, the problem is a traveling salesman problem. The state variables are Vi and the immediately preceding job yi. The transition and immediate cost functions are (cid:0)(Vi, yi), xi (cid:0)(Vi, yi), xi (cid:1) =(cid:0)Vi ∪ {xi}, xi (cid:1) = pyixi (cid:1) ¯φi ¯ci (10) Since the immediate cost depends only on state yi, nodes can be merged when- ever they are reached using the same control. This permits a great deal of reduc- tion in the relaxed DD and suggests that a Lagrangian approach to bounding can be effective. While pure traveling salesman problems are already well solved, a DD-based Lagrangian bounding technique may be useful when there are side constraints. When there are time windows in the problem, an additional state variable ti representing the finish time of the previous job is necessary for a stand-alone relaxed DD. The transition function is The immediate cost functions for minimizing travel time and total tardiness, respectively, are ¯φi (cid:1) (cid:0)(Vi, yi, ti), xi (cid:0)(Vi, yi, ti), xi (cid:0)(Vi, yi, ti), xi (cid:1) =(cid:0)Vi ∪ {xi}, xi, max{rxi, ti} + pyixi (cid:1) = (rxi − ti)+ + pyixi (cid:1) =(cid:0) max{rxi, ti} + pyixi − dxi (cid:1)+ ¯ci ¯ci (11) (12) (13) In either case, the immediate cost depends on two state variables yi and ti, and nodes can be merged only when they agree on these variables. This is likely to result in an impracticably large relaxed DD. For example, if there are 50 jobs and a few hundred possible values of ti, a layer of the relaxed DD could easily expand to tens of thousands of nodes. We confirmed this with preliminary experiments on the Dumas instances [14]. Lagrangian relaxation on a stand-alone relaxed DD therefore does not appear to be a promising approach to bounding TSP problems with time windows. One can, of course, use the simpler DD described by (10) to bound travel time (although not total tardiness), as is done in [3]. However, this relaxation ignores time windows altogether and would yield a weaker bound than (11) -- (12). 7.4 State-Dependent Processing Times We refer to a job's processing times as state dependent when they depend on one or more of the state variables in the recursion, such as the set Vi of jobs already processed. Such a problem is studied in [20], where the processing time is less if a certain job has already been processed. State variables are again Vi and ti, but to build a relaxed DD we need an additional state variable Ui representing the sets of jobs that have been processed along some path to the current node. The transition function and immediate cost function are (cid:0)(Vi, Ui, ti), xi (cid:0)(Vi, Ui, ti), xi ¯φi ¯ci (cid:1) =(cid:0)Vi ∪ {xi}, Ui ∪ {xi}, max{rxi, ti} + pxi(Ui)(cid:1) (cid:1) =(cid:0) max{rxi , ti} + pxi(Ui) − dxi (cid:1) (cid:1)+ i) =(cid:0)Vi ∩ V (cid:48) i , U(cid:48) i , Ui ∪ U(cid:48) i , min{ti, t(cid:48) i} i , t(cid:48) (Vi, Ui, ti) ⊕ (V (cid:48) where the processing time is pxi(Ui). The merger operation is Since the cost depends on both ti and Ui, these state variables must be exact, and states can be merged only when they agree on the values of ti and Ui. This predicts that the relaxed DD will grow rapidly with the number of jobs. DD-based Lagrangian relaxation is therefore not a promising approach to this type of problem. 8 Computational Experiments 8.1 Problem Instances To assess the quality of bounds obtained from Lagrangian relaxation on relaxed DDs, it is necessary to obtain problem instances with known optimal values, or values that are likely to be close to the optimum. We carry out tests on two well-known sets of instances, corresponding to two sequencing problems identified earlier to be suitable for bounding. One is the set of minimum weighted tardiness instances of Crauwels, Potts and Wassenhove [13], which we refer to as the CPW instances. The other is the Biskup-Feldman collection of minimum weighted earliness-plus-tardiness instances with a common due date [8]. The CPW set consists of 125 instances of each of three sizes: 40 jobs, 50 jobs, and 100 jobs. We compute bounds for first 25 instances in the 40- and 50- job sets. These instances exhibit a wide range of gradually increasing tardiness values, thus providing a diverse selection for testing. Optimal solutions are given in [8] for all of these instances except instance 14 with 40 jobs, and instances 11, 12, 14 and 19 with 50 jobs. Solution values presented in [8] for the unsolved instances are apparently the best known. The Biskup-Feldman collection includes 10 instances of each size, where the sizes are 10, 20, 50, 100 and 200 jobs. We study the instances with 20, 50 and 100 jobs. The instances specify only the processing times pj and the earliness/tardiness weights αj, βj described earlier. The common due date for all jobs in an instance is not specified. Typical practice is to set the due date equal to d(h) = (cid:98)h(cid:80) j pj(cid:99), where h is a parameter. We compare our lower bounds against the best known solution values re- ported in [25]. These authors compute the earliness penalty with respect to d(h1) and the tardiness penalty with respect to d(h2) for h1 < h2, so that the penalty for each job j is αj(d(h1) − tj)+ + βj(tj − d(h2))+, where tj is the finish time of job j. Heuristics are used in [25] to solve instances with (h1, h2) = (0.1, 0.2), (0.1, 0.3), (0.2, 0.5), (0.3, 0.4), and (0.3, 0.5). We study instances with (h1, h2) = (0.1, 0.2) and (0.2, 0.5) to provide a look at contrasting cases. To our knowledge, none of these instances have been solved to proven optimality. 8.2 Solving the Lagrangian Dual We use subgradient optimization to solve the Lagrangian dual problem (6). Each iterate λk is obtained from the previous by the update formula λk+1 = λk + σkg(xk) where xk is the value of x obtained when computing θ(λk) in (5). The art of Lagrangian optimization is choosing the step size σk. This choice is avoided in [3] by using the Kelly-Cheney-Goldstein bundle method [21] of deriving λk from previous iterates. However, Polyak's method [23] seems better suited to our purposes, because it is much easier to implement, and it requires as a parameter only an upper bound θ∗ on the optimal value of θ(λ). Such a bound is available in practice, because one seeks to estimate how far a known solution value lies from the optimal value, and that solution value is an upper bound θ∗. Polyak's method defines the step size to be σk = θ∗ − θ(λk) (cid:107)g(xk)(cid:107)2 2 8.3 Building the Relaxed Diagram In previous work [1,4,6], heuristically-selected nodes are merged in each layer after all states obtainable from the previous layer are generated. Since we wish to merge all nodes that agree on ti, and no others, we merge these nodes as we generate the states, rather than first generating all possible states and then merging nodes. This drastically reduces computation time and results in reasonable widths that gradually increase as layers are created. 8.4 Computational Results The computational tests were run on a Dell XPS-13 laptop computer with Intel Core i7-6560U (4M cache, 3.2 GHz) and 16GB memory. Results for the CPW instances appear in Table 1. The table displays optimal (or best known) values and DD-based bounds, as well as the absolute and relative gap between the two. It also shows the maximum width of the relaxed DD (always obtained in layer n), the time required to build the DD, and the time consumed by the subgradient algorithm. Since a subgradient iteration requires only the solution of a shortest path problem in the relaxed DD, we allowed the algorithm to run for 50,000 iterations to obtain as much improvement in the bound as seemed reasonably possible. Due to slow convergence, which is typical for subgradient algorithms, a bound that is nearly as tight can be obtained by executing only, say, 20% as many iterations. The bounds in Table 1 are reasonably tight. The gap is well below one percent in most cases, and below 0.1% in about a quarter of the cases, although a few of the bounds are rather weak. The optimal value was obtained for one instance. The gap for instance 14 in the 40-job table suggests that the best known value is probably not optimal, while no such inference can be drawn for the 4 unsolved 50-job instances. Results for the Biskup-Feldman instances appear in Table 2, where the bounds are compared with the best known solutions. The relaxed DDs are the same for the two sets of due dates (h1, h2) = (0.1, 0.2), (0.2, 0.5); only the costs differ. The bounds are very tight, resulting in gaps that are mostly under 0.1%. This indicates that the known solutions are, at worst, very close to optimality. In fact, optimality is proved for 8 instances, which represents the first time that any of these instances have been solved. The bounds may be equal to the optimal value for other instances, since the known values displayed may not be optimal. 9 Conclusion We have shown how Lagrangian relaxation in a stand-alone relaxed decision diagram can yield tight optimization bounds for certain job sequencing problems. We also characterized problems on which this approach is likely to be effective; namely, problems in which a relaxed DD of reasonable width results from a restricted form of state merger. The restriction is that states may be merged only when they agree on the values of state variables on which the cost function and dualized constraints depend in a recursive formulation of the problem. Based on this analysis, we observed that job sequencing problems with state- independent processing times and time windows are suitable for this type of bounding, whether one minimizes tardiness, makespan or the number of late jobs. The same is true when processing times are dependent on when the job is processed or its position in the sequence. The traveling salesman problem can also bounded in this fashion. However, the TSP with time windows, as well as problems with state-dependent processing times in general, are normally unsuitable for DD-based Lagrangian relaxation, unless the relaxed diagram is combined with branching or embedded in a larger model. We ran computational experiments on 110 instances from the well-known Crauwels-Potts-Wassenhove and Biskup-Feldman problem sets, with sizes rang- ing from 20 to 100 jobs. We found that DD-based Lagrangian relaxation can provide tight bounds for nearly all of these instances. This is especially true of the Biskup-Feldman instances tested, all of which were unsolved prior to this work. We showed that the best known solutions are almost always within a small fraction of one percent of the optimum, and we proved optimality for 8 of the solutions. To our knowledge, these are the first useful bounds that have been obtained for these instances. More generally, our analysis can be used to identify dynamic programming models that may have a useful relaxation based on relaxed decision diagrams and Lagrangian duality. Table 1. Comparison of bounds with optimal values (target) of CPW instances. Computation times are in seconds. 40 jobs 50 jobs Instance Target Bound Gap Percent Max Build Subgr time gap width time Instance Target Bound Gap Percent Max Build Subgr time gap width time 883 1 913 1179 2 1225 483 3 537 2047 4 2094 980 5 990 6939 6 6955 6299 7 6324 6743 8 6865 16049 9 16225 9591 10 9737 17417 11 17465 19245 12 19312 29003 13 29256 14 ∗14377 14100 26755 26914 15 72120 72317 16 78501 78623 17 74131 74310 18 77083 77122 19 63217 20 63229 21 77754 77774 22 100484 100456 23 135618 135617 24 119947 119914 25 128747 128705 ∗Best known solution 3.29% 30 46 3.76% 54 10.06% 2.24% 47 10 1.01% 0.23% 16 0.40% 25 1.78% 122 1.08% 176 146 1.50% 0.27% 48 0.35% 67 0.86% 253 1.93% 277 159 0.59% 0.27% 197 0.16% 122 0.24% 179 0.05% 39 12 0.02% 0.03% 20 0.03% 28 1 0.001% 0.03% 0.03% 33 42 3163 3652 3556 3568 3305 3588 3509 3508 3699 3426 3770 3644 3736 3609 3849 3418 3531 3524 3407 3506 3766 3489 3581 3477 3597 16 20 20 20 18 20 20 20 22 19 23 22 22 21 23 19 20 20 19 20 22 20 21 19 22 1287 1420 1443 1427 1312 1406 1437 1393 1468 1346 1493 1435 1506 1406 1554 1382 1384 1431 1320 1344 1433 1382 1375 1295 1339 2100 1 2134 1864 2 1996 2552 3 2583 2673 4 2691 1342 5 1518 26054 6 26276 11128 7 11403 8490 8 8499 9507 9 9884 10594 10 10655 11 ∗43504 43472 12 ∗36378 36303 45310 45383 13 14 ∗51785 51702 38910 38934 15 87512 87902 16 17 84066 84260 18 104795 104633 19 ∗89299 89163 72316 20 72222 21 214546 214476 22 150800 150800 23 224025 223922 24 116015 115990 25 240179 240172 ∗Best known solution 34 132 31 18 1.59% 6.61% 1.20% 0.67% 176 11.59% 0.84% 222 2.41% 275 0.11% 9 3.81% 377 61 0.57% 0.07% 32 0.21% 75 0.16% 73 0.16% 83 47 0.12% 0.44% 390 0.23% 194 0.15% 162 0.15% 136 94 0.13% 0.03% 70 0 0% 0.05% 103 0.02% 25 7 0.003% 4525 4453 4703 4585 4590 4490 4357 4396 4696 4740 4597 4500 4352 4699 4650 4589 4359 4448 4609 4678 4406 4098 4288 4547 4639 48 53 52 55 52 48 45 46 52 53 50 48 47 52 52 49 45 47 50 51 47 39 44 49 51 2633 2856 2697 2703 2658 2562 2499 2501 2660 2738 2606 2655 2521 2656 2630 2623 2526 2505 2660 2659 2580 418 2441 2620 2686 Table 2. Comparison of bounds with best known values (target) of Biskup-Feldman instances. (h1, h2) = (0.1, 0.2) (h1, h2) = (0.2, 0.5) Instance Target Bound Gap Percent Subgr Target Bound Gap Percent Subgr Max Build time time width time gap gap 20 jobs 1 2 3 4 5 6 7 8 9 10 50 jobs 1 2 3 4 5 6 7 8 9 10 100 jobs 4089 8251 5881 8977 4028 6306 10204 3742 3317 4673 39250 29043 33180 25856 31456 33452 42234 42218 33222 31492 4089 8244 5877 8971 4024 6288 10204 3739 3310 4669 39250 29043 33180 25847 31439 33444 42228 42203 33218 31481 0 7 4 6 4 18 0 3 7 4 0 0 0 9 17 8 6 15 4 11 0% 0.08% 0.07% 0.07% 0.10% 0.29% 0% 0.08% 0.21% 0.09% 0% 0% 0% 0.03% 0.05% 0.02% 0.01% 0.04% 0.01% 0.03% 1 28 27 27 32 26 1 25 21 29 16 191 300 549 540 544 491 491 503 529 1 139573 139556 2 120484 120465 3 124325 124289 4 122901 122876 5 119115 119101 6 133545 133536 7 129849 129830 8 153965 153958 9 111474 111466 10 112799 112792 17 19 36 25 14 0.01% 4075 0.02% 4065 0.03% 3957 0.02% 3903 0.01% 3925 9 0.007% 3987 0.01% 4027 7 0.005% 3722 8 0.007% 3930 7 0.006% 3936 19 1162 2770 1675 3113 1192 1557 3573 990 1056 1355 12754 8468 9935 7373 8947 10221 12002 11154 10968 9652 39495 35293 38174 35498 34860 35146 39336 44963 31270 34068 1162 2766 1669 3108 1187 1557 3569 979 1055 1349 12752 8463 9935 7335 8938 10213 11981 11141 10965 9650 39467 35266 38150 35467 34826 35123 39303 44927 31231 34048 0 4 6 5 5 0 4 11 1 6 2 5 0 38 9 8 21 13 3 3 28 27 24 31 34 23 33 36 39 20 0% 0.14% 0.36% 0.16% 0.42% 0% 0.11% 1.11% 0.09% 0.44% 0.02% 0.06% 0% 0.52% 0.10% 0.08% 0.17% 0.12% 0.03% 0.03% 1 27 28 27 32 1 29 25 22 30 501 524 66 521 529 532 465 478 508 522 0.07% 3968 0.08% 4068 0.06% 4059 0.09% 3964 0.10% 4016 0.07% 3961 0.08% 3974 0.08% 3865 0.12% 4008 0.06% 4003 323 287 287 287 341 271 305 267 230 320 931 931 836 932 932 932 835 833 884 932 1882 1882 1882 1882 1882 1882 1882 1784 1882 1882 0.12 0.08 0.08 0.08 0.10 0.09 0.09 0.08 0.07 0.09 2.8 2.9 2.4 2.8 3.0 2.9 2.4 2.4 2.7 2.9 42 44 42 42 42 43 43 39 42 42 References 1. Andersen, H.R., Hadzi´c, T., Hooker, J.N., Tiedemann, P.: A constraint store based on multivalued decision diagrams. In: Bessi`ere, C. (ed.) Principles and Practice of Constraint Programming (CP 2007). LNCS, vol. 4741, pp. 118 -- 132. Springer (2007) 2. Bergman, D., Cir´e, A.A., van Hoeve, W.J.: Improved constraint propagation via Lagrangian decomposition. In: Pesant, G. (ed.) Principles and Practice of Constraint Programming (CP 2015). LNCS, vol. 9255, pp. 30 -- 38. Springer (2015) 3. Bergman, D., Cir´e, A.A., van Hoeve, W.J.: Lagrangian bounds from decision diagrams. Constraints 20, 346 -- 361 (2015) 4. Bergman, D., Cir´e, A.A., van Hoeve, W.J., Hooker, J.N.: Optimization bounds from binary decision diagrams. INFORMS Journal on Computing 26, 253 -- 268 (2013) 5. Bergman, D., Cir´e, A.A., van Hoeve, W.J., Hooker, J.N.: Discrete optimization with binary decision diagrams. INFORMS Journal on Computing 28, 47 -- 66 (2014) 6. Bergman, D., Cir´e, A.A., van Hoeve, W.J., Hooker, J.N.: Decision Diagrams for Optimization. Springer (2016) 7. Bergman, D., van Hoeve, W.J., Hooker, J.N.: Manipulating MDD relaxations for combinatorial optimization. In: Proceedings of CPAIOR. LNCS, vol. 6697, pp. 20 -- 35 (2011) 8. Biskup, D., Feldman, M.: Benchmarks for scheduling on a single machine against restrictive and unrestrictive common due dates. Computers and Operations Research 28, 787 -- 801 (2001) 9. Biskup, D., Feldman, M.: On scheduling around large restrictive common due windows. European Journal of Operational Research 162, 740 -- 761 (2005) 10. Bryant, R.E.: Graph-based algorithms for boolean function manipulation. IEEE Transactions on Computers C-35, 677 -- 691 (1986) 11. Chen, Z.L.: Scheduling and common due date assignment with earliness-tardiness penalties and batch delivery costs. European Journal of Operational Research 93, 49 -- 60 (1996) 12. Cir´e, A.A., van Hoeve, W.J.: Multivalued decision diagrams for sequencing problems. Operations Research 61, 1411 -- 1428 (2013) 13. Crauwels, H., Potts, C., Wassenhove, L.V.: Local search heuristics for the single machine total weighted tardiness scheduling problem. INFORMS Journal on Computing 10, 341 -- 350 (1998) 14. Dumas, Y., Desrosiers, J., Gelinas, E., Solomon, M.M.: An optimal algorithm for the traveling salesman problem with time windows. Operations Research 43, 367 -- 371 (1995) 15. Hadzi´c, T., Hooker, J.N.: Cost-bounded binary decision diagrams for 0-1 programming. In: Loute, E., Wolsey, L. (eds.) CPAIOR 2007 Proceedings. LNCS, vol. 4510, pp. 84 -- 98. Springer (2007) 16. Hall, N.G., Posner, M.E.: Earliness-tardiness scheduling problems, I: Weighted deviation of completion times about a common due date. Operations Research 39, 836 -- 846 (1991) 17. Hall, N.G., Posner, M.E., Sethi, S.P.: Earliness-tardiness scheduling problems, II: Weighted deviation of completion times about a restrictive common due date. Operations Research 39, 847 -- 856 (1991) 18. Hooker, J.N.: Discrete global optimization with binary decision diagrams. In: GICOLAG 2006. Vienna, Austria (December 2006) 19. Hooker, J.N.: Decision diagrams and dynamic programming. In: Gomes, C., Sellmann, M. (eds.) CPAIOR 2013 Proceedings. LNCS, vol. 7874, pp. 94 -- 110. Springer (2013) 20. Hooker, J.N.: Job sequencing bounds from decision diagrams. In: Beck, J.C. (ed.) Principles and Practice of Constraint Programming (CP 2017). LNCS, vol. 10416, pp. 565 -- 578. Springer (2017) 21. Lemar´echal, C.: Lagrangian relaxation. In: Junger, M., Naddef, D. (eds.) Computational Combinatorial Optimization. Lecture Notes in Computer Science, vol. 2241, pp. 112 -- 156. Springer (2001) 22. Ow, P.S., Morton, T.E.: The single machine early/tardy problem. Management Science 35, 177 -- 191 (1989) 23. Polyak, B.T.: Introduction to Optimization (translated from Russian). Optimiza- tion Software, New York (1987) 24. Serra, T., Hooker, J.N.: Compact representation of near-optimal integer programming solutions. Mathematical Programming (to appear) 25. Ying, K.C., Lin, S.W., Lu, C.C.: Effective dynamic dispatching rule and constructive heuristic for solving single-machine scheduling problems with a common due window. International Journal of Production Research 55, 1707 -- 1719 (2017)
1909.01554
1
1909
2019-09-04T04:57:24
Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures
[ "cs.DS" ]
We study the problem of multiplying two bit matrices with entries either over the Boolean algebra $(0,1,\vee,\wedge)$ or over the binary field $(0,1,+,\cdot)$. We engineer high-performance open-source algorithm implementations for contemporary multiple-accelerator shared-memory architectures, with the objective of time-and-energy-efficient scaling up to input sizes close to the available shared memory capacity. For example, given two terabinary-bit square matrices as input, our implementations compute the Boolean product in approximately 2100 seconds (1.0 Pbop/s at 3.3 pJ/bop for a total of 2.1 kWh/product) and the binary product in less than 950 seconds (2.4 effective Pbop/s at 1.5 effective pJ/bop for a total of 0.92 kWh/product) on an NVIDIA DGX-1 with power consumption at peak system power (3.5 kW). Our contributions are (a) for the binary product, we use alternative-basis techniques of Karstadt and Schwartz [SPAA '17] to design novel alternative-basis variants of Strassen's recurrence for $2\times 2$ block multiplication [Numer. Math. 13 (1969)] that have been optimized for both the number of additions and low working memory, (b) structuring the parallel block recurrences and the memory layout for coalescent and register-localized execution on accelerator hardware, (c) low-level engineering of the innermost block products for the specific target hardware, and (d) structuring the top-level shared-memory implementation to feed the accelerators with data and integrate the results for input and output sizes beyond the aggregate memory capacity of the available accelerators.
cs.DS
cs
Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures MATTI KARPPA, Aalto University, Finland PETTERI KASKI, Aalto University, Finland We study the problem of multiplying two bit matrices with entries either over the Boolean algebra (0, 1, ∨, ∧) or over the binary field (0, 1, +, ·). We engineer high-performance open-source algorithm implementations for contemporary multiple-accelerator shared-memory architectures, with the objective of time-and-energy-efficient scaling up to input sizes close to the available shared memory capacity. For example, given two terabinary-bit square matrices as input, our implementations compute the Boolean product in approximately 2100 seconds (1.0 Pbop/s at 3.3 pJ/bop for a total of 2.1 kWh/product) and the binary product in less than 950 seconds (2.4 effective Pbop/s at 1.5 effective pJ/bop for a total of 0.92 kWh/product) on an NVIDIA DGX-1 with power consumption at peak system power (3.5 kW). Our contributions are (a) for the binary product, we use alternative-basis techniques of Karstadt and Schwartz [SPAA '17] to design novel alternative-basis variants of Strassen's recurrence for 2 × 2 block multiplication [Numer. Math. 13 (1969)] that have been optimized for both the number of additions and low working memory, (b) structuring the parallel block recurrences and the memory layout for coalescent and register-localized execution on accelerator hardware, (c) low-level engineering of the innermost block products for the specific target hardware, and (d) structuring the top-level shared-memory implementation to feed the accelerators with data and integrate the results for input and output sizes beyond the aggregate memory capacity of the available accelerators. CCS Concepts: • Computing methodologies → Linear algebra algorithms; Shared memory algorithms; • Mathematics of computing → Mathematical software performance; • Computer systems organization → Single instruction, multiple data. Additional Key Words and Phrases: shared-memory, heterogeneous architecture, gpu, binary matrix multiplication, Boolean matrix multiplication 1 INTRODUCTION Matrix multiplication is one of the most widely deployed primitives in computing. In a combinatorial context, one often encounters the task of multiplying Boolean matrices with entries in {0, 1}, and with the arithmetic taking place either over the Boolean algebra (0, 1,∨,∧) or over the binary field (0, 1, +, ·). Fast algorithms for the Boolean product and the binary product of two bit matrices underlie the fastest known algorithms for a wide range of tasks, such as transitive closure, context-free parsing, and triangle detection [11, 12, 17, 36, 38]. Our interest in this paper is to engineer high-performance open-source implementations of Boolean and binary matrix multiplication for shared-memory platforms connected to multiple vector-parallel accelerator devices. Such platforms are the state of the art in terms of delivering both (i) speed through extensive parallelism available in the accelerator devices, and (ii) energy-efficiency for moderately large data through shared memory.1 Configurations of this type are not only powerful individual systems; indeed, shared-memory platforms with multiple accelerator devices are individual compute nodes in larger distributed-memory systems ranging from a few compute 1For example, a representative configuration of this type is the NVIDIA DGX-1, with eight Tesla V100 SXM2 accelerator devices (in total 40960 32-bit cores running at 1530-MHz boost clock), 512 GiB of shared DDR4-2133 memory, and 3.5-kW peak power consumption. This configuration can execute, at peak, 40960 · 1530 · 106 · 32 = 2.01 · 1015 bit operations per second (2.01 Pbop/s), which at peak power consumption translates to 1.8 · 10−12 Joules of energy consumed per bit operation (1.8 pJ/bop). 1 2 Matti Karppa and Petteri Kaski nodes to current leading-edge supercomputers.2 Thus, scalability to distributed-memory systems starts from carefully engineered shared-memory-accelerated implementations. To our knowledge, the present paper constitutes the first study of Boolean matrix multiplication that seeks to push the envelope towards peak hardware performance on shared-memory-accelerated platforms simultaneously in terms of speed, energy consumption, and input sizes of up to one terabinary-bit (1048576 × 1048576 = 220 × 220 = 240 bits = 1 Tib = 128 GiB) per operand matrix.3 For example, given two terabinary-bit square matrices as input, our present open-source implementation computes the Boolean product in approximately 2100 seconds (1.0 Pbop/s at 3.3 pJ/bop for a total of 2.1 kWh/product) and the binary product in less than 950 seconds (2.4 effective Pbop/s at 1.5 effective pJ/bop for a total of 0.92 kWh/product) on an NVIDIA DGX-1 with power consumption at peak system power (3.5 kW). 1.1 Engineering Challenges Before outlining our specific contributions in more detail, let us introduce some of the challenges when engineering for peak performance on inputs that nearly occupy the available capacity of shared memory and exceed the total memory available on the accelerators in a platform. 3 − n log2 7 − 5n 2 bit operations, and the Strassen -- Winograd algorithm [35, 41] for the binary field uses 6n First, the mathematical framework for algorithm design needs fine-grained optimization beyond coarse tools offered by traditional asymptotic analysis. Algorithms for fast matrix multiplication are a canonical example of this phenomenon, where the asymptotically fastest known algorithm designs [8, 10, 22, 37] hide in their asymptotic analysis very large constants, which make these designs infeasible to use in practice; we refer to the recent survey by Pan [33] for an extensive discussion. For bit matrices, a natural first measure for the concrete efficiency of an algorithm design is the number of bit operations executed. For example, the elementary algorithm to multiply two n × n bit matrices 2 bit uses 2n operations when n is a power of two. Already here one observes a leading constant that is three times the leading constant for the elementary algorithm, which necessitates n ≥ 512 before the Strassen -- Winograd algorithm uses fewer bit operations than the elementary algorithm. The Strassen -- Winograd algorithm is known to be an optimal implementation of matrix multiplication relying on recursive 2 × 2 multiplications [5, 34], assuming one works in the standard basis. Recently, Karstadt and Schwartz [20] introduce an alternative-basis framework that reduces the 2, assuming the input and output are represented in an number of bit operations of Strassen's algorithm to 5n alternative basis. (The transformation of an n × n bit matrix between the standard basis and the alternative basis uses 2 log2 n bit operations.) n Second, accelerator hardware is designed to give peak performance when executing an identical instruction on each entry of a fixed-length vector of words. Thus, all recurrences of bit operations must be designed to support vectorization and coalesced memory accesses across words of bits. Due to pipelining and long latencies in accelerator hardware (cf. Mei and Chu [25] and Volkov [39]), recurrences should make use of the available lowest-latency memory (registers) and expose sufficient parallelism to enable a large number of threads simultaneously in execution compared with the number of cores for effective latency hiding. Furthermore, the bottom layer of recursion needs to be engineered for compatibility with the available low-level instruction set, such as vector-shuffles and custom bit operations given by a truth table. While the word- and vector-level hardware is at the moment rapidly evolving towards integrating increasingly domain- specific hardware units -- for example, units that that perform small-size numerical matrix multiplication -- the high-level 2For example, the Summit supercomputer at Oak Ridge National Laboratory -- the first-ranked supercomputer on the June 2019 Top500-list (https: //top500.org) -- consists of 4608 compute nodes, each of which has 512 GiB of shared DDR4 memory and six Tesla V100 SXM2 accelerator devices. 3Here we note that numerical rather than Boolean matrix multiplication has been extensively studied from an implementation engineering perspective both in the setting of shared memory and in the setting of distributed memory -- we postpone a discussion of related work to §1.3. log2 7 − 4n Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 3 architecture with vectorization, pipelining, and long latencies is likely to remain more stable over time. In particular, this requires designs and engineering for the on-accelerator memory hierarchy that saturates the bandwidth of the dedicated hardware units. Third, assuming each accelerator can be engineered to perform close to the peak available bandwidth in terms of bit operations per second, the host-level algorithm must be engineered to make effective use of the accelerators. This in particular means feeding the accelerators with input and aggregating their output in comparatively low-bandwidth shared memory across a low-bandwidth interconnect between the accelerators and the host. Our objective of engineering for inputs that are near the capacity of shared memory presents a further challenge in that at the host level we must use designs with a low memory footprint. We expect also these traits to withstand the test of time and thus warrant the present engineering effort. 1.2 Our Contributions Let us now proceed to our specific contributions to address the aforementioned engineering challenges. Fine-grained optimization of the base design. First, we proceed with a fine-grained optimization of Strassen's algorithm [35] using the alternative-basis framework of Karstadt and Schwartz [20] for the binary field. Essentially, we investigate all possible alternative bases over the binary field, and optimize (i) the number of Boolean operations for the alternative- basis multiplication, (ii) the weight distribution of linear combinations in the alternative basis, and (iii) the number of Boolean operations for changing between bases. Further desirable properties include in-place-computability and self-invertibility of the basis changes, as well as the ability to make chains of matrix multiplications in the alternative basis. Theorem 1.1 (Main, Self-Inverse and In-Place Basis Changes). There exists an alternative-basis bilinear algorithm that multiplies two 2 × 2 input matrices over the binary field using (a) 3 additions to preprocess each input, (b) 7 noncommutative multiplications, and (c) 6 additions for postprocessing to obtain the output. Moreover, the weight distribution in the alternative bases is 1, 1, 1, 1, 2, 2, 2. The basis changes between the standard basis and the alternative bases each use 2 additions, are self-inverse, and can be computed in-place. Applied recursively in the alternative basis, Theorem 1.1 gives binary matrix multiplication using 5n log2 7 − 4n 2 bit operations when n is a power of two. Changing between the standard basis and the alternative bases takes 1 2 log2 n bit operations and can be done in-place in memory, which presents a minor improvement over the original 2n Karstadt -- Schwartz design, but comes at the cost of losing the chain-multiplication property, which is desirable in many applications. The next theorem summarizes a new design that supports chain multiplication but is slightly less efficient than Theorem 1.1 in terms of its weight distributions, which results in slightly less efficiency when aggregating solutions of sub-instances in tight working memory at the host. Theorem 1.2 (Main, Chain-Multiplication). There exists an alternative-basis bilinear algorithm that multiplies two 2 × 2 input matrices over the binary field using (a) 3 additions to preprocess each input, (b) 7 noncommutative multiplications, and 4 Matti Karppa and Petteri Kaski (c) 6 additions for postprocessing to obtain the output. Moreover, the weight distributions are 1, 1, 1, 1, 2, 2, 2 and 1, 1, 1, 1, 2, 3, 3 for taking linear combinations of the operands and the results of noncommutative multiplications, respectively. The basis changes between the standard basis and the alternative basis each use 2 additions, can be computed in-place, and support chain-multiplication in the alternative basis. The proofs of Theorem 1.1 and Theorem 1.2 are presented in §2 together with a development of the alternative- basis framework using Kronecker products and Yates's algorithm [42] that enables easy parallelization on vectorized accelerator hardware. Engineering for performance on accelerator hardware. Second, beyond optimizing the base design, we engineer an implementation suitable for vectorized accelerator hardware with extensive bit-operation-and-memory bandwidth but long latencies. Here the key engineering principle is to expose sufficient parallelism to saturate the compute cores with work and hide latency, but not to exceed the available on-accelerator memory. It is well known (e.g. [2, 23]) that bilinear block-recursive algorithm designs for matrix multiplication enable a tradeoff between (1) parallel processing (executing the recursive block multiplications in parallel, or "breadth-first", using independent memory for each recursive case) and (2) serial processing (by processing the recursive multiplications serially one after another, or "depth-first", reusing memory). We observe that this tradeoff also applies to alternative-basis algorithms, and illustate its application with a recursive design whose upper levels proceed serially through recursive calls to lower levels executed in parallel, relying on the recurrences underlying Theorems 1.1 and 1.2. The lower parallel levels consist of (i) parallel preprocessing for both inputs, (ii) parallel low-level optimized 64 × 64 bit-matrix-multiplication, and (iii) parallel postprocessing to recover the output. We fine-tune the performance of these levels for the target hardware by (a) merging consecutive levels so that the intermediate results are stored in per-thread registers and (b) working with the widest available per-thread load and store instructions for communicating between the per-thread registers and the on-accelerator memory. For an n × n binary product for large enough n, these engineering considerations together with Theorem 1.1 and 1.2 enable us to obtain on a single Tesla V100 SXM2 accelerator an empirical effective bit-operation bandwidth that exceeds the theoretical boost-clock peak bandwidth for bit operations. Here by effective bandwidth we mean 2n3−n2 bit 2 is the number of bit operations to compute an n × n binary product with the operations per second, where 2n elementary algorithm, and T is the measured wall-clock running time to compute an n × n binary product. We postpone a detailed review of empirical performance to §4. 3 − n T Host-level implementation with a low memory footprint. Third, we engineer host-level subroutines that in parallel feed multiple accelerators with recursive subproblems and aggregate the results obtained to the host-level buffers. Here we follow a strategy of using multiple groups of threads on the host CPUs, where each group contains exactly one thread for each accelerator. Each group is responsible for a specific task in a pipeline of tasks, such as preparing subproblems from the host-level input, solving subproblems on accelerators, and integrating the results of subproblems into the host-level output. The threads coordinate their work through standard synchronization primitives such as mutexes and blocking. To maintain a low working-memory footprint in host memory, we use q-fold Kronecker products of the decomposition matrices underlying Theorems 1.1 and 1.2 to produce subproblems and aggregate the sub-results. This strategy in particular benefits from optimization of the weights of the decomposition matrices discussed above. Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 5 For the binary product, this strategy suffices to obtain aggregate effective bandwidth that exceeds the aggregate peak boost-clock bandwidth of the accelerators on inputs whose size is beyond the aggregate memory capacity of the accelerators. In particular, we consider it a very satisfactory engineering outcome as well as benchmark that we can deliver the binary product of two one-terabinary-bit square matrices in less than one thousand seconds and with less than one kilowatt-hour of energy consumption. Open source. We release our present experimental algorithm implementations as open source4 to enable further engineering and to communicate precisely the lowest-level design decisions for current microarchitectures. 1.3 Earlier and Related Work From a theory perspective, the study of fast algorithms for Boolean matrix multiplication has proceeded along essentially two lines of study. The first line of study either relies on the binary field directly or embeds the Boolean algebra to a ring, employing techniques for fast matrix multiplication over rings to obtain the result. Asymptotically the fastest known such algorithms run in time O(nω+o(1)), where 2 ≤ ω < 2.3728639 is the exponent of matrix multiplication [8, 10, 22, 37]. While such algorithms are the fastest known in terms of asymptotic efficiency, practical algorithms for fast matrix multiplication over rings rely on recursive tensor techniques using small base tensors (e.g. [2, 4, 6, 9, 13 -- 15, 20, 21, 23, 24]) or trilinear aggregation -- cancellation techniques [31, 32] for a small number of independent matrix multiplications (e.g. [18, 19]). These practical studies differ from our present work in that they consider numerical (floating-point) matrix multiplication for CPU-based shared- or distributed-memory systems, whereas we optimize for bit matrices and a multiple-accelerator shared-memory system. Furthermore, we rely on an alternative-basis approach optimized for bit matrices, whereas most of the earlier work -- with the exception of Karstadt and Schwartz [20] -- operates in the standard basis. A second line of study on Boolean matrix multiplication seeks combinatorial rather than algebraic techniques to obtain competitive algorithms [1, 3, 7, 38, 43]. Currently, the fastest such algorithm runs asymptotically in time O(n n) [43]. However, we are not aware of engineering work to bring algorithms in this second line of study to the computing practice on contemporary parallel architectures. 3/log4 2 ALTERNATIVE-BASIS MATRIX-MULTIPLICATION This section develops the mathematical framework for alternative-basis matrix multiplication over the binary field (0, 1, +, ·). We start by recalling the Strassen -- Winograd standard-basis design, and then proceed to introduce two novel alternative-basis designs for use with the binary field as well as establishing our main theorems (Theorem 1.1 and Theorem 1.2). In essence, both new designs are variants of the design in Karstadt and Schwartz [20], with some further optimization of the designs in particular as pertains to the additive complexity and in-place computability of the basis changes. The rest of the section develops the mathematical framework of fast alternative-basis matrix multiplication with no claim on originality, apart perhaps from an expositionary choice to work with Kronecker products and Yates's algorithm [42] to highlight the symmetries and the easily vector-parallelizable sum-product-sum-layered structure of the framework. As discussed in the introduction, we expect this framework to withstand the test of time with further designs and evolving computing hardware. 4Cf. https://github.com/mkarppa/matmul. 6 Matti Karppa and Petteri Kaski 2.1 The Strassen -- Winograd Recurrences We start by recalling the classical Strassen -- Winograd design that works in the standard basis. It will be convenient to first state all algorithms as straight-line programs to highlight their additive complexity. Toward this end, suppose we are to multiply two matrices (cid:34) (cid:35) (cid:34) (cid:35) A = A00 A01 A10 A11 and B = B00 B10 B01 B11 with entries over the binary field (0, 1, +, ·). The Strassen-Winograd design is as follows. First, compute the linear combinations T0 ← A10 + A11 , T1 ← A01 , T2 ← A01 + A11 , T3 ← A10 + T2 , T4 ← A00 + T3 , T5 ← A10 , S0 ← B10 + B11 , S1 ← B10 , S2 ← B01 + B11 , S3 ← B10 + S2 , S4 ← B01 , T6 ← A00 , S5 ← B00 + S3 , S6 ← B00 . (1) (2) (3) (4) Then, multiply the linear combinations to obtain the products Q0 ← T0S0 , Q1 ← T1S1 , Q2 ← T2S2 , Q3 ← T3S3 , Q4 ← T4S4 , Q5 ← T5S5 , Q6 ← T6S6 . Finally, compute the linear combinations of products U1 ← Q2 + U0 , C01 ← Q0 + U2 , U0 ← Q1 + Q3 , C00 ← Q1 + Q6 , U2 ← Q4 + U0 , C10 ← Q5 + U1 , C11 ← Q0 + U1 . In total, this straight-line program makes exactly 15 additions and 7 multiplications. Furthermore, a direct calculation shows that the straight-line program correctly computes the product (cid:34) (cid:35) (cid:34) C = C00 C01 C10 C11 = A00B00 + A01B10 A00B01 + A01B11 A10B00 + A11B10 A10B01 + A11B11 = AB . (5) (cid:35) 2.2 An Alternative-Basis Algorithm with Self-Inverse Basis Changes Let us now turn to alternative-basis designs. We continue to assume that the input is given in 2 × 2 block form, as in (1). Our first new alternative-basis algorithm is as follows. First, change basis by computing A00 ← A00 , B00 ← B00 , A01 ← A01 , B01 ← B01 , A10 ← A10 , B10 ← B10 , A11 ← A01 + A10 + A11 , B11 ← B01 + B10 + B11 , (6) We observe that the same basis change is applied for both matrices A and B. Next, compute the linear combinations T3 ← A11 , T0 ← A00 , S3 ← B11 , S0 ← B00 , Multiply the linear combinations to obtain the products T4 ← A00 + A11 , S4 ← B01 , T6 ← A10 + A11 , S6 ← B10 + B11 . T5 ← A01 + A11 , S5 ← B01 + B11 , T1 ← A01 , S1 ← B10 , T2 ← A10 , S2 ← B00 + B11 , (7) Q0 ← T0 S0 , Q1 ← T1 S1 , Q2 ← T2 S2 , Q3 ← T3 S3 , Q4 ← T4 S4 , Q5 ← T5 S5 , Q6 ← T6 S6 . Compute the linear combinations of products C00 ← Q0 + Q1 , C01 ← Q4 + Q6 , C10 ← Q2 + Q5 , C11 ← Q1 + Q3 + Q5 + Q6 . (8) (9) Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures Finally, transform C back to the standard basis with C00 ← C00 , C01 ← C01 + C11 , C10 ← C10 + C11 , C11 ← C11 . 7 (10) A direct calculation shows that the product (5) is correctly evaluated. This establishes Theorem 1.1 with the exception of the claim on weights, which can be easily verified from (46) in what follows. Compared with the design of Karstadt and Schwartz [20], we observe that the basis transformations (6) and (10) over the binary field use only two additions per matrix, whereas their design uses three additions per matrix, but works over an arbitrary ring. Furthermore, our transformations (6) and (10) admit straightforward in-place computation as well as in-place inversion -- indeed, both (6) and (10) are easily verified to be self-inverses over the binary field. Remark. A drawback of the design above is that it does not enable alternative-basis chaining of matrix multiplications in the sense that the transformations (6) and (10) are not inverses of each other, which would be advantageous in applications that seek chain-multiplication. Our next design removes this drawback but loses the appealing self-inverse property. 2.3 An Alternative-Basis Algorithm with Chaining Our second algorithm retains the arithmetic advantage in basis changes over the Karstadt -- Schwartz [20] design and works in an alternative basis for the matrix ring. For a matrix in the standard basis (cid:34) (cid:35) , X = X00 X01 X10 X11 we transform to the alternative basis by computing X01 ← X01 , X00 ← X00 , X11 ← X01 + X11 , X10 ← X11 + X10 . The inverse transform from the alternative basis to the standard basis is given by X00 ← X00 , X01 ← X01 , X10 ← X10 + X11 , X11 ← X01 + X11 . (11) (12) The algorithm now proceeds as follows. Given two matrices A and B as input, we transform both to the alternative basis using (11) to obtain the matrices A and B. Then, compute the linear combinations T0 ← A00 , S0 ← B00 , T1 ← A01 , S1 ← B10 + B11 , T2 ← A10 , S2 ← B10 , T3 ← A11 , S3 ← B11 , T4 ← A00 + A10 , S4 ← B01 , T5 ← A01 + A10 , S5 ← B01 + B10 , T6 ← A10 + A11 , S6 ← B00 + B10 . (13) Multiply the linear combinations to obtain the products Q0 ← T0 S0 , Q2 ← T2 S2 , Compute the linear combinations of products Q1 ← T1 S1 , Q3 ← T3 S3 , Q4 ← T4 S4 , Q5 ← T5 S5 , Q6 ← T6 S6 . (14) C00 ← Q0 + Q1 , C01 ← R + Q5 , C10 ← R + Q6 , R ← Q1 + Q2 + Q4 , (15) Finally, transform the matrix C back to the standard basis using (12) to obtain the product matrix C. A direct calculation shows that C = AB. Furthermore, since the transformations (11) and (12) are mutual inverses, multiplications ( A, B) (cid:55)→ C in the alternative basis may be chained without transforming back to the standard basis in between multiplications; this C11 ← Q3 + Q4 . 8 Matti Karppa and Petteri Kaski property will become immediate from our exposition in §2.7 and §2.8. This establishes Theorem 1.2 with the exception of the claim on weights, which can be easily verified from (48) in what follows. 2.4 Arrays, Vectors, and Matrices This section develops preliminaries and notational conventions for working with binary matrices used throughout the rest of this paper. The basic data structure we work with is an array of m entries, indexed by the set [m] = {0, 1, . . . , m−1}. A tensor is an array with an associated shape m1 × m2 × · · · × md for nonnegative integers m1, m2, . . . , md with m = m1m2 · · · md. In this case we say that the tensor has d modes and that the mode ℓ = 1, 2, . . . , d has length mℓ. A tensor with one mode is called a vector and a tensor with two modes is called a matrix. We index the entries of a tensor T of shape m1 ×m2 ×· · ·×md using tuples (i1, i2, . . . , id) ∈ [m1]×[m2]×· · ·×[md], with the convention that the tuple refers to the entry indexed by i = i1m2m3 · · · md + i2m3m4 · · · md + . . . + id−1md + id (16) in the underlying array of length m. In other words, in linearizing the tuple (i1, i2, . . . , id) ∈ [m1] × [m2] × · · · × [md] to a linear index i ∈ [m], the first index i1 ∈ [m1] is the most significant, the next index i2 ∈ [m2] is the next most significant, and so forth. We write T(i1,i2, ...,id) for the entry of T indexed by (i1, i2, . . . , id). To lighten the notation, we may also write simply Ti1i2···id assuming the indexing is immediate from the context. When working with modes of composite length mℓ = mℓ,1mℓ,2 · · · mℓ,k for nonnegative integers mℓ,1, mℓ,2, . . . , mℓ,k, for convenience we often choose to index such a mode with tuples in [mℓ,1] × [mℓ,2] × · · · × [mℓ,k], with the understanding that we follow the first-index-major convention (16) to arrive at the linear index in [mℓ]. We use the following notation for subtensors of tensors indexed along the most significicant modes. For a tensor T of shape m1×m2×· · ·×md and a tuple (i1, i2, . . . , iℓ) ∈ [m1]×[m2]×· · ·×[mℓ] of indices, we write Ti1i2···iℓ for the tensor of shape mℓ+1×mℓ+2×· · ·×md with entries (Ti1i2···iℓ)iℓ+1iℓ+2···id for all (iℓ+1, iℓ+2, . . . , id) ∈ [mℓ+1]×[mℓ+2]×· · ·×[md]. In particular, we find it convenient to use the same notation for entries and subarrays of a tensor T , as the structure of the indexing tuple will indicate whether an entry or a subarray is meant. for all i ∈ [s] and k ∈ [u] by (µν)ik = In what follows let us assume that all arrays have their entries in the binary field (0, 1, +, ·) unless indicated otherwise. For an s × t matrix µ, write write µ⊤ for the t × s transpose of µ with entries defined for all i ∈ [s] and j ∈ [t] by the rule µ⊤ = µji. For an s × t matrix µ and a t × u matrix ν, we write µν for the s × u product matrix with entries defined ij j∈[t] µijνjk. We write I = In for the n × n identity matrix. For an s × t matrix µ and a p × q matrix ν, the Kronecker product µ ⊗ ν is the sp × tq matrix with entries defined for all i ∈ [s], j ∈ [t], k ∈ [p], and ℓ ∈ [q] by the rule (µ ⊗ ν)ik j ℓ = µijνk ℓ. For an s × t matrix µ, a t × u matrix σ, a p × q matrix ν, and a q × r matrix τ, let us recall the composition rule for Kronecker products (µσ) ⊗ (ντ) = (µ ⊗ ν)(σ ⊗ τ) . (17) Let us also recall the transposition rule (µ ⊗ ν)⊤ = µ ⊤ ⊗ ν (18) For two tensors σ and τ of identical shape, the entrywise product σ ⊙ τ has the same shape, with entries defined by the rule (σ ⊙ τ)i = σiτi for all indices i. . ⊤ Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 9 2.5 The Triple Product Property and Matrix Multiplication This section recalls the triple product of matrix multiplication and its closure under taking of Kronecker products. For an su × r matrix ζ , an r × st matrix ξ, and an r × tu matrix η, we say that the three-tuple (ζ ξ , η) has the triple product property with parameters ⟨s, t, u⟩r if for all i, i′ ∈ [s], j, j′ ∈ [t], and k, k′ ∈ [u] it holds that if i = i′, j = j′, and k = k′ , ζi′k′hξhijηhj′k = 0 otherwise . For example, the Strassen -- Winograd design (2), (3), (4) gives rise to the matrices  h∈[r]  0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 0 1 1 1 0 1 0 1 1 1 0 0  1  1 0 1 1 0 1 0  0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 1 0 1 0 1 0 ξ = , η =  0 1 0 1 1 1 1 1 0 0 1 1 0 1 1 1 0 1 0 0 0 0 1 0  , 1 0 0 0 and ζ = , (19) (20) (21) which are readily verified to satisfy the triple product property with s = t = u = 2 and r = 7. Let (ζ ξ , η) satisfy the triple product rule with parameters ⟨s, t, u⟩r . Let A be an s × t matrix and B be a t × u matrix. Define an s × u matrix C for all i′ ∈ [s] and k′ ∈ [u] by the rule Ci′k′ =  =  =  i∈[s] h∈[r] j∈[t]   i∈[s]   j∈[t] ζi′k′h  k ∈[u] j∈[t] j′∈[t] Ai′j Bjk′ ,    j′∈[t] h∈[r] ξhijAij Aij Bj′k ηhj′k Bj′k k ∈[u] ζi′k′hξhijηhj′k where the second equality follows by changing the order of summation and the last equality follows from the triple product property (19). Viewing A, B, and C as vectors of length st, tu, and su, respectively, from (21) it immediately follows that (22) In other words, we observe that a three-tuple (ζ ξ , η) with the triple product property reduces multiplication of the matrices A and B to (i) taking linear combinations ξ A and ηB of entries of A and B independently, (ii) multiplying these linear combinations pointwise to obtain ξ A ⊙ ηB, and (iii) taking linear combinations ζ(ξ A ⊙ ηB) to obtain the product matrix C of A and B. C = ζ(ξ A ⊙ ηB) . The triple product property gains its computational power from closure under Kronecker products and the compo- sition rule. Indeed, let (ζℓξℓ, ηℓ) satisfy the triple product property with parameters ⟨sℓ, tℓ, uℓ⟩rℓ for ℓ = 1, 2, . . . , d. Let A be a vector of length s1t1s2t2 · · · sd td, let B be a vector of length t1u1t2u2 · · · tdud, and let C be a vector of length s1tus2u2 · · · sdud. Similarly to (21), for all(i′ d) ∈ [u1]×[u2]×· · ·×[ud], d) ∈ [s1]×[s2]×· · ·×[sd] and(k′ 2, . . . , k′ 2, . . . , i′ 1, k′ 1, i′ 10 Matti Karppa and Petteri Kaski by the triple product property (19) we now have Ci′ = 2···i′ d k′ 2k′ 1i′ 1k′ d (1) 1h1 · · · ζ 1k′ i′ (d) d k′ i′ d hd   i1∈[s1] i2∈[s2] id ∈[sd] ... ξ j1∈[t1] j2∈[t2] jd ∈[td] ... Ai′ 1j1i′ 2j2···i′ d jd Bj1k′ 1j2k′ 2···jd k′ . d =  = ζ h1∈[r1] h2∈[r2] hd ∈[rd] ... j1∈[t1] j2∈[t2] jd ∈[td] ... (1) h1i1j1 · · · ξ (d) hd id jd Ai1j1i2j2···id jd (1) 1k1 · · · η h1j′ (d) hd j′ d kd Bj′ 1k1j′ 2k2···j′ d kd   η k1∈[u1] k2∈[u2] kd ∈[ud] ... 1∈[t1] j′ 2∈[t2] j′ ... d ∈[td] j′ (23) (24) (25) (26) (27) Similarly to (22), from (23) we observe that (1) ⊗ · · · ⊗ ζ C =(cid:0)ζ T ←(cid:0)ξ (1) ⊗ · · · ⊗ ξ (1) ⊗ · · · ⊗ η (d)(cid:1)(cid:0)(cid:0)ξ (d)(cid:1)A , (d)(cid:1)A ⊙(cid:0)η S ←(cid:0)η (d)(cid:1)B(cid:1) . (d)(cid:1)B , (1) ⊗ · · · ⊗ η In other words, to multiply A and B, it suffices to first compute the two matrix-vector products (1) ⊗ · · · ⊗ ξ then multiply the resulting vectors elementwise and finally compute the matrix-vector product Q ← T ⊙ S , C ←(cid:0)ζ (1) ⊗ · · · ⊗ ζ (d)(cid:1)Q to recover the product C of A and B as a vector of length s1u1s2u2 · · · sdud. 2.6 Yates's Algorithm and Fast Matrix Multiplication This section develops fast matrix multiplication in the above framework by reduction to Yates's algorithm. The computational bottleneck of the matrix-multiplication algorithm (A, B) (cid:55)→ C given by (25), (26), and (27) occurs with matrix-vector multiplications of the following form. For ℓ = 1, 2, . . . , d, let µ(ℓ) be a matrix of shape bℓ × aℓ, and let U be a vector of length a1a2 · · · ad. We want to compute the vector V of length b1b2 · · · bd with V =(cid:0)µ (d)(cid:1)U . (1) ⊗ µ (2) ⊗ · · · ⊗ µ The key idea is to rely on the composition rule (17) to implement multiplication with µ(1)⊗µ(2)⊗· · ·⊗µ(d) one component matrix µ(ℓ) at a time, via a sequence of sparse matrices ¯µ[ℓ] defined in what follows. Let π : {1, 2, . . . , d} → {1, 2, . . . , d} be an arbitrary permutation that encodes the order in which the matrices µ(ℓ) will be applied.5 For all k, ℓ ∈ {1, 2, . . . , d}, let mπ k, ℓ = mπ k, ℓ (b, a) = if k ∈ π(cid:0)(cid:8)1, 2, . . . , π−1(ℓ)(cid:9)(cid:1); otherwise. ak bk 5At first reading, it may be convenient to assume that π is the identity permutation. Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 11 Let us recall that we write In for an n × n identity matrix. From the composition rule (17) of Kronecker products, we obtain the decomposition (1) ⊗ µ (2) ⊗ · · · ⊗ µ (d) = ¯µ [π(1)] ¯µ [π(2)] · · · ¯µ µ [π(d)] with ¯µ ⊗ Imπ2, ℓ ⊗ · · · ⊗ Imπ [ℓ] = Imπ1, ℓ for ℓ = 1, 2, . . . , d. In essence, each matrix ¯µ[ℓ] implementsd ⊗ Imπ (29) independent matrix-vector multiplications with the matrix µ(ℓ). Accordingly, ¯µ[ℓ] is sparse with at most aℓbℓ nonzero entries. Furthermore, if matrix-vector multiplication with the bℓ × aℓ matrix µ(ℓ) has a straight-line-program implementation consisting of Pℓ ≤ bℓ(aℓ − 1) binary additions, the total number of binary additions in the algorithm (ℓ) ⊗ Imπ ℓ+1, ℓ k =1, k(cid:44)ℓ mπ k, ℓ k =1, k(cid:44)ℓ mπ k, ℓ ⊗ · · · ⊗ Imπ d ⊗ µ ℓ−1, ℓ ℓ+2, ℓ d, ℓ [d] ← U , U [d−1] ← ¯µ [π(d)] U [d] U , U is [d−2] ← ¯µ [π(d−1)] U [d−1] [0] ← ¯µ [π(1)] U [1] , V ← U [0] , , U (28) (30) (31) d ℓ=1 d k =1 k(cid:44)ℓ Pℓ mπ k, ℓ . The algorithm (30) is known as Yates's algorithm [42] for multiplying a Kronecker-product-structured matrix with a given vector. Yates's algorithm is known to admit highly efficient parallelization. Indeed, since each layer U [ℓ−1] ← ¯µ[π(ℓ)]U [ℓ] in Yates's algorithm consists of a large number of independent matrix-vector multiplications with the same matrix µ(π(ℓ)), Yates's algorithm admits immediate vector-parallelization (single-instruction-multiple-data parallelization). Furthermore, multiple consecutive layers may be aggregated into one layer to optimize use of local storage such as per-scalar-thread registers in vectorized parallel execution. Here the ability to permute layers arbitrarily yields considerable freedom to optimize both the arithmetic cost as well as the vectorized execution and the use of local storage in applications. For matrix multiplication, using Yates's algorithm with permutations πζ , πξ , πη : {1, 2, . . . , d} → {1, 2, . . . , d} to implement the matrix-vector multiplications in (25) and (27), we obtain an algorithm design that multiplies an s1s2 · · · sd × t1t2 · · · td matrix with a t1t2 · · · td × u1u2 · · · ud matrix using exactly d ℓ=1 d k =1 k(cid:44)ℓ d ℓ=1 d k =1 k(cid:44)ℓ d ℓ=1 d k =1 k(cid:44)ℓ ζ ℓ P m πζ k, ℓ (s ⊙ u, r) + ξ ℓ P m πξ k, ℓ (r , s ⊙ t) + η ℓ P m πη k, ℓ (r , t ⊙ u) (32) binary additions and r1r2 · · · rd binary multiplications, where P line program that multiplies the matrix ζ (ℓ), ξ(ℓ), and η(ℓ), respectively, with a vector, ℓ = 1, 2, . . . , d. , and P , P η ℓ ξ ℓ ζ ℓ are the number of additions in a straight- 2.7 Fast Alternative-Basis Matrix Multiplication Let us now review the key idea of Karstadt and Schwartz [20] to change basis to reduce the total additive cost within the previous framework. For ℓ = 1, 2, . . . , d, let (ζ (ℓ)ξ(ℓ), η(ℓ)) satisfy the triple product property with parameters ⟨sℓ, tℓ, uℓ⟩rℓ . For each ℓ = 1, 2, . . . , d, let us now decompose the matrices ζ (ℓ), ξ(ℓ), η(ℓ) into (33) where ϕ(ℓ), ψ(ℓ), and χ(ℓ) are arbitrary invertible matrices. Applying the decomposition (33) together with the composi- tion rule (17) of Kronecker products, the key observation of Karstadt and Schwartz [20] in the present framework is ϕ η ζ ξ , , , (ℓ) = α (ℓ) (ℓ) (ℓ) = β (ℓ) ψ (ℓ) (ℓ) = χ (ℓ) γ (ℓ) 12 Matti Karppa and Petteri Kaski that the multiplication identity (24) decomposes as (1) ⊗ · · · ⊗ ξ (1) (d)(cid:1)(cid:18)(cid:0)α (1) ⊗ · · · ⊗ χ C =(cid:0)ζ =(cid:0)χ =(cid:0)χ (1) ⊗ · · · ⊗ ζ (1) γ (1) ⊗ · · · ⊗ χ (d) γ ϕ (1) ⊗ · · · ⊗ γ (d)(cid:1)(cid:18)(cid:0)ξ (d)(cid:1)(cid:0)γ (d)(cid:1)A ⊙(cid:0)η (d)(cid:1)(cid:18)(cid:0)α ⊙(cid:0)β (1) ⊗ · · · ⊗ α (1) ⊗ · · · ⊗ η (d) ϕ (cid:19) (d)(cid:1)B (d)(cid:1)A ⊙(cid:0)β (d)(cid:1)(cid:0)ϕ (d)(cid:1)(cid:0)ψ (1) ⊗ · · · ⊗ α (1) ⊗ · · · ⊗ β (1) ⊗ · · · ⊗ ϕ (1) ⊗ · · · ⊗ ψ (1) ψ (1) ⊗ · · · ⊗ β (d)(cid:1)A (d)(cid:1)B (cid:19) . (cid:19) (d)(cid:1)B (d) ψ (34) From (34) we can immediately extract the following alternative-basis multiplication algorithm, which we state in a form that relies on Yates's algorithm for multiplying with each Kronecker-product-structured matrix in (34). Let A be a vector of length s1t1s2t2 · · · sd td and let B be a vector of length t1u1t2u2 · · · tdud. Let πϕ , πψ , π χ , πα , πβ , πγ : {1, 2, . . . , d} → {1, 2, . . . , d} be arbitrary permutations. To multiply A and B, first change basis for both inputs by computing A ← ¯ϕ [πϕ(1)] · · · ¯ϕ [πϕ(d)] A , B ← ¯ψ [πψ (1)] · · · ¯ψ [πψ (d)] B . Then compute linear combinations in the new bases T ← ¯α [πα (1)] · · · ¯α [πα (d)] A , S ← ¯β [πβ(1)] · · · ¯β [πβ(d)] B . Multiply the resulting vectors elementwise Take linear combinations of the products Finally change basis Q ← T ⊙ S . C ← ¯γ [πγ (1)] · · · ¯γ [πγ (d)] Q . C ← ¯χ [π χ (1)] · · · ¯χ [π χ (d)] C (35) (36) (37) (38) (39) to recover the product C of A and B as a vector of length s1u1s2u2 · · · sdud. The key insight of Karstadt and Schwartz [20] is that the additive straight-line-program cost of the matrix-vector multiplications with the basis-transformed matrices α(ℓ), β(ℓ), and γ(ℓ) may be strictly lower than the corresponding cost for the matrices ξ(ℓ), η(ℓ), and ζ (ℓ). Furthermore, one may engineer the basis changes ϕ(ℓ), ψ(ℓ), and χ(ℓ) to such an effect. In more precise terms, implementing each of the transformations (35), (36), (38), and (39) using Yates's algorithm (30) with the identity permutation, we obtain that the alternative-basis algorithm uses exactly χ ℓ P m π χ k, ℓ (s ⊙ u, s ⊙ u) + ϕ ℓ m πϕ k, ℓ (s ⊙ t, s ⊙ t) + P d ℓ=1 d d k =1 k(cid:44)ℓ ℓ=1 d k =1 k(cid:44)ℓ P d d ℓ=1 ℓ=1 d d k =1 k(cid:44)ℓ k =1 k(cid:44)ℓ binary additions for the basis changes, γ ℓ P m πγ k, ℓ (s ⊙ u, r) + Pα ℓ (r , s ⊙ t) + m πα k, ℓ β ℓ P d d ℓ=1 ℓ=1 ψ ℓ d d k =1 k(cid:44)ℓ m k =1 k(cid:44)ℓ m πψ k, ℓ (t ⊙ u, t ⊙ u) (r , t ⊙ u) πβ k, ℓ (40) (41) Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures binary additions for the linear combinations, and r1r2 · · · rd 13 (42) binary multiplications. In the diagonal case with r = rℓ, s = sℓ, t = tℓ, u = uℓ, α = α(ℓ), β = β(ℓ), γ = γ(ℓ), ϕ = ϕ(ℓ), ψ = ψ(ℓ), and χ = χ(ℓ) for ℓ = 1, 2, . . . , d, and s = t = u with r > s 2, we obtain that the alternative-basis algorithm uses (cid:0)P χ + Pϕ + Pψ(cid:1)s 2(d−1) d binary additions for the basis changes, (cid:0)Pγ + Pα + P β(cid:1) d ℓ=1 rd−ℓ =(cid:0)Pγ + Pα + P β(cid:1) rd − s r − s 2d 2 2(ℓ−1) s binary additions for the linear combinations, and rd binary multiplications. In particular, from (43) and (44) we see that optimizing the additive costs Pγ , Pα , and P β optimizes the leading constant of the dominant cost for large d. In the non-diagonal case, more fine-grained optimization may be performed by optimizing the components of the decomposition and the permutations to minimize (40) and (41). χ(ℓ) =(cid:0)ϕ(ℓ)(cid:1)−1 for all ℓ = 1, 2, . . . , d. We say that such algorithms support matrix chain multiplication or chaining in A useful subfamily of alternative-basis algorithms are the alternative-basis algorithms that satisfy ϕ(ℓ) = ψ(ℓ) and the alternative basis. Indeed, for such an algorithm, one may chain multiplications ( A, B) (cid:55)→ C in the alternative basis using (36), (37), and (38) only, without changing back to the standard basis in between multiplications. 2.8 The Two New Algorithms in Matrix Form Let us first express the new alternative-basis algorithm in §2.2 in matrix form. The change-of-basis matrices are ϕ = ψ = χ = 0 1 0 1 0 0 1 1 0 0 0 1  1 0 0 0  . 0 1 0 0 0 0 1 0 0 1 1 1 We readily observe that ϕ = ψ = χ⊤ and that ϕ = ϕ−1 and χ = χ−1 over the binary field. This self-inverse property and the ease of in-place computation of matrix-vector multiplication with (45) are appealing properties when working with inputs with tight space constraints. From (6) we observe that we can take Pϕ = Pψ = 2 and from (10) we observe that we can take P χ = 2. The alternative-basis decomposition is defined by the matrices (43) (44) (45) (46) 1 0 0 0   1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1  ,  0 0 1 1 0 1 1  1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1  α = , β = and γ = ,  1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 1 0 0 0 0 1 1  . 0 1 0 1 14 Matti Karppa and Petteri Kaski We readily verify that matrix-vector multiplication with the matrices α and β can be implemented using the recur- rences (7) so that Pα = P β = 3, and matrix-vector multiplication with the matrix γ can be implemented with Pγ = 6 using (9). We observe that the three-tuple (χγαϕ, βψ) with ϕ, α, β, and γ given by (45) and (46) satisfies the triple product property (19) with parameters ⟨2, 2, 2⟩7. Let us now turn to the alternative-basis algorithm in §2.3. The change-of-basis matrices are ϕ = ψ = and χ =  1 0 0 0  0 1 1 1 0 0 1 0 0 0 1 1  1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 0   1 0 0 0 1 0 0  0 1 0 0 0 1 0 0 0 1 0 1 1 1 0 0 0 1 0 0 1  1 0 0 0  , 0 1 0 1 0 0 1 0 0 0 1 1  1 0 0 0 1 1 1 0 0 1 1 0 0 0 0 1 0 1 1 1 0 1 0 0  . 0 0 1 0 (47) (48) We observe that χ = ϕ−1 = ψ−1, so we have an alternative-basis algorithm that supports chaining. From (11) we observe that Pϕ = Pψ = 2. From (12) we observe that P χ = 2. The alternative-basis decomposition is defined by the matrices α = , β = and γ = , We readily verify that matrix-vector multiplication with the matrices α and β can be implemented using the recurrences (13) so that Pα = P β = 3, and matrix-vector multiplication with the matrix γ can be implemented using (15) so that Pγ = 6. Finally, we have that the three-tuple (χγαϕ, βψ) with ϕ, ψ, χ, α, β, and γ given by (47) and (48) satisfies the triple product property (19) with parameters ⟨2, 2, 2⟩7. 3 IMPLEMENTATION ENGINEERING This section describes our algorithm engineering effort in more detail, with a focus on implementing the binary product of two matrices; our implementation of Boolean products is described more concisely at the end of this section. We strive for generality of exposition in terms of the target platform and in terms of enabling the use of future advances in specific alternative-basis decompositions beyond our new decompositions presented in §2.2 and §2.3. The high-level exposition withstanding, our goal with the present engineering effort is that a careful low-level implementation of our engineering framework will be able to utilize specific hardware configurations across a range of configurations efficiently, which we seek to demonstrate in our experiments across a range of current platforms in the subsequent section. Furthermore, we would like to highlight that detailed low-level parameterization and specific optimizations for current target platforms can always be found in the accompanying open-source release. 3.1 The Family of Target Platforms Let us recall from the introduction that we seek generality towards a family of target platforms that consist of a single shared-memory compute node (the host) equipped with N independent and identical vectorized accelerator devices (the accelerators), each joined to the host by a low-bandwidth interconnect compared with the bandwidth available at each device. Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 15 While the detailed parameters of such a configuration are expected to vary and evolve over time, this overall topology of the configuration -- that is, a large-capacity shared-memory host joined by a low-bandwidth interconnect to N independent high-bandwidth accelerators with restricted memory capacity and vectorized parallelism based on thread arrays -- can perhaps be expected to remain more stable over time and thus warrant engineering attention with the goal of providing a design that can be fine-tuned to the varying parameters of each specific configuration. A modern typical configuration of this type is a one-or-more-CPU-based shared-memory host joined by a peripheral component interconnect to N GPU accelerators. A further specific goal in our engineering effort is to enable consideration of input sizes that are close to the shared-memory capacity of the host. Accordingly, our present design at the host level has been structured for a low shared-memory footprint in terms of working memory, but with the understanding that, memory permitting, a faster design can be obtained by following a series-parallel strategy at the host, similarly to the present framework employed at each accelerator. One further design choice in the present framework is that we assume that the accelerators work independently and asynchronously, apart from synchronization enforced by the host. This choice scopes out platforms where the accelerators may be joined to each other by a fast interconnect; indeed, making use of such an interconnect would require at least partial synchronization between the accelerators. 3.2 Accelerators and Thread Arrays Let us now review our more detailed conventions for working with components of a target platform, starting with the accelerators. We assume the accelerator devices are vector processors designed to execute a large number of threads in parallel, working asynchronously with one or more arrays of data residing in accelerator memory. Each of these data arrays has a shape, which makes it convenient to assume that the array of threads working on the data has a shape to structure the workload. More precisely, we say that a parallel workload of L = L1L2 · · · Lr asynchronous threads for positive integers L1, L2, . . . , Lr is a thread array of volume L and shape L1 × L2 × · · · × Lr . This assumption enables us to index a thread t = 0, 1, . . . , L − 1 inside a thread array of volume L alternatively by its linear index t or by the unique tuple (t1, t2, . . . , tr) ∈ [L1] × [L2] × · · · × [Lr] with t = t1L2L3 · · · Lr + t2L3L4 · · · Lr + . . . + tr−1Lr + tr (49) for compatibility with our convention for linearization of data arrays (16). Workloads based on thread arrays are also essentially immediately translatable to modern GPU platforms. With current and envisaged future platforms in mind, a key property for a thread-array based design is that of coalescence. We say that a thread array of shape L1 × L2 × · · · × Lr is coalescent up to c modes if any two threads threads whose tuple-indices agree in all but least significant c modes Lr−c +1, Lr−c +2, . . . , Lr execute an identical stream of instructions; furthermore, whenever an instruction in the stream is a memory access, either a single address or consecutive addresses of words in accelerator memory are accessed across consecutive threads in the c least significant modes. Here it is important to note that we do not assume that the threads in a thread array execute synchronously, although the underlying hardware in most cases has a vectorized structure that is optimized for synchronized execution of the workload in groups of V coalescent threads for a hardware-dependent parameter V . 16 Matti Karppa and Petteri Kaski Further engineering principles for accelerators include the following: (1) work with a large enough L to expose sufficient parallelism to saturate the accelerator hardware; (2) seek coalescent execution by careful design and ordering of the modes of the thread array and the modes of the data tensors; and (3) make sure each thread in the array works with enough local data to make use of low-latency and high-bandwidth storage available to each thread or groups of threads, for example, in the form of per-thread registers and per-thread-group cache memory. 3.3 The Host and Coordinating the Work The role of the host is to coordinate the work of the N accelerators through multithreading and synchronization primitives at the host. Furthermore, our assumption is that the input and the output require memory capacity in excess of what is available at the accelerators, thus requiring the host to prepare workloads for the accelerators and aggregate the results obtained from the accelerators. We also recall that we are seeking a design that has a low working-memory footprint at the host to enable processing of large inputs. Our engineering principles for the host-side implementation include the following: (1) design for efficient use of the host-side memory hierarchy; each host-thread works with at least one cache line of data at a time, utilizing the cache hierarchy available; (2) the N accelerators are coordinated asynchronously in parallel so that each accelerator has its own pipeline implemented using host-side threads, with synchronization on buffers and submatrices of the output to avoid data races; (3) each of the N accelerator-pipelines involves four stages, implemented using dedicated host-threads: (i) prepare left input to accelerator in host memory, (ii) prepare right input to accelerator in host memory, (iii) upload input from host memory to accelerator, compute at accelerator, download result from accelerator to host memory, and (iv) aggregate the result in host memory to output; (4) the accelerators must be supplied with extensive-enough workloads if possible to hide the running time of the other stages of the pipeline behind the accelerator-side compute on the workloads; (5) the accelerator memory and the available low bandwidth between the host and the accelerators constrain the size of the workloads, which we ease by adopting a series/parallel approach on the accelerators; and (6) the memory budget at the host is tight due to our goal of scaling to large inputs and the need to buffer of workloads for N accelerators in host memory -- we use low-memory-footprint designs to prepare and aggregate the workloads, including in-place basis changes and other primitives help with the memory budget. 3.4 The High-Level Design We are now ready for a high-level exposition of the algorithm design engineered for our target platforms. Once the high-level description is done, we proceed to review more detailed implementation considerations. We will use the alternative-basis framework of §2. Let d be a positive integer that represents the depth of the algorithm design in terms of the number of three-tuples of matrices that satisfy the triple-product property (19) used to structure the arithmetic. The exact implementation of this arithmetic will vary somewhat from the ideal design (35), (36), (37), (38), and (39) given in §2, in particular due to storage and bandwidth considerations both at the host and at the accelerators, and due to the need to supply independent Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 17 and asynchronous parallel workloads to each of the N accelerators. Each accelerator will in turn work both serially (recursively) and in parallel with its specific subproblems delegated to it by the host. We will split d according to the high-level layers of the design. We work with four layers: (1) host layer, (2) accelerator serial layer, (3) accelerator parallel layer, and (4) accelerator inner layer. It will be convenient to indicate the layers in our notation with the symbols "h" (host), "s" (accelerator serial), "p" (accelerator parallel), and "i" (inner). Accordingly, we have (h) + d (p) + d (s) + d d = d (i) , where the nonnegative integers d(h), d(s), d(p), and d(i) indicate the number of decomposition matrices employed at each high-level layer. For each type of layer t ∈ {h, s, p, i} and each level ℓ = 1, 2, . . . , d(t) inside a layer, let the three-tuple (t, ℓ)(cid:12)(cid:12)α satisfy the triple product property with parameters(cid:10)s (cid:0)χ (t, ℓ) γ matrices. (t, ℓ)(cid:1) (cid:11) (t) ℓ r (t, ℓ) ϕ (t) ℓ , t (t, ℓ) (t) ℓ , u (t, ℓ) ψ , β (t) , where χ(t, ℓ), ϕ(t, ℓ), and ψ(t, ℓ) are invertible ℓ (50) Our task is to multiply a given matrix A′ of shape s × t with a given matrix B′ of shape t × u to yield as output the product matrix C′ = A′B′ of shape s × u, where (h) d(h) · s · · · s (h) · · · t d(h) · t (h) · · · u d(h) · u s = s t = t u = u (h) 1 (h) 1 (h) 1 (s) (s) d(s) · s 1 · · · s (s) (s) · · · t d(s) · t 1 (s) (s) 1 · · · u d(s) · u (p) 1 (p) 1 (p) 1 (p) d(p) · s · · · s (p) · · · t d(p) · t (p) · · · u d(p) · u (i) (i) 1 · · · s d(i) , (i) (i) 1 · · · t d(i) , (i) (i) 1 · · · u d(i) . The following subsections will expose the more detailed algorithm design. We will first present the flow of computation from the host to the accelerators and back to the host one layer at a time, and then present in detail how the host coordinates its own work and the work of the accelerators through host-side threading and appropriate synchronization primitives. Finally, we will parameterize the algorithm implementation. Our expositionary focus will be on the implementation of the alternative-basis phase (36), (37), and (38) of the algorithm, with less attention and optimization effort devoted to the pre-and-postprocessing phases of data permutation and the basis changes at the host; the latter can be found in the accompanying source code. Linearization and indexing conventions recalled. At this point it is convenient to recall that we tacitly employ the first-index-major linearization convention (16) when linearizing bit arrays to words of memory; that is, changing the most significant (leftmost) indices in a tuple of indices causes the largest stride in memory addressing, and the least significant (rightmost) indices will index bits inside a word of memory as appropriate. We follow a similar convention when linearizing thread arrays on accelerators (49); that is, hardware vectorization occurs with the least significant (rightmost) indices of a tuple indexing a thread in an array of asynchronous threads that implements a workload on an accelerator. We assume that the accelerator hardware computes with vectors of V synchronous threads with consecutive linear indices and that each thread can load and store W -bit words. 18 Matti Karppa and Petteri Kaski and 3.5 Input Permutation at the Host To obtain coalesecent execution of the layered design on vectorized accelerator hardware, it will be convenient to permute the input matrices A′ and B′ from the s × t and t × u layouts with (50) into the interleaved-layout vectors A and B of lengths (h) 1 t (h) 1 s · · · s (h) d(h)t (h) d(h)s (s) 1 t (s) 1 · · · s (s) d(s)t (s) d(s)s (p) 1 t (p) 1 · · · s (p) d(p)t (p) d(p)s (i) 1 t (i) 1 · · · s (i) d(i)t (i) d(i) (51) (h) 1 u (h) 1 · · · t (h) d(h)u (h) d(h)t (s) 1 u (s) 1 · · · t (s) d(s)u (s) d(s)t t (52) respectively. This permutation is executed in host memory, using appropriate parallelization, vectorization primitives, and cache-blocking at the host for efficiency. For uniform implementation of Boolean and binary matrix multiplication, our low-level implementation also transposes the right-hand side operand at this point by transposing the roles of t and u in (52). The innermost transpose is implemented for 64 × 64 submatrices recursively using word operations on 32-bit words, cf. [40]. (p) d(p)u (p) d(p)t (i) 1 u (i) 1 · · · t (i) d(i)u (i) d(i) , (p) 1 u (p) 1 · · · t 3.6 Input Basis Change at the Host After input permutation, we execute basis changes A ← ¯ϕA and B ← ¯ψ B at the host. Both basis changes are executed in parallel using Yates's algorithm (30) on d levels. The innermost d(i) levels employ the identity basis change and thus are omitted; indeed, we work with the standard-basis cubic multiplication algorithm in the accelerator inner layer in §3.10, so no basis changes will be required. 3.7 Instance Generation at the Host We now proceed to describe the sub-instances that the host generates and forwards to the N accelerators for processing. In particular, we assume that the alternative-basis inputs A and B have been prepared and reside in shared memory for parallel access by multiple host-threads working in parallel to keep all the N accelerators saturated with work; we postpone the precise description of the host-side threading and synchronization to §3.16. In essence, the sub-instances are generated from A and B as the sub-arrays obtained by aggregating the linear combinations at the d(h) first levels of the base design (36) at once, which results in increased arithmetic cost compared with (36) implemented using Yates's algorithm, but keeps the working memory needs low at the host, as per our engineering goal to scale up to large inputs on a single host. (h) In precise terms, the sub-instance indexed by (h1, h2, . . . , hd(h)) ∈ [r 1 ] × [r (h,2) h2i2j2 · · · α (h,1) h1i1j1α [h] T h1h2···hd(h) ← α (h) 2 ] × · · · × [r (h) d(h)] consists of the vectors (h,d(h)) hd(h) id(h) jd(h) Ai1j1i2j2···id(h) jd(h) , (h,1) h1j1k1 β (h,2) h2j2k2 · · · β β (h,d(h)) hd(h) jd(h) kd(h) Bj1k1j2k2···jd(h) kd(h) . (53)   (h) 1 ]×[s (h) ]×[t 1 [h] S h1h2···hd(h) ← (i1,i2, ...,id(h))∈[s (j1, j2, ..., jd(h))∈[t (h) 2 ]×···×[s (h) ]×···×[t 2 (h) d(h)] (h) d(h)] (h) (h) (h) d(h)] ]×···×[t (j1, j2, ..., jd(h))∈[t ]×[t 1 2 (h) (h) (h) d(h)] (k1,k2, ...,kd(h))∈[u 2 ]×···×[u 1 ]×[u We compute these vectors by aggregating the sums of subvectors in (53) as they are stated, taking care to not consider subvectors whose associated α-product (respectively, β-product) in (53) is zero. At low level, subroutines for performing the XOR and memory copy operations on subvectors have been handcrafted to make use of the 256-bit AVX2-registers Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 19 (h) 2 (h) 1 r In total thus r in CPU hardware. The routines also perform reads and writes of 512 bits at a time, which corresponds to the length of cache lines on the target CPU. We leave these low-level implementation details to the accompanying source code. (h) · · · r d(h) sub-instances are generated and forwarded for solution by the N accelerators. Such [h] [h] solving of a sub-instance ( T ) by an accelerator consists of (i) uploading the sub-instance to one h1h2···hd(h) , S h1h2···hd(h) of the accelerators, (ii) having the accelerator compute the solution Q , and (iii) downloading the solution from the accelerator to shared memory at the host. We next describe how each accelerator proceeds to solve a given sub-instance, and then describe how each downloaded solution Q is aggregated to the master solution C at the host. [h] h1h2···hd(h) [h] h1h2···hd(h) 3.8 Accelerator Serial Layer Suppose the sub-instance ( T ) has been uploaded to an accelerator. The accelerator then proceeds to solve the instance using three layers. First, a serial layer works with the instance recursively, at the bottom of the recursion switching to parallel work with three parts, the expanding parallel layer, the inner layer, and the compressing parallel layer. We start with a description of the serial (recursive) layer. Let the uploaded instance [h] [h] h1h2···hd(h) , S h1h2···hd(h) [h] [s,0] = T T h1h2···hd(h) , [h] [s,0] = S S h1h2···hd(h) be the input to the serial layer. The serial layer consists of d(s) levels. Each recursive invocation at level ℓ = 1, 2, . . . , d(s) can be indexed by a tuple (h1, h2, . . . , hℓ−1) ∈ [r (s) 2 ] × (s) ℓ−1]. In particular, the initial invocation at ℓ = 1 is indexed by the empty tuple and with input consisting of the and · · · × [r vectors T[s,0] and S[s,0]. More generally, the input to invocation (h1, h2, · · · , hℓ−1) consists of vectors T [s, ℓ−1] S h1h2···hℓ−1 [s, ℓ−1] h1h2···hℓ−1 (s) 1 ] × [r . For hℓ ∈ [r [s, ℓ] T h1h2···hℓ (s) ℓ ←  ], the invocation computes the vectors [s, ℓ] S h1h2···hℓ [s, ℓ−1] T h1h2···hℓ−1iℓ jℓ (s, ℓ) hℓiℓ jℓ α , iℓ ∈[s jℓ ∈[t (s) ℓ (s) ℓ ] ] ←  (s) jℓ ∈[t ] ℓ (s) kℓ ∈[u ] ℓ (s, ℓ) hℓiℓ jℓ [s, ℓ−1] S h1h2···hℓ−1iℓ jℓ β , (54) , obtaining as return value and storing the solution Q and makes the recursive invocation with index (h1, h2, . . . , hℓ) and input consisting of the vectors T and [s, ℓ] . At the bottom level of recursion when ℓ = d(s), S h1h2···hℓ the expanding parallel layer (described in the following section) is invoked with the input, and the return value is ] are available, the invocation obtained from the output of that layer. Once all r computes and returns the value Q (s) for hℓ ∈ [r ℓ ] by (s) ℓ [s, ℓ] h1h2···hℓ [s, ℓ] return values Q h1h2···hℓ (s) ] and jℓ ∈ [t defined for all iℓ ∈ [s ℓ [s, ℓ−1] (s, ℓ) Q h1h2···hℓ iℓ jℓhℓ ←  [s, ℓ−1] h1h2···hℓ−1 [s, ℓ−1] h1h2···hℓ−1iℓ jℓ Q . (55) (s) ℓ γ [s, ℓ] h1h2···hℓ hℓ ∈[r (s) ℓ ] The array-arithmetic in (54) and (55) is implemented with thread arrays on the accelerator so that each thread produces one W -bit word of output using optimized straight-line programs for matrix-vector multiplication with the α, β, and γ matrices. 20 Matti Karppa and Petteri Kaski 3.9 Accelerator Expanding Parallel Layer We now turn to the layer that implements Yates's algorithm with each of the α and β matrices, as follows. Each input to the expanding parallel layer arrives from the bottom level of recursion in the serial layer. Let us write T[p,0] and S[p,0] for the input vectors to the parallel layer. These vectors have lengths (p) 1 t (i) 2 · · · s (i) 2 · · · t and t (p) 1 u (p) 2 u (p) 1 s · · · s (p) 1 t (p) 2 t (i) 1 u (i) 2 u · · · t (i) 1 s (i) 1 t (i) 2 t (i) 1 t (p) 2 (p) 2 s (p) d(p)u (p) d(p)t (p) d(p)t (p) d(p)s (i) d(i)u (i) d(i) , (i) d(i)t (i) d(i) respectively. We describe the processing of the input T[p,0] only, with the understanding that the processing of S[p,0] is similar but utilizes the β matrices in place of the α matrices. Let us write ¯α[p] for the matrix [p] = α (p,1) ⊗ α (p,2) ⊗ · · · ⊗ α ¯α (p,d(p)) ⊗ Is (i) 1 t (i) 1 s (i) 2 t (i) 2 ···s (i) d(i) t (i) d(i) and decompose the matrix using Yates's decomposition (28) with respect to the reversal permutation as [p] = ¯α [p,d(p)] ¯α [p,d(p)−1] · · · ¯α ¯α [p,1] . (p) 1 r The parallel layer proceeds to compute ¯α[p] T[p,0] by a sequence of matrix-vector multiplications T[p, ℓ] ← ¯α[p, ℓ]T[p, ℓ−1] for ℓ = 1, 2, . . . , d(p). Each multiplication in the sequence is implemented with vectorization using W -bit words6 and parallelization via a thread array of · · · r (p) (i) ℓ+2 · · · s 1 t words from the array T[p, ℓ−1] to its local registers, threads working asynchronously, so that each thread loads s word-bit-parallel multiplies in registers with W copies of the matrix α(p, ℓ) using an optimized straight-line program, words to the array T[p, ℓ]. We illustrate the design in pseudocode with Algorithm 1, where we assume that and saves r (i) (i) w is a nonnegative integer with W = s d(i), and that the parameterization of the inner layer is d(i)t such that such a w exists; this will be the case in what follows. (i) d(i)−w +1 · · · s (i) d(i)−w +1t (p) d(p)t (p) ℓ t (p) d(p)s (p) ℓ (i) d(i) /W (i) 2 · · · s (p) ℓ−1s (p) ℓ+1s (p) ℓ+2t (p) ℓ+1t (i) d(i)t (i) 1 s (p) ℓ (i) 2 t (p) 2 r The output of the layer consists of the expanded vectors T[p,d(p)] and S[p,d(p)] of lengths (i) (i) 2 · · · t 2 u (i) 2 · · · s (p) 1 r (p) 1 r · · · r · · · r (i) 1 u (i) 1 s (i) 2 t (i) 1 t (i) 1 t (p) 2 (p) 2 and r r (i) d(i)t (i) d(i) (p) d(p)s (p) d(p)t (i) d(i)u (i) d(i) , respectively, which are in turn given as input to the inner layer. 3.10 Accelerator Inner Layer The inner layer is the most performance-critical part of the design since it works with the expanded vectors and thus with the most data aggregated over the execution of the algorithm. The inner layer takes as input two vectors T[i] and S[i]. The output of the layer is the product Q [i](cid:0) ¯α [i](cid:1) , [i] ⊙ ¯β [i] = ¯γ [i] T [i] S · · · s 6We tacitly assume in what follows that W divides the product s can be similarly chosen to be a power of two by careful design of the inner layer. (i) 1 t (i) 1 s (i) 2 t (i) 2 (i) d(i) t (i) d(i) . Indeed, W is in most cases a power of two, and the product Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 21 Algorithm 1 The accelerator expanding parallel layer illustrated in pseudocode. This pseudocode illustrates the procedure implemented using a thread array for level ℓ = 1, 2, . . . , d(p) that takes as input T[p, ℓ−1] and yields the output T[p, ℓ]. Each thread in the array reads s words to its local registers, multiplies with the matrix α(p, ℓ) in registers, and writes r words. This procedure illustrates operation for the left input only; the procedure for the right input is similar. 1: procedure AcceleratorExpandingParallelLeft( T [p, ℓ−1], ℓ) 2: (p) ℓ t (p) ℓ (p) ℓ do (h (p) ℓ+1, . . . , i parallel for thread (p) (p) (p) (p) (p) (i) (i) (i) (i) ) ∈ d(p), i d(p), j ℓ+1, j ℓ−1, i 1 , . . . , h 1 , j 1 , . . . , i , j d(i)−w d(i)−w (p) (p) (p) (p) (p) (p) (i) [r 1 ] × · · · × [r ℓ−1] × [s ℓ+1] × [t ℓ+1] × · · · × [s d(p)] × [t d(p)] × [s 1 ] × [t (p) (p) (p) (p) ) ∈ [s for (i ] × [t ] do ℓ , j ℓ ℓ ℓ [p, ℓ−1] [local, ℓ−1] ← T T (p) (p) (p) (p) (p) (p) 1 ···h ℓ j i h ℓ−1i ℓ j ℓ i ℓ end for T [local, ℓ] ← α(p, ℓ) T [local, ℓ−1] (i) d(i)−w (p) d(p) j (p) ℓ+1···i [[ Implemented with word-bit-operations using an optimized (i) d(i)−w (p) d(p) i (p) ℓ+1 j (i) 1 ···i (i) 1 j j (i) 1 ] × · · · × [s (i) d(i)−w ] × [t (i) d(i)−w ] straight-line program for multiplying the r with the s (p) ℓ vector T [local, ℓ−1], such as (7) or (13). ]] (p) ℓ t (p) ℓ × s (p) ℓ t (p) ℓ matrix α(p, ℓ) 3: 4: 5: 6: 7: 8: (p) for h ℓ [p, ℓ] T (p) 1 ···h h (p) ∈ [r ℓ (p) ℓ−1h ] do (p) (p) ℓ i ℓ+1 j (p) ℓ+1···i (p) d(p) j (p) d(p) i (i) 1 j (i) 1 ···i (i) d(i)−w (i) d(i)−w j [local, ℓ] ← T (p) h ℓ end for 9: 10: 11: end procedure end for where [i] = Ir ¯α [i] = Ir ¯β [i] = Ir ¯γ (p) 1 r (p) 2 ···r (p) 1 r (p) 2 ···r (p) 1 r (p) 2 ···r (p) d(p) (p) d(p) (p) d(p) ⊗ α ⊗ β ⊗ γ (i,1) ⊗ α (i,1) ⊗ β (i,1) ⊗ γ (i,2) ⊗ · · · ⊗ α (i,2) ⊗ · · · ⊗ β (i,2) ⊗ · · · ⊗ γ (i,d(i)) (i,d(i)) (i,d(i)) , , . As the inner layer works with the least significant bit positions of the bit vectors, in most cases the implementation of the inner layer is hardware-specific and amounts to making the best possible use of the available bit- and word-operations in the instruction set as well as the available vectorization and associated vector-shuffling instructions. (p) 2 · · · r (p) 1 r For example, with W -bit words and length-V hardware vectorization of thread arrays with M 2 = W V , one possibility (p) d(p) independent M × M binary matrix multiplications in parallel to implement the inner layer is to perform r (p) d(p)V threads, using the elementary cubic algorithm implemented with word operations and a thread array of r so that each thread works with one W -bit-word-size fragment from each of the M × M operand matrices and the result matrix, with hardware V -vector shuffle instructions used to communicate words between threads. This is essentially how our low-level implementation of the inner layer is structured, though some optimizations remain to be discussed in §3.15. This part of the framework is also the most sensitive to changes in underlying hardware, and so is perhaps the least likely to withstand the test of time. (p) 1 r · · · r (p) 2 22 Matti Karppa and Petteri Kaski 3.11 Accelerator Compressing Parallel Layer Once the inner layer is complete, its output Q[i] is given as input to a further parallel layer that implements Yates's algorithm with the γ matrices, as follows. Let us write Q[p,d(p)] for the input vector to the compressing parallel layer. Similarly to the expanding layer, let us write ¯γ[p] for the matrix [p] = γ (p,1) ⊗ γ (p,2) ⊗ · · · ⊗ γ ¯γ (p,d(p)) ⊗ Is (i) 1 u (i) 1 s (i) 2 u (i) 2 ···s (i) d(i)u (i) d(i) . and decompose the matrix using Yates's decomposition (28) with respect to the identity permutation as [p] = ¯γ [p,1]¯γ [p,2] · · · ¯γ ¯γ [p,d(p)] . The parallel layer proceeds to compute ¯γ[p] Q[p,d(p)] by a sequence of matrix-vector multiplications Q[p, ℓ−1] ← ¯γ[p, ℓ]Q[p, ℓ] for ℓ = d(p), d(p) − 1, . . . , 1. Each multiplication in the sequence is implemented with vectorization using W -bit words and parallelization via a thread array of (p) ℓ+2 · · · s (p) (i) d(p)u 1 u words from the array Q[p, ℓ] to its local registers, threads working asynchronously, so that each thread loads r word-bit-parallel multiplies in registers with W copies of the matrix γ(p, ℓ) using an optimized straight-line program, and words to the array Q[p, ℓ−1]. We illustrate the design in pseudocode with Algorithm 2, where, analogously stores s to Algorithm 1, we assume that w is a nonnegative integer with W = s (p) d(p)s (p) ℓ (i) d(i) /W (i) 2 · · · s (p) ℓ+1u (p) ℓ+2u (i) d(i)u (p) ℓ−1s (p) ℓ+1s (p) ℓ u (p) 1 r · · · r (i) 2 u (i) 1 s (p) ℓ (p) 2 r (i) d(i)−w +1u (i) d(i)−w +1 · · · s (i) d(i)u (i) d(i). The output of the layer consists of the compressed vector Q[p,0] of length (i) 2 · · · s · · · s which is in turn given as output to the serial layer. (p) d(p)u (p) d(p)s (p) 1 u (p) 2 u (p) 1 s (i) 2 u (i) 1 u (i) 1 s (p) 2 s (i) d(i)u (i) d(i) , 3.12 Instance Aggregation at the Host The aggregation of a solution obtained at an accelerator proceeds as follows at the host, again with a focus on obtaining a design with a low working memory footprint in host memory at the price of increased arithmetic cost. Before [h] any solutions are accepted, the output vector C is initialized to all-0 values. Suppose that the solution Q h1h2···hd(h) (h) for (h1, h2, . . . , hd(h)) ∈ [r d(h)] has been downloaded from an accelerator to host memory. We (h) then execute the following aggregation procedure. For each (i1, i2, . . . , id(h)) ∈ [s d(h)] and each (h,1) (h) (k1, k2, . . . , kd(h)) ∈ [u d(h)], whenever it holds that γ = 1, then i1k1h1γ aggregate the solution to the output by (h) (h) 1 ] × [s 2 ] × · · · × [s (h,2) i2k2h2 · · · γ (h,d(h)) id(h) kd(h)hd(h) (h) 2 ] × · · · × [u (h) 2 ] × · · · × [r (h) 1 ] × [u (h) 1 ] × [r Ci1k1i2k2···id(h) kd(h) ← Ci1k1i2k2···id(h) kd(h) + Q [h] h1h2···hd(h) . (56) When multiple host-threads execute aggregation in parallel, appropriate synchronization primitives need to be employed to avoid conflicts between threads when executing (56). This will be described in detail in §3.16. 3.13 Output Basis Change at the Host After the alternative-basis output C has been aggregated, we execute the basis change C ← ¯χ C at the host, in parallel using Yates's algorithm (30) on d levels. In our implementation, the innermost d(i) levels employ the identity basis change (since the accelerator inner-layer uses the standard-basis cubic multiplication algorithm) and thus are omitted. Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 23 Algorithm 2 The accelerator compressing parallel layer illustrated in pseudocode. This pseudocode illustrates the procedure implemented using a thread array for level ℓ = d(p), d(p) − 1, . . . , 1 that takes as input Q[p, ℓ] and yields the output Q[p, ℓ−1] . Each thread in the array reads r words to its local registers, multiplies with the matrix γ(p, ℓ) in registers, and writes s 1: procedure AcceleratorCompressingParallel( Q[p, ℓ], ℓ) 2: (p) (p) (i) (i) (i) (i) ) ∈ d(p), k d(p), i 1 , k 1 , . . . , i , k d(i)−w d(i)−w (p) (p) (p) (p) (i) ℓ+1] × [u ℓ+1] × · · · × [s d(p)] × [u d(p)] × [s 1 ] × [u (i) 1 ] × · · · × [s (i) d(i)−w (i) d(i)−w words. (p) ℓ u ] × [u (p) ℓ (p) ℓ (h ] do parallel for thread (p) (p) (p) (p) 1 , . . . , h ℓ−1, i ℓ+1, k ℓ+1, . . . , i (p) (p) [r 1 ] × · · · × [r ℓ−1] × [s (p) ∈ [r ℓ [local, ℓ] (p) (p) h ℓ−1h ℓ end for Q[local, ℓ−1] ← γ (p, ℓ) Q[local, ℓ] (p) ] do ℓ ← Q [p, ℓ] (p) 1 ···h h for h Q (p) ℓ+1k (p) ℓ i 3: 4: 5: 6: 7: 8: (p) ℓ+1···i (p) d(p) k (p) d(p) i (i) 1 k (i) 1 ···i (i) d(i)−w (i) d(i)−w k [[ Implemented with word-bit-operations using an optimized straight-line program for multiplying the s with the r (p) × r ℓ vector Q[local, ℓ], such as (9) or (15). ]] (p) ℓ u (p) ℓ (p) ℓ matrix γ (p, ℓ) for (i Q (p) (p) ℓ , k ℓ [p, ℓ−1] (p) 1 ···h h end for ) ∈ [s (p) (p) ℓ−1i ℓ k (p) ℓ (p) ℓ i (p) ] × [u ℓ (p) (p) ℓ+1···i ℓ+1k ] do (p) d(p) k (p) d(p) i (i) 1 k (i) 1 ···i (i) d(i)−w (i) d(i)−w k ← Q [local, ℓ−1] (p) i ℓ k (p) ℓ 9: 10: 11: end procedure end for 3.14 Output Permutation at the Host The last layer of the framework permutes the interleaved-layout vector C of length (i) (i) 1 · · · s 1 u (57) to an s × u output matrix C′ with s and u as in (50). This completes the description of the layers of the algorithm design. (s) 1 · · · s (p) d(p)u (h) d(h)u (s) d(s)u (p) d(p)s (h) d(h)s (i) d(i)u (s) d(s)s (p) 1 u (h) 1 u (s) 1 u · · · s · · · s (i) d(i) (h) 1 (p) 1 s (p) ℓ , t (p) ℓ , s (p) ℓ , u 3.15 Further Optimization by Merging Levels and Shifting Levels Between Layers The previous framework can be further optimized at the accelerators by making more extensive use of the registers local to each thread in a thread array, assuming such registers are available in sufficient quantity. This section documents two techniques towards this end. of the expanding levels ℓ = 1, 2, . . . , d(p) in the expanding Merging levels. Assuming the parameters r layer (cf. §3.9) are small enough, one may utilize the per-thread registers and compute two consecutive levels, ℓ and ℓ + 1, instead of only one level ℓ. In this case one works with a thread array of (i) 2 · · · s (p) (p) (p) (p) · · · r ℓ−1s ℓ+2s ℓ+2t ℓ+3t (p) (p) (p) (p) threads, so that each thread loads s ℓ+1 words from accelerator memory to its local registers, then multiplies ℓ t ℓ s ℓ+1t word-bit-parallel in registers with W copies of the matrix α(p, ℓ) ⊗ α(p, ℓ+1) using optimized straight-line programs for both component matrices (that is, one implements with register arithmetic Yates's algorithm using straight-line (p) programs for α(p, ℓ) and α(p, ℓ+1) for the levels ℓ and ℓ + 1 computed in registers), and finally saves r ℓ+1 words to accelerator memory. Similar merging of levels may be used for the compressing layer (cf. §3.11). Our low-level (p) ℓ+3 · · · s (i) d(i) /W (p) d(p)s (p) d(p)t (i) d(i)t (p) ℓ r (p) 1 r (i) 1 s (i) 1 t (i) 2 t (p) ℓ (p) 2 r 24 Matti Karppa and Petteri Kaski implementation uses this two-level merging for pairs of levels closest to the inner layer. In particular one wants to optimize at levels closest to the inner layer because these layers process the longest vectors and thus do the most work. If more per-thread registers are available, more consecutive levels can be merged and computed in registers. (p) ℓ (p) ℓ , t (p) ℓ , s (p) ℓ , u Shifting levels between layers. The inner layer can use per-thread registers more efficiently by shifting expand- ing/compressing levels to the inner layer from the expanding/compressing layers. Assuming that the parameters , and that the inner layer originally implements M × M standard- of the expansion/compression are r basis matrix multiplication (cf. §3.10) using one W -bit-word per thread, the inner layer with shifting (i) first loads sℓtℓ + tℓuℓ words to each thread, (ii) expands in registers using straight-line programs for α(p, ℓ) and β(p, ℓ) to rℓ + rℓ words of operands per thread, (iii) executes in registers rℓ independent M × M matrix multiplications (essentially repeating the original inner layer rℓ times in registers) to obtain rℓ words of expanded results, and (iv) finally compresses to sℓuℓ words of results per thread using a straight-line program for γ(p, ℓ) and writes these results to accelerator memory. Our low-level implementation follows this strategy of shifting one level of expansion/compression to the inner layer to make more efficient use of per-thread registers and to perform less accelerator-memory transactions at the inner layer. (h) 2 · · · r (h) 1 r 3.16 Coordinating the Workload This section describes how the entire workload for the host and the N accelerators is coordinated at the host using host-threads and appropriate synchronization. Let us start by recalling that the top-level alternative-basis workload ( A, B) (cid:55)→ C consists of r (h) d(h) sub- instances that need to be (i) generated from A and B on the host, (ii) solved in an accelerator, and (iii) the solution aggregated to C on the host. This suggests processing the workload with N essentially independent pipelines imple- mented by one or more host-threads each so that each pipeline is responsible for keeping exactly one accelerator busy with work. Synchronization between pipelines is also required because the aggregation steps (56) of different pipelines can access and update the same subarray of C, which can lead to data races unless synchronization is used to ensure serial updates to each subarray. Our strategy is to implement the pipeline for each accelerator ℓ ∈ [N] using three buffers Tℓ, Sℓ, Qℓ in host memory and four host-threads: one thread to prepare the left input Tℓ in host memory, one thread to prepare the right input Sℓ in host memory, one thread to multiply Tℓ, Sℓ on accelerator ℓ to obtain the result Qℓ (including uploading the input and downloading the result), and one thread to aggregate the result Qℓ to the result C. Pseudocode for coordinating work at the host is given in Algorithm 3. This workload of 4N host-threads is deadlock- free due to the design of the pipeline -- blocking is needed to prevent race conditions occurring on the arrays Tℓ, Sℓ, Qℓ, the accelerator devices, and subarrays of the array C, but each pipeline will always be flushed eventually. We also observe that the order in which the subproblems (h1, . . . , hd(h)) are processed is insignificant as long as the order is well-defined, which is guaranteed by the locks on subarrays of C. Here we have presented a 4N -thread design with a single 4-thread pipeline for each of the N accelerators; the design can be easily extended to multiple pipelines competing for a single accelerator device to better saturate the accelerators with data as appropriate. 3.17 Parameterizing the Implementation Let us now turn to the detailed parameterization of the framework. Our current implementation uses the framework in a diagonal setting based on either of the two ⟨2, 2, 2⟩7 alternative-basis decompositions developed in §2.2 and §2.3, Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 25 Algorithm 3 Procedure for coordinating work at a host joined to N accelerators. The input arrays are A and B and the output array is C. The workload is formed of 4N threads. Each thread is associated with one of the N accelerators and a specific part of the pipeline for this accelerator. 1: procedure HostCoordinate( A, B) 2: (s) (s) Let Tℓ for ℓ ∈ [N] be an array of shape s 1 t 1 (s) (s) Let Sℓ for ℓ ∈ [N] be an array of shape t 1 u 1 (s) (s) Let Qℓ for ℓ ∈ [N] be an array of shape s 1 u 1 Initialize C as zero parallel for thread t ∈ [4N] do ℓ ← t mod N (h) for (h1, . . . , hd(h)) ∈ [r 1 if 0 ≤ t ≤ N − 1 then Block until Tℓ is free Initialize Tℓ as zero for (i1, j1, . . . , id(h), jd(h)) ∈ [s (h,d(h)) (h,1) h1i1 j1 · · · α hd(h) id(h) jd(h) Tℓ ← Tℓ + Ai1 j1···id(h) jd(h) ] × · · · × [r if α (h) end if else if N ≤ t ≤ 2N − 1 then end for Mark Tℓ occupied Block until Sℓ is free Initialize Sℓ as zero for (j1, k1 . . . , jd(h), kd(h)) ∈ [t (h,d(h)) (h,1) h1 j1k1 · · · β hd(h) jd(h) kd(h) Sℓ ← Sℓ + Bj1k1···jd(h) kd(h) if β end if , (s) d(s)s (s) d(s)t (s) d(s)s (s) · · · s d(s)t (s) · · · t d(s)u (s) · · · s d(s)u (p) (p) (p) · · · s 1 t d(p)t 1 (p) (p) (p) · · · t 1 u d(p)u 1 (p) (p) (p) · · · s 1 u d(p)u 1 (p) (i) (i) (i) (i) · · · s d(p)s 1 t d(i)t d(i) 1 (p) (i) (i) (i) (i) 1 · · · t d(p)t 1 u d(i)u d(i) (p) (i) (i) (i) (i) 1 · · · s d(p)s 1 u d(i)u d(i) d(h)] such that ℓ ≡d(h) i =1 hid(h) j =i +1 r (h) j (mod N) do (h) (h) 1 ] × [t 1 ] × · · · × [s (cid:44) 0 then (h) d(h)] × [t (h) d(h)] do (h) 1 ] × · · · × [t (h) d(h)] × [u (h) d(h)] do (h) 1 ] × [u (cid:44) 0 then 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: else if 2N ≤ t ≤ 3N − 1 then end for Mark Sℓ occupied Block until Tℓ and Sℓ are occupied and Qℓ is free Upload Tℓ and Sℓ to accelerator ℓ Mark Tℓ and Sℓ free Multiply Tℓ and Sℓ on accelerator ℓ to obtain the result Qℓ Download Qℓ from accelerator ℓ Mark Qℓ occupied else if 3N ≤ t ≤ 4N − 1 then Block until Qℓ is occupied for (i1, k2, . . . , id(h), kd(h)) ∈ [s (h,d(h)) id(h) kd(h) hd(h) (h) (h) 1 ] × · · · × [s 1 ] × [u (h,1) i1k1h1 · · · γ (cid:44) 0 then Acquire the lock for Ci1k1···id(h) kd(h) Ci1k1···id(h) kd(h) ← Ci1k1···id(h) kd(h) + Qℓ Release the lock for Ci1k1···id(h) kd(h) if γ (h) d(h)] × [u (h) d(h)] do 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: end procedure end for end for end if end if end for Mark Qℓ free 26 respectively. Accordingly, we set Matti Karppa and Petteri Kaski sd(h) j td(h) j ud(h) j rd(h) j = sd(s) j = td(s) j = ud(s) j = rd(s) j j j = sd(p) = td(p) = ud(p) j = rd(p) j = 2 , = 2 , = 2 , = 7 . When more efficient decompositions are discovered, these can be immediately used in the present framework. The present accelerator hardware has V -length vectorization of threads with V = 32, and the maximum word length supported per thread for memory transactions is W = 128 bits.7 We structure the inner layer to work with M × M 2 = VW and the M × M multiplication can work with instructions for shuffling data between matrices, M = 64, so that M threads across each V -length vector of threads in a thread array. Accordingly, we let the inner layer consists of a single level with (i) = 1, d s (i) 1 = t (i) 1 = u (i) 1 = M . This level works in the standard basis and does not use basis changes. The setting of the parameters d(h), d(s), and d(p) for best performance depends on the details of the target platform, such as the communication bandwidth available between the host and the accelerators, and the memory capacities in each component. Here we will give a discussion of considerations for parameterization that we expect to generalize and withstand the test of time. In the present case we have up to N = 8 accelerator devices available in the host. The following considerations affect the detailed parameterization: (1) The host layer should consist of as few levels d(h) as possible since the N accelerators with their parallel capacity have far superior aggregate instruction bandwidth and they should shoulder the bulk of the workload. Constraints on decreasing d(h) include the memory capacity at the host for maintaining the arrays Tℓ, Sℓ, Qℓ associated with each of the N host-side accelerator pipelines, as well as the bandwidth of the communication interconnect between the host and the accelerators -- large subinstances and their solutions take more time to transfer over the interconnect, but on the other hand take more time to solve on the accelerator, leaving the interconnect idle and thus enabling the hiding of transfer latency. When working with inputs close to the memory capacity of the host as per our engineering goal, the memory capacity at the host is the primary constraint that determines how many levels need to be performed at the host layer. (2) The accelerator serial layer in its d(s) levels enables each accelerator to accept larger inputs than would be otherwise possible by resorting to the accelerator parallel layer only. That is, because of limited memory available at the accelerator, the data-expanding/-compressing accelerator parallel layers can only be invoked on input sizes that tolerate a constant-factor expansion in the size of the data at each level, up to the inner layer. The serial layer is more space-efficient by working through the r cases at each level recursively and serially, reusing space, but becomes time-inefficient when the size of a case becomes so small that its parallel processing does not saturate the parallel hardware at the accelerator. (3) The accelerator parallel layer should consist of sufficiently many levels d(p) to saturate the parallel hardware of (s) ℓ the accelerator and to enable utilization of the optimizations in §3.15. 7The latter implemented with instructions that work with four consecutive 32-bit words. Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 27 The setting of the parameters d(h), d(s), and d(p) that gives the fastest overall performance may be done by first identifying the memory-capacity-induced constraints on the parameters and then, subject to these constraints, empirically finding the best parameter combination that optimizes performance among the relatively few choices that remain. For the detailed target platforms considered in what follows, subproblems of shape 65536 × 65536 (512 MiB per matrix) are small enough to be accommodated in the host-side arrays Tℓ, Sℓ, Qℓ for ℓ ∈ [N] alongside the input arrays. For example, with subproblems of shape 65536 × 65536 = 216 × 216 delegated to the accelerators, an input of shape 1048576 × 1048576 = 220 × 220 (1 Tib; or what is the same, 128 GiB per matrix) will perform d(h) = 20 − 16 = 4 levels in the host layer using a ⟨2, 2, 2⟩7-decomposition. On an input of shape 65536 × 65536 = 216 × 216, we parameterize the layers on the accelerators so that each accelerator performs two levels in the accelerator serial layer (d(s) = 2) using a ⟨2, 2, 2⟩7-decomposition, and then proceeds with the accelerator parallel layer. That is, the parallel layer is started with inputs of shape 16384 × 16384 = 214 × 214 (32 MiB per matrix). 3.18 Boolean Multiplication We also provide reference implementations for both Boolean and binary multiplication using the elementary cubic algorithm distributed to the accelerators. For an s × t by t × u multiplication to yield an s × u product, the N accelerators each work with subproblems of size s × t by t × u such that s divides s, t divides t, and u divides u. That is, the total workload of volume stu (in precise terms, stu +s(t −1)u bit operations) gets executed on the accelerators so that each unit of work for an accelerator has volume stu. Each accelerator executes a thread array of shape s such that 2/W threads are responsible for aggregating one M × M block of the s × u output, with low-level the least significant M 3. Empirically, s = t = u = 131072 and vectorization and vector shuffle operations used for each work unit of volume M M = 64 give best parameterization for our target hardware with W = 128 and V = M·M = 32. Coordination at the host W is simplified compared with Algorithm 3; namely, we partition the s × u result matrix to disjoint segments of size s × u, and set up threads on the host so that a single thread is responsible for each segment, which eliminates the need for synchronization between threads to guard against race conditions. In addition, we set up each host thread so that it integrates each s × u subresult it has downloaded from an accelerator in parallel when the next subproblem is being solved on the accelerator; this effectively hides the latency of integrating each subresult because the time to solve each subproblem is greater than the time to integrate the result. M × M·M M × u W 4 EXPERIMENTS This section describes the experiments we ran to evaluate the performance of the framework described in the previous section. In particular, our goal is to observe that a careful implementation of the framework enables efficient use of current multiple-accelerator systems at input sizes that are close to the host memory capacity of the entire system. The implementation was written in C++ [16], and the accelerator device routines were written in CUDA C [28]. Host- level parallelization was prepared using the OpenMP API [30]. We ran three sets of experiments: (i) alternative-basis binary matrix multiplication, (ii) classical binary matrix multiplication, and (iii) Boolean matrix multiplication. The single-accelerator version was evaluated at all powers of two until the subproblem size for the multiple-accelerator case. The multiple-accelerator case was evaluated up to one terabinary-bit (1 Tib) input size (n = 220). 4.1 Hardware configuration The target hardware for our implementation was an NVIDIA DGX-1 system with eight NVIDIA Tesla V100 accelerators, 512 GiB of memory, and 2 × 20 CPU cores. We also ran experiments on two less powerful configurations: One with 28 Matti Karppa and Petteri Kaski Table 1. Comparison of the hardware used in our experiments. System Dell PowerEdge C4130 Dell PowerEdge C4130 NVIDIA DGX-1 CPUs 2 × 6-core Xeon E5 2620v3 2.50 GHz (Haswell) 2 × 12-core Xeon E5-2680v3 2.50 GHz (Haswell) 2×20-core Xeon E5- 2698v4 (Broadwell) CPU RAM 8 × 16 GiB = 128 GiB DDR4-2133 16×16 GiB = 256 GiB DDR4-2400 GPUs 4 × 2 Tesla K80 RAM/GPU 12 GiB GDDR5 4 × Tesla P100 16 GiB HBM2 16×32 GiB = 512 GiB DDR4-2133 8 × Tesla V100 SXM2 16 GiB HBM2 Table 2. Peak performance of the GPU accelerators used in our experiments. This presents an upper bound on the number of bit operations that could theoretically be achieved by the hardware. GPU 4 × Tesla K80 [26] 4 × Tesla P100 [27] 8 × Tesla V100 [29] #Cores 8 · 2496 4 · 3584 8 · 5120 Boost clock 875 MHz 1480 MHz 1530 MHz Peak performance 8 · 2496 · 875 · 106 · 32 ≈ 5.60 · 1014 bops 4 · 3584 · 1480 · 106 · 32 ≈ 6.79 · 1014 bops 8 · 5120 · 1530 · 106 · 32 ≈ 2.01 · 1015 bops four NVIDIA Tesla P100 accelerators, 256 GiB of memory, and 2 × 12 CPU cores, and one with four NVIDIA Tesla K80 accelerators, 128 GiB of memory, and 2 × 6 CPU cores. A more detailed description of the hardware configurations is given in Table 1. Table 2 lists technical details of the accelerators: the number of cores, boost clock speed, and the peak performance that presents an upper bound on the number of bit operations (bops) that could be theoretically achieved by simultaneous use of all the accelerators in each configuration. In practice, this upper bound is unattainable due to thermal effects and the need to coordinate data across the storage hierarchy ranging from per-thread registers to the global memory of each accelerator. Yet this upper bound presents an uncompromising benchmark against which to measure the performance of the actual implementation. The power consumption of the systems used in our experiments is listed in Table 3. The table lists the nominal power consumption of the CPUs and GPUs, and the system power intake as indicated in the basic system documentation of each vendor. While one may perhaps expect the CPUs and GPUs to operate essentially at their maximum power, the given system power intake is perhaps expected to be higher than the actual power usage. While we would like to be able to measure the actual energy consumption by each system and its components during the computation more precisely, such instrumentation has been unavailable to us, so in the present experiments we resort to using the tabulated power values as the mean power over the duration of each computation, which then gives us a crude approximation of the energy used by each computation. In particular, we would like to highlight the importance of implementation engineering for low energy consumption as an important goal beyond the present study, with the hope of having in the future available more fine-grained measurement tools. Finally, to record a rough benchmark of the performance of the different system components in our main target configuration, measurements on the bandwith for transferring data within host memory, and between the accelerator device and the host system are shown in Tables 4 and 5, respectively. Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 29 Table 3. Power consumption of the system and the GPUs. System C4130/K80 C4130/P100 DGX-1/V100 System watts CPU watts GPU watts 2 × 85 W 4 × 300 W 2000 W 2 × 120 W 4 × 300 W 2000 W 2 × 135 W 8 × 300 W 3500 W Table 4. Measured host-memory bandwiths of the DGX-1 node. The values shown are averages of five consecutive repetitions. Benchmark Read from linear addresses (consecutive 64-bit words) Write to linear addresses (consecutive 64-bit words) Read from random addresses (individual 64-bit words) Read from random addresses (full cache lines) Single core 9.08 GiB/s 6.92 GiB/s 0.17 GiB/s 0.78 GiB/s All cores 37.28 GiB/s 19.93 GiB/s 3.13 GiB/s 14.09 GiB/s Table 5. Measured memory bandwiths of transferring data within a single GPU device or between the host and the GPU device. Measurements on the DGX-1 node. Benchmark Host to device Device to host Device to device Bandwith 10.5 GiB/s 11.8 GiB/s 704.9 GiB/s Table 6. Running times for the routine that transposes each of the 64 × 64 submatrices. The procedure is parallelized and works using 32-bit words as the base data type. All runtimes reported are the median of five repeats on the DGX-1 node. n 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 64 × 64 submatrix transpose time 1.56 · 10−5 s 3.69 · 10−5 s 1.23 · 10−4 s 4.63 · 10−4 s 1.84 · 10−3 s 7.45 · 10−3 s 2.98 · 10−2 s 1.29 · 10−1 s 4.94 · 10−1 s 2.03 · 100 s 7.99 · 100 s 4.2 Results Runtimes, effective bit operations per second, and energy consumption at different sizes of input are shown in Tables 8, 9, 10, 11, and 12. All values shown are medians over five consecutive runs. Since the instrumentation does not permit us to measure the actual power use, two different values are shown for the energy consumption: one is computed assuming full CPU utilization with nominal CPU wattage and the maximum wattage of a single GPU accelerator times the number of GPUs in use, and the other by simply taking the maximum power intake of the entire system in account. We expect the actual energy consumption to lie somewhere between these two values, since the former ignores macroscopic 30 Matti Karppa and Petteri Kaski Table 7. Scalability of running times for the various change-of-basis routines. The forward columns show the running times for the forward transformations (that is, corresponding to ψ and ϕ) whereas the inverse columns show the inverse transformations (corresponding to χ ). For the chaining variant, measurements were made to confirm that accounting for transposed data in the right-hand operand has no effect on the running time. The procedures have been crafted using AVX2 intrinsics and to work with 512-bit cache lines on the DGX-1 host hardware. All runtimes reported are the median of five repeats on the DGX-1 node. n 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 Forward self-inverse 3.28 · 10−5 s 4.70 · 10−5 s 8.10 · 10−5 s 1.80 · 10−4 s 7.15 · 10−4 s 2.06 · 10−2 s 9.36 · 10−2 s 4.10 · 10−1 s 1.81 · 100 s 7.82 · 100 s 3.45 · 101 s Inverse self-inverse 3.42 · 10−5 s 4.88 · 10−5 s 8.80 · 10−5 s 2.09 · 10−4 s 8.78 · 10−4 s 2.56 · 10−2 s 1.20 · 10−1 s 5.30 · 10−1 s 2.31 · 100 s 1.01 · 101 s 4.41 · 101 s Forward chain left 3.41 · 10−5 s 5.02 · 10−5 s 9.42 · 10−5 s 2.04 · 10−4 s 8.55 · 10−4 s 2.59 · 10−2 s 1.20 · 10−1 s 5.27 · 10−1 s 2.31 · 100 s 1.01 · 101 s 4.46 · 101 s Forward chain right 3.44 · 10−5 s 5.13 · 10−5 s 9.33 · 10−5 s 2.07 · 10−4 s 8.68 · 10−4 s 2.61 · 10−2 s 1.20 · 10−1 s 5.30 · 10−1 s 2.33 · 100 s 1.01 · 101 s 4.46 · 101 s Inverse chain 3.41 · 10−5 s 5.00 · 10−5 s 9.35 · 10−5 s 2.05 · 10−4 s 8.67 · 10−4 s 2.59 · 10−2 s 1.20 · 10−1 s 5.26 · 10−1 s 2.32 · 100 s 1.01 · 101 s 4.40 · 101 s factors such as memory and cooling, and the latter is simply the maximum amount of power that the entire system can supply. 3 − n 2 is used to compute (2n In Tables 8 and 9, given runtime T , the exact bit operation count of 2n 2)/T , the number of individual bit operations performed in a second on average. The same number is also used in Tables 10, 11, and 12 to compute the effective bit operation count; that is, to highlight the relative difference in performance, we show how many elementary bit operations per second a classical implementation operating on individual bits would have to perform to achieve the same wall-clock runtime as the alternative-basis design. 3 − n The times reported here do not include the time required for data permutation or change of basis operations at the host; it is assumed that the data is already in the desired format. Table 7 shows the runtime of an implementation of the change of basis with AVX2 vector-intrinsics on the DGX-1 host. It can be seen that, in the case of the best-performing algorithm (with self-inversion), the forward-transformation takes approximately 34.5 seconds per 1-Tib input matrix, and 44.1 seconds for the inverse transformation of the result. The favorable difference is due to the structure of the transformation which means that only 1 of the 4 subarrays needs to be modified at any level of recursion. Also, to preserve linearity of access in memory, we assume that the right-hand-side operand is transposed. For Strassen-like algorithms, this needs to be only done for the 64 × 64 submatrices; we implemented a parallelized, recursive transpose function using word-operations that can perform the transpose for all 228 submatrices of a 1-TiB input matrix in 7.99 s (median of five consecutive runs, see Table 6 for scalability). With two 1-Tib input matrices, on the DGX-1, the classical cubic algorithm runs for 1880 and 2110 seconds, and performs over 1.23 and 1.09 peta-bit-operations per second, in the binary and Boolean cases, respectively. This means we are able to achieve over 50 % of the theoretical maximum peak performance of 2.01 Pbops per second. At the assumed level of power used, this means that one such multiplication takes at most 1.83 and 2.05 kWh of electricity, or 2.85 and 3.20 pJ/bop, in the binary and Boolean cases, respectively. In both cases, a single V100 accelerator processes a 131072 × 131072-subproblem in just under 30 seconds, meaning that the runtime obtained here is accelerator-bound. The time required for data upload and download, and result integration of individual subproblems is in the order of seconds, making it negligible in comparison and effectively hidden by the host-side pipeline design. Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 31 Due to their limited memory, the P100 and K80 systems can only be evaluated up to n = 524288. However, otherwise the results are very similar to those of the DGX-1, apart from worse energy consumption and slower processing power, owing to the older hardware in use. As an interesting artifact of the low-level implementation, we see in the Tables 8 and 9 that, with the V100 and P100 accelerators, the Boolean version is slightly slower than the binary version of the algorithm, even though the only differences in code are with the replacement of the popcount-parity check with the nonzero test, and the replacement of XOR with OR. Furthermore, the difference is inverse with the K80 accelerator. This artifact appears to be due to the optimizations performed by the NVIDIA compiler: On the P100 and the V100, the compiler compresses several bitwise operations into one LOP3.LUT instruction, or arbitrary trinary logical instructions, and for one reason or another, the sequence is slightly more efficient in the XOR case. However, these instructions are not available on the K80. For binary multiplication, the Strassen-Winograd design in standard basis executes in 2610 seconds, the alternative basis with self-inverse in 821 seconds, and the alternative basis with chaining in 972 seconds, on 1-Tib inputs on the DGX-1, and achieve 0.8, 2.8, and 2.3 effective Pbops per second, respectively. The best alternative-basis variant exceeds the theoretical peak hardware performance of the elementary algorithm by more than 30 %. One alternative-basis multiplication takes less than 0.8 kWh of electricity, or less than 1.26 pJ/bop. This is less than one half of that required by the cubic multiplication algorithm. Furthermore, considering that a subproblem of size n = 65536 can be solved by an accelerator in 1.87 seconds, this means that the available host-side bandwidth forms the bottleneck (cf. Tables 4 and 5). Indeed, if subproblem construction and aggregation as well as the data transfer over the PCIe link were completely 8 × 1.87 s ≈ 560 s. This in particular highlights the need to carefully free, the multiplication could be executed in 74 engineer workloads and their pipelining both at the host and at the accelerators to obtain balanced overall performance from a multi-accelerator system. Tables 11 and 12 also show that the present approach generalizes to alternative multiple-accelerator configurations, even though the more limited memory on the K80 accelerators requires a smaller subproblem size. ACKNOWLEDGMENTS. The research leading to these results has received funding from the European Research Council under the European Union's Seventh Framework Programme (FP/2007-2013) / ERC Grant Agreement 338077 "Theory and Practice of Advanced Search and Enumeration". We gratefully acknowledge the use of computational resources provided by the Aalto Science-IT project at Aalto University. REFERENCES [1] V. L. Arlazarov, E. A. Dinic, M. A. Kronrod, and I. A. Faradzhev. 1970. On economical construction of the transitive closure of an oriented graph. Sov. Math., Dokl. 11 (1970), 1209 -- 1210. [2] Grey Ballard, James Demmel, Olga Holtz, Benjamin Lipshitz, and Oded Schwartz. 2012. Communication-optimal parallel algorithm for Strassen's matrix multiplication. In 24th ACM Symposium on Parallelism in Algorithms and Architectures, SPAA '12, Pittsburgh, PA, USA, June 25-27, 2012, Guy E. Blelloch and Maurice Herlihy (Eds.). ACM, 193 -- 204. https://doi.org/10.1145/2312005.2312044 [3] Nikhil Bansal and Ryan Williams. 2012. Regularity Lemmas and Combinatorial Algorithms. Theory of Computing 8, 1 (2012), 69 -- 94. https: //doi.org/10.4086/toc.2012.v008a004 [4] Austin R. Benson and Grey Ballard. 2015. A framework for practical parallel fast matrix multiplication. In Proceedings of the 20th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP 2015, San Francisco, CA, USA, February 7-11, 2015, Albert Cohen and David Grove (Eds.). ACM, 42 -- 53. https://doi.org/10.1145/2688500.2688513 [5] Nader H. Bshouty. 1995. On the Additive Complexity of 2 × 2 Matrix Multiplication. Inf. Process. Lett. 56, 6 (1995), 329 -- 335. https://doi.org/10.1016/ 0020-0190(95)00176-X 32 Matti Karppa and Petteri Kaski Table 8. Scalability of the running times, the bit operations per second, and the energy requirements for the classical (cubic) binary (AND/XOR) multiplication procedure. The subproblem size is 131072 for the V100 (DGX-1) and P100 accelerators, and 65536 for the K80. The number of bit operations is 2n3 − n2. The first two energy columns are computed assuming full usage of CPU Watts and the Wattage of a single GPU times the number GPUs in use. The latter two columns are computed using the full system power intake. GPU V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 P100 P100 P100 P100 P100 P100 P100 P100 P100 P100 K80 K80 K80 K80 K80 K80 K80 K80 K80 K80 n 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 d 1 1 1 1 1 1 1 1 8 8 8 1 1 1 1 1 1 1 1 4 4 1 1 1 1 1 1 1 8 8 8 Runtime 1.07 · 10−4 s 2.15 · 10−4 s 1.16 · 10−3 s 8.28 · 10−3 s 5.21 · 10−2 s 4.09 · 10−1 s 3.28 · 100 s 2.65 · 101 s 6.76 · 101 s 2.40 · 102 s 1.88 · 103 s 6.22 · 10−5 s 2.96 · 10−4 s 1.88 · 10−3 s 1.25 · 10−2 s 8.64 · 10−2 s 6.83 · 10−1 s 5.46 · 100 s 4.37 · 101 s 9.57 · 101 s 7.24 · 102 s 2.27 · 10−4 s 1.95 · 10−3 s 9.94 · 10−3 s 6.44 · 10−2 s 4.28 · 10−1 s 3.43 · 100 s 2.86 · 101 s 6.34 · 101 s 2.51 · 102 s 1.98 · 103 s Bop/s 20.22 Tbop/s 79.94 Tbop/s 118.78 Tbop/s 132.83 Tbop/s 169.11 Tbop/s 172.46 Tbop/s 171.74 Tbop/s 170.14 Tbop/s 533.46 Tbop/s 1204.30 Tbop/s 1230.18 Tbop/s 34.56 Tbop/s 58.21 Tbop/s 73.31 Tbop/s 88.56 Tbop/s 101.90 Tbop/s 103.03 Tbop/s 103.15 Tbop/s 103.21 Tbop/s 376.85 Tbop/s 398.11 Tbop/s 9.47 Tbop/s 8.83 Tbop/s 13.84 Tbop/s 17.09 Tbop/s 20.59 Tbop/s 20.55 Tbop/s 19.70 Tbop/s 71.11 Tbop/s 143.73 Tbop/s 146.29 Tbop/s Energy/bop 132.06 pJ/bop 33.40 pJ/bop 22.48 pJ/bop 20.10 pJ/bop 15.79 pJ/bop 15.48 pJ/bop 15.55 pJ/bop 15.69 pJ/bop 5.01 pJ/bop 2.22 pJ/bop 2.17 pJ/bop 41.67 pJ/bop 24.74 pJ/bop 19.64 pJ/bop 16.26 pJ/bop 14.13 pJ/bop 13.98 pJ/bop 13.96 pJ/bop 13.95 pJ/bop 3.82 pJ/bop 3.62 pJ/bop 144.69 pJ/bop 155.16 pJ/bop 99.01 pJ/bop 80.15 pJ/bop 66.52 pJ/bop 66.68 pJ/bop 69.54 pJ/bop 19.27 pJ/bop 9.53 pJ/bop 9.36 pJ/bop Total energy 7.88 · 10−8 kWh 1.60 · 10−7 kWh 8.59 · 10−7 kWh 6.14 · 10−6 kWh 3.86 · 10−5 kWh 3.03 · 10−4 kWh 2.44 · 10−3 kWh 1.97 · 10−2 kWh 5.01 · 10−2 kWh 1.78 · 10−1 kWh 1.40 · 100 kWh 2.49 · 10−8 kWh 1.19 · 10−7 kWh 7.50 · 10−7 kWh 4.97 · 10−6 kWh 3.46 · 10−5 kWh 2.74 · 10−4 kWh 2.19 · 10−3 kWh 1.75 · 10−2 kWh 3.83 · 10−2 kWh 2.90 · 10−1 kWh 8.63 · 10−8 kWh 7.41 · 10−7 kWh 3.78 · 10−6 kWh 2.45 · 10−5 kWh 1.63 · 10−4 kWh 1.31 · 10−3 kWh 1.09 · 10−2 kWh 2.42 · 10−2 kWh 9.54 · 10−2 kWh 7.50 · 10−1 kWh System en./bop 173.12 pJ/bop 43.79 pJ/bop 29.47 pJ/bop 26.35 pJ/bop 20.70 pJ/bop 20.29 pJ/bop 20.38 pJ/bop 20.57 pJ/bop 6.56 pJ/bop 2.91 pJ/bop 2.85 pJ/bop 57.87 pJ/bop 34.36 pJ/bop 27.28 pJ/bop 22.58 pJ/bop 19.63 pJ/bop 19.41 pJ/bop 19.39 pJ/bop 19.38 pJ/bop 5.31 pJ/bop 5.02 pJ/bop 211.23 pJ/bop 226.50 pJ/bop 144.54 pJ/bop 117.00 pJ/bop 97.11 pJ/bop 97.34 pJ/bop 101.52 pJ/bop 28.13 pJ/bop 13.91 pJ/bop 13.67 pJ/bop Total system en. 1.04 · 10−7 kWh 2.09 · 10−7 kWh 1.13 · 10−6 kWh 8.05 · 10−6 kWh 5.06 · 10−5 kWh 3.97 · 10−4 kWh 3.19 · 10−3 kWh 2.58 · 10−2 kWh 6.57 · 10−2 kWh 2.33 · 10−1 kWh 1.83 · 100 kWh 3.46 · 10−8 kWh 1.64 · 10−7 kWh 1.05 · 10−6 kWh 6.90 · 10−6 kWh 4.80 · 10−5 kWh 3.80 · 10−4 kWh 3.04 · 10−3 kWh 2.43 · 10−2 kWh 5.32 · 10−2 kWh 4.03 · 10−1 kWh 1.26 · 10−7 kWh 1.09 · 10−6 kWh 5.52 · 10−6 kWh 3.58 · 10−5 kWh 2.38 · 10−4 kWh 1.91 · 10−3 kWh 1.59 · 10−2 kWh 3.52 · 10−2 kWh 1.40 · 10−1 kWh 1.10 · 100 kWh [6] Murat Cenk and M. Anwar Hasan. 2017. On the arithmetic complexity of Strassen-like matrix multiplications. J. Symbolic Comput. 80, part 2 (2017), 484 -- 501. https://doi.org/10.1016/j.jsc.2016.07.004 [7] Timothy M. Chan. 2015. Speeding up the Four Russians Algorithm by About One More Logarithmic Factor. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, Piotr Indyk (Ed.). SIAM, 212 -- 217. https://doi.org/10.1137/1.9781611973730.16 [8] Don Coppersmith and Shmuel Winograd. 1990. Matrix multiplication via arithmetic progressions. J. Symb. Comput. 9, 3 (1990), 251 -- 280. https://doi.org/10.1016/S0747-7171(08)80013-2 [9] Paolo D'Alberto, Marco Bodrato, and Alexandru Nicolau. 2011. Exploiting parallelism in matrix-computation kernels for symmetric multiprocessor systems: Matrix-multiplication and matrix-addition algorithm optimizations by software pipelining and threads allocation. ACM Trans. Math. Softw. 38, 1 (2011), 2:1 -- 2:30. https://doi.org/10.1145/2049662.2049664 [10] A. M. Davie and A. J. Stothers. 2013. Improved bound for complexity of matrix multiplication. Proc. R. Soc. Edinb., Sect. A, Math. 143, 2 (2013), 351 -- 369. https://doi.org/10.1017/S0308210511001648 [11] Michael J. Fischer and Albert R. Meyer. 1971. Boolean Matrix Multiplication and Transitive Closure. In 12th Annual Symposium on Switching and Automata Theory, East Lansing, Michigan, USA, October 13-15, 1971. IEEE Computer Society, 129 -- 131. https://doi.org/10.1109/SWAT.1971.4 [12] M. E. Furman. 1970. Application of a method of fast multiplication of matrices in the problem of finding the transitive closure of a graph. Sov. Math., Dokl. 11 (1970), 1252. Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 33 Table 9. Scalability of the running times, the bit operations per second, and the energy requirements for the classic (cubic) Boolean (AND/OR) multiplication procedure. The subproblem size is 131072 for the V100 (DGX-1) and P100 accelerators, and 65536 for the K80. The number of bit operations is 2n3 − n2. The first two energy columns are computed assuming full usage of CPU Watts and the Wattage of a single GPU times the number GPUs in use. The latter two columns are computed using the full system power intake. GPU V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 P100 P100 P100 P100 P100 P100 P100 P100 P100 P100 K80 K80 K80 K80 K80 K80 K80 K80 K80 K80 n 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 d 1 1 1 1 1 1 1 1 8 8 8 1 1 1 1 1 1 1 1 4 4 1 1 1 1 1 1 1 8 8 8 Runtime 9.84 · 10−5 s 1.93 · 10−4 s 1.30 · 10−3 s 7.86 · 10−3 s 5.94 · 10−2 s 4.69 · 10−1 s 3.73 · 100 s 2.98 · 101 s 7.51 · 101 s 2.71 · 102 s 2.11 · 103 s 5.09 · 10−5 s 2.72 · 10−4 s 1.62 · 10−3 s 1.16 · 10−2 s 8.90 · 10−2 s 7.09 · 10−1 s 5.67 · 100 s 4.53 · 101 s 9.89 · 101 s 7.50 · 102 s 2.15 · 10−4 s 1.21 · 10−3 s 8.08 · 10−3 s 5.52 · 10−2 s 3.26 · 10−1 s 2.53 · 100 s 2.11 · 101 s 4.63 · 101 s 1.80 · 102 s 1.41 · 103 s Bop/s 21.83 Tbop/s 89.25 Tbop/s 106.45 Tbop/s 140.00 Tbop/s 148.16 Tbop/s 150.33 Tbop/s 151.07 Tbop/s 151.27 Tbop/s 479.81 Tbop/s 1065.59 Tbop/s 1094.98 Tbop/s 42.24 Tbop/s 63.35 Tbop/s 85.13 Tbop/s 95.10 Tbop/s 98.89 Tbop/s 99.29 Tbop/s 99.40 Tbop/s 99.45 Tbop/s 364.55 Tbop/s 384.46 Tbop/s 10.03 Tbop/s 14.22 Tbop/s 17.02 Tbop/s 19.92 Tbop/s 27.06 Tbop/s 27.82 Tbop/s 26.72 Tbop/s 97.47 Tbop/s 200.24 Tbop/s 205.47 Tbop/s Energy/bop 122.33 pJ/bop 29.92 pJ/bop 25.08 pJ/bop 19.07 pJ/bop 18.02 pJ/bop 17.76 pJ/bop 17.67 pJ/bop 17.65 pJ/bop 5.56 pJ/bop 2.51 pJ/bop 2.44 pJ/bop 34.09 pJ/bop 22.73 pJ/bop 16.91 pJ/bop 15.14 pJ/bop 14.56 pJ/bop 14.50 pJ/bop 14.49 pJ/bop 14.48 pJ/bop 3.95 pJ/bop 3.75 pJ/bop 136.60 pJ/bop 96.35 pJ/bop 80.48 pJ/bop 68.77 pJ/bop 50.62 pJ/bop 49.24 pJ/bop 51.27 pJ/bop 14.06 pJ/bop 6.84 pJ/bop 6.67 pJ/bop Total energy 7.30 · 10−8 kWh 1.43 · 10−7 kWh 9.58 · 10−7 kWh 5.83 · 10−6 kWh 4.41 · 10−5 kWh 3.48 · 10−4 kWh 2.77 · 10−3 kWh 2.21 · 10−2 kWh 5.57 · 10−2 kWh 2.01 · 10−1 kWh 1.57 · 100 kWh 2.04 · 10−8 kWh 1.09 · 10−7 kWh 6.46 · 10−7 kWh 4.63 · 10−6 kWh 3.56 · 10−5 kWh 2.84 · 10−4 kWh 2.27 · 10−3 kWh 1.82 · 10−2 kWh 3.96 · 10−2 kWh 3.00 · 10−1 kWh 8.15 · 10−8 kWh 4.60 · 10−7 kWh 3.08 · 10−6 kWh 2.11 · 10−5 kWh 1.24 · 10−4 kWh 9.63 · 10−4 kWh 8.02 · 10−3 kWh 1.76 · 10−2 kWh 6.85 · 10−2 kWh 5.34 · 10−1 kWh System en./bop 160.36 pJ/bop 39.22 pJ/bop 32.88 pJ/bop 25.00 pJ/bop 23.62 pJ/bop 23.28 pJ/bop 23.17 pJ/bop 23.14 pJ/bop 7.29 pJ/bop 3.28 pJ/bop 3.20 pJ/bop 47.35 pJ/bop 31.57 pJ/bop 23.49 pJ/bop 21.03 pJ/bop 20.22 pJ/bop 20.14 pJ/bop 20.12 pJ/bop 20.11 pJ/bop 5.49 pJ/bop 5.20 pJ/bop 199.41 pJ/bop 140.66 pJ/bop 117.49 pJ/bop 100.40 pJ/bop 73.90 pJ/bop 71.88 pJ/bop 74.84 pJ/bop 20.52 pJ/bop 9.99 pJ/bop 9.73 pJ/bop Total system en. 9.57 · 10−8 kWh 1.88 · 10−7 kWh 1.26 · 10−6 kWh 7.64 · 10−6 kWh 5.78 · 10−5 kWh 4.56 · 10−4 kWh 3.63 · 10−3 kWh 2.90 · 10−2 kWh 7.31 · 10−2 kWh 2.63 · 10−1 kWh 2.05 · 100 kWh 2.83 · 10−8 kWh 1.51 · 10−7 kWh 8.97 · 10−7 kWh 6.43 · 10−6 kWh 4.95 · 10−5 kWh 3.94 · 10−4 kWh 3.15 · 10−3 kWh 2.52 · 10−2 kWh 5.50 · 10−2 kWh 4.17 · 10−1 kWh 1.19 · 10−7 kWh 6.72 · 10−7 kWh 4.49 · 10−6 kWh 3.07 · 10−5 kWh 1.81 · 10−4 kWh 1.41 · 10−3 kWh 1.18 · 10−2 kWh 2.57 · 10−2 kWh 10.00 · 10−2 kWh 7.80 · 10−1 kWh [13] Brian Grayson and Robert A. van de Geijn. 1996. A High Performance Parallel Strassen Implementation. Parallel Processing Letters 6, 1 (1996), 3 -- 12. https://doi.org/10.1142/S0129626496000029 [14] Jianyu Huang, Leslie Rice, Devin A. Matthews, and Robert A. van de Geijn. 2017. Generating Families of Practical Fast Matrix Multiplication Algorithms. In 2017 IEEE International Parallel and Distributed Processing Symposium, IPDPS 2017, Orlando, FL, USA, May 29 - June 2, 2017. IEEE Computer Society, 656 -- 667. https://doi.org/10.1109/IPDPS.2017.56 [15] Jianyu Huang, Tyler M. Smith, Greg M. Henry, and Robert A. van de Geijn. 2016. Strassen's algorithm reloaded. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC 2016, Salt Lake City, UT, USA, November 13-18, 2016, John West and Cherri M. Pancake (Eds.). IEEE Computer Society, 690 -- 701. https://doi.org/10.1109/SC.2016.58 [16] International Organization for Standardization. 2017. Programming Languages -- C++. Standard. ISO/IEC 14882:2017. [17] Alon Itai and Michael Rodeh. 1978. Finding a Minimum Circuit in a Graph. SIAM J. Comput. 7, 4 (1978), 413 -- 423. https://doi.org/10.1137/0207033 [18] Igor Kaporin. 1999. A practical algorithm for faster matrix multiplication. Numer. Linear Algebra Appl. 6, 8 (1999), 687 -- 700. https://doi.org/10.1002/ (SICI)1099-1506(199912)6:8<687::AID-NLA177>3.0.CO;2-I [19] Igor Kaporin. 2004. The aggregation and cancellation techniques as a practical tool for faster matrix multiplication. Theoret. Comput. Sci. 315, 2-3 (2004), 469 -- 510. https://doi.org/10.1016/j.tcs.2004.01.004 [20] Elaye Karstadt and Oded Schwartz. 2017. Matrix Multiplication, a Little Faster. In Proceedings of the 29th ACM Symposium on Parallelism in Algorithms and Architectures, SPAA 2017, Washington DC, USA, July 24-26, 2017, Christian Scheideler and Mohammad Taghi Hajiaghayi (Eds.). ACM, 101 -- 110. 34 Matti Karppa and Petteri Kaski Table 10. Scalability the running times, the effective bit operations per second, and the energy requirements for the standard-basis binary Strassen-Winograd multiplication procedure. The subproblem size is 65536 for the V100 (DGX-1) and P100 accelerators, and 32768 for the K80. The effective number of bit operations is computed with the same value of 2n3 − n2 as in the cubic case to highlight the relative difference in performance. The first two energy columns are computed assuming full usage of CPU Watts and the Wattage of a single GPU times the number GPUs in use. The latter two columns are computed using the full system power intake. The right-hand-side input matrix is assumed to be pre-transposed; the times reported here do not include the transposition of submatrices. GPU V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 P100 P100 P100 P100 P100 P100 P100 P100 P100 P100 K80 K80 K80 K80 K80 K80 K80 K80 K80 K80 n 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 d 1 1 1 1 1 1 1 8 8 8 8 1 1 1 1 1 1 1 4 4 4 1 1 1 1 1 1 8 8 8 8 Runtime 1.67 · 10−4 s 2.72 · 10−4 s 1.05 · 10−3 s 5.86 · 10−3 s 3.97 · 10−2 s 2.81 · 10−1 s 1.97 · 100 s 3.74 · 100 s 2.34 · 101 s 2.66 · 102 s 2.61 · 103 s 1.39 · 10−4 s 3.34 · 10−4 s 1.53 · 10−3 s 9.12 · 10−3 s 5.76 · 10−2 s 4.08 · 10−1 s 2.87 · 100 s 7.37 · 100 s 4.37 · 101 s 3.02 · 102 s 3.07 · 10−4 s 1.19 · 10−3 s 6.96 · 10−3 s 4.08 · 10−2 s 2.35 · 10−1 s 1.62 · 100 s 2.34 · 100 s 1.36 · 101 s 1.33 · 102 s 1.60 · 103 s Effective bop/s 12.92 Tbop/s 63.24 Tbop/s 132.07 Tbop/s 187.69 Tbop/s 222.03 Tbop/s 251.04 Tbop/s 285.95 Tbop/s 1205.38 Tbop/s 1543.54 Tbop/s 1086.54 Tbop/s 884.18 Tbop/s 15.54 Tbop/s 51.50 Tbop/s 90.17 Tbop/s 120.55 Tbop/s 152.77 Tbop/s 172.84 Tbop/s 196.61 Tbop/s 611.79 Tbop/s 824.68 Tbop/s 956.67 Tbop/s 7.00 Tbop/s 14.50 Tbop/s 19.77 Tbop/s 26.99 Tbop/s 37.44 Tbop/s 43.51 Tbop/s 241.49 Tbop/s 331.26 Tbop/s 272.80 Tbop/s 180.20 Tbop/s Energy/bop 206.67 pJ/bop 42.22 pJ/bop 20.22 pJ/bop 14.23 pJ/bop 12.03 pJ/bop 10.64 pJ/bop 9.34 pJ/bop 2.22 pJ/bop 1.73 pJ/bop 2.46 pJ/bop 3.02 pJ/bop 92.64 pJ/bop 27.96 pJ/bop 15.97 pJ/bop 11.94 pJ/bop 9.43 pJ/bop 8.33 pJ/bop 7.32 pJ/bop 2.35 pJ/bop 1.75 pJ/bop 1.51 pJ/bop 195.67 pJ/bop 94.47 pJ/bop 69.31 pJ/bop 50.76 pJ/bop 36.59 pJ/bop 31.49 pJ/bop 5.67 pJ/bop 4.14 pJ/bop 5.02 pJ/bop 7.60 pJ/bop Total energy 1.24 · 10−7 kWh 2.02 · 10−7 kWh 7.72 · 10−7 kWh 4.35 · 10−6 kWh 2.94 · 10−5 kWh 2.08 · 10−4 kWh 1.47 · 10−3 kWh 2.78 · 10−3 kWh 1.74 · 10−2 kWh 1.97 · 10−1 kWh 1.94 · 100 kWh 5.53 · 10−8 kWh 1.34 · 10−7 kWh 6.10 · 10−7 kWh 3.65 · 10−6 kWh 2.31 · 10−5 kWh 1.63 · 10−4 kWh 1.15 · 10−3 kWh 2.95 · 10−3 kWh 1.75 · 10−2 kWh 1.21 · 10−1 kWh 1.17 · 10−7 kWh 4.51 · 10−7 kWh 2.65 · 10−6 kWh 1.56 · 10−5 kWh 8.95 · 10−5 kWh 6.16 · 10−4 kWh 8.88 · 10−4 kWh 5.18 · 10−3 kWh 5.03 · 10−2 kWh 6.09 · 10−1 kWh System en./bop 270.92 pJ/bop 55.34 pJ/bop 26.50 pJ/bop 18.65 pJ/bop 15.76 pJ/bop 13.94 pJ/bop 12.24 pJ/bop 2.90 pJ/bop 2.27 pJ/bop 3.22 pJ/bop 3.96 pJ/bop 128.67 pJ/bop 38.84 pJ/bop 22.18 pJ/bop 16.59 pJ/bop 13.09 pJ/bop 11.57 pJ/bop 10.17 pJ/bop 3.27 pJ/bop 2.43 pJ/bop 2.09 pJ/bop 285.64 pJ/bop 137.91 pJ/bop 101.18 pJ/bop 74.10 pJ/bop 53.42 pJ/bop 45.97 pJ/bop 8.28 pJ/bop 6.04 pJ/bop 7.33 pJ/bop 11.10 pJ/bop Total system en. 1.62 · 10−7 kWh 2.65 · 10−7 kWh 1.02 · 10−6 kWh 5.70 · 10−6 kWh 3.86 · 10−5 kWh 2.73 · 10−4 kWh 1.92 · 10−3 kWh 3.64 · 10−3 kWh 2.27 · 10−2 kWh 2.58 · 10−1 kWh 2.54 · 100 kWh 7.68 · 10−8 kWh 1.86 · 10−7 kWh 8.47 · 10−7 kWh 5.07 · 10−6 kWh 3.20 · 10−5 kWh 2.27 · 10−4 kWh 1.60 · 10−3 kWh 4.09 · 10−3 kWh 2.43 · 10−2 kWh 1.68 · 10−1 kWh 1.71 · 10−7 kWh 6.58 · 10−7 kWh 3.87 · 10−6 kWh 2.27 · 10−5 kWh 1.31 · 10−4 kWh 8.99 · 10−4 kWh 1.30 · 10−3 kWh 7.56 · 10−3 kWh 7.34 · 10−2 kWh 8.89 · 10−1 kWh https://doi.org/10.1145/3087556.3087579 [21] Bharat Kumar, Chua-Huang Huang, Rodney W. Johnson, and P. Sadayappan. 1993. A Tensor Product Formulation of Strassen's Matrix Multiplication Algorithm with Memory Reduction. In The Seventh International Parallel Processing Symposium, Proceedings, Newport Beach, California, USA, April 13-16, 1993. IEEE Computer Society, 582 -- 588. https://doi.org/10.1109/IPPS.1993.262814 [22] François Le Gall. 2014. Powers of tensors and fast matrix multiplication. In International Symposium on Symbolic and Algebraic Computation, ISSAC '14, Kobe, Japan, July 23-25, 2014, Katsusuke Nabeshima, Kosaku Nagasaka, Franz Winkler, and Ágnes Szántó (Eds.). ACM, 296 -- 303. https://doi.org/10.1145/2608628.2608664 [23] Benjamin Lipshitz, Grey Ballard, James Demmel, and Oded Schwartz. 2012. Communication-avoiding parallel Strassen: implementation and performance. In SC Conference on High Performance Computing Networking, Storage and Analysis, SC '12, Salt Lake City, UT, USA - November 11 - 15, 2012, Jeffrey K. Hollingsworth (Ed.). IEEE/ACM, 101. https://doi.org/10.1109/SC.2012.33 [24] Qingshan Luo and John B. Drake. 1995. A scalable parallel Strassen's matrix multiplication algorithm for distributed-memory computers. In Proceedings of the 1995 ACM symposium on applied computing, SAC'95, Nashville, TN, USA, February 26-28, 1995, Jim Hightower, Ed Deaton, K. M. George, Janice H. Carroll, and Dave Oppenheim (Eds.). ACM, 221 -- 226. https://doi.org/10.1145/315891.315965 Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 35 Table 11. Scalability the running times, the effective bit operations per second, and the energy requirements for the alternative-basis (with self-inversion) binary multiplication procedure. The subproblem size is 65536 for the V100 (DGX-1) and P100 accelerators, and 32768 for the K80. The effective number of bit operations is computed with the same value of 2n3 − n2 as in the cubic case to highlight the relative difference in performance. The first two energy columns are computed assuming full usage of CPU Watts and the Wattage of a single GPU times the number GPUs in use. The latter two columns are computed using the full system power intake. The right-hand-side input matrix is assumed to be pre-transposed and in the alternate basis; the times reported here do not include the transposition of submatrices or the change of basis. GPU V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 P100 P100 P100 P100 P100 P100 P100 P100 P100 P100 K80 K80 K80 K80 K80 K80 K80 K80 K80 K80 n 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 d 1 1 1 1 1 1 1 8 8 8 8 1 1 1 1 1 1 1 4 4 4 1 1 1 1 1 1 8 8 8 8 Runtime 1.51 · 10−4 s 2.45 · 10−4 s 9.97 · 10−4 s 5.55 · 10−3 s 3.76 · 10−2 s 2.66 · 10−1 s 1.87 · 100 s 3.33 · 100 s 1.83 · 101 s 1.19 · 102 s 8.21 · 102 s 1.18 · 10−4 s 2.94 · 10−4 s 1.38 · 10−3 s 8.31 · 10−3 s 5.37 · 10−2 s 3.79 · 10−1 s 2.67 · 100 s 7.12 · 100 s 4.12 · 101 s 2.60 · 102 s 2.87 · 10−4 s 1.12 · 10−3 s 6.56 · 10−3 s 4.17 · 10−2 s 2.24 · 10−1 s 1.52 · 100 s 2.04 · 100 s 1.24 · 101 s 7.79 · 101 s 5.64 · 102 s Effective bop/s 14.26 Tbop/s 70.36 Tbop/s 137.96 Tbop/s 198.32 Tbop/s 234.14 Tbop/s 265.39 Tbop/s 301.77 Tbop/s 1356.04 Tbop/s 1970.12 Tbop/s 2440.74 Tbop/s 2809.41 Tbop/s 18.22 Tbop/s 58.49 Tbop/s 100.27 Tbop/s 132.34 Tbop/s 163.82 Tbop/s 185.81 Tbop/s 211.34 Tbop/s 633.00 Tbop/s 876.27 Tbop/s 1110.41 Tbop/s 7.50 Tbop/s 15.44 Tbop/s 20.95 Tbop/s 26.40 Tbop/s 39.43 Tbop/s 46.45 Tbop/s 276.04 Tbop/s 365.09 Tbop/s 462.55 Tbop/s 511.71 Tbop/s Energy/bop 187.30 pJ/bop 37.95 pJ/bop 19.35 pJ/bop 13.46 pJ/bop 11.40 pJ/bop 10.06 pJ/bop 8.85 pJ/bop 1.97 pJ/bop 1.36 pJ/bop 1.09 pJ/bop 0.95 pJ/bop 79.02 pJ/bop 24.62 pJ/bop 14.36 pJ/bop 10.88 pJ/bop 8.79 pJ/bop 7.75 pJ/bop 6.81 pJ/bop 2.27 pJ/bop 1.64 pJ/bop 1.30 pJ/bop 182.63 pJ/bop 88.74 pJ/bop 65.38 pJ/bop 51.89 pJ/bop 34.75 pJ/bop 29.49 pJ/bop 4.96 pJ/bop 3.75 pJ/bop 2.96 pJ/bop 2.68 pJ/bop Total energy 1.12 · 10−7 kWh 1.82 · 10−7 kWh 7.39 · 10−7 kWh 4.12 · 10−6 kWh 2.79 · 10−5 kWh 1.97 · 10−4 kWh 1.39 · 10−3 kWh 2.47 · 10−3 kWh 1.36 · 10−2 kWh 8.76 · 10−2 kWh 6.09 · 10−1 kWh 4.72 · 10−8 kWh 1.18 · 10−7 kWh 5.49 · 10−7 kWh 3.33 · 10−6 kWh 2.15 · 10−5 kWh 1.52 · 10−4 kWh 1.07 · 10−3 kWh 2.85 · 10−3 kWh 1.65 · 10−2 kWh 1.04 · 10−1 kWh 1.09 · 10−7 kWh 4.24 · 10−7 kWh 2.50 · 10−6 kWh 1.59 · 10−5 kWh 8.50 · 10−5 kWh 5.77 · 10−4 kWh 7.77 · 10−4 kWh 4.70 · 10−3 kWh 2.97 · 10−2 kWh 2.15 · 10−1 kWh System en./bop 245.53 pJ/bop 49.74 pJ/bop 25.37 pJ/bop 17.65 pJ/bop 14.95 pJ/bop 13.19 pJ/bop 11.60 pJ/bop 2.58 pJ/bop 1.78 pJ/bop 1.43 pJ/bop 1.25 pJ/bop 109.75 pJ/bop 34.19 pJ/bop 19.95 pJ/bop 15.11 pJ/bop 12.21 pJ/bop 10.76 pJ/bop 9.46 pJ/bop 3.16 pJ/bop 2.28 pJ/bop 1.80 pJ/bop 266.62 pJ/bop 129.54 pJ/bop 95.45 pJ/bop 75.75 pJ/bop 50.73 pJ/bop 43.05 pJ/bop 7.25 pJ/bop 5.48 pJ/bop 4.32 pJ/bop 3.91 pJ/bop Total system en. 1.47 · 10−7 kWh 2.38 · 10−7 kWh 9.69 · 10−7 kWh 5.39 · 10−6 kWh 3.66 · 10−5 kWh 2.58 · 10−4 kWh 1.82 · 10−3 kWh 3.23 · 10−3 kWh 1.78 · 10−2 kWh 1.15 · 10−1 kWh 7.98 · 10−1 kWh 6.55 · 10−8 kWh 1.64 · 10−7 kWh 7.62 · 10−7 kWh 4.62 · 10−6 kWh 2.99 · 10−5 kWh 2.11 · 10−4 kWh 1.48 · 10−3 kWh 3.96 · 10−3 kWh 2.29 · 10−2 kWh 1.45 · 10−1 kWh 1.59 · 10−7 kWh 6.19 · 10−7 kWh 3.65 · 10−6 kWh 2.32 · 10−5 kWh 1.24 · 10−4 kWh 8.42 · 10−4 kWh 1.14 · 10−3 kWh 6.86 · 10−3 kWh 4.33 · 10−2 kWh 3.13 · 10−1 kWh [25] Xinxin Mei and Xiaowen Chu. 2017. Dissecting GPU Memory Hierarchy Through Microbenchmarking. IEEE Trans. Parallel Distrib. Syst. 28, 1 (2017), 72 -- 86. https://doi.org/10.1109/TPDS.2016.2549523 [26] NVIDIA Corporation. 2015. NVIDIA Tesla K80 GPU accelerator board specification. https://www.nvidia.com/content/dam/en-zz/Solutions/ Data-Center/tesla-product-literature/Tesla-K80-BoardSpec-07317-001-v05.pdf (retrieved 2019-01-09). [27] NVIDIA Corporation. 2016. NVIDIA Tesla P100 datasheet. https://www.nvidia.com/en-us/data-center/tesla-p100/ (retrieved 2019-01-09). [28] NVIDIA Corporation. 2018. CUDA C Programming Guide. https://docs.nvidia.com/cuda/pdf/CUDA_C_Programming_Guide.pdf (retrieved 2018-08-11). PG-02829-001_v9.2. [29] NVIDIA Corporation. 2018. NVIDIA Tesla V100 datasheet. https://www.nvidia.com/en-us/data-center/tesla-v100/ (retrieved 2019-01-09). [30] OpenMP Architecture Review Board. 2015. OpenMP Application Program Interface. https://www.openmp.org/wp-content/uploads/openmp-4.5.pdf. Version 4.5. [31] Victor Pan. 1984. How can we speed up matrix multiplication? SIAM Rev. 26, 3 (1984), 393 -- 415. https://doi.org/10.1137/1026076 [32] Victor Y. Pan. 1978. Strassen's Algorithm Is not Optimal: Trililnear Technique of Aggregating, Uniting and Canceling for Constructing Fast Algorithms for Matrix Operations. In 19th Annual Symposium on Foundations of Computer Science, Ann Arbor, Michigan, USA, 16-18 October 1978. 36 Matti Karppa and Petteri Kaski Table 12. Scalability the running times, the effective bit operations per second, and the energy requirements for the alternative-basis (with chaining) binary multiplication procedure. The subproblem size is 65536 for the V100 (DGX-1) and P100 accelerators, and 32768 for the K80. The effective number of bit operations is computed with the same value of 2n3 − n2 as in the cubic case to highlight the relative difference in performance. The first two energy columns are computed assuming full usage of CPU Watts and the Wattage of a single GPU times the number GPUs in use. The latter two columns are computed using the full system power intake. The right-hand-side input matrix is assumed to be pre-transposed and in the alternate basis; the times reported here do not include the transposition of submatrices or the change of basis. GPU V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 V100 P100 P100 P100 P100 P100 P100 P100 P100 P100 P100 K80 K80 K80 K80 K80 K80 K80 K80 K80 K80 n 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 d 1 1 1 1 1 1 1 8 8 8 8 1 1 1 1 1 1 1 4 4 4 1 1 1 1 1 1 8 8 8 8 Runtime 1.63 · 10−4 s 2.53 · 10−4 s 1.01 · 10−3 s 5.56 · 10−3 s 3.77 · 10−2 s 2.66 · 10−1 s 1.87 · 100 s 3.50 · 100 s 1.83 · 101 s 1.37 · 102 s 9.72 · 102 s 1.26 · 10−4 s 3.04 · 10−4 s 1.38 · 10−3 s 8.38 · 10−3 s 5.40 · 10−2 s 3.82 · 10−1 s 2.69 · 100 s 7.08 · 100 s 4.12 · 101 s 2.63 · 102 s 2.97 · 10−4 s 1.13 · 10−3 s 6.70 · 10−3 s 3.97 · 10−2 s 2.24 · 10−1 s 1.58 · 100 s 2.15 · 100 s 1.31 · 101 s 8.05 · 101 s 6.92 · 102 s Effective bop/s 13.20 Tbop/s 68.02 Tbop/s 136.65 Tbop/s 197.78 Tbop/s 233.70 Tbop/s 265.02 Tbop/s 301.20 Tbop/s 1287.65 Tbop/s 1976.47 Tbop/s 2105.28 Tbop/s 2374.71 Tbop/s 17.17 Tbop/s 56.63 Tbop/s 99.65 Tbop/s 131.30 Tbop/s 163.10 Tbop/s 184.64 Tbop/s 210.00 Tbop/s 636.99 Tbop/s 875.64 Tbop/s 1096.61 Tbop/s 7.25 Tbop/s 15.22 Tbop/s 20.53 Tbop/s 27.71 Tbop/s 39.33 Tbop/s 44.61 Tbop/s 262.51 Tbop/s 344.31 Tbop/s 447.61 Tbop/s 416.80 Tbop/s Energy/bop 202.35 pJ/bop 39.25 pJ/bop 19.54 pJ/bop 13.50 pJ/bop 11.42 pJ/bop 10.07 pJ/bop 8.86 pJ/bop 2.07 pJ/bop 1.35 pJ/bop 1.27 pJ/bop 1.12 pJ/bop 83.89 pJ/bop 25.43 pJ/bop 14.45 pJ/bop 10.97 pJ/bop 8.83 pJ/bop 7.80 pJ/bop 6.86 pJ/bop 2.26 pJ/bop 1.64 pJ/bop 1.31 pJ/bop 189.02 pJ/bop 90.03 pJ/bop 66.73 pJ/bop 49.44 pJ/bop 34.84 pJ/bop 30.71 pJ/bop 5.22 pJ/bop 3.98 pJ/bop 3.06 pJ/bop 3.29 pJ/bop Total energy 1.21 · 10−7 kWh 1.88 · 10−7 kWh 7.46 · 10−7 kWh 4.13 · 10−6 kWh 2.80 · 10−5 kWh 1.97 · 10−4 kWh 1.39 · 10−3 kWh 2.60 · 10−3 kWh 1.36 · 10−2 kWh 1.02 · 10−1 kWh 7.21 · 10−1 kWh 5.01 · 10−8 kWh 1.22 · 10−7 kWh 5.52 · 10−7 kWh 3.35 · 10−6 kWh 2.16 · 10−5 kWh 1.53 · 10−4 kWh 1.08 · 10−3 kWh 2.83 · 10−3 kWh 1.65 · 10−2 kWh 1.06 · 10−1 kWh 1.13 · 10−7 kWh 4.30 · 10−7 kWh 2.55 · 10−6 kWh 1.51 · 10−5 kWh 8.52 · 10−5 kWh 6.01 · 10−4 kWh 8.17 · 10−4 kWh 4.98 · 10−3 kWh 3.07 · 10−2 kWh 2.64 · 10−1 kWh System en./bop 265.25 pJ/bop 51.45 pJ/bop 25.61 pJ/bop 17.70 pJ/bop 14.98 pJ/bop 13.21 pJ/bop 11.62 pJ/bop 2.72 pJ/bop 1.77 pJ/bop 1.66 pJ/bop 1.47 pJ/bop 116.51 pJ/bop 35.32 pJ/bop 20.07 pJ/bop 15.23 pJ/bop 12.26 pJ/bop 10.83 pJ/bop 9.52 pJ/bop 3.14 pJ/bop 2.28 pJ/bop 1.82 pJ/bop 275.94 pJ/bop 131.43 pJ/bop 97.42 pJ/bop 72.17 pJ/bop 50.86 pJ/bop 44.84 pJ/bop 7.62 pJ/bop 5.81 pJ/bop 4.47 pJ/bop 4.80 pJ/bop Total system en. 1.59 · 10−7 kWh 2.46 · 10−7 kWh 9.78 · 10−7 kWh 5.41 · 10−6 kWh 3.66 · 10−5 kWh 2.59 · 10−4 kWh 1.82 · 10−3 kWh 3.41 · 10−3 kWh 1.78 · 10−2 kWh 1.34 · 10−1 kWh 9.45 · 10−1 kWh 6.95 · 10−8 kWh 1.69 · 10−7 kWh 7.67 · 10−7 kWh 4.66 · 10−6 kWh 3.00 · 10−5 kWh 2.12 · 10−4 kWh 1.49 · 10−3 kWh 3.93 · 10−3 kWh 2.29 · 10−2 kWh 1.47 · 10−1 kWh 1.65 · 10−7 kWh 6.28 · 10−7 kWh 3.72 · 10−6 kWh 2.21 · 10−5 kWh 1.25 · 10−4 kWh 8.77 · 10−4 kWh 1.20 · 10−3 kWh 7.27 · 10−3 kWh 4.48 · 10−2 kWh 3.85 · 10−1 kWh IEEE Computer Society, 166 -- 176. https://doi.org/10.1109/SFCS.1978.34 [33] Victor Y. Pan. 2018. Fast Feasible and Unfeasible Matrix Multiplication. CoRR abs/1804.04102 (2018). arXiv:1804.04102 http://arxiv.org/abs/1804.04102 [34] Robert L. Probert. 1976. On the Additive Complexity of Matrix Multiplication. SIAM J. Comput. 5, 2 (1976), 187 -- 203. https://doi.org/10.1137/0205016 [35] V. Strassen. 1969. Gaussian elimination is not optimal. Numer. Math. 13 (1969), 354 -- 356. https://doi.org/10.1007/BF02165411 [36] Leslie G. Valiant. 1975. General Context-Free Recognition in Less than Cubic Time. J. Comput. Syst. Sci. 10, 2 (1975), 308 -- 315. https://doi.org/10. 1016/S0022-0000(75)80046-8 [37] Virginia Vassilevska Williams. 2012. Multiplying matrices faster than Coppersmith-Winograd. In Proceedings of the 44th Symposium on Theory of Computing Conference, STOC 2012, New York, NY, USA, May 19 - 22, 2012, Howard J. Karloff and Toniann Pitassi (Eds.). ACM, 887 -- 898. https: //doi.org/10.1145/2213977.2214056 [38] Virginia Vassilevska Williams and Ryan Williams. 2010. Subcubic Equivalences between Path, Matrix and Triangle Problems. In 51th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2010, October 23-26, 2010, Las Vegas, Nevada, USA. IEEE Computer Society, 645 -- 654. https://doi.org/10.1109/FOCS.2010.67 Engineering Boolean Matrix Multiplication for Multiple-Accelerator Shared-Memory Architectures 37 Table 13. This table presents a best-case comparison between the runtimes of the different algorithms as run on the DGX-1 with 8 GPUs and subproblem size of 131072 for the cubic binary and Boolean algorithms and 65536 for Strassen-like algorithms. The right-hand-side operand is assumed to be pre-transposed and in the desired basis; the change of basis or the transpose of the submatrices is not included in the reported times. n 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 Cubic 1.07 · 10−4 s 2.15 · 10−4 s 1.16 · 10−3 s 8.28 · 10−3 s 5.21 · 10−2 s 4.09 · 10−1 s 3.28 · 100 s 2.65 · 101 s 6.76 · 101 s 2.40 · 102 s 1.88 · 103 s Boolean 9.84 · 10−5 s 1.93 · 10−4 s 1.30 · 10−3 s 7.86 · 10−3 s 5.94 · 10−2 s 4.69 · 10−1 s 3.73 · 100 s 2.98 · 101 s 7.51 · 101 s 2.71 · 102 s 2.11 · 103 s Strassen-Winograd Alt.-basis self-inverse Alt.-basis chaining 1.63 · 10−4 s 2.53 · 10−4 s 1.01 · 10−3 s 5.56 · 10−3 s 3.77 · 10−2 s 2.66 · 10−1 s 1.87 · 100 s 3.50 · 100 s 1.83 · 101 s 1.37 · 102 s 9.72 · 102 s 1.51 · 10−4 s 2.45 · 10−4 s 9.97 · 10−4 s 5.55 · 10−3 s 3.76 · 10−2 s 2.66 · 10−1 s 1.87 · 100 s 3.33 · 100 s 1.83 · 101 s 1.19 · 102 s 8.21 · 102 s 1.67 · 10−4 s 2.72 · 10−4 s 1.05 · 10−3 s 5.86 · 10−3 s 3.97 · 10−2 s 2.81 · 10−1 s 1.97 · 100 s 3.74 · 100 s 2.34 · 101 s 2.66 · 102 s 2.61 · 103 s [39] Vasily Volkov. 2016. Understanding Latency Hiding on GPUs. Ph.D. Dissertation. Electrical Engineering and Computer Sciences, University of California at Berkeley. Technical Report No. UCB/EECS-2016-143. [40] Henry S. Warren. 2013. Hacker's Delight (2nd ed.). Addison-Wesley. [41] S. Winograd. 1971. On multiplication of 2 × 2 matrices. Linear Algebra Appl. 4 (1971), 381 -- 388. https://doi.org/10.1016/0024-3795(71)90009-7 [42] F. Yates. 1937. The Design and Analysis of Factorial Experiments. Imperial Bureau of Soil Science, Harpenden. [43] Huacheng Yu. 2018. An improved combinatorial algorithm for Boolean matrix multiplication. Inf. Comput. 261 (2018), 240 -- 247. https://doi.org/10. 1016/j.ic.2018.02.006
1010.4925
1
1010
2010-10-24T04:02:45
Property Testing via Set-Theoretic Operations
[ "cs.DS" ]
Given two testable properties $\mathcal{P}_{1}$ and $\mathcal{P}_{2}$, under what conditions are the union, intersection or set-difference of these two properties also testable? We initiate a systematic study of these basic set-theoretic operations in the context of property testing. As an application, we give a conceptually different proof that linearity is testable, albeit with much worse query complexity. Furthermore, for the problem of testing disjunction of linear functions, which was previously known to be one-sided testable with a super-polynomial query complexity, we give an improved analysis and show it has query complexity $O(1/\eps^2)$, where $\eps$ is the distance parameter.
cs.DS
cs
Property Testing via Set-Theoretic Operations Victor Chen∗ Madhu Sudan† Ning Xie‡ Abstract Given two testable properties P1 and P2, under what conditions are the union, intersection or set- difference of these two properties also testable? We initiate a systematic study of these basic set-theoretic operations in the context of property testing. As an application, we give a conceptually different proof that linearity is testable, albeit with much worse query complexity. Furthermore, for the problem of testing disjunction of linear functions, which was previously known to be one-sided testable with a super-polynomial query complexity, we give an improved analysis and show it has query complexity O(1/ǫ2), where ǫ is the distance parameter. 0 1 0 2 t c O 4 2 ] S D . s c [ 1 v 5 2 9 4 . 0 1 0 1 : v i X r a ∗Princeton University. [email protected]. †Microsoft Research New England. [email protected]. Research supported in part by NSF Award CCR-0514915. ‡MIT CSAIL. [email protected]. Research supported in part by NSF Award CCR-0514771, 0728645 and 0732334. 0 1 Introduction During the last two decades, the size of data sets has been increasing at an exponential rate, rendering a linear scan of the whole input an unaffordable luxury. Thus, we need sublinear time algorithms that read a vanishingly small fraction of their input and still output something intelligent and non-trivial about the properties of the input. The model of property testing [33, 22] has been very useful in understanding the power of sublinear time. Property testing is concerned with the existence of a sublinear time algorithm that queries an input object a small number of times and decides correctly with high probability whether the object has a given property or whether it is "far away" from having the property. We model input objects as strings of arbitrary length, which can also be viewed as a function on arbi- trarily large domain. Formally, let R be a finite set and D = {Dn}n>0 be a parametrized family of domains. RD denote the set of all functions mapping from D to R. A property P is simply specified by a family of functions P ⊆ RD. A tester for property P is a randomized algorithm which, given the oracle access to an input function f ∈ RD together with a distance parameter ǫ, distinguishes with high probability (say, 2/3) between the case that f satisfies P and the case that f is ǫ-far from satisfying P. Here, distance between functions f, g : D → R, denoted dist(f, g), is simply the probability that Prx∈D[f (x) 6= g(x)], where x is chosen uniformly at random from D, and dist(f, P) = ming∈P {dist(f, g)}. We say f is ǫ-far from P if dist(f, P) ≥ ǫ and ǫ-close otherwise. The central parameter associated with a tester is the number of oracle queries it makes to the function f being tested. Property testing was first studied by Blum, Luby and Rubinfeld [18] and was formally defined by Ru- binfeld and Sudan [33]. The systematic exploration of property testing for combinatorial properties was initiated by Goldreich, Goldwasser, and Ron [22]. Subsequently, a rich collection of properties have been shown to be testable [8, 7, 3, 19, 31, 5, 4, 26, 25]. Perhaps the most fundamental question in property testing is the following: which properties have local testing algorithms whose running time depends only on the distance parameter ǫ? Are there any attributes that make a property locally testable? Questions of this type in the context of graph property testing were first raised in [22] and later received a lot of attention. Some very general results have been obtained [2, 8, 7, 21, 3, 19], leading to an (almost) complete qualitative understanding of which graph properties are efficiently testable in the dense graph model (see [14] for some recent progress in the sparse graph model). In addition, for an important class of properties, namely H-freeness for fixed subgraphs H, it is known exactly for which H, testing H-freeness requires the query complexity to be super-polynomial in 1/ǫ and for which only a polynomial number of queries suffice: This was shown by Alon [1] for one-sided error testers and by Alon and Shapira [6] for general two-sided error testers. Progress toward similar understanding has also been made for hypergraph properties [32, 9, 7]. However, much less is known for algebraic properties. In a systematic study, Kaufman and Sudan [27] examined the query complexity of a broad class of algebraic properties based on the invariance of these prop- erties under linear transformations. Roughly speaking, they showed that any locally-characterized linear- invariant and linear1 properties are testable with query complexities polynomial in 1/ǫ. Non-linear linear- invariant properties were first shown to be testable by Green [24] and were formally studied in [15]. The properties studied in [24, 15] are "pattern-freeness" of Boolean functions, which has been attracting consid- erable attention [24, 15, 34, 29, 16], as such a study may lead to a complete characterization of testability for functions, analogous to the setting of graphs. 1A property F is linear if for any f and g that are in F necessarily implies that f + g is in F. 1 1.1 Motivation for set-theoretic operations In this paper we propose a new paradigm to systematically study algebraic property testing. First, decom- pose a natural algebraic property into the union or intersection (or some other set operation) of a set of "atomic properties". Second, try to show that each of these atomic properties is testable. Finally, prove that some "composite" property obtained from applying some set theoretic operations on the (testable) atomic properties is also testable. A prominent example is the set of low-degree polynomials [4, 26, 25]. It is easy to see that the property of being a degree-d polynomial over GF(2) is simply the intersection of 22d+1−2 atomic properties. Indeed, let Pd denote the set of n-variate polynomials of degree at most d. Then, by the charac- terization of low-degree polynomials (see, e.g., [4]), f ∈ Pd if and only if for every x1, . . . , xd+1 ∈ Fn 2 , X∅6=S⊆[d+1] f (Xi∈S xi) ≡ 0 (mod 2). Now fix an ordering of the non-trivial subsets of [d + 1] = {1, 2, . . . , d + 1}. Let ~b be a bit-string d,~b denote the set of functions f such that the string of length 22d+1−1 with an odd number of ones and P P d,~b's.2 hf (Pi∈S xi)i∅6=S⊆[d+1] is not equal to ~b. By definition, Pd is the intersection of 22d+1−2 "~b-free" properties In order to carry out this program of decomposing an algebraic properties into atomic ones, one must have a solid understanding of how basic set-theoretic operations affect testability. For instance, given two testable properties, is the union, intersection, or set-difference also testable? Previously, Goldreich, Gold- wasser and Ron considered such questions in their seminal paper [22]. They observed that the union of two testable properties is always testable (cf. Section 3.1) but also provided examples showing that in general, testability is not closed under other set-theoretic operations. Thus, current understanding of testability via set-theoretic operations seems insufficient to carry out the above mentioned program of attack. 1.2 Our results In this paper, we show more positive results for these basic set-theoretic operations and illustrate several applications. We now describe our contribution in more detail. Set-theoretic operations We provide sufficient conditions that allow local testability to be closed under intersection and set difference. Given two locally testable properties, we show that if the two properties (minus their intersection) are sufficiently far apart, then their intersection is also locally testable. For set difference, a similar statement can also be made, albeit with more technicality, requiring that one of the properties must be "tolerantly testable". A more detailed treatment of these set operations appears in Section 3. We remark that in the general case, testability is not closed under most set operations. Thus, putting restrictions on these properties is not unwarranted. Applications of these set-theoretic considerations appear in Sections 4.2 and 4.3. Furthermore, Sec- tion 4.3 demonstrates the simplicity that comes from these set-theoretic arguments. There, via set theory, we define a new property from an established one, and show that the new property's testability, in terms of both upper and lower bounds, is inherited from the previous property. 2In fact, some of these 22 d+1−2 properties are identical since the set of non-trivial subsets generated by xi is invariant under permutation of the xi's. 2 Disjunction of linear functions In addition to set theory, it is also natural to ask whether testability is preserved under the closure of some fundamental, unary operations. For instance, given a testable property P, under what condition is its additive closure ⊕P testable? A similar question can also be asked for the disjunctive operator ∧, which is one of the most basic operations used to combine formulas. Given a testable property P, is its disjunctive closure ∧P testable? Trivially, if P is linear, then ⊕P = P and testability is preserved. Furthermore, if P1 and P2 are both linear and linear-invariant as introduced by Kaufman and Sudan [27], then their sumset P1 + P2 is testable. However, in general, not much can be said about how these basic operations affect testability. Here we focus on disjunction's effect on one specific property, namely the set of linear functions. Before we describe our result, we note some previous works in testing where disjunction played a role. For the disjunction of monomials, Parnas et. al. [31] gave a testing algorithm for s-term monotone DNF with query complexity O(s2/ǫ). Diakonikolas et. al. [20] generalized Parnas et. al.'s result to general s-term DNF with query complexity O(s4/ǫ2). We take a different direction and ask how disjunction affects the testability of the set of linear functions. The property of being a linear Boolean function (see next section for a full discussion), first studied by Blum, Luby and Rubinfeld [18], is testable with query complexity O(1/ǫ). As observed in [15], the class of disjunction of linear functions is equal to the class of 100-free functions (see Preliminaries for a definition). There they showed that a sufficiently rich class of "pattern-free" functions is testable, albeit with query complexity a tower of 2's whose height is a function of 1/ǫ. In a different context, the authors in [23] showed implicitly3 that the disjunction of linear functions is testable with query complexity polynomial in 1/ǫ, but with two-sided error. Since both [15] and [23] seek to describe rich classes of testable Boolean functions, the bounds from both works do not adequately address how disjunction affects the query complexity of the underlying property, the set of linear functions. In Section 4.1, we give a direct proof, showing that the disjunction of linear functions is testable with query complexity O(1/ǫ2) and has one-sided error. Thus, the blowup from the disjunctive operator is O(1/ǫ). It will be interesting to see if the blowup is optimal for this problem. A different proof for linearity testing Linearity testing, first proposed by Blum, Luby and Rubinfeld [18], is arguably the most fundamental and extensively studied problem in property testing of Boolean functions. Due to its simplicity and important applications in PCP constructions, much effort has been devoted to the study of the testability of linearity [18, 12, 11, 10, 28]. For linearity, we indeed are able to carry out the program of decomposing an algebraic property into atomic pattern-free properties, and thus obtain a novel new proof that linearity is testable in Section 4.2. In particular, linearity is easily seen to be equal to the intersection of two atomic properties, namely triangle- freeness (see Section 2) and disjunction of linear functions, which are both testable. The query complexity of linearity in our proof is of the tower-type, drastically worse than the optimal O(1/ǫ) bound, where ǫ is the distance parameter. We note that our effort in obtaining a new proof lies not in improving the parameters, but in understanding the relationships among these atomic, testable properties. In fact, we believe that despite the poor upper bound, our new proof is conceptually simple and gives evidence that set theory may uncover new testable properties. 3We thank an anonymous reviewer from ICS 2011 for pointing this out. 3 1.3 Techniques Our new proof that linearity is testable is built on the testability results for triangle freeness (see definition in Section 2) and the disjunction of linear functions. The latter was already shown to be testable in [15]. However, in this work, we give a completely different proof using a BLR-styled approach. Our proof is a novel variant of the classical self-correction method. Consequently, the query upper bound we obtain (quadratic in 1/ǫ) is significantly better than the tower-type upper bound shown in [15]. In fact, to the best of our knowledge, this is the first and only polynomial query upper bound for testing pattern-freeness properties. All other analysis for testing pattern-freeness properties apply some type of "regularity lemma", thus making tower-type query upper bounds unavoidable. We believe that both the self-correction technique and the investigation of set-operations may be useful in the study of testing pattern-freeness. From the works developed in [34, 29], we know that for every d, d,~b remains open. And in the property P general very little can be said about the testability of an arbitrary intersection of these properties. Since Pd is known to be testable using self-correction [4], we believe that self-correction, applied in conjunction with set-theory, may be useful for understanding these pattern-free properties. d,~1 is testable.4 However, for an arbitrary ~b, the testability of P 2 Preliminaries y are two n-bit strings, then x + y denotes bitwise addition (i.e., XOR) of x and y, and x · y = Pn We now describe some basic notation and definitions that we use throughout the paper. We let N = {0, 1, . . .} denotes the set of natural numbers and [n] the set {1, . . . , n}. We view elements in Fn 2 as n- 2 , we write xi ∈ {0, 1} for the ith bit of x. If x and bit binary strings, that is elements of {0, 1}n. For x ∈ Fn i=1 xiyi (mod 2) denotes the inner product between x and y. We write (x, y) to denote the concatenation of two bit strings x and y. For convenience, sometimes we view a n-bit binary string as a subset of [n], that is, for every x ∈ Fn 2 there is a corresponding subset Sx ⊆ [n] such that xi = 1 iff i ∈ Sx for every 1 ≤ i ≤ n. We write x to indicate the Hamming weight of x, i.e., the number of coordinates i such that xi = 1. Equivalently, this is also the cardinality of subset Sx. By abuse of notation, we use parentheses to denote multisets; for instance, we write (a, a, b, b, b) for the multiset which consists of two a's and three b's. Let f : Fn 2 → {0, 1} be a Boolean function. The support of f is supp(f ) = {x ∈ Fn 2 : f (x) = 1}. Recall that for two functions f and g defined over the same domain, the (fractional) distance between def these two functions is dist(f, g) = Prx∈D[f (x) 6= g(x)]. Let P1 and P2 be two properties defined over the same domain D, then the distance between these two properties, dist(P1, P2), is simply defined to be minf ∈P1,g∈P2{dist(f, g)}. A Boolean function f : Fn 2 → {0, 1} is linear if for all x and y in Fn 2 , f (x)+f (y) = f (x+y). We denote the set of linear function by PLIN. Throughout this paper, we will be working with the pattern generated by the triple (x, y, x+y). To this end, we say that a Boolean function f : Fn 2 → {0, 1} is (1, 0, 0)-free if for all x and y in Fn 2 , (f (x), f (y), f (x + y)) 6= (1, 0, 0), where here and after we view (f (x), f (y), f (x + y)) as well as (1, 0, 0) as multisets5. We denote the set of (1, 0, 0)-free functions by P(100)-FREE. Similarly, a (1, 1, 0)- free Boolean function is defined analogously. Lastly, we say that a Boolean function f : Fn 2 → {0, 1} is triangle-free if for all x and y in Fn 2 , (f (x), f (y), f (x + y)) 6= (1, 1, 1). We denote the set of triangle- free functions by P(111)-FREE. Note that P(111)-FREE is monotone: if f ∈ P(111)-FREE and we modify 4Actually, stronger theorems were proved in [34, 29], but to state their works in full, definitions not needed in this work will have to be introduced. 5That is, for example, we do not distinguish the case hf (x), f (y), f (x+y)i = h1, 0, 0i from hf (x), f (y), f (x+y)i = h0, 1, 0i. 4 f by setting some of the points in Fn encapsulate this observation into the following statement: 2 from 1 to 0, then the new function is clearly also triangle-free. We Observation 1. Let f and g be two Boolean functions such that supp(f ) ⊆ supp(g). Then dist(f, P(111)-FREE) ≤ dist(g, P(111)-FREE). For concreteness, we provide a formal definition of a tester. Definition 1 (Testability). Let R be a finite set and D = {Dn}n>0 be a parametrized family of domains. Let P ⊆ RD be a property. We say a (randomized) algorithm T is a tester for P with query complexity q(ǫ, n) if for any distance parameter ǫ > 0, input size n and function f : Dn → R, T satisfies the following: • T queries f at most q(ǫ, n) times; • (completeness) if f ∈ P, then Pr[T accepts] = 1; • (soundness) if dist(f, P) ≥ ǫ, then Pr[T accepts] ≤ 1 3, where the probabilities are taken over the internal randomness used by T . We say that a property is locally testable if it has a tester whose query complexity is a function depending only on ǫ, independent of n. In this work, we actually use the word testability to describe the stronger notion of local testability. For our main results, we will work with the model case when Dn = Fn 2 and R = {0, 1}. 3 Basic theory of set operations In this section, we present some basic testability results based on set-theoretic operations such as union, intersection, complementation, and set-difference. The proofs here are fairly standard and are thus deferred to the Appendix. 3.1 Union It is well known that the union of two testable properties remains testable. This folklore result first appeared in [22]; for completeness, a proof is included in Appendix A. Proposition 1 (Folklore). Let P1, P2 ⊆ RD be two properties defined over the same domain D = {Dn}n>0. For i = 1, 2, suppose Pi is testable with query complexity qi(ǫ). Then the union P1 ∪ P2 is testable with query complexity O(q1(ǫ) + q2(ǫ)). 3.2 Intersection The case of set intersection is more complicated than union. Goldreich et al. showed in [22] (see Proposition 4.2.2) that there exist testable properties whose intersection is not testable. Thus, in general, testability does not follow from the intersection operation. However, testability may still follow in restricted cases. In particular, we show that if two testable properties P1 and P2 minus their intersection are sufficiently far from each other, then their intersection remains testable as well. A proof is included in Appendix B. Proposition 2. Let P1, P2 ⊆ RD be two properties defined over the same domain D = {Dn}n>0. Suppose dist(P1 \ P2, P2 \ P1) ≥ ǫ0 for some absolute constant ǫ0, and for i = 1, 2, Pi is testable with query complexity qi(ǫ). Then the intersection P1 ∩ P2 is testable with query complexity O(q1(ǫ) + q2(ǫ)), 5 3.3 Complementation Here we examine the effect complementation has on the testability of a property. As it turns out, all three outcomes -- both P and ¯P are testable, only one of P and ¯P is testable, and neither P nor ¯P is testable -- are possible! The first outcome is the easiest to observe. Note that the property DR and the empty property are complements of each other, and both are trivially testable. The second outcome is observed in Proposition 4.2.3 in [22]. To our knowledge, the third outcome has not been considered before. In fact, previous constructions of non-testable properties, e.g. [22, 13], are sparse. Hence, the complements of these non- testable properties are trivially testable (by the tester that accepts all input functions). One may wonder if in general the complement of a non-testable property must also be testable. We disprove this in the following proposition. Proposition 3. There exists some property P ⊆ RD where R = {0, 1} and D = {Fn P nor P is testable for any ǫ < 1/8. 2 }n>0, such that neither By utilizing coding theory, we can bypass the sparsity condition to prove Proposition 3. Essentially, property P consists of neighborhoods around functions that have degree n/2 − 1 as polynomials over F2n. Its complement contains functions that are polynomials of degree n/2. Since d evaluations are needed to specify a polynomial of degree d, any tester for P or P needs (roughly) at least n/2 queries. Using a standard argument involving code concatenation, one can construct P and P to be binary properties that require testers of query complexity Ω(2n/2). A formal proof can be found in Appendix C. 3.4 Difference Let P1 and P2 be two properties and let P = P1 \ P2 denote the set difference of the two properties. In this section, we confine our attention to the simple case that P2 ⊂ P1. Since complementation is a special case of set-difference, from Section 3.3, we know that in general we can infer nothing about the testability of P from the fact that both P1 and P2 are testable. However, under certain restrictions, we still can show that P is testable. First we observe a simple case in which P1 \ P2 is testable. This simple observation, which is obvious and whose proof we omit, is utilized in the proof of Theorem 4 in Section 4.3. Observation 2. Let P2 ⊂ P1 be two testable properties defined over the same domain D = {Dn}n>0. If for every f ∈ P2, there is some g ∈ P1 \ P2 such that dist(f, g) = o(1), then P1 \ P2 is testable by the same tester which tests property P1. Our second observation on set difference relies on the notion of tolerant testing, introduced by Parnas, Ron, and Rubinfeld [30] to investigate testers that are guaranteed to accept (with high confidence) not only inputs that satisfy the property, but also inputs that are sufficiently close to satisfying it. Definition 2 (Tolerant Tester [30]). Let 0 < ǫ1 < ǫ2 < 1 denote two distance parameters and P ⊆ RD be a property defined over the domain D = {Dn}n>0. We say that property P is (ǫ1, ǫ2)-tolerantly testable with query complexity q(ǫ1, ǫ2) if there is a tester T that makes at most q(ǫ1, ǫ2) queries, if for all f with dist(f, P) ≤ ǫ1, T rejects f with probability at most 1/3, and for all f with dist(f, P) ≥ ǫ2, T accepts f with probability at most 1/3. We record in the following proposition that if P and P2 are sufficiently far apart and P2 is tolerantly testable, then P is also testable. We include a proof in Appendix D. 6 Proposition 4. Let ǫ1 < ǫ2 < ǫ0 be three absolute constants. Let P2 ⊂ P1 ⊆ RD be two properties defined over the same domain D = {Dn}n>0. If for every ǫ > 0, P1 is testable with query complexity q1(ǫ), P2 is (ǫ1, ǫ2)-tolerantly testable with query complexity q2(ǫ1, ǫ2), and dist(P1 \ P2, P2) ≥ ǫ0, then P1 \ P2 is testable with query complexity O(q1(ǫ) + q2(ǫ1, ǫ2)) (and completeness 2/3). We note that since P2 is tolerantly testable, it does not have completeness 1. Thus, the set difference P1 \ P2 is not guaranteed to have one-sided error, either. 4 Main results In this section we show two applications of the results developed in Section 3. We stress that set theoretic arguments may be used to show both upper bound results (some properties are testable with only a few number of queries) and lower bound results (some properties can not be tested by any tester with less than certain number of queries). 4.1 Testing disjunction of linear functions In this section, we employ a BLR-style analysis to show that the class of disjunction of linear functions is testable with query complexity O(1/ǫ2). We first recall from [15] that a function is a disjunction of linear functions iff it is (1, 0, 0)-free. (Recall that P(100)-FREE is the set of Boolean functions that are free of (1, 0, 0)-patterns for any x, y and x + y in Fn 2 .) Proposition 5 ([15]). A function f : Fn linear functions (or the all 1 function). 2 → {0, 1} is (1,0,0)-free if and only if f is the disjunction (OR) of Proof. The reverse direction is obvious. For the forward direction, let S = {x ∈ Fn 2 : f (x) = 0}. If S is empty, then f is the all 1 function. Otherwise let x and y be any two elements in S (not necessarily distinct). Then if f is (1, 0, 0)-free, it must be the case that x + y is also in S. Thus S is a linear subspace of Fn 2 . Suppose the dimension of S is k with k ≥ 1. Then there are k linearly independent vectors a1, . . . , ak ∈ Fn 2 such that z ∈ S iff {z · a1 = 0}V · · ·V{z · ak = 0}. Therefore, by De Morgan's law, f (z) = 1 iff z ∈ ¯S iff {z · a1 = 1}W · · ·W{z · ak = 1}, which is equivalent to the claim. P(100)-FREE was shown to be testable with a tower-type query upper bound in [15]. We now give a direct proof that P(100)-FREE is testable with a quadratic upper bound. In fact, by symmetry the testability of P(110)-FREE is the same as the testability of P(100)-FREE. Theorem 1. For every distance parameter ǫ > 0, the property P(100)-FREE is testable with query complexity O(1/ǫ2). Proof. Suppose we have oracle access to some Boolean function f : Fn 2 → {0, 1}. A natural 3-query test T for P(100)-FREE proceeds as follows. T picks x and y independently and uniformly at random from Fn 2 , and accepts iff (f (x), f (y), f (x + y)) 6= (1, 0, 0). Let Rdef= Prx,y[(f (x), f (y), f (x + y)) 6= (1, 0, 0)] be the rejection probability of T . If f ∈ P(100)-FREE, then R = 0, i.e., T has completeness 1. For soundness, in a series of steps, we shall show that for every ǫ > 0, if R < ǫ2/128, then there exists a Boolean function g such that (1) g is well-defined, (2) dist(f, g) < ǫ, and (3) g is in P(100)-FREE. Let µ0 denote Prx[f (x) = 0]. Suppose µ0 < 63ǫ/64. Then dist(f,~1) < 63ǫ/64, where ~1 is the all-ones function. Then trivially, taking g = ~1 completes the proof. Thus, henceforth we assume that µ0 ≥ 63ǫ/64. 7 For a fixed x ∈ Fn 2 , let px 00 denote Pry[(f (y), f (x + y)) = (0, 0)], and and px 10 is defined similarly. We define g : Fn 2 → {0, 1} as follows: 0, 1, f (x), g(x) =  00 ≥ ǫ/4; 10 ≥ ǫ/4; if px if px otherwise. Proof of (1). g is well-defined. Suppose not, then there exists some x ∈ Fn 2 such that px 00, px 10 ≥ ǫ/4. Pick y and z independently and uniformly at random from Fn 2 . Let E be the event that at least one of (f (y), f (z), f (y + z)) and (f (x + y), f (x + z), f (y + z)) is (1, 0, 0). By assumption, with probability at least ǫ2/16, f (y) = 1, f (x + y) = 0 and f (z), f (x + z) = 0, which will imply that -- regardless of the value of f (y + z) -- event E must occur. Thus, ǫ2/16 ≤ Pr[E]. On the other hand, by the union bound, Pr[E] ≤ 2R < ǫ2/64, a contradiction. Proof of (2). dist(f, g) < ǫ 32. Suppose x is such that f (x) 6= g(x). By construction, Pry[f (x), f (y), f (x + y)] ≥ ǫ/4. This implies that the rejection probability R is at least dist(f, g) · ǫ/4. Since R < ǫ2/128, dist(f, g) < ǫ/32. Before proving (3), we first note that for every x ∈ Fn 2 , [(g(x), g(y), g(x + y)) = (1, 0, 0)] < Pr y 5ǫ 16 . To see this, note that by construction of g, for every x ∈ Fn 2 , Pry[(g(x), f (y), f (x + y)) = (1, 0, 0)] < ǫ/4. Since dist(f, g) < ǫ/32, by the union bound, we can deduce that the probability that g has a (1, 0, 0)-pattern at (x, y, x + y) is less than ǫ/4 + 2 · ǫ/32. Proof of (3). g is in P(100)-FREE. Suppose not, that there exist x, y ∈ Fn 2 . Let E denote the event that random from Fn 2 such that g(x) = 1, g(y), g(x + y) = 0. Pick z uniformly at at least one of (g(x), g(z), g(x + z)), (g(y), g(z), g(y + z)), and (g(x + y), g(x + z), g(y + z)) is (1, 0, 0). A case by case analysis reveals that if g(z) = 0, then event E must occur. Note that the probability that g(z) = 0 is at least 63ǫ/64 − ǫ/32 = 61ǫ/64, since f (z) = 0 occurs with probability at least 63ǫ/64 and dist(f, g) < ǫ/32. On the other hand, by union bound, we have Pr[g(z) = 0] ≤ Pr[E] ≤ 3·5ǫ/16, implying that 61ǫ/64 ≤ 15ǫ/16, an absurdity. Therefore, we have shown that on any input function that is ǫ-far from P(100)-FREE, the rejection prob- ability of T is always at least ǫ2/128. By repeating the basic test T independently O(1/ǫ2) times, we can boost the rejection probability of T to 2/3, and thus completing the proof. 8 4.2 A new proof that linearity is testable As an application of our results in Section 3.2, we give a new proof that linear functions are testable based on a set-theoretic argument. To this end, note that the set of linear functions equals to the intersection of (1, 1, 1)-free functions and (1, 0, 0)-free functions, i.e., PLIN = P(111)-FREE ∩ P(100)-FREE. From the previous section, we know that P(100)-FREE is testable. The following theorem due to Green [24] asserts that P(111)-FREE is also testable. Theorem 2 ([24]). The property P(111)-FREE is testable with query complexity W (poly(1/ǫ)), where for every t > 0, W (t) denotes the tower of 2's of height ⌈t⌉. By Proposition 2, to show that linearity is testable, it suffices to show that the two properties P(111)-FREE and P(100)-FREE are essentially far apart. To this end, let us define a new property PNLTF, where NLTF stands for non-linear triangle-freeness: PNLTF def = P(111)-FREE \ PLIN. Lemma 1. We have that P(100)-FREE \ PLIN is 1 4-far from PNLTF. We first establish a weaker version of Lemma 1. Proposition 6. Suppose f is a disjunction of exactly two non-trivial linear functions. Then dist(f, P(111)-FREE) is at least 1 4 . Proof. Set N = 2n. Write f (x) = (α · x)W(β · x), where α 6= β ∈ Fn 2 denote two n-bit vectors not equal to 0n. We say that a tuple (x, y, x + y) where x, y ∈ Fn 2 is a triangle in f if f (x), f (y), f (x + y) = 1. We shall show that (1) f has N 2/16 triangles and (2) for every x, the number of y′s such that (x, y, x + y) is a triangle in f is N/4. Together, (1) and (2) will imply that dist(f, P(111)-FREE) is at least 1/4, since changing the value of f at one point removes at most N/4 triangles. To prove these two assertions, let A = {x ∈ Fn 2 : β · x = 1}. Since supp(f ) = A ∪ B, for every triangle (x, y, x + y) in f , each of the three points x, y, x + y must fall in one of the following three disjoint sets: 2 : α · x = 1} and B = {x ∈ Fn A \ B, (A ∩ B), B \ A. Furthermore, each of the three points must fall into distinct sets. To see this, suppose that x, y ∈ A \ B. Then by definition, α(x + y) = α(x) + α(y) = 0 and β(x + y) = 0, implying that f (x + y) = 0, a contradiction. So A \ B cannot contain two points of a triangle, and by symmetry, neither can B \ A. The same calculation also reveals that A ∩ B cannot contain two points of a triangle. Thus, a triangle (x, y, x + y) in f must be such that x ∈ A \ B, y ∈ A ∩ B, and x + y ∈ B \ A. In addition, it is easy to check that given two points p1, p2 from two distinct sets (say A \ B and A ∩ B), their sum p1 + p2 must be in the third set (B \ A). Since these three sets A \ B, (A ∩ B), B \ A all have size N/4, this implies that the number of triangles in f is N 2/16, proving (1). (2) also follows easily given the above observations. Suppose x ∈ A \ B. For every y ∈ A ∩ B, (x, y, x + y) forms a triangle. Since any triangle that has x as a point must also contain a point in A ∩ B (with the third point uniquely determined by the first two), the number of triangles in f containing x is N/4. The case when x ∈ B \ A or x ∈ A ∩ B is similar. This completes the proof. 9 Now we prove Lemma 1. Proof of Lemma 1. Let f ∈ P(100)-FREE \ PLIN and write f = f1 ∨ f2, where f1 is a disjunction of exactly two linear functions. By Proposition 6, it follows that dist(f1, P(111)-FREE) is at least 1/4. Since P(111)-FREE is monotone and supp(f1) ⊆ supp(f ), by Observation 1, we know that dist(f, P(111)-FREE) ≥ 1/4. Since PNLTF ⊂ P(111)-FREE, dist(f, PNLTF) ≥ dist(f, P(111)-FREE), completing the proof. By Theorem 2 and Theorem 1, both P(111)-FREE and P(100)-FREE are testable. Now by combining Proposition 2 and Lemma 1, we obtain the following: Theorem 3. PLIN is testable. We remark that the query complexity for testing linearity in Theorem 3 is of the tower type (of the form W (poly(1/ǫ)) because of Theorem 2. This is much worse than the optimal linear query upper bound obtained in [18, 10]. 4.3 A lower bound for testing non-linear triangle-freeness We first show that PLIN is a "thin strip" around PNLTF. Proposition 7. For any Boolean function f , dist(f, P(111)-FREE) ≥ dist(f, PNLTF) − 2−n. Proof. The statement is trivially true if dist(f, P(111)-FREE) = dist(f, PNLTF). Since PNLTF is a proper subset of P(111)-FREE, we can assume that dist(f, PNLTF) is strictly larger than dist(f, P(111)-FREE), implying that the function in P(111)-FREE that has minimum distance to f is actually in PLIN. Call this function g. Then it is easy to see that there exists some function h in PNLTF such that dist(g, h) = 2−n. To this end, note that if g is the all-zero function, we can define h such that h(x) = 1 for some x 6= 0n and 0 everywhere else. By construction h is non-linear but triangle-free. If g is a non-trivial linear function, then we can pick any x ∈ supp(g) and define h(x) = 0 and h(y) = g(y) for all y 6= x. By construction h is non-linear, and since P(111)-FREE is monotone, h remains triangle-free. Thus, by Triangle inequality, we know that dist(f, P(111)-FREE) = dist(f, g) is at least dist(f, h)− 2−n. This implies that dist(f, P(111)-FREE) ≥ dist(f, PNLTF) − 2−n. Since any linear function is 2−n-close to a function in PNLTF, intuitively we expect PNLTF, which is obtained by deleting the strip PLIN from P(111)-FREE, to inherit the testability features of P(111)-FREE. Indeed, we record this next by using the set-theoretic machinery set up in Section 3. Theorem 4. PNLTF is testable, but any non-adaptive 6 tester (with one-sided error) for PNLTF requires ω(1/ǫ) queries. Proof. We first observe that PNLTF is testable with one-sided error. By Proposition 7 and Observation 2, the testing algorithm for PNLTF is simply the same as the tester for P(111)-FREE [24]. Next we show that the lower bound for the query complexity of PNLTF is the same as P(111)-FREE. As shown in [17], any one-sided, non-adaptive tester for P(111)-FREE requires ω(1/ǫ) queries.7 Suppose PNLTF is testable with one-sided error and has query complexity O(1/ǫ). Since PLIN is testable with query complexity O(1/ǫ) [18], by Proposition 1 P(111)-FREE = PLIN ∪ PNLTF is testable with one-sided error and has query complexity O(1/ǫ), a contradiction. 6A tester is non-adaptive if all its query points can be determined before the execution of the algorithm, i.e., the locations where a tester queries do not depend on the answers to previous queries. 7The specific lower bound shown in [17] is Ω(( 1 by Eli Ben-Sasson and the third author of the present paper. ǫ )1.704···) but can be improved to be Ω(( 1 ǫ )2.423···) as observed independently 10 5 Concluding remarks We have initiated a general study of the closure of testability under various set operations. Our results show that such a study can lead to both upper and lower bound results in property testing. We believe our answers are far from complete, and further investigation may lead to more interesting results. For example, the def symmetric difference between two properties P1 and P2 is defined to be P1 △ P2 = (P1 \ P2) ∪ (P2 \ P1). Under what conditions is the property P1 △ P2 testable if both P1 and P2 are testable? Another natural generalization of our approach is to examine properties resulting from a finitely many application of some set-theoretic operations. Our proof that the class of disjunction of linear functions is testable employs a BLR-style self-correction approach. We believe that this technique may be useful in analyzing other non-monotone, pattern-free properties. In particular, it will be interesting to carry out our approach of decomposing an algebraic property into atomic ones for higher degree polynomials. This will, in addition to giving a set-theoretic proof for testing low-degree polynomials, sheds light on how pattern-free properties relate to one another. Finally, our quadratic query complexity upper bound for the disjunction of linear functions opens up a number of directions. In our work, the blowup in query complexity from the disjunction is O(1/ǫ). One may vary the underlying properties and the operators to measure the blowup in query complexity. Of particular interest may be understanding how the disjunction affects the testability of low-degree polynomials. Acknowledgments We thank the anonymous referees for numerous suggestions and the reference to [23]. References [1] Noga Alon. Testing subgraphs in large graphs. Random Structures and Algorithms, 21(3-4):359 -- 370, 2002. [2] Noga Alon, Eldar Fischer, Michael Krivelevich, and Mario Szegedy. Efficient testing of large graphs. Combinatorica, 20(6):451 -- 476, 2000. [3] Noga Alon, Eldar Fischer, Ilan Newman, and Asaf Shapira. A combinatorial characterization of the testable graph properties: it's all about regularity. In STOC'06: Proceedings of the 38th Annual ACM Symposium on Theory of Computing, pages 251 -- 260, 2006. [4] Noga Alon, Tali Kaufman, Michael Krivelevich, Simon Litsyn, and Dana Ron. Testing low-degree polynomials over GF(2). In Proceedings of Random 2003, pages 188 -- 199, 2003. [5] Noga Alon, Michael Krivelevich, Ilan Newman, and Mario Szegedy. Regular languages are testable with a constant number of queries. SIAM Journal on Computing, 30(6):1842 -- 1862, 2000. [6] Noga Alon and Asaf Shapira. Testing subgraphs in directed graphs. Journal of Computer and System Sciences, 69(3):354 -- 382, 2004. [7] Noga Alon and Asaf Shapira. A characterization of the (natural) graph properties testable with one- sided error. In FOCS'05: Proceedings of the 46th Annual IEEE Symposium on Foundations of Com- puter Science, pages 429 -- 438, 2005. 11 [8] Noga Alon and Asaf Shapira. Every monotone graph property is testable. In STOC'05: Proceedings of the 37th Annual ACM Symposium on Theory of Computing, pages 128 -- 137, 2005. [9] Tim Austin and Terence Tao. On the testability and repair of hereditary hypergraph properties. http://arxiv.org/abs/0801.2179, 2008. [10] Mihir Bellare, Don Coppersmith, Johan Håstad, Marcos A. Kiwi, and Madhu Sudan. Linearity testing over characteristic two. IEEE Transactions on Information Theory, 42(6):1781 -- 1795, 1996. [11] Mihir Bellare, Oded Goldreich, and Madhu Sudan. Free bits, PCPs, and nonapproximability -- towards tight results. SIAM Journal on Computing, 27(3):804 -- 915, 1998. [12] Mihir Bellare, Shafi Goldwasser, Carsten Lund, and Alexander Russell. Efficient probabilistically In STOC'93: Proceedings of the 25th Annual checkable proofs and applications to approximation. ACM Symposium on Theory of Computing, pages 304 -- 294, 1993. [13] Eli Ben-Sasson, Prahladh Harsha, and Sofya Raskhodnikova. Some 3CNF properties are hard to test. SIAM Journal on Computing, 35(1):1 -- 21, 2005. Early version in STOC'03. [14] Itai Benjamini, Oded Schramm, and Asaf Shapira. Every minor-closed property of sparse graphs is In STOC'08: Proceedings of the 40th Annual ACM Symposium on Theory of Computing, testable. pages 393 -- 402, 2008. [15] Arnab Bhattacharyya, Victor Chen, Madhu Sudan, and Ning Xie. Testing linear-invariant non-linear properties. In STACS'09, pages 135 -- 146, 2009. [16] Arnab Bhattacharyya, Elena Grigorescu, and Asaf Shapira. A unified framework for testing linear- invariant properties. In FOCS'10: Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science, 2010. [17] Arnab Bhattacharyya and Ning Xie. Lower bounds for testing triangle-freeness in Boolean functions. In SODA'10: Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, pages 87 -- 98, 2010. [18] Manuel Blum, Michael Luby, and Ronitt Rubinfeld. Self-testing/correcting with applications to nu- merical problems. Journal of Computer and System Sciences, 47(3):549 -- 595, 1993. [19] Christian Borgs, Jennifer T. Chayes, László Lovász, Vera T. Sós, Balázs Szegedy, and Katalin Veszter- In STOC'06: Proceedings of the 38th Annual ACM gombi. Graph limits and parameter testing. Symposium on Theory of Computing, pages 261 -- 270, 2006. [20] Ilias Diakonikolas, Homin K. Lee, Kevin Matulef, Krzysztof Onak, Ronitt Rubinfeld, Rocco Servedio, and Andrew Wan. Testing for concise representations. In FOCS'07: Proceedings of the 48th Annual IEEE Symposium on Foundations of Computer Science, pages 549 -- 558, 2007. [21] Eldar Fischer and Ilan Newman. Testing versus estimation of graph properties. SIAM Journal on Computing, 37(2):482 -- 501, 2007. [22] Oded Goldreich, Shafi Goldwasser, and Dana Ron. Property testing and its connection to learning and approximation. Journal of the ACM, 45(4):653 -- 750, 1998. 12 [23] Parikshit Gopalan, Ryan O'Donnell, Rocco A. Servedio, Amir Shpilka, and Karl Wimmer. Testing Fourier dimensionality and sparsity. In ICALP (1), pages 500 -- 512, 2009. [24] Ben Green. A Szemerédi-type regularity lemma in abelian groups, with applications. Geom. Funct. Anal., 15(2):340 -- 376, 2005. [25] Charanjit S. Jutla, Anindya C. Patthak, Atri Rudra, and David Zuckerman. Testing low-degree poly- nomials over prime fields. In FOCS'04: Proceedings of the 45th Annual IEEE Symposium on Foun- dations of Computer Science, pages 423 -- 432, 2004. [26] Tali Kaufman and Dana Ron. Testing polynomials over general fields. In FOCS'04: Proceedings of the 45th Annual IEEE Symposium on Foundations of Computer Science, pages 413 -- 422, 2004. [27] Tali Kaufman and Madhu Sudan. Algebraic property testing: The role of invariance. In STOC'08: Proceedings of the 40th Annual ACM Symposium on Theory of Computing, pages 403 -- 412, 2008. [28] Marcos Kiwi. Algebraic testing and weight distributions of codes. Theoretical Computer Science, 299(1-3):81 -- 106, 2003. Earlier version appeared as ECCC TR97-010, 1997. [29] Dan Král, Oriol Serra, and Lluis Vena. A removal lemma for systems of linear equations over finite fields, 2008. [30] Michal Parnas, Dana Ron, and Ronitt Rubinfeld. Tolerant property testing and distance approximation. Journal of Computer and System Sciences, 72(6):1012 -- 1042, 2006. [31] Michal Parnas, Dana Ron, and Alex Samorodnitsky. Testing basic Boolean formulae. SIAM Journal on Discrete Mathematics, 16(1):20 -- 46, 2003. [32] Vojtech Rödl and Mathias Schacht. Generalizations of the removal lemma. Combinatorica, To appear. Earlier version in STOC'07. [33] Ronitt Rubinfeld and Madhu Sudan. Robust characterizations of polynomials with applications to program testing. SIAM Journal on Computing, 25(2):252 -- 271, 1996. [34] Asaf Shapira. Green's conjecture and testing linear-invariant properties. In STOC'09: Proceedings of the 41st Annual ACM Symposium on Theory of Computing, pages 159 -- 166, 2009. A Proof of Proposition 1 Let T1 be the tester for P1 with query complexity q1(ǫ, n) and T2 be the tester for P2 with query complexity q2(ǫ, n). We may assume that both T1 and T2 have soundness 1/6 with a constant blowup in their query complexity. Define T to be the tester which, on input function f , first simulates T1 and then T2. If at least one of the two testers T1 and T2 accepts f , T accepts f . Otherwise, T rejects. Clearly the query complexity of T is O(q1 + q2). For completeness, note that if f is in P, then by definition f is in at least one of P1 and P2. Thus, T accepts f with probability 1. Now suppose dist(f, P) ≥ ǫ. Then we have both dist(f, P1) ≥ ǫ and dist(f, P2) ≥ ǫ. By the union bound, the probability that at least one of T1 and T2 accepts f is at most 1/6 + 1/6 = 1/3. 13 B Proof of Proposition 2 Let T1 be the tester for P1 with query complexity q1(ǫ), and T2 be the tester for P2 with query complexities q2(ǫ). First we convert T1 into another tester T ′ 1 makes Q′ 1 for P1 such that, on input distance parameter ǫ, T ′ 1(ǫ) queries, where Q′ 1(x) =(q1(x), max{q1(x), qi( ǫ0 2 )}, if x < ǫ0 2 ; otherwise. 1 can be obtained from T1 by making more queries when x is larger than ǫ0/2. Similarly, 1(ǫ) = O(q1(ǫ)) and 2 from T2 in the same manner. Since ǫ0 is a constant, we have Q′ In other words, T ′ we can construct T ′ Q′ 2(ǫ) = O(q2(ǫ)). Define T to be the tester that on input function f , first simulates T ′ 1 and then T ′ T ′ 2 accept, then T accepts f . Otherwise, it rejects. The query complexity of T is Q′ O(q1(ǫ) + q2(ǫ)). 2. If both testers T ′ 1(ǫ) + Q′ 1 and 2(ǫ), which is For the completeness, if f ∈ P, then both f ∈ P1 and f ∈ P2 hold. Therefore, T accepts with probability at least 1. For the soundness, suppose dist(f, P) ≥ ǫ. We distinguish between two cases. Case 1. ǫ ≤ ǫ0 2 . It suffices to show that f is ǫ-far from at least one of P1 or P2. This fact then implies that T , in simulating T ′ and T ′ 2, accepts f with probability at most 1/3. To show the f is far from at least one of the two properties, suppose not, that we have both dist(f, P1) < ǫ and dist(f, P2) < ǫ. That is, there exist g1 ∈ P1 and g2 ∈ P2 such that dist(f, g1) < ǫ and dist(f, g2) < ǫ. Since dist(f, P) ≥ ǫ, g1, g2 /∈ P and therefore g1 ∈ P1 \ P and g2 ∈ P2 \ P. By triangle inequality, dist(g1, g2) < 2ǫ ≤ ǫ0, and consequently dist(P1 \ P2, P2 \ P1) < ǫ0, contradicting our assumption. Case 2. ǫ > ǫ0 2 . There are three sub-cases depending on where f is located. We analyze each of them separately below. Note that in each of the sub-cases, f is at least ǫ0/2-far from one of P1 and P2. 1. f ∈ P1\P. Then by our assumption on the distance between P1\P2 and P2\P1, dist(f, P2\P) ≥ ǫ0. It follows that dist(f, P2) = min{dist(f, P), dist(f, P2 \ P)} ≥ min{ǫ, ǫ0} ≥ ǫ0/2. 2. f ∈ P2 \ P. Analogous to the case above, we have dist(f, P1) ≥ ǫ0/2. 3. f /∈ P1 ∪ P2. Then by triangle inequality, max{dist(f, P1 \ P), dist(f, P2 \ P)} ≥ ǫ0/2. So there is some i ∈ {1, 2} such that dist(f, Pi \ P) ≥ ǫ0/2. Since dist(f, P) ≥ ǫ, it follows that dist(f, Pi) ≥ min{ǫ, ǫ0/2} = ǫ0/2. Thus, we conclude that there is some i ∈ {1, 2} such that dist(f, Pi) ≥ ǫ0/2. This implies that T ′ makes at least Q′ probability at most 1/3 as well, completing the proof. i , which i(ǫ) ≥ qi(ǫ0/2) queries, accepts f with probability at most 1/3. Hence, T accepts f with 14 C Proof of Proposition 3 We shall define a property P = {P2k}k>0, where P2k ⊆ {0, 1}F2k is a collection of Boolean functions defined over F2k 2 , such that neither P2k nor P2k is testable. Recall that a property P is said to be testable if there is a tester for P whose query complexity is independent of the sizes of the inputs to the functions (in our case, independent of k). 2 First, let the Hadamard encoding Had : Fk isomorphic to Fk Had ◦ g : F2k 2, so for every function g : F 2 → {0, 1} where (Had ◦ g)(x, y) 2 × Fk 2k → F def = Had(g(x), y). 2k is 2 → {0, 1} be Had(α, x) = α · x. Note that F 2k, the Hadamard concatenation of g can be written as We now define P2k as follows. Let f ∈ P2k if there exists a polynomial p : F 2k of degree at most 2k−1 − 1 such that dist(f, Had ◦ p) < 1/8. An important fact is that if g : F 2k is a polynomial of degree 2k−1, then Had ◦ g is not in P2k. To see this, note that by the Schwartz-Zippel Lemma, 2k is a polynomial of degree at most 2k−1, then Prx[q(x) = 0] ≤ 1/2. Therefore, for any if q : F polynomial p of degree at most 2k−1 − 1, dist(p, g) ≥ 1/2. This implies that dist(Had ◦ p, Had ◦ g) ≥ 1/4, since the Hadamard encoding has relative distance 1/2.8 Since the Hadamard encoding of g is at least 1/4- far from the Hadamard encoding of any degree 2k−1 − 1 polynomials, by construction of P2k, Had ◦ g is at least 1/8-far from P , i.e., Had ◦ g ∈ P2k. 2k → F 2k → F 2k → F Now we show that neither P2k nor its complement is testable for any distance parameter ǫ < 1/8. By polynomial interpolation, for every set of 2k−1 − 1 points, there exists a polynomial of degree 2k−1 − 1 that agrees with g on these points. So any tester that distinguishes between members of P2k and members at least ǫ-far away from P2k needs at least 2k−1 − 1 queries. Similarly, as we have just shown that Had ◦ g ∈ P2k when g is a degree-2k−1 polynomial, it follows that any tester that distinguishes between members of P2k and functions at least ǫ-far away from P2k also need at least 2k−1 queries. To conclude, we have shown a property P defined over domains of sizes D = 22k but testing P and P both require Ω(2k) = Ω(D1/2) queries. Thus, neither the property or its complement is testable with a query complexity independent of the sizes of the domains, completing the proof. D Proof of Proposition 4 Let T1 be the tester for P1 with query complexity q1(ǫ) and let T2 be the tolerant tester for P2 with query 1 such that, on input distance parameter ǫ, T ′ complexity q2(ǫ1, ǫ2). First we convert T1 into another tester T ′ 1 makes Q′ 1(ǫ) queries, where Q′ 1(x) =(q1(x), max{q1(x), qi(ǫ1)}, if x < ǫ1; otherwise. Set P = P1 \ P2 and define its tester T as follows: on input function f , T first simulates T1 and then T2. 1(ǫ)) = O(ǫ), and T has query complexity T accepts iff T1 accepts and T2 rejects. Since ǫ1 is a constant, Q′ O(q1 + q2). For completeness, if f ∈ P, then by assumption f ∈ P1 and dist(f, P2) ≥ ǫ0 > ǫ2. This implies that T1 always rejects f , T2 accepts f with probability at most 1/3, and thus by a union bound argument T accepts f with probability at least 2/3. 8In other words, suppose x ∈ F is exactly 2k−1. 2k satisfies that p(x) 6= g(x). Then the number of y's such that Had(p(x), y) 6= Had(g(x), y) 15 For soundness, suppose dist(f, P) ≥ ǫ. We consider two cases and note that in both of them, T accepts f with probability at most 1/3. Case 1. dist(f, P2) ≤ ǫ1. Since T2 is a tolerant tester, T2 rejects f with probability at most 1/3. Thus, T accepts with probability at most 1/3 as well. Case 2. dist(f, P2) > ǫ1. Since P1 is the union of P and P2, we can conclude that dist(f, P1) = min{dist(f, P), dist(f, P2)}, 1 accepts which is at least min{ǫ, ǫ1}. Since T ′ f with probability at most 1/3, and hence, T accepts f with probability at most 1/3 as well. 1 makes at least max{q1(ǫ), q1(ǫ1)} queries, we know that T ′ 16
1510.03945
2
1510
2017-01-19T21:44:13
An $O(\log OPT)$-approximation for covering and packing minor models of ${\theta}_r$
[ "cs.DS", "math.CO" ]
Given two graphs $G$ and $H$, we define $\textsf{v-cover}_{H}(G)$ (resp. $\textsf{e-cover}_{H}(G)$) as the minimum number of vertices (resp. edges) whose removal from $G$ produces a graph without any minor isomorphic to ${H}$. Also $\textsf{v-pack}_{H}(G)$ (resp. $\textsf{v-pack}_{H}(G)$) is the maximum number of vertex- (resp. edge-) disjoint subgraphs of $G$ that contain a minor isomaorphic to $H$. We denote by $\theta_r$ the graph with two vertices and $r$ parallel edges between them. When $H=\theta_r$, the parameters $\textsf{v-cover}_{H}$, $\textsf{e-cover}_{H}$, $\textsf{v-pack}_{H}$, and $\textsf{v-pack}_{H}$ are NP-hard to compute (for sufficiently big values of $r$). Drawing upon combinatorial results in [Minors in graphs of large $\theta_r$-girth, Chatzidimitriou et al., arXiv:1510.03041], we give an algorithmic proof that if $\textsf{v-pack}_{\theta_r}(G)\leq k$, then $\textsf{v-cover}_{\theta_r}(G) = O(k\log k)$, and similarly for $\textsf{v-pack}_{\theta_r}$ and $\textsf{e-cover}_{\theta_r}$. In other words, the class of graphs containing ${\theta_r}$ as a minor has the vertex/edge Erd\H{o}s-P\'osa property, for every positive integer $r$. Using the algorithmic machinery of our proofs, we introduce a unified approach for the design of an $O(\log {\rm OPT})$-approximation algorithm for $\textsf{v-pack}_{\theta_r}$, $\textsf{v-cover}_{\theta_r}$, $\textsf{v-pack}_{\theta_r}$, and $\textsf{e-cover}_{\theta_r}$ that runs in $O(n\cdot \log(n)\cdot m)$ steps. Also, we derive several new Erd\H{o}s-P\'osa-type results from the techniques that we introduce.
cs.DS
cs
An O(log OPT)-approximation for covering and packing minor models of θr∗ Dimitris Chatzidimitriou† Jean-Florent Raymond‡§ Ignasi Sau§ Dimitrios M. Thilikos† § Abstract Given two graphs G and H, we define v-coverH (G) (resp. e-coverH (G)) as the minimum number of vertices (resp. edges) whose removal from G produces a graph without any minor isomorphic to H. Also v-packH (G) (resp. e-packH (G)) is the maximum number of vertex- (resp. edge-) disjoint subgraphs of G that contain a minor isomorphic to H. We denote by θr the graph with two vertices and r parallel edges between them. When H = θr, the parameters v-coverH , e-coverH , v-packH , and e-packH are NP-hard to compute (for sufficiently big values of r). Drawing upon combinatorial results in [7], we give an algorithmic proof that if v-packθr (G) ≤ k, then v-coverθr (G) = O(k log k), and similarly for e-packθr and e-coverθr . In other words, the class of graphs containing θr as a minor has the vertex/edge Erdos-P´osa property, for every positive integer r. Using the algorithmic machinery of our proofs we introduce a unified approach for the design of an O(log OPT)-approximation algorithm for v-packθr , v-coverθr , e-packθr , and e-coverθr that runs in O(n · log(n) · m) steps. Also, we derive several new Erdos-P´osa-type results from the techniques that we introduce. Keywords: Erdos-P´osa property, packings in graphs, coverings in graphs, minor- models of θr, approximation algorithms, protrusion decomposition. MSC 2010: 05C70. 1 Introduction All graphs in this paper are undirected, do not have loops but they may contain multiple edges. We denote by θr the graph containing two vertices x and y connected by r parallel edges between x and y. Given a graph class C and a graph G, we call C-subgraph of G any subgraph of G that is isomorphic to some graph in C. All along this paper, when giving the running time of an algorithm with input some graph G, we agree that n = V (G) and m = E(G). ∗This research have been supported by the Warsaw Centre of Mathematics and Computer Science (Jean- Florent Raymond), by the (Polish) National Science Centre grant PRELUDIUM 2013/11/N/ST6/02706 (Jean-Florent Raymond), and by the E.U. (European Social Fund - ESF) and Greek national funds through the Operational Program "Education and Lifelong Learning" of the National Strategic Reference Framework (NSRF) - Research Funding Program: "Thales. Investing in knowledge society through the European Social Fund" (Dimitris Chatzidimitriou and Dimitrios M. Thilikos). Email addresses: [email protected] , [email protected], [email protected], and [email protected]. †Department of Mathematics, National and Kapodistrian University of Athens, Greece. ‡Faculty of Mathematics, Informatics and Mechanics, University of Warsaw, Poland. §AlGCo project team, CNRS, LIRMM, France. 1 Packings and coverings. Paul Erdos and Lajos P´osa, proved in 1965 [12] that there is a function f : N → N such that for each positive integer k, every graph either contains k vertex-disjoint cycles or it contains f (k) vertices that intersect every cycle in G. Moreover, they proved that the "gap" of this min-max relation is f (k) = O(k · log k) and that this gap is optimal. This result initiated an interesting line of research on the duality between coverings and packings of combinatorial objects. To formulate this duality, given a class C of connected graphs, we define v-coverC(G) (resp. e-coverC(G)) as the minimum cardinality of a set S of vertices (resp. edges) such that each C-subgraph of G contains some element of S. Also, we define v-packC(G) (resp. e-packC(G)) as the maximum number of vertex- (resp. edge-) disjoint C-subgraphs of G. the edge Erdos -- P´osa prop- erty) if there is a function f : N → N, called gap function, such that, for every graph G, v-coverC(G) ≤ f (v-packC(G)) (resp. e-coverC(G) ≤ f (e-packC(G))). Using this terminology, the original result of Erdos and P´osa says that the set of all cycles has the vertex Erdos -- P´osa property with gap O(k · log k). The general question in this branch of Graph Theory is to detect instantiations of C which have the vertex/edge Erdos -- P´osa property (in short, v/e- EP-property) and when this is the case, minimize the gap function f . Several theorems of this type have been proved concerning different instantiations of C such as odd cycles [24,30], long cycles [3], and graphs containing cliques as minors [10] (see also [18, 22, 34] for results on more general combinatorial structures and [31, 33] for surveys). We say that C has the vertex Erdos -- P´osa property (resp. A general class that is known to have the v-EP-property is the class CH of the graphs that contain some fixed planar graph H as a minor1. This fact was proven by Robertson and Seymour in [35] and the best known general gap is f (k) = O(k · logO(1) k) due to the results of [8] -- see also [14 -- 16] for better gaps for particular instantiations of H. Moreover, the planarity of H appears to be the right dichotomy, as for non-planar H's, CH does not satisfy the v-EP-property. Besides the near-optimality of the general upper bound of [8], it is open whether the lower bound Ω(k · log k) can be matched for the general gap function, while this is indeed the case when H = θr [14]. The question about classes that have the e-EP-property has also attracted some attention (see [3]). According to [9, Exercise 23 of Chapter 7], the original proof of Erdos and P´osa implies that cycles have the e-EP-property with gap O(k· log k). Moreover, as proved in [32], the class Cθr has the e-EP-property with the (non-optimal) gap f (k) = O(k2 · logO(1) k). Interestingly, not much more is known on the graphs H for which CH has the e-EP-property and is tempting to conjecture that the planarity of H provides again the right dichotomy. Other graph classes that are known to have the e-EP-property are rooted cycles [29] (here the cycles to be covered and packed are required to intersect some particular set of terminals of G) and odd cycles for the case where G is a 4-edge connected graph [23], a planar graph [26], or a graph embeddable in an orientable surface [24]. Approximation algorithms. The above defined four graph parameters are already quite general when C := CH. From the algorithmic point of view, the computation of x-packCH (for x ∈ {v, e}) corresponds to the general family of graph packing problems, while the computation of x-coverCH belongs to the general family of graph modification problems where the modification operation is the removal of vertices/edges (depending on whether x = v or x = e). Interestingly, particular instantiations of H = θr generate known, well studied, NP- hard problems. For instance, asking whether v-coverCθr ≤ k generates Vertex Cover for r = 1, Feedback Vertex Set for r = 2, and Diamond Hitting Set for r = 3 [13, 17]. (G) ≥ k corresponds to Vertex Cycle Packing [6, 25] Moreover, asking whether x-packCθ2 and Edge Cycle Packing [1, 27] when x = v and x = e, respectively. Finally, asking 1A graph H is a minor of a graph G if it can be obtained from some subgraph of G by contracting edges. 2 (G) ≤ k corresponds to the Maximum Cactus Subgraph2. All whether E(G)− e-coverCθ3 parameters keep being NP-complete to compute because the aforementioned base cases can be reduced to the general one by replacing each edge by one of multiplicity r − 1. From the approximation point of view, it was proven in [17] that, when H is a planar graph, there is a randomized polynomial O(1)-approximation algorithm for v-coverH . For the , O(log n)-approximations are known for every r ≥ 1 because cases of v-coverCθr and v-packCθr of [21] (see also [36]). Moreover, v-coverCθr admits a deterministic 9-approximation [13]. (G) it is known, from [28], that there is a polynomial O(√log n)- Also, about e-packCθr approximation algorithm for the case where r = 2. Notice also that for r = 1, it is trivial to compute e-coverCθr (G) in polynomial time. However, to our knowledge, nothing is known about the computation of e-coverCθr (G) for r ≥ 3. In this paper we introduce a unified approach for the study of the combi- Our results. natorial interconnections and the approximability of the parameters v-coverCθr , e-coverCθr , v-packCθr Theorem 1. For every r ∈ N≥2 and every x ∈ {v, e} the graph class Cθr has the x-EP- property with (optimal) gap function f (k) = O(k · log k). . Our main combinatorial result is the following. , and e-packCθr Our proof is unified and treats simultaneously the covering and the packing parameters for both the vertex and the edge cases. This verifies the optimal combinatorial bound for the case where x = v [14] and optimally improves the previous bound in [32] for the case where x = e. Based on the proof of Theorem 1, we prove the following algorithmic result. Theorem 2. For every r ∈ N≥2 and every x ∈ {v, e}, there is an algorithm that, given a (G) in O(n · graph G, outputs an O(log OPT)-approximation of x-coverCθr (G) and x-packCθr log(n) · m) steps when x = v and in O(m2 log n) steps when x = e. Theorem 2 improves the results in [21] for the cases of v-coverCθr and v-packCθr is the first approximation algorithm for e-coverCθr and e-packCθr and, to our knowledge, for r ≥ 3. We were also able to derive the following Erdos-P´osa-type result with linear gap on graphs of bounded tree-partition width (the definition of this width parameter is given in Subsection 2.2). Theorem 3. Let t ∈ N. For every x ∈ {v, e}, the following holds: if H is a finite collection of connected graphs and G is a graph of tree-partition width at most t, then x-coverH(G) ≤ α· x- packH(G), where α is a constant which depends only on t and H. Let θr,r′ (for some r, r′ ∈ N≥1) denote the graph obtained by taking the disjoint union of θr and θr′ and identifying one vertex of θr with one of θr′ . Another consequence of our results is that, for every r, r′ ∈ N≥1, the class Cθr,r′ has the edge Erdos -- P´osa property. Theorem 4. For every r, r′ ∈ N, there is a function f r,r′ simple graph G where k = e-packCθ : N≥1 → N≥1 such that for every (G), it holds that e-coverCθ 1 r,r′ r,r′ (G) ≤ f1 r,r′ (k). 2The Maximum Cactus Subgraph problem asks, given a graph G and an integer k, whether G contains a subgraph with k edges where no two cycles share an edge. It is easy to reduce to this problem the Vertex Cycle Packing problem on cubic graphs which, in turn, can be proved to be NP-complete using a simple variant of the NP-completeness proof of Exact Cover by 2-Sets [19]. 3 Our techniques. Our proofs are based on the notion of partitioned protrusion that, roughly, is a tree-structured subgraph of G with small boundary to the rest of G (see Subsection 2.2 for the precise definition). Partitioned protrusions were essentially introduced in [7] by the name edge-protrusions and can be seen as the edge-analogue of the notion of protrusions introduced in [4] (see also [5]). Our approach makes strong use of the main result of [7], that is equivalently stated as Proposition 1 in this paper. According to this result, there exists a polynomial algorithm that, given a graph G and an integer k as an input, outputs one of the following: (1) a collection of k edge/vertex disjoint Cθr-subgraphs of G, (2) a Cθr -subgraph J with O(log k) edges, or (3) a large partitioned protrusion of G. Our approximation algorithm does the following for each k ≤ V (G). If the first case of the above combinatorial result applies on G, we can safely output a packing of k Cθr -subgraphs in G. In the second case, we make some progress as we may remove the vertices/edges of J from G and then set k := k− 1. In order to deal with the third case, we prove that in a graph G with a sufficiently large partitioned protrusion, we can either find some Cθr -subgraph with O(log k) edges (which is the same as in the second case), or we can replace it by a smaller graph where both x-coverH and x-packH remain invariant (Lemma 1). The proof that such a reduction is possible is given in Section 3 and is based on a suitable dynamic programming encoding of partial packings and coverings that is designed to work on partitioned protrusions. Notice that the "essential step" in the above procedure is the second case that reduces the packing number of the current graph by 1 to the price of reducing the covering number by O(log k). This is the main argument that supports the claimed O(log OPT)-approximation algorithm (Theorem 2) and the corresponding Erdos -- P´osa relations in Theorem 1. Finally, Theorem 3 is a combinatorial implication of Lemma 1 and Theorem 4 follows by combining Theorem 3 with the results of Ding and Oporowski in [11]. In Section 2 we provide all concepts and notation that we Organization of the paper. use in our proofs. Section 3 contains the proof of Lemma 1, which is the main technical part of the paper. The presentation and analysis of our approximation algorithm is done in Section 4, where Theorem 1 and Theorem 2 are proven. Section 5 contains the proofs of Theorem 3 and Theorem 4. Finally, we summarize our results and provide several directions for further research in Section 6. 2 Preliminaries 2.1 Basic definitions Let t = (x1, . . . , xl) ∈ Nl and χ, ψ : N → N. We say that χ(n) = Ot(ψ(n)) if there exists a computable function φ : Nl → N such that χ(n) = O(φ(t) · ψ(n)). For every i, j ∈ N, we denote by Ji, jK the interval of {i, . . . , j}. Graphs. All graphs in this paper are undirected, loopless, and may have multiple edges. For this reason, a graph G is represented by a pair (V, E) where V is its vertex set, denoted by V (G) and E is its edge multi-set, denoted by E(G). The edge-multiplicity of an edge of G is the number of times it appears in E(G). We set n(G) = V (G) and m(G) = E(G). If H is a finite collection of connected graphs, we set n(H) = PH∈H n(H), m(H) = PH∈H m(H), and ∪∪∪∪∪∪∪∪∪H = SG∈H G. We denote by δ(G) the minimum degree of G, that is the minimum number of neighbors a vertex can have in G. Let x ∈ {v, e} where, in the rest of this paper, v will be interpreted as "vertex" and e will be interpreted as "edge". Given a graph G, we denote by Ax(G) the set of vertices or edges of G depending on whether x = v or x = e, respectively. 4 Given a graph H and a graph J that are both subgraphs of the same graph G, we define the subgraph H ∩G J of G as the graph (V (H) ∩ V (J), E(H) ∩ E(J)). Given a graph G and a set S ⊆ V (G), such that all vertices of S have degree 2 in G, we define diss(G, S) as the graph obtained from G after we dissolve in it all vertices in S, i.e., replace each maximal path whose internal vertices are in S with an edge whose endpoints are the endpoints of the path. A rooted tree is a pair (T, s) where T is a tree and s ∈ V (T ) is a distinguished vertex If v ∈ V (T ), a vertex u ∈ V (T ) is a descendant of v in (T, s) if v called the root of T . lies on the (unique) path from u to s. Note that v is a descendant of itself. We denote by children(T,s)(v) the set of children of v, which are the vertices that are both neighbors and descendants of v. Given a graph G and an edge e = (u, v) ∈ E(G), the subdivision of e is defined as the operation of removing e and adding a new vertex w and the edges (w, u) and (w, v). A graph H is called a subdivision of G, if it can be obtained by performing a series of subdivisions in G. Minors and topological minors. Given two graphs G and H, we say that H is a minor of G if there exits some function φ : V (H) → 2V (G) such that • for every v ∈ V (H), G[φ(v)] is connected; • for every two distinct v, u ∈ V (H), φ(v) ∩ φ(u) = ∅; and • for every edge e = {v, u} ∈ E(H) of multiplicity l, there are at least l edges in G with one endpoint in φ(v) and the other in φ(u). We say that H is a topological minor of G if there exits some collection P of paths in G and an injection φ : V (H) → V (G) such that • no path in P has an internal vertex that belongs to some other path in P; • φ(V (H)) is the set of endpoints of the paths in P; and • for every two distinct v, u ∈ V (H), {v, u} is an edge of H of multiplicity l if and only if there are l paths in P between φ(v) and φ(u). Given a graph H, we define by ex(H) the set of all topologically-minor minimal graphs that contain H as a minor. Notice that the size of ex(H) is upper-bounded by some function of m(H) and that H is a minor of G if it contains a member of ex(H) as a topological minor. An H-minor model of G is any minimal subgraph of G that contains a member of ex(H) as a topological minor. Subdivisions. The subdivision of an edge {u, v} of a graph is the operation that introduces a new vertex w to the graph adjacent to u and v and deletes the edge. A graph G is a subdivision of H if it can be obtained from H by repeteadly subdividing edges. If G is a graph and H is a finite collection of connected graphs, an H-subdivision of G is a subgraph M of G that is a subdivision of a graph, denoted by M , that is isomorphic to a member of H. Clearly, the vertices of M are vertices of G and its edges correspond to paths in G between their endpoints such that internal vertices of a path do not appear in any other path. We refer to the vertices of M in G as the branch vertices of the H-subdivision M , whereas internal vertices of the paths between branch vertices will be called subdivision vertices of M . Note that we are here dealing with what is sometimes called a topological minor model. A graph which contains no H-subdivision is said to be H-free. Notice that G has an H-subdivision iff G contains a graph of H as a topological minor. 5 Packings and coverings. An x-H-packing of size k of a graph G is a collection P of k pairwise x-disjoint H-subdivisions of G. Given an x ∈ {v, e}, we define P≥k x,H(G) as the set of all x-H-packings of G of size at least k. An x-H-covering of a graph G is a set C ⊆ Ax(G) such that G \ C does not contain any H-subdivision. We define C≤k x,H(G) as the set of all x-H-coverings of G of size at most k. We finally define x-coverH(G) = min{k C≤k x,H(G) 6= ∅} and x-packH(G) = max{k P≥k x,H(G) 6= ∅}. These numbers are well-defined: G always has a packing of size 0 (the empty packing) and a covering of size Ax(G) (which contains all vertices/edges of G). It is easy to observe that, for every graph G and every finite collection of connected graphs H, the following inequalities hold: v-coverH(G) ≤ e-coverH(G), v-packH(G) ≤ v-coverH(G), v-packH(G) ≤ e-packH(G), e-packH(G) ≤ e-coverH(G). Notice that the definition of these invariants differs from that given in the introduction. 2.2 Boundaried graphs Informally, a boundaried graph will be used to represent a graph that has been obtained by "dissecting" a larger graph along some of its edges, where the boundary vertices correspond to edges that have been cut. Boundaried graphs. A boundaried graph G = (G, B, λ) is a triple consisting of a graph G, where B is a set of vertices of degree one (called boundary) and λ is a bijection from B to a subset of N≥1. The edges with at least one endpoint in B are called boundary edges. We define E s(G) as the subset of E(G) of boundary edges. We stress that instead of N≥1 we could choose any other set of symbols to label the vertices of B. We denote the set of labels of G by Λ(G) = λ(B). Given a finite collection of connected graphs H, we say that a boundaried graph G is H-free if G \ B is H-free. Two boundaried graphs G1 and G2 are compatible if Λ(G1) = Λ(G2). Let now G1 = (G1, B1, λ1) and G2 = (G2, B2, λ2) be two compatible boundaried graphs. We define the graph G1⊕G2 as the non-boundaried graph obtained by first taking the disjoint union of G1 and G2, then, for every i ∈ Λ(G1), identifying λ−1 2 (i), and finally dissolving all resulting identified vertices. Suppose that e is an edge of G = G1⊕G2 that was created after dissolving the vertex resulting from the identification of a vertex v1 in B1 and a vertex v2 in B2 and that ei is the boundary edge of Gi that has vi as endpoint, for i = 1, 2. 1 (i) with λ−1 Figure 1 shows the result of the operation ⊕ on two graphs. Boundaries are drawn in gray and their labels are written next to them. The graphs G1 and G2 on this picture are compatible as Λ(G1) = Λ(G2) = {0, 1, 2, 3}. For every t ∈ N≥1, we denote by Bt all boundaried graphs whose boundary is labeled by numbers in J1, tK. Given a boundaried graph G = (G, B, λ) and a subset S of V (G) such that all vertices in S have degree 2 in G, we define diss(G, S) as the graph G = ( G, B, λ) where G = diss(G, S). Let W be a graph and S be a non-empty subset of V (W ). An S-splitting of W is a pair (GS, GS c ) consisting of two boundaried graphs GS = (GS, BS, λS) and GS c = (GS c , BS c , λS c ) that can be obtained as follows: First, let W + be the graph obtained by subdividing in W 6 0 1 2 3 ⊕ 2 1 0 3 = G1 G2 G Figure 1: Gluing graphs together: G = G1 ⊕ G2. every edge with one endpoint in S and the other in V (W ) \ S and let B be the set of created vertices. Let λ be any bijection from B to a subset of N≥1. Then GS = W +[S ∪ B], GS c = W + \ S, BS = BS c = B, and λS = λS c = λ. Notice that there are infinite such pairs, depending on the numbers that will be assigned to the boundaries of GS and GS c . Moreover, keep in mind that all the boundary edges of GS are non-loop edges with exactly one endpoint in B and the same holds for the boundary edges of GS c . An example of a splitting is given in Figure 2, where boundaries are depicted by gray vertices. 5 5 3 6 3 6 W GS GS c Figure 2: Cutting a graph: (GS, GS c) is an S-splitting of W , where S consists of all the white vertices. We say that G′ = (G′, B′, λ′) is a boundaried subgraph of G = (G, B, λ) if G′ is a subgraph of G, B′ ⊆ B ∩ V (G′) and λ′ = λB ′. On the other hand, G is a subgraph of a (non-boundaried) graph H if G = HS for some S-splitting (HS, HS c ), where S ⊆ V (H). If H is a graph, G is a subgraph of H, and F = (F, B, λ) is a boundaried subgraph of H, we define G ∩H F as follows. Let S = V (G) ∩ (V (F ) \ B) and let G+ be the graph obtained by subdividing once every edge of G that has one endpoint in S and the other in V (G) \ S. We call B′ the set of created vertices and let G′ = G+[S ∪ B′]. Then G′ is a subgraph of F where B′ ⊆ B. For every v ∈ B′, we set λ′(v) = λ(v), which is allowed according to the previous remark. Then G ∩H F = (G′, B′, λ′). Observe that G ∩H F is part of an S-splitting of G (but not necessarily of H). Given two boundaried graphs G′ = (G′, B′, λ′) and G = (G, B, λ), we say that they are isomorphic if there is an isomorphism from G′ to G that respects the labelings of B and B′, i.e., maps every vertex x ∈ B′ to λ−1(λ′(x)) ∈ B. Given a boundaried graph G = (G, B, λ), we denote n(G) = n(G) − B and m(G) = m(G). Given a boundaried graph G = (G, B, λ) and an x ∈ {v, e}, we set Ax(G) = V (G) \ B or Ax(G) = E(G), depending on whether x = v or x = e. 7 Partial structures. Let H be a family of graphs. A boundaried subgraph J of a boundaried graph G is a partial H-subdivision if there is a boundaried graph H which is compatible with G and a boundaried subgraph J′ of H which is compatible with J such that J ⊕ J′ is an H-subdivision of G⊕H. Intuitively, this means that J can be extended into an H-subdivision in some larger graph. In this case, the H-subdivision J ⊕ J′ is said to be an extension of J. Similarly, for every p ∈ N≥1, a collection of boundaried subgraphs J = {J1, . . . , Jp} of a graph G is a partial x-H-packing if there is a boundaried graph H which is compatible with G and a collection of boundaried subgraphs {J′ 1, . . . , Jp ⊕ J′ p} is an x-H-packing of G ⊕ H. The obtained packing is said to be an extension of the partial packing J . A partial packing is H-free if none of its members (the boundaried graphs {J1, . . . , Jp}) has an H-subdivision. Observe that if the graphs in H are connected, then every partial subdivision of an H-free partial x-H-packing in G must contain at least one boundary vertex of G. p} of H such that {J1 ⊕ J′ 1, . . . , J′ Partitions and protrusions. A rooted tree-partition of a graph G is a triple D = (X , T, s) where (T, s) is a rooted tree and X = {Xt}t∈V (T ) is a partition of V (G) where either n(T ) = 1 or for every {x, y} ∈ E(G), there exists an edge {t, t′} ∈ E(T ) such that {x, y} ⊆ Xt ∪ Xt′ (see also [11, 20, 37]). Given an edge f = {t, t′} ∈ E(T ), we define Ef as the set of edges of G with one endpoint in Xt and the other in Xt′. Notice that all edges in Ef are non-loop edges. The width of D is defined as max{Xtt∈V (T )} ∪ {Eff ∈E(T )}. The tree-partition width of G is the minimum width over all tree-partitions of G and will be denoted by tpw(G). The elements of X are called bags. of the notion of (vertex-)protrusion introduced in [4, 5]. In order to decompose graphs along edge cuts, we introduce the following edge-counterpart Given a rooted tree-partition D = (X , T, s) of G and a vertex i ∈ V (T ), we define Ti as the subtree of T induced by the descendants of i (including i) and Vi = [ h∈V (Ti) Xh, and Gi = G[Vi]. Let W be a graph and t ∈ N≥1. A pair P = (G,D) is a t-partitioned protrusion of W if there exists an S ⊆ V (W ) such that • G = (G, B, λ) is a boundaried graph where G ∈ Bt and G = GS for some S-splitting (GS, GS c) of W and • D = (X , T, s) is a rooted tree-partition of G \ B of width at most t, where Xs are the neighbors in G of the vertices in B. We say that a t-partitioned protrusion (G,D) (with D = ({Xu}u∈V (T ), T, s)) of a graph W is H-free if G is H-free. Recall that in the rooted tree-partition D, for every u ∈ V (T ), we denote by Vu the union of the bags indexed by descendants of u (including u). For every vertex u ∈ V (T ), we define the t-partitioned protrusion Pu of W as a pair Pu = (Gu,Du), where Du = ({Xv}v∈VTu , Tu, u) and Gu is defined as GVu for some Vu-splitting (GVu , GV c u ) of W . Informally speaking, the rooted tree-partition Du is the part of D corresponding to the subgraph of G induced by vertices in the bags that are descendants of u. Figure 3 provides an example of partitioned protrusions. We choose the labeling function of Gs so that it is the same as the one of G, i.e., Gs = G. Notice that the labelings of all other Gu's are arbitrary. For every u ∈ V (T ) we define Gu = {Gl l ∈ children(T,s)(u)}. 8 s Xs B D u Xu G W Du Gu Figure 3: The partitioned protrusion Pu = (Gu,Du) as a substructure of (G,D). White circles represent bags of the rooted tree-partitions. Only the edges between B and Xs are depicted 2.3 Encodings, signatures, and folios In this section we introduce tools that we will use to sort boundaried graphs depending on the subdivisions that are realizable inside. Encodings. Let H be a family of graphs, let t ∈ N≥1, and let x ∈ {v, e}. Recall that if M is an H-subdivision in G, we denote by M a graph isomorphic to some graph of H such that M is a subdivision of M (see Subsection 2.1). If G = (G, B, λ) ∈ Bt is a boundaried graph and S ⊆ Ax(G), we define µx H(G, S) as the collection of all sets {(J1, L1), . . . , (Jσ, Lσ)} such that (i) {J1, . . . , Jσ} is a partial x-H-packing of G \ S of size σ and (ii) Li = V ( Mi) ∩ V (G), where Mi is an extension of Ji, for every i ∈ J1, σK. F G H = {K4, K2,3} Figure 4: A member of P≥1 e,H(F ⊕ G). Branch vertices are circled. 9 J Figure 5: A partial subdivision from the packing of Figure 4. Branch vertices are circled. In other words, Li contains branch vertices of the partial subdivision Ji for every i ∈ J1, σK (see Figures 4 and 5). The set µx H(G, S) encodes all different restrictions in G of partial x-H-packings that avoid the set S. Given a boundaried graph G = (G, B, λ) and a set L ⊆ V (G) such that every vertex of V (G) \ L has degree 2 in G, we define κ(G, L) as the boundaried graph obtained from G by dissolving every vertex of V (G) \ L, i.e., κ(G, L) = (diss(G, V (G) \ L), B, λ). In the definition of κ we assume that the boundary vertices of κ(G, L) remain the same as in G while the other vertices are treated as new vertices (see Figure 6). J Figure 6: The compression of the partial packing of Figure 5: J = κ(J, L). This allows us to introduce the following notation aimed at representing, intuitively, the essential part of each partial packing. H(G, S) = { J = {J1, . . . , Jσ} = {κ(J1, L1), . . . , κ(Jσ, Lσ)} µx {(J1, L1), . . . , (Jσ, Lσ)} ∈ µH(G, S)}. Isomorphisms. graphs in Bt, S ∈ V (G), and S′ ∈ V (G′), we say that a member J of µx member J ′ of µx paired elements are isomorphic. We also say that µx if there is a bijection between them such that paired elements are isomorphic. If G = (G, B, λ) and G′ = (G′, B′, λ′) are two compatible boundaried H(G, S) and a H(G′, S′) are isomorphic if there is a bijection between them such that H(G′, S′) are isomorphic H(G, S) and µx We now come to the point where we can define, for every boundaried graph, a signature encoding all the possible partial packings that can be realized in this graph. Signatures and folios. For every y ∈ N, we set sigx H(G, y) = {µx H(G, S), S ⊆ Ax(G), S = y} and, given two compatible t-boundaried graphs G and G′ and a y ∈ N, we say that sigx and sigx are isomorphic. H(G, y) H(G′, y) are isomorphic if there is a bijection between them such that paired elements Finally, for ρ ∈ N, we set folioH,ρ(G) = (sigv H(G, 0), . . . , sigv H(G, ρ), sige H(G, 0), . . . , sige H(G, ρ)). 10 Given two t-boundaried graphs G and G′, a ρ ∈ N, and a finite collection of connected graphs H, we say that G ≃H,ρ G′ if G and G′ are compatible, neither G nor G′ contains an H-subdivision, and the elements of folioH,ρ(G) and folioH,ρ(G′) are position-wise isomorphic. 3 The reduction The purpose of this section is to prove the following lemma. Lemma 1. There exists a function f2 : N2 → N and an algorithm that, given a positive integer t, a finite collection H of connected graphs where h = m(H), and a t-partitioned protrusion P = (G, (X , T, s)) of a graph W with n(G) > f2(h, t), outputs either • an H-subdivision of W with at most f2(h, t) edges or • a graph W ′ such that x-packH(W ′) = x-packH(W ), x-coverH(W ′) = x-coverH(W ), and n(W ′) < n(W ). Furthermore, this algorithm runs in time Ot,h(n(T )). Moreover, this algorithm can be en- hanced so that given a x-H-packing (resp. x-H-covering) in W ′ then it outputs a same size x-H-packing (resp. x-H-covering) in W . In other words we can, in linear time, either find a small H-subdivision, or reduce the graph to a smaller one where the parameters of packing and covering stay the same. The main lines of the proof are the following. We consider the equivalence relation ≃H,t on H-free t-partitioned protrusions. Informally, ≃H,t relates the partitioned protrusions in which the same partial packings are realizable. The first step is to show that this relation has a finite number of equivalence classes. Recall that each vertex i of the tree T of the partitioned protrusion P defines a partitioned protrusion Pi. We then show that if T is too large (i.e. it has a long path or a vertex of large degree), then for several vertices, such partitioned protrusions belong to the same equivalence class of ≃H,t. We finally show that in this case, some of these vertices can be deleted without changing the packing and covering numbers. Before giving the proof of Lemma 1, we need to prove several intermediate results. In the sequel, unless stated otherwise, we assume that x ∈ {v, e}, t ∈ N≥1 and that H is a finite collection of connected graphs. We set h = m(H). Recall that, for a t-partitioned protrusion (G, (X , T, s)) of a graph W , and v ∈ V (T ), we denote by Gv the set of all boundaried graphs of the form GVu , for some Vu-splitting (GVu , GV c u ) of W , where u is a child of v. Informally, these are the boundaried graphs induced by the bags of the subtrees of T rooted at the children of v. Lemma 2. There are two functions f3 : N2 → N and f4 : N2 → N such that, for every graph W and every t-partitioned protrusion (G, (X , T, s)) of W , if P is an H-free partial x-H-packing in G then: (a) The partial subdivisions of graphs in H that are contained in P have in total at most f3(h, t) branch vertices. (b) P intersects at most f4(h, t) graphs of Gs. 11 Proof. Proof of (a). First, note that any H-free partial x-H-packing in G has cardinality at most t, because each partial subdivision it contains must use a boundary edge of G, and two distinct subdivisions of the same packing are (at least) edge-disjoint. Also, each of these partial subdivisions contains at most maxH∈H n(H) ≤ h branch vertices. Consequently, for every H-free partial x-H-packing in G, the number of branch vertices of graphs of H it induces in G is at most t · h. Hence the function f3(h, t) := t · h upper-bounds the amount of branch vertices each H-free partial packing can contain. Proof of (b). Let ζ be the maximum multiplicity of an edge in a graph of H. Because of (a), every H-free partial x-H-packing P in G has at most f3(h, t) branch vertices of graphs of H, so at most f3(h, t) graphs of Gs may contain such vertices. Besides, P might also contain paths free of branch vertices linking pairs of branch vertices. Since there are at most (f3(h, t))2 such pairs and no pair will need to be connected with more than ζ ≤ h distinct paths, it follows that at most (f3(h, t))2 · h graphs of Gs contain vertices from these paths. Therefore, every H-free partial x-H-packing intersects at most f3(h, t) + (f3(h, t))2 · h =: f4(h, t) graphs of Gs. Lemma 3. There is a function f5 : N2 → N such that the image of the function µx its domain is restricted to H, when has size upper-bounded by f5(h, t). {(G, S), G is H-free and S ⊆ Ax(G)}, Proof. Let G be an H-free t-boundaried graph and let S ⊆ Ax(G). From Lemma 2(a), every H-free partial x-H-packing in G contains at most f3(h, t) branch vertices. This partial packing can in addition use at most t boundary vertices. Let Ch,t be the class of all (≤ t)- boundaried graphs on at most f3(h, t) + t vertices. Clearly the size of this class is a function depending on h and t only. Recall that the elements of the set µx H(G, S) are obtained from partial x-H-packings by dissolving internal vertices of the paths linking branch vertices, hence every element of µx H(G, S) is a t-boundaried graph of Bt having at most f3(h, t) + t vertices. Therefore, for any H-free t-boundaried graph G and subset S ⊆ Ax(G), we have µx H(G, S) ⊆ Ch,t. As a consequence, the image of the function µx H when restricted to H-free t-boundaried graphs G ∈ Bt (and subsets S ⊆ Ax(G)) is a subset of the power set of Ch,t, so its size is upper-bounded by a function (which we call f5) that depends only on h and t. Corollary 1. There is a function f6 : N2 → N such that the relation ≃H,t partitions H-free t-boundaried graphs into at most f6(h, t) equivalence classes. The following lemma follows directly from the definition of µx H. Lemma 4. Let F, G ∈ Bt be two compatible t-boundaried graphs and let k ∈ N. Then we have: P≥k x,H(F ⊕ G) 6= ∅ ⇐⇒ ∃ J ∈ µx H(G,∅), P≥k x,H(F ⊕∪∪∪∪∪∪∪∪∪ J ) 6= ∅. The choice of the definition of the relation ≃ is justified by the following lemma. Roughly speaking, it states that we can replace a t-partitioned protrusion of a graph with any other ≃H,t-equivalent t-partitioned protrusion without changing the covering and packing number of the graph. The reduction algorithm that we give after this lemma relies on this powerful property. Lemma 5 (protrusion replacement). Let F, G, G′ ∈ Bt be three compatible boundaried graphs such that G ≃H,t G′. For every k ∈ N, we have: 12 (i) P≥k x,H(F ⊕ G) 6= ∅ ⇐⇒ P≥k x,H(F ⊕ G) 6= ∅ ⇐⇒ C≤k x,H(F ⊕ G′) 6= ∅ and x,H(F ⊕ G′) 6= ∅. (ii) C≤k Proof. Notice that, by definition of ≃,t, the boundaried graphs G and G′ are H-free. Proof of item (i), "⇒". Let M be an x-H-packing of size at least k in F ⊕ G, whose set of branch vertices is L. We define JF = (∪∪∪∪∪∪∪∪∪M) ∩F⊕G F, JG = (∪∪∪∪∪∪∪∪∪M) ∩F⊕G G, and JG = [ κ(M ∩F⊕G G, L ∩ V (G)). M∈M H(G,∅) and µx H(G′,∅). Let J′ H(G,∅) and that F⊕JG has an x-H-packing of size at least k (cf. Lemma 4). Note that JG ∈ µx By definition of ≃, there is a bijection ψ between µx G be the image of JG by ψ. Since J′ G and JG are isomorphic, F ⊕ J′ G also has an x-H-packing of size at least k. By Lemma 4, this implies that such a packing exists in F ⊕ G′ as well. The direction "⇐" is symmetric as G and G′ play the same role. Proof of item (ii), "⇒". Let C ⊆ Ax(F ⊕ G) be a minimum x-H-covering of F ⊕ G of size at most k. Let S = C ∩ Ax(G). Since we assume that G is H-free and that C is minimum, we can also assume that S ≤ t (otherwise we could get a smaller covering by taking the t boundary vertices/edges of G). By our assumption that G ≃H,t G′, there is an isomorphism between sigx H(G, S) is sent H(G′, S′) by this isomorphism. Then observe that every partial packing J ′ of G′ \ S′, to µx such that (F \ C) ⊕ (∪∪∪∪∪∪∪∪∪J ′) has an H-subdivision, can be translated into a partial packing J of G\ S such that (F \ C)⊕ (∪∪∪∪∪∪∪∪∪J ) also has such a subdivision, in the same way as in the proof of item (i) above. As C is a cover, this would lead to contradiction. Therefore µx H(G, S) does not contain such a partial packing. As a consequence, (C ∩ Ax(F)) ∪ S′ is a covering of F⊕ G′ of size at most k. As in the previous case, the proof of direction "⇐" comes from the symmetry in the statement. H(G′,S). Let S′ ⊆ Ax(G′) be a set such that µx H(G,S) and sigx Lemma 5 can be rewritten as follows. Corollary 2. Under the assumptions of Lemma 5, we have x-pack(F⊕ G) = x-pack(F⊕ G′) and x-cover(F ⊕ G) = x-cover(F ⊕ G′). Recall that f6(h, t) denotes the number of equivalence classes of ≃H,t among boundaried graphs of Bt. For every h, t ∈ N, let f7(h, t) = f6(h, t) · f4(h, t) and f2(h, t) = 2ht3 · (f3(h, t)) f6(h,t)+1 . Let us give some intuition about these definitions. The first remark is an application of the pigeonhole principle. Observation 1. In a collection of more than f3(h, t) H-free boundaried graphs of Bt, there is one that is equivalent (w.r.t. ≃H,t) to f4(h, t) other graphs of the collection. Observation 2. If (T, s,X ) is a rooted tree-partition of a graph G with the following prop- erties: • (T,X ) has width at most t; • T has height at most f6(h, t); and 13 • T has degree at most f3(h, t) + 1, then G has at most f2(h, t) vertices, and every H-subdivision of G has at most f2(h, t) edges. f6(h,t)+1 vertices. Every Proof. The above assumptions imply that T has at most (f3(h, t)) f6(h,t)+1 · t ≤ bag of (T,X ) contains at most t vertices of G, therefore G has at most (f3(h, t)) f2(h, t) vertices. Also, every bag induces a subgraph with at most t(t− 1)/2 multiedges (i.e. without counting multiplicities), and for every edge f of T we have Ef ≤ t, hence every bag f6(h,t)+1 contributes for at most t2 + t multiedges. Therefore G has at most (t + t2) (f3(h, t)) multiedges. Now, observe that an edge of G is used at most h times by an H-subdivision (if it is a multiple edge), since every path connecting two branch vertices of a subdivision uses a given edge at most once. We deduce that an H-subdivision of G contains at most h · (t + t2) (f3(h, t)) f6(h,t)+1 ≤ f2(h, t) edges. The two next lemmas are the main tools used in the proof of Lemma 1. Under different conditions, they provide either a small subdivision, or a reduced graph. Lemma 6 considers the case where a vertex of T has high degree, whereas Lemma 7 deals with the situation where T has a long path. Lemma 6. Let P = (G, (X , T, s)) be a t-partitioned protrusion of a graph W , and let u ∈ V (T ) be a vertex with more than f3(h, t) children such that for every v ∈ children(T,s)(u), we have m(Gv) ≤ f6(h, t). Then, either • W contains an H-subdivision M with at most f6(h, t) edges or • there exists a graph W ′ such that x-packH(W ′) = x-packH(W ), x-coverH(W ′) = x-coverH(W ), and n(W ′) < n(W ). Moreover, there is an algorithm that, given such P, W, and u, returns either M or W ′ as above in Oh,t(1) steps. Proof. As u has more than f3(h, t) children, it contains a collection of d = f4(h, t) + 1 children v1, . . . , vd, such that Gv1 ≃H,t Gvi for every i ∈ J2, dK (by Observation 1). Let us now assume that Gu is H-free. Since every x-H-packing of W will intersect at most f4(h, t) bags of children of u (by Lemma 2(b)), we can safely delete one of the f4(h, t) + 1 equivalent subgraphs mentioned above. We use the following algorithm in order to find such a bag to delete or a small H-subdivision. 1. Let A be an array of f6(h, t) counters initialized to 0, each corresponding to a distinct equivalence class of ≃H,t; 2. Pick a vertex v ∈ children(T,s)(u) that has not been considered yet; 3. If Gv contains an H-subdivision M, then return M and exit; 4. Otherwise, increment the counter of A corresponding to the equivalence class of Gu by one; 5. If this counter reaches d + 1, return v, otherwise go back to Line 2. 14 Notice that the subdivision returned in Line 3 has size at most t · f6(h, t) (as we assume that m(Gv) ≤ f6(h, t)) and that the vertex returned in Line 5 has the desired property. By Corollary 1, the relation ≃H,t has at most f6(h, t) equivalence classes, thus the main loop will be run at most f6(h, t) · f4(h, t) + 1 times (by the pigeonhole principle). Eventually, Lines 3 and 4 can be performed in Oh,t(1)-time given that Gv has size bounded by a function of h and t. In the end, we return W ′ = W \ V (Gv) if the algorithm outputs v and M otherwise. Lemma 7. There is an algorithm that, given a t-partitioned protrusion P = (G, (X , T, s)) of a graph W and a vertex u ∈ V (T ) such that • u has height exactly f6(h, t) in (T, s), • the graph of Gu is H-free, and • Tu has maximum degree at most f3(h, t), outputs a graph W ′ such that x-packH(W ′) = x-packH(W ), x-coverH(W ′) = x-coverH(W ), and n(W ′) < n(W ). Moreover, this algorithm runs in Oh,t(1)-time. Proof. As in the proof of Observation 2, we use the fact that every H-subdivision of Gu uses every (multi)edge at most h times. A consequence is that the boundaried subgraph of Gu obtained by setting the multiplicity of every edge e to the minimum of h and the multiplicity of e contains an H-subdivision iff Gu does. As the number of vertices and edges of this subgraph is bounded by a function of h and t, we can therefore check in Oh,t(1)-time if Gu contains an H-subdivision. If one is found, it has at most f2(h, t) edges (Observation 2) and we are done. Let us now consider the case where Gu is H-free. By definition of the vertex u, there is a path of f6(h, t) + 1 vertices from a leaf of Tu to u. Let us arbitrarily choose, for every v ) of G. By definition of f6(h, t) (the number vertex v of this path, a Vv-splitting (GGv , GGc of equivalence classes in ≃H,t in Bt), there are two distinct vertices v, w on this path such that Gv ≃H,t Gw. As mentioned above, the number edges of Gu is bounded by a function of h and t, hence finding these two vertices can be done in Oh,t(1)-time. Let us assume without loss of generality that w is a descendant of v. Let H be the boundaried graph such that W = H⊕ GGv and let W ′ = H⊕ GGw. By Corollary 2, we have x-packH(W ′) = x-packH(W ) and x-coverH(W ′) = x-coverH(W ). Furthermore, the graph W ′ is clearly smaller than W . We are now ready to prove Lemma 1. Proof of Lemma 1. Observe that since n(G) > f2(h, t) and each bag of (X , T, s) contains at most t vertices, we have n(T ) > f2(h, t)/t = (f6(h, t) · f4(h, t)) f6(h,t) . Therefore, T has either diameter more than f6(h, t) or a vertex of degree more than f6(h, t)· f4(h, t). Let us consider the following procedure. 15 1. By a DFS on (T, s), compute the height of each vertex of T and find (if it exists) a vertex v of degree more than f3(h, t) + 1 and height at most f6(h, t) − 1 that has minimum height. 2. If such a vertex v is found, then apply the algorithm of Lemma 6 on P and v, and return the obtained result. 3. Otherwise, find a vertex u of height exactly f6(h, t) in (T, s) and then apply the algo- rithm of Lemma 7 on P and (Tu, u) and return the obtained result. Observe that since n(G) > f2(h, t), Observation 2 implies that either T has diameter more than f6(h, t), or it contains a vertex of degree more than f3(h, t) + 1. Therefore, the vertex u of line 3 always exists in the case where no vertex of high degree is found in line 1. The correctness of this algorithm follows from Lemma 6 and Lemma 7. The DFS done in the first step takes time O(n(T )) and the rest of the algorithm takes time Oh,t(1) according to the aforementioned lemmata. The fact that a x-H-packing of W ′ can be lifted to an equal size x-H-packing of W follows easily when Lemma 6 is applied, as then W ′ is a subgraph of W . In the case that Lemma 7 is applied, the new x-H-packing is obtained because of Corollary 2 and the supporting pro- trusion replacement Lemma 5, whose proof indicates which part of the x-H-packing of W ′ should be replaced with what in order to obtain an equal size x-H-packing of W . 4 From the Erdos-P´osa property to approximation For the purposes of this section we define Θr = ex(θr). We need the following that is one of the main results in [7, Theorem 3.2]. Proposition 1. There is an algorithm that, with input three positive integers r ≥ 2, w, z and a connected m-edge graph W , where m ≥ z > r ≥ 2, outputs one of the following: • a Θr-subdivision of W with at most z edges, • a (2r − 2)-partitioned protrusion (G,D) of W , where G = (G, B, λ) and such that G is a connected graph and n(G) > w, or • an H-minor model of W for some graph H with δ(H) ≥ 1 r−1 2 z−5r 4r(2w+1) , in Or(m) steps. 4.1 A lemma on reduce or progress The proof of the next lemma combines Proposition 1 and Lemma 1. Lemma 8 (Reduce or progress). There is an algorithm that, with input x ∈ {v, e}, r ∈ N≥2, k ∈ N and an n-vertex graph W , outputs one of the following: • a Θr-subdivision of W with at most Or(log k) edges; • a graph W ′ where x-coverH(W ′) = x-coverH(W ), x-packH(W ′) = x-packH(W ), and n(W ′) < n(W ); or 16 • an H-minor model in W , for some graph H with δ(H) ≥ k(r + 1), in Or(m) steps. Moreover, this algorithm can be enhanced so that, when the second case applies, given a x-H-packing (resp. x-H-covering) in W ′ then it outputs a same size x-H- packing (resp. x-H-covering) in W . Proof. We set t = 2r− 2, w = f2(h, t), z = 2r(w− 1) log(k(r + 1)(r− 1))+ 5r, and h = m(Θr). Observe that z = Or(log k) and h, t, w = Or(1). Also observe that our choice for variable z ensures that 2 z−5r 2r(w−1) /(r − 1) = k(r + 1). By applying the algorithm of Proposition 1 to r, w, z, and W , we obtain in Or(m(W ))- time either: • a Θr-subdivision in W of at most z edges (first case), • a (2r − 2)-edge-protrusion Y of W with extension > w (second case), or • an H-minor model M in W , for some graph H with δ(H) ≥ k(r + 1) (third case). In the first case, we return the obtained Θr-subdivision.In the second case, by applying the algorithm of Lemma 1 on Y , we get in O(n(W ))-time either a Θr-subdivision of W on at most w = Or(1) vertices, or a graph W ′ where, for x ∈ {v, e}, x-coverH(W ′) = x-coverH(W ), x-packH(W ′) = x-packH(W ) and n(W ′) < n(W ).In the third case, we return the minor model M . In each of the above cases, we get after O(m) steps either a minor model of a graph with minimum degree more than k(r + 1), a Θr-subdivision in W with at most z edges, or an equivalent graph of smaller size. It might not be clear yet to what purpose the minor model of a graph of degree more than k(r + 1) output by the algorithm of Lemma 8 can be used. An answer is given by the following lemmata, which state that such a graph contains a packing of at least k minor models of Θr. These lemmata will be used in the design of the appoximation algorithms in Subsection 4.2. Lemma 9. There is an algorithm that, given k, r ∈ N≥1 and a graph G with δ(G) ≥ kr, returns a member of P≥k e,Θr (G) in G in O(m) steps. Proof. Starting from any vertex u, we grow a maximal path P in G by iteratively adding to P a vertex that is adjacent to the previously added vertex but does not belong to P . Since δ(G) ≥ kr, any such path will have length at least kr + 1. At the end, all the neighbors of the last vertex v of P belong to P (otherwise P could be extended). Since v has degree at least kr, v has at least kr neighbors in P . Let w0, . . . , wkr−1 be an enumeration of the kr first neighbors of v in the order given by P , starting from u. For every i ∈ J0, k − 1K, let Si be the subgraph of G induced by v and the subpath of P starting at wir and ending at w(i+1)r−1. Observe that for every i ∈ J0, k − 1K, Si contains a Θr-subdivision and that the intersection of every pair of graphs from {Si}i∈J0,k−1K is {v}. Hence P contains a member of P≥k (G), as desired. Every edge of G is considered at most once in this algorithm, yielding e,Θr to a running time of O(m) steps. Corollary 3. There is an algorithm that, given r ∈ N≥1 and a graph G with δ(G) ≥ r, returns a Θr-subdivision in G in O(m)-steps. Observe that the previous lemma only deals with edge-disjoint packings. An analogue of Lemma 9 for vertex-disjoint packings can be proved using Proposition 2, to the price of a worse time complexity. 17 Proposition 2 (Theorem 12 of [2]). Given k, r ∈ N≥1 and an input graph G such that δ(G) ≥ k(r + 1)− 1, a partition (V1, . . . , Vk) of V (G) satisfying ∀i ∈ J1, kK , δ(G[Vi]) ≥ r can be found in O(nc) steps for some c ∈ N. Lemma 10. There is an algorithm that, given k, r ∈ N≥1 and a graph G with δ(G) ≥ k(r + 1) − 1, outputs a member of P≥k (G) in O(nc + m) steps, where c is the constant of Proposition 2. v,Θr Proof. After applying the algorithm of Proposition 2 on G to obtain in O(nc)-time k graphs G[V1], . . . , G[Vk], we extract a Θr-subdivision from each of them using Corollary 3. 4.2 Approximation algorithms As Θr-subdivisions are exactly the subgraph minimal graphs that contain Θr as a minor, a graph has a Θr-x-packing of size k iff it contains k x-disjoint subgraphs, each containing θr as a minor. Therefore, Theorem 1 is a direct combinatorial consequence of the following. Theorem 5. There is a function f8 : N → N and an algorithm that, with input x ∈ {v, e}, r ∈ N≥2, k ∈ N, and an n-vertex graph W , outputs either a x-Θr-packing of W of size k or an x-Θr-covering of W of size at most f8(r)·k·log k. Moreover, this algorithm runs in O(m2) steps if x = e and in Or(nc + n· m) steps if x = v, where c is the constant from Proposition 2. Proof. Let f8(r) : N → N be a function such that each Θr-subdivision output by the algorithm of Lemma 8 has size at most f8(r) · log k. We consider the following procedure. 1. G := W ; P := ∅; 2. Apply the algorithm of Lemma 8 on (x, r, k, G): Progress: if the output is a Θr-subdivision M , let G := G\ Ax(M ) and P = P ∪{M}; Win: if the output is a H-minor model M in W for some graph H with δ(H) ≥ k(r+1), apply the algorithm of Lemma 9 (if x = e) or the one of Lemma 10 (if x = v) to H to obtain a member of P≥k (H). Using M , translate this packing into a member x,Θr of P≥k x,Θr (W ) and return this new packing; Reduce: otherwise, the output is a graph G′. Then let G := G′. 3. If P = k then return P which is a member of P≥k 4. If n(W ) = 0 then return P which is in this case a member of C (W ); x,Θr ≤f8(r) log k x,Θr (W ); 5. Otherwise, go back to Line 2. This algorithm clearly returns the desired result. Furthermore, the loop is executed at most Ax(W ) times (as an element of Ax(W ) is deleted each time we reach the Progress case) and each call to the algorithm of Lemma 8 takes O(m(W )) steps. When the algorithm reaches the "Win" case (which can happen at most once), the calls to the algorithm of Lemma 9 (if x = e) or the one of Lemma 10 (if x = v), respectively, take O(m(H)) and O ((n(H))c) steps. Therefore, in total, this algorithm terminates in O(m2) steps if x = e and in O (nc + n · m) steps if x = v. Observe that if the algorithm of Theorem 5 reaches the "Win" case, then the input graph is known to contain an x-Θr-packing of size at least k. As a consequence, if we are only interested in the existence of a packing or covering, the call to the algorithm of Lemma 9 or Lemma 10 is not necessary. 18 Corollary 4. There is an algorithm that, with input x ∈ {v, e}, r ∈ N≥2, k ∈ N, and a graph W , outputs 0 only if W has an x-Θr-packing of size k or 1 only if W has an x-Θr-covering of size at most f8(r)· k· log k. Furthermore this algorithm runs in Or(n· m) steps when x = v and in Or(m2) steps when x = e. We now conclude this section with the proof of Theorem 2. For the same reason as in the proof of Theorem 1 at the beginning of this section, we can deal with Θr-subdivisions instead of dealing with subgraphs that contain θr as a minor. Proof of Theorem 2. Let us call A the algorithm of Corollary 4. Let k0 ∈ J1, n(W )K be an integer such that A(x, r, k0, W ) = 1 and A(x, r, k0 − 1, W ) = 0, and let us show that the value f8(r) · k0 log k0 is an O(log OP T )-approximation of x-packΘr (W ) and coverΘr (W ). W ) is 1. Symmetrically, for every k such that f8(r) · k log k < x-coverΘr (W ), the value of A(x, r, k, W ) is 0. Therefore, the value k0 is such that: First, notice that for every k > x-packΘr (W ), the value returned by A(x, r, k, k0 − 1 ≤ x-packΘr (W ) and x-coverΘr (W ) ≤ f8(r) · k0 log k0. As every minimal covering must contain at least one vertex or edge (depending on whether x = v or x = e) of each element (i.e. subdivision) of a maximal packing x-packΘr (W ) ≤ x-coverΘr (W ), we have the following two equations: x-packΘr (W ) ≤ f8(r) · k0 log k0 ≤ (x-packΘr (W ) + 1) log(x-packΘr (W ) + 1) x-coverΘr (W ) ≤ f8(r) · k0 log k0 ≤ (x-coverΘr (W ) + 1) log(x-coverΘr (W ) + 1). (1) (2) Dividing (1) by x-packΘr (W ) and (2) by coverΘr (W ), we get: 1 ≤ 1 ≤ k0 log k0 x-packΘr (W ) ≤ log(x-packΘr (W ) + 1) + = O(log(x-packΘr (W ))), k0 log k0 x-coverΘr (W ) ≤ log(x-coverΘr (W ) + 1) + = O(log(x-coverΘr (W ))). log x-packΘr (W ) x-packΘr (W ) and log x-coverΘr (W ) x-coverΘr (W ) Therefore the value k0 log k0 is both an O(log OP T )-approximation of x-packΘr (W ) and coverΘr (W ). The value k0 can be found by performing a binary search in the interval J1, nK, with O(log n) calls to Algorithm A. Hence, our approximation algorithm runs in O(n· log(n)· m) steps when x = v and in O(m2 · log(n)) steps when x = e. 5 Erdos -- P´osa property and tree-partition width Using the machinery introduced in Section 3, we are able to prove a slightly more general version of Theorem 3. Theorem 6. Let t ∈ N. For every x ∈ {v, e}, the following holds: if H is a finite collection of connected graphs and G is a graph of tree-partition width at most t, then x-coverH(G) ≤ α· x- packH(G), where α is a constant which depends only on t and H. 19 Proof. Let k = x-packH(G). This proof is similar to that of Theorem 5 (progress or reduce). We start with P := ∅ and G0 := G and repeatedly apply Lemma 1 to Gi, which provides the existence of either a smaller graph Gi+1 with the same parameters x-coverH and x-packH (reduce), or that of an H-subdivision M with at most f2(h, t) edges, in which case we set Gi+1 := Gi \ Ax(M ) and P := P ∪ {M} (progress) and continue. Notice that while the algorithm of Lemma 1 requires a t-partitioned protrusion, it is enough here to know that such a partitioned protrusion exists as we do not actually run the algorithm. This is the case because the considered graphs are subgraph of G, which has tree-partition width at most t, so we can consider a t-partitioned protrusion containing the whole graph. We stop this process when the current graph has at most f2(h, t) vertices. Let Gj be this graph. In the end, P contains at most k H-subdivisions. Therefore, C := ∪∪∪∪∪∪∪∪∪Ax(P ) ∪ Ax(Gj ) is an x-H-covering of G of size (k + 1) · f2(h, t), as required. Theorem 3 can be obtained from Theorem 6 by considering packing and covering of the graphs in SH∈H ex(H), where H is the family of graphs mentioned in the statement of Theorem 3. We define Θr,r′ = ex(θr,r′). The rest of this section is devoted to the proof of Theorem 4. Prior to this, we need to introduce a result of Ding et al. [11]. Tree-partition width has been studied in [11, 20, 37]. In particular, the authors of [11] characterized the classes of graphs of bounded tree-partition width in terms of excluded topological minors. The statement of this result requires additional definitions. Walls, fans, paths, and stars. The n-wall is the graph with vertex set J1, nK 2 and whose edge set is: {{(i, j), (i, j + 1)}, 1 ≤ i, j ≤ n} ∪{{(2i − 1, 2j + 1), (2i, 2j + 1)}, 1 < 2i ≤ n and 1 ≤ 2j + 1 ≤ n} ∪{{(2i, 2j), (2i + 1, 2j)}, 1 ≤ 2i < n and 1 ≤ 2j ≤ n} . The 7-wall is depicted in Figure 7. The n-fan is the graph obtained by adding a dominating vertex to a path on n vertices. A collection of paths is said to be independent if two paths of the collection never share interior vertices. The n-star is the graph obtained by replacing every edge of K1,n with n independent paths of two edges. The n-path is the graph obtained by replacing every edge of an n-edge path with n independent paths of two edges. Examples of these graphs are depicted in Figure 7. The wall number (resp. fan number, star number, and path number ) of a graph G is defined as the largest integer k such that G contains a minor model of a k-wall (resp. of a k-fan, of a k-star, of a k-path), or infinity is no such integer exists. Let γ(G) denote the maximum of the wall number, fan number, star number, and path number of a graph G. We need the following result. Proposition 3 ([11]). There is a function f9 : N → N such that every graph G satisfies tpw(G) ≤ f9(γ(G)). In other words, for every integer k, every graph of large enough tree-partition width contains a minor model of one of the following graphs: the k-wall, the k-fan, the k-path, or the k-star. Notice that for every r, r′ ∈ N, r′ ≤ r, the graph θr,r′ is a minor of the following graphs: the r-path, the r-star, the (r + r′ + 1)-fan, and the r-wall (for r ≥ 6). Hence, every graph of large enough tree-partition width contains a Θr,r′-subdivision. This can easily be generalized to edge-disjoint packings, as follows. 20 7-fan 7-wall 4-star 4-path Figure 7: Unavoidable patterns of graphs of large tree-partition width. Lemma 11. For every r, r′ ∈ N, r′ ≤ r, and every k ∈ N≥1, every graph G satisfying γ(G) ≥ k(r + r′ + 2) − 1 contains an e-Θr,r′-packing of size k. Using Proposition 3, we get the following corollary. Corollary 5. For every r, r′ ∈ N, r′ ≤ r, and every k ∈ N≥1, every graph G satisfying tpw(G) ≥ f9(k(r + r′ + 2) − 1) contains an e-Θr,r′-packing of size k. We are now able to give the proof of Theorem 4. As in the proof of Theorem 1 at the beginning of Subsection 4.2, we can consider Θr,r′-subdivisions instead of sugraphs containing θr,r′ as a minor. Proof of Theorem 4. According to Corollary 5, for every k ∈ N, there is a number tk such that every graph G with e-coverΘr,r′ (G) = k satisfies tpw(G) ≤ tk. Indeed, such a graph does not contain a packing of k + 1 Θr,r′-subdivisions. Then by Theorem 3 the value e-coverΘr,r′ (G) is bounded above by f2(h, tk) · e-packΘr,r′ (G), and this concludes the proof. 6 Concluding remarks The main algorithmic contribution of this paper is a log(OPT)-approximation algorithm for the parameters v-packθr , v-coverθr , e-packθr , and e-coverθr , for every positive integer r. This improves the results of [21] in the case of vertex packings and coverings and is the first approximation algorithm for the parameters e-packθr and e-coverθr for general r. Our proof uses a reduction technique of independent interest, which is not specific to the graph θr and can be used for any other (classes of) graphs. On the combinatorial side, we optimally improved the gap of the edge-Erdos-P´osa prop- erty of minor models of θr for every r. Also, we were able to show that every class of graphs has the (edge and vertex) Erdos-P´osa property in graphs of bounded tree-partition width, with linear gap. An other outcome of this work is that minor models of θr,r′ have the 21 edge-Erdos-P´osa. Recall that prior to this work, the only graphs for which this was known were θr's. As mentioned in [32], the planarity of a graph H is a necessary condition for the minor models of H to have the edge-Erdos-P´osa property. However, little is known on which planar graphs have this property and with which gap. This is the first direction of research that we want to highlight here. Also, the question of an approximation algorithm can be asked for packing and covering the minor models of different graphs. It was proved in [8] that the gap of the vertex-Erdos-P´osa property of minor models of every planar graph is O(k polylog k). It would be interesting to check if these results can be used to derive a polylog(OPT)-approximation for vertex packing and covering minor models of any planar graph. Notice that all our results are strongly exploiting Lemma 1 that holds for every finite collection H of connected graphs. Actually, what is missing in order to have an overall generalization of all of our results, is an extension of Proposition 1 where Θr is replaced by any finite collection H of connected planar graphs. This is an an interesting combinatorial problem even for particular instantiations of H. References [1] A. P. Alberto Caprara and R. Rizzi. Packing cycles in undirected graphs. Journal of Algorithms, 48(1):239 -- 256, 2003. [2] C. Bazgan, Z. Tuza, and D. Vanderpooten. Efficient algorithms for decomposing graphs under degree constraints. Discrete Applied Mathematics, 155(8):979 -- 988, 2007. [3] E. Birmel´e, J. A. Bondy, and B. A. Reed. The Erdos -- P´osa property for long circuits. Combinatorica, 27:135 -- 145, 2007. [4] H. L. Bodlaender, F. V. Fomin, D. Lokshtanov, E. Penninkx, S. Saurabh, and D. M. Thilikos. (Meta) kernelization. In Proceedings of the 2009 50th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 629 -- 638, Washington, DC, USA, 2009. IEEE Computer Society. [5] H. L. Bodlaender, F. V. Fomin, D. Lokshtanov, E. Penninkx, S. Saurabh, and D. M. Thilikos. (Meta) kernelization. CoRR, abs/0904.0727, 2009. [6] H. L. Bodlaender, S. Thomass´e, and A. Yeo. Kernel bounds for disjoint cycles and disjoint paths. Theoretical Computer Science, 412(35):4570 -- 4578, 2011. [7] D. Chatzidimitriou, J.-F. Raymond, I. Sau, and D. M. Thilikos. Minors in graphs of large θr-girth. CoRR, abs/1510.03041, 2015. [8] C. Chekuri and J. Chuzhoy. Large-treewidth graph decompositions and applications. In Proceedings of the Forty-fifth Annual ACM Symposium on Theory of Computing (STOC), pages 291 -- 300, New York, NY, USA, 2013. ACM. [9] R. Diestel. Graph Theory, volume 173 of Graduate Texts in Mathematics. Springer- Verlag, Heidelberg, third edition, 2005. [10] R. Diestel, K. ichi Kawarabayashi, and P. Wollan. The Erdos -- P´osa property for clique minors in highly connected graphs. Journal of Combinatorial Theory, Series B, 102(2):454 -- 469, 2012. 22 [11] G. Ding and B. Oporowski. On tree-partitions of graphs. Discrete Mathematics, 149(1 -- 3):45 -- 58, 1996. [12] P. Erdos and L. P´osa. On independent circuits contained in a graph. Canadian Journal of Mathematics, 17:347 -- 352, 1965. [13] S. Fiorini, G. Joret, and U. Pietropaoli. Hitting diamonds and growing cacti. In Proceed- ings of Integer Programming and Combinatorial Optimization, volume 6080 of Lecture Notes in Computer Science, pages 191 -- 204. Springer Berlin Heidelberg, 2010. [14] S. Fiorini, G. Joret, and I. Sau. Optimal Erdos -- P´osa property for pumpkins. Manuscript, 2013. [15] S. Fiorini, G. Joret, and D. R. Wood. Excluded forest minors and the Erdos-P´osa property. Combinatorics, Probability & Computing, 22(5):700 -- 721, 2013. [16] F. V. Fomin, D. Lokshtanov, N. Misra, G Philip, and S. Saurabh. Quadratic Upper Bounds on the Erdos -- P´osa Property for a Generalization of Packing and Covering Cy- cles. Journal of Graph Theory 74(4), 417-424' 2013 [17] F. V. Fomin, D. Lokshtanov, N. Misra, and S. Saurabh. Planar F-deletion: Approx- imation, kernelization and optimal FPT-algorithms. In Proceedings of the IEEE 53rd Annual Symposium on Foundations of Computer Science (FOCS), pages 470 -- 479, Oct 2012. [18] J. Geelen and K. Kabell. The Erdos -- P´osa property for matroid circuits. Journal of Combinatorial Theory, Series B, 99(2):407 -- 419, Mar. 2009. [19] P. A. Golovach. Personal communication, 2015. [20] R. Halin. Tree-partitions of infinite graphs. Discrete Mathematics, 97(1 -- 3):203 -- 217, 1991. [21] G. Joret, C. Paul, I. Sau, S. Saurabh, and S. Thomass´e. Hitting and harvesting pump- kins. SIAM Journal on Discrete Mathemarics, 28(3):1363 -- 1390, 2014. [22] N. Kakimura, K.-i. Kawarabayashi, and Y. Kobayashi. Erdos-P´osa property and its algorithmic applications: Parity constraints, subset feedback set, and subset packing. In Proceedings of the Twenty-third Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1726 -- 1736. SIAM, 2012. [23] K.-I. Kawarabayashi and Y. Kobayashi. Edge-disjoint odd cycles in 4-edge-connected graphs. In Procedings of the 29th International Symposium on Theoretical Aspects of Computer Science, (STACS), February 29th - March 3rd, 2012, Paris, France, pages 206 -- 217, 2012. [24] K.-I. Kawarabayashi and A. Nakamoto. The erdos -- p´osa property for vertex- and edge- disjoint odd cycles in graphs on orientable surfaces. Discrete Mathematics, 307(6):764 -- 768, 2007. [25] T. Kloks, C. Lee, and J. Liu. New algorithms for k-face cover, k-feedback vertex set, and k-disjoint cycles on plane and planar graphs. In Proceedings of Graph-Theoretic Concepts in Computer Science, volume 2573 of Lecture Notes in Computer Science, pages 282 -- 295. Springer Berlin Heidelberg, 2002. 23 [26] D. Kr´al' and H.-J. Voss. Edge-disjoint odd cycles in planar graphs. Journal of Combi- natorial Theory, Series B, 90(1):107 -- 120, 2004. [27] M. Krivelevich, Z. Nutov, M. R. Salavatipour, J. V. Yuster, and R. Yuster. Approxima- tion algorithms and hardness results for cycle packing problems. ACM Transactions on Algorithms, 3(4), Nov. 2007. [28] M. Krivelevich, Z. Nutov, and R. Yuster. Approximation algorithms for cycle packing problems. In Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 556 -- 561, Philadelphia, PA, USA, 2005. SIAM. [29] M. Pontecorvi and P. Wollan. Disjoint cycles intersecting a set of vertices. Journal of Combinatorial Theory, Series B, 102(5):1134 -- 1141, 2012. [30] D. Rautenbach and B. Reed. The Erdos -- P´osa property for odd cycles in highly connected graphs. Combinatorica, 21:267 -- 278, 2001. [31] Bruce A. Reed. Tree width and tangles: A new connectivity measure and some applica- tions, pages 87 -- 162. Cambridge University Press, 1997. [32] J.-F. Raymond, I. Sau, and D. M. Thilikos. An edge variant of the Erdos -- P´osa property. CoRR, abs/1311.1108, 2013. [33] Jean-Florent Raymond and Dimitrios M. Thilikos. Recent results on the Erdos -- P´osa property. to appear in Discrete Applied Mathematics, 2017. [34] B. A. Reed, N. Robertson, P. D. Seymour, and R. Thomas. Packing directed circuits. Combinatorica, 16(4):535 -- 554, 1996. [35] N. Robertson and P. D. Seymour. Graph Minors. V. Excluding a planar graph. Journal of Combinatorial Theory, Series B, 41(2):92 -- 114, 1986. [36] M. R. Salavatipour and J. Verstraete. Disjoint cycles: Integrality gap, hardness, and approximation. In Proceedings of Integer Programming and Combinatorial Optimiza- tion, volume 3509 of Lecture Notes in Computer Science, pages 51 -- 65. Springer Berlin Heidelberg, 2005. [37] D. Seese. Tree-partite graphs and the complexity of algorithms. In Proceedings of Fun- damentals of Computation Theory, volume 199 of Lecture Notes in Computer Science, pages 412 -- 421. Springer Berlin Heidelberg, 1985. 24
1911.06958
2
1911
2019-11-19T03:54:41
Regularized Weighted Low Rank Approximation
[ "cs.DS", "cs.LG" ]
The classical low rank approximation problem is to find a rank $k$ matrix $UV$ (where $U$ has $k$ columns and $V$ has $k$ rows) that minimizes the Frobenius norm of $A - UV$. Although this problem can be solved efficiently, we study an NP-hard variant of this problem that involves weights and regularization. A previous paper of [Razenshteyn et al. '16] derived a polynomial time algorithm for weighted low rank approximation with constant rank. We derive provably sharper guarantees for the regularized version by obtaining parameterized complexity bounds in terms of the statistical dimension rather than the rank, allowing for a rank-independent runtime that can be significantly faster. Our improvement comes from applying sharper matrix concentration bounds, using a novel conditioning technique, and proving structural theorems for regularized low rank problems.
cs.DS
cs
Regularized Weighted Low Rank Approximation Frank Ban David Woodruff UC Berkeley / Google [email protected] Carnegie Mellon University [email protected] Qiuyi (Richard) Zhang UC Berkeley / Google [email protected] November 20, 2019 Abstract The classical low rank approximation problem is to find a rank k matrix U V (where U has k columns and V has k rows) that minimizes the Frobenius norm of A − U V . Although this problem can be solved efficiently, we study an NP-hard variant of this problem that involves weights and regularization. A previous paper of [Razenshteyn et al. '16] derived a polynomial time algorithm for weighted low rank approximation with constant rank. We derive provably sharper guarantees for the regularized version by obtaining parameterized complexity bounds in terms of the statistical dimension rather than the rank, allowing for a rank-independent runtime that can be significantly faster. Our improvement comes from applying sharper matrix concentration bounds, using a novel conditioning technique, and proving structural theorems for regularized low rank problems. 1 Introduction In the weighted low rank approximation problem, one is given a matrix M ∈ Rn×d, a weight matrix W ∈ Rn×d, and an integer parameter k, and would like to find factors U ∈ Rn×k and V ∈ Rk×d so as to minimize n(cid:88) d(cid:88) (cid:107)W ◦ (M − U · V )(cid:107)2 F = i,j(Mi,j − (cid:104)Ui,∗, V∗,j(cid:105))2, W 2 where Ui,∗ denotes the i-th row of U and V∗,j denotes the j-th column of V . W.l.o.g., we assume n ≥ d. This is a weighted version of the classical low rank approximation problem, which is a special case when Wi,j = 1 for all i and j. One often considers the approximate version of this problem, for which one is given an approximation parameter ε ∈ (0, 1) and would like to find U ∈ Rn×k and V ∈ Rk×d so that i=1 j=1 (cid:107)W ◦ (M − U · V )(cid:107)2 F ≤ (1 + ε) min U(cid:48)∈Rn×k,V (cid:48)∈Rk×d (cid:107)W ◦ (M − U(cid:48) · V (cid:48))(cid:107)2 F . (1) Weighted low rank approximation extends the classical low rank approximation problem in many ways. While in principal component analysis, one typically first subtracts off the mean to make the matrix M have mean 0, this does not fix the problem of differing variances. Indeed, imagine one of the columns of M has much larger variance than the others. Then in classical low rank approximation with k = 1, it could suffice to simply fit this single high variance column and ignore the remaining entries of M . Weighted low rank approximation, on the other hand, can correct for this by re-weighting each of the entries of M to give them similar variance; this allows for the low rank approximation U · V to capture more of the remaining data. This technique is often used in gene expression analysis and co-occurrence matrices; we refer the reader to [SJ03] and the Wikipedia entry on weighted low rank approximation1. The well-studied problem of matrix completion is also a special case of weighted low rank approximation, where the entries Wi,j are binary, and has numerous applications in recommendation systems and other settings with missing data. Unlike its classical variant, weighted low rank approximation is known to be NP-hard [GG11]. Classical low rank approximation can be solved quickly via the singular value decomposition, which is often sped up 1https://en.wikipedia.org/wiki/Low-rank_approximation#Weighted_low-rank_approximation_problems 1 with sketching techniques [Woo14, PW15, TYUC17]. However, in the weighted setting, under a standard complexity-theoretic assumption known as the Random Exponential Time Hypothesis (see, e.g., Assumption 1.3 in [RSW16] for a discussion), there is a fixed constant ε0 ∈ (0, 1) for which any algorithm achieving (1) with constant probability and for ε = ε0, and even for k = 1, requires 2Ω(r) time, where r is the number of distinct columns of the weight matrix W . Furthermore, as shown in Theorem 1.4 of [RSW16], this holds even if W has both at most r distinct rows and r distinct columns. Despite the above hardness, in a number of applications the parameter r may be small. Indeed, in a matrix in which the rows correspond to users and the columns correspond to ratings of a movie, such as in the Netflix matrix, one may have a small number of categories of movies. In this case, one may want to use the same column in W for each movie in the same category. It may thus make sense to renormalize user ratings based on the category of movies being watched. Note that any number of distinct rows of W is possible here, as different users may have completely different ratings, but there is just one distinct column of W per category of movie. In some settings one may simultaneously have a small number of distinct rows and a small number of distinct columns. This may occur if say, the users are also categorized into a small number of groups. For example, the users may be grouped by age and one may want to weight ratings of different categories of movies based on age. That is, maybe cartoon ratings of younger users should be given higher weight, while historical films rated by older users should be given higher weight. Motivated by such applications when r is small, [RSW16] propose several parameterized complexity al- gorithms. They show that in the case that W has at most r distinct rows and r distinct columns, there is an algorithm solving (1) in 2O(k2r/ε)poly(n) time. If W has at most r distinct columns but any number of √ distinct rows, there is an algorithm achieving (1) in 2O(k2r2/ε)poly(n) time. Note that these bounds imply log n) in the second case, that for constant k and ε, even if r is as large as Θ(log n) in the first case, and Θ( the corresponding algorithm is polynomial time. In [RSW16], the authors also consider the case when the rank of the weight matrix W is at most r, which includes the r distinct rows and columns, as well as the r distinct column settings above, as special cases. In this case the authors achieve an nO(k2r/ε) time algorithm. Note that this is only polynomial time if k, r, and ε are each fixed constants, and unlike the algorithms for the other two settings, this algorithm is not fixed parameter tractable, meaning its running time cannot be written as f (k, r, 1/ε) · poly(nd), where f is a function that is independent of n and d. There are also other algorithms for weighted low rank approximation, though they do not have provable guarantees, or require strong assumptions on the input. There are gradient-based approaches of Shpak [Shp90] and alternating minimization approaches of Lu et al. [LPW97, LA03], which were refined and used in practice by Srebro and Jaakkola [SJ03]. However, neither of these has provable gurantees. While there is some work that has provable guarantees, it makes incoherence assumptions on the low rank factors of M , as well as assumptions that the weight matrix W is spectrally close to the all ones matrix [LLR16] and that there are no 0 weights. 1.1 Our Contributions The only algorithms with provable guarantees that do not make assumptions on the inputs are slow, and inherently so given the above hardness results. Motivated by this and the widespread use of regularization in machine learning, we propose to look at provable guarantees for regularized weighted low rank approximation. In one version of this problem, where the parameter r corresponds to the rank of the weight matrix W , we are given a matrix M ∈ Rn×d, a weight matrix W ∈ Rn×d with rank r, and a target integer k > 0, and we consider the problem U∈Rn×k,V ∈Rk×d Let U∗, V ∗ minimize (cid:107)W ◦ (U V − M )(cid:107)2 min (cid:107)W ◦ (U V − M )(cid:107)2 F + λ(cid:107)V (cid:107)2 F + λ(cid:107)U(cid:107)2 F + λ(cid:107)U(cid:107)2 F + λ(cid:107)V (cid:107)2 F F and OPT be the minimum value. Regularization is a common technique to avoid overfitting and to solve an ill-posed problem. It has been applied in the context of weighted low rank approximation [DN11], though so far the only such results known for weighted low rank approximation with regularization are heuristic. In this paper we give the first provable bounds, without any assumptions on the input, on regularized weighted low rank approximation. Importantly, we show that regularization improves our running times for weighted low rank approxi- mation, as specified below. Intuitively, the complexity of regularized problems depends on the "statistical 2 dimension" or "effective dimension" of the underlying problem, which is often significantly smaller than the number of parameters in the regularized setting. Let U∗ and V ∗ denote the optimal low-rank matrix approximation factors, DWi,: denote the diagonal matrix with the i-th row of W along the diagonal, and DW:,j denote the diagonal matrix with the j-th column of W along the diagonal. Improving the Exponent: We first show how to improve the nO(k2r/ε) time algorithm of [RSW16] to a running time of nO((s+log(1/ε))rk/ε). Here s is defined to be the maximum statistical dimension of V ∗DWi,: and DW:,j U∗, over all i = 1, . . . , n, and j = 1, . . . , d, where the statistical dimension of a matrix M is: i 1/(1 + λ/σ2 i ) denote the statistical dimension of M with regularizing weight Definition 1. Let sdλ(M ) =(cid:80) λ (here σi are the singular values of M ). Note that this maximum value s is always at most k and for any s ≥ log(1/ε), our bound directly improves upon the previous time bound. Our improvement requires us to sketch matrices with k columns down to s/ε rows where s/ε is potentially smaller than k. This is particularly interesting since most previous provable sketching results for low rank approximation cannot have sketch sizes that are smaller than the rank, as following the standard analysis would lead to solving a regression problem on a matrix with fewer rows than columns. Thus, we introduce the notion of an upper and lower distortion factor (KS and κS below) and show that the lower distortion factor will satisfy tail bounds only on a smaller-rank subspace of size s/ε, which can be smaller than k. Directly following the analysis of [RSW16] will cause the lower distortion factor to be infinite. The upper distortion factor also satisfies tail bounds via a more powerful matrix concentration result not used previously. Furthermore, we apply a novel conditioning technique that conditions on the product of the upper and lower distortion factors on separate subspaces, whereas previous work only conditions on the condition number of a specific subspace. We next considerably strengthen the above result by showing an nO(r2(s+log(1/ε))2/ε2)) time algorithm. This shows that the rank k need not be in the exponent of the algorithm at all! We do this via a novel projection argument in the objective (sketching on the right), which was not done in [RSW16] and also improves a previous result for the classical setting in [ACW17]. To gain some perspective on this result, suppose ε is a large constant, close to 1, and r is a small constant. Then our algorithm runs in nO(s2) time as opposed to the algorithm of [RSW16] which runs in nO(k2) time. We stress in a number of applications, the effective dimension s may be a very small constant, close to 1, even though the rank parameter k can be considerably larger. This occurs, for example, if there is a single dominant singular value, or if the singular values are geometrically decaying. Concretely, it is realistic that k could be Θ(log n), while s = Θ(1), in which case our algorithm is the first polynomial time algorithm for this setting. Improving the Base: We can further optimize by removing our dependence on n in the base. The non-negative rank of a n × d matrix A is defined to be the least r such that there exist factors U ∈ Rn×r and V ∈ Rr×d where A = U · V and both U and V have non-negative entries. By applying a novel rounding procedure, if in addition the non-negative rank of W is at most r(cid:48), then we can obtain a fixed-parameter tractable algorithm running in time 2r(cid:48)r2(s+log(1/ε))2/ε2)poly(n). Note that r ≤ r(cid:48), where r is the rank of W . Note also that if W has at most r distinct rows or columns, then its non-negative rank is also at most r since we can replace the entries of W with their absolute values without changing the objective function, while still preserving the property of at most r distinct rows and/or columns. Consequently, we significantly √ improve the algorithms for a small number of distinct rows and/or columns of [RSW16], as our exponent is log n), for constant r(cid:48) and ε independent of k. Thus, even if k = Θ(n) but the statistical dimension s = O( our algorithm is polynomial time, while the best previous algorithm would be exponential time. We also give ways, other than non-negative rank, for improving the running time. Supposing that the rank of W is r again, we apply iterative techniques in linear system solving like Richardson's Iteration and preconditioning to further improve the running time. We are able to show that instead of an npoly(rs/ε) time algorithm, we are able to obtain algorithms that have running time roughly (σ2/λ)poly(rs/ε)poly(n) or (uW /lW )poly(rs/ε)poly(n), where σ2 is defined to be the maximum singular value of V ∗DWi,: and DW:,j U∗, over all i = 1, . . . , n, and j = 1, . . . , d, while uW is defined to be the maximum absolute value of an entry of W and lW the minimum absolute value of an entry. In a number of settings one may have σ2/λ = O(1) or uW /lW = O(1) in which case we again obtain fixed parameter tractable algorithms. 3 Empirical Evaluation: Finally, we give an empirical evaluation of our results. While the main goal of our work is to obtain the first algorithms with provable guarantees for regularized weighted low rank approximation, we can also use them to guide heuristics in practice. In particular, alternating minimization is a common heuristic for weighted low rank approximation. We consider a sketched version of alternating minimization to speed up each iteration. We show that in the regularized case, the dimension of the sketch can be significantly smaller if the statistical dimension is small, which is consistent with our theoretical results. 2 Preliminaries We let (cid:107) · (cid:107)F denote the Frobenius norm of a matrix and let ◦ be the elementwise matrix multiplication operator. We denote x ∈ [a, b] y if ay ≤ x ≤ by. For a matrix M , let Mi,; denote its ith row and let M;,j denote its jth column. For v ∈ Rn, let Dv denote the n × n diagonal matrix with its i-th diagonal entry equal to vi. For a matrix M with non-negative Mij, let nnr(M ) denote the non-negative rank of M . Let sr(M ) = (cid:107)M(cid:107)2 F /(cid:107)M(cid:107)2 denote the stable rank of M . Let D denote a distribution over r × n matrices; in our setting, there are matrices with entries that are Gaussian random variables with mean 0 and variance 1/r (or r × n CountSketch matrices [Woo14]). Definition 2. For S sampled from a distribution of matrices D and a matrix M with n rows, let cS(M ) ≥ 1 denote the smallest (possibly infinite) number such that (cid:107)SM v(cid:107)2 ∈ [cS(M ) Definition 3. For S sampled from a distribution of matrices D and a matrix M , let KS(M ) ≥ 1 denote the smallest number such that (cid:107)SM v(cid:107)2 ≤ KS(M )(cid:107)M v(cid:107)2 for all v. Definition 4. For S sampled from a distribution of matrices D and a matrix M , let κS(M ) ≤ 1 denote the largest number such that (cid:107)SM v(cid:107)2 ≥ κS(M )(cid:107)M v(cid:107)2 for all v. −1, cS(M )](cid:107)M v(cid:107)2 for all v. Note that by definition, cs(M ) equals the max of KS(M ) and 1 κS (M ) . We define the condition number of a matrix A to be cA = KA(I)/κA(I). 2.1 Previous Techniques Building upon the initial framework established in [RSW16], we apply a polynomial system solver to solve weighted regularized LRA to high accuracy. By applying standard sketching guarantees, v can be made a polynomial function of k, 1/ε, r that is independent of n. Theorem 1 ([Ren92a][Ren92b][BPR96]). Given a real polynomial system P (x1, x2, ..., xv) having v variables and m polynomial constraints fi(x1, ..., xv)∆i0, where ∆i ∈ {≥, =,≤}, d is the maximum degree of all polynomials, and H is the maximum bitsize of the coefficients of the polynomials, one can determine if there exists a solution to P in (md)O(v)poly(H) time. Intuitively, the addition of regularization requires us to only preserve directions with high spectral weight in order to preserve our low rank approximation well enough. This dimension of the subspace spanned by these important directions is exactly the statistical dimension of the problem, allowing us to sketch to a size less than k that could provably preserve our low rank approximation well enough. In line with this intuition, we use an important lemma from [CNW16] Lemma 2.1. Let A, B be matrices with n rows and let S, sampled from D, have (cid:96) = Ω( 1 rows and n columns. Then γ2 (K + log(1/ε))) (cid:20) (cid:107)AT ST SB − AT B(cid:107) > γ ·(cid:113) Pr ((cid:107)A(cid:107)2 + (cid:107)A(cid:107)2 F /K) ((cid:107)B(cid:107)2 + (cid:107)B(cid:107)2 F /K) < ε (cid:21) In particular, if we choose K > Ω(sr(A) + sr(B)), then we have for some small constant γ(cid:48), Pr(cid:2)(cid:107)AT ST SB − AT B(cid:107) > γ(cid:48)(cid:107)A(cid:107)(cid:107)B(cid:107)(cid:3) < ε 4 3 Multiple Regression Sketches In this section, we prove our main structural theorem which allows us to sketch regression matrices to the size of the statistical dimension of the matrices while maintaining provable guarantees. Specifically, to approximately solve a sum of regression problems, we are able to reduce the dimension of the problem to the maximum statistical dimension of the regression matrices. Theorem 2. Let M (1), . . . , M (d) ∈ Rn×k and b(1), . . . , b(d) ∈ Rn be column vectors. Let S ∈ R(cid:96)×n be sampled from D with (cid:96) = Θ( 1 Define x(i) = argminx (cid:107)M (i)x− b(i)(cid:107)2 + λ(cid:107)x(cid:107)2 and y(i) = argminy (cid:107)S(M (i)y − b(i))(cid:107)2 + λ(cid:107)y(cid:107)2. Then, with ε (s + log(1/ε))) and s = maxi{sdλ(M (i))}. constant probability, d(cid:88) (cid:32) d(cid:88) (cid:33) (cid:107)M (i)y(i) − b(i)(cid:107)2 + λ(cid:107)y(i)(cid:107)2 ≤ (1 + ε) · (cid:107)M (i)x(i) − b(i)(cid:107)2 + λ(cid:107)x(i)(cid:107)2 i=1 i=1 0 λIk (cid:21) 0 Ik We note that a simple union bound would incur a dependence of a factor of log(d) in the sketching dimension l. While this might seem mild at first, the algorithms we consider are exponential in l, implying that we would be unable to derive polynomial time algorithms for solving weighted low rank approximation even when the input and weight matrix are both of constant rank. Therefore, we need an average case version of sketching guarantees to hold; however, this is not always the case since l is small and applying Lemma 2.1 naıvely only gives a probability bound. Ultimately, we must condition on the event of a combination of sketching guarantees holding and carefully analyzing the expectation in separate cases. Proof. Let (cid:98)S = that (cid:107)M (i)x − b(i)(cid:107)2 + λ(cid:107)x(cid:107)2 = (cid:107)(cid:99)M (i)x −(cid:98)b(i)(cid:107)2 and (cid:107)S(M (i)y − b(i))(cid:107)2 + λ(cid:107)y(cid:107)2 = (cid:107)(cid:98)S((cid:99)M (i)y −(cid:98)b(i))(cid:107)2. (cid:20)b(i) (cid:21) (cid:21) ∈ R((cid:96)+k)×(n+k), (cid:99)M (i) = (cid:104)(cid:107)(cid:99)M (i)y(i) −(cid:98)b(i)(cid:107)2 − (cid:107)(cid:99)M (i)x(i) −(cid:98)b(i)(cid:107)2(cid:105) ≤ O(ε) · (cid:107)(cid:99)M (i)x(i) −(cid:98)b(i)(cid:107)2 ∈ R(n+k)×k, and(cid:98)b(i) = It suffices to prove that, for 1 ≤ i ≤ d, ∈ Rn+k. Observe (cid:20) M (i)√ (cid:20)S because we can sum over all i and apply Markov's inequality to complete the argument. Fix some i and set M = M (i), b = b(i),(cid:99)M = (cid:99)M (i),(cid:98)b =(cid:98)b(i), x = x(i), y = y(i). Let (cid:98)Ub be an orthogonal matrix whose columns form an orthonormal basis for the columns of [(cid:99)M (cid:98)b]. Now define Γ := (cid:107)(cid:98)U T b (cid:98)ST(cid:98)S(cid:98)Ub − Since s < k, we can have an unbounded condition number if we just look at c(cid:98)S((cid:99)M ) so we need to have Ik+1(cid:107). We let U1 form its first n rows and U2 form the rest. a more subtle analysis than in [RSW16]. Instead of simply conditioning on Γ, let us define M = Mh + Mt, i ≥ λ. where Mh is the component of M corresponding to the span of singular vectors with values that are σ2 Then, Mt is the orthogonal component to Mh and is a subspace of the span of singular vectors corresponding to values that are σ2 , for σi corresponding to Mh, then the rank of Mh is bounded by rh = O(sdλ(M )). Since S has at least Ω(sdλ(M )/ε) rows, with probability 1, the condition number ch = cS([Mh, b]) will be finite with probability 1 (note that b can be assumed to be orthogonal to the image of M ). i < λ. Since 2 ≥ 1 + λ σ2 i E S 0 Let α = ch(1 + Γ) be a product of condition numbers. If α is close to 1, then we are in a good regime so we will condition on α.It follows that (cid:104)(cid:107)(cid:99)M y −(cid:98)b(cid:107)2 − (cid:107)(cid:99)M x −(cid:98)b(cid:107)2(cid:105) E S (cid:104)(cid:107)(cid:99)M y −(cid:98)b(cid:107)2 − (cid:107)(cid:99)M x −(cid:98)b(cid:107)2(cid:12)(cid:12)α > 1.1 (cid:105) (cid:104)(cid:107)(cid:99)M y −(cid:98)b(cid:107)2 − (cid:107)(cid:99)M x −(cid:98)b(cid:107)2(cid:12)(cid:12)α ≤ 1.1 (cid:105) = Pr [α > 1.1] · E + Pr [α ≤ 1.1] · E S S We will now bound the two terms in the sum and our final result follows by combining Claim 3.1 and Claim 3.4. Claim 3.1. Pr [α > 1.1] E S (cid:104)(cid:107)(cid:99)M y −(cid:98)b(cid:107)2 − (cid:107)(cid:99)M x −(cid:98)b(cid:107)2(cid:12)(cid:12)α > 1.1 (cid:105) ≤ O(ε) · (cid:107)(cid:99)M x −(cid:98)b(cid:107)2 5 1 Proof. To bound our expression, note that κ(cid:98)S([(cid:99)M (cid:98)b]) (cid:107)(cid:98)S((cid:99)M y −(cid:98)b)(cid:107)2 ≤ (cid:107)(cid:99)M y −(cid:98)b(cid:107)2 ≤ (cid:104)(cid:107)(cid:99)M y −(cid:98)b(cid:107)2 − (cid:107)(cid:99)M x −(cid:98)b(cid:107)2(cid:12)(cid:12)α > 1.1 κ(cid:98)S([(cid:99)M (cid:98)b]) By Claim 3.2, (cid:107)(cid:99)M y −(cid:98)b(cid:107)2 ≤ 10α2(cid:107)(cid:99)M x −(cid:98)b(cid:107)2. By Claim 3.3, (cid:105) ≤ 10(cid:107)(cid:99)M x −(cid:98)b(cid:107)2 E (cid:107)(cid:98)S((cid:99)M x −(cid:98)b)(cid:107)2 ≤ K(cid:98)S([(cid:99)M (cid:98)b]) κ(cid:98)S([(cid:99)M (cid:98)b]) (cid:107)(cid:99)M x −(cid:98)b(cid:107)2 (cid:2)α2(cid:12)(cid:12)α > 1.1(cid:3) ≤ O(ε)(cid:107)(cid:99)M x −(cid:98)b(cid:107)2 1 E S S 1 ≤ 10α κ(cid:98)S ([(cid:99)M (cid:98)b]) Claim 3.2. K(cid:98)S([(cid:99)M (cid:98)b]) ≤ α and Proof. First, we bound K(cid:98)S([(cid:99)M(cid:98)b]). By definition of Γ, (cid:107)S(M x− b)(cid:107)2 + λ(cid:107)x(cid:107)2 ≤ (1 + Γ)((cid:107)M x− b(cid:107)2 + λ(cid:107)x(cid:107)2) so K(cid:98)S([(cid:99)M (cid:98)b]) ≤ 1 + Γ ≤ α. . First, we claim that (cid:107)SMtx(cid:107) ≤(cid:112)λ(1 + 2Γ)(cid:107)x(cid:107). We may We now consider two cases: one where (cid:107)S(Mhx−b)(cid:107) is at least 2(cid:112)λ(1 + 2Γ)(cid:107)x(cid:107) and one where (cid:107)S(Mhx− b)(cid:107) < 2(cid:112)λ(1 + 2Γ)(cid:107)x(cid:107). For all x such that (cid:107)S(Mhx−b)(cid:107) ≥ 2(cid:112)λ(1 + 2Γ)(cid:107)x(cid:107), we rewrite (cid:107)S(M x−b)(cid:107)2 = (cid:107)S(Mhx−b)+SMtx(cid:107)2. assume x lies entirely in the column space of Mt and by definition of Mt, we know that (cid:107)M x(cid:107)2 = (cid:107)Mtx(cid:107)2 ≤ λ(cid:107)x(cid:107)2. Now, by the definition of Γ, (cid:107)SMtx(cid:107)2 = (cid:107)SM x(cid:107)2 which is at most (1 + Γ)(cid:107)M x(cid:107)2 + Γλ(cid:107)x(cid:107)2 ≤ (1 + 2Γ)λ(cid:107)x(cid:107)2. More importantly, we want to bound κ(cid:98)S ([(cid:99)M (cid:98)b]) 1 Then, by Cauchy-Schwarz, (cid:107)S(M x − b)(cid:107)2 ≥ (cid:107)S(Mhx − b)(cid:107)2 − 2(cid:104)S(Mhx − b), SMtx(cid:105) ≥ (cid:107)S(Mhx − b)(cid:107)2 − 2(cid:107)S(Mhx − b)(cid:107)(cid:107)SMtx(cid:107) = (cid:107)S(Mhx − b)(cid:107)((cid:107)S(Mhx − b)(cid:107) − (cid:107)SMtx(cid:107)) ≥ 0.5(cid:107)S(Mhx − b)(cid:107)2 ≥ (0.5/ch)(cid:107)Mhx − b(cid:107)2, where the fourth line follows since (cid:107)S(Mhx − b)(cid:107) ≥ 2(cid:112)λ(1 + 2Γ)(cid:107)x(cid:107) ≥ 2(cid:107)SMtx(cid:107) and the fifth line follows from definition of ch. Finally, this implies (cid:107)S(M x − b)(cid:107)2 + λ(cid:107)x(cid:107)2 ≥ (0.5/ch)((cid:107)Mhx − b(cid:107)2 + 2λ(cid:107)x(cid:107)2) ≥ (0.5/ch)((cid:107)Mhx − b(cid:107)2 + (cid:107)Mtx(cid:107)2 + λ(cid:107)x(cid:107)2) ≥ (1/2ch)((cid:107)M x − b(cid:107)2 + λ(cid:107)x(cid:107)2) where the first line follows since ch > 1, the second line follows from (cid:107)Mtx(cid:107)2 < λ(cid:107)x(cid:107)2 and the last line from orthogonality. Now consider all x such that (cid:107)S(Mhx − b)(cid:107) is less than 2(cid:112)λKS(M )(cid:107)x(cid:107). This means (cid:107)Mhx − b(cid:107) is less than 2(cid:112)chλKS(M )(cid:107)x(cid:107). Then, (cid:107)M x − b(cid:107)2 + λ(cid:107)x(cid:107)2 ≤ 4ch(1 + 2Γ)λ(cid:107)x(cid:107)2 + λ(cid:107)x(cid:107)2 ≤ · λ(cid:107)x(cid:107)2 ≤ 1 1 · ((cid:107)S(M x − b)(cid:107)2 + λ(cid:107)x(cid:107)2) 4ch(1 + 2Γ) + 1 5ch(1 + 2Γ) Together, we conclude that κ(cid:98)S ([(cid:99)M (cid:98)b]) 1 ≤ max(5ch(1 + 2Γ), 2ch) ≤ 10α, where α = ch(1 + Γ). Claim 3.3. Pr [α > 1.1] E S (cid:104) α2(cid:12)(cid:12)(cid:12)α > 1.1 (cid:105) = O(ε) 6 Proof. Note that for t > 1, we have Pr (α > t) ≤ Pr ≤ Pr (cid:16) (cid:16) 1 + Γ > 1 + Γ > (cid:17) (cid:17) √ √ t t + Pr + Pr (cid:16) (cid:16) 1 + Γ ≤ √ (cid:17) √ ch > t (cid:17) √ t t and ch > Γ = (cid:107)(cid:98)U T By Lemma 12 of [ACW17], note that (cid:107)U1(cid:107)2 b (cid:98)ST(cid:98)S(cid:98)Ub − Ik+1(cid:107) which is equal to (cid:107)U T √ (cid:107)U1(cid:107)2 , then for any t > 1.1, we have γ = t F is at most sdλ(M ) + 1 and (cid:107)U1(cid:107) < 1. Now, we can express 1 U1(cid:107). By Lemma 2.1 with A = B = U1 and 1 ST SU1 − U T Then, by [CD08], since Mh only has less than O(sdλ(M )) columns, then since (cid:96) > sdλ(M )/ε, we have t] = Θ(t−1/ε) < εt−Ω(1). Thus, we conclude that Pr[1 + Γ > √ t] < εt−Ω(1) F /(cid:107)U1(cid:107)2 + log(t/ε))) = Ω(sdλ(M ) + log(1/ε)). γ2 ((cid:107)U1(cid:107)2 since (cid:96) is larger than Ω( 1 √ (cid:104) for t > 1.1, Pr[cS(M ) > α2(cid:12)(cid:12)(cid:12)α > 1.1 (cid:105) ≤ O(1) Pr[α > 1.1] + (cid:90) ∞ (cid:105) ≤ O(ε) · (cid:107)(cid:99)M x −(cid:98)b(cid:107)2 1.1 Pr [α > 1.1] E S (cid:104)(cid:107)(cid:99)M y −(cid:98)b(cid:107)2 − (cid:107)(cid:99)M x −(cid:98)b(cid:107)2(cid:12)(cid:12)α ≤ 1.1 t Pr[α > t] dt = O(ε) Claim 3.4. ES (cid:107)(cid:99)M y −(cid:98)b(cid:107)2 − (cid:107)(cid:99)M x −(cid:98)b(cid:107)2 = (cid:107)(cid:99)M (y − x)(cid:107)2 = (cid:107)y − x(cid:107)2 Proof. The normal equations for x tell us that (cid:99)M T ((cid:99)M x −(cid:98)b) is 0. Thus, by the Pythagorean Theorem, where (cid:98)U y = (cid:99)M y and (cid:98)U x = (cid:99)M x. We have (cid:107)y − x(cid:107) ≤ (cid:107)((cid:98)U T(cid:98)ST(cid:98)S(cid:98)U − Ik)(y − x)(cid:107) + (cid:107)(cid:98)U T(cid:98)ST(cid:98)S(cid:98)U (y − x)(cid:107), so since we are conditioning on α ≤ 1.1, we know that Γ ≤ 0.1, which implies that (cid:107)y − x(cid:107) ≤ O(1)(cid:107)(cid:98)U T(cid:98)ST(cid:98)S(cid:98)U (y − x)(cid:107). (cid:104)(cid:107)(cid:98)U T(cid:98)ST(cid:98)S(cid:98)U (y − x)(cid:107)2(cid:105) Since Pr[α ≤ 1.1] ≥ 1 − O(ε), then . and the normal equations for y tell us that (cid:98)U T(cid:98)ST(cid:98)S((cid:98)U y −(cid:98)b) is 0. Thus, S E S E S = E S (cid:104)(cid:107)(cid:99)M y −(cid:98)b(cid:107)2 − (cid:107)(cid:99)M x −(cid:98)b(cid:107)2(cid:12)(cid:12)α ≤ 1.1 (cid:105) ≤ O(1) · E (cid:104)(cid:107)(cid:98)U T(cid:98)ST(cid:98)S(cid:98)U (y − x)(cid:107)2(cid:105) (cid:104)(cid:107)(cid:98)U T(cid:98)ST(cid:98)S((cid:98)U x −(cid:98)b)(cid:107)2(cid:105) tε(cid:107)(cid:98)U x −(cid:98)b(cid:107)(cid:105) (cid:104)(cid:107)(cid:98)U T(cid:98)ST(cid:98)S((cid:98)U x −(cid:98)b)(cid:107) > (cid:104)(cid:107)(cid:98)U T(cid:98)ST(cid:98)S((cid:98)U x −(cid:98)b)(cid:107)2(cid:105) ≤ (cid:107)(cid:99)M x −(cid:98)b(cid:107)2 ∞(cid:88) ≤ ε · (cid:107)(cid:99)M x −(cid:98)b(cid:107)2 O(εt) · t ≤ O(ε) · (cid:107)(cid:99)M x −(cid:98)b(cid:107)2 ε (s + log(1/ε)) = Ω( 1 ∞(cid:88) √ Pr E S t=1 . tε · Pr [Et(cid:107)] Let t be a natural number. Note that S has Ω( 1 (cid:98)S only sketches U1 but leaves U2 un-sketched. By Lemma 2.1 with A = U1, B = U1 x − b, γ = Let Et denote the event that (cid:107)(cid:98)U T(cid:98)ST(cid:98)S((cid:98)U x −(cid:98)b)(cid:107) is between (cid:112)(t − 1)ε(cid:107)(cid:99)M x −(cid:98)b(cid:107) and < O(εt) have √ tε (s + log((1/ε)t)) rows. Note that tε/(cid:107)U1(cid:107) we √ (2) tε(cid:107)(cid:99)M x −(cid:98)b. By inequality (2) we have and we are done. t=1 7 4 Algorithms In this section, we present a fast algorithm for solving regularized weighted low rank approximation. Our algorithm exploits the structure of low-rank approximation as a sum of regression problems and applies the main structural theorem of our previous section to significantly reduce the number of variables in the optimization process. Note that we can write n(cid:88) d(cid:88) (cid:107)W ◦ (U V − A)(cid:107)2 F = (cid:107)Ui,;V DWi,; − Ai,;DWi,;(cid:107)2 = (cid:107)DW;,j U V;,j − DW;,j A;,j(cid:107)2 i=1 j=1 4.1 Using the Polynomial Solver with Sketching Now we sample Gaussian sketch matrices S(cid:48) from Rd×Θ( s denote V DWi,; S(cid:48) and Q(j) denote S(cid:48)(cid:48)DW;,j U . ε ) log(1/ε) and S(cid:48)(cid:48) from RΘ( s ε ) log(1/ε)×n. We let P (i) The matrices P (i) and Q(j) can be encoded using Θ( s+log(1/ε) )kr variables. For fixed P (i) and Q(j) we ε can define and to get and n(cid:88) d(cid:88) i=1 j=1 U = argmin U∈Rn×k V = argmin V ∈Rk×n (cid:107)Ui,;P (i) − Ai,;DWi,;S(cid:48)(cid:107)2 + λ(cid:107)Ui,;(cid:107)2 (cid:107)Q(j)V;,j − S(cid:48)(cid:48)DW;,j A;,j(cid:107)2 + λ(cid:107)V;,j(cid:107)2 Ui,; = Ai,;DWi,; S(cid:48)(P (i))T (P (i)(P (i))T + λIk)−1 V;,j = ((Q(j))T Q(j) + λIk)−1(Q(j))T S(cid:48)(cid:48)DW;,j A;,j F +λ(cid:107)U∗(cid:107)2 so U and V can be encoded as rational functions over Θ( (s+log(1/ε))kr F +λ(cid:107) U(cid:107)2 By Theorem 2, we can argue that min U , V (cid:107)W ◦( U V −A)(cid:107)2 F +λ(cid:107)V ∗(cid:107)2 F is a good approximation for (cid:107)W◦(U∗V ∗−A)(cid:107)2 F with constant probability, and so in particular such a good approxima- tion exists. By using the polynomial system feasibility checkers described in Theorem 1 and following similar procedures and doing binary search, we get an polynomial system with O(nk)-degree and O( s+log(1/ε) kr) ε variables after simplifying and so our polynomial solver runs in time nO((s+log(1/ε))kr/ε) logO(1)(∆/δ). Theorem 3. Given matrices A, W ∈ Rn×d and ε < 0.1 such that ) variables by Cramer's Rule. F +λ(cid:107) V (cid:107)2 ε 1. rank(W) = r 2. non-zero entries of A, W are multiples of δ > 0 3. all entries of A, W are at most ∆ in absolute value 4. s = maxi,j{sdλ(V ∗DWi,;), sdλ(DW;,j U∗)} < k there is an algorithm to find U ∈ Rn×k, V ∈ Rk×d in time nO((s+log(1/ε))kr/ε) logO(1)(∆/δ) such that (cid:107)W ◦ (U V − A)(cid:107)2 F ≤ (1 + ε)OPT. F + λ(cid:107)V (cid:107)2 F + λ(cid:107)U(cid:107)2 4.2 Removing Rank Dependence Note that the running time of our algorithm still depends on k, the dimension that we are reducing to. To remove this, we prove a structural theorem about low rank approximation of low statistical dimension matrices. 8 Algorithm 1 Regularized Weighted Low Rank Approximation public : procedure RegWeightedLowRank(A, W, λ, s, k, ε) Sample Gaussian sketch S(cid:48) ∈ Rd×Θ( s Sample Gaussian sketch S(cid:48)(cid:48) ∈ RΘ( s Create matrix variables P (i) ∈ Rk×Θ( s ε ) log(1/ε) from D ε ) log(1/ε)×n from D. ε ) log(1/ε), Q(j) ∈ Rk×Θ( s ε ) log(1/ε) for i, j from 1 to r (cid:46) Variables used in polynomial system solver Use Cramer's Rule to express Ui,; = Ai,;DWi,; S(cid:48)(P (i))T (P (i)(P (i))T + λIk)−1 as a rational function of variables P (i); similarly, V;,j = ((Q(j))T Q(j) + λIk)−1(Q(j))T S(cid:48)(cid:48)DW;,j A;,j (cid:46) U , V are now rational function of variables P, Q Solve min U , V (cid:107)W ◦ ( U V − A)(cid:107)2 F + λ(cid:107) U(cid:107)2 (cid:46) Optimization with polynomial solver of Theorem 1 in variables P, Q F and apply binary search to find U , V F + λ(cid:107) V (cid:107)2 return U , V Theorem 4. Given matrices A, W in Rn×d and ε < 0.1 such that rank(W ) is r, and letting s equal maxi,j{sdλ(V ∗DWi,;), sdλ(DW;,j U∗)} < k, if we let OPT(k) denote min U∈Rn×k,V ∈Rk×d (cid:107)W ◦ (U V − A)(cid:107)2 F + λ(cid:107)U(cid:107)2 F + λ(cid:107)V (cid:107)2 F then OPT(O(r(s + log(1/ε))/ε)) ≤ (1 + ε)OPT(k) Proof. Observe that our algorithm in Theorem 3, d(cid:88) j=1 V = argmin V ∈Rk×n (cid:107)Q(j)V;,j − S(cid:48)(cid:48)DW;,j A;,j(cid:107)2 + λ(cid:107)V;,j(cid:107)2 where Q(j) = S(cid:48)(cid:48)DW;,j U which equals R(j)U which is a O((s + log(1/ε))/ε) by k matrix and R(j) = S(cid:48)(cid:48)DW;,j . Note that R(j) can be written as a linear combination of r matrices with rank at most O((s + log(1/ε))/ε). Therefore, by letting P be the projection matrix on the span of the total O((s + log(1/ε))r/ε) right singular vectors of these r matrices, we see that V equals d(cid:88) j=1 argmin V ∈Rk×n (cid:107)R(j)P U V;,j − S(cid:48)(cid:48)DW;,j A;,j(cid:107)2 + λ(cid:107)V;,j(cid:107)2 Since this holds for any U , we see that (cid:107)W ◦ (P U∗ V − A)(cid:107)2 F + λ(cid:107)P U∗(cid:107)2 F + λ(cid:107) V (cid:107)2 F ≤ (cid:107)W ◦ (U∗ V − A)(cid:107)2 F + λ(cid:107)U∗(cid:107)2 F + λ(cid:107) V (cid:107)2 F Since P U∗ V has rank at most the rank of P , we conclude by noting that by the guarantees of Theorem 3, (cid:107)W ◦ (U∗ V − A)(cid:107)2 F + λ(cid:107)U∗(cid:107)2 F + λ(cid:107) V (cid:107)2 F ≤ (1 + ε)OPT(k) Combining Theorem 3 and Theorem 4, we have our final theorem. We note that this also improves running time bounds of un-weighted regularized low rank approximation in Section 3 of [ACW17]. Theorem 5. Given matrices A, W ∈ Rn×d and ε < 0.1 and the conditions of Theorem 3, there is an algorithm to find U ∈ Rn×k, V ∈ Rk×d in time nO(r2(s+log(1/ε))2/ε2) logO(1)(∆/δ) such that (cid:107)W ◦ (U V − A)(cid:107)2 F ≤ (1 + ε)OPT. F + λ(cid:107)U(cid:107)2 F + λ(cid:107)V (cid:107)2 9 5 Reducing the Degree of the Solver 5.1 Non-negative Weight Matrix and Non-Negative Rank F + λ(cid:107)U(cid:107)2 F + λ(cid:107)V (cid:107)2 Then, there is an algorithm to find U ∈ Rn×k, V ∈ Rk×d in time poly(n)·2O(r(cid:48)r2(s+log( 1 Under the case where W is rank r with only r distinct columns (up to scaling), we are able to improve the running time to poly(n)2r3(s+log(1/ε))2/ε2 by showing that the degree of the solver is O(rk) as opposed to O(nk). Specifically, the O(nk) degree comes from clearing the denominator of the rational expressions that come from naıvely using and analyzing Cramer's Rule; in this section, we demonstrate different techniques to avoid the dependence on n. We also show the same running time bound under a more relaxed assumption of non-negative rank, which is always less than or equal to the number of distinct columns. Theorem 6. Given matrices A, W ∈ Rn×d and ε < 0.1 and suppose the conditions of Theorem 3 hold. Furthermore, we are given Y, Z ≥ 0 such that W = Y Z and Y, Z T has nnr(W ) = r(cid:48) columns. ε ))2 1 such that (cid:107)W ◦ (U V − A)(cid:107)2 and Z ∈ Rr(cid:48)×n are non-negative, then we claim that we Proof. Since we know W = Y Z, where Y ∈ Rn×r(cid:48) have a rounding procedure to create W (cid:48) with only (log n/ε)r(cid:48) distinct columns and rows that produces an ε-close solution. The procedure is as expected: round all values in Y, Z to the nearest power of (1 + ε) and call W (cid:48) = Y (cid:48)Z(cid:48) our new matrix. Note that there are at most (log n/ε)r(cid:48) distinct rows, since each row in A takes on only (log n/ε)r(cid:48) possible values. Symmetrically, the number of columns is bounded by the same value. Now, we claim that: Claim 5.1. (1 − ε)2W ≤ W (cid:48) ≤ (1 + ε)2W Proof. It suffices to show that the intermediary matrix (cid:99)W = Y (cid:48)Z satisfies this bound. Consider each row of (cid:99)W , so WLOG, let (cid:99)W1 be the first row of (cid:99)W which can be expressed as (cid:99)W1 =(cid:80)r(cid:48) is the i-th row of Z. Note that W1 =(cid:80)r(cid:48) i=1(Y (cid:48))1iZi, where Zi procedure and all values in Y1i, Zi are non-negative, we deduce that (1 − ε)(cid:99)W1 ≤ W1 ≤ (1 + ε)(cid:99)W1. i=1 Y1iZi. Finally, since (Y (cid:48))1i ∈ (1 − ε, 1 + ε)Y1i by our rounding ε2 )·logO(1)(cid:0) ∆ F ≤ (1 + ε)OPT. (cid:1) δ Since we only have (log n/ε)r(cid:48) of our system is at most (log n/ε)r(cid:48) distinct columns and rows, when we call the polynomial solver, the degree and our bound follows from polynomial system solver guarantees. 5.2 Richardson's Iteration Note that the current polynomial solver uses Cramer's rule to solve n(cid:88) i=1 U = argmin U∈Rn×k (cid:107)Ui,;P (i) − Ai,;DWi,; S(cid:48)(cid:107)2 + λ(cid:107)Ui,;(cid:107)2 giving Ui,; = Ai,;DWi,; S(cid:48)(P (i))T (P (i)(P (i))T + λIk)−1. We want to use Richardson's iteration instead to avoid rational expressions and the dependence on n in the degree that comes from clearing the denominator. Theorem 7 (Preconditioned Richardson [CKP+17]). Let A, B be symmetric PSD matrices such that ker(A) = ker(B) and ηA (cid:22) B (cid:22) A. Then, for any b, if x0 = 0 and xi+1 = xi − ηB−1(Axi − b), (cid:107)xt − A−1b(cid:107) ≤ ε(cid:107)A−1b(cid:107) for t = Ω(log(cB/ε)/η). Furthermore, we may express xt as a polynomial of degree O(t) in terms of the entries of B−1 and A. Theorem 8. Given matrices A, W ∈ Rn×d and ε < 0.1 and suppose the conditions of Theorem 3 hold. Furthermore, let σ = maxi,j{σ1(V ∗DWi,; ), σ1(DW;,j U∗)}. There is an algorithm to find U ∈ Rn×k, V ∈ Rk×d in time poly(n) where l = O((s + log( 1 ε ))2 r2 ε2 ), such that (cid:107)W ◦ (U V − A)(cid:107)2 F + λ(cid:107)U(cid:107)2 (cid:16) σ2 λ · log F + λ(cid:107)V (cid:107)2 (cid:17)(cid:17)l · logO(1)(cid:0) ∆ (cid:16) ∆(σ2+λ)n F ≤ (1 + ε)OPT + τ. λτ δ (cid:1) , 10 Proof. Fix some i. By Theorem 7, we may express a k-order approximation of Ui,; as i,; = Ai,;DWi,;S(cid:48)(P (i))T pk(P (i)(P (i))T + λIk) U k where pk is a degree O(k) polynomial that approximate the inverse. Furthermore, we claim λIk (cid:22) P (i)(P (i))T + By the same arguments as in the proof of Theorem 2 in Claim 3.3, let M T = V ∗Dwi,; and (cid:99)M defined λIk (cid:22) log(n)(1 + σ/λ)Ik, where P (i) = V ∗Dwi,;S, with high probability. analogously, along with (cid:98)U ,(cid:98)S. Now define Γ := (cid:107)(cid:98)U T(cid:98)ST(cid:98)S(cid:98)U − Ik(cid:107). Again, let U1 form its first n rows and F ≤ sdλ(M ) and (cid:107)U1(cid:107) < 1. By Lemma 2.1 with A = B = U1 and U2 form the rest. Note that (cid:107)U1(cid:107)2 γ = log(n)/(cid:107)U1(cid:107)2, then we have Pr[1 + Γ > log(n)] < n−Ω(1) since (cid:96) > Ω( 1 γ2 ((cid:107)U1(cid:107)2 F /(cid:107)U1(cid:107)2 + log(n))) = Ω(sdλ(M )) = Ω(s). This implies that with high probability (cid:107)SM x(cid:107)2 + λ(cid:107)x(cid:107)2 ≤ log(n)((cid:107)M x(cid:107)2 + λ(cid:107)x(cid:107)2). Specifically, we have σ1(P (i))2 ≤ log(n)σ1(V ∗Dwi,;)2 + λ log(n) ≤ log(n)σ2 + λ log(n). Therefore, by the guarantees of Theorem 7, we have (cid:107) U k i,;P (i) − Ai,;DWi,;S(cid:48)(cid:107)2 + λ(cid:107) U k holds if k > Ω((σ2/λ) log(∆(σ2 + λ)/λn/τ )). i,;(cid:107)2 ≤ (cid:107) Ui,;P (i) − Ai,;DWi,;S(cid:48)(cid:107)2 + λ(cid:107) Ui,;(cid:107)2 + τ /n Summing up for all i and applying a union bound over failure probabilities, we see that with constant probability, we have n(cid:88) (cid:107) U k i,;P (i) − Ai,;DWi,; S(cid:48)(cid:107)2 + λ(cid:107) U k i,;(cid:107)2 ≤ (1 + ε)OPT + τ. i=1 Finally, since the degree of the polynomial system using U k is simply O(k), our theorem follows. 5.3 Preconditioned GD Instead of directly using Richardson's iteration, we may use a preconditioner first instead. The right precondi- tioner can also be guessed at a cost of increasing the number of variables. Note that multiple preconditioners may be used, but for now, we demonstrate the power of a single preconditioner. Theorem 9. Given matrices A, W ∈ Rn×d and ε < 0.1 and suppose the conditions of Theorem 8 hold. Furthermore, 0 < lW ≤ W ≤ uW . Then, there is an algorithm to find U ∈ Rn×k, V ∈ Rk×d in time F + (cid:1) , where l = O((s + log( 1 (cid:17)(cid:17)l · logO(1)(cid:0) ∆ poly(n) ·(cid:16) uW (cid:16) ∆(σ2+λ)n · log F ≤ (1 + ε)OPT + τ. F + λ(cid:107)V (cid:107)2 λ(cid:107)U(cid:107)2 Proof. For all i, we want to show there exists some matrix B such that η(P (i)(P (i))T + λIk) (cid:22) B (cid:22) P (i)(P (i))T + λIk with constant probability. Then, we may simply guess B−1 with only an additional O((s + log(1/ε))2) variables and apply Theorem 7, express a k-order approximation of Ui,; as lW ε ))2 r2 ε2 ), such that (cid:107)W ◦ (U V − A)(cid:107)2 λτ δ i,; = Ai,;DWi,; S(cid:48)(P (i))T pk(P (i)(P (i))T + λIk, B−1) U k where pk is a degree O(k) polynomial that approximate the inverse and apply the same analysis as Theorem 8 to see that k = O(η−1 log(cB/τ )) suffices. In fact, we will explicitly construct B. Let D ∈ Rn×n be the diagonal matrix with diagonal entries lW . Let P = V ∗DS = RS, where R = V ∗Dl. Also, we define P (i) = V ∗Dwi,;S = R(i)S. Then, we see that by our bounds on W , R(i)(R(i))T (cid:22) RRT (cid:22) R(i)(R(i))T lW uW 11 By using similar arguments for condition number bounds as in Claim 3.3 in Theorem 2, we see that lW uW log(n) R(i)SST (R(i))T (cid:22) RSST RT (cid:22) log(n)R(i)SST (R(i))T with high probability. So, we set B = (1/ log(n))RSST R and that implies that η = 1/ log(n)2(uW /lW ). Then, using Theorem 7, we conclude with the same analysis as in Theorem 8. 6 Experiments The goal of our experiments was to show that sketching down to the statistical dimension can be applied to regularized weighted low rank approximation without sacrificing overall accuracy in the objective function, as our theory predicts. We combine sketching with a common practical alternating minimization heuristic for solving regularized weighted low rank approximation, rather than implementing a polynomial system solver. At each step in the algorithm, we have a candidate U and V and we perform a "best-response" where we either update U to give the best regularized weighted low rank approximation cost for V or we update V to give the best regularized weighted low rank approximation cost for U . We used a synthetic dataset and several real datasets (connectus, NIPS, landmark, and language) [DH11, PJST17]. All our experiments ran on a MacBook Pro 2012 with 8GB RAM and a 2.5GHz Intel Core i5 processor. Figure 1: Regularized weighted low-rank approximations with λ = 0.556 for landmark, λ = 314 for NIPS, and λ = 1 for the synthetic dataset. For all datasets, the task was to find a rank k = 50 decomposition of a given matrix A. For the experiments of Figure 1 and Figure 2, we generated dense weight matrices W with the same shape as A and with each entry being a 1 with probability 0.8, a 0.1 with probability 0.15, and a 0.01 with probability 0.05. For the experiments of Figure 3, we generated binary weight matrices where each entry was 1 with probability 0.9. Note that this setting corresponds to a regularized form of matrix completion. We set the regularization parameter λ to a variety of values (described in the Figure captions) to illustrate the performance of the algorithm in different settings. For the synthetic dataset, we generated matrices A with dimensions 10000 × 1000 by picking random orthogonal vectors as its singular vectors and having one singular value equal to 10000 and making the rest small enough so that the statistical dimension of A would be approximately 2. For the real datasets, we chose the connectus, landmark, and language datasets [DH11] and the NIPS dataset [PJST17]. We sampled 1000 rows from each adjacency or word count matrix to form a ma- trix B and then let A be the radial basis function kernel of B. We performed three algorithms on each dataset: Singular Value Decomposition, Alternating Minimization without Sketching, and Alternating Min- imization with Sketching. We parameterized the experiments by t, the sketch size, which took values in {10, 15, 20, 25, 30, 35, 40, 45, 50}. For each value of t we generated a weight matrix and either generated a synthetic dataset or sampled a real dataset as described in the above paragraphs, then tested our three algorithms. For the SVD, we just took the best rank k approximation to A as given by the top k singular vectors. We used the built-in svd function in numpy's linear algebra package. 12 550600650landmark DatasetSketchingNo sketchingSVD1020304050Sketching dimension510Frobenius norm200000220000NIPS DatasetSketchingNo sketchingSVD1020304050Sketching dimension200400600Frobenius norm100000100500101000Synthetic DatasetSketchingNo sketchingSVD1020304050Sketching dimension200400Frobenius norm Figure 2: Regularized weighted low-rank approximations with λ = 2.754 for language, λ = 1 for NIPS, and λ = 1.982 for landmark. Figure 3: Regularized weighted low-rank approximations with binary weights and λ = 1. Runtimes w/ sketching t landmark NIPS Runtimes wo/ sketching t NIPS landmark 10 15 20 25 30 35 40 45 50 54.31 53.58 57.65 65.53 68.68 72.22 79.94 81.22 72.77 49.1 50.33 51.8 56.43 57.34 62.66 63.48 67.73 73.11 10 15 20 25 30 35 40 45 50 126.22 113.8 119.17 121.69 123.51 129.87 123.65 109.02 100.61 104.5 105.75 104.28 104.35 105.42 100.5 101.75 104.93 101.77 Table 1: Runtimes in seconds for alternating minimization with and without sketching. For Alternating Minimization without Sketching, we initialized the low rank matrix factors U and V to be random subsets of the rows and columns of A respectively, then performed n = 25 steps of alternating minimization. For Alternating Minimization with Sketching, we initialized U and V the same way, but performed n = 25 best response updates in the sketched space, as in Theorem 3. The sketch S was chosen to be a CountSketch matrix with t. Based on Theorem 5, we calculated a rank t < k approximation of A whenever we used a sketch of size t. We plotted the objective value of the low rank approximation for the connectus, NIPS, and synthetic datasets for each value of t and each algorithm in Figure 1. The experiment with the landmark dataset in Figure 1 used a regularization parameter value of λ = 0.556, while the experiments with the NIPS and synthetic datasets used a value of λ = 1. Objective values were given in 1000's in the Frobenius norm. Both forms of alternating minimization greatly outperform the low rank approximation given by the SVD. Alternating minimization with sketching comes within a factor of 1.5 approximation to alternating minimization without sketching and can sometimes slightly outperform alternating minimization without sketching, showing that performing CountSketch at each best response step does not result in a critically 13 2700280029003000language DatasetSketchingNo sketchingSVD1020304050Sketching dimension102030Frobenius norm500600700NIPS DatasetSketchingNo sketchingSVD1020304050Sketching dimension678Frobenius norm1950200020502100landmark DatasetSketchingNo sketchingSVD1020304050Sketching dimension1520Frobenius norm98010001020connectus DatasetSketchingNo sketchingSVD1020304050Sketching dimension1015Frobenius norm600800NIPS DatasetSketchingNo sketchingSVD1020304050Sketching dimension6810Frobenius norm100010201040landmark DatasetSketchingNo sketchingSVD1020304050Sketching dimension1015Frobenius norm suboptimal objective value. The runtime of alternating minimization with sketching varies from being around 2 times as fast as alternating minimization without sketching (when the sketch size t = 10) to being around 1.4 times as fast (when the sketch size t = 50). Table 1 shows the runtimes for the non-synthetic experiments of Figure 1. It may surprise the reader to see that the objective values when using sketching slightly outperform the objective values without using sketching and that the objective value improves as the sketching dimension decreases. In theory, this should not happen because in low rank approximation problems, it never hurts the objective value to increase the number of columns of U and number of rows of V since one can simply add 0's. This phenomenon arises due to the use of the alternating minimization heuristic. Although an ideal low rank approximation algorithm would recognize that if U and V have more columns / rows, then one only needs to add 0's, we found in our experiments that alternating minimization tended to add mass to those extra columns / rows. This extra mass resulted in a higher contribution from the regularization terms. Thus, by sketching onto fewer dimensions, the alternating minimization heuristic was improved because it couldn't add mass in the form of extraneous columns for U or rows for V . Acknowledgements: Part of this work was done while D. Woodruff was visiting Google Mountain View as well as the Simons Institute for the Theory of Computing, and was supported in part by an Office of Naval Research (ONR) grant N00014-18-1-2562. References [ACW17] Haim Avron, Kenneth L. Clarkson, and David P. Woodruff. Sharper bounds for regularized data fitting. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM 2017, August 16-18, 2017, Berkeley, CA, USA, pages 27:1 -- 27:22, 2017. 1.1, 3, 4.2 [BPR96] Saugata Basu, Richard Pollack, and Marie-Fran¸coise Roy. On the combinatorial and algebraic complexity of quantifier elimination. Journal of the ACM (JACM), 43(6):1002 -- 1045, 1996. 1 [CD08] Zizhong Chen and Jack J. Dongarra. Condition numbers of gaussian random matrices. CoRR, abs/0810.0800, 2008. 3 [CKP+17] Michael B Cohen, Jonathan Kelner, John Peebles, Richard Peng, Anup B Rao, Aaron Sidford, and Adrian Vladu. Almost-linear-time algorithms for markov chains and new spectral primitives for directed graphs. In Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, pages 410 -- 419. ACM, 2017. 7 [CNW16] Michael B. Cohen, Jelani Nelson, and David P. Woodruff. Optimal Approximate Matrix Product in Terms of Stable Rank. In Ioannis Chatzigiannakis, Michael Mitzenmacher, Yuval Rabani, and Davide Sangiorgi, editors, 43rd International Colloquium on Automata, Languages, and Pro- gramming (ICALP 2016), volume 55 of Leibniz International Proceedings in Informatics (LIPIcs), pages 11:1 -- 11:14, Dagstuhl, Germany, 2016. Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik. 2.1 [DH11] [DN11] [GG11] Timothy A. Davis and Yifan Hu. The university of florida sparse matrix collection. ACM Trans. Math. Softw., 38(1):1:1 -- 1:25, December 2011. 6, 6 Saptarshi Das and Arnold Neumaier. Regularized low rank approximation of weighted data sets. Preprint, 2011. 1.1 Nicolas Gillis and Francois Glineur. Low-rank matrix approximation with weights or missing data is np-hard. SIAM Journal on Matrix Analysis and Applications, 32(4):1149 -- 1165, 2011. 1 [LA03] Wu-Sheng Lu and Andreas Antoniou. New method for weighted low-rank approximation of complex-valued matrices and its application for the design of 2-d digital filters. In ISCAS (3), pages 694 -- 697, 2003. 1 14 [LLR16] Yuanzhi Li, Yingyu Liang, and Andrej Risteski. Recovery guarantee of weighted low-rank ap- In International Conference on Machine Learning, proximation via alternating minimization. pages 2358 -- 2367, 2016. 1 [LPW97] W.-S Lu, S.-C Pei, and P.-H Wang. Weighted low-rank approximation of general complex matrices In IEEE Transactions on Circuits and and its application in the design of 2-d digital filters. Systems, volume 44, pages 650 -- 655, 1997. 1 [PJST17] Valerio Perrone, Paul A. Jenkins, Dario Span`o, and Yee Whye Teh. Poisson random fields for dynamic feature models. Journal of Machine Learning Research, 18:127:1 -- 127:45, 2017. 6, 6 [PW15] Mert Pilanci and Martin J Wainwright. Randomized sketches of convex programs with sharp guarantees. IEEE Transactions on Information Theory, 61(9):5096 -- 5115, 2015. 1 [Ren92a] James Renegar. On the computational complexity and geometry of the first-order theory of the reals. part i: Introduction. preliminaries. the geometry of semi-algebraic sets. the decision problem for the existential theory of the reals. Journal of symbolic computation, 13(3):255 -- 299, 1992. 1 [Ren92b] James Renegar. On the computational complexity and geometry of the first-order theory of the reals. part ii: The general decision problem. preliminaries for quantifier elimination. Journal of Symbolic Computation, 13(3):301 -- 327, 1992. 1 [RSW16] Ilya P. Razenshteyn, Zhao Song, and David P. Woodruff. Weighted low rank approximations with provable guarantees. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 250 -- 263, 2016. 1, 1.1, 1.1, 2.1, 3 [Shp90] [SJ03] D. Shpak. A weighted-least-squares matrix decomposition method with applications to the design of two-dimensional digital filters. In IEEE Thirty Third Midwest Symposium on Circuits and Systems, 1990. 1 Nathan Srebro and Tommi S. Jaakkola. Weighted low-rank approximations. In Machine Learn- ing, Proceedings of the Twentieth International Conference (ICML 2003), August 21-24, 2003, Washington, DC, USA, pages 720 -- 727, 2003. 1 [TYUC17] Joel A Tropp, Alp Yurtsever, Madeleine Udell, and Volkan Cevher. Practical sketching algo- rithms for low-rank matrix approximation. SIAM Journal on Matrix Analysis and Applications, 38(4):1454 -- 1485, 2017. 1 [Woo14] David P. Woodruff. Sketching as a tool for numerical linear algebra. Foundations and Trends in Theoretical Computer Science, 10(1-2):1 -- 157, 2014. 1, 2 15
1503.00067
1
1503
2015-02-28T04:57:28
O(1) Time Generation of Adjacent Multiset Combinations
[ "cs.DS" ]
We solve the problem of designing an O(1) time algorithm for generating adjacent multiset combinations in a different approach from Walsh. By the word adjacent, we mean that two adjacent multiset combinations are different at two places by one in their vector forms. Previous O(1) time algorithms for multiset combinations generated non-adjacent multiset combinations. Our algorithm in this paper can be derived from a general framework of combinatorial Gray code, which we characterise to suit our need for combinations and multiset combinations. The central idea is a twisted lexico tree, which is obtained from the lexicographic tree for the given set of combinatorial objects by twisting branches depending on the parity of each node. An iterative algorithm which traverses this tree will generate the given set of combinatorial objects in constant time as well as with a fixed number of changes from the present combinatorial object to the next.
cs.DS
cs
O(1) Time Generation of Adjacent Multiset Combinations Tadao Takaoka Department of Computer Science, University of Canterbury Christchurch, New Zealand E-mail: [email protected] Summary. We solve the problem of designing an O(1) time algorithm for generating adjacent multiset combinations in a different approach from Walsh [17]. By the word “adjacent”, we mean that two adjacent multiset combinations are different at two places by one in their vector forms. Previous O(1) time algorithms for multiset combinations generated non-adjacent multiset combinations. Our algorithm in this paper can be derived from a general framework of combinatorial Gray code, which we characterise to suit our need for combinations and multiset combinations. The central idea is a twisted lexico tree, which is obtained from the lexicographic tree for the given set of combinatorial objects by twisting branches depending on the parity of each node. An iterative algorithm which traverses this tree will generate the given set of combinatorial objects in constant time as well as with a fixed number of changes from the present combinatorial object to the next. 1. Introduction In this paper, we design an O(1) time algorithm for generating adjacent multiset combinations based on a unified approach of twisted lexico tree and tree traversal. Here O(1) means we spend O(1) time from object to object. Roughly speaking, the twisted lexico tree for a set of combinatorial objects can be obtained from the lexicographic tree for the set by twisting branches depending on the parity of each node. We give an even parity to the root. As we traverse the children of a node, we give an even and odd parity alternately to the child nodes. If a node gets even, the branches from the node remain intact. If it gets odd, the branches from the node are arranged in the reverse order. This concept of parity is applied to the entire tree globally, so that the constant change property can be easily shown for each set of combinatorial objects. Although the use of trees and parity in combinatorial generation is found in Zerling[19] and Lucas[10], the tree traversal mechanism in this paper is new. The general concept of this paper can be viewed as a refinement of combinatorial Gray code [4], [14], and [18], which is, in turn, a generalization of the generation of binary reflected Gray code [12]. Previous algorithms [2] and [3] generate multiset combinations in O(1) time in the worst case, but they are not adjacent. Ruskey and Savage [13] left open an even weaker problem of generating those objects in O(1) amortized time. The Gray code for adjacent compositions suggested by Knuth was implemented by Klingsberg [5] in O(1) amortized time. Thus present paper gives a stronger result, as compositions are a special case of multiset combinations. We generate multiset combinations in a one-dimensional array for a vector form. The generation process can be viewed as moving pebbles from box to box one by one, where each box corresponds to a multiset component and has its own size, and there are k pebbles and n boxes. We exhaust all possible arrangements. This problem is also known as the bounded composition problem in Walsh [17]. That is, given integer k, we exhaust all possibilities (objects) of expressing k by a sum of n non-negative integers ai , k=Σai ,where each ai is bounded by a positive integer bi. Walsh generates the composition from the largest lexicographic order in a similar way to Klingsberg, and the value ai alternates, increasing and decreasing from object to object. This is a complicated algorithm where 23 cases are analyzed to indentify the changing positions. Walsh managed to solve this problem in O(1) time for an object with O(n) extra space. Our program is much shorter at the cost of 2 increased data structures. In a way, we shift the complexity in control structure to that of data structure. The present work is an evolution of the author’s previous works on the O(1) time generation of combinations in-place [15] and multi-set permutations [16], in both of which the technique of tree traversal was used. The work in [15] is an improvement on combination generation by Nijenhuis and Wilf [11], Bitner, Ehrlich, and Reingold [1], and Lehmer [8]. The work in [16] is an improvement of Korsh and Lipschutz [6], whose algorithm uses a linked structure rather than one dimensional array for multiset permutations. Korsh and LaFollette [7] achieved O(1) time in-place for the same problem. In-place for combinations means we use O(k) space to generate k-combinations out of n elements in array. It is open whether there is an O(1) time algorithm for generating multiset combinations in place. We partially solve this problem by generating mulitiset combinations in array of size k in O(1) time using O(n) extra space. The paper consists of the following sections. In Section 2, we give a recursive framework for generating multiset combinations in lexico-graphic order and Gray code order. In Section 3, we give the concept of twisted lexico tree, which is the main device (date structure) for our generation. In Section 4, we give a generic algorithm for tree traversal as the main control structure. In Section 5, we map the set of multiset combinations onto a twisted lexico tree, and observe a fixed number of changes are enough from object to object. Section 6 gives implementation details. In Section 7, we partially solve the problem of generating multiset combinations in-place. Section 8 concludes the paper. Programs are given in Pascal-like pseudo code. Most types are integer and just a few Boolean. 2. Preliminaries with Recursive Framework Let mi (i=1, …, n) be the multiplicity of the i-th component in the multiset. that is, there are mi elements of the i-th component. We express the i-th component by i. We take k elements out of the given multiset and call it a k-combination. Let (a1, … , an) be the vector expression of a multiset combination, where ai is the repetition of the i-th component. We call the direct expression of components the in-place expression. As mentioned in the last section we first generate multiset combinations in lexico-graphic order. Note that if mi = 1 for all i, the set of objects becomes that of combinations. If mi =k for all i, the objects become compositions of k by n integers for n  k. Example 1. (m1, …, mn) = (1, 2, 2, 1, 1), and k=4. We have the following 18 combinations in lexicographic order. Vector form in-place form 0 0 2 1 1 3 3 4 5 0 1 1 1 1 2 3 4 5 0 1 2 0 1 2 3 3 5 0 1 2 1 0 2 3 3 4 0 2 0 1 1 2 2 4 5 0 2 1 0 1 2 2 3 5 0 2 1 1 0 2 2 3 4 0 2 2 0 0 2 2 3 3 1 0 1 1 1 1 3 4 5 1 0 2 0 1 1 3 3 5 1 0 2 1 0 1 3 3 4 1 1 0 1 1 1 2 4 5 1 1 1 0 1 1 2 3 5 1 1 1 1 0 1 2 3 4 1 1 2 0 0 1 2 3 3 1 2 0 0 1 1 2 2 5 1 2 0 1 0 1 2 2 4 1 2 1 0 0 1 2 2 3 3 The number of combinations can be computed by the inclusion-exclusion principle. Although this is well known, we include an example to confirm the number of multiset combinations. (See Liu [9, p96 ] for example). Let C(n, k) = n!/(k! (n-k)!) be the number of (ordinary) combinations of k elements out of n. Let a multiset A be given by (m1, …, mn) such that mi is between 1 and k. Let B be the k-closure of A, defined by B = (k, …, k). That is, we can take an arbitrary number of elements from each component of the multiset B for k-combinations. Let S(A, k) be the set of k-combinations of A. Let Ai be the set of k-combinations of B which have at least (mi + 1) elements of the i-th component. Then S(A, k) can be computed as S(A, k) = (S(B, k) - A1)  …  (S(B, k) - An ) = S(B, k) -  Ai +  Ai  Aj + … + (-1)-n A1 …  An Now observe that Ai = S(B, k – mi – 1), since there is a one-to-one correspondence between k-combinations in Ai and k-combinations in S(B, k – mi – 1); removing (mi + 1) i’s from a k-combination in the former results in one in the latter, and vice versa with adding (mi + 1) i’s to the latter. Similarly we have Ai  Aj = S(B, k – mi – mj – 2), etc. To compute S(B, k), we have the formula S(B, k) = C(n+k-1, k). Example 2. To compute the number of combinations in Example 1, we have S(B, k) = C(8, 4) = 70 A1 = A4 = A5 = C(6, 2) = 15, A2 = A3 = C(5, 1) = 5 A1  A4 = A1  A5 = A4  A5 = C(5, 0) = 1 all other terms = 0, and thus S(A, k) = 70 – (15 + 15 + 15 + 5 + 5) + (1 + 1 + 1) = 18. Let us generate multiset combinations in vector form in array a. Let the multiplicity of item i be m[i]. In the following we define b[i]=m[i]+m[i+1]+…+m[n]. Procedure mset generates multiset k-combinations from position i to position n. The lowest possible value of a[i] is maximum of k-b[i+1] and 0. This is because if a[i]+b[i+1]<k, we cannot scatter k balls from box i to box n since b[i+1] is the maximum possible capacity beyond position i and a[i] plus this value cannot make k from position i to n. If this value is negative, 0 must be chosen. The value of upper is similarly reasoned. A recursive procedure mset(i, k) generates multiset k-combinations in array a from position i to n in lexico-graphic order as follows: procedure mset(i, k) begin lower:=max(k-b[i+1], 0); upper:=min(m[i], k); if i ≤ n then begin for j:=lower to upper do begin a[i]:=j; mset(i+1, k-j); /* handles remaining k-j balls */ end end end; begin {main} for i:=n down to 1 do b[i]:=b[i+1]+m[i]; mset(1, k) end 4 The recursive algorithm for Gray code order is given next. We have a global array for parity, d, which controls the direction of increasing pattern and decreasing pattern at position i; d[i]=1 for increasing, d[i]=-1 for decreasing. At the end of a call at position i, d is flipped over. procedure mset(i, k) var j, lower, upper; begin lower:=max(k-b[i+1], 0); upper:=min(m[i],k); if i ≤ n then begin if d[i]>0 then for j:=lower to upper begin a[i]=j; mset(i+1, k-j); end else for j:=upper downto lower begin a[i:]=j; mset(i+1, k-j); end; d[i]:=-d[i] end else output; end; begin {main} for i:=n down to 1 do begin b[i]:=b[i+1]+m[i]; d[i]:=1 end; mset(1, k) end. 3. Twisted Lexico Tree The recursive algorithm in the previous section is essentially to traverse a tree along procedure calls. We define such trees in this section. Let  = {0, ... ,  r-1} be an alphabet for combinatorial objects. A combinatorial object is a string a1... an of length n such that each ai is taken from  and satisfies some property. A total order is defined on  with  i   i+1. Let  n be the set of all possible strings on  of length n. The lexicographic order  on  n is defined for a = a1...an and b = b1...bn by a  b   j (1  j  n) a1 = b1, ... , aj-1 = bj-1, aj  bj. Let S   n lexicographic order on  n onto S. The lexicographic tree, or lexico tree for short, of S is defined in the following way. Each a  S corresponds to a path from the root to a leaf. The root is at level 0. If a = a1...an, ai corresponds to a node at level i. We refer to ai as label for the node. We sometimes do not distinguish between node and label. If a and b share the same prefix of length k, they share the path of length k in the tree. The children of each node are ordered according to the labels of the children. A path from the root to a leaf corresponds to a leaf itself, so a corresponds to a leaf. The combinatorial objects at the leaves are thus ordered in lexicographic order on S. The twisted lexico tree of a set S of combinatorial objects is defined as follows together with the parity function. We proceed to twist a given lexico tree from the root to leaves. Let the parity of the root be even. Suppose we processed up to the i-th level. If the parity of a node v at level i is even, we do not twist the branches from v to its children. If the parity of v is odd, we arrange the be a set of combinatorial objects. The order  on S is defined by projecting the 5 children of v in reverse order. If we process all nodes at level i, we give parity to the nodes at level i+1 from first to last alternately starting from even. We denote the parity of node v by parity(v). When we process nodes at level i in the following algorithms, which are children of a node v such that parity(v)=p, we say the current parity of level i is p. Note that (labels of) nodes at level i are in increasing order if the parity of the parent if even, or equivalently if the current parity of level i is even. If the parity is odd, they are in decreasing order. We draw trees lying horizontally for notational convenience. We refer to the top child of a node as the first child and the bottom as the last child. If the labels on the paths from the root to two adjacent leaves in the twisted lexico tree for S are different at nodes not more than a fixed number, we can generate S from object to object with the fixed number of changes, and we say S satisfies the constant change property(CCP). As shown in Section 2, it will be easy to design recursive algorithms that traverse those twisted lexico trees, since they can control the paths to the leaves, and paths back to the calling points. 4. Generic Iterative Algorithm We devise in this section a general framework of iterative algorithm which avoids the O(n) overhead time by recursive calls. Although a similar method is known, this algorithm is new in using data structures “up” and “down”, and also with the concept of solution point. The array “up” is to keep track of the position of an ancestor to which the algorithm comes back from an up-point. An up-point is a node which has a single child and from which we go back to an ancestor. The array “down”, used in [16], is to keep track of positions to which we go down after we make necessary changes when moving from a node to the next node. Note that this algorithm takes O(1) time in the worst case if S satisfies the CCP and the changing mechanism is properly given. The variable “vi“ is for the node to be processed at level i. In many applications, the difference at level i is solved at level j down the tree. We refer to level j as the solution point. These changing positions are called pivots in [17]. Algorithm 1. Iterative tree traversal 1. Initialize array a to be the first object in S; Initialize array up and down; 2. Initialize v1, ... , vn to nodes on the path to the first object (top path); 3. for i:=0 to n do p[i]:=0; /* all parity values are 0 (even) initially */ 4. Initialize i to the first up-point; up[0]:=0; /* From this point on, i is for the current level */ 5. repeat 6. output(a); 7. Perform changes on a at vi and related positions; 8. Let vi go to the next node at level i; /* Label increasing or decreasing depending on p */ 9. up[i]:=i; 10. if vi is the last child of its parent (largest or smallest label) then begin 11. up[i]:=up[i-1]; up[i-1]:=i-1; {value of up propagates downwards} 12. Compute the solution point for up[i]; 13. Update the value of down for up[i]; 14. p[i]:=1-p[i]; 15. if vi is an up-point then i:=up[i] else i:=down[i] 16. end 17. until i=0. The situation is illustrated in the following figure. Levels of A and B are given by j and k. level i=up[j] level j k level n 6 vi A w object a next object a’ next vi B down[i]=k Figure 1. General picture of tree traversal When we come to the last child of a parent (w in the above figure), we have to update up[i] to up[i-1] so that we can come back directly from an up-point to w or its ancestor if w itself is a last child. We refer to the paths from vi to a and from next vi to a’ as the current path and the opposite path. A current path and opposite path consist of last children and first children respectively except for level i and above. We refer to the points A and B in this figure as an up-point and a landing point. From nodes A and B we have straight lines to the leaves. Node vi is called the return ancestor of A. Note that the return ancestor is the first non-last child we encounter when we trace the current path from A up towards the root. We also refer to level i as the crossing level when viewed from A and B. How to avoid traversing straight lines is the central problem in this paper. Simply speaking , the algorithm repeats (up, cross, down)-actions. 5. Generation of Multiset Combinations Now we form the twisted lexico-tree for multiset combinations. Here we modify the concept of parity slightly in such a way that we do not give a parity to a node which has a single child. This is slightly different from the parity in Section 3, where every node has parity, because we cannot maintain the parity in straight lines in the tree as we skip them. Example 3. The twisted lexico tree of Example 1 is given below. i0 0 2 1 1 0 0 2 1 1 2 1 0 0 1 2 1 0 0 1 0 1 0 1 2 0 1 1 1 1 0 1 1 1 1 0 1 1 0 2 0 1 1 2 1 0 1 0 2 1 0 1 1 0 0 2 1 1 0 2 0 0 0 2 2 0 0 1 0 0 1 2 1 0 0 1 0 1 2 0 1 0 2 0 0 1 1 2 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 0 2 0 0 1 1 2 0 0 0 2 1 0 1 0 2 1 0 0 1 1 0 2 0 1 1 1 1 1 0 1 1 1 Figure 2. Twisted lexico tree for multiset combinations In this figure, nodes which are given parities are shown by big circles: white for even and black for 7 odd. We assume even for all nodes on the first path, although some are little circles. Those are regarded as either parity in the proof below. Theorem 1. The set of k-combinations S(A, k) of multiset A given by (m1, …, mn) satisfies the constant change property in vector form. Proof. Form the twisted lexico-tree for the set S(A, k). Let a = a1...ai-1ai ...an and a’ = a1...ai-1a’i ...a’n be two adjacent k-combinations in the tree. Then a’i= ai + 1 or a’i = ai - 1. Along the paths from ai to an and from a’i to a’n we observe the difference at i will be solved at some j such that a’j = aj - 1 or aj + 1 when ai’= ai +1 or ai - 1 respectively. All other labels are equal along those paths since we have opposite parities on those paths and the sums of labels on those paths are equal to k. 6. Implementation Now we consider the problem of implementation. The key point in implementation is to prepare necessary information for the opposite path when we are traversing the current path through last children. We use array indices rather than subscripts for convenience. We identify a node by its label whenever convenient. We maintain the parity at level i by array element d[i]. If d[i]>0, the parity is even and a[i] is increasing, and vice versa. We keep the solution point in array “solve”. When we move from a node to the next node at level i, we perform changes (see lines 9 and 10 in the algorithm) by a[i] := a[i] + d[i] and a[j] := a[j] - d[i], where j = solve[i]. The difficulties are how to find the solution point j and where to go after these changes. If the current node after these changes has a single child, this current node is a last child and we have to go up to the return ancestor, guided by array “up”. Otherwise we go down to the node on the opposite path that has a single child, that is, the landing point, guided by array “down”. The computational process is modelled by moving k pebbles, one each time, in n boxes whose i-th box has the capacity of mi. At the beginning we fill the boxes to their capacities from right to left. Let i0 be the right-most non-filled box position. Then we start from i0 and use the first solution point which is set to n initially, changing a to a’ and go down to down[i0] which is set to n-1 initially. The computation of solution point is based on the array “sum” defined by sum[i] = a[1] + ... + a[i-1], and array “b” defined by b[i] = m[i] + ... + m[n]. When we stand at a node at level i, we see that the sibling nodes can take the values between “lower” and “upper” where lower = max{k - b[i+1] - sum[i], 0} and upper = min{k - sum[i], m[i]}. When d[i]>0 and a[i]=upper, or d[i]<0 and a[i]=lower, we can say we reached a last child at level i. Then we have to prepare the solution point for up[i] which is the level where the return ancestor is. This computation depends on the values of “lower” and “upper” at the next stage on and beyond the opposite path. We name these lower and upper values “lower1” and “upper1” one of which becomes the value of “next” depending on the parity. That is, lower1 = max{k - b[i+1] - sum[i] - d[up[i]], 0} and upper1 = min{k - sum[i] - d[up[i]], m[i]} Let “next” be the next node at level i on the opposite path. If “next” is not equal to a[i], then obviously we can set solve[up[i]] to i. If next=a[i], on the other hand, we set solve[up[i]] to solve[i], the solution point of i. This is because if a[i] is an up-point, we want to recover the sequence a’i+1 8 ...a’n to be a”i+1 ...a”n, where a”1 ...a”n is the sequence immediately before a. If a[i] is not an up-point, solve[up[i]] will be overwritten later by a[i]’s descendants. See the following figure for illustration and line 18 in Algorithm 2. If a”[i+1] ≠ a[i+1], for example, solve[up[i]]=solve[i]=i+1, that is, a’[i+1] becomes equal to a”[i+1] after crossing at level up[i]. level up[i] i a”[i] a”[i+1] a”[n] a[i] a[i+1] a[n] a’[n] a’[i+1] next=a[i] Figure 3. Illustration for array “solve” If the landing point on the opposite path is i or closer to the leaf, the information for the solution point is available from the previous path as the above figure illustrates. If the landing point on the opposite path is closer to the root than the up-point of the current path is, however, the solution point of the landing point has not been set, since we set the solution point for up[i] and the points between up[i] and i are not taken care of. Fortunately, when we come down to the landing point, we can adopt the solution point of the crossing level. This is because we recover the same path to the leaf (path A) after we have the straight line from the landing point (path B). The care for solution points is kept in array “mark”. If mark[i] = false, it means the solution point for level i is not prepared. The situation is illustrated in the following figure. up-point path A landing point path B path A Figure 4. Care of “solve” at landing point Now we describe how to maintain array “down”. If the node “next” at level i has a single child and has one or more siblings, then the node “next” is the landing point on the opposite path, indicated by “next_landing = true”. We mark this level by array “up1” by setting up1[i]:=i. Suppose i increased as we went down through the current path. See line 27 in the algorithm. This value of “up1” propagates through last children. With the help of array “up1”, we classify the 9 situation into three cases. Dotted lines consist of several branches. Suppose we are standing at “a[i]” in the following figures. Case 1. If lower1=upper1 (“next” has no sibling), we set down[up1[i]]:=i. This may be overwritten by descendants. level up[i] up1[i] i a[i] next a[i] Figure 5. Care of “down” at level up1[i] When we go up from level i to up[i], the values of “down” for nodes between level i and level up[i] will need care. Fortunately only one value at level up1[i] needs care apart from level up[i]. The correctness of this part and case 3 comes from the fact that the two opposing paths across one or more straight lines are identical in labels from level up1[i]+1 towards leaves, and thus old values of “down” at those levels can be used with no changes. Case 2. If lower1 ≠ upper1 (“next” has siblings) and “next” is the landing point, we set down[up[i]]:=i. level up[i] i a[i] next Figure 6. Care of “down” at level up[i] with i Case 3. If lower1 ≠ upper1 and “next” is not a landing point, we set down[up[i]]:=down[i]. The value of down[i] was prepared using case 1 repeatedly when we traverse from A to B. 10 level up[i] i down[i] A B a[i] next Figure 7. Care of “down” at level up[i] with down[i] Now the algorithm follows with comments on a few lines. Algorithm 2. Iterative algorithm for generating multiset combinations 1. Initialize array a and sum; Initialize d[i] to 1 for i=1, ..., i0, and -1 for i=i0+1, ..., n; 2. Initialize down[i] to i-1, up[i], up1[i] to i, solve[i] to n, and mark[i] to false for i=1, ..., n; 3. i :=i0; 4. repeat 5. output(a); 6. lower := max{k-b[i+1]-sum[i], 0}; 7. upper := min{k-sum[i], m[i]}; 8. if not ((d[i]>0 and a[i]=upper) or (d[i]<0 and a[i]=lower)) then begin 9. a[i] := a[i] + d[i]; 10. a[solve[i]] := a[solve[i]] - d[i] 11. end; 12. up[i] := i; 13. if (a[i]>0 and a[i]=upper) or (d[i]<0 and a[i]=lower) then begin 14. up[i] := up[i-1]; up[i-1] := i-1; {value of up propagates downwards} 15. lower1 := max{k-b[i+1]-sum[i]-d[up[i]], 0}; 16. upper1 := min{k-sum[i]-d[up[i]], m[i]}; 17. if d[i]>0 then next := upper1 else next := lower1; 18. if a[i] <> next then solve[up[i]] := i else solve[up[i]] := solve[i]; 19. mark[up[i]]:= true; mark[i]:= true; 20. up_point := (sum[i]+a[i]=k) or (sum[i]+a[i]+b[i+1]=k) or (i=n-1); 21. if lower1 ≠ upper1 then sum[i] := sum[i]+d[up[i]]; 22. next_landing := (sum[i]+next=k) or (sum[i]+next+b[i+1]=k) or (i=n-1); 23. up1[i] := up1[i-1]; up1[i-1] := i-1; {value of up1 propagates downwards} 24. if lower1=upper1 then down[up1[i]] := i {case 1} 25. else if next_landing then down[up[i]] := i {case 2} 26. else down[up[i]] := down[i]; {case 3} 27. if next_landing then up1[i] := i; 28. d[i] := -d[i]; 29. end; 30. if up_point then begin 31. ii := i; i := up[i]; up[ii] := ii; up_point := false; {going up} 32. end else begin 11 33. if not mark[down[i]] then solve[down[i]] := solve[i]; 34. mark[i] := false; i := down[i] 35. end 36. until i=0; 37. output(a). Line 8-11. Go through the cross level from node vi to next vi in the notation of Figure 1. Line 13-35. When we hit a last child, we update data structures and decide whether to go up or go down. Most of the work is for preparing information for the opposite path. Lines 15-16. Computation of the upper bound and lower bound of the opposite side Line 18. solve[up[i]] has been set. Also we can use the same solve[i] for level i later. Line 19. Declare solution points of levels at up[i] and i are known. Line 20. If up-point is true, it means the current node has a single child, hence it is an up-point Line 21. Prepare sum[i] for the opposite path. Line 22. To check if the next node is a landing point. Line 27. If next_landing is true, we set up1[i] to i. Line 33. Prepare the solution point for level down[i] before going down. 7. In-Place Generation In this section we show how to generate multiset combinations in-place in array in O(1) time per object with O(n) space. The idea is to enhance Algorithm 2 with additional data structures. Let array “container” be the container of multiset. In Example 3, we have the initial state and next state of a and container as a=(0, 0, 2, 1, 1), container=(3, 3, 4, 5) a=(0, 1, 2, 1, 0), container=(3, 3, 4, 2) That is, component 5 is out and 2 is in. If we maintain the positions of components in a stack, we can keep track of those positions. We can say a ball come from source 5 to destination 2. We express those two values by “dest” and “source”. Also we prepare n stacks, stack[1], …, stack[n] for the above mentioned positions. We insert the following piece of code before line 9. if d[i]>0 then begin dest:=i; source:=solve end else begin dest:=solve[i]; source:=i end; j:=pop(stack[source]); /* pop up from stack[source] */ push(stack[dest], j); /* push j into stack[dest] */ container[j]:=dest; Initialization for the stacks, initially empty, is as follows: for j:=1 to k do push(stack[container[j]], j); In our example we have the following changes from left to right. container=(3, 3, 4, 5) container=(3, 3, 4, 2) dest=2, source=5 Stack[1]=empty stack[1]=empty Stack[2]=empty stack[2]=(4) Stack[3]=(1, 2) stack[3]=(1, 2) Stack[4]=(3) stack[4]=(3) Stack[5]=(4) stack[5]=empty 12 8. Concluding Remarks We developed an O(1) algorithm for generating adjacent multiset combinations. Algorithm 2 is general enough to further adapt to other combinatorial objects. Recursive algorithms, which were given in Section 2, were first developed, and then converted to iterative ones based on Algorithm 1. Recursive algorithms are easier to develop since we can control the path to the leaf at the cost of O(n) time. The most difficult part is how to avoid this O(n) time by the aid of additional data structures. We partially solved the in-place generation in O(1) time spending O(n) space. A complete solution with O(1) time and O(k) space is an open problem. Also the same components are placed in an array separately in our algorithm. It is open whether we can keep them consecutively. More formal explanation of Algorithm 2 will be a future research topic. A full Pascal programs for Algorithm 2 is attached for verification. References [1] Bitner, J.R., G. Ehrlich and E.M. Reingold, “Efficient Generation of Binary Reflected Gray Code and its Applications,” CACM 19 (1976) 517-521. [2] Ehrlich, G., “Algorithm 466: Four Combinatorial Algorithms,” CACM, Vol. 16 (1973) 690-691. [3 ] Ehrlich, G., “Loop-less Algorithms for generating permutations, combinations and Other Combinatorial Configurations,” JACM, Vol 20, (1973) 500-513. [4] Joichi, J.T., D.E. White, and S.G. Williamson, Combinatorial Gray Vvodes, SIAM Jour. Comput., 9, (1980) 130-141 [5] Klingsberg, A Gray code for compositions, Jour. Algorithms, 3 (1982) 41-44 [6] Korsh, J and S. Lipschutz, Generating Multiset Permutations in Constant Time,” Journal of Algorithms, Vol. 25 (1997) 321-335. [7] James F. Korsh, Paul LaFollette: Loopless Array Generation of Multiset Permutations. Comput. J. 47(5): 612-621 (2004) [8] Lehmer, D.H., “The Machine Tools of Combinatorics,” in Applied Combinatorial Mathematics (E.F. Beckenbach Ed.), Wiley, New York (1964) 5-31. [9] Liu, C.L., Introduction to Combinatorial Mathematics, McGraw-Hill, 1968. [10] Lucas, J., The rotation graph of binary trees is Hamiltonian, Jour. Algorithms, 8, (1987) 503-535 [11] Nijenhuis, A and H.S. Wilf, Combinatorial Mathematics, Chapter 3, Next k-Subset of an n-Set (1975) 21-34. [12] Reingold, E.M., J. Nievergelt and N. Deo, Combinatorial Algorithms, Prentice-Hall, 1977. [13] Ruskey, F. and C. D. Savage, “A Gray Code for Combinations of a Multiset,” Europ. Jour. Combiantorics, Vol. 17 (1996) 493-500. [14] Savage, C.D., A survey of combinatorial Gray codes, SIAM Review, 39, (1997) 605-629 [15] Takaoka, T, O(1) time algorithms for combinatorial generation by tree traversal, Computer Journal, Vol. 42, (1999) 400-408. [16] Takaoka, T, An O(1) time algorithm for generating multiset permutations, ISAAC 99, Madras, India, Lecture Notes in Computer Science 1741, 237-246, Springer-Verlag, 1999. [17] Walsh, T., Loop-free sequencing for bounded integer compositions of a multiset, Jour. of combinatorial Math. and Combinatorial Comp, 33, 323-345, 2000 [18] Wilf, H.S., Combinatorial Algorithms,: An Update, SIAM, Philadelphia, 1989 [19] Zerling, D., Generating binary trees by rotations, JACM, 32, (1985) 694-701 13 Appendix Pascal program for generating multiset combinations program ex(input,output); label 10; var i,i0,ii,n,k,kk,s1,count,lower,upper,lower1,upper1,next:integer; b,d,down,up,up1,m,sum,solve,mark:array[0..100] of integer; a:array[0..100] of integer; up_point,next_landing:boolean; procedure out; var i:integer; begin count:=count+1; for i:=1 to n do write(a[i]:2); writeln end; function min(x,y:integer):integer; begin if x<=y then min:=x else min:=y end; function max(x,y:integer):integer; begin if x>=y then max:=x else max:=y end; begin {main} writeln(‘input k and n); readln(k,n); kk:=k; writeln(‘input m[1], ..., m[n]’); for i:=1 to n do read(m[i]); readln; for i:=n downto 1 do if m[i]<=kk then begin a[i]:=m[i]; kk:=kk-a[i] end else begin a[i]:=kk; goto 10 end; 10: i0:=i; b[n+1]:=0; for i:=n downto 1 do b[i]:=b[i+1]+m[i]; for i:=0 to n do begin up[i]:=i; up1[i]:=i; solve[i]:=n; mark[i]:=0 end; sum[0]:=0; a[0]:=0; for i:=1 to n do sum[i]:=sum[i-1]+a[i-1]; for i:=i0+1 to n do sum[i]:=sum[i]+1; for i:=1 to i0 do d[i]:=1; for i:=i0+1 to n do d[i]:=-1; for i:=1 to n-1 do down[i]:=n-1; count:=0; i:=i0; repeat out; lower:=max(k-b[i+1]-sum[i],0); upper:=min(k-sum[i],m[i]); if not((d[i]>0) and (a[i]=upper) or (d[i]<0) and (a[i]=lower)) then begin a[i]:=a[i]+d[i]; a[solve[i]]:=a[solve[i]]-d[i]; end; up[i]:=i; if (d[i]>0) and (a[i]=upper) or (d[i]<0) and (a[i]=lower) then begin up[i]:=up[i-1]; up[i-1]:=i-1; lower1:=max(k-b[i+1]-sum[i]-d[up[i]],0); upper1:=min(k-sum[i]-d[up[i]],m[i]); if d[i]>0 then next:=upper1 else next:=lower1; if next<>a[i] then solve[up[i]]:=i else solve[up[i]]:=solve[i]; mark[up[i]]:=1; mark[i]:=1; up_point:=(sum[i]+a[i]=k) or (sum[i]+a[i]+b[i+1]=k) or (i=n-1); if lower1<>upper1 then sum[i]:=sum[i]+d[up[i]]; next_landing:=(sum[i]+next=k) or (sum[i]+next+b[i+1]=k) or (i=n-1); 14 up1[i]:=up1[i-1]; up1[i-1]:=i-1; if lower1=upper1 then down[up1[i]]:=i else if next_landing then down[up[i]]:=i else down[up[i]]:=down[i]; if next_landing then up1[i]:=i; d[i]:=-d[i]; end; if up_point then begin ii:=i; i:=up[i]; up[ii]:=ii; up_point:=false; end else begin if mark[down[i]]=0 then solve[down[i]]:=solve[i]; mark[i]:=0; i:=down[i] end until i=0; out; writeln('count= ', count:5); end.
1903.12150
1
1903
2019-03-28T17:38:45
Dynamic Streaming Spectral Sparsification in Nearly Linear Time and Space
[ "cs.DS" ]
In this paper we consider the problem of computing spectral approximations to graphs in the single pass dynamic streaming model. We provide a linear sketching based solution that given a stream of edge insertions and deletions to a $n$-node undirected graph, uses $\tilde O(n)$ space, processes each update in $\tilde O(1)$ time, and with high probability recovers a spectral sparsifier in $\tilde O(n)$ time. Prior to our work, state of the art results either used near optimal $\tilde O(n)$ space complexity, but brute-force $\Omega(n^2)$ recovery time [Kapralov et al.'14], or with subquadratic runtime, but polynomially suboptimal space complexity [Ahn et al.'14, Kapralov et al.'19]. Our main technical contribution is a novel method for `bucketing' vertices of the input graph into clusters that allows fast recovery of edges of sufficiently large effective resistance. Our algorithm first buckets vertices of the graph by performing ball-carving using (an approximation to) its effective resistance metric, and then recovers the high effective resistance edges from a sketched version of an electrical flow between vertices in a bucket, taking nearly linear time in the number of vertices overall. This process is performed at different geometric scales to recover a sample of edges with probabilities proportional to effective resistances and obtain an actual sparsifier of the input graph. This work provides both the first efficient $\ell_2$-sparse recovery algorithm for graphs and new primitives for manipulating the effective resistance embedding of a graph, both of which we hope have further applications.
cs.DS
cs
Dynamic Streaming Spectral Sparsification in Nearly Linear Time and Space Michael Kapralov Navid Nouri Aaron Sidford Jakab Tardos EPFL EPFL Stanford University EPFL March 29, 2019 Abstract In this paper we consider the problem of computing spectral approximations to graphs in the single pass dynamic streaming model. We provide a linear sketching based solution that given a stream of edge insertions and deletions to a n-node undirected graph, uses O(n) space, processes each update in O(1) time, and with high probability recovers a spectral sparsifier in O(n) time. Prior to our work, state of the art results either used near optimal O(n) space complexity, but brute-force Ω(n2) recovery time [Kapralov et al.'14], or with subquadratic runtime, but polynomially suboptimal space complexity [Ahn et al.'14, Kapralov et al.'19]. Our main technical contribution is a novel method for 'bucketing' vertices of the input graph into clusters that allows fast recovery of edges of sufficiently large effective resistance. Our algorithm first buckets vertices of the graph by performing ball-carving using (an approximation to) its effective resistance metric, and then recovers the high effective resistance edges from a sketched version of an electrical flow between vertices in a bucket, taking nearly linear time in the number of vertices overall. This process is performed at different geometric scales to recover a sample of edges with probabilities proportional to effective resistances and obtain an actual sparsifier of the input graph. This work provides both the first efficient ℓ2-sparse recovery algorithm for graphs and new primitives for manipulating the effective resistance embedding of a graph, both of which we hope have further applications. 9 1 0 2 r a M 8 2 ] S D . s c [ 1 v 0 5 1 2 1 . 3 0 9 1 : v i X r a 1 1 Introduction Graph sketching, i.e. constructing small space summaries for graphs using linear measurements, has received much attention since the work of Ahn, Guha and McGregor [AGM12a] gave a linear sketching primitive for graph connectivity with optimal O(n log3 n) space complexity [NY19]. A key application of linear sketching has been to design small space algorithms for processing dynamic graph streams, where edges can be both inserted and deleted, although the graph sketching paradigm has been shown very powerful in many other areas such as distributed algorithms and dynamic algorithms (we refer the reader to the survey [McG17] for more on applications of graph sketching). Furthermore, it is known that linear sketching is essentially a universal approach to designing dynamic streaming algorithms [LNW14], and yields distributed protocols for graph processing with low communication. Sketching solutions have been recently constructed for many graph problems, including spanning forest computation [AGM12a], cut and spectral sparsifiers [AGM12b, KLM+14], spanner construction [AGM12b, KW14], matching and matching size approximation [AKLY16, AKL17], sketching the Laplacian [ACK+16, JS18b] and many other problems. The focus of our work is on oblivious sketches for approximating spectral structure of graphs with optimally fast recovery. A sketch is called oblivious if its distribution is independent of the input -- such sketches yield efficient single pass dynamic streaming algorithms for sparsification. We now outline the main ideas involved in previous works on this and related problems, and highlight the main challenges in designing a solution that achieves both linear space and time. Oblivious linear sketches with nearly optimal n logO(1) n have been obtained for the related problems of constructing a spanning forest of the input graph [AGM12a], the problem of constructing cut sparsifiers of graphs [AGM12c] and for the spectral sparsification problem itself [KLM+14]. In the former two cases the core of the problem is to design a sketch that allows recovery of edges that cross small cuts in the input graph, and the problem is resolved by applying ℓ0-sampling(see, e.g., [JST11, CF14, KNP+17]), and more generally exact (i.e., ℓ0) sparse recovery techniques on the edge incidence matrix B ∈ R(n 2)×n of the input graph: one designs a sketching matrix S ∈ RlogO(1) n×(n 2) and maintains S·B ∈ RlogO(1) n×n throughout the stream. A natural recovery primitive that follows Boruvka's algorithm for the MST problem then yields a nearly linear time recovery scheme. Specifically, to recover a spanning tree one repeatedly samples outgoing edges out of every vertex of the graph and contracts resulting connected components into supernodes, halving the number of connected components in every round. Surprisingly, a sketch of the original graph suffices for sampling edges that go across connected components in graphs that arise through the contraction process, yielding a spanning forest in O(log n) rounds and using n logO(1) n bits of space. The situation with spectral sparsifiers is very different: edges critical to obtaining a spectral approx- imation do not necessarily cross small cuts in the graph. Instead, 'important edges' are those that have large effective resistance, i.e can be made 'heavy' in the ℓ2 sense in an appropriate linear com- bination of the columns of the edge incidence matrix B. This observation was used in [KLM+14] to design a sketch with nearly optimal n logO(1) n space complexity, but the recovery of the sparsifier was brute-force and ran in Ω(n2) time: one had to iterate over all potential edges and test whether they are in the graph and have 'high' effective resistance. Approaches based on relating effective resistances to inverse connectivity have been proposed [AGM13], but these result in suboptimal Ω(n5/3) space complexity. In a very recent work [KMM+19] a subset of the authors proposed an algorithm with n1.4+o(1) space and runtime complexity, but no approach that yields optimal space and runtime was known previously. 2 A key reason why previously known sketching techniques for reconstructing spectral approximations to graphs failed to achieve nearly linear runtime is exactly the lack of simple 'local' (akin to Boruvka's algorithm) technique for recovering heavy edges. The main contribution of this paper is such a technique: we propose a bucketing technique based on ball carving in (an approximation to) the effective resistance metric that recovers appropriately heavy effective resistance edges by routing flows between source-sink pairs that belong to the same bucket. This ensures that the recovery process is more 'localized', and results in a nearly linear time algorithm. Our result. Formally, we consider the problem of constructing spectral sparsifiers [ST11a, SS11] of graphs presented as a dynamic stream of edges: given a graph G = (V, E) presented as a dynamic stream of edge insertions and deletions and a precision parameter ǫ ∈ (0, 1), our algorithm outputs a graph G′ such that (1 − ǫ)L (cid:22) L′ (cid:22) (1 + ǫ)L, where L is the Laplacian of G, L′ is the Laplacian of G′ and ≺ stands for the positive semidefinite ordering of matrices. Our main result is a linear sketching algorithm that compresses a graph with n vertices to a n logO(1) n-bit representation that allows logO(1) n-time updates, and from which a spectral approx- imation can be recovered in n logO(1) n time. Thus, our result achieve both optimal space and time complexity simultaneously. Theorem 1 (Near Optimal Streaming Spectral Sparsification). There exists an algorithm such that for any ǫ ∈ (0, 1), processes a list of edge insertions and deletions for an unweighted graph G in a single pass and maintains a set of linear sketches of this input in O(ǫ−2n logO(1) n) space. From these sketches, it recovers in O(ǫ−2n logO(1) n) time, with high probability, a weighted subgraph H with O(ǫ−2n log n) edges, such that H is a (1 ± ǫ)-spectral sparsifier of G. Our result in Theorem 1 can be thought of as the first efficient 'ℓ2-graph sketching' result, using an analogy to compressed sensing recovery guarantees. It is interesting to note that compressed sensing primitives that allow recovery in time nearly linear in sketch size (which is exactly what our algorithm achieves for the sparsification problem) usually operate by hashing the input vector into buckets so as to isolate dominant entries, which can then be recovered efficiently. The main contribution of our work is giving a 'bucketing scheme' for graphs that allows for nearly linear time recovery. As we show, the right 'bucketing scheme' for the spectral sparsification problem is a space partitioning scheme in the effective resistance metric. Effective resistance, spectral sparsification, and random spanning trees. The effective resistance metric or effective resistance distances induced by an undirected graph plays a central role in spectral graph theory and has been at the heart of numerous algorithmic breakthroughs over the past decade. They are central to the to obtaining fast algorithms for constructing spectral sparsifiers [SS11, KLP16a], spectral vertex sparsifiers [KLP+16b], sparsifiers of the random walk Laplacian [CCL+15, JKPS17], and subspace sparsifiers [LS18]. They have played a key role in many advances in solving Laplacian systems [ST04, KMP10, KMP11, PS14, CKM+14, KLP16a, KLP+16b, KS16] and are critical to the current fastest (weakly)-polynomial time algorithms for maximum flow and minimum cost flow in certain parameter regimes [LS14]. Given their utility, the computation of effective resistances has itself become an area of active research [JS18b, CGP+18]. 3 In a line of work particularly relevant to this paper, the effective resistance metric has played an important role in obtaining faster algorithms for generating random spanning trees [KM09, MST15, Sch18]. The result of [MST15] partitions the graph into clusters with bounded diameter in the effective resistance metric in order to speed up simulation of a random walk, whereas [Sch18] proposed a more advanced version of this approach to achieve a nearly linear time simulation. While these results seem superficially related to ours, there does not seem to be any way of using spanning tree generation techniques for our purpose. The main reason is that the objective in spanning tree generation results is quite different from ours: there one would like to find a partition of the graph that in a sense minimizes the number times a random walk crosses cluster boundaries, which does not correspond to a way of recovering 'heavy' effective resistance edges in the graph. In particular, while in spanning tree generation algorithms the important parameter is the number of edges crossing the cuts generated by the partitioning, whereas it is easily seen that heavy effective resistance edges cannot be recovered from small cuts. Finally, the problem of partitioning graphs into low effective resistance diameter clusters has been studied recently in [AALG17]. The focus of the latter work is on partitioning into induced expanders, and the results of [AALG17] were an important tool in the work of [KMM+19] that achieved the previous best n1.4+o(1) space and runtime complexity for our problem. Our techniques in this paper take a different route and achieve optimal results. Prior work. Streaming algorithms are well-studied with too many results to list and we refer the reader to [McG14, McG17] for a survey of streaming algorithms. The idea of linear graph sketching was introduced in a seminal paper of Ahn, Guha, and McGregror [AGM12a], where a O(log n)-pass sparsification algorithm for dynamic streams was presented (this result is for the weaker notion of cut sparsification due to [Kar94, BK96]). A single-pass algorithm for cut sparsification with of [AGM12a] to hypergraphs were presented in [GMT15]. The more challenging problem of com- puting a spectral sparsifier from a linear sketch was addressed in [AGM13], who gives an O(ǫ−2n5/3) space solution. An O(ǫ−2n) space solution was obtained in [KLM+17] by more explicitly exploiting nearly optimal eO(ǫ−2n) space was given in [AGM12c], and extensions of the sketching approach the connection between graph sketching and vector sparse recovery, at the expense of eO(ǫ−2n2) runtime. In a recent work [KMM+19] a subset of the authors gave a single pass algorithm with ǫ−2n1.4+o(1) space and runtime complexity. We also mention that spectral sparsifiers have been studied in the insertion-only streaming model, where edges can only be added to G [KL13, CMP16, KPPS17], and in a dynamic data structure model [ADK+16, ACK+16, JS18a], where more space is allowed, but the algorithm must quickly output a sparsifier at every step of the stream. While these models are superficially similar to the dynamic streaming model, they seem to allow for different techniques, and in particular do not require linear sketching since they do not constrain the space used by the algorithm. The spectral sparsification problem on its own has received a lot of attention in the literature (e.g., [SS11, ST11b, BSS09, ALO15, LS15, LS17]. We refer the reader to the survey [BSST13] for a more complete set of references. 2 Preliminaries General Notation. Let G = (V, E) be an unweighted undirected graph with n vertices and m edges. For any vertex v ∈ V , let χv ∈ Rn be the indicator vector of v, with a one at position v 4 2)×n denote the vertex edge incidence matrix of G = (V, E). B 2)×n denote the vertex edge incidence matrix of an unweighted and zeros elsewhere. Let Bn ∈ R(n and undirected complete graph, where for any edge e = (u, v) ∈(cid:0)V be := buv := χu − χv. Let B ∈ R(n is obtained by zeroing out any rows of Bn corresponding to (u, v) /∈ E.1 2)×(n (n 2) For weighted graph G = (V, E, w), where w : E → R+ denotes the edge weights, let W ∈ R+ be the diagonal matrix of weights where W (e, e) = w(e) for e ∈ E and W (e, e) = 0 otherwise. Note that L = B⊤W B = BT n W Bn, is the Laplacian matrix of G. Let L+ denote the Moore-Penrose pseudoinverse of L. Also, for a real valued variable s, we define s+ := max{0, s}. We also use the following folklore: 2(cid:1), u 6= v, its e'th row is equal to Fact 1. For any Laplacian matrix L of an unweighted and undirected graph, its minimum nonzero eigenvalue is bounded from below by λℓ = 1 8n2 and its maximum eigenvalue is bounded from above by λu = 2n. Definition 1. For any unweighted graph G = (V, E) and any γ ≥ 0, we define LGγ , as follows: LGγ = LG + γI. This can be seen in the following way. One can think of Gγ as graph G plus some regularization term. In order to distinguish between edges of G and regularization term in Gγ, we let BGγ = B ⊕√γI, where B ⊕√γI is the operation of appending rows of √γI to matrix B. One should note that B⊤Gγ BGγ = LGγ . Also for simplicity we define Lℓ for any integer ℓ ∈ [0, d + 1] as follows: Lℓ =(LG + λu LG 2ℓ I if 0 ≤ ℓ ≤ d if ℓ = d + 1. where d and λu are defined as in Lemma 3. We often denote the matrix LGγ = LG + γI by K, and in particular use the notation L and K interchangeably. Effective Resistance. Given a weighted graph G = (V, E, w) we associate it with an electric circuit where the vertices are junctions and each edge e is a resistor of resistance 1/w(e). Now suppose in this circuit we inject one unit current at vertex u, extract one from vertex v, and let fuv ∈ Rm denote the the currents induced on the edges. By Kirchhoff's current law, except for the source u and the sink v, the sum of the currents entering and exiting any vertex is zero. Hence, we have buv = B⊤fuv. Let ϕ ∈ Rn denote the voltage potentials induced at the vertices in the above setting. By Ohm's law we have f = W Bϕ. Putting these facts together: χu − χv = B⊤W Bϕ = Lϕ. Observe that (χu − χv) ⊥ ker(L), and hence ϕ = L+(χu − χv). The effective resistance between vertices u and v in graph G, denoted by Ruv is defined as the voltage difference between vertices u and v, when a unit of current is injected into u and is extracted from v. Thus we have: Ruv = b⊤uvL+buv. (1) 1Note this is different then the possibly more standard definition of B as the E × V matrix with the rows not in the graph removed altogether. 5 We also let Ruu := 0 for any u ∈ V , for convenience. For any matrix K ∈ Rn×n, we let RK b⊤uvK +buv. uv := Also, for any pair of vertices (w1, w2), the potential difference induced on this pair when sending a unit of flow from u to v can be calculated as: Furthermore, if the graph is unweighted, the flow on edge (w1, w2) is ϕ(w1) − ϕ(w2) = b⊤w1w2L+buv. fuv(w1w2) = b⊤w1w2L+buv. We frequently use the following simple fact. (2) (3) Fact 2 (See e.g. matrix L ∈ RV , let K = L + γI. Then, for any pair of vertices (u, v), (u′, v′) ∈ V × V , [KLM+17], Lemma 3). For any graph G = (V, E, w), γ ≥ 0 and any Laplacian b⊤u′v′ K +buv ≤ b⊤uvK +buv. Proof. Let ϕ = K +buv. Suppose that for some x ∈ V \{u}, ϕ(x) > ϕ(u). Then, since K = L+γI is a full rank and diagonally dominant matrix, then one can easily see that we should have buv(x) > 0, which is a contradiction. So, ϕ(u) ≥ ϕ(x) for any x ∈ V \{u} . In a similar way, we can argue that ϕ(v) ≤ ϕ(y) for any y ∈ V \ {v}. So, the claim holds. Spectral Approximation. For matrices C, D ∈ Rp×p, we write C (cid:22) D, if ∀x ∈ Rp, x⊤Cx ≤ x⊤Dx. We say that eC is (1 ± ǫ)-spectral sparsifier of C, and we write it as eC ≈ǫ C, if (1 − ǫ)C (cid:22) eC (cid:22) (1 + ǫ)C. Graph eG is (1 ± ǫ) -- spectral sparsifier of graph G if, L eG ≈ǫ LG. We also sometimes use a slightly weaker notation (1 − ǫ)C (cid:22)r eC (cid:22)r (1 + ǫ)C, to indicate that (1 − ǫ)x⊤Cx ≤ x⊤eCx ≤ (1 + ǫ)x⊤Cx, for any x in the row span of C. 3 Main result We start by giving some intuition and presenting the high level idea of our algorithm in Section 3.1 below. In Section 3.2 we formally state the algorithm and provide correctness analysis. In Sec- tion 3.3 we describe how the required sketches can be implemented using the efficient pseudorandom number generator from [KMM+19]. Finally in Section 3.4 we give the proof of Theorem 1. 3.1 Overview of the approach To illustrate our approach, suppose for now that our goal is to find edges with effective resistance 1 at least log n in a graph G = (V, E), which we denote by "heavy edges". This task has been studied in prior work on spectral sparsification [KLM+17] and was essentially shown in [KMM+19] to be sufficient to yield a spectral sparsification with only almost constant overhead. Each of [KLM+17] and [KMM+19] solve this problem by running ℓ2-heavy hitters on approximate flow vectors, ob- tained by coarse sparsifier of the graph. The number of test flow vectors used in [KLM+17] is quadratic in the number of vertices, i.e., they brute force on all pair of vertices to find the heavy edges, and this was improved to n1.4+o(1) in [KMM+19]. Consequently, a natural question that one could attack to further improve the running times of these methods is the following: 6 (a) Graph of Example 1 (b) Graph of Example 2 Figure 1: (a) Graph of Example 1. A star with n petals along with one additional edge. (b) Graph of Example 2. A star graph with Θ(n0.7) petals, along with one additional edge. Each zigzag represents a path of connected cliques with effective resistance diameter O(1). Can we efficiently find a nearly linear number of test vectors that enable us to recover all heavy edges? In this work, we answer this question in the affirmative and formally show that there exist a linear number of test vectors, which suffice to find all heavy edges. This is essentially the key technical contribution of this paper and generalizing this solution yields our main algorithmic results. To illustrate our approach, suppose that one can compute the flow vector using the following formula 2 BL+buv = fuv (4) for any pair of vertices in polylogarithmic time (in our actual algorithms we will be unable to compute these flow vectors exactly). Note that and fuv2 2 = b⊤uvL+B⊤BL+buv = b⊤uvL+buv = Ruv fuv(uv) = b⊤uvL+buv = Ruv. (5) (6) This implies that, when Ruv > 1 log n , the contribution of uv coordinate of this vector to the ℓ2 norm is substantial, and known ℓ2-heavy hitters can recover this edge using corresponding sketches, polylog n ) contribution efficiently. One should note that ℓ2-heavy hitter returns a set of edges with Ω( to the ℓ2 2 of the flow vector. A natural question that arises is whether it is possible to recover a heavy edge without using its flow vector, but rather using other flow vectors. Consider the following example. 1 Example 1 (Star Graph Plus Edge). Suppose that graph G = (V, E) is a "star" with a center and n petals along with one additional edge that connects a pair of petals, i.e., V = {v1, v2, . . . , vn} and E = {(v1, v2), (v1, v3),·, (v1, vn)} ∪ {(v2, v3)} (see Figure 1a). 2Note that in the actual algorithm we use K + as opposed to L+, since we work with regularized versions of the Laplacian of G, denoted by K. We use L in this overview of our techniques to simplify notation. 7 Clearly, for edge (v2, v3), Rv2v3 = 2 3 . Suppose that we want to recover this edge by examining an electrical flow vector other than fv2v3. We can in fact pick an arbitrary vertex x ∈ V \ v2 and send one unit of flow to v2. Regardless of the choice of x, edge (v2, v3) contributes an Ω(1) fraction of the energy of the flow, and thus can be recovered by applying heavy hitters to fxv2. Similarly, for any vi, when one unit of flow is sent from x to vi, at least a constant fraction of the energy is contributed by edge (x, vi). So, all high effective resistance edges in this graph (all edges) can be recovered using n − 1 simple flow vectors, i.e., {fxv1 , . . . , fxvn}. Of course, the graph in Example 1 has only n edges, and so could be stored explicitly in the streaming setting, without needing to recover edges from heavy hitter queries. However, we can give a similar example which is in fact dense. Example 2 (Thick Star Plus Edge). Suppose that graph G is a dense version of the previous example as follows: it has a center and Θ(n0.7) petals. Each petal consists of a chain of Θ(n0.2) cliques of size n0.1, where each pair of consecutive cliques is connected with a complete bipartite graph. One can verify that the effective resistance diameter of each petal is Θ(1). Now, we add an additional edge, e, that connects an arbitrary node in the leaf of one petal to a node in the leaf of another petal (see Figure 1b). As in Example 1, e is heavy, with Re = Θ(1). In fact, it is the only heavy edge in the graph. One can verify that, similar to Example 1, if we let C2 and C3 denote the cliques that e connects, choosing an arbitrary vertex x and sending flow to any node in C2 and then to any node in C3, will give an electrical flow vector where e contributes an Ω(1) fraction of the energy. Thus, e can be recovered by applying heavy hitters to these vectors. Consequently, using n test vectors (sending flow from x to each other node in the graph) one can recover all heavy edges of this example. Unfortunately, it is possible to give an example where the above simple procedure of checking the flow from an arbitrary vertex to all others fails. Example 3 (Thick Line Plus Edge). Suppose that graph G = (V, E) is a thick line, consisting of n0.9 set of points (clusters) where any two consecutive clusters form a complete bipartite graph. Formally, V = {v1, v2, . . . , vn} = C1 ∪ C2 ∪ ··· ∪ Cn0.9, where Ci's are disjoint sets of size n0.1 and E = n0.9−1[i=1 Ci × Ci+1. Also, add an edge e = (u, v) such that u ∈ C1 and v ∈ Cn0.2 (see Figure 2). One can verify that Re = Ω(1). However, if one picks an arbitrary vertex x ∈ V and sends one unit of flow each other vertex, running ℓ2-heavy hitters on each of these flows will not recover edge e if x is far from u and v in the thick path. Any flow that must cross (u, v) will have very large energy due to the fact that it must travel a long distance to the clusters containing these vertices, so e will not contribute non-trivial fraction. Fortunately, the failure of our recovery method in Example 3 is due to a simple fact: the effective resistance diameter of the graph is large. When the effective resistance diameter is small (as in Examples 1 and 2) the strategy always suffices. This follows from the following simple observation: Observation 1. For a graph G = (V, E), suppose that for an edge e = (u, v) ∈ E, one has Re ≥ β. 8 C1 C2 C3 C4 Cn0.2 Cn0.9 Figure 2: Graph of Example 3. Each Ci represents a cluster with n0.1 vertices (with no internal edges) and each zigzag represents the edges of a complete bipartite graph between consecutive Ci's. Then, for any x ∈ V , in at least one of these settings, edge e carries at least β/2 units of flow: 1. One unit of flow is sent from x to u. 2. One unit of flow is sent from x to v. This observation follows formally from the following simple lemma. Lemma 1. For a graph G = (V, E), suppose that D ∈ RV ×V is a PSD matrix. Then, for any pair of vertices (u, v) ∈(cid:0)V 2(cid:1) and for any vertex x ∈ V \ {u, v}, max{b⊤xuDbuv,b⊤xvDbuv} ≥ b⊤uvDbuv 2 . Proof. Note that b⊤uvDbuv =(cid:16)b⊤ux + b⊤xv(cid:17) Dbuv = b⊤uxDbuv + b⊤xvDbuv, and hence, the claim holds. 1 4 log2 n Consider the setting where β = 1 log n . The observation guarantees that edge e contributes at least energy to either flow fxv or fxu. Thus, we can recover this edge via ℓ2 heavy hitters, as long as the total energy kfxvk2 2 is not too large. Note that this energy is just equal to the effective resistance Rxv between x and v (respectively x and u). Thus it is bounded if the effective resistance diameter is small, demonstrating that our simple recovery procedure always succeeds in this setting. For example, if the diameter is O(1), both kfxvk2 2 = O(1), and so by Observation 1, edge e = (u, v) contributes at least a Θ(cid:16) 1 2 = O(1) and kfxuk2 log2 n(cid:17) fraction of the energy of at least 2 or kfxuk2 one these flows. We next explain how to extend this procedure to handle general graphs, like that of Example 3. Ball carving in effective resistance metric: When the effective resistance diameter of G is large, if we attempt to recover e using ℓ2-heavy hitters on the flow vectors fxu and fxv, for an arbitrary chosen x ∈ V , we may fail if the effective resistance distance between x and v or u (kfxvk2 or kfxuk2 However, using the fact that fxv2 2 = Rxv, our test will succeed if we find a vertex x, which is close to u and v in the effective resistance metric. This suggests that we should partition the vertices 2) is large. This is exactly what we saw in Example 3. 2 9 into cells of fairly small effective resistance diameter, ensuring that both endpoints of an edge (u, v) that we would like to recover fall in the same cell with nontrivially large probability. This is exactly what standard metric decomposition techniques achieve through a ball-carving approach, which we use, as described next. Partitioning the graph into low effective resistance diameter sets: It is well-known that using Johnson-Lindenstrauss (JL) dimension reduction (see Lemma 5), one can embed vertices of a graph in Rq, for q = O(log n), such that the Euclidean distance squares correspond to a constant factor multiplicative approximation to effective resistance of corresponding vertices. We then partition Rq intro ℓ∞ balls centered at points of a randomly shifted infinite q-dimensional grid with side length w > 0, essentially defining a hash function that maps every point in Rq to the nearest point on the randomly shifted grid. We then bound the maximum effective resistance of pair of vertices in the same bucket (see Claim 2), and show how an appropriate choice of the width w ensures that u and v belong to the same cell, with a probability no less than a universal constant (see Claim 1). This ensures that in at least one of O(log n) independent repetitions of this process with high probability, u and v fall into the same cell. We note that the parameters of our partitioning scheme can be improved somewhat using Locality Sensitive Hashing techniques (e.g., [IM98, DIIM04, AI06, AINR14, AR15]). More precisely, LSH techniques would improve the space complexity by polylogarithmic factors at the expense of slightly higher runtime (the best improvement in space complexity would result from Euclidean LSH [AI06, AR15], at the cost of an no(1) additional factor in runtime). However, since the resulting space complexity does not quite match the lower bound of Ω(n log3 n) due to [NY19], we leave the problem of fine-tuning the parameters of the space partitioning scheme as an exciting direction for further work. Sampling edges with probability proportional to effective resistances: The above tech- niques can actually be extended to recover edges of any specific target effective resistance. Broadly speaking, if we aim to capture edges of effective resistance about R, we can afford to lower our grid cell size proportionally to R. Unfortunately, these edges don't contribute enough to the flow vector to be recoverable. Thus, we will also subsample the edges of the graph at rate approximately proportional to R to allow us to detect the target edges while also subsampling them. 3.2 Our algorithm and proof of main result As mentioned in the introduction, our algorithm consists of two phases. In the first phase, our algorithm maintains sketches of the stream, updating the sketches at each edge addition or deletion. Then, in the second phase, when queried, it can recover a spectral sparsifier of the graph from the sketches that have been maintained in the first phase. In the following lines, we give a brief overview of each phase: Updating sketches in the dynamic stream. Our algorithm maintains a set of sketches ΠB, of size O(n polylog(n)· ǫ−2), and updates them each time it receives an edge addition or deletion in the stream. ΠB consists of multiple sketches (Πℓ s is a subsampling of the edges in B at rate 2−s and Πℓ s is an ℓ2 heavy hitters sketch. In section 3.3 we discuss these sketches in more detail and we show that the update time for each edge addition or deletion is O(polylog(n) · ǫ−2). s)ℓ,s where Bℓ sBℓ 10 Recursive sparsification: After receiving the updates in the form of a dynamic stream, as described above, our algorithm uses the maintained sketches to recover a spectral sparsifier of the graph. This is done recursively, and heavily relies on the idea of a chain of coarse sparsifiers described in Lemma 3. For a regularization parameter ℓ between 0 and d = O(log n) the task of Sparsify(Π≤ℓB, ℓ, ǫ) is to output a spectral sparsifier to matrix Lℓ, which is defined as follows: Lℓ =(LG + λu LG 2ℓ I if 0 ≤ ℓ ≤ d if ℓ = d + 1. λu λℓ ⌉ (see Lemma 3 for more details about chain of coarse sparsifiers). Note that the where d = ⌈log2 call receives a collection of sketches Π≤ℓB as input that suffices for all recursive calls with smaller values of ℓ. So, in order to get a sparsifier of the graph we invoke Sparsify(Π≤d+1B, d + 1, ǫ), which receives all the sketches maintained throughout the stream and passes the required sketches to the recursive calls in line 6 of Algorithm 1. This recursive algorithm takes as input Π≤ℓB corresponding to the parts of the sketch used to recover a spectral approximation to Lk for all k ≤ ℓ, ℓ corresponding to the current Lℓ which we wish to recover a sparsifier of, and ǫ corresponding to the desired sparsification accuracy. The algorithm first invokes itself recursively to recover K, a spectral approximation for Lℓ−1 (or uses the trivial approximation λuI when ℓ = 0). The effective resistance metric induced by K is then approximated using the Johnson-Lindenstrauss lemma (JL). Finally, the procedure RecoverEdges (i.e. Algorithm 2) uses this metric and the heavy hitters sketches (Πℓ s)s. We formally state our algorithm, Algorithm 2 below. sBℓ Algorithm 1 Sparsify(Π≤ℓB, ℓ, ǫ) 1: procedure Sparsify(Π≤ℓB, ℓ, ǫ) 2: else ⊲ q above is chosen as it suffices to get a (1 ± 1 2(1+ǫ) Sparsify(Π≤ℓ−1B, ℓ − 1, ǫ) 2(cid:1) is a random ±1 matrix for q ← 1000 log n uv ≤ 5 eK is the effective resistance metric in eK W ← 0n×n if ℓ = 0 then eK ← λuI eK ← 1 eB ← the edge vertex incident matrix of eK (discarding the regularization) fW ← the diagonal matrix of weights over the edges of eK (discarding the regularization) Q ← q ×(cid:0)n M ← 1√q QfW 1/2eBeK + 4M (χu − χv)2 for s ∈ [− log(cid:0)3 · c2 · log n · ǫ−2(cid:1) , 10 log n] do Es ← RecoverEdges(Πℓ for e ∈ Es do W (e, e) ← 2−(s+) λℓm + 1 then if ℓ =llog2 γ ← 0 γ ← λu 5 ) approximation from JL eK uv w.h.p. s+, M, eK +, s, q, ǫ) ⊲ We use the notation s+ = max(0, s) ⊲ M is such that R eK 2 ≤ 3 2 R s+Bℓ λu else 2ℓ return B⊤n W Bn + γI. 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: ⊲ R 11 ǫ2 log n · 2−s)) from an appropriate sketch. Algorithm 2 (the RecoverEdges primitive) is the core of Algorithm 1. It receives a parameter s as input, and its task is to recover edge of effective resistance ≈ ǫ2 log n 2−s from a sample at rate min(1, O( 1 It is convenient to let s range from −O(log(log n/ǫ2)) to O(log n), so that the smallest value of s corresponds to edges of constant effective resistance. That way the sampling level corresponding to s is simply equal to s+ := max(0, s). Therefore Algorithm 2 takes as input a heavy hitters sketch Πℓ s+, the edge incidence matrix of Lℓ sampled at rate 2−s+ , an approximate effective resistance embedding M , the target sampling probability 2−s, the dimension q of the embedding, and the target accuracy ǫ. This procedure then performs the previously described random grid hashing of the points using the effective resistance embedding and queries the heavy hitters sketch to find the edges sampled at the appropriate rate. s+ of Bℓ s+Bℓ The development and analysis of RecoverEdges (Algorithm 2) is the main technical contribution of our paper. In the rest of the section we prove correctness of Algorithm 2 (Lemma 2, our main technical lemma), and then provide a correctness proof for Algorithm 1, establishing Theorem 2. We then put these results together with runtime and space complexity bounds to obtain a proof of Theorem 1. ⊲ q is the dimension to perform hashing in, s is the sampling level Algorithm 2 RecoverEdges(Πℓ s+Bℓ s+Bℓ s+, M, eK +, s, q, ǫ) s+, M, eK +, s, q, ǫ) 1: procedure RecoverEdges(Πℓ 2: E′ ← ∅. C ← the constant in the proof of Lemma 2 c2 ← the oversampling constant of Theorem 4 w ← 2q ·q ǫ2 c2·2s·log n . for j ∈ [10 log n] do For each dimension i ∈ [q], choose si ∼ Unif([0, w]). Initialize H ← ∅ to an empty hash table for u ∈ V do For all i ∈ [q], let G(u)i :=j (M χu)i−si Insert u into H with key G(u) ∈ Zq k. w for b ∈ keys(H) do x ←arbitrary vertex in H−1(b) for v ∈ H−1(b) \ {x} do F ← HeavyHitter(cid:16)Πℓ s+Bℓ p′e ← 5 4 · c2 · M be2 if p′e ∈ (2−s−1, 2−s] then E′ ← E′ ∪ {e}. for e ∈ F do s+eK +bxv, 1 2 · 2 · log n/ǫ2 return E′. 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: ⊲ Hash vertices to points on randomly shifted grid ⊲ G(u) ∈ Zq indexes a point on a randomly shifted grid ⊲ b ∈ Zq indexes a point on a randomly shifted grid 1 C·q3 ·q ǫ2 log n(cid:17). ⊲ As per Lemma 4 Lemma 2 below is our main technical lemma. Specifically, Lemma 2 proves that if Algorithm 1 successfully executes all lines before line 13, then each edge is sampled and weighted properly (as required by Theorem 4), in the remaining steps. Lemma 2 (Edge Recovery). Consider an invocation of RecoverEdges(Πℓ 12 s+Bℓ s+, M, eK, s, q, ǫ) of Algorithm 2, where Πℓ s+Bℓ s+ is a sketch of the edge incidence matrix B of the input graph G as the following guarantees: described in Section 3.3, s is some integer, and ǫ ∈ (0, 1/5). Suppose further that eK and M satisfy (A) eK is such that 1 3 · Lℓ (cid:22)r eK (cid:22)r Lℓ (see lines 4 and 6 of Algorithm 1) (B) M is such that for any pair of vertices u and v, R eK is the eK uv (R eK 4M (χu − χv)2 2 ≤ 3 2 R uv ≤ 5 effective resistance metric in eK; see line 11 of Algorithm 1) Then, with high probability, for every edge e, RecoverEdges(Πℓ if and only if: s+, M, eK, s, q, ǫ) will recover e 2 · log(n)/ǫ2 ∈ (2−s−1, 2−s] where c2 is the oversampling constant of Theorem 4 4 · c2 · M be2 (see lines 18 and 19 of Algorithm 2), and s+Bℓ (1) 5 (2) edge e is sampled in Bℓ s+. The proof of Lemma 2 relies on the following two claims regarding the hashing scheme of Algo- rithm 2. First, Claim 1 shows that the endpoints of an edge of effective resistance bounded by a threshold most likely get mapped to the same grid point in the random hashing step in line 10 of Algorithm 2. Claim 1 (Hash Collision Probability). Let q be a positive integer and let the function G : Rq → Zq define a hashing with width w > 0 as follows: w (cid:23) ∀i ∈ [q], G(u)i =(cid:22) ui − si where si ∼ Unif[0, w], as per line 10 of Algorithm 2. If for a pair of points x, y ∈ Rq, x− y2 ≤ w0 and w ≥ 2w0q, then G(x) = G(y) with probability at least 1/2. Proof. First note that by union bound P(G(x) 6= G(y)) = P(∃i : G(x)i 6= G(y)i) ≤ qXi=1 P(G(x)i 6= G(y)i) . Now let us bound each term of the sum. P(G(x)i 6= G(y)i) = P(cid:18)(cid:22) xi − si w (cid:23) 6=(cid:22) yi − si w (cid:23)(cid:19) w = xi − yi ≤ x − y2 ≤ 1 2q w Combining (7) and (8), we get that P(G(x) 6= G(y)) ≤ 1/2 as claimed. 13 (7) (8) The next claim, Claim 2 bounds the effective resistance diameter of buckets in the hash table constructed in line 11 of Algorithm 2. Claim 2 (Hash Bucket Diameter). Let the function G : Rq → Zq, for some integer q, define a hashing with width w > 0 as follows: ∀i ∈ [q], G(u)i =(cid:22) ui − si w (cid:23) where si ∼ Unif[0, w], as per line 10 of Algorithm 2. For any pair of points u, v ∈ Rq, such that G(u) = G(v), one has u − v2 ≤ w · √q. Proof. Since G(u) = G(v), then (ui − vi)2 u − v2 =sXi∈q ≤pw2 · q = w · √q. since ∀i ∈ q,ui − vi ≤ w Using Claim 1 and Claim 2 we now prove Lemma 2. Proof of Lemma 2: Let p′e := 5 2 · log(n)/ǫ2. First note that both of conditions (1) and (2) are necessary. Indeed, if e is not sampled in Bs, it will never be returned by HeavyHitter in line 16, and if p′e 6∈ (2−s−1, 2−s] then e will not be added to E′ due to line 19 of Algorithm 2. It remains to show that the two conditions are sufficient to recover e with high probability. 4 · c2 · M be2 For an edge (u, v) = e ∈ E satisfying conditions (1) and (2) we prove that the size of the grid (w as defined in line 5 of Algorithm 2) is large enough to capture edge e, as described by Claim 1. Specifically, we invoke the claim with w0 = M be2. Note that we have w ≥ 2qw0 by the setting of w in line 5 and the fact that M be2 =s4 5 · p′e · ǫ2 c2 · log n ≤s ǫ2 c2 · 2s · log n , where we used the fact that p′e ≤ 2−s. Thus, we have w ≥ 2qw0 as prescribed by Claim 1, so u and v fall into the same cell with probability at least 1/2 in a single instance of hashing. Hashing is then repeated 10 log n times to guarantee that they fall into the same cell at least once with high probability, see line 6 of Algorithm 2. Consider now an instance of hashing where u and v fall into the same cell, say C (which corresponds to a hash bucket in our hash table H). Let x be chosen arbitrarily from C as per line 14 of Algorithm 2 . Our algorithm sends electrical flow from x to both u and v and by Observation 1 eK e /2. More precisely, by Lemma 1 invoked with in at least one of these flows e will have weight R D = eK + we have max{b⊤xueK +buv,b⊤xveK +buv} ≥ 14 b⊤uveK +buv 2 = R eK e /2. (9) Without loss of generality assume that this is the flow from x to v. It remains to show, that unlike in Example 3, the total energy of the xv flow does not overshadow the contribution of edge e. Intuitively this is because the effective resistence of e is proportional to 2−s · ǫ2 and therefore its ℓ2-contribution is proportional to 2−2s · ǫ4. On the other hand, the effective resistence diameter of C is proportional to 2−s · ǫ2, which bounds the energy of the xv flow before subsampling. Subsampling at rate 2−s decreases the energy by a factor of 2−s in expectation, and the energy concentrates sufficiently around its expectation with high probability. We prove everything in more detail below. It turns out that the actual ratio between contribution of e and the entire energy of the subsampled flow is polylogarithmic in n and quadratic in ǫ. Therefore, we can afford to store a heavy hitter sketch powerful enough to recover e. 2) is a vector whose nonzero entries are exactly the voltage differences across edge in G when one unit of current is Now letefxv = BeK +(χx − χv), andefxu = BeK +(χx − χu). Note that fxv ∈ R(n forced from x to v in eK. We have, writing L instead of Lℓ to simplify notation, efxv2 2 = (χx − χv)⊤eK +B⊤BeK +(χx − χv) ≤ (χx − χv)⊤eK +LeK +(χx − χv) ≤ 3 · (χx − χv)⊤eK +eKeK +(χx − χv) = 3 · (χx − χv)⊤eK +(χx − χv) = 3 · R eK xv Since B⊤B (cid:22) L Since L (cid:22) 3 · eK by assumption (A) of the lemma Moreover we have and For simplicity, let By (9) we have efxv(uv) ≥ ≥ ≥ = efxv(uv) = (χu − χv)⊤eK +(χx − χv) efxu(uv) = (χu − χv)⊤eK +(χx − χu). β := ǫ2 . c2 · log n 2 2 b⊤uveK +buv 5 12 · M be2 1 3 · 2s+1 · c2 · 1 3 · 2s+1 β 1 By assumption (B) of the lemma ε2 log n Since p′e ≥ 1 2s+1 (10) 15 Since x, v belong to the same cell, by Claim 2, M (χu − χv)2 ≤ w · √q, thus, efxv2 (w2 · q) eK xv 5 4 2 ≤ 3 · R ≤ = 15q3 · = 15q3 · ǫ2 c2 · 2s · log n β 2s Since R eK xv ≤ 15 4 M (χx − χv)2 2 by (B) By line 5 of Algorithm 2 (11) 2s . We now argue that, if the edge (u, v) is included in Bs, then it is recovered with high probability Now, letef (s) by the heavy hitter procedure HeavyHitter in line 16. We letef (s) :=ef (s) xv := BseKbxv denote an independent sample of the entries ofefxv with probability 1 xv andef :=efxv (i.e., we omit the subscript xv) to simplify notation. We will prove a lower bound on that holds with high probability. Note that ef (s)(uv)2 ef (s)2 2 eK xv. Thus, we have for a sufficiently < 1 ǫ2 large constant C > 1 ef (s)2 2 = Xe∈Bs\{(u,v)}ef (s)(e)2 +ef (s) (uv)2 For ease of notation let X :=Pe∈Bs\{(u,v)}ef (s)(e)2, and let τ := R log n(cid:12)(cid:12)(cid:12)(u, v) ∈ Bs! − 1(cid:19) ·ef (s)(uv)2(cid:12)(cid:12)(cid:12)(u, v) ∈ Bs(cid:19) ·ef(uv)2(cid:19) ·ef (uv)2 ·ef (uv)2(cid:19) , Pr ef (s)(uv)2 C 2 · q6 · ef (s)2 =Pr(cid:18)X >(cid:18) C 2 · q6 · log n ≤Pr(cid:18)ef (s)2 1 2 · C 2 · q6 · ≤Pr(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)ef (s) τ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) =Pr(cid:18)ey(s)2 τ and ey(s) := 2s+1 by (10) and τ ≤ 5q3 · β ǫ2 1 2 · C 2 · q6 · 1 2 · C 2 · q6 · 1 τ 2 · 1 τ 2 · log n log n log n 2 > 2 2 2 2 > ε2 ǫ2 ǫ2 ef (s) ǫ2 > ef where we let ey := that ef (s)(uv)2 = ef(uv)2 conditioned on (u, v) ∈ Bs in going from line 2 to line 3. Noting that ef (uv) ≥ 1 3 · β 2s by (11), we get that the last line in (13) is upper bounded to simplify notation in the last line and used the fact by τ < 1 C 2 · q6 · log n(cid:12)(cid:12)(cid:12)(u, v) ∈ Bs! ≤ Pr(cid:18)ey(s)2 2 > C′ · log n ǫ2 (cid:19) , where C′ is a constant that can be made arbitrarily large by increasing C. On the other hand, we Pr ef (s)(uv)2 ef (s)2 2 (12) (13) (14) 16 have the following 2(cid:17) = E(cid:16)ey(s)2 ≤ ≤ ≤ ≤ = 2 1 2s · ef2 τ 2 3 τ 6 R eK uv 1 2s · 1 2s · 1 2s · 1 2s · 5·c2 · 18 · c2 · log n 5 · M buv2 36 1 2s+1 · , 5 · 36 2 4 ǫ2 Sinceef (s) is obtained by sampling at rate By (11) 1 2s By (9) and Fact 2 By assumption (B) of the lemma By condition (1) of the lemma ǫ2 log n where the transition from line 2 to line 3 is justified by noting that τ ≥(cid:12)(cid:12)(cid:12)(χu − χv)⊤eK +(χx − χv)(cid:12)(cid:12)(cid:12) ≥ eyab = (χa − χb)⊤eK +(χx − χv) Pr(cid:18)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)ey(s)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) τ 2 1 2 (χu − χv)⊤eK +(χu − χv) = R eK uv 1 2 by Fact 2 and choice of x. We now upper bound the right hand side of (14). For every entry (a, b) iney, using Fact 2 one has = 1 ≤ (χx − χv)⊤eK +(χx − χv) τ Thus, every entry is in [−1, 1], and since every entry is sampled independently, so we can use standard Chernoff/Hoeffding [Hoe63] bound and we get C′ · log n > 2 (cid:19) ≤ n−10 ǫ2 as long as C′ is a sufficiently large absolute constant (which can be achieved by making the constant C sufficiently large). Hence, we get from (13) that with high probability over the sampling of entries in Bs 1 C · q3 ·s ǫ2 log n . ef (s)(uv) ef (s)2 ≥ C·q3 ·q ǫ2 1 log n , thus if ef (s)(uv) ≥ 2ηef (s)2 our sparse recovery sketch must return We set η = 1 2 · uv with high probability, by Lemma 4. Theorem 2. (Correctness of Algorithm 1) Algorithm Sparsify(Π≤ℓB, ℓ, ǫ), for ℓ = d + 1 = λℓ ⌉ + 1 (see Lemma 3), any ǫ ∈ (0, 1/5) and sketches Π≤ℓB of graph G as described in ⌈log2 Section 3.3, returns a graph H with O(n · polylog n · ǫ−2) weighted edges, with Laplacian matrix LH, such that λu with high probability. LH ≈ǫ LG, Proof. Let γ = λu/2ℓ. As the algorithm only makes recursive calls with lower values of ℓ, we proceed by induction on ℓ. 17 Inductive hypothesis: A call of Sparsify(Π≤ℓB, ℓ, ǫ) returns a graph H ℓ with O(n· polylog n· ǫ−2) weighted edges, with Laplacian matrix LH ℓ, such that LH ℓ ≈ǫ Lℓ with high probability, where Lℓ =(LG + λu LG 2ℓ I if 0 ≤ ℓ ≤ d if ℓ = d + 1. 1 Gγ(ℓ). Base case: ℓ = 0. and for all ℓ ≥ 0 the matrix eK defined at the beginning of Algorithm 1 is a 3-spectral sparsifier of In this case we set eK = λuI (see line 4 of Algorithm 1). By Lemma 3 we have i.e. eK is a factor 3 spectral approximation of Lℓ for ℓ = 0. We argue that the graph output by Inductive step: ℓ− 1 → ℓ. As per line 6 of Algorithm 1 we set eK = 1 2(1+ǫ) Sparsify(Π≤ℓ−1B, ℓ− 1, ǫ), therefore the corresponding Laplacian for this call is Lℓ−1. By the inductive hypothesis Sparsify(Π≤ℓ−1B, ℓ − 1, ǫ) returns an ǫ-sparsifier of Lℓ−1, so we have (1 − ǫ) · Lℓ−1 (cid:22)r 2(1 + ǫ)eK (cid:22)r (1 + ǫ) · Lℓ−1. Algorithm 1 satisfies LH ℓ ≈ǫ Lℓ below, together with the same argument for the inductive step. 2 · Lℓ (cid:22) eK (cid:22) Lℓ, Moreover, by Lemma 3, we have (16) (15) Putting (16) and (17) together we get which implies for ǫ ≤ 1/5 that 1 2 · Lℓ (cid:22) 1 2 · Lℓ−1 (cid:22) Lℓ. 1 − ǫ 2(1 + ǫ) · Lℓ (cid:22)r eK (cid:22)r Lℓ, 3 · Lℓ (cid:22)r eK (cid:22)r Lℓ. 1 (17) (18) (19) (20) We thus have that for all values of ℓ the matrix eK defined at the beginning of Algorithm 1 is a 3-spectral sparsifier of Gγ(ℓ), assuming the inductive hypothesis for ℓ − 1 (except for the base case case, where no inductive hypothesis is needed). Consequently, for any pair of vertices (u, v) in the same connected component in L, b⊤uvL+ ℓ buv ≤ b⊤uveK +buv ≤ 3 · b⊤uvL+ ℓ buv For the rest of the proof, we let L := Lℓ for simplicity. We now show that the rest of the al- gorithm constructs an ǫ-sparsifier for L by sampling each edge e with some probability at least uv log(n)/ǫ2} and giving it weight inverse proportional to the probability. This will indeed min{1, RL 18 give us an ǫ-sparsifier due to Theorem 4. In particular, this probability will be the following: For edges e in the appended complete graph γI the probability is 1. For an edge e in the original graph G we define the variable p′e, as in line 18 of Algorithm 2, to be 5 2 · log(n)/ǫ2, and we define pe to be min{1, p′e}. Let se be the integer such that p′e ∈ (2−se−1, 2−se]. Note that then e ]. Our probability for sampling an edge e of the original graph will be 2−s+ pe ∈ (2−s+ e , which is less than min{1, c2 · RL Consider the conditions of Lemma 2. e log(n)/ǫ2}, as required by Theorem 4. 4 · c2 · M be2 e −1, 2−s+ 1. 1 2. Note that R eK 3 · Lℓ (cid:22)r eK (cid:22)r Lℓ is satisfied as shown above. uv = fW 1/2eBeK +bu −fW 1/2eBeK +bv2 uv ≤ 5 2 so we can use the Johnson-Lindenstrauss lemma to approximate R In lines 10 and 9 we use the exact construction of Lemma 5 with q being large enough for parameters ǫ = 1/5 and β = 6. Therefore, R eK uv is satisfied with high probability, by Lemma 5. eK uv using a smaller matrix. 4M (χu − χv)2 2 ≤ 3 2 R eK , M, eK +, se, q, ǫ) will Thus by Lemma 2 if edge e is sampled in Bℓ s+ e recover e with high probability in line 14 of Algorithm 1. It will then be given the required weight (2s+ e ). Note that e will not be recovered in any other call of RecoverEdges, that is when s 6= se. Note also, that 2−s+ e · log(n)/ǫ2}, and within constant factor of it. Therefore, by Theorem 4, the resulting graph will be an ǫ-spectral sparsifier of Gγ, and it will be O(n · polylog(n)/ǫ2)-sparse (disregarding the regularization). e is indeed an upper bound on min{1, c2 · RL then RecoverEdges(Πℓ s+ e Bℓ s+ e 3.3 Maintenance of sketches Note that Algorithm 2 takes sketch ΠB as input. More precisely, Π is a concatenation of Heavy- Hitter sketch matrices composed with sampling matrices, indexed by sampling rate s and regu- s be a row-sampled version of B at rate 2−s. larization level ℓ. In particular, for all s and ℓ let Bℓ Then Πℓ s is a HeavyHitter sketch drawn from the distribution from Lemma 4 with parameter η = 1 2 · We then maintain Πℓ s(cid:1)s,ℓ are independent and identically distributed. log n . Note that the matrices (cid:0)Πℓ C·q3 ·q ǫ2 s for all s and ℓ. We define sBℓ 1 ΠℓB = Πℓ 0Bℓ 0 ⊕ . . . ⊕ Πℓ 10 log nBℓ 10 log n, sBℓ s mapping(cid:0)V where ⊕ denotes concatenation of rows. We let Π≤ℓ denote Π0 ⊕ . . . ⊕ Πℓ, and let Π denote Π≤d+1 to simplify notation. Thus, the algorithm maintains ΠB throughout the stream. We maintain ΠB by maintaining each Πℓ s individually. To this end we have for each s and ℓ an independent hash s(u, v) = 1) = 2−s. Then when an function hℓ edge insertion or deletion, ±(u, v), arrives in the stream, we update Πℓ Overall, the number of random bits needed for all the matrices in an invocation of Algorithm 2 is at most R = eO(n2), in addition to the random bits needed for the recursive calls. To generate 2(cid:1) to {0, 1} independently such that P(hℓ matrix Π we use the fast pseudo random numbers generator from Theorem 3 below: Theorem 3. [KMM+19] For any constants q, c > 0, there is an explicit pseudo-random generator (PRG) that draws on a seed of O(S polylog(S)) random bits and can simulate any randomized s · buv · hℓ s by ±Πℓ s(u, v). sBℓ 19 algorithm running in space S and using R = O(Sq) random bits. This PRG can output any pseudorandom bit in O(logO(q) S) time and the simulated algorithm fails with probability at most S−c higher than the original. Observe that the space used by Algorithm 2 is s = eO(n) in addition to the space used by the recursive calls. Since R = O(n2), we have R = O(s2). Therefore, by Theorem 3 we can generate seed of O(s · poly(log s)) random bits in O(s · poly(log s)) time that can simulate our randomized algorithm. Also, note that the random matrix Q ∈ RΘ(log n)×(n using O(log n)-wise independent hash functions. 2) for JL (line 9 of Algorithm 2) can be generated 3.4 Proof of Theorem 1 Proof of Theorem 1: Correctness of Algorithm 2 is proved in Theorem 2. It remains to prove space and runtime bounds. Run-time and space analysis. We will prove that one call of Sparsify in Algorithm 1 requires 2) for JL (line 9 of Algorithm 2) can be generated using O(log n)-wise independent hash functions, resulting eO(n) time and space, discounting the recursive call, where n is the size of the vertex set of the input graph. Consider first lines 9 and 11, and note that the random matrix Q ∈ RΘ(log n)×(n in poly(log n) time to generate an entry of Q and O(log n) space. We then multiply QfW 1/2eB by eK + which amounts to solving Θ(log n) Laplacian systems and can be done in O(n polylog n · ǫ−2) time, since eK is O(n polylog(n) · ǫ−2) sparse, using any of a variety of algorithms in the long line of improvements in solving Laplacian systems [ST04, KMP10, KMP11, KOSA13, LS13, PS14, CKM+14, KLP16a, KLP+16b, KS16]. The resulting matrix, M , is again Θ(log n × n) and can be stored in n polylog n space. We note that the aforementioned Laplacian solvers provide approximate solutions with inverse polynomial precision, which is sufficient for application of the HeavyHitter sketch. The for loops in both line 13 and line 6 iterate over only Θ(log n) values. For all non-empty cells we iterate over all vertices in that cell, so overall, we iterate n times. The HeavyHitters subroutine called with parameter η = ǫ/ polylog n returns by definition at most polylog n/ǫ2 elements, so the for loop in line 17 is over polylog n/ǫ2 iterations. In total this is O(n polylog n· ǫ−2) time and space as claimed. To get an ǫ-sparsifier of the input graph G, we need only to run Sparsify(Π≤d+1B, d + 1, ǫ). Therefore chain of recursive calls will be Θ(log(n)) long, and the total run time will still be eO(nǫ−2). References [AALG17] Vedat Levi Alev, Nima Anari, Lap Chi Lau, and Shayan Oveis Gharan. Graph clus- tering using effective resistance. arXiv preprint arXiv:1711.06530, 2017. 20 [Ach03] Dimitris Achlioptas. Database-friendly random projections: Johnson-lindenstrauss with binary coins. J. Comput. Syst. Sci., 66(4):671 -- 687, 2003. [ACK+16] Alexandr Andoni, Jiecao Chen, Robert Krauthgamer, Bo Qin, David P. Woodruff, and Qin Zhang. On sketching quadratic forms. Proceedings of the 2016 ACM Conference on Innovations in Theoretical Computer Science, Cambridge, MA, USA, January 14-16, 2016, pages 311 -- 319, 2016. [ADK+16] Ittai Abraham, David Durfee, Ioannis Koutis, Ssebastian Krinninger, and Richard Peng. On fully dynamic graph sparsifiers. In 57th Annual Symposium on Foundations of Computer Science, pages 335 -- 344, 2016. [AGM12a] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Analyzing graph structure via linear measurements. In Proceedings of the twenty-third annual ACM-SIAM symposium on Discrete Algorithms, pages 459 -- 467. SIAM, 2012. [AGM12b] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Graph sketches: sparsification, spanners, and subgraphs. In Michael Benedikt, Markus Krotzsch, and Maurizio Lenz- erini, editors, Proceedings of the 31st ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, PODS 2012, Scottsdale, AZ, USA, May 20-24, 2012, pages 5 -- 14. ACM, 2012. [AGM12c] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Graph sketches: sparsifica- tion, spanners, and subgraphs. In Proceedings of the 31st Symposium on Principles of Database Systems (PODS), pages 5 -- 14, 2012. [AGM13] Kook Jin Ahn, Sudipto Guha, and Andrew McGregor. Spectral sparsification in dy- namic graph streams. In Approximation, Randomization, and Combinatorial Optimiza- tion. Algorithms and Techniques, pages 1 -- 10. Springer, 2013. [AI06] Alexandr Andoni and Piotr Indyk. Near-optimal hashing algorithms for approximate nearest neighbor in high dimensions. In 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2006), 21-24 October 2006, Berkeley, California, USA, Proceedings, pages 459 -- 468. IEEE Computer Society, 2006. [AINR14] Alexandr Andoni, Piotr Indyk, Huy L. Nguyen, and Ilya P. Razenshteyn. Beyond locality-sensitive hashing. In Chandra Chekuri, editor, Proceedings of the Twenty- Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, pages 1018 -- 1028. SIAM, 2014. [AKL17] Sepehr Assadi, Sanjeev Khanna, and Yang Li. On estimating maximum matching size in graph streams. In Philip N. Klein, editor, Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel Porta Fira, January 16-19, pages 1723 -- 1742. SIAM, 2017. [AKLY16] Sepehr Assadi, Sanjeev Khanna, Yang Li, and Grigory Yaroslavtsev. Maximum match- ings in dynamic graph streams and the simultaneous communication model. In Robert Krauthgamer, editor, Proceedings of the Twenty-Seventh Annual ACM-SIAM Sympo- sium on Discrete Algorithms, SODA 2016, Arlington, VA, USA, January 10-12, 2016, pages 1345 -- 1364. SIAM, 2016. 21 [ALO15] Zeyuan Allen Zhu, Zhenyu Liao, and Lorenzo Orecchia. Spectral sparsification and regret minimization beyond matrix multiplicative updates. In Servedio and Rubinfeld [SR15], pages 237 -- 245. [AR15] [BK96] [BSS09] Alexandr Andoni and Ilya P. Razenshteyn. Optimal data-dependent hashing for ap- proximate near neighbors. In Servedio and Rubinfeld [SR15], pages 793 -- 801. Andr´as A. Bencz´ur and David R. Karger. Approximating S-T minimum cuts in O(n2) time. In 38th Annual Symposium on Theory of Computing, pages 47 -- 55, 1996. Joshua D. Batson, Daniel A. Spielman, and Nikhil Srivastava. Twice-ramanujan spar- sifiers. In Proceedings of the 41st Annual ACM Symposium on Theory of Computing, STOC 2009, Bethesda, MD, USA, May 31 - June 2, 2009, pages 255 -- 262, 2009. [BSST13] Joshua D. Batson, Daniel A. Spielman, Nikhil Srivastava, and Shang-Hua Teng. Spec- tral sparsification of graphs: theory and algorithms. Commun. ACM, 56(8):87 -- 94, 2013. [CCL+15] Dehua Cheng, Yu Cheng, Yan Liu, Richard Peng, and Shang-Hua Teng. Spectral sparsification of random-walk matrix polynomials. CoRR, abs/1502.03496, 2015. [CF14] Graham Cormode and Donatella Firmani. A unifying framework for ℓ0-sampling algo- rithms. Distributed and Parallel Databases, 32(3):315 -- 335, 2014. Preliminary version in ALENEX 2013. [CGP+18] Timothy Chu, Yu Gao, Richard Peng, Sushant Sachdeva, Saurabh Sawlani, and Junx- ing Wang. Graph sparsification, spectral sketches, and faster resistance computation, via short cycle decompositions. In 59th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2018, Paris, France, October 7-9, 2018, pages 361 -- 372, 2018. [CKM+14] Michael B. Cohen, Rasmus Kyng, Gary L. Miller, Jakub W. Pachocki, Richard Peng, Anup B. Rao, and Shen Chen Xu. Solving SDD linear systems in nearly mlog1/2n time. In Symposium on Theory of Computing, STOC 2014, New York, NY, USA, May 31 - June 03, 2014, pages 343 -- 352, 2014. [CMP16] Michael B Cohen, Cameron Musco, and Jakub Pachocki. Online row sampling. In Ap- proximation, Randomization, and Combinatorial Optimization. Algorithms and Tech- niques (APPROX/RANDOM 2016), 2016. [DBL13] 54th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2013, 26- 29 October, 2013, Berkeley, CA, USA. IEEE Computer Society, 2013. [DIIM04] Mayur Datar, Nicole Immorlica, Piotr Indyk, and Vahab S. Mirrokni. Locality-sensitive hashing scheme based on p-stable distributions. In Jack Snoeyink and Jean-Daniel Bois- sonnat, editors, Proceedings of the 20th ACM Symposium on Computational Geometry, Brooklyn, New York, USA, June 8-11, 2004, pages 253 -- 262. ACM, 2004. [GMT15] Sudipto Guha, Andrew McGregor, and David Tench. Vertex and hyperedge connectiv- ity in dynamic graph streams. In Tova Milo and Diego Calvanese, editors, Proceedings of the 34th ACM Symposium on Principles of Database Systems, PODS 2015, Mel- bourne, Victoria, Australia, May 31 - June 4, 2015, pages 241 -- 247. ACM, 2015. 22 [Hoe63] [IM98] Wassily Hoeffding. Probability inequalities for sums of bounded random variables. Journal of the American Statistical Association, 58(301):13 -- 30, 1963. Piotr Indyk and Rajeev Motwani. Approximate nearest neighbors: Towards removing the curse of dimensionality. In Jeffrey Scott Vitter, editor, Proceedings of the Thirtieth Annual ACM Symposium on the Theory of Computing, Dallas, Texas, USA, May 23- 26, 1998, pages 604 -- 613. ACM, 1998. [JKPS17] Gorav Jindal, Pavel Kolev, Richard Peng, and Saurabh Sawlani. Density independent algorithms for sparsifying k-step random walks. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM 2017, August 16-18, 2017, Berkeley, CA, USA, pages 14:1 -- 14:17, 2017. [JS18a] [JS18b] [JST11] [Kar94] Arun Jambulapati and Aaron Sidford. Efficienteo(n/ǫ) spectral sketches for the lapla- cian and its pseudoinverse. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2487 -- 2503. SIAM, 2018. Arun Jambulapati and Aaron Sidford. Efficient spectral sketches for the laplacian and its pseudoinverse. Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 2487 -- 2503, 2018. Hossein Jowhari, Mert Saglam, and G´abor Tardos. Tight bounds for Lp samplers, finding duplicates in streams, and related problems. In Proceedings of the 30th ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems (PODS), pages 49 -- 58. ACM, 2011. David R. Karger. Random sampling in cut, flow, and network design problems. In Frank Thomson Leighton and Michael T. Goodrich, editors, Proceedings of the Twenty- Sixth Annual ACM Symposium on Theory of Computing, 23-25 May 1994, Montr´eal, Qu´ebec, Canada, pages 648 -- 657. ACM, 1994. [KL13] Jonathan A. Kelner and Alex Levin. Spectral sparsification in the semi-streaming setting. Theory of Computing Systems, 53(2):243 -- 262, 2013. [KLM+14] Michael Kapralov, Yin Tat Lee, Cameron Musco, Christopher Musco, and Aaron Sid- ford. Single pass spectral sparsification in dynamic streams. arXiv, abs/1407.1289, 2014. arXiv:1407.1289. [KLM+17] Michael Kapralov, Yin Tat Lee, CN Musco, CP Musco, and Aaron Sidford. Single pass spectral sparsification in dynamic streams. SIAM Journal on Computing, 46(1):456 -- 477, 2017. [KLP16a] Ioannis Koutis, Alex Levin, and Richard Peng. Faster spectral sparsification and nu- merical algorithms for SDD matrices. ACM Trans. Algorithms, 12(2):17:1 -- 17:16, 2016. [KLP+16b] Rasmus Kyng, Yin Tat Lee, Richard Peng, Sushant Sachdeva, and Daniel A. Spielman. Sparsified cholesky and multigrid solvers for connection laplacians. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 842 -- 850, 2016. 23 [KM09] Jonathan A. Kelner and Aleksander Madry. Faster generation of random spanning trees. In 50th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2009, October 25-27, 2009, Atlanta, Georgia, USA, pages 13 -- 21. IEEE Computer So- ciety, 2009. [KMM+19] Michael Kapralov, Aida Mousavifar, Cameron Musco, Christopher Musco, and Navid Nouri. Faster spectral sparsification in dynamic streams. 2019. [KMP10] [KMP11] Ioannis Koutis, Gary L. Miller, and Richard Peng. Approaching optimality for solving SDD linear systems. In 51th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2010, October 23-26, 2010, Las Vegas, Nevada, USA, pages 235 -- 244, 2010. Ioannis Koutis, Gary L. Miller, and Richard Peng. A nearly-m log n time solver for SDD linear systems. In IEEE 52nd Annual Symposium on Foundations of Computer Science, FOCS 2011, Palm Springs, CA, USA, October 22-25, 2011, pages 590 -- 598, 2011. [KNP+17] Michael Kapralov, Jelani Nelson, Jakub Pachocki, Zhengyu Wang, David P. Woodruff, and Mobin Yahyazadeh. Optimal lower bounds for universal relation, and for samplers and finding duplicates in streams. In 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2017, Berkeley, CA, USA, October 15-17, 2017, pages 475 -- 486, 2017. [KOSA13] Jonathan A. Kelner, Lorenzo Orecchia, Aaron Sidford, and Zeyuan Allen Zhu. A simple, combinatorial algorithm for solving SDD systems in nearly-linear time. In Symposium on Theory of Computing Conference, STOC'13, Palo Alto, CA, USA, June 1-4, 2013, pages 911 -- 920, 2013. [KPPS17] Rasmus Kyng, Jakub Pachocki, Richard Peng, and Sushant Sachdeva. A framework for analyzing resparsification algorithms. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2032 -- 2043, 2017. [KS16] Rasmus Kyng and Sushant Sachdeva. Approximate gaussian elimination for laplacians - fast, sparse, and simple. In IEEE 57th Annual Symposium on Foundations of Computer Science, FOCS 2016, 9-11 October 2016, Hyatt Regency, New Brunswick, New Jersey, USA, pages 573 -- 582, 2016. [KW14] Michael Kapralov and David P. Woodruff. Spanners and sparsifiers in dynamic streams. ACM Symposium on Principles of Distributed Computing, PODC '14, Paris, France, July 15-18, 2014, pages 272 -- 281, 2014. [LMP13] Mu Li, Gary L. Miller, and Richard Peng. Iterative row sampling. In 54th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2013, 26-29 October, 2013, Berkeley, CA, USA [DBL13], pages 127 -- 136. [LNW14] Yi Li, Huy L. Nguyen, and David P. Woodruff. Turnstile streaming algorithms might In Proceedings of the 46th Annual ACM Symposium on as well be linear sketches. Theory of Computing (STOC), pages 174 -- 183, 2014. 24 [LS13] [LS14] [LS15] [LS17] [LS18] [McG14] [McG17] Yin Tat Lee and Aaron Sidford. Efficient accelerated coordinate descent methods and faster algorithms for solving linear systems. In 54th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2013, 26-29 October, 2013, Berkeley, CA, USA, pages 147 -- 156, 2013. Yin Tat Lee and Aaron Sidford. Path finding methods for linear programming: Solving linear programs in o(vrank) iterations and faster algorithms for maximum flow. In 55th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2014, Philadelphia, PA, USA, October 18-21, 2014, pages 424 -- 433, 2014. Yin Tat Lee and He Sun. Constructing linear-sized spectral sparsification in almost- linear time. In Venkatesan Guruswami, editor, IEEE 56th Annual Symposium on Foundations of Computer Science, FOCS 2015, Berkeley, CA, USA, 17-20 October, 2015, pages 250 -- 269. IEEE Computer Society, 2015. Yin Tat Lee and He Sun. An sdp-based algorithm for linear-sized spectral sparsification. In Hamed Hatami, Pierre McKenzie, and Valerie King, editors, Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2017, Montreal, QC, Canada, June 19-23, 2017, pages 678 -- 687. ACM, 2017. Huan Li and Aaron Schild. Spectral subspace sparsification. In 59th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2018, Paris, France, October 7-9, 2018, pages 385 -- 396, 2018. Andrew McGregor. Graph stream algorithms: A survey. SIGMOD Rec., 43(1):9 -- 20, 2014. Preliminary version in the 31st International Colloquium on Automata, Languages and Programming (ICALP), 2004. Andrew McGregor. Graph sketching and streaming: New approaches for analyzing massive graphs. In Pascal Weil, editor, Computer Science - Theory and Applications - 12th International Computer Science Symposium in Russia, CSR 2017, Kazan, Russia, June 8-12, 2017, Proceedings, volume 10304 of Lecture Notes in Computer Science, pages 20 -- 24. Springer, 2017. [MST15] Aleksander Madry, Damian Straszak, and Jakub Tarnawski. Fast generation of random spanning trees and the effective resistance metric. In Piotr Indyk, editor, Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, pages 2019 -- 2036. SIAM, 2015. [NY19] [PS14] [Sch18] Jelani Nelson and Huacheng Yu. Optimal lower bounds for distributed and streaming spanning forest computation. Proceedings of the Thirtieth Annual ACM-SIAM Sympo- sium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6-9, 2019, pages 1844 -- 1860, 2019. Richard Peng and Daniel A. Spielman. An efficient parallel solver for SDD linear systems. In Symposium on Theory of Computing, STOC 2014, New York, NY, USA, May 31 - June 03, 2014, pages 333 -- 342, 2014. Aaron Schild. An almost-linear time algorithm for uniform random spanning tree gener- ation. In Ilias Diakonikolas, David Kempe, and Monika Henzinger, editors, Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, Los Angeles, CA, USA, June 25-29, 2018, pages 214 -- 227. ACM, 2018. 25 [SR15] [SS11] [ST04] [ST11a] [ST11b] Rocco A. Servedio and Ronitt Rubinfeld, editors. Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, STOC 2015, Portland, OR, USA, June 14-17, 2015. ACM, 2015. Daniel A Spielman and Nikhil Srivastava. Graph sparsification by effective resistances. SIAM Journal on Computing, 40(6):1913 -- 1926, 2011. Daniel A. Spielman and Shang-Hua Teng. Nearly-linear time algorithms for graph partitioning, graph sparsification, and solving linear systems. In Proceedings of the 36th Annual ACM Symposium on Theory of Computing, Chicago, IL, USA, June 13- 16, 2004, pages 81 -- 90, 2004. Daniel A. Spielman and Shang-Hua Teng. Spectral sparsification of graphs. SIAM Journal on Computing, 40(4):981 -- 1025, 2011. Daniel A. Spielman and Shang-Hua Teng. Spectral sparsification of graphs. SIAM J. Comput., 40(4):981 -- 1025, 2011. A Supplementary material We will need Lemma 3 that we use in the correctness proof of our algorithm. Lemma 3 (Chain of Coarse Sparsifiers [LMP13, KLM+17]). Consider any PSD matrix K with maximum eigenvalue bounded from above by λu = 2n and minimum nonzero eigenvalue bounded from below by λℓ = 1 λu λℓ ⌉. For ℓ ∈ {0, 1, 2, . . . , d}, define: 8n2 . Let d = ⌈log2 So γ(d) ≤ λℓ, and γ(0) = λu. Then the chain of P SD matrices, [K0, K1, . . . , Kd] with Kℓ = K + γ(ℓ)I satisfies the following relations: γ(ℓ) = λu 2ℓ . 1. K (cid:22)r Kd (cid:22)r 2 · K, 2. Kℓ (cid:22) Kℓ−1 (cid:22) 2 · Kℓ for all ℓ ∈ {1, . . . , d}, 3. K0 (cid:22) 2 · γ(0) · I (cid:22) 2 · K0. We will need Theorem 4 that we use in the proof of correctness of the main algorithm. It is well known that by sampling the edges of B according to their effective resistance, it is possible to high probability (see Lemma 4). obtain a weighted edge vertex incident matrix eB such that (1− ǫ)B⊤B (cid:22) eB⊤eB (cid:22) (1 + ǫ)B⊤B with Theorem 4 (Spectral Approximation via Effective Resistance Sampling [SS11]). Let B ∈ R(n K = B⊤B, and let eτ be a vector of leverage score overestimates for B's rows, i.e. eτy ≥ b⊤y K +by for all y ∈ [m]. For ǫ ∈ (0, 1) and fixed constant c, define the sampling probability for row by to be py = min{1, c · ǫ−2 log n ·eτy}. Define a diagonal sampling matrix W with W (y, y) = 1 with probability py and W (y, y) = 0 otherwise. With high probability, eK = B⊤W B ≈ǫ K. Furthermore W has O(eτ1 · ǫ−2 log n) non-zeros with high probability. 2)×n, py 26 Lemma 4 (ℓ2 Heavy Hitters). For any η > 0, there is a decoding algorithm denoted by HeavyHit- ter and a distribution on matrices Sh in RO(η−2 polylog(N ))×N such that, for any x ∈ RN , given Shx, the algorithm HeavyHitter(Shx, η) returns a list F ⊆ [N ] such that F = O(η−2 polylog(N )) with probability 1 − 1 poly(N ) over the choice of Sh one has (1) for every i ∈ [N ] such that xi ≥ ηx2 one has i ∈ F ; (2) for every i ∈ F one has xi ≥ (η/2)x2. The sketch Shx can be maintained and decoded in O(η−2 polylog(N )) time and space. Lemma 5 (Binary Johnson-Lindenstrauss Lemma [Ach03]). Let P be an arbitrary set of points in Rd, represented by a d × n matrix A, such that the jth point is Aχj. Given ǫ, β > 0 and q ≥ 4 + 2β ǫ2/2 − ǫ3/3 log n. Let Q be a random q × d matrix (qij)ij where qij's are independent identically distributed variables taking 1 and −1 each with probability 1/2. Then, if M = 1√q QA, then with probability at least 1 − n−β, for all u, v ∈ [n] (1 − ǫ)Aχu − Aχv2 2 ≤ M χu − M χv2 2 ≤ (1 + ǫ)Aχu − Aχv2 2 27
1203.5387
2
1203
2012-11-13T01:50:51
Finding Connected Components on Map-reduce in Logarithmic Rounds
[ "cs.DS", "cs.DB" ]
Given a large graph G = (V,E) with millions of nodes and edges, how do we compute its connected components efficiently? Recent work addresses this problem in map-reduce, where a fundamental trade-off exists between the number of map-reduce rounds and the communication of each round. Denoting d the diameter of the graph, and n the number of nodes in the largest component, all prior map-reduce techniques either require d rounds, or require about n|V| + |E| communication per round. We propose two randomized map-reduce algorithms -- (i) Hash-Greater-To-Min, which provably requires at most 3log(n) rounds with high probability, and at most 2(|V| + |E|) communication per round, and (ii) Hash-to-Min, which has a worse theoretical complexity, but in practice completes in at most 2log(d) rounds and 3(|V| + |E|) communication per rounds. Our techniques for connected components can be applied to clustering as well. We propose a novel algorithm for agglomerative single linkage clustering in map-reduce. This is the first algorithm that can provably compute a clustering in at most O(log(n)) rounds, where n is the size of the largest cluster. We show the effectiveness of all our algorithms through detailed experiments on large synthetic as well as real-world datasets.
cs.DS
cs
Finding Connected Components in Map-Reduce in Logarithmic Rounds Anish Das Sarma Laukik Chitnis Ashwin Machanavajjhala Vibhor Rastogi {vibhor.rastogi, ashwin.machanavajjhala, laukik, anish.dassarma}@gmail.com 1 2 1 0 2 v o N 3 1 ] S D . s c [ 2 v 7 8 3 5 . 3 0 2 1 : v i X r a Abstract —Given a large graph G = (V , E ) with millions of nodes and edges, how do we compute its connected components ef ficiently? Recent work addresses this problem in map-redu ce, where a fundamental trade-off exists between the number of map- reduce rounds and the communication of each round. Denoting d the diameter of the graph, and n the number of nodes in the largest component, all prior techniques for map-reduce either require a linear, Θ(d), number of rounds, or a quadratic, Θ(nV + E ), communication per round. We propose here two ef ficient map-reduce algorithms: (i) Hash-Greater-to-Min, which is a randomized algorithm based on PRAM techniques, requiring O(log n) rounds and O(V + E ) communication per round, and (ii) Hash-to-Min, which is a novel algorithm, provably finishing in O(log n) iterations for path graphs. The proof technique used for Hash-to-Min is novel, but not tight, and it is actually faster than Hash-Greater-to- Min in practice. We conjecture that it requires 2 log d rounds and 3(V + E ) communication per round, as demonstrated in our experiments. Using secondary sorting, a standard map- reduce feature, we scale Hash-to-Min to graphs with very large connected components. Our techniques for connected components can be applied to clustering as well. We propose a novel algorithm for agglomera- tive single linkage clustering in map-reduce. This is the fir st map- reduce algorithm for clustering in at most O(log n) rounds, where n is the size of the largest cluster. We show the effectiveness of all our algorithms through detailed experiments on large synthetic as well as real-world datasets. I . INTRODUCT ION Given a large graph G = (V , E ) with millions of nodes and edges, how do we compute its connected components efficiently? With the proliferation of large databases of li nked data, it has become very important to scale to large graphs. Ex- amples of large datasets include the graph of webpages, where edges are hyperlinks between documents, social networks that link entities like people, and Linked Open Data1 that represents a collection of linked structured entities. The problem of finding connected components on such graphs, and the related problem of undirected s-t connectivity (USTCON [14]) that checks whether two nodes s and t are connected, are funda- mental as they are basic building blocks for more complex graph analyses, like clustering. The number of vertices V and edges E in these graphs is very large. Moreover, such graphs often arise as intermediate outputs of large batch-processing tasks (e.g., clustering Web pages and entity resolution), thus requiring us to design algorithms in a distributed setting. Map-reduce [6] has become a very popular choice for distributed data processing. In map-reduce, there are two critical metrics to be optimized – number of map-reduce rounds, since each additional job incurs significant running time overhead because of synchronizati on 1 http://linkeddata.org/ and congestion issues, and communication per round, since this determines the size of the intermediate data. There has been prior work on finding connected components iteratively in map-reduce, and a fundamental trade-off exists between the number of rounds and the communication per round. Starting from small clusters, these techniques iteratively expand existing clusters, by either adding adjacent one-hop graph neighbors, or by merging existing overlapping clusters. The former kind [5], [10], [17] require Θ(d) map-reduce rounds for a graph with diameter d, while the latter [1] require a larger, Θ(nV + E ), computation per round, with n being the number of nodes in the largest component. More efficient O(log n) time PRAM algorithms have been proposed for computing connected components. While theo- retical results simulating O(log n) PRAM algorithms in map- reduce using O(log n) rounds exist [12], the PRAM algorithms for connected components have not yet been ported to a practical and efficient map-reduce algorithm. (See Sec. II- A for a more detailed description) In this paper, we present two new map-reduce algorithms for computing connected components. The first algorithm, calle d Hash-Greater-to-Min, is an efficient map-reduce implement a- tion of existing PRAM algorithms [11], [20], and provably requires at most 3 log n rounds with high probability, and a per round communication cost2 of at most 2(V + E ). The second algorithm, called Hash-to-Min, is novel, and provably finishes in O(log n) rounds for path graphs. The proof technique used for Hash-to-Min is novel, but not tight, and our experiments show that it requires at most 2 log d rounds and 3(V + E ) communication per rounds. Both of our map-reduce algorithms iteratively merge over- lapping clusters to compute connected components. Low com- munication cost is achieved by ensuring that a single cluster is replicated exactly once, using tricks like pointer-doubling, commonly used in the PRAM literature. The more intricate problem is processing graphs for which connected components are so big that either (i) they do not fit in the memory of a single machine, and hence cause failures, or (ii) they result in heavy data skew with some clusters being small, while others being large. The above problems mean that we need to merge overlap- ping clusters, i.e. remove duplicate nodes occurring in multi- ple clusters, without materializing entire clusters in memory. Using Hash-to-Min, we solve this problem by maintaining each cluster as key-value pairs, where the key is a common cluster id and values are nodes. Moreover, the values are kept sorted (in lexicographic order), using a map-reduce capability 2Measured as total number of c-bit messages communicated, where c is number of bits to represent a single node in the graph. called secondary-sorting, which incurs no extra computation cost. Intuitively, when clusters are merged by the algorithm, mappers individually get values (i.e, nodes) for a key, sort them, and send them to the reducer for that key. Then the reducer gets the ‘merge-sorted’ list of all values, corresponding to nodes from all clusters needing to be merged. In a single scan, the reducer then removes any duplicates from the sorted list, without materializing entire clusters in memory. We also present two novel map-reduce algorithms for single-linkage agglomerative clustering using similar ideas. One using Hash-to-All that provably completes in O(log n) map-reduce rounds, and at most O(nV + E ) commu- nication per round, and other using Hash-to-Min that we conjecture completes in O(log d) map-reduce rounds, and at most O(V + E ) communication per round. We believe that these are the first Map-Reduce algorithm for single linkage clustering that finish in o(n) rounds. All our algorithms can be easily adapted to the Bulk Syn- chronous Parallel paradigm used by recent distributed graph processing systems like Pregel [16] and Giraph [4]. We choose to focus on the map-reduce setting, since it is more impacted by a reduction in number of iterations, thus more readily showing the gains brought by our algorithms (see Sections II and VI-C for a more detailed discussion). Contributions and Outline: • We propose two novel algorithms for connected compo- nents – (i) Hash-Greater-to-Min, which provably requires at most 3 log n rounds with high probability, and at most 2(V + E ) communication per round, and (ii) Hash-to- Min, which we prove requires at most 4 log n rounds on path graphs, and requires 2 log d rounds and 3(V + E ) communication per round in practice. (Section III) • While Hash-Greater-to-Min requires connected compo- nents to fit in a single machine’s memory, we propose a robust implementation of Hash-to-Min that scales with arbitrarily large connected components. We also describe extensions to Hash-to-Min for load balancing, and show that on large social network graphs, for which Hash- Greater-to-Min runs out of memory, Hash-to-Min still works efficiently. (Section IV) • We also present two algorithms for single linkage ag- glomerative clustering using our framework: one using Hash-to-All that provably finishes in O(log n) map-reduce rounds, and at most O(nV + E ) communication per round, and the other using Hash-to-Min that we again conjecture finishes in O(log d) map-reduce rounds, and at most O(V + E ) communication per round. (Section V) • We present detailed experimental results evaluating our algorithms for connected components and clustering and compare them with previously proposed algorithms on multiple real-world datasets. (Section VI) We present related work in Sec. II, followed by algorithm and experiment sections, and then conclude in Sec. VII. I I . RE LAT ED WORK The problems of finding connected components and undi- rected s-t connectivity (USTCON) are fundamental and very well studied in many distributed settings including PRAM, MapReduce, and BSP. We discuss each of them below. 2 # of steps Name Pegasus [10] O(d) Zones [5] O(d) L Datalog [1] O(d) NL Datalog [1] O(log d) PRAM [20], [18], [8], [11], [12] O(log n) Hash-Greater-to-Min 3 log n Communication O(V + E ) O(V + E ) O(nV + E ) O(nV + E ) shared memory3 2(V + E ) TABLE I COM P L EX I TY COM PA R I S ON W I TH R E LAT ED WO RK : n = # O F NOD E S I N LA RG E S T COM P ON EN T, AND d = G RA P H D I AM E T ER A. Parallel Random Access Machine (PRAM) The PRAM computation model allows several processors to compute in parallel using a common shared memory. PRAM can be classified as CRCW PRAM if concurrent writes to shared memory are permitted, and CREW PRAM if not. Although, map-reduce does not have a shared memory, PRAM algorithms are still relevant, due to two reasons: (i) some PRAM algorithms can been ported to map-reduce by case-to- case analyses, and (ii), a general theoretical result [12] shows that any O(t) CREW PRAM algorithm can be simulated in O(t) map-reduce steps. For the CRCW PRAM model, Shiloach and Vishkin [20] proposed a deterministic O(log n) algorithm to compute con- nected components, with n being the size of the largest com- ponent. Since then, several other O(log n) CRCW algorithms have been proposed in [8], [13], [18]. However, since they require concurrent writes, it is not obvious how to translate them to map-reduce efficiently, as the simulation result of [ 12] applies only to CREW PRAM. For the CREW PRAM model, Johnson et. al. [9] pro- vided a deterministic O(log3/2 n) time algorithm, which was subsequently improved to O(log n) by Karger et. al. [11]. These algorithms can be simulated in map-reduce using the result of [12]. However, they require computing all nodes at a distance 2 of each node, which would require O(n2 ) communication per map-reduce iteration on a star graph. Conceptually, our algorithms are most similar to the CRCW PRAM algorithm of Shiloach and Vishkin [20]. That algorithm maintains a connected component as a forest of trees, and repeatedly applies either the operation of pointer doubling (pointing a node to its grand-parent in the tree), or of hooking a tree to another tree. Krishnamurthy et al [13] propose a more efficient implementation, similar to map-reduce, by interleaving local computation on local memory, and parallel computation on shared memory. However, pointer doubling and hooking require concurrent writes, which are hard to implement in map-reduce. Our Hash-to-Min algorithm does conceptually similar but, slightly different, operations in a single map-reduce step. B. Map-reduce Model Google’s map-reduce lecture series describes an iterative approach for computing connected components. In each itera- tion a series of map-reduce steps are used to find and include all nodes adjacent to current connected components. The number of iterations required for this method, and many of its improvements [5], [10], [17], is O(d) where d is the diameter of the largest connected component. These techniques do not scale well for large diameter graphs (such as graphical models where edges represent correlations between variables). Even for moderate diameter graphs (with d = 20), our techniques outperform the O(d) techniques, as shown in the experiments. Afrati et al [1] propose map-reduce algorithms for com- puting transitive closure of a graph – a relation containing tuples of pairs of nodes that are in the same connected component. These techniques have a larger communication per iteration as the transitive closure relation itself is quadratic in the size of largest component. Recently, Seidl et al [19] have independently proposed map-reduce algorithms similar to ours, including the use of secondary sorting. However, they do not show the O(log n) bound on the number of map-reduce rounds. Table I summarizes the related work comparison and shows that our Hash-Greater-to-Min algorithm is the first map-red uce technique with logarithmic number of iterations and linear communication per iteration. C. Bulk Synchronous Parallel (BSP) In the BSP paradigm, computation is done in parallel by processors in between a series of synchronized point-to-point communication steps. The BSP paradigm is used by recent distributed graph processing systems like Pregel [16] and Giraph [4]. BSP is generally considered more efficient for graph processing than map-reduce as it has less setup and overhead costs for each new iteration. While the algorithmic improvements of reducing number of iterations presented in this paper are applicable to BSP as well, these improvements are of less significance in BSP due to lower overhead of additional iterations. However, we show that BSP does not necessarily dominate map-reduce for large-scale graph processing (and thus our algorithmic improvements for map-reduce are still relevant and important). We show this by running an interesting experiment in shared grids having congested environments in Sec. VI-C. The experiment shows that in congested clusters, map- reduce can have a better latency than BSP, since in the latter one needs to acquire and hold machines with a combined memory larger than the graph size. For instance, consider a graph with a billion nodes and ten billion edges. Suppose each node is associated with a state of 256 bytes (e.g., the contents of a web page, or recent updates by a user in a social network, etc.). Then the total memory required would be about 256 GB, say, 256 machines with 1G RAM. In a congested grid waiting for 256 machines could take much longer than running a map- reduce job, since the map-reduce jobs can work with a smaller number of mappers and reducers (say 50-100), and switch in between different MR jobs in the congested environment. I I I . CONNECT ED COM PONENT S ON MA P -REDUCE In this section, we present map-reduce algorithms for com- puting connected components. All our algorithms are instan- tiations of a general map-reduce framework (Algorithm 1), which is parameterized by two functions – a hashing function h, and a merging function m (see line 1 of Algorithm 1). Different choices for h and m (listed in Table II) result in algorithms having very different complexity. Our algorithm framework maintains a tuple (key, value) for each node v of the graph – key is the node identifier v , and the value is a cluster of nodes, denoted Cv . The value 3 1: Input: A graph G = (V , E ), hashing function h merging function m, and export function EX PORT 2: Output: A set of connected components C ⊂ 2V 3: Either Initialize Cv = {v} Or Cv = {v} ∪ nbrs(v) depending on the algorithm. 4: repeat 5: mapper for node v : Compute h(Cv ), which is a collection of key-value pairs 6: (u, Cu ) for u ∈ Cv . Emit all (u, Cu ) ∈ h(Cv ). reducer for node v : v , . . . , C (K ) Let {C (1) } denote the set of values received v from different mappers. Set Cv ← m({C (1) v , . . . , C (K ) }) 10: v 11: until Cv does not change for all v 12: Return C = EX PORT(∪v {Cv }) Algorithm 1: General Map Reduce Algorithm 7: 8: 9: Hash-Min emits (v, Cv ), and (u, {vmin }) for all nodes u ∈ nbrs(v). Hash-to-All emits (u, Cv ) for all nodes u ∈ Cv . Hash-to-Min emits (vmin , Cv ), and (u, {vmin }) for all nodes u ∈ Cv . Hash-Greater-to-Min computes C≥v , the set of nodes in Cv not less than v . It emits (vmin , C≥v ), and (u, {vmin }) for all nodes u ∈ C≥v TABLE II H A S H I NG F UN C T I ON S : E ACH S TRAT EGY D E S C R I B E S TH E K EY- VA LU E PA I R S EM I T T ED BY MA P P ER W I TH I N P U T K EY v AND VA LU E Cv (vmin D ENOT E S SMA L L E S T NOD E I N Cv ) Cv is initialized as either containing only the node v , or containing v and all its neighbors nbrs(v) in G, depending on the algorithm (see line 3 of Algorithm 1). The framework updates Cv through multiple mapreduce iterations. In the map stage of each iteration, the mapper for a key v applies the hashing function h on the value Cv to emit a set of key-value pairs (u, Cu ), one for every node u appearing in Cv (see lines 6-7). The choice of hashing function governs the behavior of the algorithm, and we will discuss different instantiations shortly. In the reduce stage, each reducer for a key v aggregates tuples (v , C (1) v ), . . . , (v , C (K ) ) emitted by v different mappers. The reducer applies the merging function m over C (i) to compute a new value Cv (see lines 9-10). v This process is repeated until there is no change to any of the clusters Cv (see line 11). Finally, an appropriate EX PORT function computes the connected components C from the final clusters Cv using one map-reduce round. Hash Functions We describe four hashing strategies in Ta- ble II and their complexities in Table III. The first one, deno ted Hash-Min, was used in [10]. In the mapper for key v , Hash- Min emits key-value pairs (v , Cv ) and (u, {vmin}) for all nodes u ∈ nbrs(v). In other words, it sends the entire cluster Cv to reducer v again, and sends only the minimum node vmin of the cluster Cv to all reducers for nodes u ∈ nbrs(v). Thus communication is low, but so is rate of convergence, as information spreads only by propagating the minimum node. On the other hand, Hash-to-All emits key-value pairs (u, Cv ) for all nodes u ∈ Cv . In other words, it sends the cluster Cv to all reducers u ∈ Cv . Hence if clusters Cv and C ′ v overlap on some node u, they will both be sent to reducer of u, where they can be merged, resulting in a faster convergence. Algorithm MR Rounds Hash-Min [10] Hash-to-All Hash-to-Min Hash-Greater-to-Min d log d O(log n)⋆ 3 log n Communication (per MR step) O(V + E ) O(nV + E ) O(log nV + E )⋆ 2(V + E ) TABLE III COM P L EX I TY O F D I FFER EN T A LGO R I THM S (⋆ D ENOT E S R E S U LT S HO LD F O R ON LY PATH G RA P H S ) But, sending the entire cluster Cv to all reducers u ∈ Cv re- sults in large quadratic communication cost. To overcome this, Hash-to-Min sends the entire cluster Cv to only one reducer vmin , while other reducers are just sent {vmin}. This decreases the communication cost drastically, while still achieving fast convergence. Finally, the best theoretical complexity bounds can be shown for Hash-Greater-to-Min, which sends out a smaller subset C≥v of Cv . We look at how these functions are used in specific algorithms next. A. Hash-Min Algorithm The Hash-Min algorithm is a version of the Pegasus al- gorithm [10].4 In this algorithm each node v is associated with a label vmin (i.e., Cv is a singleton set {vmin}) which corresponds to the smallest id amongst nodes that v knows are in its connected component. Initially vmin = v and so Cv = {v}. It then uses Hash-Min hashing function to propagate its label vmin in Cv to all reducers u ∈ nbrs(v) in every round. On receiving the messages, the merging function min amongst the incoming m computes the smallest node vnew messages and sets Cv = {vnew min }. Thus a node adopts the minimum label found in its neighborhood as its own label. On convergence, nodes that have the same label are in the same connected component. Finally, the connected components are computed by the following EX PORT function: return sets of nodes grouped by their label. Theorem 3.1 (Hash-Min [10]): Algorithm Hash-Min cor- rectly computes the connected components of G = (V , E ) using O(V + E ) communication and O(d) map-reduce rounds. B. Hash-to-All Algorithm The Hash-to-All algorithm initializes each cluster Cv = {v} ∪ {nbrs(v)}. Then it uses Hash-to-All hashing function to send the entire cluster Cv to all reducers u ∈ Cv . On receiving the messages, merge function m updates the cluster by taking the clusters received by the node. More the union of all formally, if the reducer at v receives clusters C (1) v , . . . , C (K ) , v i=1C (i) then Cv is updated to ∪K v . We can show that after log d map-reduce rounds, for every v , Cv contains all the nodes in the connected component containing v . Hence, the EX PORT function just returns the distinct sets in C (using one map-reduce step). cor- Theorem 3.2 (Hash-to-All): Algorithm Hash-to-All rectly computes the connected components of G = (V , E ) using O(nV + E ) communication per round and log d map- reduce rounds, where n is the size of the largest component and d the diameter of G. 4 [10] has additional optimizations that do not change the asymptotic complexity. We do not describe them here. 4 Proof: We can show using induction that after k map- reduce steps, every node u that is at a distance ≤ 2k from v is contained in Cv . Initially this is true, since all neighbors are part of Cv . Again, for the k + 1st step, u ∈ Cw for some w and w ∈ Cv such that distance between u, w and w, v is at most 2k . Hence, for every node u at a distance at most 2k+1 from v , u ∈ Cv after k + 1 steps. Proof for communication complexity follows from the fact that each node is replicated at most n times. C. Hash-to-Min Algorithm While the Hash-to-All algorithm computes the connected components in a smaller number of map-reduce steps than Hash-Min, the size of the intermediate data (and hence the communication) can become prohibitively large for even sparse graphs having large connected components. We now present Hash-to-Min, a variation on Hash-to-All, that we show finishes in at most 4 log n steps for path graphs. We also show that in practice it takes at most 2 log d rounds and linear communication cost per round (see Section VI),where d is the diameter of the graph. The Hash-to-Min cluster each algorithm initializes Cv = {v} ∪ {nbrs(v)}. Then it uses Hash-to-Min hash function to send the entire cluster Cv to reducer vmin , where vmin is the smallest node in the cluster Cv , and {vmin} to all reducers u ∈ Cv . The merging function m works exactly like in Hash-to-All: Cv is the union of all the nodes appearing in the received messages. We explain how this algorithm works by an example. Example 3.3: Consider an intermediate step where clusters C1 = {1, 2, 4} and C5 = {3, 4, 5} have been associated with keys 1 and 5. We will show how these clusters are merged in both Hash-to-All and Hash-to-Min algorithms. In the Hash-to-All scheme, the mapper at 1 sends the entire cluster C1 to reducers 1, 2, and 4, while mapper at 5 sends C5 to reducers 3, 4, and 5. Therefore, on reducer 4, the entire cluster C4 = {1, 2, 3, 4, 5} is computed by the merge function. In the next step, this cluster C4 is sent to all the five reducers. In the Hash-to-Min scheme, the mapper at 1 sends C1 to reducer 1, and {1} to reducer 2 and 4. Similarly, the mapper at 5 sends C5 to reducer 3, and {3} to reducer 4 and 5. So reducer 4 gets {1} and {3}, and therefore computes the cluster C4 = {1, 3} using the merge function. Now, in the second round, the mapper at 4, has 1 as the minimum node of the cluster C4 = {1, 3}. Thus, it sends {1} to reducer 3, which already has the cluster C2 = {3, 4, 5}. Thus after the second round, the cluster C3 = {1, 3, 4, 5} is formed on reducer 3. Since 1 is the minimum for C3 , the mapper at 3 sends C3 to reducer 1 in the third round. Hence after the end of third round, reducer 1 gets the entire cluster {1, 2, 3, 4, 5}. Note in this example that Hash-to-Min required three map-reduce steps; however, the intermediate data transmitted is lower since entire clusters C1 and C2 were only sent to their minimum element’s reducer (1 and 3, resp). As the example above shows, unlike Hash-to-All, at the end of Hash-to-Min, all reducers v are not guaranteed to contain in Cv the connected component they are part of. In fact, we can show that the reducer at vmin contains all the nodes in that component, where vmin is the smallest node in a connected component. For other nodes v , Cv = {vmin}. Hence, EX PORT outputs only those Cv such that v is the smallest node in Cv . Theorem 3.4 (Hash-to-Min Correctness): At the end of al- gorithm Hash-to-Min, Cv satisfies the following property: If vmin is the smallest node of a connected component C , then Cvmin = C . For all other nodes v , Cv = {vmin}. Proof: Consider any node v such that Cv contains vmin . Then in the next step, mapper at v sends Cv to vmin , and only {vmin} to v . After this iteration, Cv will always have vmin as the minimum node, and the mapper at v will always send its cluster Cv to vmin . Now at some point of time, all nodes v in the connected component C will have vmin ∈ Cv (this follows from the fact that min will propagate at least one hop in every iteration just like in Theorem 3.1). Thus, every mapper for node v sends its final cluster to vmin , and only retains vmin . Thus at convergence Cvmin = C and Cv = {vmin}. Theorem 3.5 (Hash-to-Min Communication): Algorithm takes O(k ·(V + E )) expected communication per round, where k is the total number of rounds. Here expectation is over the random choices of the node ordering. Proof: Note that the total communication in any step equals the total size of all Cv in the next round. Let nk denote the size of this intermediate after k rounds. That is, nk = Pv Cv . We show by induction that nk = O(k · (V + E )). v ≤ 2(V + E ), since each node contains First, n0 = Pv C 0 itself and all its neighbors. In each subsequent round, a node v is present in Cu , for all u ∈ Cv . Then v is sent to a different cluster in one of two ways: • If v is the smallest node in Cu , then v is sent to all nodes in Cu . Due to this, v gets replicated to Cu different clusters. However, this happens with probability 1/Cu . • If v is not the smallest node, then v is sent to the smallest node of Cu . This happens with probability 1 − 1/Cu . Moreover, once v is not the smallest for a cluster, it will never become the smallest node; hence it will never be replicated more that once. From the above two facts, on expectation after one round, the v clusters as the smallest node node v is sent to s1 = C 0 and to m1 = C 0 v clusters as not the smallest node. After two rounds, the node v is additionally sent to s2 = C 0 v , v , in addition to the m1 clusters. Therefore, after k m2 = C 0 rounds, nk = O(k · (V + E )). Next we show that on a path graph, Hash-to-Min finishes in 4 log n. The proof is rather long, and due to space constraints appears in Sec. A of the Appendix. Theorem 3.6 (Hash-to-Min Rounds): Let G = (V , E ) be a path graph (i.e. a tree with only nodes of degree 2 or 1). Then, Hash-to-Min correctly computes the connected component of G = (V , E ) in 4 log n map-reduce rounds. Although, Theorem 3.6 works only for path graphs, we conjecture that Hash-to-Min finishes in 2 log d rounds on all inputs, with O(V + E ) communication per round. Our experiments (Sec. VI) seem to validate this conjecture. D. Hash-Greater-to-Min Algorithm Now we describe the Hash-Greater-to-Min algorithm that has the best theoretical bounds: 3 log n map-reduce rounds 5 with high probability and 2(V +E ) communication com- plexity per round in the worst-case. In Hash-Greater-to-Min algorithm, the clusters Cv are again initialized as {v}. Then Hash-Greater-to-Min algorithm runs two rounds using Hash- Min hash function, followed by a round using Hash-Greater- to-Min hash function, and keeps on repeating these three rounds until convergence. In a round using Hash-Min hash function, the entire cluster Cv is sent to reducer v and vmin to all reducers u ∈ nbrs(v). For, the merging function m on machine m(v), the algo- rithm first computes the minimum node among all incoming messages, and then adds it to the message C (v) received min is the smallest from m(v) itself. More formally, say vnew nodes among all the messages received by u, then Cnew (v) is min } ∪ {C (v)}. updated to {vnew In a round using Hash-Greater-to-Min hash function, the set C≥v is computed as all nodes in Cv not less than v . This set is sent to reducer vmin , where vmin is the smallest node in C (v), and {vmin} is sent to all reducers u ∈ C≥v . The merging function m works exactly like in Hash-to-All: C (v) is the union of all the nodes appearing in the received messages. We explain this process by the following example. Example 3.7: Consider a path graph with n edges (1, 2), (2, 3), (3, 4), and so on. We will now show three rounds of Hash-Greater-to-Min. In Hash-Greater-to-Min algorithm, the clusters are initial- ized as Ci = {i} for i ∈ [1, n]. In the first round, the Hash-Min function will send {i} to reducers i − 1, i, and i + 1. So each reducer i will receive messages {i − 1}, {i} and {i + 1}, and aggregation function will add the incoming minimum, i − 1, to the previous Ci = {i}. Thus in the second round, the clusters are C1 = {1} and Ci = {i − 1, i} for i ∈ [2, n]. Again Hash-Min will send the minimum node {i − 1} of Ci to reducers i − 1, i, and i + 1. Again merging function would be used. At the end of second step, the clusters are C1 = {1}, C2 = {1, 2}, Ci = {i − 2, i − 1, i, } for i ∈ [3, n]. In the third round, Hash-Greater-to-Min will be used. This is where interesting behavior is seen. Mapper at 2 will send its C≥(2) = {2} to reducer 1. Mapper at 3 will send its C≥( 3) = {3} to reducer 1. Note that C≥(3) does not include 2 even though it appears in C3 as 2 < 3. Thus we save on sending redundant messages from mapper 3 to reducer 1 as 2 has been sent to reducer 1 from mapper 2. Similarly, mapper at 4 sends C≥( 4) = {4} to reducer 2, and mapper 5 sends C≥(5) = {5} to reducer 3, etc. Thus we get the sets, C1 = {1, 2, 3}, C2 = {1, 2, 4}, C3 = {1, 3, 6}, C4 = {4, 5, 6}, and so on. The analysis of the Hash-Greater-to-Min algorithm relies on the following lemma. Lemma 3.8: Let vmin be any node. Denote GT (vmin ) the set of all nodes v for which vmin is the smallest node in Cv after Hash-Greater-to-Min algorithm converges. Then GT (vmin ) is precisely the set C≥( vmin ). Note that in the above example, after 3 rounds of Hash- Greater-to-Min, GT (2) is {2, 4} and C≥(2) is also {2, 4}. We now analyze the performance of this algorithm. The proof is based on techniques introduced in [8], [11], and omitted here due to lack of space. The proof appears in the Appendix. Theorem 3.9 (Complexity): Algorithm Hash-Greater- to-Min correctly computes connected components the of G = (V , E ) in expected 3 log n map-reduce rounds (expectation is over the random choices of the node ordering) with 2(V + E ) communication per round in the worst case. IV. SCAL ING THE HA SH - TO -M IN A LGOR ITHM Hash-to-Min and Hash-Greater-to-Min complete in less number of rounds than Hash-Min, but as currently described, they require that every connected component of the graph fit in memory of a single reducer. We now describe a more ro- bust implementation for Hash-to-Min, which allows handling arbitrarily large connected components. We also describe an extension to do load balancing. Using this implementation, we show in Section VI examples of social network graphs that have small diameter and extremely large connected com- ponents, for which Hash-Greater-to-Min runs out of memory, but Hash-to-Min still works efficiently. A. Large Connected Components We address the problem of larger than memory connected components, by using secondary sorting in map-reduce, which allows a reducer to receive values for each key in a sorted order. Note this sorting is generally done in map-reduce to keep the keys in a reducer in sorted order, and can be extended to sort values as well, at no extra cost, using composite keys and custom partitioning [15]. To use secondary sorting, we represent a connected com- ponent as follows: if Cv is the cluster at node v , then we represent Cv as a graph with an edge from v to each of the node in Cv . Recall that each iteration of Hash-to-Min is as follows: for hashing, denoting vmin as the min node in Cv , the mapper at v sends Cv to reducer vmin , and {vmin} to all reducers u in Cv . For merging, we take the union of all incoming clusters at reducer v . Hash-to-Min can be implemented in a single map-reduce step. The hashing step is implemented by emitting in the mapper, key-value pairs, with key as vmin , and values as each of the nodes in Cv , and conversely, with key as each node in Cv , and vmin as the value. The merging step is implemented by collecting all the values for a key v and removing duplicates. To remove duplicates without loading all values in the memory, we use secondary sorting to guarantee that the values for a key are provided to the reducer in a sorted order. Then the reducer can just make a single pass through the values to remove duplicates, without ever loading all of them in memory, since duplicates are guaranteed to occur adjacent to each other. Furthermore, computing the minimum node vmin is also trivial as it is simply the first value in the sorted ord er. 6 1: Input: Weighted graph G = (V , E , w), stopping criterion S top. 2: Output: A clustering C ⊆ 2V . 3: Initialize clustering C ← {{v}v ∈ V }; 4: repeat Find the closest pair of clusters C1 , C2 in C (as per d); 5: Update C ← C − {C1 , C2 } ∪ {C1 ∪ C2 )}; 6: 7: until C does not change or S top(C ) is true 8: Return C Algorithm 2: Centralized single linkage clustering at machine v is larger than a prede fined threshold, we send all nodes u ≤ v to reducer vmin and {vmin} to all reducers u ≤ v , as done in Hash-to-Min. However, for nodes u > v , we send them to reducer v and {v} to reducer u. This ensures that reducer vmin does not receive too many nodes, and some of the nodes go to reducer v instead, ensuring balanced load. This modified Hash-to-Min is guaranteed to converge in at most the number of steps as the standard Hash-to-Min converges. However, at convergence, all nodes in a connected component are not guaranteed to have the minimum node vmin of the connected component. In fact, they can have as their minimum, a node v if the cluster at v was bigger than the specified threshold. We can then run standard Hash-to-Min, o n the modified graph over nodes that correspond to cluster ids, and get the final output. Note that this increases the number of rounds by at most 2, as after load-balanced Hash-to-Min converges, we use the standard Hash-to-Min. Example 4.1: If the specified threshold is 1, then the modi- fied algorithm converges in exactly one step, returning clus ters equal to one-hop neighbors. If the specified threshold is ∞, then the modified algorithm converges to the same output as the standard one, i.e. it returns connected components. If the specified threshold is somewhere in between (for our experiments we choose it to 100,000 nodes), then the output clusters are subsets of connected components, for which no cluster is larger than the threshold. V. S INGL E L INKAGE AGGLOMERAT IVE CLU S T ER ING To the best of our knowledge, no map-reduce implemen- tation exists for single linkage clustering that completes in o(n) map-reduce steps, where n is the size of the largest cluster. We now present two map-reduce implementations for the same, one using Hash-to-All that completes in O(log n) rounds, and another using Hash-to-Min that we conjecture to finish in O(log d) rounds. For clustering, we take as input a weighted graph denoted as G = (V , E , w), where w : E → [0, 1] is a weight function on edges. An output cluster C is any set of nodes, and a clustering C of the graph is any set of clusters such that each node belongs to exactly one cluster in C . B. Load Balancing Problem Even though Hash-to-Min can handle arbitrarily large graphs without failure (unlike Hash-Greater-to-Min), it can still suffer from data skew problems if some connected com- ponents are large, while others are small. We handle this problem by tweaking the algorithm as follows. If a cluster Cv A. Centralized Algorithm: Algorithm 2 shows the typical bottom up centralized algo- rithm for single linkage clustering. Initially, each node is its own cluster. De fine the distance between two clusters C1 , C2 to be the minimum weight of an edge between the two clusters; 1: Input: Weighted graph G = (V , E , w), stopping criterion S top. 2: Output: A clustering C ⊆ 2V . 3: Initialize C = {{v} ∪ nbrs(v)v ∈ V }. 4: repeat 5: Map: Use Hash-to-All or Hash-to-Min to hash clusters. Reduce: Merge incoming clusters. 6: 7: until C does not change or S top(C ) is true 8: Split clusters in C merged incorrectly in the final iteration. 9: Return C Algorithm 3: Distributed single linkage clustering i.e., d(C1 , C2 ) = min e=(u,v),u∈C1 ,v∈C2 w(e) In each step, the algorithm picks the two closest clusters and merges them by taking their union. The algorithm terminates either when the clustering does not change, or when a stopping condition, S top, is reached. Typical stopping conditions are threshold stopping, where the clustering stops when the closest distance between any pair of clusters is larger than a threshold, and cluster size stopping condition, where the clustering stops when the merged cluster in the most recent step is too large. Next we describe a map-reduce algorithm that simulates the centralized algorithm, i.e., outputs the same clustering. If there are two edges in the graph having the exact same weight, then single linkage clustering might not be unique, making it impossible to prove our claim. Thus, we assume that ties have been broken arbitrarily, perhaps, by perturbing the weights slightly, and thus no two edges in the graph have the same weight. Note that this step is required only for simplifying our proofs, but not for the correctness of our algorithm. B. Map-Reduce Algorithm Our Map-Reduce algorithm is shown in Algorithm 3. In- tuitively, we can compute single-linkage clustering by firs t computing the connected components (since no cluster can lie across multiple connected components), and then splitting the connected components into appropriate clusters. Thus, Algorithm 3 has the same map-reduce steps as Algorithm 1, and is implemented either using Hash-to-All or Hash-to-Min. However, in general, clusters, de fined by the stopping criteria, S top, may be much smaller than the connected components. In the extreme case, the graph might be just one giant connected component, but the clusters are often small enough that they individually fit in the memory of a single machine. Thus we need a way to check and stop execution as soon as clusters have been computed. We do this by evaluating S top(C ) after each iteration of map-reduce. If S top(C ) is false, a new iteration of map-reduce clustering is started. If S top(C ) is true, then we stop iterations. While the central algorithm can implement any stopping condition, checking an arbitrary predicate in a distributed setting can be difficult. Furthermore, while the central al- gorithm merges one cluster at a time, and then evaluates the stopping condition, the distributed algorithm evaluates stopping condition only at the end of a map-reduce iteration. This means that some reducers can merge clusters incorrectly 7 in the last map-reduce iteration. We describe next how to stop the map-reduce clustering algorithm, and split incorrectly merged clusters. C. Stopping and Splitting Clusters It is difficult to evaluate an arbitrary stopping predicate i n a distributed fashion using map-reduce. We restrict our attention to a restricted yet frequently used class of local monotonic stopping criteria, which is de fined below. De finition 5.1 (Monotonic Criterion): S top is monotone if for every clusterings C , C ′ , if C ′ re fines C (i.e, ∀C ∈ C ⇒ ∃C ′ ∈ C ′ , C ⊆ C ′ ), then S top(C ) = 1 ⇒ S top(C ′ ) = 1. Thus monotonicity implies that stopping predicate continues to remain true if some clusters are made smaller. Virtually every stopping criterion used in practice is monotonic. Next we de fine the assumption of locality, which states that stopp ing criterion can be evaluated locally on each cluster individually. De finition 5.2 (Local Criterion): S top is local if there ex- ists a function S toplocal : 2V → {0, 1} such that S top(C ) = 1 iff S toplocal (C ) = 1 for all C ∈ C . Examples of local stopping criteria include distance- threshold (stop merging clusters if their distance becomes too large) and size-threshold (stop merging if the size of a cluster becomes too large). Example of non-local stopping criterion is to stop when the total number of clusters becomes too high. If the stopping condition is local and monotonic, then we can compute it efficiently in a single map-reduce step. To explain how, we first de fine some notations. Given a cluster C ⊆ V , denote GC the subgraph of G induced over nodes C . Since C is a cluster, we know GC is connected. We denote tree(C ) as the5 minimum weight spanning tree of GC , and split(C ) as the pair of clusters CL , CR obtained by removing the edge with the maximum weight in tree(C ). Intuitively, CL and CR are the clusters that get merged to get C in the centralized single linkage clustering algorithm. Finally, denote nbrs(C ) the set of clusters closest to C by the distance metric d, i.e. if C1 ∈ nbrs(C ), then for every other cluster C2 , d(C, C2 ) > d(C, C1 ). We also de fine the notion of core and minimal core decom- position as follows. De finition 5.3 (Core): A singleton cluster is always a core. Furthermore, any cluster C ⊆ V is a core if its split CL , CR are both cores and closest to each other, i.e. CL ∈ nbrs(CR ) and CR ∈ nbrs(CL ). De finition 5.4 (Minimal core decomposition): Given a cluster C its minimal core decomposition, M CD(C ), is a set of cores {C1 , C2 , . . . , Cl} such that ∪iCi = C and for every core C ′ ⊆ C there exists a core Ci in the decomposition for which C ′ ⊆ Ci . Intuitively, a cluster C is a core, if it is a valid, i.e., it is a subset of some cluster C ′ in the output of the centralized single linkage clustering algorithm, and M CD(C ) finds the largest cores in C , i.e. cores that cannot be merged with any other node in C and still be cores. Computing MCD We give in Algorithm 4, a method to find the minimal core decomposition of a cluster. It checks whether the input cluster is a core. Otherwise it computes cluster splits Cl , and Cr and computes their MCD recursively. 5 The tree is unique because of unique edge weights 1: Input: Cluster C ⊆ V . 2: Output: A set of cores {C1 , C2 , . . . , Cl} corresponding to M CD(C ). 3: If C is a core, return {C }. 4: Construct the spanning tree TC of C , and compute CL , CR to be the cluster split of C . 5: Recursively compute M CD(CL ) and M CD(CR ). 6: Return M CD(CL ) ∪ M CD(CR ) Algorithm 4: Minimal Core Decomposition M CD 1: Input: Stopping predicate S top, Clustering C . 2: Output: S top(C ) 3: For each cluster C ∈ C , compute M CD(C ). (performed in reduce of calling of Algo. 3) 4: Map: Run Hash-to-All on cores, i.e, hash each core Ci ∈ M CD(C ) to all machines m(u) for u ∈ Ci 5: Reducer for node v: Of all incoming cores, pick the largest core, say, Cv , and compute S toplocal (Cv ). 6: Return ∧v∈V S toplocal (Cv ) Algorithm 5: Stopping Algorithm Note that this algorithm is centralized and takes as input a single cluster, which we assume fits in the memory of a single machine (unlike connected components, graph clusters are rather small). Stopping Algorithm Our stopping algorithm, shown in Algo- rithm 5, is run after each map-reduce iteration of Algorithm 3. It takes as input the clustering C obtained after the map- reduce iteration of Algorithm 3 . It starts by computing the minimal core decomposition, M CD(C ), of each cluster C in C . This computation can be performed during the reduce step of the pervious map-reduce iteration of Algorithm 3. Then, it runs a map-reduce iteration of its own. In the map step, using Hash-to-All, each core Ci is hashed to all machines m(u) for u ∈ Ci . In reducer, for machine m(v), we pick the incoming core with largest size, say Cv . Since S top is local, there exists a local function S toplocal . We compute S toplocal (Cv ) to determine whether to stop processing this core further. Finally, the algorithm stops if all the cores for nodes v in the graph are stopped. Splitting Clusters If the stopping algorithm (Algorithm 5) returns true, then clustering is complete. However, some clusters could have merged incorrectly in the final map-redu ce iteration done before the stopping condition was checked. Our recursive splitting algorithm, Algorithm 6, correctly splits such a cluster C by first computing the minimal core decomposi- tion, M CD(C ). Then it checks for each core Ci ∈ M CD(C ) that its cluster splits Cl and Cr could have been merged by ensuring that both S toplocal (Cl ) and S toplocal (Cr ) are false. If that is the case, then core Ci is valid and added to the output, otherwise the clusters Cl and Cr should not have been merged, and Ci is split further. D. Correctness & Complexity Results We first show the correctness of Algorithm 3. For that we first show the following lemma about the validity of cores. Lemma 5.5 (Cores are valid): Let Ccentral be the output of Algorithm 2, and C be any core (de fined according to Def. 5.3) 8 1: Input: Incorrectly merged cluster C w.r.t S toplocal . 2: Output: Set S of correctly split clusters in C . 3: Initialize S = {}. 4: for Ci in M CD(C ) do Let Cl and Cr be the cluster splits of Ci . 5: if S toplocal (Cl ) and S toplocal (Cr ) are false then 6: S = S ∪ Ci . 7: else 8: S = S ∪ S plit(Ci ) 9: end if 10: 11: end for 12: Return S . Algorithm 6: Recursive Splitting Algorithm Split such that its clusters splits Cl , Cr have both S toplocal (Cl ) and S toplocal (Cr ) as false. Then C is valid, i.e. Algorithm 2 does compute C some time during its execution, and there exists a cluster Ccentral in Ccentral such that C ⊆ Ccentral . Proof: The proof uses induction. For the base case, note that any singleton core is obviously valid. Now assume that C has cluster splits Cl and Cr , which by induction hypothesis, are valid. Then we show that C is also valid. Since S toplocal (Cl ) and S toplocal (Cr ) are false for the cluster splits of C , they do get merged with some clusters in Algorithm 2. Furthermore, by de finition of a core, Cl , Cr are closest to each other, hence they actually get merged with each other.Thus C = Cl ∪ Cr is constructed some during execution of Algorithm 2, and there exists a cluster Ccentral in its output that contains Cl ∪ Cr = C , completing the proof. Next we show the correctness of Algorithm 3. Due to lack of space, the proof is omitted and appears in the Appendix. Theorem 5.6 (Correctness): The distributed Algorithm 3 simulates the centralized Algorithm 2, i.e., it outputs the same clustering as Algorithm 2. Next we state the complexity result for single linkage clustering. We omit the proof as it is very similar to that of the complexity result for connected components. Theorem 5.7 (Single-linkage Runtime): If Hash-to-All is used in Algorithm 3, then it finishes in O(log n) map-reduce iterations and O(nV + E ) communication per iteration, where n denotes the size of the largest cluster. We also conjecture that if Hash-to-Min is used in Algo- rithm 3, then it finishes in O(log d) steps. V I . EX P ER IMENT S In this section, we experimentally analyze the performance of the proposed algorithms for computing connected compo- nents of a graph. We also evaluate the performance of our agglomerative clustering algorithms. Datasets: To illustrate the properties of our algorithms we use both synthetic and real datasets. • Movie: The movie dataset has movie listings collected from Y! Movies6 and DBpedia7 . Edges between two listings correspond to movies that are duplicates of one another; these edges are output by a pairwise matcher algorithm. Listings maybe duplicates from the same or 6 http://movies.yahoo.com/movie/*/info 7 http://dbpedia.org/ s n o i t a r e t i f o r e b m u N 30 25 20 15 10 5 Actual ⌈2 log d⌉ 4 6 8 10 12 14 logd (a) # of Iterations (max over 10 runs) Fig. 1. Analysis of Hash-to-Min on a path graph with random node orderings 9 Actual 3(V + E ) e z i s e t a i d e m r e t n i x a M 100000 1000 100 1000 100000 V + E (b) Largest intermediate data size (average 10 runs) s n o i t a r e t i f o r e b m u N 15 10 5 Actual ⌈2 log d⌉ 10 15 20 25 30 35 40 d Actual 3(V + E ) e z i s e t a i d e m r e t n i x a M 100000 1000 100 1000 100000 V + E (b) Largest intermediate data size (average 10 runs) (a) # of Iterations (max over 10 runs) Fig. 2. Analysis of Hash-to-Min on a tree graph with random node orderings different source, hence the sizes of connected components vary. The number of nodes V = 431, 221 (nearly 430K) and the number of edges E = 889, 205 (nearly 890K). We also have a sample of this graph (238K nodes and 459K edges) with weighted edges, denoted MovieW, which we use for agglomerative clustering experiments. • Biz: The biz dataset has business listings coming from two overlapping feeds that are licensed by a large internet company. Again edges between two businesses correspond to business listings that are duplicates of one another. Here, V = 10, 802, 777 (nearly 10.8M) and E = 10, 197, 043 (nearly 10.2M). We also have a version of this graph with weighted edges, denoted BizW, which we use for agglomerative clustering experiments. • Social: The Social dataset has social network edges between users of a large internet company. Social has V = 58552777 (nearly 58M) and E = 156355406 (nearly 156M). Since social network graphs have low diameter, we remove a random sample of edges, and generate SocialSparse. With E = 15, 638, 853 (nearly 15M), SocialSparse graph is more sparse, but has much higher diameter than Social. • Twitter: The Twitter dataset (collected by Cha et al [3]) has follower relationship between twitter users. Twitter has V = 42069704 (nearly 42M) and E = 1423194279 (nearly 1423M). Again we remove a random sample of edges, and generate a more sparse graph, TwitterSparse, with E = 142308452 (nearly 142M). • Synth: We also synthetically generate graphs of a vary- ing diameter and sizes in order to better understand the properties of the algorithms. A. Connected Components Algorithms: We compare Hash-Min, Hash-Greater-to-Min, Hash-to-All, Hash-to-Min and its load-balanced version Hash-to-Min∗ (Section IV). For Hash-Min, we use the open- source Pegasus implementation8, which has several optimiza- tions over the Hash-Min algorithm. We implemented all other algorithms in Pig9 on Hadoop10. There is no native support for iterative computation on Pig or Hadoop map-reduce. We implement one iteration of our algorithm in Pig and drive a loop using a python script. Implementing the algorithms on iterative map-reduce platforms like HaLoop [2] and Twister [7] is an interesting avenue for future work. 1) Analyzing Hash-to-Min on Synthetic Data: We start by experimentally analyzing the rounds complexity and space requirements of Hash-to-Min. We run it on two kinds of synthetic graphs: paths and complete binary trees. We use synthetic data for this experiment so that we have explicit 8 http://www.cs.cmu.edu/∼pegasus/ 9 http://pig.apache.org/ 10 http://hadoop.apache.org 10 (a) Group I:Runtimes (in minutes) (b) Group I: # of Map-Reduce jobs (c) Group II: Runtimes (in minutes) (d) Group II: # of Map-Reduce jobs Fig. 3. Comparison of Pegasus and our algorithms on real datasets. control over parameters d, V , and E . Later we report the performance of Hash-to-Min on real data as well. We use path graphs since they have largest d for a given V and complete binary trees since they give a very small d = log V . For measuring space requirement, we measure the largest intermediate data size in any iteration of Hash-to-Min. Since the performance of Hash-to-Min depends on the random ordering of the nodes chosen, we choose 10 different random orderings for each input. For number of iterations, we report the worst-case among runs on all random orderings, while for intermediates data size we average the maximum intermediate data size over all runs of Hash-to-Min. This is to verify our conjecture that number of iterations is 2 log d in the worst- case (independent of node ordering) and intermediate space complexity is O(V + E ) in expectation (over possible node orderings). For path graphs, we vary the number of nodes from 32 (25 ) to 524, 288 (219 ). In Figure 1(a), we plot the number of iterations (worst-case over 10 runs on random orderings) with respect to log d. Since the diameter of a path graph is equal to number of nodes, d varies from 32 to 524, 288 as well. As conjectured the plot is linear and always lies below the line corresponding to 2 log d. In Figure 1(b), we plot the largest intermediate data size (averaged over 10 runs on random orderings) with respect to V + E . Note that both x-axis and y-axis are in log-scale. Again as conjectured, the plot is linear and always lies below 3(V + E ). For complete binary trees, we again vary the number of nodes from 32 (25 ) to 524, 288 (219 ). The main difference from the path case is that for a complete binary tree, diameter is 2 log(V ) and hence the diameter varies only from 10 to 38. Again in Figure 2(a), we see that the rounds complexity still lies below the curve for 2 log d supporting our conjecture even for trees. In Figure 2(b), we again see that space complexity grows linearly and is bounded by 3(V + E ). 11 Input V E n Biz Movie SocialSparse 10.8M 10.1M 430K 890K 15M 58M 93 17K 2.9M Pegasus # MR jobs 36 60 60 Time 40 263 173 Hash-to-Min Time # MR jobs 29 7 17 7 59 11 Hash-Greater-to-Min Time # MR jobs 34 23 23 59 144 38 Hash-to-All Time # MR jobs 14 4 DNF DNF DNF DNF TABLE IV COM PA R I S ON O F P EGA S U S , H A S H - TO -M IN , H A S H -G R EAT ER -TO -M IN , AND H A S H - TO -A L L ON TH E G ROU P I DATA S E T S . T IM E I S AV ERAG ED OV ER 4 RUN S AND ROUND ED TO M I NU T E S . O P T IMA L T IM E S A P P EA R I N BO LD : I N A L L CA S E S E I TH ER H A S H - TO -M IN O R H A S H - TO -A L L I S O P T IMA L . Input V E n Social TwitterSparse Twitter 58M 156M 36M 42M 142M 24M 42M 1423M 42M Pegasus # MR jobs 20 12 12 Time 145 57 61 Hash-to-Min∗ Time # MR jobs 65 7 32 5 50 5 TABLE V COM PA R I S ON O F P EGA S U S AND TH E H A S H - TO -M I N∗ A LGO R I THM ON G ROU P I I DATA S E T S . T IM E I S AV ERAG ED OV ER 4 RUN S AND ROUND ED TO M I NU T E S . O P T IMA L T IM E S A P P EA R I N BO LD : I N A L L CA S E S , HM∗ I S O P T IMA L . (b) # of Map-Reduce jobs (a) Runtimes (in minutes) Fig. 4. Comparison of Hash-to-All and Hash-to-Min for single linkage clustering on BizW and MovieW. 2) Analysis on Real Data: We next compared Hash-to- Min, Hash-Greater-to-Min, and Hash-to-All algorithms on real datasets against Pegasus [10]. To the best of our knowledge, Pegasus is the fastest technique on MapReduce for computing connected components. Although all datasets are sparse (have average degree less than 3), each dataset has very different distribution on the size n of the largest connected components and graph diameter d. We partition our datasets into two groups – group I with d >= 20 and relatively small n, and group II with d < 20 and very large n. Group I: Graphs with large d and small n: This group includes Biz, Movie, and SocialSparse datasets that have large diameters ranging from 20 to 80. On account of large diameters, these graphs requires more MR jobs and hence longer time, even though they are somewhat smaller than the graphs in the other group. These graphs have small connected components that fit in memory. Each connected component in the Biz dataset represents the number of duplicates of a real-world entity. Since there are only two feeds creating this dataset, and each of the two feeds is almost void of duplicates, the size of most connected components is 2. In some extreme cases, there are more duplicates, and the largest connected component we saw had size 93. The Movie dataset has more number of sources, and consequently significantly more number of duplicates. Hence the size of some of the connected components for it is significantly larger, with the largest containing 17,213 no des. Finally, the SocialSparse dataset has the largest connected component in this group, with the largest having 2,945,644 nodes. Table IV summarizes the input graph parameters. It also includes the number of map-reduce jobs and the total runtime for all of the four techniques. Differences in the connected component sizes has a very interesting effect on the run-times of the algorithm as shown in Figures 3(a) and 3(b). On account of the extremely small size of connected components, runtime for all algorithms is fastest for the Biz dataset, even though the number of nodes and edges in Biz is larger than the Movie dataset. Hash-to-All has the best performance for this dataset, almost 3 times faster than Pegasus. This is to be expected as Hash-to-All just takes 4 iterations (in general it takes log d iterations) to converge. Since connected components are small, the replication of components, and the large intermediate data size does not affect its performance that much. We believe that Hash-to-All is the fastest algorithm whenever the intermediate data size is not a bottleneck. Hash-to-Min takes twice as many iterations (2 log d in general) and hence takes almost twice the time. Finally, Pegasus takes even more time because of a larger k 1 5 10 15 MR-k Completion Time median maximum 10:45 10:45 17:03 11:30 12:46 19:10 28:17 26:07 B S P-k Completion Time median maximum 7:40 7:40 11:20 8:05 15:49 23:39 64:51 43:37 TABLE VI M ED I AN AND MAX IMUM COM P L E T I ON T IM E S ( I N M I N : S EC ) F O R k CONN EC T ED COM P ON EN T J O B S D E P LOY ED S IMU LTAN EOU S LY U S I NG MA P - R EDU C E (M R - K ) AND G I RA P H ( B S P - K ) number of iterations, and a larger number of map-reduce jobs. For the Movie and SocialSparse datasets, connected com- ponents are much larger. Hence Hash-to-All does not finish on this dataset due to large intermediate data sizes. However, Hash-to-Min beats Pegasus by a factor of nearly 3 in the SocialSparse dataset since it requires a fewer number of iterations. On movies, the difference is the most stark: Hash- to-Min has 15 times faster runtime than Pegasus again due to significant difference in the number of iterations. Group II: Graphs with small d and large n: This group includes Social, TwitterSparse, and Twitter dataset that have a small diameter of less than 20, and results are shown in Figures 3(c) and 3(d) and Table V. Unlike Group I, these datasets have very large connected components, such that even a single connected component does not fit into memory of a single mapper. Thus we apply our robust implementation of Hash-to-Min (denoted Hash-to-Min∗ ) described in Sec. IV. The Hash-to-Min∗ algorithm is nearly twice as fast as pegasus, owing to reduction in the number of MR rounds. Only exception is the Twitter graph, where reduction in times is only 18%. This is because the Twitter graph has some nodes with very high degree, which makes load-balancing a problem for all algorithms. B. Single Linkage Clustering We implemented single linkage clustering on map-reduce using both Hash-to-All and Hash-to-Min hashing strategies. We used these algorithms to cluster the MovieW and BizW datasets. Figures 4(a) and 4(b) shows the runtime and number of map-reduce iterations for both these algorithms, respec- tively. Analogous to our results for connected components, for the MovieW dataset, we find that Hash-to-Min outperforms Hash-to-All both in terms of total time as well as number of rounds. On the BizW dataset, we find that both Hash-to- Min and Hash-to-All take exactly the same number of rounds. Nevertheless, Hash-to-All takes lesser time to complete that Hash-to-Min. This is because some clusters (with small n) finish much earlier in Hash-to-All; finished clusters reduce the amount of communication required in further iterations. C. Comparison to Bulk Synchronous Parallel Algorithms Bulk synchronous parallel (BSP) paradigm is generally con- sidered more efficient for graph processing than map-reduce as it has less setup and overhead costs for each new iteration. While the algorithmic improvements of reducing number of iterations presented in this paper are important independent of the underlying system used, these improvements are of less significance in BSP due to low overhead of additional iterations. 12 In this section, we show that BSP does not necessarily dominate Map-Reduce for large-scale graph processing (and thus our algorithmic improvements for Map-Reduce are still relevant and important). We show this by running an interest- ing experiment in shared grids having congested environments. We took the Movie graph and computed connected compo- nents using Hash-to-Min (map-reduce, with 50 reducers) and using Hash-Min11 on Giraph [4] (BSP, with 100 mappers), an open source implementation of Pregel [16] for Hadoop. We deployed k = 1, 5, 10, and 15 copies of each algorithm (denoted by MR-k and B S P-k), and tracked the maximum and median completion times of the jobs. The jobs were deployed on a shared Hadoop cluster with 454 map slots and 151 reduce slots, and the cluster experienced normal and equal load from other unrelated tasks. Table VI summarizes our results. As expected, B S P-1 out- performs MR-1;12 unlike map-reduce, the BSP paradigm does not have the per-iteration overheads. However, as k increases from 1 to 15, we can see that the maximum and median completion times for jobs increases at a faster rate for B S P-k than for MR-k. This is because the BSP implementation needs to hold all 100 mappers till the job completes. On the other hand, the map-reduce implementation can naturally parallelize the map and reduce rounds of different jobs, thus eliminating the impact of per round overheads. So it is not surprising that while all jobs in MR-15 completed in about 20 minutes, it took an hour for jobs in B S P-15 to complete. Note that the cluster con figurations favor BSP implementations since the reducer capacity (which limits the map-reduce implementation of Hash-to-Min) is much smaller (< 34%) than the mapper capacity (which limits the BSP implementation of Hash-Min). We also ran the experiments on clusters with higher ratios of reducers to mappers, and we observe similar results (not included due to space constraints) showing that map-reduce handles congestion better than BSP implementations. V I I . CONCLU S ION S AND FUTURE WORK In this paper we considered the problem of find connected components in a large graph. We proposed the first map- reduce algorithms that can find the connected components in logarithmic number of iterations – (i) Hash-Greater-to- Min, which provably requires at most 3 log n iterations with high probability, and at most 2(V + E ) communication per iteration, and (ii) Hash-to-Min, which has a worse theoreti- cal complexity, but in practice completes in at most 2 log d iterations and 3(V + E ) communication per iteration; n is the size of the largest component and d is the diameter of the graph. We showed how to extend our techniques to the problem of single linkage clustering, and proposed the first algorithm that computes a clustering in provably O(log n) iterations. RE F ERENCE S [1] F. N. Afrati, V. Borkar, M. Carey, N. Polyzotis, and J. D. Ullman. Map- reduce extensions and recursive queries. In EDBT, 2011. 11Hash-Min is used as it is easier to implement and not much different than Hash-to-Min in terms of runtime for BSP environment 12 The time taken for M R-1 is different in Tables IV and VI since they were run on different clusters with different number of reducers (100 and 50 resp.). 13 [2] Y. Bu, B. Howe, M. Balazinska, and M. D. Ernst. Haloop: Effi cient iterative data processing on large clusters. In VLDB, 2010. [3] M. Cha, H. Haddadi, F. Benevenutoz, and K. P. Gummadi. Measuring user influence in twitter: The million follower fallacy. In ICWSM, 2010. [4] A. Ching and C. Kunz. Giraph : Large-scale graph processing on hadoop. In Hadoop Summit, 2010. [5] J. Cohen. Graph Twiddling in a MapReduce World. Computing in Science and Engineering, 11(4):29–41, July 2009. [6] J. Dean and S. Ghemawat. Mapreduce: simplified data proce ssing on large clusters. Commun. ACM, 51, January 2008. [7] J. Ekanayake, H. Li, B. Zhang, T. Gunarathne, S.-H. Bae, J. Qiu, and G. Fox. Twister: A runtime for iterative mapreduce. In MAPREDUCE, 2010. [8] H. Gazit. An optimal randomized parallel algorithm for fi nding con- nected components in a graph. SIAM J. Comput., 20(6):1046–1067, 1991. [9] D. B. Johnson and P. Metaxas. Connected components in o(log3/2n) parallel time for the crew pram. J. Comput. Syst. Sci., 54(2):227–242, 1997. [10] U. Kang, C. E. Tsourakakis, and C. Faloutsos. PEGASUS: A Peta-Scale Graph Mining System- Implementation and Observations. 2009. [11] D. R. Karger, N. Nisan, and M. Parnas. Fast connected components algorithms for the erew pram. SIAM J. Comput., 28(3):1021–1034, 1999. [12] H. J. Karloff, S. Suri, and S. Vassilvitskii. A model of computation for mapreduce. In SODA, 2010. [13] A. Krishnamurthy, S. S. Lumetta, D. E. Culler, and K. Yelick. Connected components on distributed memory machines. In Parallel Algorithms: 3rd DIMACS Implementation Challenge, 1994. [14] H. R. Lewis and C. H. Papadimitriou. Symmetric space-bounded computation. Theor. Comput. Sci., 19:161–187, 1982. [15] J. Lin and C. Dyer. Data-Intensive Text Processing with MapReduce. Morgan & Claypool Publishers, 2010. [16] G. Malewicz, M. H. Austern, A. J. Bik, J. C. Dehnert, I. Horn, N. Leiser, and G. Czajkowski. Pregel: a system for large-scale graph processing. In SIGMOD, 2010. [17] S. J. Plimpton and K. D. Devine. MapReduce in MPI for Large-scale Graph Algorithms. Special issue of Parallel Computing, 2011. [18] J. Reif. Optimal parallel algorithms for interger sorting and graph connectivity. In Technical report, 1985. [19] T. Seidl, B. Boden, and S. Fries. CC-MR - finding connecte d compo- nents in huge graphs with mapreduce. In ECML/PKDD (1), 2012. [20] Y. Shiloach and U. Vishkin. An O( log n ) parallel connectivity algorithm. Journal of Algorithms, 3:57–67, 1982. A P P END IX 14 A. Proof of Theorem 3.6 We first restate Theorem 3.6 below. Theorem A.1 (3.6): Let G = (V , E ) be a path graph (i.e. a tree with only nodes of degree 2 or 1). Then, Hash-to-Min correctly computes the connected component of G = (V , E ) in 4 log n map-reduce rounds. To prove the above theorem, we first consider path graphs when node ids increase from left to right. Then we show the result for path graphs with arbitrary ordering. Lemma A.2: Consider a path with node ids increasing from the left to right. Then after k iterations of the Hash-to-min algorithm, • For every node j within a distance of 2k from the minimum node m, m knows j and j knows m. • For every pair of nodes i, j that are a distance 2k apart, i knows j and j knows k . • Node j is not known to and does not know any node i that is at a distance > 2k . Proof: The proof is by induction. Base Case: After 1 iterations, each node knows about its 1-hop and 2-hop neighbors (on either side). Induction Hypothesis: Suppose the claim holds after k − 1 iterations. Induction Step: In the k th iteration, consider a node j that is at a distance d from the min node m, where 2k−1 < d ≤ 2k . From the induction hypothesis, there is some node i that is 2k−1 away from j that knows j . Since, m is known to i (from induction hypothesis), the Hash-to-min algorithm would send j to m and m to j in the current iteration. Therefore, m knows j and m is known to j . Consider a node j that is > 2k distance from the min node. At the end of the previous iteration, j knew (and was known to) i, and i knew and was known to i′ – where i and i′ are at distance 2k−1 from j and i respectively. Moreover, i did not know any node i′′ smaller than i′ . Therefore, in the current iteration, i sends i′ to j and j to i′ . Therefore, j knows and is known to a node that is 2k distance away. Finally, we can show that a node does not know (and is not known to) any node that is distance > 2k as follows. Node j can only get a smaller node i′ if i′ is a minimum at some node i. Since in the previous step no one knows a node at distance > 2k−1 , j cannot know a node at distance > 2k . Now we extend the proof for arbitrary path graphs. Denote mink (u) the minimum node after k iterations that u knows that also knows u. Also denote ∆(u, v) the distance between node u and v . De finition A.3 (Local Minima): A node v is local minimum if all its neighbors have id larger than v ’s id. For a path graph, we de fine the notion of levels below. De finition A.4 (Levels): Given a path, level 0 consists of all nodes in the path. Level i is then de fined recursively as nodes that are local minimum nodes among the nodes at level i − 1, if the level i − 1 nodes are arranged in the order in which they occur in the path. Denote the set of nodes at level i as level(i). Proposition A.5: The number of levels having more than 1 node is at most log n. Proof: The proof follows from the fact that for each level i, no consecutive nodes can be local minimum. Hence level(i) ≤ level(i − 1)/2). Lemma A.6: Consider a path P with three segments P1 , P2 and P3 , where P1 and P3 are arbitrary, and P2 has r + 1 level ℓ nodes l1 , l2 , ...lr , m1 going from left to right. Assume that labels are such that l1 < l2 < . . . < lr . For a node li , denote l(li , k , ℓ) the closest level ℓ node lj from li towards the right such that mink (lj ) > li . Denote T (k , ℓ) and M (k , ℓ) as ∆(li , l(li , k , ℓ)) T (k , ℓ) = minP,li :l(li ,k,ℓ) 6=lr and . M (k , ℓ) = minP :mink (l1 )>mink−1 (m1 ) or mink (m1 )>mink−1 (l1 )∆(l1 , m1 ) Then the following is true: 1) T satisfies the following recurrence realtion T (k , ℓ) ≥ min(T (k − 2, ℓ) + min(T (k − 1, ℓ), M (k , ℓ), M (k − 1, ℓ − 1)) 2) M satisfies the following recurrence relation M (k , ℓ) ≥ min(T (k − 2, ℓ), M (k − 1, ℓ − 1)) Proof: Denote by [lt , lu ] the level ℓ nodes between lt and lu , and [lt , lu ) those nodes except for lu . Proof of claim 1: Let ls = l(li , k − 1, ℓ) and let lt be the level ℓ node just to the left of ls . We know by de finition of ls = l(li , k − 1, ℓ) that mink−1 (ls ) > li , but for all l ∈ [li , lt ], mink−1 (l) ≤ li . Now there are three cases: 1) mink−1 (lt ) ∈ P3 . Then mink−1 (lt ) ≤ li (from above), and any node l ∈ [lt , lr ] would have mink−1 (l) ∈ P3 ≤ mink−1 (lt ). Hence mink−1 (l) ≤ li for all l ∈ {li , . . . , lr }. Thus l(li , k − 1) = lr . 2) mink−1 (lt ) /∈ P3 and ∆(li , lt ) ≥ T (k − 1, ℓ). Denote lu = l(lt , k − 1, ℓ). Consider any l ∈ [lt , lu ). Let a = mink−1 (l). lu = l(lt , k − 1) and since l ∈ [lt , lu ), we know that, a = mink−1 (l) ≤ lt . Now there are Then from the de finition of two sub-cases: 15 a) For all l ∈ [lt , lu ), a = mink−1 (l) /∈ P3 ∪ {m1}. In this case, we show that l(li , k , ℓ) is a level ℓ node in [lu , lr ]. For this we will show that for all l ∈ [lt , lu ) and a = mink−1 (l), mink−1 (a) ≤ li . If a /∈ P3 ∪ {m1}, then either (i) a ∈ P1 , in which case a ≤ l1 (otherwise mink−1 (l) would be l1 and not a), and hence obviously mink−1 (a) ≤ li , or (ii) a ∈ P2 but a 6= m1 , and then since a ≤ lt (from above), a ∈ [li , lt ]. Hence mink−1 (a) ≤ li . In other words, after k − 1 iterations, the minimum for any node l ∈ [lt , lu ) is a, which in turn has a minimum b ≤ li . Thus in one Hash-to-Min step, b would become mink (l). Hence after k iterations and for any local minimum l between li and lu , we have mink (l) ≤ li . This shows that l(li , k , ℓ) ∈ [lu , lr ]. Then either lu is lr or the following holds. ∆(li , l(li , k , ℓ)) ≥ ∆(li , lt ) + ∆(lt , lu ) ≥ T (k − 2, ℓ) + T (k − 1, ℓ − 1) b) There exists l ∈ [lt , lu ), such that a = mink−1 (l) ∈ P3 . Let lw = l(li , k , ℓ). Then lw is the first node in [li , lr ] for which mink (lw ) > li . If ∆(lv , lw ) ≤ M (k , ℓ) then by de finition after k iterations mink (lw ) ≤ mink−1 (lt ) ≤ li . Thus ∆(lw , li ) ≥ M (k , ℓ). Thus ∆(li , l(li , k , ℓ)) ≥ ∆(li , lt ) + ∆(lt , lw ) ≥ T (k − 2, ℓ) + M (k , ℓ) 3) mink−1 (lt ) ∈ P1 P2 and ∆(li , lt ) ≤ T (k − 2, ℓ). In this case, we argue that ∆(lt , ls ) > M (k − 1, ℓ − 1). Assume the contrary: ∆(lt , ls ) ≤ M (k − 2, ℓ − 1). Since, ∆(li , lt ) ≤ T (k − 2, ℓ), we know that mink−2 (lt ) ≤ li . Since lt and ls are consecutive level ℓ nodes, all the level ℓ − 1 nodes between them are ordered. Hence by de finition of M (k − 1, ℓ − 1), and the fact that ∆(lt , ls ) ≤ M (k − 1, ℓ − 1), mink−1 (ls ) ≤ mink−2 (lt ) ≤ li . This contradicts the assumption that ls = l(li , k − 1, ℓ). Thus ∆(lt , ls ) > M (k − 1, ℓ − 1). ∆(li , l(li , k)) ≥ ∆(li , lt ) + ∆(lt , ls ) ≥ M (k − 1, ℓ − 1) Combining the above cases we complete the proof of claim 1. Proof of claim 2: If ∆(l1 , lr ) ≤ T (k−2, ℓ), then mink−2 (lr ) ≤ l1 . Also if ∆(lr , m1 ) ≤ M (k−1, ℓ−1), then mink−1 (m1 ) ≤ mink−2 (lr ) ≤ l1 . If both ∆(l1, lr ) ≤ T (k − 2, ℓ) and ∆(lr , m1 ) ≤ M (k − 1, ℓ − 1), then mink−1 (m1 ) ≤ l1 . Hence by claim 1, mink (m) ≤ mink−1 (l1 ). This completes the proof. Lemma A.7: Let T (k , ℓ) be the quantity as de fined in Lemma A.6. Then T (k , ℓ) ≥ 2k/2−ℓ . Proof: We prove the lemma using induction. Base Cases: (i) ℓ = 0 and k ≥ 1. Then by Lemma A.2, T (k , 0) ≥ 2k ≥ 2k/2−0 . (ii) k = 1 and ℓ ≥ 1. For any level ℓ ≥ 1, T (1, ℓ) ≥ 1 ≥ 21/2−ℓ . Induction Hypothesis (IH) For all k0 ≤ k − 1 and ℓ0 ≤ ℓ − 1, T (k0 , ℓ0 ) ≥ 2k0 /2−ℓ0 Induction Step: By Lemma A.6, we know that: T (k , ℓ) ≥ min (T (k − 1, ℓ) + T (k − 2, ℓ), T (k − 2, ℓ − 1)) ≥ min (cid:16)2(k−1)/2−ℓ + 2(k−2)−ℓ , 2(k−2)/2−ℓ+1(cid:17) (using IH) ≥ min (cid:16)2k/2−ℓ (1/2 + 1/√2), 2k/2−ℓ (cid:17) ≥ 2k/2−ℓ Finally, we can complete the proof of Theorem 3.6. Since T (k , l) is less than the length of the path, we know that T (k , l) < n. Now from Prop. A.5, the number of levels having more than 1 node is at most log n. Hence ℓ ≤ log n. Finally, from Lemma A.7, we know that T (k , ℓ) ≥ 2k/2−ℓ . Thus 2k/2−log n ≤ 2k/2−ℓ ≤ n. Thus k ≤ 4 log n. This completes the proof of Theorem 3.6. B. Proof of Theorem 3.9 We first restate Theorem 3.9 below. Theorem A.8 (3.9): Algorithm Hash-Greater-to-Min correctly computes the connected components of G = (V , E ) in expected 3 log n map-reduce rounds (expectation is over the random choices of the node ordering) with 2(V + E ) communication per round in the worst case. Proof: After 3k rounds, denote Mk = {min(Cv ) : v ∈ V } the set of nodes that appear as minimum on some node. For a minimum node m ∈ Mk , denote GTk (m) the set of all nodes v for which m = min(Cv ). Then by Lemma 3.8, we know that GTk (m) = C≥(m) after 3k rounds. Obviously ∪m∈Mk GTk (m) = V and for any m, m′ ∈ Mk , GTk (m) ∩ GTk (m′ ) = ∅. Consider the graph GMk with nodes as Mk and an edge between m ∈ Mk to m′ ∈ Mk if there exists v ∈ GTk (m) and v ′ ∈ GTk (m′ ) such that v , v ′ are neighbors in the input graph G. If a node m has no outgoing edges in GMk , then GTk (m) forms a connected component in G disconnected from other components, this is because, then for all v ′ /∈ GTk (m), there exists no edge to v ∈ GTk (m). 16 We can safely ignore such sets GTk (m). Let M Ck be the set of nodes in GMk that have at least one outgoing edge. Also if m ∈ M Ck has an edge to m′ < m in GMk , then m will no longer be the minimum of nodes v ∈ GTk (m) after 3 additional rounds. This is because there exist nodes v ∈ GTk (m) and v ′ ∈ GTk (m′ ), such that v and v ′ are neighbors in G. Hence in the first round of Hash-Min, v ′ will send m′ to v . In the second round of Hash-Min, v will send m′ to m. Hence finally m will get m′ , and in the round of Hash-Greater-to-Min, m will send GTk (m) to m′ . If M Ck = l , W.L.O.G, we can assume that they are labeled 1, 2, . . . , l (since only relative ordering between them matters anyway). For any set, GTk (m), the probability that it its min m′ ∈ (l/2, l] after 3 more rounds is 1/4. This is because that happens only when m ∈ [(l/2, l) and all its neighbors m′ ∈ GMk are also in (l/2, l]. Since there exist at least one neighbor m′ , the probability of m′ ∈ (l/2, l] is at most 1/2. Hence the probability of any node v having a min m′ ∈ (l/2, l] after 3 more rounds is 1/4. Now since no set, GTk (m), ever get splits in subsequent rounds, the expected number of cores is 3l/4 after 3 more rounds. Hence in three rounds of Hash-Greater-to-Min, the expected number of cores reduces from l to 3l/4, and therefore it will terminate in expected 3 log n time. The communication complexity is 2(V + E ) per round in the worst-case since the total size of clusters is Pv C≥v = 2(V ). C. Proof of Theorem 5.6 We first restate Theorem 5.6 below. Theorem A.9 (5.6): The distributed Algorithm 3 simulates the centralized Algorithm 2, i.e., it outputs the same clustering as Algorithm 2. Proof: Let Ccentral be the clustering output by Algorithm 2. Let Cdistributed be the clustering output by Algorithm 3. We show the result in two parts. First, for any cluster Cdistributed ∈ Cdistributed , there exists a cluster Ccentral ∈ Ccentral such that Cdistributed ⊆ Ccentral . Since Algorithm 3 uses the splitting algorithm 6, it outputs only cores having cluster splits Cl , Cr for which S toplocal (Cl ) and S toplocal (Cr ) equal false. Thus we can invoke Lemma 5.5 on Cdistributed to prove that Cdistributed is valid, and the existence of Ccentral such that Cdistributed ⊆ Ccentral . Having shown that Cdistributed ⊆ Ccentral , we now show that, in fact, Cdistributed = Ccentral . Assume the contrary, i.e. Cdistributed ⊂ Ccentral . Since Cdistributed is valid, even the centralized algorithm constructed Cdistributed some time during its execution, and then merged it with some other cluster, say C ′ central . Since Cdistributed is in the output of Algorithm 3, then three cases are pospsible: (i) Cdistributed forms a connected component by itself, disconnected from the rest of the graph, or (ii) S toplocal (Cdistributed ) is true, and the algorithm stops because of the stopping condition, or (iii) S toplocal (Cdistributed ) is false, but it merges with some cluster C ′ distributed for which distributed ) is true. In the first two cases, even the centralized algorith m can not merge Cdistributed with any other S toplocal (C ′ cluster, contradicting that Cdistributed ⊂ Ccentral . central with Ccentral , central . Since the central algorithm merges C ′ For case (iii), we show below that in fact C ′ distributed ⊆ C ′ distributed ) has to central , S toplocal (C ′ central ) has to be false. Since S toplocal is monotonic, and C ′ distributed ⊆ C ′ S toplocal (C ′ be false as well, contradicting the assumption made in case (iii). Thus we proved all three cases are impossible, contradicting our assumption of Cdistributed ⊂ Ccentral . Hence Cdistributed = Ccentral . central have to be closest to Cdistributed , i.e. in distributed and C ′ central . Both C ′ Now we show that C ′ distributed ⊆ C ′ nbrs(Cdistributed ), in order to get merged with it in either the central or distributed algorithms. Denote v to be the node, such that the singleton cluster {v} is in nbrs(Cdistributed ). Hence, by the property of single linkage clustering, both C ′ distributed distributed is valid, there must be a cluster in the central algorithm’s output and C ′ central must contain the node v . Since C ′ containing it. Finally, since clusters in the output have to be disjoint, the cluster containing C ′ distributed has to be C ′ central , and thus C ′ central . distributed ⊆ C ′
1202.2792
1
1202
2012-02-13T17:09:58
On the Hardness of Welfare Maximization in Combinatorial Auctions with Submodular Valuations
[ "cs.DS", "cs.GT" ]
We present a new type of monotone submodular functions: \emph{multi-peak submodular functions}. Roughly speaking, given a family of sets $\cF$, we construct a monotone submodular function $f$ with a high value $f(S)$ for every set $S \in {\cF}$ (a "peak"), and a low value on every set that does not intersect significantly any set in $\cF$. We use this construction to show that a better than $(1-\frac{1}{2e})$-approximation ($\simeq 0.816$) for welfare maximization in combinatorial auctions with submodular valuations is (1) impossible in the communication model, (2) NP-hard in the computational model where valuations are given explicitly. Establishing a constant approximation hardness for this problem in the communication model was a long-standing open question. The valuations we construct for the hardness result in the computational model depend only on a constant number of items, and hence the result holds even if the players can answer arbitrary queries about their valuation, including demand queries. We also study two other related problems that received some attention recently: max-min allocation (for which we also get hardness of $(1-\frac 1 {2e}+\epsilon)$-approximation, in both models), and combinatorial public projects (for which we prove hardness of $(3/4+\epsilon)$-approximation in the communication model, and hardness of $(1 -\frac 1 e+\epsilon)$-approximation in the computational model, using constant size valuations).
cs.DS
cs
On the Hardness of Welfare Maximization in Combinatorial Auctions with Submodular Valuations Shahar Dobzinski Jan Vondr´ak August 8, 2018 Abstract We present a new type of monotone submodular functions: multi-peak submodular functions. Roughly speaking, given a family of sets F, we construct a monotone submodular function f with a high value f (S) for every set S ∈ F (a "peak"), and a low value on every set that does not intersect significantly any set in F. We use this construction to show that a better than (1 − 1 2e )-approximation (≃ 0.816) for welfare maximization in combinatorial auctions with submodular valuations is (1) impossible in the communica- tion model, (2) NP-hard in the computational model where valuations are given explicitly. Establishing a constant approximation hardness for this problem in the communication model was a long-standing open question. The valuations we construct for the hardness result in the computational model depend only on a constant number of items, and hence the result holds even if the players can answer arbitrary queries about their valuation, including demand queries. We also study two other related problems that received some attention recently: max-min allocation 2e + ǫ)-approximation, in both models), and combinatorial public 4 +ǫ)-approximation in the communication model, and hardness (for which we also get hardness of (1 − 1 projects (for which we prove hardness of ( 3 of (1 − 1 e + ǫ)-approximation in the computational model, using constant size valuations). 1 Introduction In a combinatorial auction there are k players and a set of M items (M = m). Each players i has a valuation function vi : 2M → R+. In this paper we use the standard assumption that the valuation functions are non-decreasing and that vi(∅) = 0. The goal is to find an allocation of the items (S1, . . . , Sk) to maximize the social welfare Σivi(Si). There is extensive literature on combinatorial auctions, and the two most popular lines of research in this area are the design of computationally efficient truthful mechanisms for combinatorial auctions and the development of (non-truthful) approximation algorithms (for various restricted classes of valuations, such as subadditive [13, 10] or submodular [21, 16]). This paper belongs to the latter type. Specifically, we consider the case where the valuation functions are submodular, and ask what is the best approximation of the optimum social welfare that is achievable in polynomial time. The case of players with submodular valuations unique because of two reasons. First, submodular valuations have a natural economic interpretation of decreasing marginal utilities. Second, the rich literature on submodular optimization makes the study of combinatorial auctions with submodular valuations an ideal midway point for the exchange of techniques and ideas between algorithmic game theory and combinatorial optimization. We would like our algorithms to run in time that is polynomial in k and m. However, in a naive representation of the valuation function we may have to specify one number for each possible bundle, so the total size is exponential in m. Algorithms for combinatorial auctions usually assume that the valuations are represented by oracles. The algorithm is assumed to make only a polynomial number of queries to the oracles. Popular queries include the value query (given a set S, what is v(S)?) and the stronger demand oracle (given prices p1, . . . , pm return a bundle S ∈ arg max v(S)−Σi∈Spi). The state of the art is an (1−1/e)- approximation that uses value queries only [26] (which is optimal in the value oracle model [19, 22]), and a 1 (1 − 1/e + δ)-approximation that uses demand queries only [17] (where δ > 0 is some small constant). As one can observe from these results, different oracles may potentially enable us to obtain different approximation ratios. Our goal in this paper is to prove hardness results that will hold for every oracle. The literature contains two approaches to deal with this issue: • Communication complexity: Nisan and Segal pioneered this approach [24, 25]. Players can trans- mit any information and thus answer any possible oracle query, but the number of bits transmitted is polynomially bounded. The algorithm and the players are conservatively assumed to be computation- ally unbounded. • Constant-size valuations: This approach was introduced in [17]. Each player has a valuation function that depends non-trivially only on a constant number of items, and its full description is available to the algorithm (so any query whose answer depends only on the valuation can be answered in constant time -- see a discussion in [16]). The algorithm is required to run in polynomial time. The two approaches are conceptually at two opposite ends of the spectrum: either arbitrarily complex valuations and infinite computational power, limited only by the communication bottleneck, or extremely succinct valuations and a polynomial-time algorithm. 1.1 Our Main Result: The Hardness of Welfare Maximization We prove the following hardness result for welfare maximization, with the same factor in both models. Theorem 1.1. For welfare maximization with submodular valuations, a (1 − 1 constant ǫ > 0 requires exponential communication. For constant-size submodular valuations, a (1 − 1 approximation would imply P = N P . 2e + ǫ)-approximation for any 2e + ǫ)- We note that previously, only (1 − o(1))-hardness was known in the communication complexity model, and we show the first constant-factor hardness in this model (this question was open since the seminal paper of Nisan and Segal [25]). In particular, this settles affirmatively a conjecture of [10]. NP-hardness of (1 − ρ)-approximation for some very small ρ > 0 was known for constant-size submodular valuations [16]. Each of our results implies hardness of (1− 1 2e +ǫ)-approximation in the demand oracle model, because de- mand queries can be simulated in polynomial communication, and because demand queries can be efficiently implemented for constant-size valuations. This improves the known NP-hardness of ( 15 16 +ǫ)-approximation in the demand oracle model by Chakrabarty and Goel [8]. We stress that our results apply to any "reasonable" oracle model and not just to the demand oracle model; see also the discussion in [16]. We remark that the communication complexity result holds even for a constant number of players, in the sense that for every ǫ > 0 there is some fixed k ≥ 2 such that the hardness result holds for k players. For the special case of 2 players, we get the following. Theorem 1.2. For welfare maximization with 2 players with submodular valuations, a ( 17 for any ǫ > 0 requires exponential communication. 18 +ǫ)-approximation For constant-size valuations, we clearly need a superconstant number of players, otherwise the problem can be solved in constant time. 1.2 Our Techniques At the heart of our hardness proofs is a new construction of submodular functions, which has been the stumbling block of previous attempts to prove similar results. We call these multiple-peak submodular func- tions: given a family of (possibly overlapping, exponentially many) sets F , we want a monotone submodular function with high value f (S) for every set S ∈ F (a "peak"), and a low value on every set that does not intersect significantly any set in F . The precise parameters depend on the family F , in particular how much the sets in F are allowed to overlap. As an aside, this construction goes in the opposite direction to the 2 Problem Approximation CC hardness (2 players) CC hardness NP-hardness submodular welfare submodular max-min∗ submodular CPP 1 − 1/e + δ 1 − 1/e 1 − 1/e 17/18 17/18 7/8 1 − 1/(2e) 1 − 1/(2e) 3/4 1 − 1/(2e) 1 − 1/(2e) 1 − 1/e Figure 1: Summary of our hardness results: "CC hardness" refers to communication complexity, or more precisely inapproximability under polynomial communication, and "NP-hardness" refers to inapproximability for constant-size valuation functions. The approximation results shown here are in the demand oracle model for submodular welfare [17], in the value oracle model for submodular max-min allocation (∗for a constant number of players) [9], and in the value oracle model for submodular CPP [23]. In the value oracle model, 1 − 1/e is optimal for all 3 problems. (very different) construction of Balcan and Harvey [4], where a submodular function is constructed that has very low value on a given family of sets. This construction is then leveraged in two possible ways: for communication complexity, we use the general framework introduced by Nisan [24]. We use the probabilistic method to prove the existence of an exponentially large family F and show a reduction from the Set Disjointness problem. Each player has a multiple-peak submodular valuation corresponding to a family Fi, where either there is a choice of sets Si ∈ Fi that are "consistent" (disjoint/equal, depending on the problem), or not - distinguishing these two cases requires exponential communication. For NP-hardness results, we start from Feige's proof of inapproximability of Max k-cover [14]. Then we use the coverage system to construct an instance with multi-peak submodular functions. In the YES case, the instance contains matching sets, providing high value for each player, while in the NO case, some players are forced to receive low value. In addition, Feige's construction guarantees that the valuation functions depend only on a constant (albeit large) number of items. Hence the computational hardness result applies even if the bidders have constant-size valuations. 1.3 Other Results We use the new multiple-peak submodular functions to prove hardness results for every oracle in two other related settings. One is Combinatorial Public Projects (CPP), where we seek a single set S of at most k i=1 vi(S). Another one is the Max-min Allocation Problem, where we want to allocated items, maximizing Pn disjoint sets of items Si in order to maximize min1≤i≤k vi(Si). Combinatorial Public Projects. For CPP there is an (1 − 1/e)-approximation that can be achieved using value queries only [23]. We show that this is optimal in any arbitrarily powerful oracle model even for constant size valuation, hence strengthening previous result that showed that this result cannot be improved using demand queries [6]. We note that the situation is different for the welfare maximization, where 1 − 1/e is optimal for value queries but not optimal if demand queries are allowed [17]. No constant-factor communication complexity hardness was previously known for the CPP problem. Theorem 1.3. For the CPP problem with submodular valuations, a ( 3 requires exponential communication. For 2 players with submodular valuations, a ( 7 any ǫ > 0 requires exponential communication. For constant-size submodular valuations, a (1 − 1 approximation would imply P = N P . 4 + ǫ)-approximation for any ǫ > 0 8 + ǫ)-approximation for e + ǫ)- Max-min Allocation. Finally, our results for Welfare Maximization also apply to the Submodular Max- min Allocation problem. The problem of obtaining a max-min allocation was quite heavily studied recently [5, 3, 12, 2, 7], and most of the work concentrated on cases where the valuations are special cases of sub- modular valuations. It is known that the Submodular Max-min Allocation problem admits a (1 − 1/e − ǫ)- approximation for any fixed ǫ > 0 and any fixed number of players k [9], and this is optimal in the value oracle model, if we want approximation independent of k [22]. Our hardness results also hold for a fixed 3 number of players k (approaching 1 − 1 2e for k fixed but large), and they are independent of a particular oracle model. When the number of players is not fixed, the problem is less understood, and the best known approximation is O(m1/2+ǫ) [18, 7]. Theorem 1.4. For Max-min Allocation with submodular valuations, a (1− 1 0 requires exponential communication. For constant-size submodular valuations, a (1 − 1 would imply P = N P . For Max-min Allocation with 2 players with submodular valuations, a ( 17 approximation for any ǫ > 0 requires exponential communication. 2e +ǫ)-approximation for any ǫ > 2e + ǫ)-approximation 18 + ǫ)- The proof is obtained by a straightforward adaption of the proof for Welfare Maximization, as we explain in Section 4.3. Organization. The rest of the paper is organized as follows. In Section 2, we give the necessary prelimi- naries. In Section 3, we present the construction of multiple-peak submodular functions, the main technical ingredient of our proofs. In Section 4, we present the proofs for Welfare Maximization, and we also note why they apply to Max-min Allocation. In Section B, we present the proofs for Combinatorial Public Projects. 2 Preliminaries A function f : {0, 1}n → R is submodular if f (A) + f (B) ≥ f (A ∪ B) + f (A ∩ B) for all A, B (and sets are naturally identified with {0, 1} vectors). By calling a function monotone, we mean non-decreasing, i.e. f (A) ≤ f (B) for all A ⊆ B. We use the following connection between continuous and discrete submodular functions (slightly modifying the conditions used in [20] and [27], where "smooth submodular functions" were used). Definition 2.1. We call a function F : [0, 1]n → R continuous submodular, if all of the following conditions hold: • F is absolutely continuous1 on every line segment of direction ei, for every i. • The partial derivative ∂F ∂xi is defined almost everywhere on every line segment of direction ei. • ∂F ∂xi is non-increasing with respect to every coordinate. Lemma 2.2. If F : [0, 1]n → R is continuous submodular, then its restriction to {0, 1}n is submodular. Proof. Since F is absolutely continuous, we can express differences between point values by integrating the partial derivatives: assuming that x ∈ {0, 1}n and xi = xj = 0, F (x + ei) − F (x) = Z 1 0 ∂F ∂xi(cid:12)(cid:12)(cid:12)x+tei dt. Since ∂F ∂xi is non-increasing with respect to every coordinate, in particular xj , we get This means that F restricted to {0, 1}n is submodular. F (x + ei + ej) − F (x + ej) ≤ F (x + ei) − F (x). In this paper, (x)+ = max{x, 0} denotes the positive part of a number. We remark that when we write +, we mean (max{x, 0})2, i.e. for x < 0 this quantity is 0. (x)2 1A function F : R → R is absolutely continuous if for every ǫ > 0 there is δ > 0 such that whenever Pi xi − yi < δ, Pi F (xi) − F (yi) < ǫ. 4 3 Construction of Multiple-Peak Submodular Valuations In this section, we construct a new class of submodular functions. These functions are the main technical elements of our hardness results. Given a family of sets F , we would like to define a function that has a high value on each set in F , and low value on every set that does not overlap any set in F very much. We call these functions multiple-peak submodular valuations. The construction is inspired by the "continuous point of view", which has been used in previous work on submodular optimization [22, 26, 27], and the connection between continuous and discrete submodular functions given by Lemma 2.2. Suppose we start from a continuous submodular function F : [0, 1]M → R+ that depends only on the sum of coordinates P xi, in particular F (x) = 1 − (1 − aP xi)2 +. In addition, we have a collection F of vertices of the hypercube that should become the "peaks" of the function, i.e. their value should be increased compared to F (x). We define a region of the hypercube BA ⊂ [0, 1]M around each vertex A ∈ F , such that these regions are disjoint. Then if we modify the function F so that it is continuous submodular on each region separately, and first partial derivatives are continuous on the boundary of each region, then the resulting function is still continuous submodular. Crucially, we can perform this operation on each region BA independently, since there is no interaction between different (disjoint) regions, due to the local nature of continuous submodularity - we only have to ensure that first partial derivatives are continuous on the boundary of each region. In particular, consider a region defined by BA = {x ∈ [0, 1]M : Pi∈A xi − Pi /∈A xi > b}. We can define FA(x) = 1 − (1 − a(2Pi∈A xi − b))+(1 − a(2Pi /∈A xi + b))+. This function is continuous submodular on BA. Moreover, it agrees with F (x) on the boundary of BA and also its first partial derivatives are the same. Therefore, we can glue the two functions seamlessly at the boundary of BA and the resulting function is still continuous submodular. A discrete formulation of this idea follows. Definition 3.1. A set S ⊆ M is said to be b-close to a set A, if S ∩ A − S \ A > b. More generally, a point x ∈ [0, 1]M is b-close to A, if Pi∈A xi − Pi /∈A xi > b. Note that S being b-close to A is the same as the characteristic vector 1S being b-close to A. Proposition 3.2. Let A, A′ ⊆ M be two sets such that A ∩ A′ ≤ b. Then every point x ∈ [0, 1]M is b-close to at most one of the two sets A, A′. In particular, every set S ⊆ M is b-close to at most one of A, A′. Proof. Suppose towards contradiction that x is b-close to both A and A′. That is, Pi∈A xi − Pi /∈A xi > b and Pi∈A′ xi −Pi /∈A′ xi > b. Adding up these two inequalities, we get xi − Xi /∈A′ xi −Xi∈A xi −Xi /∈A xi −Xi /∈A xi −Xi xi + 2 Xi∈A′ xi) + (Xi∈A′ xi +Xi∈A xi) + (2Xi∈A xi − 2Xi 2b < (Xi∈A = (Xi∈A = (2Xi∈A = 2Xi∈A = 2 Xi∈A∩A′ xi + 2 Xi∈A∪A′ xi − 2Xi xi ≤ 2A ∩ A′ ≤ 2b xi) + (Xi∈A′ xi − Xi /∈A′ xi + Xi∈A′ xi − Xi∈A′ xi) xi) xi −Xi xi) xi We have reached a contradiction and therefore x is close to at most one of the sets. Definition 3.3. A family of sets F ⊂ 2M is called b-intersecting if A ∩ A′ ≤ b for all A, A′ ∈ F , A 6= A′. Definition 3.4 (Multiple-Peak Submodular Valuation). Let F be a b-intersecting family and a > 0 some constant. A function f is called (F , a, b)-multiple-peak function if it is defined as follows: 5 1. For a set S that is b-close to some A ∈ F (unique by the above), f (S) = 1 − (1 − a(2S ∩ A − b))+(1 − a(2S \ A + b))+. 2. For a set S that is not b-close to any A ∈ F , f (S) = 1 − (1 − aS)2 +. Lemma 3.5. For every constant a > 0 and every b-intersecting family F , the (F , a, b)-multiple-peak function f (as defined in Definition 3.4) is monotone and submodular. Proof. We define the following function F : [0, 1]M → R+: F (x) = 1 − (1 − aXi xi)2 +. One can verify that this function is continuous submodular, because it is absolutely continuous and its partial derivatives are non-increasing. In addition, for each A ∈ F , we define FA(x) = 1 − (1 − a(2Xi∈A xi − b))+(1 − a(2Xi /∈A xi + b))+ Again, it is easy to see that FA is continuous submodular, by checking that its partial derivatives are non-increasing. Define BA = {x ∈ [0, 1]M : Pi∈A xi − Pi /∈A xi > b}, i.e. the region b-close to A. We know that these regions are disjoint for A ∈ F . We define a function F (x) to be equal to FA(x) for x ∈ BA, and equal to F (x) when x /∈ BA for any A ∈ F . We need to prove that F is a continuous submodular function. Since F and FA are continuous submodular functions, we only have to verify that they agree on the boundary of BA up to first partial derivatives. Note that the boundary of BA intersects any axis-parallel line segment in at most one point. Therefore this will imply that on any line segment parallel to ei, F is absolutely continuous, ∂F is defined almost everywhere, ∂xi and it is non-increasing with respect to every coordinate. Therefore, F is continuous submodular. For each boundary point x of BA, we have 2Pi∈A xi − b = 2Pi /∈A xi + b = Pi xi. Therefore, FA(x) = F (x). In addition, if 1 − aPi xi ≤ 0, then F (x) = FA(x) = 1 and all partial derivatives are 0. Finally, assume that 1 − aPi xi > 0. For j ∈ A we have = 2a(1 − a(2Xi /∈A xi + b)) = 2a(1 − aXi ∂FA ∂xj xi) = ∂F ∂xj . Similarly, for j /∈ A, we have ∂FA ∂xj = 2a(1 − a(2Xi∈A xi − b)) = 2a(1 − aXi xi) = ∂F ∂xj . Hence F and FA agree on the boundary of BA up to their first partial derivatives. Therefore, F is a continuous submodular function and also monotone (non-decreasing). By Lemma 2.2, its restriction to {0, 1}M is monotone submodular. This is the multi-peak submodular function of Definition 3.4. 4 Welfare Maximization In this section we prove our three results regarding welfare maximization: (1 − 1 2e + ǫ)-approximation requires exponential communication, for 2 players, a 17 for every constant ǫ > 0, a 18 + ǫ requires exponential 6 communication and that for constant-size submodular valuations, a (1 − 1 2e + ǫ)-approximation would imply P = N P . We then note why the same proof implies hardness result for max-min allocations (Theorem 1.4). All results share the same basic ideas and use multi-peak submodular functions. The multi-peak submodular functions are defined using a special kind of a set system: Definition 4.1. A collection of sets S ⊂ 2M that is partitioned into groups S1, . . . , Sk is called well struc- tured if all of the following holds: • The total number of elements in the universe is m = k · s. • There is some number s such that for each set S ∈ S, S = s. • S1 = . . . = Sk. • There exists some b such that for every i ∈ [k] and every S, S ′ ∈ Si, we have S ∩ S ′ ≤ b. Given a well structured collection, we identify the k groups of sets with k players. The set of items is M . For each player i, we define a (Si, a, b)-multi-peak submodular valuation function vi : 2M → R+. The precise choice of a, b is application specific and will be given later. We will say that an instance is a YES instance if there exist k disjoint sets, one from each group Si, whose union is M . An instance is a NO instance if for any choice of ℓ ≤ k sets, their union covers at most a (1 − (1 − 1/k)ℓ + ǫ)m items. The inapproximability gap that we prove is the result of the intractability of distinguishing between YES instances and NO instances. We start with calculating the welfare in YES instances. The more involved task is to upper bound the welfare in NO instances. Claim 4.2. The optimal welfare in a YES instance is at least k(1 − (1 − a(2s − b))+(1 − ab)+). Proof. This is a YES instance so for each bidder i there is a set Si ∈ Si such that the Si's are disjoint and cover the universe. A feasible allocation gives Si to player i, and each player collects value vi(Si) = 1 − (1 − a(2s − b))+(1 − ab)+. So the overall welfare of this allocation is k(1 − (1 − a(2s − b))+(1 − ab)+). Consider now a NO instance. There is no such choice of disjoint sets as in YES instances, and moreover i=1 Ai ≤ (1 − (1 − 1/k)ℓ + ǫ)ks. Consider any feasible allocation of disjoint sets (S1, . . . , Sk). For each Si, let Ai ∈ Si be the set in Si closest to Si, i.e. maximizing Si ∩ Ai − Si \ Ai. Our goal now is to upper bound the maximum welfare such allocation can achieve. any selection of ℓ sets such that Ai ∈ Si satisfies Sℓ s Si ∩ Ai, yi = 1 For each i, we define variables xi = 1 . . . ≥ xk. For every ℓ, the first ℓ variables xi satisfy the constraint that Pℓ from the properties of the set system in NO instances). In addition, we have the constraint Pk s Si \ Ai. Without loss of generality, x1 ≥ x2 ≥ x3 ≥ i=1 xi ≤ (1−(1−1/k)ℓ+ǫ)k (arising i=1(xi +yi) ≤ k, meaning that we cannot allocate more than the total number of elements, ks. The following technical lemma bounds the value that can be obtained under these constraints. (We note that the parameters α, β in the lemma are related to a, b by α = a · s and β = b/s.) Lemma 4.3. Let x1, y1, . . . , xk, yk ≥ 0 be such that • x1 ≥ x2 ≥ . . . ≥ xk, i=1 xi ≤ (1 − (1 − 1/k)ℓ + ǫ)k, • for each ℓ ≤ k, Pℓ • Pk i=1(xi + yi) ≤ k. Let v(x, y) = 1 − (1 − α(2x − β))+(1 − α(2y + β))+ if x − β > y, and v(x, y) = 1 − (1 − α(x + y))2 Then, + if x − β ≤ y. k Xi=1 v(xi, yi) ≤ max 1≤k∗ ≤k 2αk + 1 − α2k2 k − k∗ ((1 − 1/k)k∗ − ǫ)2 7 Moreover, for k = 2 and β ≥ 1 4 + ǫ we have that 2 Xi=1 v(xi, yi) = 2 − (1 − α(2 − 1 + αβ 2α ))2 +. We defer the proof to Appendix A. Given this lemma, we obtain bounds on the ratio between YES and NO instances. Corollary 4.4. The ratio between the social welfare in a NO instance and a YES instance is: • 1 − 1 2e + O(ǫ) for α = 1 2 , β = ǫ and large enough k. • 17 18 + O(ǫ) for α = 2 3 , β = 1 2 + 2ǫ and k = 2. Proof. We show the first part by optimizing for the best value of k∗ in the NO case: Let z = k∗/k. For large k, we can approximate (1 − 1/k)2k∗ 4(1−z) e−2z over z ∈ (0, 1) (the rest of the terms approach 0 and we ignore them in this analysis). By elementary calculus, φ(z) is maximized at z = 1/2, and the maximum value is φ( 1 2e ). In other words, k∗ = k/2 is the best choice, and gives ≃ e−2z. Hence we maximize the function φ(z) = k − k 2 ) = k(1 − 1 k Xi=1 v(xi, yi) = (1 − e−1/2)k + 1 2 k(1 − (1 − e−1/2)2) = (1 − 1 2e )k. In the YES case, the optimum is k(1 − (1 − α(2 − β))+(1 − αβ)+) = k(1 − 1 the ratio is 1 − 1 2e + O(ǫ). For the second part, we choose α = 2 2 ǫ(1 − 1 2 ǫ)) ≥ k(1 − ǫ). Therefore, x1 = 1 + ǫ, y1 = 0, x2 = 0, y2 = 1 − ǫ. The value of this solution is 3 and β = 1 2 + 2ǫ, which gives an optimal solution in the NO case 2 Xi=1 v(xi, yi) = 1 + 1 − (1 − αy2)2 + = 2 − (1 − 2 3 (1 − ǫ))2 + = 2 − ( 1 3 + 2 3 ǫ)2 ≤ 17 9 . In the YES case, as we argued, the optimum is 2(1 − (1 − α(2 − β))+(1 − αβ)+) = 2(1 − (1 − 2 2ǫ))(1 − 2 3 ǫ)) ≥ 2 − ǫ. Therefore, the ratio is 17 2 + 2ǫ)) = 2(1 − 1 18 + O(ǫ). 3 ǫ( 2 3 − 1 3 ( 1 3 (2 − 1 2 − 4.1 Communication complexity of welfare maximization Here we prove the first part of Theorem 1.1, and Theorem 1.2: 2e + ǫ)-approximation requires exponential communication. For 2 players, a ( 17 18 + ǫ)-approximation requires exponential communication. This is the first constant-factor impossibility result for submodular valuations in the communication model. The basic idea is to reduce from the Set Disjointness problem. In the Set Disjointness problem there are k players, each player i holds a string xi ∈ {0, 1}t. The following theorem establishes the hardness of Set Disjointness. for every constant ǫ > 0, a (1 − 1 Theorem 4.5 ([1]). It requires t k4 bits to distinguish between the following two cases: 1. There exists some j such that x1 j = . . . = xk j = 1. 2. For each two different players i and i′ and every j it holds that if xi j = 1 then xi′ j = 0. The lower bound holds also for randomized and non-deterministic algorithms. The plan is to reduce Set Disjointness (with an exponential t) to an instance of combinatorial auctions with multiple-peak submodular functions. Then we would like to show that a good approximation algorithm will let us decide the Set Disjointness problem. This will show that a good approximation algorithm requires exponential communication. The first step is to show the existence of an exponential well-structured set system. 8 Lemma 4.6. For a universe M , M = ks = m and for any ǫ > 0, there is a collection of t = 2Θ(ǫ2m/k3) partitions P j = (Cj k) such that 1, . . . , Cj • For each j ∈ [t], Sk i=1 Cj i = M . • For each i ∈ [k], j ∈ [t], Cj i = s. • For any i ≤ i′ and any j, j′, Cj i ∩ Cj ′ i′ ≤ 1+ǫ k s. • For every distinct i1, ...iℓ and any j1, . . . , jℓ, we have Cj1 i1 ∪ . . . ∪ Cjℓ iℓ ≤ (1 − (1 − 1 k )ℓ + ǫ)ks. 1, . . . , er Consider any pair Cj 1, . . . , er Proof. This is a slight modification of the probabilistic construction of [11]. Consider M partitioned into s k-tuples (er k), we include each element in exacly one of the sets Cj k, using an independently random bijection {er k), 1 ≤ r ≤ s. We generate each partition P j as follows: from each k-tuple (er k}. Thus the first two conditions are satisfied by construction. k} → {Cj 1 , . . . , Cj 1, . . . , Cj 1, . . . , er from each k-tuple (er and these events are independent. The expected size of the intersection Cj bound, the probability that the intersection is larger than Pr[Cj i , Cj ′ for i 6= i′. Each set is generated by taking (independently) a random element i′ 1, . . . , er k). Therefore, the probability of taking the same element is 1/k for each k-tuple i′ is s/k, and by the Chernoff i′ > (1 + ǫ)s/k] < e−Ω(ǫ2s/k). Similarly, consider any choice of distinct (i1, . . . , iℓ) and any (j1, . . . , jℓ). Each element appears in Cj1 i1 ∪ . . . ∪ Cjℓ iℓ with probability 1 − (1 − 1/k)ℓ, and hence the expected cardinality of the union is (1 − (1 − 1/k)ℓ)ks. We can write Cj1 r=1 Xr where Xr is the number of elements of the r-th k-tuple that are contained in the union. The random variables Xr are independent, in the range [0, k], and hence by the iℓ = Ps i1 ∪ . . . ∪ Cjℓ i ∩ Cj ′ i ∩Cj ′ Chernoff bound Pr[Ps If the number of partitions is t, we have O(tk) combinations of sets to consider. By the union bound, the probability that any of the bad events above occurs is O(tk)e−Ω(ǫ2s/k). For t = 2Θ(ǫ2s/k2), the probability is smaller than 1 and hence there is a collection of partitions satisfying the assumptions. r=1 Xr > (1 + ǫ)E[Ps r=1 Xr]] < e−Ω(ǫ2s/k). i using Lemma 4.6 and we include Cj Given an instance of Set Disjointness, consider the following well structured collection of sets: We con- struct Cj j = 1. Consider the k multiple-peak submodular functions that are based on this well structured collection of sets (with b = 1+ǫ k s). Observe that if there exists some j such that x1 j = 1 then this is a YES instance. However, if for each two different players i and i′ and every j it holds that if xi j = 0 this is a NO instance. Hence it requires exponential amount of communication to distinguish between these two cases (even for 2 players) and the hardness of approximation in the communication model follows from Corollary 4.4. in Si if and only if xi j = 1 then xi′ j = . . . = xk i 4.2 Computational complexity of welfare maximization We now prove the second part of Theorem 1.1. The starting point of our reduction is Feige's inpproximability result for Max k-cover [14]. We summarize it here, with some additional useful properties of the set system that arises from Feige's reduction (see also [15] and [16] for some comments and explanations). Hardness of Max k-cover. For any fixed ǫ > 0, it is NP-hard to distinguish the following two cases for a given collection of sets S ⊂ 2M , partitioned into groups S1, . . . , Sk: 1. YES case: There exist k disjoint sets, one from each group Si, whose union is the universe M . 2. NO case: For any choice of ℓ ≤ k sets, their union covers at most a (1 − (1 − 1/k)ℓ + ǫ)-fraction of M . In addition, the set system can be assumed to have the following properties: • Every set has the same (constant) size s. 9 • Each group contains the same (constant) number of sets g. • Every element appears in the same (constant) number of sets d. • Any two sets intersect in at most ǫs elements. We remark that the properties up to the last two are discussed in [15, 16]. The last two properties follow from the deterministic construction for max k-cover in [14], as follows: The sets are unions of (L − 1)-dimensional layers in disjoint hypercubes [k′]L, where k′ is the number of provers, and each hypercube corresponds to a particular random string r generated by the verifier. (Here, k′ and L are both constant.) Each set corresponds to a triple (q, a, i) where q is a question, a is an answer, and i is a prover. The direction of the layer that a set uses in a certain hypercube corresponds to the answer a, and the position (shift) of the layer corresponds to the prover i. Given a random string r and a prover i, the question q is determined by r and i. Therefore different sets for the same prover i, restricted to the same hypercube r, must differ in their answer a. Hence, they are orthogonal in the respective hypercube. In particular, for each prover i there can be at most L different sets participating in the same hypercube, one for each dimension. As the number of provers and L are constant, there is only a constant number of sets participating in each hypercube. As shown in [15], it can be arranged that the number of sets containing any given element is the same, and by the above it must be a constant. For two different provers, the respective sets restricted to one hypercube are layers indexed by a different i, and hence they are either orthogonal or disjoint. Either way, any two different sets are either disjoint or intersect in a 1/k′-fraction of their size in each hypercube where they both participate. Overall, two different sets can intersect in at most a 1/k′-fraction of their elements. The number of provers k′ can be chosen large enough so that 1/k′ ≤ ǫ (in any case k′ has to increase as ǫ → 0, for other reasons). Reduction. We describe a reduction from the Max k-cover problem to a combinatorial auction with submodular valuations which works as follows. Given an instance of Max k-cover as above, we identify the k groups of sets with k players. The set of items is the universe M . For each player i, we define a multiple-peak submodular valuation function vi : 2M → R+. The size of each set in Si is s (a constant), and the number of sets is g, also a constant. Hence, the set system Si covers only a constant number of elements ≤ sg, and we apply the construction of Definition 3.4 only to these elements (i.e. other elements have value 0 for player i). From the properties of the Max k-cover instance, we know that any two sets in Si can overlap in at most ǫs elements, hence the parameter b can be set to b = ǫs. We also set a = 1 2s . From the hardness of Max k-cover it follows now that it is NP-hard to distinguish between the YES and NO instances, with a ratio of optimal values 1 − 1 2e + O(ǫ) due to Corollary 4.4. 4.3 Max-min allocation We note that the same proofs apply to the Max-min Allocation problem as well. This is because the reduction produces instances such that in the YES case, all players receive the same value. In the NO case, the minimum value is upper-bounded by the average value over all players. Therefore, the gap in terms of the objective min1≤i≤k vi(Si) is at least as large as in terms of welfare maximization. In fact the hardness factors can be (slightly) improved for Max-min allocation, but we defer this to the full version of the paper. Acknowledgment. JV wishes to thank Uri Feige, who inspired the computational-complexity part of this paper in a conversation 6 years ago. We would also like to thank Ashwinkumar Badanidiyuru Varadaraja for valuable commments. References [1] N. Alon, Y. Matias, and M. Szegedy. The space complexity of approximating the frequency moments. Proc. 28th ACM Symp. on Theory of Computing, pages 20 -- 29, May 1996. 10 [2] Arash Asadpour, Uriel Feige, and Amin Saberi. Santa claus meets hypergraph matchings. In AP- PROX'08. [3] Arash Asadpour and Amin Saberi. An approximation algorithm for max-min fair allocation of indivisible goods. In STOC'07. [4] Maria-Florina Balcan and Nicholas J. A. Harvey. Learning submodular functions. In STOC, 2011. [5] Nikhil Bansal and Maxim Sviridenko. The santa claus problem. In STOC'06. [6] David Buchfuhrer, Michael Schapira, and Yaron Singer. Computation and incentives in combinatorial public projects. In ACM Conference on Electronic Commerce, 2010. [7] D. Chakrabarty, J. Chuzhoy, and S. Khanna. On allocating goods to maximize fairness. In FOCS'09. [8] Deeparnab Chakrabarty and Gagan Goel. On the approximability of budgeted allocations and improved lower bounds for submodular welfare maximization and gap. In FOCS, pages 687 -- 696, 2008. [9] Chandra Chekuri, Jan Vondr´ak, and Rico Zenklusen. Dependent randomized rounding via exchange properties of combinatorial structures. In FOCS, 2010. [10] Shahar Dobzinski, Noam Nisan, and Michael Schapira. Approximation algorithms for combinatorial auctions with complement-free bidders. In STOC'05. [11] Shahar Dobzinski and Michael Schapira. An improved approximation algorithm for combinatorial auc- tions with submodular bidders. In SODA'06. [12] Uriel Feige. On allocations that maximize fairness. In SODA'08. [13] Uriel Feige. On maximizing welfare where the utility functions are subadditive. In STOC'06. [14] Uriel Feige. A threshold of ln n for approximating set cover. Journal of the ACM, 45(4):634 -- 652, 1998. [15] Uriel Feige, L´aszl´o Lov´asz, and Prasad Tetali. Approximating min sum set cover. Algorithmica, 40(4):219 -- 234, 2004. [16] Uriel Feige and Jan Vondr´ak. Approximation algorithms for allocation problems: Improving the factor of 1-1/e. Theory of Computation 6, 247 -- 290, 2010. [17] Uriel Feige and Jan Vondr´ak. Approximation algorithms for allocation problems: Improving the factor of 1-1/e. In FOCS'06. [18] Michel X. Goemans, Nicholas J. A. Harvey, Satoru Iwata, and Vahab S. Mirrokni. Approximating submodular functions everywhere. In SODA'09. [19] Subhash Khot, Richard J. Lipton, Evangelos Markakis, and Aranyak Mehta. Inapproximability results for combinatorial auctions with submodular utility functions. In WINE'05. [20] Jon Lee, Vahab S. Mirrokni, Viswanath Nagarajan, and Maxim Sviridenko. Non-monotone submodular maximization under matroid and knapsack constraints. In STOC'09. [21] Benny Lehmann, Daniel Lehmann, and Noam Nisan. Combinatorial auctions with decreasing marginal utilities. In EC'01. [22] Vahab Mirrokni, Michael Schapira, and Jan Vondr´ak. Tight information-theoretic lower bounds for welfare maximization in combinatorial auctions. In EC'08. [23] G. L. Nemhauser, L. A. Wolsey, and M. L. Fisher. An analysis of approximations for maximizing submodular set functions - I. Mathematical Programming, 14:265 -- 294, 1978. 11 [24] Noam Nisan. The communication complexity of approximate set packing and covering. In ICALP 2002. [25] Noam Nisan and Ilya Segal. Exponential communication inefficiency of demand queries. In TARK'05. [26] Jan Vondr´ak. Optimal approximation for the submodular welfare problem in the value oracle model. In STOC'08. [27] Jan Vondr´ak. Symmetry and approximability of submodular maximization problems. In FOCS'09. A Proof of Lemma 4.3 This section is devoted to proving Lemma 4.3. We consider some optimal solution and massage it to get the specified bounds. The following simple claims show several structural properties that an optimal solution can be assumed to possess. Claim A.1. The sequence x1 ≥ x2 ≥ . . . ≥ xk is non-zero up to a certain index k∗, xi − β > yi for i ≤ k∗ and then xi = 0 for i > k∗. Proof. If xi −β ≤ yi, we can assume that xi = 0 (by replacing yi by xi +yi and xi by 0, nothing changes). Claim A.2. If xi = xj , i < j ≤ k∗ then yi = yj = 0. Proof. Suppose that xi = xj, i < j ≤ k∗ and suppose yj ≤ yi 6= 0. The derivative ∂v ∂y at xi equals the derivative at xk. So we can move some small amount of mass from yi to yj, while making sure that still xj − β > yj. Observe that the value of the solution is the same. But once yi > yj, it is already more profitable to increase xi. So the case where xi = xj is not optimal, unless yi = yj = 0. Claim A.3. All the variables yi for i > k∗ are equal. We denote their value by y∗. Proof. If not, we could gain by making them equal, due to the concavity of v(0, y) = 1 − (1 − 1 2 y)2 +. Claim A.4. For all yi < k∗, yi = 0. Proof. Consider some yi < k∗ with yi > 0. Notice that xi > xk∗ (by Claim A.2 if xi = xk∗ then yi = 0), and ∂y at xi is smaller than the derivative ∂v hence the derivative ∂v ∂y at xk∗ . So moving some mass from yi to yk∗ improves the value of the optimal solution -- a contradiction. A.1 The case of 2 players Claim A.5. k∗ ≥ 1. Proof. Suppose k∗ = 0. Then, by the previous claims we have that x1 = x2 = 0 and y1 = y2 = 1. The value of this solution is 2 − 2(1 − α)2 +. However the solution in which x1 = y2 = 1 and x2 = y1 = 0 has value 2 − (1 − α)2 + − (1 − α(2 − β))+(1 − αβ)+ which is no smaller by using simple arithmetic. Claim A.6. y1 = 0. Proof. Suppose y1 > 0. It must be that k∗ = 1 (by Claim A.4). If 1 − a(2x1 − b) ≤ 0 then y1 does not bring any benefit and moving all the mass of y1 to y2 can only improve the value of the solution. Otherwise, moving some mass from y1 to x1 (making sure that still 1 − a(2x1 − b) ≥ 0) will improve the optimal solution -- a contradiction. Claim A.7. If β ≥ 1 2 + 2ǫ then k∗ = 1. Proof. By the constraints of the lemma we have that x1 + x2 + y1 + y2 ≤ 2 and x1 + x2 ≤ 2( 3 4 + ǫ). Without loss of generality, x1 + x2 + y1 + y2 = 2, and hence x1 + x2 − y1 − y2 = 2(x1 + x2) − (x1 + x2 + y1 + y2) ≤ 1 + 4ǫ. But if k∗ = 2, summing up x1 − β > y1 and x2 − β > y2 we get x1 + x2 − y1 − y2 > 2β ≥ 1 + 4ǫ. This is a contradiction. 12 Claim A.8. x1 = 1+αβ 2α . Proof. x1 = 1+αβ is the point at which 1 − α(2x1 − β) = 0, i.e. the first player is saturated and does not 2α benefit from any additional items. If 1 − α(2x1 − β) < 0, we can move some mass from x1 to y2 and improve the optimal solution. If 1 − α(2x1 − β) > 0, we can move some mass from x2 or y2 to x1 and improve the optimal solution. This implies that the following is an optimal solution: x1 = 1+αβ 2α , y2 = 2 − 1+αβ 2α , x2 = y1 = 0. The first player gets value 1, and the second player 1 − (1 − αy2)2 +; hence the optimum is 2 Xi=1 v(xi, yi) = 1 + 1 − (1 − αy2)2 + = 2 − (1 − α(2 − 1 + αβ 2α ))2 +. This proves the second part of Lemma 4.3. A.2 The case of many players By the series of claims we proved above, we have a sequence x1 ≥ x2 ≥ . . . ≥ xk∗ , yi = 0 for i < k∗, and then yk∗+1 = yk∗+2 = . . . = yk = y∗, xi = 0 for i > k∗. The value of this solution is at most (we upper bound the value of player k∗ by 1): k Xi=1 k∗−1 k v(xi, yi) = Xi=1 (1 − (1 − α(2xi − β))+(1 − αβ)+) + 1 + k∗−1 k Xi=k∗+1 (1 − (1 − αy∗)2 +) ≤ Xi=1 We have the global constraint Pk∗ tight: Pk∗ i=1 xi = k(1 − (1 − 1/k)k∗ k−k∗ ((1 − 1/k)k∗ y∗ = k + ǫ). Subject to these constraints, it is profitable to make the variables xi as large as possible, because they bring more benefit than the yi variables (see the formula above). Therefore, we can assume that both constraints are − ǫ)k. Then we have i=k∗+1 yi = (k − k∗)y∗ = ((1 − 1/k)k∗ i=1 xi ≤ k(1 − (1 − 1/k)k∗ i=1 xi +Pk − ǫ). The objective value is + ǫ), and Pk 2αxi + 1 + +). (1 − (1 − αy∗)2 Xi=k∗+1 i=k∗+1 yi ≤ k, and also Pk∗ k Xi=1 v(xi, yi) ≤ 2α k∗ −1 Xi=1 xi + 1 + (k − k∗)(1 − (1 − αy∗)2) = 2αk(1 − (1 − = 2αk(1 − (1 − 1 k 1 k )k∗ + ǫ) + 1 + (k − k∗)(1 − (1 − )k∗ + ǫ) + 1 + (k − k∗)( 2αk k − k∗ ((1 − 1/k)k∗ (k − k∗)2 ((1 − 1/k)k∗ − ǫ)2) αk k − k∗ ((1 − 1/k)k∗ − ǫ) − − ǫ))2) α2k2 = 2αk + 1 − α2k2 k − k∗ ((1 − 1/k)k∗ − ǫ)2. This proves the first part of Lemma 4.3. B Combinatorial Public Projects Here, we prove Theorem 1.3, in two parts. Due to the similarities with welfare maximization, we only point out the necessary differences. 13 B.1 Communication complexity of CPP We reduce from an instance of Set Disjointness to CPP with submodular valuations as follows. We use Lemma 4.6 to construct a collection of partitions (Cj k), 1 ≤ j ≤ t. The difference now is that we use Cj j = 1 in the Set Disjointness instance. By Lemma 4.6, Si is a well structured collection. The valuation vi of player i is going to be the (Si, a, b)-multiple-peak submodular function of Definition 3.4, where a = 1 k s. The 1 for all k players, rather than Cj for player i. We include Cj 1 in collection Si if xi 2s and b = 1+ǫ 1, . . . , Cj i In the YES case, all players share an index j such that x1 i=1 vi(S) : S = s}. CPP instance is going to be max{Pk i ∈ [k]. Then Cj 1 − O(1/k) for each player. 1 is a feasible solution of value vi(Sj j = x2 j = 1, and hence Cj 1) = 1 − (1 − a(2s − b))+(1 − ab)+ = 1 − 1+ǫ j = . . . = xk 1 ∈ Si for all 2k ) = 2k (1 − 1+ǫ In the NO case, for every index j there is at most one player i such that xi 1 ∈ Si for at most k s = b. By Proposition 3.2, any set S can be b-close to at most 1. Therefore, for any feasible set S, at most one player derives a value defined by a b-close set, and + = 3/4. one player i. By Lemma 4.6, Cj one set Cj all the remaining k − 1 players get value defined by the formula vi(S) = 1 − (1 − aS)2 One player can receive value close to 1. + = 1 − (1 − as)2 1 ≤ 1+ǫ 1 ∩ Cj ′ j = 1; hence Cj For a large number of players (k → ∞), the value per player tends to 1 in the YES case and 3/4 in the NO case. Therefore, if we could approximate the CPP problem within a factor better than 3/4, we could solve the Set Disjointness problem. For 2 players, we still use the construction above, but we only consider the first two players. In the YES case, both players get value close to 1. In the NO case, 1 player must get value close to 3/4, while the other player can get value close to 1. Thus if we could approximate the CPP problem for 2 players within a factor better than 7/8, we could solve the Set Disjointness problem. B.2 Computational complexity of CPP Here we prove the second part of Theorem 1.3. This is actually quite simple and does not require our construction of multiple-peak submodular functions. The same reduction has been used in [6] to prove that CPP is hard to approximation better than 1 − 1/e with unit-demand valuations. The only new ingredient here is the observation that the valuation functions can be assumed to depend only on a constant number of items. The result of [6] already implies that the factor of 1 − 1/e for CPP with submodular valuations cannot be improved in the demand oracle model; we strengthen this to the case of constant-size valuation functions. Proof of Theorem 1.3, part 2. Consider an instance of Max k-cover as above. We associate players with the elements of the universe M , and items with the sets in S. For each player e ∈ M , we define a valuation function as follows: ve(T ) = 1 if T contains any set covering element e, and 0 otherwise. Due to the properties of the set system, this valuation function depends non-trivially only on a constant number of items (d), and it is a very special monotone submodular function (unit demand) of the form ve(T ) = min{T ∩ De, 1}. The objective function of the CPP problem is now Pe∈M ve(T ) which is the number of elements covered by the sets in T . Subject to the condition T ≤ k, this is NP-hard to maximize within a 1−1/e+ǫ factor. 14
1210.7605
1
1210
2012-10-29T09:56:59
List-coloring embedded graphs
[ "cs.DS", "math.CO" ]
For any fixed surface Sigma of genus g, we give an algorithm to decide whether a graph G of girth at least five embedded in Sigma is colorable from an assignment of lists of size three in time O(|V(G)|). Furthermore, we can allow a subgraph (of any size) with at most s components to be precolored, at the expense of increasing the time complexity of the algorithm to O(|V(G)|^{K(g+s)+1}) for some absolute constant K; in both cases, the multiplicative constant hidden in the O-notation depends on g and s. This also enables us to find such a coloring when it exists. The idea of the algorithm can be applied to other similar problems, e.g., 5-list-coloring of graphs on surfaces.
cs.DS
cs
List-coloring embedded graphs Zdenek Dvor´ak∗ Ken-ichi Kawarabayashi† Abstract For any fixed surface Σ of genus g, we give an algorithm to decide whether a graph G of girth at least five embedded in Σ is colorable from an assignment of lists of size three in time O(V (G)). Furthermore, we can allow a subgraph (of any size) with at most s components to be precol- ored, at the expense of increasing the time complexity of the algorithm to O(cid:0)V (G)K(g+s)+1(cid:1) for some absolute constant K; in both cases, the mul- tiplicative constant hidden in the O-notation depends on g and s. This also enables us to find such a coloring when it exists. The idea of the algorithm can be applied to other similar problems, e.g., 5-list-coloring of graphs on surfaces. 1 Introduction In general, deciding 3-colorability of a planar graph is NP-complete [2]. On the other hand, Grotzsch [8] proved that any triangle-free planar graph is 3- colorable. A quadratic algorithm to find such a 3-coloring follows from his proof; the time complexity was later improved to O(n log n) by Kowalik [12] and finally to linear by Dvor´ak et al. [4]. The situation is significantly more complicated for graphs embedded in surfaces. Nevertheless, Dvor´ak et al. [5] gave a linear-time algorithm to decide whether a triangle-free graph embedded in a fixed surface is 3-colorable. Motivated by subproblems appearing in many coloring proofs, Vizing [18] and Erdos et al. [7] introduced the notion of list coloring. A list assignment for a graph G is a function L that assigns to each vertex v ∈ V (G) a list L(v) of colors. An L-coloring is a function ϕ : V (G) → Sv L(v) such that ϕ(v) ∈ L(v) for every v ∈ V (G) and ϕ(u) 6= ϕ(v) whenever u, v are adjacent vertices of G. If G admits an L-coloring, then it is L-colorable. A graph G is k-choosable if it is L-colorable for every list assignment L such that L(v) ≥ k for all v ∈ V (G). A natural question is whether triangle-free planar graphs are also 3-choosable. This is not the case, as demonstrated by Voigt [19]. Let us remark that this im- plies that deciding whether a triangle-free planar graph is colorable from a given assignment of lists of size three is NP-complete, by a straightforward reduction from 3-colorability of planar graphs. Therefore, we need to restrict the graphs ∗Computer Science Institute, Charles University, Prague, Czech Republic. E-mail: [email protected]. The work leading to this invention has received funding from the European Research Council under the European Union's Seventh Framework Programme (FP7/2007-2013)/ERC grant agreement no. 259385. †National Institute of Informatics, Tokyo, Japan and JST ERATO Kawarabayashi Project. E-mail: k [email protected]. 1 in this setting even more. Thomassen [15] proved that every planar graph of girth at least five is 3-choosable. His proof also gives a quadratic algorithm to find such a coloring. In this paper, we consider the problem of 3-list-coloring a graph of girth at least five embedded in a fixed surface. Our main result is a linear-time algorithm to decide whether a graph of girth at least five embedded in a fixed surface is colorable from given lists of size three. Furthermore, the algorithm can be modified to decide in linear time whether an embedded graph of girth at least five is 3-choosable. This problem is Π2-complete for triangle-free embedded graphs [9]. Also, let us remark that it is not even known whether all projective planar graphs of girth at least five are 3-choosable. Another interesting area of study is the precoloring extension problem, where we are given a coloring ψ of a subgraph F of the considered graph G and we want to decide whether there exists a (list-)coloring of G that extends ψ. Unless some restriction is placed on F , it is easy to see that the problem is NP-complete for planar graphs of arbitrarily large genus, even for ordinary 3- coloring (e.g., by a reduction from 3-colorability of planar graphs, where we replace each edge by two paths of odd length whose vertices are adjacent to vertices colored by 1 and 2, respectively). The known algorithms for (list- )coloring graphs on surfaces [16, 17, 4] allow some vertices to be precolored, but the number of precolored vertices needs to be bounded by a constant in order to achieve a polynomial time complexity. Our algorithm allows an arbitrary number of precolored vertices, assuming that the subgraph induced by them has a bounded number of components (at most s), at the expense of increasing its time complexity to O(cid:0)V (G)K(g+s)+1(cid:1) for some absolute constant K. Since we can handle arbitrarily large precolored subgraphs, the algorithm can be used to find the coloring when it exists, by coloring the vertices one by one. The algorithm is based on a bound on the size of critical planar graphs with one precolored face. Consider a graph G, a subgraph (not necessarily induced) S ⊆ G and an assignment L of lists to vertices of G. A graph G is S-critical (with respect to L) if for every proper subgraph G′ ⊂ G such that S ⊆ G′, there exists an L-coloring of S that does not extend to an L-coloring of G, but extends to an L-coloring of G′; i.e., removal of any edge of E(G) \ E(S) affects which colorings of S extend to the rest of the graph. Dvor´ak and Kawarabayashi [3] proved the following. Theorem 1. Let G be a plane graph of girth at least 5 with the outer face F bounded by a cycle, and let L be an assignment of lists of size three to vertices of G. If G is F -critical with respect to L, then V (G) ≤ 37ℓ(F )/3. Our algorithm can be applied in any other setting where the result analogous to Theorem 1 holds (the bound on the size of the critical graph must be linear in the length of the precolored face). For example, Postle [14] gave a similar bound for 5-list-coloring. Theorem 2 (Postle). There exists a constant c with the following property. Let G be a plane graph with the outer face F bounded by a cycle, and let L be an assignment of lists of size five to vertices of G. If G is F -critical with respect to L, then V (G) ≤ cℓ(F ). Using this theorem instead of Theorem 1, we obtain a polynomial-time al- gorithm for extending a precoloring of a subgraph with bounded number of 2 components in graphs embedded in a fixed surface and with lists of size five. Let us remark that a linear-time algorithm for testing colorability of an embed- ded graph from lists of size five (but with only a constant number of precolored vertices) was previously given by Kawarabayashi and Mohar [11]. The basic idea of our algorithm is to use Theorem 1 to show that all vertices of critical graphs embedded in a fixed surface with sufficiently large edge-width are in logarithmic distance from the precolored subgraph (for planar graphs with one precolored cycle, this was first observed by Postle [14]). This enables us to restrict the problem to graphs of logarithmic tree-width. In Section 2, we prove the result on the distance from the precolored sub- graph in critical graphs and use it to design a list-coloring algorithm for graphs with large edge-width. The algorithm for the general case (which follows by a standard dynamic programming idea, used before e.g. in [5]) is described in Section 3. The 3-choosability case is discussed in Section 4. 2 Distances in critical graphs We use the following consequence of Theorem 1. Corollary 3. Let G be a plane graph of girth at least 5 and let S be a set of vertices such that each vertex in S is incident with the outer face of G. Let L be an assignment of lists of size three to vertices of G. If G is S-critical with respect to L, then V (G) ≤ 50S. Proof. Let k = S. Thomassen [15] proved that a precoloring of any vertex of a planar graph G of girth at least five extends to a coloring of G from arbitrary lists of size three. Consequently, we can assume that k ≥ 2. Let s1, s2, . . . , sk be the vertices of S, and let G′ be the graph obtained from G by joining si with si+1 by a new path of length four (where sk+1 = s1) for 1 ≤ i ≤ k. Let C be the cycle in G′ formed by the newly added paths. Note that we can choose the ordering of the vertices of S so that G′ is a plane graph with a face bounded by C. Give the new vertices arbitrary lists of size three, and note that G′ is C-critical with respect to the resulting list assignment. Furthermore, G′ has girth at least five, and by Theorem 1, we have V (G) < V (G′) ≤ 37ℓ(C)/3 = 37 · 4S/3 < 50S. A surface is a compact 2-dimensional manifold (possibly disconnected or with boundary). A useful tool for dealing with surfaces is the operation of cutting along prescribed curves. To avoid technical complications, we restrict ourselves to cutting along subgraphs of some graph embedded in the surface, as follows. Let Q be a graph embedded in a surface Σ without boundary. Let Σ − Q be the open space obtained from Σ by removing the edges and vertices of the embedding of Q. Let ΣQ be the surface (possibly disconnected) with boundary such that the interior of ΣQ is homeomorphic to Σ − Q. Let θ : ΣQ → Σ be the continuous extension of this homeomorphism. Let cΣQ stand for the surface without boundary obtained from ΣQ by capping each component of its boundary by a disk. Suppose that G is embedded in Σ so that the intersection of the embeddings of G and Q is a subgraph of both G and Q (i.e., a point of this intersection is a vertex in G iff it is a vertex in Q, and if a point of this intersection belongs to an edge e of G or Q, then e is an edge drawn in the 3 same way both in G and Q). Then, we say that the embeddings of G and Q are compatible and we let GQ = θ−1(G). Note that each edge of G ∩ Q corresponds to two edges of GQ. Similarly, each vertex v ∈ V (G) ∩ V (Q) corresponds to degQ(v) vertices of GQ. The basic property of criticality is that it is preserved by this cutting operation. If S is a subgraph of G, then let SQ denote the graph θ−1(S ∪ (G ∩ Q)). If L is a list assignment for G, then let LQ denote the list assignment for GQ such that LQ(v) = L(θ(v)) for v ∈ V (GQ). Lemma 4. Let G and Q be graphs with compatible embeddings in a surface Σ without boundary, and let L be a list assignment for G. Let S be a subgraph of G. If G is S-critical with respect to L, then GQ is SQ-critical with respect to LQ. Proof. Let θ : ΣQ → Σ be the mapping from the definition of cutting along Q. Consider an arbitrary proper subgraph G′ of GQ such that SQ ⊆ G′, and let G′′ = θ(G′). Note that G′′ is a proper subgraph of G containing S ∪ (G ∩ Q), and thus there exists an L-coloring ϕ of S that extends to an L-coloring ϕ′′ of G′′, but does not extend to an L-coloring of G. Let ϕ′ be the LQ-coloring of G′ defined by ϕ′(v) = ϕ′′(θ(v)) for v ∈ V (G′). Observe that the restriction of ϕ′ to SQ does not extend to an LQ-coloring of GQ, as otherwise the image of this LQ-coloring under θ would be an L-coloring of G extending ϕ. Since the choice of G′ was arbitrary, this implies that GQ is SQ-critical. Similarly, we can prove the following. Lemma 5. Let S be a subgraph of a graph G and let L be a list assignment If G is S-critical with respect to L and G = G1 ∪ G2, then G1 is for G. ((G2 ∪ S) ∩ G1)-critical with respect to L. In particular, if G1 is a connected component of G, then G is (S∩G1)-critical. Consider a surface Σ without boundary and a graph G with a 2-cell em- bedding in Σ. The radial graph H of G is the bipartite graph with vertex set consisting of the vertices and faces of G, and edge set corresponding to the incidence relation between vertices and faces of G (with multiplicities -- i.e., if a vertex v appears k times in the facial walk of a face f of G, then v and f are joined by k edges in the radial graph of G). The radial graph has a natural embedding in Σ, where each vertex v ∈ V (H) ∩ V (G) is drawn at the same position as in the embedding of G, each vertex f ∈ V (H) \ V (G) is drawn inside the corresponding face f of G, and each face of H has length four and contains exactly one edge of G. Postle [14] observed that Corollary 3 and Lemma 5 imply a logarithmic bound on the distances in a critical plane graph with all precolored vertices incident with the same face. We include a proof of this claim giving a slightly better multiplicative constant in the bound. Theorem 6 (Postle). Let G be a connected plane graph of girth at least 5 and let S be a set of vertices such that each vertex in S is incident with the outer face f of G. Let L be an assignment of lists of size three to vertices of G. Let H be the radial graph of G. If G is S-critical with respect to L, then every vertex of H is at distance at most 398 + 100 log S from the vertex corresponding to f . 4 Proof. Let F be the set of all faces incident with vertices of S (including f ). Let S0 = S. Let S1 be the set of vertices of V (G) \ S adjacent to the elements of F in H. For an integer i ≥ 2, let Si denote the set of vertices of H at distance exactly 2i−1 from F in H (all these vertices belong to V (G)). Let Gi denote the subgraph of G induced by Sj≥i Sj. Let ni = V (Gi) = Pj≥i Sj. Note that Gi is Si-critical by Lemma 5, and thus ni ≤ 50Si by Corollary 3. It follows that ni+1 50 for every i ≥ 0, and consequently ni ni ≤ 50S0.98i. = 1 − ni−ni+1 ni = 1 − Si ni ≤ 49 Therefore, for k > log 50S − log 0.98 , we have nk < 1, and since nk is a nonnegative integer, it is zero. Consequently, every vertex of H is at distance at most 2k − 2 from F , and thus at distance at most 2k from f . The claim of the theorem follows. We now aim to prove a similar claim for graphs on surfaces and possibly with precolored vertices incident with several faces. We need an auxiliary result on surface cutting first. We use the following standard properties of graphs on surfaces [13]. Given a spanning tree T of a graph, a set S of edges not belonging to T and a vertex v, let TS,v denote the graph consisting of S and of the paths in T joining v with the vertices incident with edges of S. Lemma 7. Let H be a graph with a 2-cell embedding in a connected surface Σ of Euler genus g > 0 and without boundary. Let T be a spanning tree of H and v a vertex of H. Then, there exists a set S ⊆ E(H) \ E(T ) of size g such that ΣTS,v is a disk. Lemma 8. Let G be a 2-cell embedding in a connected surface Σ without bound- ary and let H be a natural embedding of the radial graph of G. Let G′ be an induced subgraph of G. Vertices u, v ∈ V (H) \ V (G′) lie in the same face of G′ if and only if there exists a path in H − V (G′) joining u with v. Let G be a graph with 2-cell embedding in a surface Σ and let F be a set of faces of G. A cycle C ⊆ G is F -contractible if there exists a disk ∆ ⊆ Σ bounded by C disjoint with all the faces of F . Lemma 9. Let G be a 2-cell embedding in a connected surface Σ without bound- ary and let F be a set of faces of G and r an integer, such that every cycle in G of length less than r is F -contractible. Let H be a natural embedding of the radial graph of G. There exists a spanning tree T of H, a vertex v ∈ V (G), closed disks ∆1, . . . , ∆k ⊂ Σ (for some k ≥ 0) and either a point or a closed disk ∆0, such that the following holds: 1. ∆0, . . . , ∆k are disjoint with the faces in F and have pairwise disjoint interiors. 2. If ∆0 is a point, then it is equal to v. If ∆0 is a closed disk, then the boundary of ∆0 is a cycle of length at most r − 1 in G, the vertex v lies in ∆0 and the distance in H from v to any vertex in the boundary of ∆0 is the same. 3. For 1 ≤ i ≤ k, the boundary of ∆i is a cycle of length at most r − 1 in G. 4. T ∩ ∆0 is connected. 5 5. For 1 ≤ i ≤ k, the graph obtained from T by removing the vertices con- tained in the interior of ∆i is connected. 6. Every path P ⊆ T starting with a vertex in the boundary of ∆0 such that no internal vertex of P is contained in ∆0 ∪ . . . ∆k has length at most 2V (G)/r + 2. Proof. Choose an arbitrary vertex v ∈ V (G), and let T be a breadth-first search tree of H rooted in v. Let Gi denote the subgraph of G induced by the vertices whose distance from v in H is 2i. Let i0 be the largest index such that Gi0 contains a cycle of length at most r − 1 bounding a disk containing v and disjoint with the faces in F , and let ∆0 be the disk; if no such index exists, then let i0 = 0 and let ∆0 = v. Let i1 > i0 be the smallest index such that V (Gi1 ) < r (Gi1 can be empty). Since every cycle in Gi1 has length at most r − 1, each such cycle is F -contractible. Let ∆1, . . . , ∆k be the maximal disks whose boundaries are cycles in Gi1 and that are disjoint with the faces of F . Note that the interiors of the disks are pairwise disjoint. Since i0 < i1, the boundary of ∆0 is disjoint with the boundaries of ∆1, . . . , ∆k, and the choice of i0 implies that ∆0 is actually disjoint with ∆1, . . . , ∆k. Let us show that T and the disks ∆0, . . . , ∆k satisfy the conclusions of the lemma. The first three properties follow by the construction. For the next two properties, the following observation is useful: for every i > 0, letting fi be the face of Gi that contains v, a vertex u ∈ V (H) is at distance at most 2i − 1 from v in H if and only if u lies in fi -- this follows from Lemma 8, as u is at distance at most 2i − 1 from v in H if and only if there exists a path from u to v in H − V (Gi). Furthermore, the same argument implies that all vertices of Gi are incident with this face fi. Therefore, if the boundary of ∆0 is a cycle in Gi0 , then fi0 is contained in ∆0, and consequently all vertices of T at distance at most 2i0 from v are contained inside ∆0. This implies that for every vertex u in the boundary of ∆0, the path from u to v in T is contained in ∆0. Note that every path in T that contains v is either contained in ∆0 or intersects the boundary of ∆0, and thus there exists a path from every vertex of T ∩ ∆0 to v contained in T ∩ ∆0. The fourth property follows. For the fifth property, note that v 6∈ ∆1 ∪ . . . ∪ ∆k, and that Σ − Gi ⊆ fi ∪ ∆1 ∪ . . . ∪ ∆k. Therefore, exactly the vertices of H at distance at least 2i1 + 1 are contained in the interiors of ∆1, . . . , ∆k. Since all vertices in the boundaries of these disks have distance 2i1 from v and T is a breadth-first search tree, there exists no path in T with endvertices outside of ∆i and with an internal vertex in the interior of ∆i for any 1 ≤ i ≤ k. The fifth property follows. By the choice of i1, we have V (Gi) ≥ r when i0 + 1 ≤ i ≤ i1 − 1. Since the graphs Gi0+1, . . . , Gi1−1 are pairwise vertex disjoint, we have V (G) ≥ (i1 − i0 − 1)r. Every path P ⊆ T with the properties described in the fifth claim contains at most one vertex of Gi for i0 ≤ i ≤ i1, and thus it has length at most 2(i1 − i0). The last property follows. Combined with Theorem 6 and Lemma 7, we obtain the result on surface cutting we mentioned before. 6 Lemma 10. Let G be a graph of girth at least five with a 2-cell embedding in a connected surface Σ of Euler genus g and without boundary, and let F be a set of faces of G and r an integer such that every cycle in G of length less than r is F -contractible. Let S be a set of vertices of G such that every vertex in S is incident with a face in F . Let L be an assignment of lists of size three to V (G). Let H be a natural embedding of the radial graph of G. If G is S- critical with respect to L, then there exists a subgraph Q ⊆ H with at most (2V (G)/r + 800 + 200 log r)(2g + F ) edges such that ΣQ is a disk. Proof. Note that 2g + F ≥ 1, as planar graphs of girth at least five are 3- choosable. Let T , v, ∆0, . . . , ∆k be obtained by Lemma 9. By Lemma 5, the subgraph of G embedded in ∆i is Fi-critical for 0 ≤ i ≤ k, where Fi is the intersection of the boundary of ∆i with G. By Theorem 6, we conclude that every vertex of T is at distance at most 2V (G)/r + 798 + 200 log r from v in T . Let S ⊆ E(H) \ E(T ) be the set of edges given by Lemma 7, where we set S = ∅ when g = 0. We let Q consist of TS,v and of the paths in T joining v with the vertices corresponding to the faces in F . Together with Corollary 3, this bounds the size of critical graphs. Lemma 11. Let G be a graph of girth at least five with an embedding in a surface Σ of Euler genus g and without boundary, and let F be a set of faces of G. Let c be the number of components of Σ. For a component Σ′ of Σ, let q(Σ′) = 2g′ + n′, where g′ is the Euler genus of Σ′ and n′ is the number of faces of F in Σ′. Let q be the maximum q(Σ′) over all components Σ′ of Σ. Suppose that every cycle in G of length less than 200q is F -contractible. Let S be a set of vertices of G such that every vertex in S is incident with a face in F . Let L be an assignment of lists of size three to V (G). If G is S-critical with respect to L, then V (G) ≤ 100S + 40000(2g + F − c)(10 + log q). Proof. We can assume that Σ is connected, as otherwise we can consider each component separately. Similarly, we can assume that the embedding of G is 2-cell, as otherwise we can cut Σ along a non-F -contractible curve contained inside a face of G and cap the resulting hole(s) with disk(s) -- this simplifies the embedding, does not increase q and when it increases F , it either decreases g or increases c. Note that 2g + F ≥ 1, as planar graphs of girth at least five are 3-choosable. If 2g + F = 1, then the claim follows from Corollary 3, hence assume that 2g + F ≥ 2. Let H be a natural embedding of the radial graph of G. Let Q be the subgraph of H obtained by Lemma 10. By Lemma 4, GQ is SQ-critical with respect to L. Note that SQ ≤ S + Pv∈V (Q)∩V (G) degQ(v) ≤ S + E(Q) ≤ S+V (G)/100+(2g+F )(2000+200 log q)). By Corollary 3, we have V (G) ≤ V (GQ) ≤ 50SQ ≤ 50S + V (G)/2 + 50(2g + F )(2000 + 200 log q)). The claim of the lemma follows, since 2g + F ≤ 2(2g + F − 1). Using this lemma (instead of Corollary 3), we prove the main result of this section -- a bound on distances for critical graphs on surfaces analogous to The- orem 6. Theorem 12. Let G be a graph of girth at least five with an embedding in a surface Σ of Euler genus g and without boundary. Let S be a set of vertices of G and F a set of faces of G such that every vertex in S is incident with 7 a face in F . Suppose that every cycle in G of length less than 200q is F - contractible, where q is defined as in Lemma 11. Let L be an assignment of lists of size three to V (G). If G is S-critical with respect to L, then every vertex of G either is at distance less than 200(C + 5 + log(1 + S/(C + 1))) from S or belongs to a connected component of G with at most 100C vertices, where C = 400(2g + F − 1)(10 + log q). Proof. Each component of G that contains no vertex of S has at most 100C ver- tices by Lemma 11. Therefore, we can assume that S intersects all components of G. For i ≥ 0, let Si be the set of vertices of G at distance exactly i from S. Let Gi denote the subgraph of G induced by Sj≥i Sj. Let ni = V (Gi) = Pj≥i Sj. Note that Gi is Si-critical by Lemma 5 and all vertices of Si are incident with one of at most F faces of Gi, and thus ni ≤ 100Si + 100C by Lemma 11. = 1 − ni−ni+1 = 1 − Si 200 for every i ≥ 0. Let k be the smallest index such that Sk < ni C + 1. For 0 ≤ i ≤ k, we have Si ≤ ni ≤ 100(S + C)0.995i, and thus k ≤ 200(5 + log(1 + S/(C + 1))). Since nk ≤ 100Sk + 100C ≤ 200C, we have nk+200C = 0. Consequently, every vertex of G is at distance less than k + 200C from S. The claim of the theorem follows. < 199 If Si > C, this implies that ni < 200Si, and thus ni+1 ni ni This theorem enables us to bound the tree-width of critical graphs, using the following result of Eppstein [6]. Theorem 13 (Eppstein). There exists a constant ct such that every graph G of Euler genus g and radius r has tree-width at most ct(g + 1)r. Furthermore, the tree decomposition of this width can be found in time O((g + 1)rV (G)). Corollary 14. Let g, s ≥ 0 be fixed integers. Let C = 0 if g = s = 0 and C = 400(2g + s − 1)(10 + log(2g + s)) otherwise. There exists an algorithm with the following specification. The input of the algorithm is a graph G of girth at least five embedded in a surface Σ of Euler genus at most g and without boundary, a set F of at most s faces of G such that every cycle in G of length at most 100C is F -contractible, a set S of vertices incident with the faces of F , and a list assignment L such that L(v) = 3 for v ∈ V (G) \ S and L(v) = 1 for v ∈ S. The algorithm correctly decides whether G is L-colorable. The time complexity of the algorithm is O(cid:0)(S + 1)K(g+s)V (G)(cid:1) for some absolute constant K. Proof. If g = s = 0, then G is L-colorable by Thomassen [15]; hence, assume that g + s ≥ 1. Let G1 be the subgraph of G induced by vertices at distance less than 200(C + 5 + log(1 + S/(C + 1))) from S. Note that if G is not L-colorable, then it contains a subgraph G0 with S ⊆ V (G0) that is S-critical and not L- colorable. Suppose that G0 has a component Q that does not contain a vertex of S. By Theorem 12, Q has at most 100C vertices. Since planar graphs of girth at least five are 3-choosable, Q contains a non-contractible cycle of length at most V (Q) ≤ 100C, contrary to the assumptions. Therefore, every component of G0 contains a vertex of S, and by Theorem 12, we have G0 ⊆ G1. It follows that G is L-colorable if and only if G1 is L-colorable. Let G2 be the graph obtained from G1 by adding a new vertex adjacent to all vertices of S. Note that G2 has radius at most 200(C +5+log(1+S/(C +1))) = O(log S) by Theorem 12 and that G2 can be embedded in a surface of Euler 8 genus at most g + 2s − 2. By Theorem 13, G2 (and thus also G1) has tree- width at most K ′(g + s) log(S + 1) for some absolute constant K ′. We apply the standard dynamic programming algorithm [10] for list-coloring graphs from lists of bounded size, which (for lists of size at most three) has time complexity eO(tw(G1))V (G1)). Since V (G1) ≤ V (G), this gives the desired bound on the time complexity of the algorithm. Let us remark that in the situation of Corollary 14, it is easy to find an L-coloring of G when it exists in time O(cid:0)V (G)K(g+max(s,1))+2(cid:1) as follows. We can assume that S is an independent set, as edges joining vertices of the same color would prevent the existence of an L-coloring, and edges joining vertices of different colors are irrelevant. If V (G) = S, then the list assignment L gives an L-coloring of G. Otherwise, there exists a vertex v ∈ V (G) \ S incident with a face of F . Let S′ = S ∪ {v}, and using the algorithm of Corollary 14, try all three possible colors for v and test whether the corresponding coloring of S′ extends to an L-coloring of G. If this succeeds for at least one color c, set L(v) := {c}, S := S′ and repeat the process until the whole graph is colored. 3 The algorithm A standard dynamic programming approach enables us to deal with short non- F -contractible cycles. Let us first consider the case of a graph embedded in the sphere with precolored vertices incident with at most two faces. Lemma 15. Let d be an integer such that 4 ≤ d ≤ ⌈100C0⌉, where C0 = 400(10 + log 2). There exists an algorithm Ad with the following specification. The input of the algorithm is a graph G of girth at least five embedded in the sphere, a set F of at most 2 faces of G such that every cycle in G of length at most d is F -contractible, a set S of vertices incident with the faces of F , and a list assignment L such that L(v) = 3 for v ∈ V (G)\S and L(v) = 1 for v ∈ S. The algorithm correctly decides whether G is L-colorable. The time complexity of the algorithm is O(cid:0)(S + 1)K0V (G)(cid:1) for some absolute constant K0. Proof. Let K0 = 2K for the constant K from Corollary 14. We proceed by induction on d, starting from the largest value. If d = ⌈100C0⌉, then we can use the algorithm of Corollary 14 as Ad. Hence, suppose that d < ⌈100C0⌉ and as the induction hypothesis assume that the algorithm Ad+1 exists. We now describe the algorithm Ad. If F ≤ 1, then we use the algorithm of Corollary 14, since then every cycle is F -contractible; thus, we can assume that F consists of two faces f1 and f2. If an edge joins two vertices u, v ∈ S such that L(u) = L(v), then G is not L-colorable. Otherwise, G is L-colorable if and only if G − uv is L-colorable. Consequently, we can also assume that S forms an independent set. Note that a cycle in G is not F -contractible if and only if it separates f1 from f2. Consider the dual G′ of G and a maximum flow from f1 to f2 in G′ (where all edges have capacity 1). The size of the flow is equal to the size of a minimum cut between f1 and f2 in G′, which corresponds to the shortest cycle separating f1 from f2 in G. If the size of the flow is at least d + 2 (which can be verified in O(V (G)) using the Ford-Fulkerson algorithm by stopping after we improve the flow d + 2 times), then every cycle in G of length at most d + 1 is 9 F -contractible and the lemma follows by induction. Therefore, assume that the maximum flow has size exactly d + 1. Then, there exists a unique (d + 1)-cycle Q1 in G separating f1 from f2 which is nearest to f1, corresponding to the cut of size d + 1 in G′ bounding the set of vertices that can be reached from f1 by augmenting paths. Let G1 be the graph obtained from G by removing all vertices between f1 and Q1, including V (f1) but not V (Q1), as well as all edges of Q1. In G1, we find the (d + 1)-cycle Q2 separating the face corresponding to Q1 from f2 that is nearest to Q1, and by removing the part between Q1 and Q2 as well as the edges of Q2, we obtain a graph G2. We repeat this as long as the current graph contains such a cycle. Let Q1, Q2, . . . , Qn be the sequence of (d+1)-cycles obtained in this way, let Q0 = S ∩V (f1) and let Qn+1 = S ∩V (f2). Note that we can inherit the flow from the dual of Gi to the dual of Gi+1 and that in order to find the cycle Qi+1, the algorithm visits only the vertices in V (Gi+1) \ V (Gi), for 1 ≤ i ≤ n − 1. Consequently we can find this sequence of cycles in time O(V (G)). For 0 ≤ i ≤ n, let Hi be the subgraph of G between Qi and Qi+1, not including the edges of Qi and Qi+1. Note that all cycles of length at most d + 1 in Hi are {Qi, Qi+1}-contractible and that for j ∈ {i, i + 1}, we either have V (Qj) = d + 1 or L assigns a unique coloring to Qj. Furthermore, n = O(V (G)) and only the vertices of Q1 ∪ Q2 ∪ . . . ∪ Qn can belong to several of the graphs Hi; thus, Pn i=0 V (Hi) = O(V (G)). For 0 ≤ i ≤ n, we determine the set Ψi of all L-colorings of V (Qi) ∪ V (Qi+1) that extend to an L-coloring of Hi, excluding those incompatible with the edges of Qi ∪ Qi+1. This can be done by applying the algorithm Ad+1 to Hi repeatedly, precoloring the vertices of Qi ∪ Qi+1 in all possible ways (the number of L-colorings of Qi ∪ Qi+1 is bounded by the constant 32d+2). The total time spend by this is O(cid:0)(S + 1)K0V (G)(cid:1). Finally, for 1 ≤ i ≤ n + 1, we determine the set Φi of all L-colorings of V (Q0) ∪ V (Qi) that extend to an L-coloring of the subgraph of G between Q0 and Qi (inclusive) -- we already know the set Φ1 = Ψ0, and Φi+1 can be obtained by combining Φi with Ψi in constant time. The time to determine Φn+1 is thus O(V (G)). The graph G is L-colorable if and only if Φn+1 is nonempty. Let us note that if d = 4, then the assumption on F -contractibility of all cycles of length at most d is void, since the graph has girth at least five; hence, we can drop the assumption entirely. A similar argument is used to give the algorithm in the general case. Given a graph G embedded in a surface Σ with boundary, a non-contractible cycle C in G is almost contractible if there exists a component b of the boundary of Σ such that C is contractible in the surface obtained from Σ by capping b with a disk; in this case, we say that C surrounds b. Theorem 16. Let g, s ≥ 0 be fixed integers. There exists an algorithm with the following specification. The input of the algorithm is a graph G of girth at least five embedded in a surface Σ of Euler genus at most g and without boundary, a set F of at most s faces of G, a set S of vertices incident with the faces of F , and a list assignment L such that L(v) = 3 for v ∈ V (G) \ S and L(v) = 1 for v ∈ S. The algorithm correctly decides whether G is L-colorable. The time complexity of the algorithm is O(cid:0)(S + 1)K(g+s)V (G)(cid:1) for some absolute constant K. 10 Proof. We proceed by induction, assuming that the theorem holds for all sur- faces of Euler genus less than g, and for all graphs embedded in a surface of Euler genus g with precolored vertices incident with fewer than s faces. If g = 0 and s ≤ 2, then we can use the algorithm A4 of Lemma 15. Therefore, assume that g > 0 or s > 2. Let C = 400(2g + s − 1)(10 + log(2g + s)). As usual, we can assume that S forms an independent set and that G is connected and its embedding is 2-cell. Let us drill a hole in each face of F , obtaining a surface Σ′. We use the algorithm (inspired by the result of Cabello and Mohar [1]) described in Dvor´ak et al. [5] before the proof of Theorem 8.3 to test whether the embedding of G in Σ′ contains a non-contractible cycle of length less than 100C that is not almost contractible, in time O(V (G)). Suppose that Q is such a cycle. For each L-coloring ψ of Q, let Lψ be the list assignment such that Lψ(v) = {ψ(v)} for v ∈ V (Q) and Lψ(v) = L(v) for v ∈ V (G) \ V (Q). There are only constantly many choices for ψ, and G is L-colorable if and only if it is Lψ-colorable for some L-coloring ψ of Q. Note that G is Lψ-colorable if and only if GQ is Lψ Q- colorable, and each component of the surface cΣQ gives rise to a simpler instance of the problem (either the component has smaller Euler genus than Σ, or it is homeomorphic to Σ, but the precolored vertices in GQ are incident with fewer than F faces in this component). The claim of the theorem follows by induction applied to each of the components (and all the possible colorings ψ). Therefore, we can assume that all non-contractible cycles of length at most 100C in the embedding of G on Σ′ are almost contractible. Since g > 0 or s > 2, the component of the boundary of Σ′ surrounded by such a cycle is unique. The closer inspection of the algorithm of Dvor´ak et al. [5] shows that it actually implements a data structure representing the graph G that can be initialized in time O(V (G)) and supports the following operations in a constant time: • Remove an edge or an isolated vertex. • Decide whether a vertex belongs to a non-contractible cycle of length at most 100C, and if that is the case, return such a cycle; furthermore, if the cycle is almost contractible, it decides which component of the boundary it surrounds. Using this data structure, we process the vertices of G one by one, testing whether they belong to an almost contractible cycle Q of length at most 100C. If that is the case, we remove all vertices and edges of G between Q and the surrounded component b of the boundary (including the edges, but not the vertices, of Q). The part of graph to be removed can be found by a depth- first search from b in time proportional to the size of the removed part. We then continue the process with the remaining vertices of G. We end up with a subgraph G′ of G. For each component b of the boundary of Σ′, let Sb denote the subset of S incident with the face of G corresponding to b. Let Gb denote the removed part of G between b and G′; if nonempty, V (Gb) ∩ V (G′) is a vertex set of a cycle Qb in Gb of length at most 100C that surrounds b in the embedding of G in Σ′. For each b, we determine the set of all L-colorings of Sb ∪ V (Qb) that extend to an L-coloring of Gb using the algorithm A4 of Lemma 15. Furthermore, note that the embedding of G′ in Σ′ contains no non-contractible cycle of length at most 100C, thus we can determine the set of all L-colorings of its intersection with S and with the cycles Qb using the 11 algorithm of Corollary 14. Combining these sets (whose size is bounded by a constant depending on g and s), we can decide whether G is L-colorable. Observe that this algorithm has the required time complexity. Also, a straightforward cutting argument enables us to deal with precol- ored vertices being contained in connected subgraphs instead of incident with a common face. Corollary 17. Let g, s ≥ 0 be fixed integers. There exists an algorithm with the following specification. The input of the algorithm is a graph G of girth at least five embedded in a surface Σ of Euler genus at most g and without boundary, a subgraph Q of G with at most s components, and a list assignment L such that L(v) = 3 for v ∈ V (G) \ V (Q) and L(v) = 1 for v ∈ V (Q). The algorithm correctly decides whether G is L-colorable. The time complexity of the algorithm is O(cid:0)(V (Q) + 1)K(g+s)V (G)(cid:1) for some absolute constant K. Proof. We can assume that Q is a forest and each component of Q has at least three edges (otherwise, remove or add edges to Q to make these conditions hold). Consequently, cΣQ is homeomorphic to Σ, GQ has girth at least five and each component of Q corresponds to a cycle in GQ bounding a face. Let S = V (QQ) and note that S = 2E(Q) < 2V (Q). Note also that G is L-colorable if and only if GQ is LQ-colorable, since all vertices of Q have lists of size one. The claim then follows by Theorem 16. Again, by coloring the vertices of G one by one, we can actually find an L-coloring of G when it exists, in time O(cid:0)V (G)K(g+max(s,1))+2(cid:1). 4 Choosability Here, we extend the algorithm of Theorem 16 to the case of 3-choosability. The basic ingredients are the following generalizations of Corollary 14 and Lemma 15. Let S be a set of vertices. We say that two list assignments for S are are equivalent when they differ only by renaming the colors. Let C(S) denote a maximal set of pairwise non-eqivalent assignments of lists of size three to S, and note that C(S) is finite. If G is a graph with S ⊆ V (G), then let C(S, G) denote the set consisting of all pairs (L0, Ψ) such that L0 ∈ C(S), Ψ is a set of L0-colorings of S and there exists a list assignment L for G such that L(v) = 3 for v ∈ V (G) \ S, L(v) = L0(v) for v ∈ S and an L0-coloring ψ of S extends to an L-coloring of G if and only if ψ ∈ Ψ. Corollary 18. Let g, s ≥ 0 be fixed integers. Let C = 0 if g = s = 0 and C = 400(2g + s − 1)(10 + log(2g + s)) otherwise. There exists a function fg,s and an algorithm with the following specification. The input of the algorithm is a graph G of girth at least five embedded in a surface Σ of Euler genus at most g and without boundary, a set F of at most s faces of G such that every cycle in G of length at most 100C is F -contractible and a set S of vertices incident with the faces of F . The algorithm outputs the set C(S, G) in time O(fg,s(S)V (G)). Proof. If g = s = 0, then G is 3-choosable by Thomassen [15], and C(S, G) consists of the pair (L0, {ψ0}), where L0 is the null list assignment and ψ0 is the null coloring. Hence, assume that g + s ≥ 1. Let G1 be the subgraph of 12 G induced by vertices at distance less than 200(C + 5 + log(1 + S/(C + 1))) from S. Consider any list assignment L such that L(v) = 3 for v ∈ V (G) \ S and L(v) = 1 for v ∈ S. As in Corollary 14, we have that G is L-colorable if and only if G1 is L-colorable. Consequently, C(S, G) = C(S, G1), and since G1 has bounded treewidth, we can determine C(S, G1) in linear time by a standard dynamic programming algorithm. Lemma 19. Let d be an integer such that 4 ≤ d ≤ ⌈100C0⌉, where C0 = 400(10 + log 2). There exists a function fd and an algorithm A′ d with the follow- ing specification. The input of the algorithm is a graph G of girth at least five embedded in the sphere, a set F of at most 2 faces of G such that every cycle in G of length at most d is F -contractible and a set S of vertices incident with the faces of F . The algorithm outputs a set C(S, G) in time O(fd(S)V (G)). Proof. As in Lemma 15, we proceed by induction on d, starting from the largest value (we use Corollary 18 as the basic case). Hence, suppose that d < ⌈100C0⌉ and as the induction hypothesis assume that the algorithm A′ d+1 exists. We find a maximal sequence Q1, Q2, . . . , Qn of non-crossing (d + 1)-cycles separating the faces f1 and f2 of F in the same way as in Lemma 15 and let Q0 = S ∩V (f1) and Qn+1 = S ∩ V (f2). For 0 ≤ i ≤ n, we then apply A′ d+1 to the subgraph Hi of G between Qi and Qi+1, obtaining C(V (Qi) ∪ V (Qi+1), Hi). Let Gk = S0≤i≤k Hi. We now determine C(V (Q0) ∪ V (Qk+1), Gk) for 0 ≤ k ≤ n by induction on k. Since G0 = H0, we can assume that k ≥ 1 and that C1 = C(V (Q0) ∪ V (Qk), Gk−1) is already known. Let C2 = C(V (Qk) ∪ V (Qk+1), Hk). By combining C1 with C2, we determine C3 = C(V (Q0)∪V (Qk)∪V (Qk+1), Gk) -- a pair (L0, Ψ) belongs to C3 if and only if there exist (L′ 0 , Ψ′′) ∈ C2 such that L′ 0 are restrictions of L0 to the respective sets and Ψ consists of colorings ψ such that Ψ′ and Ψ′′ contain the restriction of ψ to the respective sets. The set C(V (Q0) ∪ V (Qk+1), Gk) is obtained by including all pairs (L0, Ψ) such that there exists (L′ 0 extends L0 and Ψ consists of L0-colorings ψ such that an extension of ψ is contained in Ψ′. In the end, we have C(S, G) = C(V (Q0) ∪ V (Qn+1), Gn). 0, Ψ′) ∈ C3 such that L′ 0 and L′′ 0, Ψ′) ∈ C1 and (L′′ Now, to decide whether a graph G of girth at least five embedded in a fixed surface of genus g is 3-choosable, we cut G along short cycles as in the proof of Theorem 16. This way, we express G as an edge-disjoint union of graphs G1, . . . , Gk, where k is bounded by a function of g and the set S of vertices contained in at least two of these graphs has size bounded by a function of g. Furthermore, for 1 ≤ i ≤ k, the graph Gi with the set S ∩ V (Gi) satisfies either assumptions of Corollary 18 or of Lemma 19 with d = 4. Consequently, we can determine C(S, G) in linear time. The graph G is 3-choosable if and only if Ψ 6= ∅ for all (L0, Ψ) ∈ C(S, G). 5 Concluding remarks The degree of the polynomial bounding the time complexity of our algorithm depends mostly on the bound on the distance given by Theorem 12. The al- gorithm is easy to implement, especially in the planar case. While the bound in Theorem 12 is rather high, it seems likely that it is possible to reduce it 13 significantly. This could make the algorithm of Corollary 17 practical, at least for the special case of a planar graph with a connected precolored subgraph. Nevertheless, an interesting open question is whether we can eliminate the dependence of the exponent on the genus entirely, and thus obtain an FPT algorithm for the problem of extension of a precoloring of a connected subgraph of a graph embedded in a fixed surface. The same remark holds for the case of finding a coloring of a graph without precolored subgraph, where we currently have to introduce a precolored subgraph whose size may be up to Ω(pV (G)). References [1] Cabello, S., and Mohar, B. Finding shortest non-separating and non- contractible cycles for topologically embedded graphs. Discrete Comput. Geom. 37 (2007), 213 -- 235. [2] Dailey, D. Uniqueness of colorability and colorability of planar 4-regular graphs are np-complete. Discrete Math. 30 (1980), 289 -- 293. [3] Dvor´ak, Z., and Kawarabayashi, K. Choosability of planar graphs of girth 5. ArXiv 1109.2976 (2011). [4] Dvor´ak, Z., Kawarabayashi, K., and Thomas, R. Three-coloring triangle-free planar graphs in linear time. Trans. on Algorithms 7 (2011), article no. 41. [5] Dvor´ak, Z., Kr´al', D., and Thomas, R. Coloring triangle-free graphs on surfaces. In Proceedings of the twentieth Annual ACM-SIAM Symposium on Discrete Algorithms (Philadelphia, PA, USA, 2009), SODA '09, Society for Industrial and Applied Mathematics, pp. 120 -- 129. [6] Eppstein, D. Diameter and treewidth in minor-closed graph families. Algorithmica 27 (2000), 275 -- 291. [7] Erdos, P., Rubin, A. L., and Taylor, H. Choosability in graphs. Congr. Numer. 26 (1980), 125 -- 157. [8] Grotzsch, H. Ein Dreifarbenzatz fur Dreikreisfreie Netze auf der Kugel. Math.-Natur. Reihe 8 (1959), 109 -- 120. [9] Gutner, S. The complexity of planar graph choosability. Discrete Math. 159 (1996), 119 -- 130. [10] Jansen, K., and Scheffler, P. Generalized coloring for tree-like graphs. Discrete Appl. Math. 75 (1997), 135 -- 155. [11] Kawarabayashi, K.-i., and Mohar, B. List-color-critical graphs on a fixed surface. In Proceedings of the twentieth Annual ACM-SIAM Sympo- sium on Discrete Algorithms (Philadelphia, PA, USA, 2009), SODA '09, Society for Industrial and Applied Mathematics, pp. 1156 -- 1165. [12] Kowalik, L. Fast 3-coloring triangle-free planar graphs. In ESA (2004), S. Albers and T. Radzik, Eds., vol. 3221 of Lecture Notes in Computer Science, Springer, pp. 436 -- 447. 14 [13] Mohar, B., and Thomassen, C. Graphs on Surfaces. The Johns Hopkins University Press, Baltimore and London, 2001. [14] Postle, L. 5-List-Coloring Graphs on Surfaces. PhD thesis, Georgia Institute of Technology, 2012. [15] Thomassen, C. 3-list-coloring planar graphs of girth 5. J. Combin. The- ory, Ser. B 64 (1995), 101 -- 107. [16] Thomassen, C. Color-critical graphs on a fixed surface. J. Combin. Theory, Ser. B 70 (1997), 67 -- 100. [17] Thomassen, C. The chromatic number of a graph of girth 5 on a fixed surface. J. Combin. Theory, Ser. B 87 (2003), 38 -- 71. [18] Vizing, V. G. Vertex colorings with given colors (in russian). Metody Diskret. Analiz, Novosibirsk 29 (1976), 3 -- 10. [19] Voigt, M. A not 3-choosable planar graph without 3-cycles. Discrete Math. 146 (1995), 325 -- 328. 15
1106.2351
1
1106
2011-06-12T22:11:56
On vertex covers and matching number of trapezoid graphs
[ "cs.DS" ]
The intersection graph of a collection of trapezoids with corner points lying on two parallel lines is called a trapezoid graph. Using binary indexed tree data structure, we improve algorithms for calculating the size and the number of minimum vertex covers (or independent sets), as well as the total number of vertex covers, and reduce the time complexity from $O (n^2)$ to $O (n \log n)$, where $n$ is the number of trapezoids. Furthermore, we present the family of counterexamples for recently proposed algorithm with time complexity $O (n^2)$ for calculating the maximum cardinality matching in trapezoid graphs.
cs.DS
cs
On vertex covers and matching number of trapezoid graphs Aleksandar Ili´c ‡ Faculty of Sciences and Mathematics, Visegradska 33, 18000 Nis, Serbia e-mail: [email protected] Andreja Ili´c Faculty of Sciences and Mathematics, Visegradska 33, 18000 Nis, Serbia e-mail: [email protected] April 9, 2019 Abstract The intersection graph of a collection of trapezoids with corner points lying on two parallel lines is called a trapezoid graph. Using binary indexed tree data structure, we improve algorithms for calculating the size and the number of minimum vertex covers (or independent sets), as well as the total number of vertex covers, and reduce the time complexity from O(n2) to O(n log n), where n is the number of trapezoids. Furthermore, we present the family of counterexamples for recently proposed algorithm with time complexity O(n2) for calculating the maximum cardinality matching in trapezoid graphs. Keywords: trapezoid graphs; vertex cover; matching; algorithms; data structures; binary indexed tree. AMS Classifications: 05C85, 68R10. 1 Introduction A trapezoid diagram consists of two horizontal lines and a set of trapezoids with corner points lying on these two lines. A graph G = (V, E) is a trapezoid graph when a trapezoid diagram exists with trapezoid set T , such that each vertex i ∈ V corresponds to a trapezoid T (i) and an edge exists (i, j) ∈ E if and only if trapezoids T (i) and T (j) intersect within the trapezoid diagram. A trapezoid T (i) between these lines has four corner points a(i), b(i), c(i) and d(i) -- which represent the upper left, upper right, lower left and lower right corner points of trapezoid i, respectively. No two trapezoids share a common endpoint. Ma and Spinrad [23] showed that trapezoid graphs can be recognized in O(n2) time, while Mertzios and Corneil [24] designed structural trapezoid recognition algorithm based on the vertex splitting method in O(n(m + n)) time, which is easier for implementation. Here n stands for the number of vertices and m for the number of edges. Trapezoid graphs are perfect, subclass of cocomparability graphs and properly contain both interval graphs and permutation graphs [20]. Trapezoid graphs were first investigated by Corneil and Kamula [9]. These graphs and their generalizations were applied in various fields, including modeling channel routing problems in ‡Corresponding author. 1 VLSI design [11] and identifying the optimal chain of non-overlapping fragments in bioinformat- ics [1]. Many common graph problems, such as minimum connected dominating sets [29], all-pair shortest paths [26], maximum weighted cliques [3], all cut vertices [16], chromatic number and clique cover [12], all hinge vertices [4], minimum vertex covers [22] in trapezoid graphs, can be solved in polynomial time. For other related problems see [6, 10, 18, 19]. Let G = (V, E) be a simple undirected graph with V = n and E = m. A subset C ⊆ V is called a vertex cover (VC for short) of G if and only if every edge in E has at least one endpoint in C. A vertex cover C is called a minimal vertex cover if and only if no proper subset of C is also a vertex cover. The size of a vertex cover is the number of vertices that it contains. A vertex cover with minimum size is called a minimum vertex cover. Notably, a minimum VC is always a minimal VC, but a minimal VC may not be a minimum VC. Given a graph G and a fixed parameter k, determining whether G has a vertex cover of at most k vertices is one of the best-known NP complete problems [17]. Many recent studies have focused on developing faster algorithms for the VC problem in special classes of graphs. The number of vertex covers in a graph is important, particularly because this characteristic typically arises in problems related to network reliability [28]. Okamoto et al. [27] proposed O(n + m) time algorithms for counting the numbers of independent sets and maximum independent sets in a chordal graph. Lin et al. [20, 21] considered interval graphs and obtained efficient linear O(n) algorithms for counting the number of VCs, minimal VCs, minimum VCs, and maximum minimal VCs in an interval graph. Recently, Lin and Chen [22] presented O(n2) algorithms for the same vertex cover properties in a trapezoid graph. In graph theory, the notions of vertex cover and independent set are dual to each other. A subset I ⊆ V is called an independent set of G if and only if every edge in E is incident on no more than one vertex in I. Theorem 1.1 ([8]) A set C is a minimal (minimum) vertex cover of G if and only if V − C is an maximal (maximum) independent set of G. A matching in a graph is a set of edges in which no two edges are adjacent. A single edge in a graph is obviously a matching. A maximum matching is a matching with the maximum cardinality and the cardinality of the maximum matching is called a matching number. Cur- rently, the best known algorithm for the constructing maximum matching in general graphs is Edmonds' algorithm [14, 25], which is based on the alternating paths, blossom and shrinking and runs in time O(EpV ). For special classes of graphs, such as interval, chordal and per- mutation graphs, more efficient algorithms were designed (see [2, 5, 7] and references therein). Ghosh and Pal [15] presented an efficient algorithm to find the maximum matching in trapezoid graphs, which turns out to be not correct. The rest of the paper is organized as follows. In Section 2 we introduce the binary indexed tree data structure. In Section 3 we design O(n log n) time dynamic programming algorithm for calculating the size of the minimum vertex cover, the number of vertex covers and the number of minimum vertex covers, improving the algorithms from [22]. In Section 4 we present family of counterexamples for O(n2) algorithm from [15] for finding the maximum matching in trapezoid graphs. 2 Binary indexed data structure The binary indexed tree (BIT) is an efficient data structure introduced by Fenwick [13] for maintaining the cumulative frequencies. The BIT was first used to support dynamic arithmetic data compression and algorithm coding. 2 Let A be an array of n elements. The binary indexed tree supports the following basic operations: (i) for given value x and index i, add x to the element A(i), 1 ≤ i ≤ n; (ii) for given interval [1, i], find the sum of values A(1), A(2), . . . , A(i), 1 ≤ i ≤ n. Naive implementation of these operations have complexities O(1) and O(n), respectively. We can achieve better complexity, if we speed up the second operation which will also affect the first operation. Another approach is to maintain all partial sums from A(1) to A(i) for 1 ≤ i ≤ n. This way the operations have complexities O(n) and O(1), respectively. The main idea of binary indexed tree structure is that sum of elements from the segment [1, i] can be represented as sum of appropriate set of subsegments. The BIT structure is based on decomposition of the cumulative sums into segments and the operations to access this data structure are based on the binary representation of the index. This way the time complexity for both operations will be the same O(log n). We want to construct these subsegments such that each element is contained in at most log n subsegments, which means that we have to change the partial sums of at most log n subsegments for the first procedure. On the other hand, we want to construct these subsegments such that for every 1 ≤ i ≤ n the subsegment [1, i] is divided in at most log n subsegments. It follows that these subsegments can be [i − 2r(i) + 1, i], where r(i) is the position of the last digit 1 (from left to right) in the binary representation of the index i. We store the sums of subsegments in the array T ree (see Algorithm 1 and Algorithm 2), and the element T ree(i) represents the sum of elements from index i − 2r(i) + 1 to i. The structure is space-efficient in the sense that it needs the same amount of storage as just a simple array of n elements. Instead of sum, one can use any distributive function (such as maximum, minimum, product). We have the following Proposition 2.1 Calculating the sum of the elements from A(1) to A(i), 1 ≤ i ≤ n, and updating the element A(i) in the binary indexed tree is performed in O(log n) time. The fundamental operation involves calculating a new index by stripping the least significant 1 from the old index, and repeating this operation until the index is zero. For example, to read the cumulative sum A(1) + A(2) + . . . + A(11), we form a sum T ree(11) + T ree(10) + T ree(8) = (cid:16)A(11)(cid:17) + (cid:16)A(9) + A(10)(cid:17) + (cid:16)A(1) + A(2) + . . . + A(8)(cid:17). An illustrative example is presented in Table 1. i A T ree Cumulative sums 1 1 1 1 2 0 1 1 3 2 2 3 4 1 4 4 5 1 1 5 6 3 4 8 7 0 0 8 8 4 12 12 9 2 2 14 10 5 7 19 11 2 2 21 12 2 11 23 13 3 3 26 14 1 4 27 15 0 0 27 16 2 29 29 Table 1: An example with array A of length n = 16, binary indexed tree T ree and cumulative sums. Using the fast bitwise AND operator, we can calculate the largest power of 2 dividing the integer n simply as r(n) = n AN D (−n). 3 Algorithm 1: Updating the binary indexed tree. Input: The value value and element index index. while index ≤ n do T ree[index] = T ree[index] + value; index = index + (index and (−index)); end Algorithm 2: Calculating the cumulative sum. Input: The index index. Output: The sum of elements A[1], A[2], . . . , A[index]. sum = 0; while index > 0 do sum = sum + T ree[index]; index = index − (index and (−index)); end return sum; 3 The algorithm for minimum vertex covers Let T = {1, 2, . . . , n} denote the set of trapezoids in the trapezoid graph G = (V, E). For simplicity, the trapezoid in T that corresponds to vertex i in V is called trapezoid T (i). Without loss of generality, the points on each horizontal line of the trapezoid diagram are labeled with distinct integers between 1 and 2n. For simplicity and easier implementation, we will consider the maximum independent sets (according to Theorem 1.1). At the beginning, we add two dummy trapezoids 0 and n + 1 to T , where a(0) = b(0) = c(0) = d(0) = 0 for the vertex 0 and a(n + 1) = b(n + 1) = c(n + 1) = d(n + 1) = 2n + 1 for the vertex n + 1. Trapezoid i lies entirely to the left of trapezoid j, denoted by i ≪ j, if b(i) < a(j) and d(i) < c(j). It follows that ≪ is a partial order over the trapezoid set T and (T, ≪) is a strictly partially ordered set. In order to get O(n log n) algorithms, we will use binary indexed tree data structure for sum and maximum functions. 3.1 The size of maximum independent set and the total number of indepen- dent sets Arrange all trapezoids by the upper left corner a(i). Let max ind(i) denote the size of the maximum independent set of T (1), T (2), . . . , T (i − 1), T (i) that contain trapezoid T (i). For the starting value, we set max ind(0) = 0. The following recurrent relation holds max ind(i) = max{1 + max ind(k), 0 ≤ k < i and T (k) ≪ T (i)}. This produces a simple O(n2) dynamic programming algorithm (similar to [22]). To speed up the above algorithm, we will store the values from max ind in the binary indexed tree cum max for maintaining the partial maximums. First initialize each element of cum max with −1. We need an additional array index, such that index(j) contains the index of the trapezoid with left or right coordinate equal to j. We are going to traverse the coordinates from 0 to 2n + 1, and let j be the current coordinate. In order to detect which already processed 4 trapezoids are to the left of the current trapezoid T (i), we calculate the value max ind(i) when the current coordinate is the left upper coordinate of a(i) and insert it in the binary indexed tree when it is the right upper coordinate b(i). Then we have two cases: (i) coordinate j is the upper left coordinate of the trapezoid T (i). We only need to consider the trapezoids that have lower right coordinate smaller than c(i). As explained, these trapezoids have their corresponding values stored in the segment [1, c(i)] in the binary indexed tree and therefore we can calculate max ind(i) based on the maximum values among cum max(1), cum max(2), . . . , cum max(c(i)). (ii) coordinate j is the upper right coordinate of the trapezoid T (i). In this case, the value max ind(i) is already calculated and we put this value in the binary indexed tree at the position d(i). The final solution is max ind(n + 1) − 1. The pseudo-code is presented in Algorithm 3. Algorithm 3: The size of the maximum independent set. Input: The trapezoids T and the array index. Output: The number of maximum independent sets stored in the array max ind. Initialize binary indexed tree for maximum cum max; for j = 0 to 2n + 1 do i = index[j]; if a[i] = j then max ind[i] = Calculate(c[i]) + 1; end else // b[i] = j Update(d[i], max ind[i]); end end return max ind[n + 1] − 1; The set of all VCs and the number of VCs of G are denoted by V C(G) and V C(G), respectively. Let NG(v) be the set of vertices adjacent to v in the graph G. In [22] the authors proved the following result. Lemma 3.1 For a graph G and arbitrary vertex v ∈ V , it holds V C(G) = V C(G − v) + V C(G − v − NG(v)). For counting the total number of independent sets, we can use the same method as above. The only difference is that we will have sum instead of maximum function in the binary indexed tree. Let num ind(i) denote the number of independent sets of trapezoids T (1), T (2), . . . , T (i − 1), T (i) that contain trapezoid T (i). According to Lemma 3.1 the following recurrent relation holds num ind(k). num ind(i) = 1 + X 0≤k≤i, T (k)≪T (i) The total number of independent sets is simply num ind(n + 1) − 1 and time complexity is the same O(n log n). 5 3.2 The number of maximum independent sets For counting the number of maximum independent sets, we will need one additional array num max ind, such that num max ind(i) represents the number of maximum independent sets among trapezoids T (1), T (2), . . . , T (i − 1), T (i) such that T (i) belongs to the independent set. After running the algorithm for calculating the array max ind, for each 1 ≤ i ≤ n we need to sum the number of independent sets of all indices j, such that T (j) ≪ T (i) and max ind(j) + 1 = max ind(i) in order to get the number of independent sets with maximum cardinality. The pseudo-code of the algorithm for counting the number of maximum independent sets from [22] is presented in Algorithm 4. Algorithm 4: The number of maximum independent sets. Input: The trapezoids T and the array max ind. Output: The number of maximum independent sets stored in the array num max ind. num max ind[0] = 1; for i = 1 to n + 1 do num max ind[i] = 0; for j = 0 to i − 1 do if (max ind[j] + 1 = max ind[i]) and (a[j] > b[i]) and (c[j] > d[i]) then num max ind[i] = num max ind[i] + num max ind[j]; end end end return num max ind[n + 1] − 1; We will use again binary indexed trees for designing O(n log n) algorithm. The main problem is how to manipulate the partial sums. Namely, for each trapezoid T (i), we need to sum the values num max ind(j) of those trapezoids T (j) which are entirely on the left of T (i) with additional condition max ind(j) + 1 = max ind(i). This can be done by considering all pairs (k, k + 1) of two neighboring values 1 ≤ k ≤ max ind(n + 1). Using two additional arrays for the coordinates and trapezoid indices, we can traverse trapezoids T (i) from left to right, such that max ind(i) = k or max ind(i) = k + 1. First, for each 1 ≤ k ≤ max ind(n + 1) one needs to carefully preprocess all trapezoids and store the indices and coordinates of all trapezoids T (i) with max ind(i) = k in order to keep the memory limit O(n). Therefore, all trapezoids will be stored in the dynamic array of arrays S, such that S(k) contains all trapezoids T (i) with max ind(i) = k. Then we fill the binary indexed tree with the values for trapezoids with max ind(i) = k, and calculate the value num max ind(i) for trapezoids with max ind(i) = k + 1, as before. Instead of resetting the binary indexed tree for each k, we can again traverse the trapezoids with max ind(i) = k and update the values of BIT to 0. Since every trapezoid will be added and removed exactly once from the binary indexed tree data structure, the total time complexity is O(n log n). This reusing of the data structure is novel approach to the best of our knowledge and makes this problem very interesting. We conclude this section by summing the results in the following theorem. Theorem 3.2 The proposed algorithms calculate the size and the number of maximum indepen- dent sets, as well as the total number of independent sets in time O(n log n) of trapezoid graph G with n vertices. 6 One can easily extend this algorithm for efficient construction the independence polynomial of a trapezoid graph I(G, x) = α(G) X k=0 skxk, where sk is the number of independent sets of cardinality k and α(G) is the independence number of G. 4 The algorithm for the maximum matching Ghosh and Pal [15] presented an efficient algorithm for finding the maximum matching in trape- zoid graphs. The proposed algorithm takes O(n2) time and O(n + m) space. They defined the right spread f (i) of a trapezoid T (i) as the maximum max{b(i), d(i)}. Let M be the set of edges which form a matching of the graph G. Deletion of a vertex from the graph means deletion of that vertex and its adjacent edges. The algorithm is designed as follows. Calculate the right spread f (i) and arrange all trape- zoids by f in ascending order for 1 ≤ i ≤ n in linear time O(n). Select the trapezoid i with the minimum value of the right spread f (i). After that, select the second minimum value f (j). If trapezoids T (i) and T (j) are adjacent, then put the edge (i, j) in the maximum matching M , remove the vertices i and j from the graph G and mark the corresponding elements of the array f . If (i, j) 6∈ E(G) then continue selecting the next minimum elements f (j′) from the array f until the trapezoids i and j′ are adjacent. In that case remove the vertices i and j′, put the edge (i, j′) in the maximum matching M and mark the corresponding elements of f ; otherwise remove the trapezoid i from the graph G since it cannot be matched. Continue this procedure as long as V (G) > 1. Since for each trapezoid we potentially traverse all trapezoids with larger values f (i), the time complexity of the proposed algorithm is O(n2). Figure 1: The minimal counterexample for the matching algorithm. Obviously, the algorithm works for any set of n = 3 trapezoids . In the configuration on Figure 2, there are four trapezoids and only trapezoids T (3) and T (4) are not adjacent. The trapezoids are ordered such that f (1) < f (2) < f (3) < f (4). By proposed algorithm in [15], we will match the trapezoids 1 and 2 and get the maximal matching of cardinality 1. But obviously, the size of the maximum matching is 2 by pairing the trapezoids (1, 3) and (2, 4). Therefore, this algorithm is not correct and gives only an approximation for the maximum matching. One can easily construct a family of counterexamples based on this minimal example by adding trapezoids to the left and right. We leave as an open problem to design more efficient algorithm for finding maximum match- ing in trapezoid graphs. Acknowledgement. This work was supported by Research Grants 174010 and 174033 of Serbian Ministry of Education and Science. 7 References [1] M. I. Abouelhoda, E. Ohlebusch, Chaining algorithms for multiple genome comparison, J. Discrete Algorithms 3 (2005) 321 -- 341. [2] M. G. Andrews, M. J. Atallah, D. Z. Chen, D. T. Lee, Parallel Algorithms for Maximum Matching in Complements of Interval Graphs and Related Problems, Algorithmica 26 (2000) 263 -- 289. [3] D. Bera, M. Pal, T. K. Pal, An efficient algorithm to generate all maximal cliques on trapezoid graphs, Int. J. Comput. Math. 79 (2002) 1057 -- 1065. [4] D. Bera, M. Pal, T. K. Pal, An Efficient Algorithm for Finding All Hinge Vertices on Trapezoid Graphs, Theory Comput. Systems 36 (2003) 17 -- 27. [5] M. S. Chang, Algorithms for maximum matching and minimum fill-in on chordal bipartite graphs, Lecture Notes in Computer Science 1178, Springer, Berlin, 1996, 146 -- 155. [6] F. Cheah, D. G. Corneil, On the structure of trapezoid graphs, Discrete Appl. Math. 66 (1996) 109 -- 133. [7] Y. Chung, K. Park, Y, Cho, Parallel Maximum Matching Algorithms in Interval Graphs, International Conference on Parallel and Distributed Systems, 1997, 602 -- 609. [8] T. H. Cormen, C. E. Leiserson, R. L. Rivest, C. Stein, Introduction to Algorithms, Second Edition, MIT Press, 2001. [9] D. G. Corneil, P. A. Kamula, Extensions of permutation and interval graphs, In: Proceed- ings of 18th Southeastern Conference on Combinatorics, Graph Theory and Computing, 1987, 267 -- 275. [10] C. Crespelle, P. Gambette, Unrestricted and complete Breadth First Search of trapezoid graphs in O(n) time, Inform. Process. Lett. 110 (2010) 497 -- 502. [11] I. Dagan, M. C. Golumbic, R. Y. Pinter, Trapezoid graphs and their coloring, Discrete Appl. Math. 21 (1988) 35 -- 46. [12] S. Felsner, R. Muller, L. Wernisch, Trapezoid graphs and generalizations, geometry and algorithms, Discrete Appl. Math. 74 (1997) 13 -- 32. [13] P. M. Fenwick, A new data structure for cumulative frequency tables, Software - Practice and Experience 24 (1994), 327 -- 336. [14] H. N. Gabow, Data structures for weighted matching and nearest common ancestors with linking, in: Proceedings of the First Annual ACM SIAM Symposium on Discrete Algo- rithms, 1990, 434 -- 443. [15] P. K. Ghosh, M. Pal, An efficient algorithm to find the maximum matching on trapezoid graphs, J. Korean Soc. Ind. Appl. Math. IT Series 9 (2) (2005) 13 -- 20. [16] M. Hota, M. Pal, T. K. Pal, Optimal sequential and parallel algorithms to compute all cut vertices on trapezoid graphs, Comput. Optim. Appl. 27 (1) (2004) 95 -- 113. 8 [17] R. M. Karp, Reducibility among combinatorial problems, In: R. E. Miller, J. W. Thatcher (Eds.), Complexity of Computer Computation, Plenum Press, New York, 1972, 85 -- 103. [18] Y. D. Liang, Domination in trapezoid graphs, Inform. Process. Lett. 52 (1994) 309 -- 315. [19] Y. D. Liang, Steiner set and connected domination in trapezoid graphs, Inform. Process. Lett. 56 (1995) 101 -- 108. [20] M. S. Lin, Fast and simple algorithms to count the number of vertex covers in an interval graph, Inform. Process. Lett. 102 (2007) 143 -- 146. [21] M. S. Lin, Y. J. Chen, Linear time algorithms for counting the number of minimal vertex covers with minimum/maximum size in an interval graph, Inform. Process. Lett. 107 (2008) 257 -- 264. [22] M. S. Lin, Y. J. Chen, Counting the number of vertex covers in trapezoid graph, Inform. Process. Lett. 109 (2009) 1187 -- 1192. [23] T. H. Ma, J. P. Spinrad, On the 2-chain subgraph cover and related problems, J. Algorithms 17 (1994) 251 -- 268. [24] G. B. Mertzios, D. G. Corneil, Vertex splitting and the recognition of trapezoid graphs, Technical Report AIB-2009-16, RWTH Aachen University, 2009. [25] S. Micali, V. V. Vazirani, An O(pV · E) algorithm for finding maximum matching in general graphs, Proceedings of the 21st IEEE Symposiums on Foundations of Computer Science, 1980, 17 -- 27. [26] S. Mondal, M. Pal, T. K. Pal, An optimal algorithm for solving all-pairs shortest paths on trapezoid graphs, Int. J. Comput. Eng. Sci. (IJCES) 3 (2002) 103 -- 116. [27] Y. Okamoto, T. Uno, R. Uehara, Counting the number of independent sets in chordal graphs, J. Discrete Algorithms 6 (2) (2005) 229 -- 242. [28] J. S. Provan, M. O. Ball, The complexity of counting cuts and of computing the probability that a graph is connected, SIAM J. Computing 12 (4) (1983) 777 -- 788. [29] Y. T. Tsai, Y. L. Lin, F. R. Hsu, Efficient algorithms for the minimum connected domination on trapezoid graphs, Inform. Sci. 177 (2007) 2405 -- 2417. 9
1307.3621
1
1307
2013-07-13T07:41:01
A Polynomial-time Approximation Scheme for Fault-tolerant Distributed Storage
[ "cs.DS" ]
We consider a problem which has received considerable attention in systems literature because of its applications to routing in delay tolerant networks and replica placement in distributed storage systems. In abstract terms the problem can be stated as follows: Given a random variable $X$ generated by a known product distribution over $\{0,1\}^n$ and a target value $0 \leq \theta \leq 1$, output a non-negative vector $w$, with $\|w\|_1 \le 1$, which maximizes the probability of the event $w \cdot X \ge \theta$. This is a challenging non-convex optimization problem for which even computing the value $\Pr[w \cdot X \ge \theta]$ of a proposed solution vector $w$ is #P-hard. We provide an additive EPTAS for this problem which, for constant-bounded product distributions, runs in $ \poly(n) \cdot 2^{\poly(1/\eps)}$ time and outputs an $\eps$-approximately optimal solution vector $w$ for this problem. Our approach is inspired by, and extends, recent structural results from the complexity-theoretic study of linear threshold functions. Furthermore, in spite of the objective function being non-smooth, we give a \emph{unicriterion} PTAS while previous work for such objective functions has typically led to a \emph{bicriterion} PTAS. We believe our techniques may be applicable to get unicriterion PTAS for other non-smooth objective functions.
cs.DS
cs
A Polynomial-time Approximation Scheme for Fault-tolerant Distributed Storage Constantinos Daskalakis∗ Anindya De† Ilias Diakonikolas‡ Ankur Moitra§ Rocco A. Servedio¶ Abstract We consider a problem which has received considerable attention in systems literature because of its applications to routing in delay tolerant networks and replica placement in distributed storage systems. In abstract terms the problem can be stated as follows: Given a random variable X generated by a known product distribution over {0, 1}n and a target value 0 ≤ θ ≤ 1, output a non-negative vector w, with kwk1 ≤ 1, which maximizes the probability of the event w · X ≥ θ. This is a challenging non-convex optimization problem for which even computing the value Pr[w · X ≥ θ] of a proposed solution vector w is #P-hard. We provide an additive EPTAS for this problem which, for constant-bounded product distributions, runs in poly(n) · 2poly(1/ǫ) time and outputs an ǫ-approximately optimal solution vector w for this prob- lem. Our approach is inspired by, and extends, recent structural results from the complexity-theoretic study of linear threshold functions. Furthermore, in spite of the objective function being non-smooth, we give a unicriterion PTAS while previous work for such objective functions has typically led to a bicrite- rion PTAS. We believe our techniques may be applicable to get unicriterion PTAS for other non-smooth objective functions. 3 1 0 2 l u J 3 1 ] S D . s c [ 1 v 1 2 6 3 . 7 0 3 1 : v i X r a [email protected]. ∗MIT. Email: †UC Berkeley. Email: ‡University of Edinburgh. Email: [email protected]. §Princeton and IAS. Email: [email protected]. ¶Columbia University. Email: [email protected]. [email protected]. 1 Introduction Many applications involve designing a system that will perform well in an uncertain environment. Sources of uncertainty include (for example) the demand when we are designing a server, the congestion when we are designing a routing protocol, and the failure of the system's own components when we are designing a distributed system. Such uncertainties are often modeled as stochastic variables, giving rise to non-linear and non-convex optimization problems. In this paper, we study a non-convex stochastic optimization problem that has received considerable attention in the systems literature [JDPF05, Fal03, LDT09, LDT10a, LDT10b, SRFS10] but has remained poorly understood. The main motivation for studying this problem comes from distributed storage [DPR05, JB03, LDT09, SRFS10]. The goal in this literature is to develop methods for storing data among a set of faulty processors in a way that makes it possible to recover the data in its entirety despite processor failures. Clearly, to perform this task we need to use some form of redundancy, as otherwise a single processor failure could cause permanent loss of data. In particular, this task contains as subproblems both the choice of an error correcting code and the decision of how to allocate the encoded data into the failure-prone processors, resulting in an enormous design space. An important observation that is used throughout the literature is that these two subproblems can be decoupled through the use of erasure codes (see, e.g., [Lub02, LMSS02, Mit04, Sho06]). Such codes can be used to encode the original data so that with high probability any large enough subset of encoded data can be used to reconstruct the original data. In view of this observation, we can formulate the distributed storage problem as a much simpler to state problem: Suppose that our original data has size θ GB for some 0 ≤ θ ≤ 1, and we use an erasure code to generate 1 GB of encoded data. The goal is to allocate the data among n failure-prone nodes so as to maximize the probability that the original data can be recovered. The standard formulation of the problem [DPR05, JB03, LDT09, SRFS10] is that each node i has some known probability 1− pi of failing, and that these failures are independent across different nodes. So, mathematically our goal is to solve the following problem, which we call Problem (P): Input: An n-vector of probabilities p = (p1, . . . , pn) ∈ [0, 1]n and a parameter θ ∈ [0, 1]. For i ∈ [n] let µpi be the distribution on {0, 1} with µpi(1) = pi, and let the corresponding product distribution over {0, 1}n be denoted by Dp =Nn Output: A weight vector w = (w1, . . . , wn) ∈ Rn ≥0 satisfying kwk1 ≤ 1 (such a w is said to be a feasible solution). The goal is to maximize i=1 µpi. Obj(w) def = PrX∼Dp [w · X ≥ θ] . A feasible solution that maximizes Obj(w) is said to be an optimal solution. We will denote by opt = opt(p, θ) the maximum value of any feasible solution. In the above formulation wi denotes the amount of data that we decide to store in the i-th storage node, and Xi is the indicator random variable of the event that the i-th storage node does not fail. Before we proceed, we point out a connection of the optimization problem (P) above with the class of Boolean halfspaces or Linear Threshold Functions (LTFs) that will be crucially exploited throughout this paper. Recall that a Boolean function f : {0, 1}n → {0, 1} is a halfspace if there exists a weight- vector v ∈ Rn and a threshold t ∈ R so that f (x) = 1 if and only if v · x ≥ t. Hence, the objective function value Obj(w) of a feasible weight-vector w (i.e., w ∈ Rn ≥0 with kwk1 ≤ 1) can be equivalently expressed as is the halfspace with weight-vector Obj(w) = PrX∼Dp [hw,θ(X) = 1], where hw,θ(x) = 1{x∈{0,1}n:w·x≥θ} w and threshold θ. 1 We remark that, even though the feasible set is continuous, it is not difficult to show that there exists a rational optimal solution. In particular, analogous to the linear-algebraic arguments [MTT61, Mur71, Rag88], we can also show that there always exists an optimal solution with bit-complexity polynomially bounded in n; in fact, one with at most O(n2 log n) bits which is best possible [Has94]. (As a corollary, the supremum is always attained and problem (P) is well-defined.) 1.1 Previous and Related Work Previous Work on the Problem. The stochastic design problem (P) stated above was formulated explicitly in the work of Jain et al. [JDPF05]. That work was motivated by the problem of routing in Delay Tolerant Networks [JFP04]. These networks are characterized by a lack of consistent end-to-end paths, due to inter- ruptions that may be either planned or unplanned, and selecting routing paths is considered to be one of the most challenging problems. The authors of [JDPF05] reduce the route selection problem to Problem (P) in a range of settings of interest, and study the structure of the optimal partition as well as its computational complexity, albeit with inconclusive theoretical results. One of the special cases of the problem considered in [JDPF05] is the case where all the pi's are equal, i.e., when p1 = . . . = pn = p. Even in this case, the structure of the optimal solution is not well-understood. It is natural to expect that the optimal weight vector is obtained by equally splitting the allowed unit of weight over a subset of the indices, and setting the weights to be 0 on all other indices (in other words, set w1 = w2 = . . . = wk = 1 k and wk+1 = . . . = wn = 0, for some k). The authors of [JDPF05] consider the performance of this strategy for different values of p and θ, as do the papers [LDT09, LDT10a, LDT10b]. Surprisingly, such partitions are not necessarily optimal. For a counter-example, communicated to us by R. Kleinberg [Kle06], consider the setting where n = 5, θ = 5/12 and p = 1 − ǫ, for sufficiently small ǫ. In this case, the allocation vector w = (1/4, 1/4, 1/6, 1/6, 1/6) performs better than the uniform weight vector over any subset of the coordinates {1, . . . , 5}. There has also been work on a related distributed storage problem [SRFS10] that uses a slightly different model of node failures. In this model, instead of every node failing with probability p, a random subset of nodes of size pn is assumed to fail. In this setting, the conjecture that certain symmetric allocations are optimal is related to a conjecture of Erdos [Erd65] on the maximum number of edges in a k-uniform hypergraph whose (fractional) matching size is at most s (see [AFH+12] for a detailed discussion of the connection). Related Work. Stochastic optimization is an important research area with diverse applications having its roots in the work of Dantzig [Dan55] and Beale [Bea55] that has been extensively studied since the 1950's (see e.g., [BL97] for a book on the topic). During the past couple of decades, there has been an extensive lit- erature on efficient approximation algorithms for stochastic combinatorial optimization problems in various settings, see e.g., [KRT97b, DGV08, BGK11, Nik10, Swa11, LD11, LY13] and references therein. In many of these works, one wants to select a subset of (discrete independent) random variables whose sum optimizes a certain non-linear function. For example, the objective function of our problem (P) cor- responds to the threshold probability maximization problem [Nik10, LY13]. Note that, while the solution space in the aforementioned works is typically discrete and finite in nature, the solution space for our prob- lem is continuous. In particular, it is not always possible to discretize the space without losing a lot in the objective function value (see Section 1.3 for a detailed explanation of the difficulties in our setting). Regarding threshold probability maximization, Li and Yuan [LY13] obtained bicriterion additive PTAS for stochastic versions of classical combinatorial problems, such as shortest paths, spanning trees, matchings and knapsacks. Roughly, they obtain a bicriterion guarantee because the function to be optimized does not have a bounded Lipschitz constant. In contrast, even though the Pr[w · X ≥ θ] function that we are optimizing does not have a bounded Lipschitz constant, we are able to obtain a unicriterion PTAS by exploiting new structural properties of near-optimal solutions that we establish in this work, as described below. In terms of techniques, [LY13] use Poisson approximation and discretization as a main component 2 of their results. We note that this approach is not directly applicable in our setting, since we are dealing with a weighted sum of Bernoulli random variables with arbitrary real weights and we are shooting for a unicriterion PTAS. We view the unicriterion guarantee that we achieve as an important contribution of the techniques in this work. 1.2 Our results It is unlikely that Problem (P) can be solved exactly in polynomial time. Note that (even for the very special case when each pi equals 1/2) (exactly) evaluating the objective function Obj(w) of a candidate solution w is #P -hard. (This follows by a straightforward reduction from the counting version of knapsack, see e.g., Theorem 2.1 of [KRT97a] for a proof.) In fact, problem (P) is easily seen to lie in N P #P , and we are not aware of a better upper bound. We conjecture that the exact problem is intractable, namely #P -hard. The focus of this paper is on efficient approximation algorithms. As our main contribution, we give an additive EPTAS for (P) for the case that each pi is bounded away from 0. That is, we give an algorithm that for every ǫ > 0, outputs a feasible solution w such that Obj(w) is within an additive ǫ of the optimal value. An informal statement of our main result follows (see Theorem 5 for a detailed statement): Theorem 1. [Main Result -- informal statement] Fix any ǫ > 0 and let p = (p1, . . . , pn) be any input instance such that mini pi ≥ ǫΩ(1). There is a randomized algorithm which, for any such input vector p and any input threshold 0 ≤ θ ≤ 1, runs in poly(n) · 2poly(1/ǫ) time and with high probability outputs a feasible solution vector w whose value is within an additive ǫ of the optimal. 1.3 Our techniques Background. In recent years, there has been a surge of research interest in concrete complexity the- ory on various problems concerning halfspaces. These include constructions of low weight approxima- tions of halfspaces [Ser07, DS09, DDFS12], PRGs for halfspaces [DGJ+10, MZ10], property testing algo- rithms [MORS10] and approximate reconstruction of halfspaces from low-degree Fourier coefficients [OS11, DDFS12] among others. All these results use a "structure versus randomness" tradeoff for halfspaces which can be described roughly as follows: Consider the weights of a halfspace 1{x∈{0,1}n:w·x≥θ} in order of decreasing magnitude. If the largest-magnitude weight is "small" compared to the 2-norm of the weight-vector w, then the Berry- Ess´een theorem (a quantitative version of the Central Limit Theorem with explicit error bounds) implies that for independent {0, 1} random variables Xi (that are not too biased towards 0 or 1), the distribution of w · X will be well-approximated by the Gaussian distribution with the same mean and variance. This is a very useful statement because it implies that the discrete random variable w · X essentially inherits several nice properties of the Gaussian distribution (such as anti-concentration, strong tail bounds, and so on). On the other hand, if the largest-magnitude weight accounts for a significant fraction of the 2-norm, then the weight-vector obtained by erasing this weight has significantly smaller 2-norm, and we have "made progress;" intuitively, after a bounded number of steps of this sort, the 2-norm of the remaining weights will be extremely small, so the halfspace essentially depends only on the first few variables and should be "easy to handle" for that reason. These arguments can be made quantitatively precise using the notion of the "critical index" (introduced in [Ser07]; see Definition 3) which plays an important role in much of the work described above. Our Contribution. In this paper we show how tools from the complexity-theoretic literature on halfspaces alluded to above can be leveraged in order to make algorithmic progress on our optimization problem (P). As we will explain below, several non-trivial technical issues arise in the context of problem (P) which require careful treatment. 3 At a high-level, in this work we adapt and enhance this technical machinery in order to obtain a structural understanding of the problem, which is then combined with algorithmic and probabilistic techniques to obtain a PTAS. Very roughly, we proceed as follows: We partition the space of optimal solution vectors v∗ into a constant number of subsets, based on the value of the critical index of v∗. For each subset we apply a (different) algorithm which outputs a candidate (feasible) solution which is guaranteed to be ǫ-optimal, assuming v∗ belongs to the particular subset. Since at least one subset contains an optimal solution, the best candidate solution will be ǫ-approximately optimal as desired. Of course, we need to explain how to compute a candidate solution for each subset. A basic difficulty comes from the fact that our problem is not combinatorial. The space of feasible solutions is continuous and even though one can easily argue that there exists a rational optimal solution with polynomially many bits, a priori we do not know anything more about its structure. We note that a natural first approach one would think to try in this context would be to appropriately "discretize" the weights (e.g., by using a geometric subdivision, etc) and then use dynamic programming to optimize in the discretized space. However, it is far from clear how to show that such a naive discretization works; one can easily construct examples of weight vectors w such that "rounding" the coefficients of w to an appropriate (inverse polynomial in n) granularity radically changes the value of the objective function1. To compute an approximately optimal solution for each case (i.e., for v∗ in a particular subset as de- scribed above) one needs a better understanding of the structure of the optimal solutions. The reason why "rounding" the coefficients may substantially change the objective function value is because for certain weight vectors w the random variable w · X is very concentrated, i.e., it puts a substantial fraction of its probability mass in a small interval. If on the other hand, w · X is sufficiently anti-concentrated, i.e., it puts small mass on every small interval, then it is easy to argue that "rounding" does not affect the objective function by a lot. Known results [TV09] show that the anti-concentration of w · X depends strongly on the additive structure of w. While it is hopeless to show that all feasible weight-vectors are anti-concentrated, one could hope to show that there exists a near-optimal solution that has good anti-concentration. Essen- tially, this is what we do. Our main structural theorem (Theorem 4) shows that, except in degenerate cases, there always exists an optimal solution whose "tail" has sufficiently large L1-norm compared with the "head 2. We remark that, while results of a broadly similar flavor appear in many of these previous papers (see e.g., [Ser07, OS11, DS09]) there are a few crucial differences. First, the previous works compare the L2 norms of the "head" and the "tail". Most importantly, all previous such results consist of re-expressing the LTFs in a "nice" form (which includes changing the value of the threshold θ). Indeed, the previous arguments which assert the existence of these nice forms do not control the value of the threshold as its exact value is immaterial. In contrast, for our problem the exact threshold in comparison to the L1-norm of the weight vector is a crucial parameter. Our structural theorem says that every LTF has a well-structured equivalent version in which (1) the threshold stays exactly the same relative to the L1-norm of the weights, and (2) L1-norm of the "tail weights" is "large." Our proof of this theorem is based on linear fractional programming, which is novel in this context of structural results for LTFs. Conceptually, our structural theorem serves as a "pre-processing" step which ensures that the optimal weight-vector may be assumed to be well-structured; our algorithm crucially exploits this nice structure of the optimal solution to efficiently find a near-optimal solution. 1Moreover, we note that discretization of the space followed by standard approaches, e.g., along the lines of [CK05], seems to inherently lead to bicriteria guarantees. 2If the optimal weight vector only has nonzero coordinates in the L coordinates in the "head" (think of L as a constant -- it will depend only on ǫ), then as we show we can find an optimal vector exactly in poly(n) · 2poly(L) time by an enumeration-based approach. 4 2 Preliminaries 2.1 Simplifying assumptions about the problem instance It is clear that if θ = 0 or θ = 1 then it is trivial to output an optimal solution; hence throughout the rest of the paper we assume that 0 < θ < 1. Without loss of generality we may make the following assumptions about the input (p1, . . . , pn): (A1) p1 ≥ ··· ≥ pn. (A2) p1 < 1−ǫ and all pi ∈ {ǫ/(4n), . . . , kǫ/(4n)}, where kǫ/(4n) is the largest integer multiple of ǫ/(4n) that is less than 1 − ǫ. For the first claim, note that if p1 ≥ 1 − ǫ then the solution w = (1, 0, . . . , 0) has PrX∼Dp [w · X ≥ θ] ≥ 1 − ǫ and hence (1, 0, . . . , 0) is an ǫ-optimal solution as desired. For the second claim, given an input vector of arbitrary values p′ = (p′1, . . . , p′n) ∈ [0, 1 − ǫ)n, if we round the p′i values to integer multiples of ǫ/4n to obtain p = (p1, . . . , pn), then a simple coupling argument gives that for any event S, we have(cid:12)(cid:12)(cid:12)PrX∼Dp[S] − PrX∼Dp′ [S](cid:12)(cid:12)(cid:12) ≤ ǫ/4. Hence for our purposes, we may assume that the initial pi values are "ǫ/(4n)-granular" as described above. We further make some easy observations about optimal solutions that will be useful later. First, it is clear that there exists an optimal solution w with kwk1 = 1. (If kwk1 < 1 then rescaling by kwk1 gives a new feasible solution whose value is at least as good as the original one.) Second, by assumption (A1) there exists an optimal solution w ∈ Rn + that satisfies wi ≥ wi+1 for all i ∈ [n − 1]. (If wi < wi+1 it is easy to see that by swapping the two values we obtain a solution whose value is at least as good as the original one.) 2.2 Tools from structural analysis of LTFs: regularity and the critical index Definition 2 (regularity). Fix any real value τ > 0. We say that a vector w = (w1, . . . , wn) ∈ Rn is τ -regular if maxi∈[n] wi ≤ τkwk2. A linear form w · x is said to be τ -regular if w is τ -regular. Intuitively, regularity is a helpful notion because if w is τ -regular then the Berry-Ess´een theorem can be used to show that for X ∼ Dp, the linear form w · X is distributed like a Gaussian (with respect to Kolmogorov distance) up to an error of η, where η depends on the regularity parameter and the parameters p1, . . . , pn (see Corollary 19). A key ingredient in our analysis is the notion of the "critical index" of a linear form w · x. The critical index was implicitly introduced and used in [Ser07] and was explicitly used in [DS09, DGJ+10, OS11, DDFS12] and other works. Intuitively, the critical index of w is the first index i such that from that point on, the vector (wi, wi+1, . . . , wn) is regular. A precise definition follows: Definition 3 (critical index). Given a vector w ∈ Rn such that w1 ≥ ··· ≥ wn > 0, for k ∈ [n] we i . We define the τ -critical index c(w, τ ) of w as the smallest index i=k w2 i ∈ [n] for which wi ≤ τ · σi. If this inequality does not hold for any i ∈ [n], we define c(w, τ ) = ∞. denote by σk the quantityqPn Given a problem instance p satisfying (A1) and (A2) and a value ǫ, we define L = L(ǫ, γ) = min{n, Θ(1/(ǫ2γ2) · (1/γ) · (log 1/(ǫγ)) · (log(1/ǫ))}, (1) where γ = min{pn, 1 − p1} ≥ ǫ/4n. The idea behind this choice of L is that it is the cutoff for "having a large (ǫγ)/200-critical index." 5 2.3 A useful structural theorem about solutions In Section 3 we prove that given any feasible solution, there is another feasible solution whose value is at least as good as the original one and which has a "heavy tail" with respect to the L1 norm: i=1 wi = 1. Let S = {x ∈ i=1 vi = 1 and v1 ≥ ··· ≥ vn ≥ 0; (b) every x ∈ S has v · x ≥ θ; and Theorem 4. Fix K ∈ [n], 0 < θ < 1, and w1 ≥ ··· ≥ wn ≥ 0 such thatPn {0, 1}n : w · x ≥ θ}. Then there is a vector v = (v1, . . . , vn) such that (a) Pn (c) either vK+1 = ··· = vn = 0 or elsePk satisfies (a) and (b), and either v∗L+1 = ··· = v∗n = 0 or elsePL i=1 vi ≤ (K + 2)(K+2)/2 ·Pn Throughout the paper, we fix v∗ to be such an optimal solution vector. i=K+1 vi. Applying Theorem 4 with K = L as defined in (1), we get that there exists an optimal solution v∗ that i=L+1 v∗i . i=1 v∗i ≤ (L + 2)(L+2)/2 ·Pn 2.4 Our approach and formal statement of the main result. At a high level, our approach is to consider three mutually exclusive and exhaustive cases for v∗: • Case 1: v∗ has v∗L+1 = ··· = v∗n = 0. In this case we say v∗ is an L-junta. (Note that if L = n then we are in this case; hence in Cases 2 and 3 we have that L < n.) • Case 2: v∗ is not an L-junta and c(v∗, ǫγ/200) > L. In this case we say that v∗ is of type L + 1. • Case 3: v∗ is not an L-junta and c(v∗, ǫγ/200) = K for some K ∈ {1, . . . , L}. In this case we say that v∗ is of type K. We show (see Section 4) that in Case 1 it is possible to efficiently compute an exactly optimal solution. In both Cases 2 and 3 (see Sections 5 and 6 respectively) we show that it is possible (using two different algorithms) to efficiently construct a set of N ≤ poly(n, 2poly(L)) feasible solutions such that one of them (call it w′) has Obj(w′) ≥ opt − ǫ/2. Running all three procedures, we thus obtain a set of O(nN ) = opt − ǫ/2. From this it is simple to obtain an ǫ-approximate optimal solution (see Section 7). poly(n, 2poly(L)) candidate solutions such that one of them (call it ew) is guaranteed to have Obj(ew) ≥ A precise version of our main result is given below, where by bit(θ) we denote the bit-length of θ: Theorem 5. [Main Result] There is a randomized algorithm with the following performance guarantee: It takes as input a vector of probabilities p = (p1, . . . , pn) satisfying (A1) and (A2), a threshold value 0 < θ < 1, and a confidence parameter 0 < δ < 1. It runs in poly(n, 2poly(1/ǫ,1/γ), bit(θ)) · log(1/δ) 3 There exist well-structured optimal solutions: Proof of Theorem 4 time, where γ = min{pn, 1 − p1} ≥ ǫ/4n. With probability 1 − δ it outputs a feasible solution ew such that Obj(ew) ≥ opt − ǫ, and an estimate gObj(ew) of Obj(ew) that satisfies gObj(ew) − Obj(ew) ≤ ǫ. Fix K ∈ [n], 0 < θ < 1, and w = (w1, . . . , wn) with w1 ≥ w2 ≥ . . . wn ≥ 0 andPn i=1 wi = 1. If wi = 0 for all i ∈ [K + 1, n] it is clear that the weight-vector w satisfies conditions (a)-(c). So, we will henceforth assume that WT We start by defining the following linear -- fractional program (LFP) over variables u1, . . . , uK and r. =Pn i=K+1 wi > 0. def (LFP) is defined by the following set of linear constraints: 6 (i) For all x ∈ S, it holdsPK (ii) For all i ∈ [K − 1], ui ≥ ui+1; and uK ≥ wK+1. The (fractional) objective function to be maximized is i=1 uixi +Pn i=K+1 wixi ≥ r. f0(u1, . . . , uK , r) = r . i=1 ui + WT PK Observe that (u1, . . . , uK, r) = (w1, . . . , wK , θ) is a feasible solution, hence the maximum value of (LFP) is at least θ. We now proceed to turn (LFP) into an essentially equivalent linear program (LP), using the standard Charnes -- Cooper transformation [CC62]. The linear program (LP) has variables t, s1, . . . , sK and δ and is defined by the following set of linear constraints: (i) For all x ∈ S, it holdsPK (ii) For all i ∈ [K − 1], si ≥ si+1; and sK ≥ wK+1 · t. (iii) PK i=1 si + WT · t = 1; and (iv) t ≥ 0. The linear objective function to be maximized is δ. i=K+1 wixi(cid:1) · t ≥ δ. i=1 sixi +(cid:0)Pn The following standard claim (see e.g. [BV04]) quantifies the relation between the two aforementioned optimization problems: Claim 6. The optimization problems (LFP) and (LP) are equivalent. Proof. Let (u∗1, . . . , u∗K , r∗) be a feasible solution to (LFP). It is straightforward to verify that the vector (t∗, s∗1, . . . , s∗K, δ∗) with t∗ = 1 i=1 u∗i + WT PK δ∗ = r∗ i=1 u∗i + WT PK , . s∗i = t∗u∗i , for i ∈ [K], and δ∗ = t∗r∗ is a feasible solution to (LP) with the same objective function value. It follows that the linear program (LP) is also feasible with maximum value at least θ. Moreover, the maximum value of (LP) is greater than or equal to the maximum value of (LFP). Conversely, if (t∗, s∗1, . . . , s∗K, δ∗) is a feasible solution to (LP) with t∗ 6= 0, then (u∗1, . . . , u∗K , r∗) with u∗i = s∗i /t∗ and r∗ = δ∗/t∗ is feasible for (LFP), with the same objective function value If (t∗, s∗1, . . . , s∗K, δ∗) is a feasible solution to (LP) with t∗ = 0 and (u∗1, . . . , u∗K , r∗) is feasible to (LFP) then (fu1, . . . ,fuK ,er) = (u∗1, . . . , u∗K, r∗) + λ(s∗1, . . . , s∗K , δ∗) is feasible to (LFP) for all λ ≥ 0. Moreover, note that f0(fu1, . . . ,fuK,er) = lim λ→∞ = δ∗. δ∗ i=1 s∗i PK So, we can find feasible solutions to (LFP) with objective values arbitrarily close to the objective value of (t∗ = 0, s∗1, . . . , s∗K , δ∗). Therefore, the maximum value of (LFP) is greater than or equal to the maximum value of (LP). Combining the above completes the proof of the claim. 7 We now proceed to analyze the linear program (LP). We will show that there exists a feasible solution to (LP) with properties that will be useful for us. Note that S is by definition non-empty. In particular, the all 1's vector belongs to S. Hence, because of constraint (iii), the optimal value δ∗ of (LP) is at most 1 (i.e., (LP) is bounded). Consider a vertex v∗ = (t∗, s∗1, . . . , s∗K, δ∗) of the feasible set of (LP) maximizing the objective function δ. Claim 6 and the observation that the optimal value of (LFP) is at least θ imply that δ∗ ≥ θ. We consider the following two cases: [Case I: t∗ = 0.] In this case, we select the desired vector v = (v1, . . . , vn) as follows: We set vi = s∗i for all i ∈ [K] and vi = 0 for i ∈ [K +1, n]. Observe that condition (c) of the theorem statement is immediately satisfied. For condition (a), we note that constraint (ii) of (LP) implies that vi ≥ vi+1 for all i ∈ [n − 1], while constraint (iii) implies thatPn i=1 s∗i = 1. Finally, for Condition (b) note that by constraint (i) it follows thatPK [Case II: t∗ 6= 0.] In this case, we show that t∗ cannot be very close to 0. It follows from basic LP theory that the vertex v∗ = (t∗, s∗1, . . . , s∗K, δ∗) is the unique solution of a linear system A′ · v∗ = b′ obtained from a subset of tight constraints in (LP). We record the following fact: Fact 7. Consider the linear program (LP): (a) All the entries of the constraint matrix A are bounded from above by max{1, WT}. (b) The constant vector b has entries in {0, 1}. (c) Any coefficient not associated with the variable t is in {0, 1}. i=1 vixi ≥ δ∗ ≥ θ. This completes the analysis of this case. i=1 vi =PK As mentioned above v∗ is the unique solution of a (K + 2) × (K + 2) linear system A′ · v∗ = b′, where (A′, b′) is obtained from (A, b) by selecting a subset of the rows. By Cramer's rule, we have that t∗ = det(A′t)/ det(A′) where A′t is obtained by replacing the column in A′ corresponding to t∗ with the vector b′. Since A′t has only 0, 1 entries, if det(A′t) 6= 0, then det(A′t) ≥ 1. Since we assumed that t∗ 6= 0, we will indeed have that det(A′t) ≥ 1. Now observe that all the columns of A′ except the one corresponding to t∗ have entries bounded from above by 1. The column corresponding to t has all its entries bounded from above by WT . By Hadamard's inequality we obtain det(A′) ≤ By combining the above we get K+2Yi=1 kA′ik2 ≤ (K + 2)(K+2)/2 · WT . t∗ ≥ (K + 2)−(K+2)/2 · (1/WT ). We are now ready to define the vector v = (v1, . . . , vn). We select vi = s∗i for i ∈ [K] and vi = t∗wi for i ∈ [K + 1, n]. It is easy to verify that v satisfies conditions (a)-(c) of the theorem. Indeed, we use the fact that v∗ = (t∗, s∗1, . . . , s∗K , δ∗) is feasible for (LP). i=1 s∗i +t∗Pn i=1 vi =PK Constraint (iii) of (LP) yieldsPn i=1 s∗i +t∗WT = 1 as desired. Constraint (ii) similarly implies that v1 ≥ v2 ≥ . . . vn ≥ 0, which establishes condition (a). We now proceed to establish condition (b). Let x ∈ S. We have that wixi! − δ∗ ≥ 0 s∗i xi + t∗ nXi=K+1 KXi=1 nXi=1 i=K+1 wi =PK vixi − δ∗ = nXi=1 vixi − θ ≥ where the last inequality uses constraint (i) of (LP). For condition (c), since t∗ ≥ (K + 2)−(K+2)/2 · (1/WT ), constraint (iii) of (LP) gives vi = KXi=1 KXi=1 s∗i = 1 − t∗WT ≤ 1 − (K + 2)−(K+2)/2. 8 Using the fact thatPn i=K+1 vi = t∗WT ≥ (K + 2)−(K+2)/2, we conclude that kXi=1 vi ≤ (K + 2)(K+2)/2 · nXi=K+1 vi This completes the proof of Theorem 4. 4 Case 1: v∗ is an L-junta In this section we prove the following theorem. Theorem 8. There is a (deterministic) algorithm Find-Optimal-Junta with the following performance guarantee: The algorithm takes as input a vector of probabilities p = (p1, . . . , pL) satisfying (A1) and (A2), a threshold value 0 < τ < 1, and a parameter 0 ≤ W ≤ 1. It runs in poly(n, 2poly(L), bit(τ )) time and outputs a head vector w′ ∈ RL i=1 w′i ≤ W. Moreover, the vector w′ maximizes Pr[w · X (H) ≥ τ ] over all w ∈ RL ≥0 such thatPL i=1 wi ≤ W. Note that Theorem 8 is somewhat more general than we need in order to establish the desired result in Case 1; this is because Find-Optimal-Junta will also be used as a component of the algorithm for Case 2. As a direct corollary of Theorem 8 we get that Find-Optimal-Junta finds an optimal solution in Case 1: ≥0 that havePL Corollary 9. If v∗ is an L-junta, then Find-Optimal-Junta((p1, . . . , pL), θ, 1) outputs a vector w′ = (w′1, . . . , w′L) such that (w′, 0n−L) ∈ Rn ≥0 is an optimal solution, i.e., Obj((w′, 0n−L)) = opt. Algorithm Find-Optimal-Junta: Input: vector of probabilities (p1, . . . , pL); threshold 0 < τ < 1; parameter W > 0 Output: vector w′ ∈ RL ≥0 that maximizes Pr[w·X (H) ≥ τ ] over all w ∈ RL i=1 wi ≤ W 1. Let S be the set of all 2Θ(L2) sets S ⊆ {0, 1}L such that S = {x ∈ {0, 1}L : u · x ≥ c} for some ≥0 that havePL u ∈ RL, c ∈ R. 2. For each S ∈ S, check whether the following linear program over variables w1, . . . , wL is feasible and if so let w(S) ∈ RL be a feasible solution: For all x ∈ S, w · x ≥ τ ; w1,··· , wL ≥ 0; w1 + ··· + wL ≤ W. 3. For each w(S) obtained in the previous step, compute Pr[w(S) · X (H) ≥ τ ] and output the vector w(S) for which this is the largest. This case is rather simple. Procedure Find-Optimal-Junta outputs a vector w′ = (w′1, . . . , w′L) that maximizes the desired probability over all non-negative vectors whose coordinates sum to at most W . This is done in a straightforward way, using linear programming and an exhaustive enumeration of all linear threshold functions that depend only on the first L variables. We now proceed with the proof of Theorem 8. We first give the simple running time analysis. It is well known (see e.g., [Cho61]) that, as claimed in Step 1 of Find-Optimal-Junta, there are 2Θ(L2) distinct Boolean functions over {0, 1}L that can be represented as halfspaces u · x ≥ c. It is also well known 9 (see [MTT61]) that for every S ∈ S, there is a vector u = (u1, . . . , uL) and a threshold c such that S = {x ∈ {0, 1}L : u · x ≥ c} where each ui and c is an integer of absolute value at most 2Θ(L log L). Thus it is possible to enumerate over all elements S ∈ S in 2Θ(L2 log L) time. Since for each fixed S the linear program in Step 2 has O(2L) constraints over L variables, the claimed running time bound follows. The correctness argument is equally simple. There must be some S ∈ S which is precisely the set of those x ∈ {0, 1}L that maximizes PrX∼µp1×···×µpL i=1 wi ≤ W. Step 2 will identify a feasible solution for this S, and hence the vector w′ = (w′1, . . . , w′L) that Find- Optimal-Junta outputs will achieve this maximum probability. This concludes the proof of Theorem 8. ≥0 that havePL [w · X ≥ τ ] over all w ∈ RL 5 Case 2: v∗ is type L + 1 Recall that in Case 2 the optimal solution v∗ is not an L-junta, so it satisfiesPL Pn i=L+1 v∗i , and c(v∗, ǫ) > L. For this case we prove the following theorem: Theorem 10. There is a (deterministic) algorithm Find-Near-Opt-Large-CI with the following perfor- mance guarantee: The algorithm takes as input a vector of probabilities p = (p1, . . . , pn) satisfying (A1) and (A2) and a threshold value 0 < θ < 1. It runs in poly(n, 2poly(L), bit(θ)) time and outputs a set of N ≤ poly(n, 2poly(L)) many feasible solutions. If v∗ is of type L + 1 then one of the feasible solutions w′ that it outputs satisfies Obj(w′) ≥ opt − ǫ/2. 5.1 Useful probabilistic tools and notation. i=1 v∗i ≤ (L + 2)(L+2)/2 · Anti-concentration. We say that a real-valued random variable Z is ǫ-anti-concentrated at radius δ if for every interval of radius δ, Z lands in that interval with probability at most ǫ, i.e., We will use the following simple result, which says that anti-concentration of a linear form under a product distribution can only improve by adding more independent coordinates: for all t ∈ R, Pr[Z − t ≤ δ] ≤ ǫ. i=1 µqi is also ǫ-anti-concentrated at radius δ. Lemma 11. Fix (q1, . . . , qn) ∈ [0, 1]n and let Nn i=1 µqi denote the corresponding product distribution over {0, 1}n. Fix any weight-vector w(k) ∈ Rk and suppose that the random variable w(k) · X (k), where X (k) ∼Nk i=1 µqi, is ǫ-anti-concentrated at radius δ. Then for any w(n−k) ∈ Rn−k, the random variable w · X, where w = (w(k), w(n−k)) and X ∼Nn Notation. Much of our analysis in this section will deal separately with the coordinates 1, . . . , L and the coordinates L + 1, . . . , n; hence the following terminology and notation will be convenient. For an n- dimensional vector w ∈ Rn, in this section we refer to (w1, . . . , wL) as the "head" of w and we write w(H) to denote this vector; similarly we write w(T ) to denote the "tail" (wL+1, . . . , wn) of w. We sometimes refer to a vector in RL as a "head vector" and to a vector in Rn−L as a "tail vector." In a random variable w(H) · X (H) the randomness is over the draw of X (H) ∼ NL i=1 µpi, and similarly for a random variable w(T ) · X (T ) the randomness is over the draw of X (T ) ∼Nn i=L+1 µpi. 5.2 The algorithm and its analysis. Case 2 is more involved than Case 1. We first explain some of the analysis that motivates our approach (Lemmas 12 and 13 below) and then explain how the algorithm works (see Steps 1 and 2 of Find-Near- Opt-Large-CI). Let us say that a vector w = (w1, . . . , wn) ∈ Rn has a κ-granular tail if the following condition holds (throughout the rest of Section 5, κ = poly(1/n, 1/2poly(L)); we will specify its value more precisely later): 10 • [w = (w1, . . . , wn) has a κ-granular tail]: For L + 1 ≤ i ≤ n, each coordinate wi is an integer multiple of κ. The first stage of our analysis is to show (assuming that v∗ is type L + 1) that there is a feasible solution such that both the head and tail have some useful properties: the tail weights are granular and the tail random variable is sharply concentrated around its mean, while the head gives a high-quality solution to a problem with a related threshold (see condition (3) below): Lemma 12. Suppose v∗ is type L + 1. Then there is a feasible solution w′ = (w′1, . . . , w′n) ∈ Rn that w′1 ≥ ··· ≥ w′n ≥ 0 which satisfies the following: ≥0 such 1. The vector w′ has a κ-granular tail. Hence for M A′, B′, C′ ≤ M such thatPn 2. Let µ′ denote E[w′(T ) · X (T )], i.e., µ′ = B′κ(ǫ/(4n)). The random variable w′(T ) · X (T ) is strongly i=L+1 w′ipi = B′κ(ǫ/(4n)), andPn i=L+1(w′i)2 = A′κ2,Pn def = poly(1/κ), there are non-negative integers i=L+1 w′i = C′κ. concentrated around its mean: Pr[w′(T ) · X (T ) − µ′ ≥pA′ · ln(200/ǫ) · κ] ≤ ǫ/100. 3. The head random variable w′(H) · X (H) satisfies LXi=1 w′i ≤ 1 − C′κ and Pr[w′(H) · X (H) ≥ θ − µ′ +pA′ · ln(200/ǫ) · κ] ≥ opt − ǫ/40. (2) (3) Next, our analysis shows that for any vector w′′ with a κ-granular tail which matches the A′, B′, C′ values from above, the value of its overall solution is essentially determined by the value that its head random variable w′′(H) · X (H) achieves for the related-threshold problem. More precisely, let us say that a triple of non-negative integers (A, B, C) with A, B, C ≤ M is a conceivable triple. We say that a conceivable triple (A, B, C) is achievable if there exists a vector (uL+1, . . . , un) ∈ Rn−L ≥0 whose coordinates are non-negative integer multiples of κ such thatPn i=L+1 ui = Cκ, and we say that such a vector (uL+1, . . . , un) achieves the triple (A, B, C). Let w′′ = (w′′1 , . . . , w′′L, w′′L+1, . . . , w′′n) be any vector with a κ-granular tail whose n−L tail coordinates (w′′L+1, . . . , w′′n) achieve the triple (A′, B′, C′). Then like w′(T ) · X (T ), the random variable w′′(T ) · X (T ) is strongly concentrated around its mean: i=L+1 uipi = Bκ(ǫ/(4n)), andPn Lemma 13. As above suppose that v∗ is type L + 1. Let w′, A′, B′, C′ be as described in Lemma 12. i=L+1(ui)2 = Aκ2,Pn Pr[w′′(T ) · X (T ) − µ′ ≥pA′ · ln(200/ǫ) · κ] ≤ ǫ/100, and hence Pr[w′′ · X ≥ θ] ≥ Pr[w′′(H) · X (H) ≥ θ − µ′ +pA′ · ln(200/ǫ) · κ] − ǫ/100. Intuitively, these two lemmas are useful because they allow us to "decouple" the problem of finding an n-dimensional solution vector w into two pieces, finding a head-vector and a tail-vector. For the tail, these lemmas say that it is enough to search over the (polynomially many) conceivable triples (A, B, C); if we can identify the achievable triples from within the conceivable triples, and for each achievable triple construct any κ-granular tail vector that achieves it, then this is essentially as good as finding the actual tail vector of w′. For the right triple (A′, B′, C′) given by 12, all that remains is to come up with a vector (4) (5) 11 of head coordinates that yields a high-value solution to the related-threshold problem (note that part (3) of Lemma 12 establishes that indeed such a head-vector must exist). This is highly reminiscent of Case 1, and indeed we can apply machinery (the Find-Optimal-Junta procedure) from that case for this purpose. These lemmas thus motivate the two main steps of the algorithm, Steps 1 and 2, which we describe below. While there are only polynomially many conceivable triples, it is a nontrivial task to identify whether any given conceivable triple is achievable (note that there are exponentially many different vectors (uL+1, . . . , un) that might achieve a given triple). However, this does turn out to be a feasible task; Algorithm Construct- Achievable-Tails, called in Step 1 of Find-Near-Opt-Large-CI, is an efficient algorithm (based on dynamic programming) which searches across all conceivable triples (A, B, C) and identifies those which are achiev- able. For each triple that is found to be achievable, Construct-Achievable-Tails constructs a κ-granular tail which achieves it. We have the following lemma: Lemma 14. There is a (deterministic) algorithm Construct-Achievable-Tails that outputs a list consisting precisely of all the achievable (A, B, C) triples, and for each achievable triple it outputs a corresponding tail vector (w′′L+1, . . . , w′′n) that achieves it. The algorithm runs in time poly(n, 1/κ) = poly(1/κ). Finally, for each achievable triple (A, B, C) and corresponding tail vector (w′′L+1, . . . , w′′n) that is gen- erated by Construct-Achievable-Tails, the procedure Find-Optimal-Junta is used to find a setting of the head coordinates that yields a high-quality solution. Algorithm Find-Near-Opt-Large-CI: Input: probability vector p = (p1, . . . , pn) satisfying (A1) and (A2); parameter 0 < θ < 1 Output: if v∗ is type L + 1, a set FEAS of feasible solutions w such that one of them satisfies Obj(w) ≥ opt − ǫ/2 1. Run Algorithm Construct-Achievable-Tails to obtain a list T of all achievable triples (A, B, C) and, for each one, a tail vector u = (uL+1, . . . , un) that achieves it. 2. For each triple (A, B, C) in T and its associated tail vector u = (uL+1, . . . , un): • Run Find-Optimal-Junta((p1, . . . , pL), θ − Bκǫ/(4n) + κ ·pln(200/ǫ) · A, 1 − Cκ) to • Add the concatenated vector (u1, . . . , uL, uL+1, . . . , un) to the set FEAS (initially empty) obtain a head (u1, . . . , uL). of feasible solutions that will be returned. 3. Return the set FEAS of feasible solutions constructed as described above. We prove the aforementioned lemmas in the next subsection. We conclude this subsection by showing how Theorem 10 follows from these lemmas. Proof of Theorem 10 given Lemmas 12, 13, and 14: The claimed running time bound is immediate from inspection of Find-Near-Opt-Large-CI, Lemma 14 (to bound the running time of Construct-Achievable-Tails) and Theorem 8 (to bound the running time of Find-Optimal-Junta). To prove correctness, suppose that v∗ is of type L + 1. One of the achievable triples that is listed by Construct-Achievable-Tails will be the (A′, B′, C′) triple that is achieved by the tail (w′L+1, . . . , w′n) of the vector w′ = (w′1, . . . , w′n) whose existence is asserted by Lemma 12. By Lemma 14, Construct- Achievable-Tails outputs this (A′, B′, C′) along with a corresponding tail vector (w′′L+1, . . . , w′′n) that achieves it; by Lemma 13, any combination u = (u1, . . . , uL, w′′L+1, . . . , w′′n) of a head vector with this 12 tail vector will have Obj(u) ≥ Pr[u(H) · X (H) ≥ θ − µ′ + κ ·pln(200/ǫ) · A′] − ǫ/100. Lemma 12 ensures that there exists some head vector w′(H) that hasPL i=1 w′i ≤ 1 − C′κ and Pr[w′(H) · X (H) ≥ θ − µ′ + κ ·pln(200/ǫ) · A′] ≥ opt − ǫ/40, so when Find-Optimal-Junta is called with input pa- rameters ((p1, . . . , pL), θ − B′κ(ǫ/(4n)) + κ ·pln(200/ǫ) · A′, 1 − C′κ), by Theorem 8 it will con- struct a head u(H) = (u1, . . . , uL) with u1, . . . , uL ≥ 0, u1 + ··· + uL ≤ 1 − C′κ which is such that Pr[u(H) · X (H) ≥ θ − µ′ + κ ·pln(200/ǫ) · A′] ≥ opt − ǫ/40, and hence the resulting overall vector u = (u1, . . . , uL, w′′L+1, . . . , w′′n) is a feasible solution which has Pr[u · X ≥ θ] ≥ opt − 7ǫ/200. This concludes the proof of Theorem 10 (modulo the proofs of Lemmas 12, 13, and 14). 5.3 Proof of Lemmas 12, 13, and 14 def . (6) v∗is 2 sXℓ=1 v∗iℓxiℓ − 5.3.1 Proof of Lemma 12 Recall from Equation (1) that L = L(ǫ, γ) = min{n, Θ(1/(ǫ2γ2) · (1/γ) · (log 1/(ǫγ)) · (log(1/ǫ))}; since we are in Case 2, we have that L = Θ(1/(ǫ2γ2)· (1/γ)· (log 1/(ǫγ))· (log(1/ǫ)). Since the ǫγ/200-critical index of v∗ is at least L, Lemma 5.5 of [DGJ+10] gives us that there is a subsequence of weights v∗i1, . . . , v∗is with is < L and s ≥ t/γ, where t /3 for all j = 1, . . . , s − 1. Given this, Claim 5.7 of [DGJ+10] implies that for any two points x 6= x′ ∈ {0, 1}s, we have = ln(2002/ǫ3γ), such that v∗ij+1 ≤ v∗ij (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) sXℓ=1 (We note that both Lemma 5.5 and Claim 5.7 are simple results with proofs of a few lines.) Equation (6) xiℓ = ν; recalling the v∗iℓx′iℓ(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≥ clearly implies that for every ν ∈ R there is at most one x ∈ {0, 1}s such thatPs definition of γ, we further have that Pr(Xi1 ,...,Xis )∼µpi1 ×···×µpis(cid:2)Ps ν ∈ R. Together with (6), this gives that for every ν ∈ R and every integer k ≥ 0, we have Pr(Xi1 ,...,Xis )∼µpi1 ×···×µpis"(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) sXℓ=1 Prh(cid:12)(cid:12)(cid:12)(v∗)(H)X (H) − ν(cid:12)(cid:12)(cid:12) ≤ kv∗is/2i ≤ (2k + 1)ǫ3γ/2002. Xiℓ = ν(cid:3) ≤ (1 − γ)s for every v∗iℓ Xiℓ − ν(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ≤ kv∗is/2# ≤ (2k+1)(1−γ)s ≤ (2k+1)e−t = (2k+1)ǫ3γ/2002. By independence, using Lemma 11 we get that this anti-concentration extends to the linear form over all of the first L coordinates, and hence we get that for all ν ∈ R, Now, recall that we are in Case 2 and hencePj>L v∗j ≥ 1/((L + 2)(L+2)/2 + 1). Since v∗is ≥ vj for all j > L, we have that v∗is ≥ 1/(n((L + 2)(L+2)/2 + 1)). Hence (7) yields that for all ν ∈ R, ℓ=1 v∗iℓ ℓ=1 v∗iℓ (7) Hoeffding bound gives that for r > 0, Prh(cid:12)(cid:12)(cid:12)(v∗)(H) · X (H) − ν(cid:12)(cid:12)(cid:12) ≤ k/(2n((L + 2)(L+2)/2 + 1))i ≤ (2k + 1)ǫ3γ/2002. We now turn from analyzing the head of v∗ to analyzing the tail. Recalling again that the ǫγ/200- def = critical index of v∗ is greater than L, another application of Lemma 5.5 of [DGJ+10] gives that σ2 Pj>L(v∗j )2 ≤ 2002(v∗is)2/(ǫ2γ2). The expected value of (v∗)(T ) · X (T ) is µ = Pj>L v∗j pj; an additive Fixing r =pln(200/ǫ), as a consequence of the above we get that Pr[(v∗)(T ) · X (T ) − µ ≥ r · σL(v∗)] ≤ 2e−r2 Pr[(v∗)(T ) · X (T ) ≥ µ +pln(200/ǫ) · σL(v∗)] ≤ 2e− ln(200/ǫ) = ǫ/100. L(v∗) (8) . 13 Since opt = Pr[v∗ · X ≥ θ], we get that Combining with (7), we get that Pr[(v∗)(H) · X (H) ≥ θ − µ −pln(200/ǫ) · σL(v∗)] ≥ opt − ǫ/100. Pr[(v∗)(H) · X (H) ≥ θ − µ +pln(200/ǫ) · σL(v∗)] ≥ opt − ǫ/50. (9) We are now ready to define the vector w′. Its head coordinates are the same as v∗, i.e., for 1 ≤ i ≤ L we have w′i = v∗i . We define the quantity κ = 1/(n2((L + 2)(L+2)/2 + 1)). For L + 1 ≤ i ≤ n, the tail coordinates w′i of w′ are obtained by rounding v∗i down to the nearest integer multiple of κ. It is immediate from this definition that part (1) of the lemma holds, i.e., w′ has a κ-granular i=1 w′i ≤Pn tail and there are non-negative integers A, B, C ≤ M as specified in part (1). SincePn i=1 v∗i = 1, it must be the case thatPL i=1 w′i ≤ 1 − C′κ, giving the first part of Equation (3). = Pj>L(w′j)2. By Write µ′ to denote E[w′(T ) · X (T )] =Pj>L w′jpj = B′κ(ǫ/(4n)). Define σ2 Hoeffding bound, we get that (w′)(T ) · X (T ) is concentrated around its mean µ′. More precisely, L(w) def Pr[(w′)(T ) · X (T ) − µ′ ≥pln(200/ǫ) · σL(w)] ≤ 2e− ln(200/ǫ) ≤ ǫ/100, L(w) ≤ σ2 L(v∗) ≤ 2002(v∗is)2/(ǫ2γ2). giving part (2) of Lemma 12. Note that σ2 It remains only to establish the second part of Equation (3). Equation (9) almost gives us this -- it falls short only in having µ in place of µ′ in the lower bound for (w′)(H) · X (H) (recall that (v∗)(H) is identical to (w′)(H)). To get around this we use the anti-concentration property of the head that was established in (8) above. Since µ − µ′ ≤ nκ = 1/(n((L + 2)(L+2)/2 + 1)), equation (8) gives that Pr[(w′)(H) · X (H) ∈ [θ − µ +pln(200/ǫ) · σL(w), θ − µ′ +pln(200/ǫ) · σL(w)]] ≤ ǫ/200 and combining this with (9) gives Pr[(w′)(H) · X (H) ≥ θ − µ′ +pln(200/ǫ) · σL(w)] ≥ opt − 5ǫ/200, the desired second part of Equation (3). This concludes the proof of Lemma 12. bound, 5.3.2 Proof of Lemma 13 Since by assumption the tail of w′′ achieves the triple (A′, B′, C′), we have that the mean E[(w′′)(T ) · X (T )] equals B′κ(ǫ/(4n)) and thus is the same as µ′, the mean of (w′)(T ) · X (T )]. SincePj>L(w′′j )2 = Pj>L(w′j)2, just as was the case for w′ we get that a Hoeffding bound gives the desired concentration Equation (4) implies that w′′(T ) · X (T ) < µ′− κ·pln(200/ǫ) · A′ with probability at most ǫ/100. Since w′′(H) · X (H) ≥ θ − µ′ + κ ·pln(200/ǫ) · A′ and w′′(T ) · X (T ) ≥ µ′ − κ ·pln(200/ǫ) · A′ together imply that w′′ · X ≥ θ, we thus get Equation (5), and the lemma is proved. Pr[w′′(T ) · X (T ) − µ′ ≥ κ ·pln(200/ǫ) · A′] ≤ ǫ/100. Thus, we have established Equation (4). 14 5.3.3 Proof of Lemma 14 The Construct-Achievable-Tails algorithm is based on dynamic programming. Let w = (wL+1, . . . , wn) be a tail weight vector such that each wi is a non-negative integer multiple of κ. We define the quantities A(w) =Xi>L (wi)2/κ2; B(w) =Xi>L wipi/(κǫ/(4n)); C(w) =Xi>L wi/κ. Recalling Assumption (A2), we see that each of A(w), B(w), C(w) is a non-negative integer bounded by poly(1/κ). For each conceivable triple (A, B, C) and for every t ∈ {L + 1, . . . , n}, we create a sub-problem in which the goal is to determine whether there is a choice of weights wL+1, . . . , wt (each of which is a non- negative integer multiple of κ, with all other weights wt+1, . . . , wn set to 0) such that A(w) = A, B(w) = B, and C(w) = C. Such a choice of weights wL+1, . . . , wt exists if and only if there is a nonnegative- integer-multiple-of-κ choice of wt for which there is a nonnegative-integer-multiple-of-κ choice of weights wL+1, . . . , wt−1 (with all subsequent weights set to 0) such that A(w) = A − (wt)2/κ, B(w) = B − wtpt/(κǫ/(4n)), and C(w) = C − wt/κ. Thus, given the set of all triples that are achievable with only weights wL+1, . . . , wt−1 allowed to be nonzero, it is straightforward to efficiently (in poly(1/κ) time) identify the set of all triples that are achiev- able with only weights wL+1, . . . , wt allowed to be nonzero. This is because for a given candidate (conceiv- able) triple (A, B, C), one can check over all possible values of wt (that are integer multiples of κ and upper bounded by 1) whether the triple (A − (wt)2/κ, B − wtpt/(κǫ/(4n)), C − wt/κ) is achievable with only weights wL+1, . . . , wt−1 allowed to be nonzero. Since there are only O(1/κ) choices of the weight wt and the overall number of sub-problems in this dynamic program is bounded by poly(n, 1/κ) = poly(1/κ), the overall entire dynamic program runs in poly(1/κ) time. This concludes the proof of Lemma 14. 6 Case 3: v∗ is type K for some 1 ≤ K ≤ L Recall that in Case 3 the optimal solution v∗ is not an L-junta, so it satisfiesPL Pn i=L+1 v∗i , and c(v∗, ǫ) = K for some 1 ≤ K ≤ L. For this case we prove the following theorem: Theorem 15. There is a randomized algorithm Find-Near-Opt-Small-CI with the following performance guarantee: The algorithm takes as input a vector of probabilities p = (p1, . . . , pn) satisfying (A1) and (A2), a threshold value 0 < θ < 1, a value 1 ≤ K ≤ L, and a confidence parameter 0 < δ < 1. It runs in poly(n, 2poly(L), bit(θ)) · log(1/δ) time and outputs a set of N ≤ poly(n, 2poly(L)) many feasible solutions. If v∗ is of type K then with probability 1− δ one of the feasible solutions w that it outputs satisfies Obj(w) ≥ opt − ǫ/2. 6.1 Useful probabilistic tools and notation. i=1 v∗i ≤ (L + 2)(L+2)/2 · Kolmogorov distance. For X, Y two real-valued random variables we say the Kolmogorov distance dK(X, Y ) between X and Y is dK(X, Y ) Remark. If w is an optimal solution of problem (P) and the random variables w·X, w′·X have Kolmogorov distance at most ǫ then Obj(w′) ≥ opt − ǫ. = supt∈R Pr[X ≤ t] − Pr[Y ≤ t]. We recall the following useful elementary fact about Kolmogorov distance: def Fact 16. Let X, Y, Z be real-valued random variables such that X is independent of Y and independent of Z. Then we have that dK(X + Y, X + Z) ≤ dK(Y, Z). 15 The Dvoretsky-Kiefer-Wolfowitz (DKW) inequality is a considerably more sophisticated fact about Kol- mogorov distance that will also be useful. Given m independent samples t1, . . . , tm drawn from a real- valued random variable X, the empirical distribution bXm is defined as the real-valued random variable which is uniform over the multiset {t1, . . . , tm}. The DKW inequality states that for m = Ω((1/ǫ2) · ln(1/δ)), with probability 1 − δ the empirical distribution bXm will be ǫ-close to p in Kolmogorov distance: Theorem 17 ([DKW56, Mas90]). For all ǫ > 0 and any real-valued random variable X, we have Pr[dK(p,bpm) > ǫ] ≤ 2e−2mǫ2 We will also require a corollary of the Berry-Ess´een theorem (see e.g., [Fel68]). We begin by recalling the theorem: . Theorem 18. (Berry-Ess´een) Let X1, . . . , Xn be a sequence of independent random variables satisfying E[Xi3] = ρ3. Let S = X1 + ··· + Xn and let F denote the E[X 2 cumulative distribution function (cdf) of S. Then E[Xi] = 0 for all i,Pi i ] = σ2, andPi x F (x) − Φσ(x) ≤ Cρ3/σ3, sup i=1 w2 where Φσ is the cdf of a N (0, σ2) Gaussian random variable (with mean zero and variance σ2), and C is a universal constant. [Shi86] has shown that one can take C = .7915. Corollary 19. Let X = (X1, . . . , Xn) ∼ Dp and suppose that mini∈[n]{pi, 1 − pi} ≥ γ > 0. Let w ∈ Rn be τ -regular. Let Z be the random variable w·X and define µ = E[w·X] =Pn i=1 wipi, σ2 = Var[w·X] = Pn Proof. Define the random variable Yi = wi(Xi − pi), so E[Yi] = 0. It suffices to show that the random variable Y =Pn i ] = σ2 =Pn i pi(1 − pi) · (p2 i · pi(1 − pi). Then dK(Z, N (µ, σ2)) ≤ η where η = τ /γ. i=1 w2 i + (1 − pi)2), so i=1 wiYi has dK(Y, N (0, σ2)). We havePi i (cid:0)pi · (1 − pi)3 + (1 − pi) · (pi)3(cid:1) = w3 E[yi3] = w3 nXi=1 E[Yi3] = nXi=1 w3 i pi(1 − pi). i + (1 − pi)2) ≤ w3 i pi(1 − pi)(p2 i pi(1 − pi) and nXi=1 E[Y 2 The Berry-Ess´een theorem thus gives i pi(1 − pi) i=1 w3 i=1 w2 dK(Y, N (0, σ2)) ≤ Pn (cid:0)Pn Recalling that (by regularity) we have maxi wi ≤ τqPi w2 σ ≥ γqPi w2 i pi(1 − pi)(cid:1)3/2 ≤ σ ≤ τ /γ as desired. i , we get that maxn i=1 wi · 1 i=1 wi · Pn (cid:0)Pn max n i=1 w2 i=1 w2 i pi(1 − pi) i pi(1 − pi)(cid:1)3/2 = n i=1 wi · max 1 σ . i , and that by definition of γ and σ we have Finally, we recall the well-known fact that an N (µ, σ2) Gaussian is ǫ-anti-concentrated at radius ǫσ (this follows directly from the fact that the pdf of an N (µ, σ2) Gaussian is given by 1 σ√2π Notation. In this section our analysis will deal separately with the coordinates 1, . . . , K and the coordinates K + 1, . . . , n, so we use the following notational conventions. For an n-dimensional vector w ∈ Rn, in this section we refer to (w1, . . . , wK−1) as the "head" of w and we write w(H) to denote this vector; similarly we write w(T ) to denote the "tail" (wK , . . . , wn) of w. We sometimes refer to a vector in RK−1 as a "head vector" and to a vector in Rn−K+1 as a "tail vector." In a random variable w(H) · X (H) the randomness is exp(cid:16)− (x−µ)2 2σ2 (cid:17)). 16 over the draw of X (H) ∼NK−1 i=1 µpi, and similarly for the random variable w(T ) · X (T ) the randomness is over the draw of X (T ) ∼Nn i=K µpi. We additionally modify some of the terminology from Section 5 dealing with granular vectors and achievable triples. Fix κ = poly(1/n, 1/2poly(L)) (we give a more precise value of κ later). We say that a vector w = (w1, . . . , wn) ∈ Rn has a κ-granular tail if each coordinate wi, K ≤ i ≤ n, is an integer multiple of κ. It is easy to see that for any vector w ∈ Rn i=1 wi ≤ 1 that has a κ-granular tail, = poly(1/κ) there must exist non-negative integers A, B, C ≤ M such that E[w(T ) · X (T )] = for M Pn i=K wipi = Aκ(ǫ/(4n)), Var[w(T ) · X (T )] =Pn i=K wi = C′κ. We say that a triple of non-negative integers (A, B, C) with A, B, C ≤ M is a conceivable triple. We say that a conceivable triple (A, B, C) is ǫ′-regular achievable if there exists an ǫ′-regular vector u(T ) = (uK+1, . . . , un) ∈ Rn−K+1 whose coordinates are non-negative integer multiples of κ such that E[u(T ) · X (T )] = Aκ(ǫ/(4n)), Var[u(T ) · X (T )] = Bκ2(ǫ/(4n))2, andPn i=K ui = Cκ, and we say that such a vector (uL+1, . . . , un) achieves the triple (A, B, C). ≤0 withPn i pi(1 − pi) = Bκ2(ǫ/(4n))2, andPn i=K w2 ≥0 def 6.2 The algorithm and an intuitive explanation of its performance. Algorithm Find-Near-Opt-Small-CI: Input: probability vector p = (p1, . . . , pn) satisfying (A1) and (A2); parameter 0 < θ < 1; parameter 1 ≤ K ≤ L; confidence parameter 0 < δ < 1 Output: if v∗ is type K, a set FEAS of feasible solutions w such that one of them satisfies Obj(w) ≥ opt − ǫ/2 1. Run Algorithm Construct-Achievable-Regular-Tails(ǫγ/100) to obtain a list T of all triples (A, B, C) that are achieved by some ǫγ/100-regular tail vector and, and, for each one, an ǫγ/100- regular tail vector u = (uL+1, . . . , un) that achieves it. 2. For each triple (A, B, C) in T and its associated tail vector u = (uK , . . . , un), • Run Find-Approximately-Best-Head(uK , . . . , un, ǫ/200, δ/(2T )) to obtain a head vec- tor (u1, . . . , uK−1) • Add the concatenated vector (u1, . . . , uK−1, uK , . . . , un) to the set FEAS (initially empty) of feasible solutions that will be returned. 3. Return the set FEAS of feasible solutions constructed as described above. Similar to Case 2, the high level idea of this case is to decouple the problem of finding a good solution into two pieces, namely finding a good tail and finding a good head. However, in Case 2 the anti-concentration of the head random variable (see Equation (8)) played an essential role; in contrast, here in Case 3 the fact that the tail random variable is close to a Gaussian will play the key role. At a high level, the analysis for this case proceeds as follows. First, using the facts that the vector (v∗K, . . . , v∗n) is ǫγ/200-regular and thatPL i=1 v∗i ≤ (L + 2)(L+2)/2 · Pn i=L+1 v∗i , we get that the tail random variable (v∗)(T ) · X (T ) is O(ǫ)-close to a Gaussian N (µ, σ2) in Kol- mogorov distance, where the variance σ2 is "not too small" (see Lemma 20). Next, we argue that for any head vector (w′)(H) = (w′1, . . . , w′K−1), there exists a tail vector (w′)(T ) = (w′K , . . . , w′n), obtained by rounding the tail coordinates v∗K, . . . , v∗n down to some not-too-small granularity κ, which is "nice" (i.e., 17 regular and with not-too-small variance) and which gives a solution of almost equal quality to what would be obtained by having the actual (v∗K , . . . , v∗n) as the tail weights (see Lemma 21). We then strengthen this by showing that for any head vector, any tail vector which is regular and has the right mean and variance sim- ilarly gives a solution of almost equal quality to what would be obtained by having the actual (v∗K , . . . , v∗n) as the tail weights (see Lemma 22). This motivates the Construct-Achievable-Regular-Tails procedure (called in Step 1); it uses dynamic programming to efficiently search across all conceivable triples and iden- tify precisely those that are achieved by some ǫγ/100-regular κ-granular tail vector (and for each achievable triple, identify a tail vector (uK , . . . , un) that achieves it). Intuitively, at this point the algorithm has identified a polynomial-sized collection of tail vectors one of which "is good" (does almost as well as the optimal tail vector (v∗K , . . . , v∗n) if it were paired with the optimal head vector). It remains to show that it is possible to find a high-quality head vector and that combining such a head vector with this "good" tail vector yields an overall high-quality solution. We do this, and conclude the proof of Theorem 15, in Section 6.4. 6.3 Good tails exist and can be found efficiently: Proofs of Lemmas 20 -- 22 and analysis of Construct-Achievable-Regular-Tails Let µ def = E[(v∗)(T ) · X (T )] = nXi=K v∗i pi and σ2 def = Var[(v∗)(T ) · X (T )] = nXi=K (v∗i )2pi(1 − pi). (10) Lemma 20. Suppose v∗ is type K. Then dK((v∗)(T )·X (T ), N (µ, σ2)) ≤ ǫ/200, and σ ≥ Proof. Since v∗ is type K, we have that (v∗)(T ) is ǫγ/200-regular, and hence Corollary 19 gives that dK((v∗)(T ) · X (T ), N (µ, σ2)) ≤ ǫ/200. For the lower bound on σ, we observe that since K ≤ L,PL Pn i=1 v∗i ≤ (L + 2)(L+2)/2Pn i=1 v∗i = 1, we have i=L+1 v∗i , and 1 γ ((L+2)(L+2)/2+1)n . v∗K + ··· + v∗n ≥ v∗L+1 + ··· + v∗n ≥ ((L + 2)(L+2)/2 + 1) . Hence Cauchy-Schwarz implies that vuut nXi=K so (v∗i )2 ≥ σ =vuut 1 ((L + 2)(L+2)/2 + 1)n 1 ((L + 2)(L+2)/2 + 1)(n − K) ≥ nXi=K (v∗i )2pi(1 − pi) ≥ γ ((L + 2)(L+2)/2 + 1)n . We now define the value of κ to be κ = ǫγ2 200((L + 2)(L+2)/2 + 1)2n3 . Lemma 21. As above suppose v∗ is type K. Let w′ ∈ Rn ≥0 be a feasible solution which is such that for K ≤ i ≤ n, the value w′i is obtained from v∗i by rounding down to the nearest integer multiple of κ. Then 18 1. The vector (w′)(T ) = (w′K , . . . , w′n) is ǫγ/100-regular; 2. The variance (σ′)2 def γ2 2 σ2 ≥ 1 2 · = Var[(w′)(T ) · X (T )] is at least 1 3. Obj(w′) ≥ Obj(w′1, . . . , w′K−1, v∗K, . . . , v∗n) − ǫ/40. Proof. We start by lower bounding (σ′)2 as follows. Since each w′i, K ≤ i ≤ n, is less than v∗i by at most κ, we have thatPn σ2 − (σ′)2 ≤ 2κn · i=K(w′i)2 is less thanPn i=K(v∗i )2 by at most 2κn and hence ((L + 2)(L+2)/2 + 1)2n2 ≤ ((L+2)(L+2)/2+1)2n2 ; and pi(1 − pi) ≤ (σ′)2 ≥ 1 2 · σ2 max i=K κn 2 1 2 · γ2 so σ2, 1 2 n < K−1Xj=1 i=K v∗i yi − κn for all (yK, . . . , yn) ∈ {0, 1}n−k+1, we have w′jyj + (v∗i )(T ) · X (T ) ≥ θ − Pr giving (2). Part (1) follows easily from (2) and the fact that w′i ≤ v∗i for K ≤ i ≤ n. For part (3) we use the fact that the tail w′(T ) · X (T ) is anti-concentrated (since, by regularity, it is close to a Gaussian). In more detail, fix an outcome (y1, . . . , yK−1) ∈ {0, 1}K−1 for the head bits. Since Pn i=K w′iyi ≥Pn Pr K−1Xj=1 ≤ Pr(w′)(T ) · X (T ) ∈hθ − w′jyj + (w′)(T ) · X (T ) ≥ θ K−1Xj=1 w′jyji . K−1Xj=1 w′jyj − κn, θ − dK(cid:16)(w′)(T ) · X (T ), N(cid:0) E[(w′)(T ) · X (T )], (σ′)2(cid:1)(cid:17) ≤ ǫ/100. Since by (1) we know that (w′)(T ) is ǫγ/100-regular, Corollary 19 gives us that Since κn/2 ≤ ǫσ′/200, as noted after Lemma 11 a random variable Z ∼ N (E[(w′)(T ) · X (T )], (σ′)2) has 40. Since this Pr[Z ∈ I] ≤ ǫ/200 for any interval I of length κn. Hence (11) is at most holds for each fixed (y1, . . . , yK−1) ∈ {0, 1}K−1, we get (3). Lemma 22. As above suppose v∗ is type K. Fix (w′′)(T ) = (w′′K , . . . , w′′n) ∈ Rn−K+1 to be any ǫγ/100- = E[(w′)(T ) · X (T )], and (σ′′)2 def regular tail vector such that µ′′ def = Var[(w′′)(T ) · X (T )] equals (σ′)2 (see part (2) of Lemma 21). Then for any head vector (w′′)(H) = (w′′1 , . . . , w′′K−1), we have that Obj((w′′1 , . . . , w′′K−1, w′′K , . . . , w′′n)) ≥ Obj(w′′1 , . . . , w′′K−1, v∗K , . . . , v∗n) − ǫ/40. = E[(w′′)(T ) · X (T )] equals µ′ def 100 + ǫ 100 + ǫ 200 = ǫ (11) ≥0 ǫ Proof. The proof is identical to part (3) of Lemma 21. Having established the existence of a "good" tail (the vector (w′)(T ) from Lemma 21), we now argue that Construct-Achievable-Regular-Tails can efficiently construct a list containing some such good tail vector. Lemma 22 ensures that finding any such good tail vector is as good as finding the actual tail vector (w′)(T ) obtained from (v∗)(T ) by rounding down as described in Lemma 21. Lemma 23. There is a (deterministic) algorithm Construct-Achievable-Regular-Tails(ǫ′) that, given input parameters ǫ′ and K, outputs a list consisting precisely of all the ǫ′-regular achievable (A, B, C) triples, and for each achievable triple it outputs a corresponding tail vector (w′′K, . . . , w′′n) that achieves it. The algorithm runs in time poly(n, 1/κ) = poly(1/κ). 19 Proof. Similar to the earlier Construct-Achievable-Tails algorithm, the main idea is to use dynamic pro- gramming; however the details are somewhat different, chiefly because of the need to ensure regularity (and also because the numerical quantities involved are somewhat different from before). Let w = (wK , . . . , wn) be a tail weight vector such that each wi is a non-negative integer multiple of κ. We define the quantities A(w) = D(w) = nXi=K nXi=K wipi/(κǫ/(4n)); B(w) = nXi=K w2 i pi(1 − pi)/(κ2(ǫ/(4n))2); C(w) = wi/κ; nXi=K w2 i /κ2; E(w) = n max i=K wi/κ. Recalling Assumption (A2), we see that each of A(w), B(w), C(w), D(w), E(w) is a non-negative integer. We say that a quintuple (A, B, C, D, E) is conceivable if all values are non-negative integers at most M. For each conceivable quintuple (A, B, C, D, E) and for every t ∈ {K, . . . , n}, we create a sub-problem in which the goal is to determine whether there is a choice of weights wK, . . . , wt (each of which is a non-negative integer multiple of κ, with all other weights wt+1, . . . , wn set to 0) such that A(w) = A, B(w) = B, C(w) = C, D(w) = D and E(w) = E. Such a choice of weights wK, . . . , wt exists if and only if there is a nonnegative-integer-multiple-of-κ choice of wt for which there is a nonnegative-integer- multiple-of-κ choice of weights wK, . . . , wt−1 (with all subsequent weights set to 0) such that A(w) = A− wtpt/(κǫ/(4n)), B(w) = B − w2 t /κ2, and E = max{E(w), wt/κ}. Thus, given the set of all quintuples that are achievable with only weights wK , . . . , wt−1 allowed to be nonzero, it is straightforward to efficiently (in poly(1/κ) time) identify the set of all quintuples that are achievable with only weights wK , . . . , wt allowed to be nonzero. Since there are only O(1/κ) choices of the weight wt and the overall number of sub-problems in this dynamic program is bounded by poly(n, 1/κ) = poly(1/κ), the overall entire dynamic program runs in poly(1/κ) time. Once the set of all achievable quintuples has been obtained, it is straightforward for each quintuple (A, B, C, D, E) to determine whether or not it is ǫ′-regular (by computing E/√D and comparing against ǫ′). Having identified the set of all ǫ′-regular quintuples, it is easy to output a list consisting of all the ǫ′-regular achievable (A, B, C) triples (and from the dynamic program it is easy to maintain a tail vector achieving the triple in the usual way). This concludes the proof of Lemma 23. t pt(1− pt)/(κ2(ǫ/(4n))2), C(w) = C − wt/κ, D(w) = D − w2 6.4 Finding a good head vector: The Find-Approximately-Best-Head procedure and the proof of Theorem 15 By Lemma 23 the Construct-Achievable-Regular-Tails procedure generates a tail vector (w′′)(T ) that matches the mean, variance and L1-norm of the (w′)(T ) vector whose existence is asserted by Lemma 21. In the rest of this section we consider the execution of Find-Approximately-Best-Head when it is run on this tail vector (w′′)(T ) as input. By the DKW inequality (Theorem 17), with high probability the random variable R has dK(R, (w′′)(T ) · X (T )) ≤ ǫ/200; we henceforth assume that this is indeed the case. Fact 16 implies that dK((v∗)(H)·X (H) + R, (v∗)(H) · X (H) + (w′′)(T ) · X (T )) ≤ ǫ/200. Since Obj(v∗1, . . . , v∗K−1, w′′K, . . . , w′′n) ≥ opt − ǫ/40 by Lemma 22, we get that Pr[(v∗)(H) · X (H) + R ≥ θ] ≥ opt − 6ǫ/200. By Lemma 24, the Find-Best-Head procedure returns a head vector u(H) = (u1, . . . , uK−1) such that Pr[u(H) · X (H) + R ≥ θ] ≥ Pr[(v∗)(H) + R ≥ θ], so Pr[u(H) · X (H) + R ≥ θ] ≥ opt − 6ǫ/200. Now recalling that dK(R, (w′′)(T ) · X (T )) ≤ ǫ/200, applying Fact 16 again gives us that dK(u(H) · X (H) + R, u(H)·X (H) +(w′′)(T )·X (T )) ≤ ǫ/200. Hence it must be the case that Pr[u(H)·X (H) +(w′′)(T )·X (T ) ≥ 20 θ] ≥ opt− 7ǫ/200. Since u1 +··· + uk−1 + w′′k +··· + w′′n ≤ 1 by Lemma 24, this vector is a near-optimal feasible solution. This concludes the proof of Theorem 15, modulo the proof of Lemma 24. Algorithm Find-Approximately-Best-Head: Input: vector of tail weights (uK , . . . , un) with uK + ··· + un ≤ 1; parameters ǫ′, δ′ Output: Pr[(u′1, . . . , u′K−1, uK , . . . , un) · X ≥ θ] − ǫ′ for all (u′1, . . . , u′K−1) ∈ RK−1 ≥0 u′K−1 + uk + ··· + un ≤ 1 if v∗ is type K, with probability 1 − δ′ a head vector such that Pr[u · X ≥ θ] ≥ such that u′1 + ··· + 1. Sample m = Θ(log(1/δ′)/(ǫ′)2) points t1, . . . , tm from the random variable (uK , . . . , un)·X (T ). Let R be the random variable which is uniform over the multiset {t1, . . . , tm}. 2. Run Algorithm Find-Best-Head(t1, . . . , tm, 1 − Pn j=K uj, K) and return the head vector (u1, . . . , uK−1) that it returns. Algorithm Find-Best-Head: Input: points t1, . . . , tm, weight value 0 ≤ W ≤ 1, parameter K Output: Returns the non-negative head vector u(H) = (u1, . . . , uK−1) that maximizes Pr[u(H) · X (H) + R ≥ θ] subject to u1 + ··· + uK−1 ≤ W , where R is the random variable that is uniform over multiset {t1, . . . , tm} 1. Let S be the set of all 2Θ(K 2) sets S ⊆ {0, 1}K−1 such that S = {x ∈ {0, 1}K−1 : u · x ≥ c} for some u ∈ RK−1, c ∈ R. 2. For each S = (S1, . . . , Sm) ∈ S m, check whether the following linear program over variables w1, . . . , wK−1 is feasible and if so let w(S) ∈ RL be a feasible solution: (a) For each i ∈ [m] and each x ∈ Si, w · x + ti ≥ θ; (b) w1,··· , wK−1 ≥ 0; (c) w1 + ··· + wK−1 ≤ W . 3. For each w(S) obtained in the previous step, compute Pr[w(S) · X (H) + R ≥ θ] and output the vector w(S) for which this is the largest. ≥0 with ku(H)k1 ≤ W which is such that for every (u′)(H) ∈ RK−1 Lemma 24. The (deterministic) algorithm Find-Best-Head runs in time 2poly(m,K) and outputs a vector u(H) = (u1, . . . , uK−1) ∈ RK−1 ≥0 with k(u′)(H)k1 ≤ W, we have Pr[u(H) · X (H) + R] ≥ Pr[(u′) · X (H) + R]. Proof. The claimed running time bound follows easily from the fact that S = 2Θ(mK 2) (note that the running time of the linear program and the time required to explicitly compute the probabilities in Step 3 are both dominated by the enumeration over all elements of S m.). The correctness argument is similar to the proof of Theorem 8. As in that proof, S consists of all possible sets of satisfying assignments to a (K − 1)-variable halfspace. The optimal head vector that maximizes Pr[u(H) · X (H) + R ≥ θ] subject to u1 + ··· + uK−1 ≤ W must be such that there is some S = 21 (S1, . . . , Sm) ∈ S m such that for 1 ≤ i ≤ m, Si is precisely the set of those x ∈ {0, 1}L for which u(H) · x + ti ≥ θ. By searching over all S = (S1, . . . , Sm) ∈ S m in Step 2, the algorithm will encounter this S and will construct a feasible head vector for it. Such a feasible head vector will be identified as maximizing the probability in Step 3, and hence Find-Best-Head will indeed output an optimal head vector as claimed. This concludes the proof of Theorem 8. 7 Putting it together: proof of Theorem 5 In this section we prove Theorem 5 using Theorems 8, 10 and 15. The overall algorithm works as follows. First, it runs Find-Optimal-Junta((p1, . . . , pL), θ, 1) to ob- tain a feasible solution wjunta. Next, for each K = 1, . . . , L it runs Algorithm Find-Near-Opt-Small- CI((p1, . . . , pn), θ, K, δ/(2L)) to obtain a set FEAS (K) of feasible solutions. Finally, it runs Algorithm Find-Near-Opt-Large-CI((p1, . . . , pn), θ) to obtain a final set FEAS (L+1) of feasible solutions. It is easy to see from Theorems 8, 10 and 15 that the running time of the overall algorithm is as claimed. Let ALL denote the union of the sets {wjunta}, FEAS (1), . . . , FEAS (L) and FEAS (L+1). Since v∗ must fall in either Case 1, Case 2 or Case 3, Theorems 8, 10 and 15 together guarantee that ALL is a set of poly(n, 2poly(L)) many feasible solutions that with probability at least 1 − δ/2 contains a feasible solution w with Obj(w) ≥ opt − ǫ/2. Next, we sample m = Θ((1/ǫ)2 · (log ALL/δ)) points independently from Dp. For each feasible solution w ∈ ALL we use these m points to obtain an empirical estimate gObj(w) of Obj(w) (recall that Obj(w) = PrX∼Dp[w · X ≥ θ]), i.e., we set gObj(w) to be the fraction of the m points that satisfy w · X ≥ θ. A straightforward Chernoff bound implies that with probability at least 1 − δ/2, for each w we have gObj(w) − Obj(w) ≤ ǫ/4. Finally, we output the vector w∗ ∈ ALL that maximizes gObj(w) (breaking ties arbitrarily), together with the value gObj(w). With overall probability at least 1 − δ this w∗ has Obj(w∗) ≥ opt − 3ǫ/4 and gObj(w) − opt ≤ ǫ as desired. This proves Theorem 5. References [AFH+12] N. Alon, P. Frankl, H. Huang, V. Rodl, A. Rucinski, and B. Sudakov. Large Matchings in Uniform Hypergraphs and the Conjectures of Erdos and Samuels. Journal of Combinatorial Theory, Series A, 2012. [Bea55] E. M. L. Beale. On minimizing a convex function subject to linear inequalities. Journal of the Royal Statistical Society. Series B (Methodological), 17(2):pp. 173 -- 184, 1955. [BGK11] Anand Bhalgat, Ashish Goel, and Sanjeev Khanna. Improved approximation results for stochas- tic knapsack problems. In SODA, pages 1647 -- 1665, 2011. [BL97] [BV04] [CC62] John R. Birge and Franc¸ois Louveaux. Introduction to Stochastic Programming. Springer Series in Operations Research and Financial Engineering. Springer, 1997. S. P. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press, Cam- bridge, UK, 2004. A. Charnes and W. W. Cooper. Programming with linear fractional functionals. Naval Research Logistics Quarterly, 9(3-4):181 -- 186, 1962. 22 [Cho61] [CK05] [Dan55] C.K. Chow. On the characterization of threshold functions. In Proceedings of the Symposium on Switching Circuit Theory and Logical Design (FOCS), pages 34 -- 38, 1961. Chandra Chekuri and Sanjeev Khanna. A polynomial time approximation scheme for the mul- tiple knapsack problem. SIAM J. Comput., 35(3):713 -- 728, 2005. George B. Dantzig. Linear programming under uncertainty. Management Science, 1(3/4):pp. 197 -- 206, 1955. [DDFS12] A. De, I. Diakonikolas, V. Feldman, and R. Servedio. Near-optimal solutions for the Chow Pa- rameters Problem and low-weight approximation of halfspaces. In Proc. 44th ACM Symposium on Theory of Computing (STOC), pages 729 -- 746, 2012. [DGJ+10] I. Diakonikolas, P. Gopalan, R. Jaiswal, R. Servedio, and E. Viola. Bounded independence fools halfspaces. SIAM J. on Comput., 39(8):3441 -- 3462, 2010. [DGV08] Brian C. Dean, Michel X. Goemans, and Jan Vondr´ak. Approximating the stochastic knapsack problem: The benefit of adaptivity. Math. Oper. Res., 33(4):945 -- 964, 2008. [DKW56] A. Dvoretzky, J. Kiefer, and J. Wolfowitz. Asymptotic minimax character of the sample dis- tribution function and of the classical multinomial estimator. Ann. Mathematical Statistics, 27(3):642 -- 669, 1956. [DPR05] A.G. Dimakis, V. Prabhakaran, and K. Ramchandran. Ubiquitous access to distributed data in large-scale sensor networks through decentralized erasure codes. In International Symposium on Information Processing in Sensor Networks (IPSN), 2005. [DS09] [Erd65] [Fal03] I. Diakonikolas and R. Servedio. In Proc. 24th Annual IEEE Conference on Computational Complexity (CCC), pages 161 -- 172, 2009. Improved approximation of linear threshold functions. P. Erdos. A problem on independent r-tuples. In Annales Universitatis Scientiarum Budapest, 1965. K. Fall. A delay-tolerant network architecture for challenged internets. In Proc. of ACM SIG- COMM, 2003. [Fel68] W. Feller. An introduction to probability theory and its applications. John Wiley & Sons, 1968. [Has94] [JB03] J. Hastad. On the size of weights for threshold gates. SIAM Journal on Discrete Mathematics, 7(3):484 -- 492, 1994. A. Jiand and J. Bruck. Memory allocation in information storage networks. In IEEE Interna- tional Symposium on Information Theory (ISIT), 2003. [JDPF05] S. Jain, M.J. Demmer, R.K. Patra, and K.R. Fall. Using redundancy to cope with failures in a delay tolerant network. In Proc. of ACM SIGCOMM, 2005. [JFP04] S. Jain, K.R. Fall, and R.K. Patra. Routing in a delay tolerant network. SIGCOMM, 2004. In Proc. of ACM [Kle06] R. Kleinberg. Personal Communication, October 2006. 23 [KRT97a] J. Kleinberg, Y. Rabani, and E. Tardos. Allocating bandwidth for bursty connections. In ACM STOC, 1997. [KRT97b] Jon Kleinberg, Yuval Rabani, and ´Eva Tardos. Allocating bandwidth for bursty connections. In STOC, pages 664 -- 673, 1997. [LD11] Jian Li and Amol Deshpande. Maximizing expected utility for stochastic combinatorial opti- mization problems. In FOCS, pages 797 -- 806, 2011. [LDT09] D. Leong, A.G. Dimakis, and T.Ho. Distributed storage allocation problems. In NetCod, 2009. [LDT10a] D. Leong, A.G. Dimakis, and T.Ho. Distributed storage allocation for high reliability. In IEEE International Conference on Communications (ICC), 2010. [LDT10b] D. Leong, A.G. Dimakis, and T.Ho. Symmetric allocations for distributed storage. In IEEE Global Telecommunications Conference (GLOBECOM), 2010. [LMSS02] M. Luby, M. Mitzenmacher, M.A. Shokrollahi, and D.A. Spielman. Efficient erasure correcting codes. In IEEE Transactions on Information Theory, 2002. [Lub02] M. Luby. LT Codes. In IEEE FOCS, 2002. [LY13] [Mas90] [Mit04] Jian Li and Wen Yuan. Stochastic combinatorial optimization via poisson approximation. In STOC, pages 971 -- 980, 2013. P. Massart. The tight constant in the Dvoretzky-Kiefer-Wolfowitz inequality. Annals of Proba- bility, 18(3):1269 -- 1283, 1990. M. Mitzenmacher. Digital fountains: A survey and look forward. In Information Theory Work- shop, 2004. [MORS10] K. Matulef, R. O'Donnell, R. Rubinfeld, and R. Servedio. Testing halfspaces. SIAM J. on Comput., 39(5):2004 -- 2047, 2010. [MTT61] S. Muroga, I. Toda, and S. Takasu. Theory of majority switching elements. J. Franklin Institute, 271:376 -- 418, 1961. [Mur71] S. Muroga. Threshold logic and its applications. Wiley-Interscience, New York, 1971. [MZ10] [Nik10] [OS11] [Rag88] [Ser07] Raghu Meka and David Zuckerman. Pseudorandom generators for polynomial threshold func- tions. In Proc. 42nd Annual ACM Symposium on Theory of Computing (STOC), pages 427 -- 436, 2010. Evdokia Nikolova. Approximation algorithms for reliable stochastic combinatorial optimiza- tion. In APPROX-RANDOM, pages 338 -- 351, 2010. R. O'Donnell and R. Servedio. The Chow Parameters Problem. 40(1):165 -- 199, 2011. SIAM J. on Comput., P. Raghavan. Learning in threshold networks. In First Workshop on Computational Learning Theory, pages 19 -- 27, 1988. R. Servedio. Every linear threshold function has a low-weight approximator. Comput. Com- plexity, 16(2):180 -- 209, 2007. 24 [Shi86] I.S. Shiganov. Refinement of the upper bound of the constant in the central limit theorem. Journal of Soviet Mathematics, pages 2545 -- 2550, 1986. [Sho06] M.A. Shokrollahi. Raptor codes. In IEEE Transactions on Information Theory, 2006. [SRFS10] M. Sardari, R. Restrepo, F. Fekri, and E. Soljanin. Memory allocation in distributed storage networks. In IEEE International Symposium on Information Theory (ISIT), 2010. [Swa11] [TV09] Chaitanya Swamy. Risk-averse stochastic optimization: Probabilistically-constrained models and algorithms for black-box distributions. In SODA, pages 1627 -- 1646, 2011. T.Tao and V. H. Vu. Inverse Littlewood-Offord theorems and the condition number of random discrete matrices. Annals of Mathematics, 169:595 -- 632, 2009. 25
1507.08348
1
1507
2015-07-30T00:02:49
Approximating Dense Max 2-CSPs
[ "cs.DS" ]
In this paper, we present a polynomial-time algorithm that approximates sufficiently high-value Max 2-CSPs on sufficiently dense graphs to within $O(N^{\varepsilon})$ approximation ratio for any constant $\varepsilon > 0$. Using this algorithm, we also achieve similar results for free games, projection games on sufficiently dense random graphs, and the Densest $k$-Subgraph problem with sufficiently dense optimal solution. Note, however, that algorithms with similar guarantees to the last algorithm were in fact discovered prior to our work by Feige et al. and Suzuki and Tokuyama. In addition, our idea for the above algorithms yields the following by-product: a quasi-polynomial time approximation scheme (QPTAS) for satisfiable dense Max 2-CSPs with better running time than the known algorithms.
cs.DS
cs
Approximating Dense Max 2-CSPs Pasin Manurangsi∗1 and Dana Moshkovitz† 2 1Dropbox, Inc., San Francisco, CA 94107, USA, [email protected] 2Massachusetts Institute of Technology , Cambridge, MA 02139, USA, [email protected] September 25, 2018 Abstract In this paper, we present a polynomial-time algorithm that approxi- mates sufficiently high-value Max 2-CSPs on sufficiently dense graphs to within O(N ε) approximation ratio for any constant ε > 0. Using this algo- rithm, we also achieve similar results for free games, projection games on sufficiently dense random graphs, and the Densest k-Subgraph problem with sufficiently dense optimal solution. Note, however, that algorithms with similar guarantees to the last algorithm were in fact discovered prior to our work by Feige et al. and Suzuki and Tokuyama. In addition, our idea for the above algorithms yields the following by- product: a quasi-polynomial time approximation scheme (QPTAS) for satisfiable dense Max 2-CSPs with better running time than the known algorithms. Keywords: Max 2-CSP, Dense Graphs, Densest k-Subgraph, QP- TAS, Free Games, Projection Games 1 Introduction Maximum constraint satisfaction problem (Max CSP) is a problem of great interest in approximation algorithms since it encapsulates many natural opti- mization problems; for instance, Max k-SAT, Max-Cut, Max-DiCut, Max k-Lin, projection games, and unique games are all families of Max CSPs. In Max CSP, the input is a set of variables, an alphabet set, and a collection of constraints. Each constraint's domain consists of all the possible assignments ∗Part of this work was completed while the author was at Massachusetts Institute of Technology. †This material is based upon work supported by the National Science Foundation under Grant Number 1218547. 1 to a subset of variables. The goal is to find an assignment to all the variables that satisfies as many constraints as possible. In this paper, our main focus is on the case where each constraint depends on exactly k = 2 variables and the alphabet size is large. This case is intensively researched in hardness of approximation and multi-prover games. For Max 2-CSP with large alphabet size, the best known polynomial-time ap- proximation algorithm, due to Charikar et al. [10], achieves an approximation ratio of O((nq)1/3) where n is the number of variables and q is the alphabet size. On the other hand, it is known that, there is no polynomial-time 2log1−δ (nq)- approximation algorithm for Max 2-CSP unless NP 6⊆ DTIME(npolylog(n)) [16]. Moreover, it is believed that, for some constant c > 0, no polynomial-time O((nq)c)-approximation algorithm exists for projection games, a family of Max 2-CSP we shall introduce later, unless P = NP [15]. This is also known as the Projection Games Conjecture (PGC). As a result, if the PGC holds, one must study special cases in order to go beyond polynomial approximation ratio for Max 2-CSP. One such special case that has been particularly fruitful is dense Max 2-CSP where density is measured according to number of constraints, i.e., an instance is δ-dense if there are δn2 constraints. Note that, for convenience, we always assume that there is at most one constraint on a pair of variables. In other words, we form a simple graph by letting vertices represent the variables and edges represent the constraints. This is the interpretation that we will use throughout the paper. According to this view, δn is the average degree of the graph. In 1995, Arora, Karger and Karpinski [3] invented a polynomial-time approxi- mation scheme (PTAS) for dense Max 2-CSP when the density δ and alphabet size q are constants. More specifically, for any constant ε > 0, the algorithm achieves an approximation ratio 1 + ε and runs in time O(n1/ε2 ). Unfortunately, the running time becomes quasi-polynomial time when q is not constant. [1, 2, 4]). Another line of development of such PTASs centers around subsampling tech- nique (e.g. In summary, these algorithms function by randomly sampling the variables according to some distribution and performing an ex- haustive search on the induced instance. Since the sampled set of variables is not too large, the running time is not exponential. However, none of these algo- rithm achieves polynomial running time for large alphabets. In particular, all of them are stuck at quasi-polynomial running time. Since none of these algorithms runs in polynomial time for large alphabet, a natural and intriguing question is how good a polynomial-time approximation algorithm can be for dense Max 2-CSPs. In this paper, we partially answer this question by providing a polynomial-time approximation algorithm for dense high-value Max 2-CSPs that achieves O((nq)ε) approximation ratio for any constant ε > 0. Moreover, our technique also helps us come up with a quasi- 2 polynomial time approximation scheme for satisfiable Max 2-CSPs with run- ning time asymptotically better than that those from [1, 2, 3, 4]. The central idea of our technique is a trade-off between two different approaches: greedy assignment algorithm and "choice reduction" algorithm. In summary, either a simple greedy algorithm produces an assignment that satisfies many constraints or, by assigning an assignment to just one variable, we can reduce the number of optimal assignment candidates of other variables significantly. The latter is what we call the choice reduction algorithm. By applying this argument repeatedly, either one of the greedy assignments gives a high-value assignment, or we are left with only few candidate labels for each variable. In the latter case, we can then just pick a greedy assignment at the end. Not only that our technique is useful for Max 2-CSP, we are able to obtain approximation algorithms for other problems in dense settings as well. The first such problem is free games, which can be defined simply as Max 2-CSP on balanced complete bipartite graphs. While free games have been studied exten- sively in the context of parallel repetition [5, 17] and as basis for complexity and hardness results [1, 9], the algorithm aspect of it has not been researched as much. In fact, apart from the aforementioned algorithms for dense Max 2-CSP that also works for free games, we are aware of only two approximation algo- rithms, by Aaronson et al. [1] and by Brandao and Harrow [8], specifically devel- oped for free games. Similar to the subsampling lemmas, these two algorithms are PTASs when q is constant but, when q is large, the running times become quasi-polynomial. Interestingly, our result for dense Max 2-CSP directly yields a polynomial-time algorithm that can approximate free games within O((nq)ε) factor for any constant ε > 0, which may be the first non-trivial approximation algorithm for free games with such running time. Secondly, our idea is also applicable for projection games. The projection games problem (also known as Label Cover) is Max 2-CSP on a bipartite graph where, for each assignment to a left vertex of an edge, there is exactly one satisfiable assignment to the other endpoint of the edge. Label Cover is of great significance in the field of hardness of approximation since almost all NP-hardness of approximation results known today are reduced from the NP- hardness of approximation of projection games (e.g. [6, 12]). The current best polynomial-time approximation algorithm for satisfiable pro- jection games is the authors' with O((nq)1/4) ratio [14]. Moreover, as mentioned earlier, if the PGC is true, then, in polynomial time, approximating Label Cover beyond some polynomial ratio is unlikely. In this paper, we exceed this bound on random balanced bipartite graphs with sufficiently high density by proving that, in polynomial time, one can approximate satisfiable projection games on such graphs to within O((nq)ε) factor for any constant ε > 0. Finally, we show a similar result for Densest k-Subgraph, the problem of finding a size-k subgraph of a given graph that contains as many edges as pos- sible. Finding best polynomial-time approximation algorithm for Densest k- 3 Subgraph(DkS) is an open question in the field of approximation algorithms. Currently, the best known algorithm for DkS achieves an approximation ratio of O(n1/4+ε) for any constant ε > 0 [7]. On the other hand, however, we only know that there is no PTAS for DkS unless P=NP [13]. Even though Densest k-Subgraph on general graphs remains open, the prob- lem is better understood in some dense settings. More specifically, Arora et al. [3] provided a PTAS for the problem when the given graph is dense and k = Ω(N ) where N is the number of vertices of the given graph. Later, Feige et al. [11] and Suzuki and Tokuyama [18] showed that, if we only know that the optimal solution is sufficiently dense, we can still approximate the solution to within any polynomial ratio in polynomial time. Using our approximation algorithm for dense Max 2-CSP, we are able to construct a polynomial-time algorithm for Densest k-Subgraph with similar conditions and guarantees as those of the algorithms from [11] and [18]. The theorems we prove in this paper are stated in Section 3 after appropriate preliminaries in the next section. 2 Preliminaries and Notation In this section, we formally define the problems we focus on and the notation we use throughout the paper. First, to avoid confusion, let us state the definition of approximation ratio for the purpose of this paper. Definition 1. An approximation algorithm for a maximization problem is said to have an approximation ratio α if the output of the algorithm is at least 1/α times the optimal solution. Note here that the approximation ratio as defined above is always at least one. Next, before we define our problems, we review the standard notation of density of a graph. Definition 2. A simple undirected graph G = (V, E) is defined to be of density E/V 2. Moreover, for a graph G and a vertex u, we use ΓG(u) to denote the set of neighbors of u in G. We also define ΓG 2 (u) to denote the set of neighbors of neighbors of u in G, i.e., ΓG 2 (u) = ΓG(ΓG(u)). When it is unambiguous, we will leave out G and simply write Γ(u) or Γ2(u). Now, we will define the problems starting with Max 2-CSP. Definition 3. An instance (q, V, E,{Ce}e∈E) of Max 2-CSP consists of 4 • a simple undirected graph (V, E), and • for each edge e = (u, v) ∈ E, a constraint (or constraint) Ce : [q]2 → {0, 1} where [q] denotes {1, 2, . . . , q}. The goal is to find an assignment (solution) ϕ : V → [q] that maximizes the number of constraints Ce's that are satisfied, i.e. C(u,v)(ϕ(u), ϕ(v)) = 1. In other words, find an assignment ϕ : {x1, . . . , xn} → [q] that maximizes P(u,v)∈E C(u,v)(ϕ(u), ϕ(v)). The value of an assignment is defined as the frac- tion of edges satisfied by it and the value of an instance is defined as the value of the optimal assignment. A Max 2-CSP instance (q, V, E,{Ce}e∈E) is called δ-dense if the graph (V, E) is δ-dense. Throughout the paper, we use n to denote the number of vertices (variables) V and N to denote nq, which can be viewed as the size of the problem. Free games and projection games are specific classes of Max 2-CSP, which can be defined as follows. Note that n, N , density and value are defined in a similar fashion for free games and projection games as well. Definition 4. A free game (q, A, B,{Ca,b}(a,b)∈A×B) consists of • Two sets A, B of equal size, and • for (a, b) ∈ A × B, a constraint Ca,b : [q]2 → {0, 1}. The goal is to find an assignment ϕ : A ∪ B → [q] that maximizes the number of edges (a, b) ∈ A × B that are satisfied, i.e., Ca,b(ϕ(a), ϕ(b)) = 1. Definition 5. A projection game (q, A, B, E,{πe}e∈E) consists of • a simple bipartite graph (A, B, E), and • for each edge e = (a, b) ∈ E, a "projection" πe : [q] → [q]. The goal is to find an assignment to the vertices ϕ : A∪ B → [q] that maximizes the number of edges e = (a, b) that are satisfied, i.e., πe(ϕ(a)) = ϕ(b). Both free games and projection games can be viewed as special cases of Max 2- CSP. More specifically, free games are simply Max 2-CSPs on complete balanced bipartite graphs. For projection games, one can view πe as a constraint Ce : [q]2 → {0, 1} where Ce(σu, σv) = 1 if and only if πe(σu) = σv. In other words, projection game is Max 2-CSP on bipartite graph where an assignment to the endpoint in A of an edge determines the assignment to the endpoint in B. For convenience, we will define the notation of "optimal assignment" for Max 2-CSP intuitively as follows. 5 Definition 6. For a Max 2-CSP instance (q, V, E,{Ce}e∈E), for each vertex u ∈ V , let σOP T be the assignment to u in an assignment to vertices that satisfies maximum number of edges, i.e., ϕ(u) = σOP T is the assignment that maximizes P(u,v)∈E C(u,v)(ϕ(u), ϕ(v)). In short, we will sometimes refer to this as "the optimal assignment". u u Note that since projection games and free games are families of Max 2-CSP, the above definition also carries over when we discuss them. Lastly, we define Densest k-Subgraph. Definition 7. In the Densest k-Subgraph problem, the input is a simple graph G = (V, E) of N = V vertices. The goal is to find a subgraph of size k that contain maximum number of edges. 3 Summary of Results We are finally ready to describe our results and how they relate to the previous results. We will start with the main theorem on approximating high-value dense Max 2-CSP. Theorem 1 (Main Theorem). For every constant γ > 0, there exists a polynomial- time algorithm that, given a δ-dense Max 2-CSP instance of value λ, produces an assignment of value Ω((δλ)O(1/γ)N −γ) for the instance. Note that, when δ, λ = N −o(1), by choosing γ < ε, the algorithm can achieve O((nq)ε) approximation ratio for any constant ε > 0. Since every free game is 1/2-dense, Theorem 1 immediately implies the following corollary. Corollary 1. For every constant γ > 0, there exists a polynomial-time al- gorithm that, given a free game of value λ, produces an assignment of value Ω(λO(1/γ)N −γ) for the instance. Again, note that when λ = N −o(1), the algorithm can achieve O((nq)ε) approx- imation ratio for any constant ε > 0. The next result is a similar algorithm for projection games on sufficiently dense random graphs as stated below. Theorem 2. For every constant γ > 0, there exists a polynomial-time algo- rithm that, given a satisfiable projection game on a random bipartite graph (A, B, E) ∼ G(n/2, n/2, p) for any p ≥ 10plog n/n, produces an assignment of value Ω(N −γ) for the instance with probability 1 − o(1). 6 Note that G(n/2, n/2, p) is defined in Erdos-R´enyi fashion, i.e., the graph con- tains n/2 vertices on each side and, each pair of left and right vertices is included as an edge with probability p independently. In addition, it is worth noting here that the required density for projection games is much lower than that of Max 2-CSP; our Max 2-CSP algorithm requires the degree to be Ω(n/N −o(1)) whereas the projection games algorithm requires only Ω(√n). As stated earlier, we are unaware of any non-trivial polynomial-time algorithm for dense Max 2-CSP, free games, or projection games on dense random graphs prior to our algorithm. Next, we state our analogous result for Densest k-Subgraph. Corollary 2. For every constant γ > 0, there exists a polynomial-time al- gorithm that, given a graph G = (V, E) on N vertices such that its densest subgraph with k vertices is δ-dense, produces a subgraph of k vertices that is Ω(δO(1/γ)N −γ)-dense with high probability. Note that the density condition is on the optimal solution, not the given graph G. The condition and the algorithm are exactly the same as that of [11] and [18]. However, the techniques are substantially different. While [11] deals combinato- rially directly with the given graph G and [18] employs subsampling technique, we simply use our algorithm from Theorem 1 together with a simple reduction from Densest k-Subgraph to Max 2-CSP due to Charikar et al. [10]. Lastly, we also give a quasi-polynomial time approximation scheme for satisfi- able dense Max 2-CSP as described formally below. Corollary 3 (QPTAS for Dense Max 2-CSP). For any 1 ≥ ε > 0, there exists an (1+ε)-approximation algorithm for satisfiable δ-dense Max 2-CSP that runs in time N O(ε−1δ−1 log N ). Comparing to the known algorithms, our QPTAS runs faster than QPTASs from [2, 3, 4], each of which takes at least N O(ε−2δ−1 log N ) time. However, while our algorithm works only for satisfiable instances, the mentioned algorithms work for unsatisfiable instances as well but with an additive error of ε in value instead of the usual multiplicative guarantee of (1 + ε). 4 Proof of The Main Theorem In this section, we prove the main theorem. In order to do so, we will first show that we do not have to worry about the density δ at all, i.e., it is enough for us to prove the following lemma. 7 Lemma 1. For every γ > 0, there exists a polynomial-time algorithm that, given a free game (q, A, B,{C(a,b)}(a,b)∈A×B) of value λ′, produces an assignment of value λ′O(1/γ)q−γ for the instance. The proof of the main theorem based on the lemma above is shown below. Proof of Theorem 1 based on Lemma 1. The proof is based on putting in "dummy edges" where the constraints are always false regardless of the assignment to make the game more dense. More specifically, given a Max 2-CSP instance (q, V, E,{Ce}e∈E) of value λ and density δ, we construct a free game (q′, A, B,{C′ as follows: (a,b)}(a,b)∈A×B) • Let A, B be copies of V and let q′ = q. • For each a ∈ A and b ∈ B, let C′ C′ (a,b) := 0. (a,b) = C(a,b) if (a, b) ∈ E. Otherwise, let It is not hard to see that, if we assign the optimal assignment of the original instance to the free game, then δλn2 edges are satisfied where n = V . In other words, the value of the free game is at least δλ. Thus, from Lemma 1, for any constant γ, we can find an assignment ϕ′ : A ∪ B → [q′] of value at least (δλ)O(1/γ)q−γ for the free game. We create an assignment ϕ : V → [q] based on ϕ′ as follows. For each vertex v ∈ V , let av ∈ A and bv ∈ B be the vertices corresponding to v in the free game. Set ϕ(v) to be either ϕ′(av) or ϕ′(bv) with equal probability. From the above construction, the expected number of edges satisfied by ϕ in the Max 2-CSP instance is C(u,v)(ϕ(u), ϕ(v)) E  X(u,v)∈E 1 1  = X(u,v)∈E E(cid:2)C(u,v)(ϕ(u), ϕ(v))(cid:3) 4 (From our choice of ϕ) = X(u,v)∈E  Xσu∈{ϕ′(au),ϕ′(bu)} ≥ X(u,v)∈E 4(cid:0)C(u,v)(ϕ′(au), ϕ′(bv)) + C(u,v)(ϕ′(bu), ϕ′(av))(cid:1) 4 X(u,v)∈E(cid:0)C(u,v)(ϕ′(au), ϕ′(bv)) + C(u,v)(ϕ′(bu), ϕ′(av))(cid:1) 4 X(a,b)∈A×B Xσv ∈{ϕ′(av ),ϕ′(bv )} (From definition of C′) = C′ (a,b)(ϕ′(a), ϕ′(b)). C(u,v)(σu, σv)  1 1 = Observe that C′ (a,b)(ϕ′(a), ϕ′(b)) X(a,b)∈A×B 8 is the value of ϕ′ with respect to the free game, which is at least (δλ)O(1/γ)q−γ. As a result, we can conclude that ϕ is of expected value at least 1 4 (δλ)O(1/γ)q−γ = Ω((δλ)O(1/γ)N −γ) with respect to the instance (q, V, E,{Ce}e∈E). Lastly, we note that while the algorithm above is non-deterministic, the standard derandomization technique via conditional probability can be employed to make the algorithm deterministic without affecting the guarantee on the value of ϕ, which completes our proof for the main theorem. Now, we finally give the proof for Lemma 1. As mentioned in the introduction, the main idea of the proof is a trade-off between the greedy algorithm and the choice reduction algorithm. In other words, either the greedy assignment has high value, or we can reduce the number of candidates of the optimal assignment for many variables significantly by assigning only one variable. This argument needs to be applied multiple times to arrive at the result; the more variables we iterate on, the better guarantee we get on the output assignment value. For the purpose of analysis, we will define our algorithm recursively and use induction to show that the output assignment meets the desired criteria. Proof of Lemma 1. First, let us define notation that we will use throughout the proof. For a free game (q, A, B,{C(a,b)}(a,b)∈A×B), define EOP T to be the }u∈V . In other words, EOP T = {(u, v) ∈ E set of edges satisfied by {σOP T C(u,v)(σOP T ) = 1}. We also define ΓOP T (u) to be the neighborhood of be the degree of u in (V, EOP T ), i.e., u with respect to (V, EOP T ) and let dOP T dOP T u = ΓOP T (u). In addition, let n′ = n/2 be the size of A and B. , σOP T u u u v We will prove the lemma by induction. Let P (i) represent the following state- ment: there exists an O(cid:0)(nq)2i(cid:1)-time algorithm Approx-FreeGamei(q, A, B, {C(a,b)}(a,b)∈A×B,{Sb}b∈B) that takes in a free game instance (q, A, B,{C(a,b)}(a,b)∈A×B) of value λ′ and a reduced alphabet set Sb for every b ∈ B, and produces an as- signment that satisfies at least n′ Xb∈B(cid:18) dOP T n′ (cid:19) b 1 i i+1 Sb(cid:19) 2 (cid:18) 1 1σOP T b ∈Sb! b ∈Sb denotes an indicator variable for whether ∈ Sb. Moreover, for convenience, we use the expression (1/Sb) edges. Note here that 1σOP T σOP T b to be represent zero when Sb = ∅. Before we proceed to the induction, let us note why P (i) implies the lemma. By setting i = ⌈1/γ⌉ and Sb = [q] for every b ∈ B, since σOP T ∈ Sb for every b ∈ B, the number of edges satisfied by the output assignment of the algorithm in P (i) is at least i 1σOP T ∈Sb b 1 b b n′Xb∈B(cid:18) dOP T n′ (cid:19) 1 i i+1 2 (cid:18) 1 q(cid:19) 9 = n′ 1 q1/i Xb∈B(cid:18) dOP T n′ (cid:19) b i+1 2 ! (From Holder's inequality) ≥ = (Since EOP T/(n′)2 is the value of the instance) = i+1 2 dOP T b n′ ! i+1 2 (n′)2 (n′)2 q1/i 1 n′ Xb∈B q1/i (cid:18)EOP T (n′)2 (cid:19) (n′)2 q1/i (λ′) i+1 2 (From our choice of i) ≥ (n′)2 λ′O(1/γ) qγ , which is the statement of the lemma. Now, we finally show that P (i) is true for every i ∈ N by induction. Base Case. The algorithm Approx-FreeGame1(q, A, B,{C(a,b)}(a,b)∈A×B,{Sb}b∈B) is a greedy algorithm that works as follows: C(a,b)(σa, σb)(cid:1) a ∈ Sa that maximizesPb∈B b ∈ Sb that maximizes the number of edges a, σb), to it. 1. For each a ∈ A, assign σ∗ Sb(cid:0)Pσb∈Sb to it. 1 2. For each b ∈ B, assign σ∗ satisfied, i.e., Pa∈A C(a,b)(σ∗ It is obvious that the algorithm runs in O(n2q2) time as desired. Next, we need to show that the algorithm gives an assignment that satisfies at least n′ Xb∈B(cid:18) dOP T b n′ (cid:19)(cid:18) 1 Sb(cid:19) 1σOP T b ∈Sb! = Xb∈B dOP T b Sb 1σOP T b ∈Sb edges. To prove this, observe that, from our choice of σ∗ by the output assignment can be bounded as follows. b , the number of satisfied edges (From our choice of σ∗ C(a,b)(σOP T 1 1 Sb Xσb∈Sb Xa∈A Sb Xσb∈Sb Sb Xσb∈Sb 1 C(a,b)(σ∗ C(a,b)(σ∗ a, σb)! a, σb)! , σb)! a C(a,b)(σOP T a , σOP T b )1σOP T b ∈Sb C(a,b)(σOP T a , σOP T b )1σOP T b ∈Sb 1 Sb 1 Sb C(a,b)(σ∗ a, σ∗ Xb∈BXa∈A b ) ≥ Xb∈B = Xa∈AXb∈B a) ≥ Xa∈AXb∈B ≥ Xa∈AXb∈B = Xb∈BXa∈A 10 (From definition of dOP T b ) = Xb∈B = Xb∈B 1 Sb dOP T b Sb dOP T b 1σOP T b ∈Sb 1σOP T b ∈Sb. Thus, we can conclude that P (1) is true. Inductive Step. Let j be any positive integer. Suppose that P (j) holds. We will now describe Approx-FreeGamej+1 based on Approx-FreeGamej as follows. 1. For each a ∈ A and σa ∈ Sa, do the following: (a) For each b ∈ B, compute Sa,σa (b) Call Approx-FreeGamej (q, A, B,{C(a,b)}(a,b)∈A×B,{Sa,σa = {σb ∈ Sb C(a,b)(σa, σb) = 1}. the output assignment be ϕa,σa . b b }b∈B). Let 2. Execute the following greedy algorithm: (a) For each a ∈ A, assign σ∗ (b) For each b ∈ B, assign σ∗ Sb(cid:0)Pσb∈Sb a ∈ Sa to it that maximizesPb∈B b ∈ Sb to it that maximizes the number of 1 C(a,b)(σa, σb)(cid:1). edges satisfied, i.e., maximizes Pa∈A C(a,b)(σ∗ 3. Output an assignment among the greedy assignment and ϕa,σa for every a, σb). a, σa that satisfies maximum number of edges. Since every step except the Approx-FreeGamej (q, A, B,{C(a,b)}(a,b)∈A×B,{Sb}b∈B) calls takes O((nq)2) time and we call Approx-FreeGamej only at most (nq)2 times, we can conclude that the running time of Approx-FreeGamej+1 is O((nq)2j+2) as desired. Define R to be n′(cid:18)Pb∈B(cid:16) dOP T n′ (cid:17) b j+2 Sb(cid:17) 2 (cid:16) 1 1 j+1 1σOP T b ∈Sb(cid:19), our target number of edges we want to satisfy. The only thing left to show is that the assignment output from the algorithm indeed satisfies at least R edges. We will consider two cases. First, if there exist a ∈ A and σa ∈ Sb such that the output assignment from Approx-FreeGamej (q, A, B,{C(a,b)}(a,b)∈A×B,{Sa,σa }b∈B) satisfies at least R edges, then it is obvious that the output assignment of Approx-FreeGamej+1 indeed satisfies at least R edges as well. In the second case, for every a ∈ A and σa ∈ Sa, the output assignment from Approx-FreeGamej (q, A, B,{C(a,b)}(a,b)∈A×B,{Sa,σa }b∈B) satisfies less than R edges. For each a ∈ A, since the output assignment from Approx- FreeGamej(q, A, B,{C(a,b)}(a,b)∈A×B,{Sa,σOP T }b∈B) satisfies less than R edges, b b b a 11 we arrive at the following inequality: b j+1 R > n′ 2 Xb∈B(cid:18) dOP T n′ (cid:19) ≥ n′  Xb∈ΓOP T (a)(cid:18) dOP T n′ (cid:19) b σOP T b ∈S a,σOP T b a 1 j 1 ! 1 1 a b j+1 Sa,σOP T 2 1 j 1 ! a Sa,σOP T b   σOP T b ∈S a,σOP T b a   . Now, observe that, for every b ∈ ΓOP T (a), we have 1 σOP T This is because, from our definition of ΓOP T , C(a,b)(σOP T b ∈ ΓOP T (a), which means that, if σOP T Thus, the above inequality can be written as follows: ∈Sb. ) = 1 for every is in Sb, then it remains in Sa,σOP T = 1σOP T a,σOP T b ∈S , σOP T a . b b b a a b b R > n′ b  Xb∈ΓOP T (a)(cid:18) dOP T n′ (cid:19) j+1 2 1 a Sa,σOP T b 1 j ! 1σOP T b ∈Sb  . (1) We will use inequality (1) later in the proof. For now, we will turn our attention to the number of edges satisfied by the greedy algorithm, which, from our choice of σ∗ b , can be bounded as follows: C(a,b)(σ∗ a, σ∗ Xb∈BXa∈A (From our choice of σ∗ C(a,b)(σOP T (Since C(a,b)(σOP T a , σb) = 1 for every σb ∈ Sa,σOP T b a C(a,b)(σ∗ C(a,b)(σ∗ a, σb)! a, σb)! , σb)! a 1 1 1 Sb Xσb∈Sb Xa∈A b ) ≥ Xb∈B Sb Xσb∈Sb = Xa∈AXb∈B Sb Xσb∈Sb a) ≥ Xa∈AXb∈B SbSa,σOP T ) ≥ Xa∈AXb∈B Sa,σOP T = Xa∈AXb∈B Sb ≥ Xa∈A Xb∈ΓOP T (a) 1 b b a a a b Sa,σOP T Sb . Moreover, from inequality (1), we can derive the following inequalities: Rj Xa∈A Xb∈ΓOP T (a) a b Sb  Sa,σOP T  12 = Xa∈A a b Rj Sb  Sa,σOP T  Xb∈ΓOP T (a)    Xb∈ΓOP T (a)(cid:18) dOP T n′ (cid:19)   Xb∈ΓOP T (a)(cid:18) dOP T n′ (cid:19) b b (From (1)) ≥ (n′)j Xa∈A (Holder's inequality) ≥ (n′)j Xa∈A j+1 a b 1 2 Sa,σOP T Sb(cid:19) 2 (cid:18) 1 j+1 1 j 1 j ! 1σOP T b ∈Sb  j+1 j  Xb∈ΓOP T (a) a b Sb  Sa,σOP T  1σOP T b ∈Sb  By applying Holder's inequality once again, the last term above is at least 1 j+1 1σOP T b Sb(cid:19) 2 (cid:18) 1 j+1 ∈Sb  j+1 1 j+1 1σOP T b ∈Sb  j+1 j j b b 1 (n′)jn′ n′ Xa∈A Xb∈ΓOP T (a)(cid:18) dOP T n′ (cid:19)  = Xb∈B Xa∈ΓOP T (b)(cid:18) dOP T Sb(cid:19) n′ (cid:19) 2 (cid:18) 1 = ΓOP T (b)) = (cid:18) dOP T Sb(cid:19) n′ (cid:19) 2 (cid:18) 1 Xb∈B = n′Xb∈B(cid:18) dOP T Sb(cid:19) n′ (cid:19) 2 (cid:18) 1 dOP T b j+1 j+1 j+2 b b 1 1 j = Rj+1. 1σOP T b 1σOP T b ∈Sb  ∈Sb  j+1 (Since dOP T b Hence, we can conclude that Xa∈A Xb∈ΓOP T (a) a b Sa,σOP T Sb ≥ R. In other words, our greedy algorithm satisfies at least R edges, which means that P (j + 1) is also true for this second case. As a result, P (i) is true for every positive integer i, which completes the proof for Lemma 1. 5 Approximation Algorithm for Projection Games In this section, we will present our approximation algorithm for projection games. The main idea of this algorithm is a reduction from projection games 13 on dense random graphs to free games, which we use together with the approx- imation algorithm for free games from Corollary 1 above to prove Theorem 2. The reduction's properties can be stated formally as follows. Lemma 2. There is a polynomial-time reduction from a satisfiable projection game (q, A, B, E,{πe}e∈E) where (A, B, E) is sampled from a distribution G(n/2, n/2, p) where p ≥ 10plog n/n to a satisfiable free game instance (q′, A′, B′,{C(a,b)}(a,b)∈A′×B′ ) such that, with probability 1 − o(1), 1. A′,B′ ≤ A and q′ ≤ q, and 2. For any 1 ≥ ε ≥ 0, given an assignment ϕ′ : A′ ∪ B′ → [q′] to the free game instance of value ε, one can construct an assignment ϕ : A∪B → [q] for the projection game of value Ω(ε) in polynomial time. Before we describe the reduction, we give a straightforward proof for Theorem 2 based on the above lemma. Proof of Theorem 2 based on Lemma 2. The proof is simple. First, we use the reduction from Lemma 2 to transform a projection game on dense graph to a free game. Since the approximation ratio deteriorates by only constant factor with probability 1 − o(1) in the reduction, we can use the approximation algorithm from Corollary 1 with λ = 1, which gives us an assignment of value at least Ω(1/N γ). To prove the reduction lemma, we use the following two properties of random graphs. We do not prove the lemmas as they follow from a standard Chernoff bound. Lemma 3. When p ≥ 10plog n/n, with probability 1 − o(1), every vertex in G ∼ G(n/2, n/2, p) has degree between np/10 and 10np. Lemma 4. In G ∼ G(n/2, n/2, p) with p ≥ 10plog n/n, with probability 1 − o(1), every pair of vertices a, a′ on the left has at least np2/10 common neighbors. Now, we are ready to prove the reduction lemma. Roughly speaking, the idea of the proof is to "square" the projection game, i.e., use A as the vertices of the new game and, for each pair of vertices in A, add a constriant between them based on their constraints with their common neighbors in the projection game. This can be formalized as follows. Proof of Lemma 2. The reduction proceeds as follows. 1. Partition A into A1, A2 of equal sizes. Then, set A′ ← A1, B′ ← A2 and q′ ← q. 2. For each a1 ∈ A1, a2 ∈ A2, σa1 , σa2 ∈ [q], let C(a1,a2)(σa1 , σa2 ) to be one if and only if these two assignments agree on every b ∈ Γ(a1) ∩ Γ(a2). In 14 other words, C(a1,a2)(σa1 , σa2 ) = 1 if and only if π(a1,b)(σa1 ) = π(a2,b)(σa2 ) for every b ∈ Γ(a1) ∩ Γ(a2). It is obvious that the reduction runs in polynomial time, the first condition holds, and the new game is satisfiable. Thus, we only need to prove that, with probability 1 − o(1), the second condition is indeed true. To show this, we present a simple algorithm that, given an assignment ϕ′ : A′ ∪ B′ → [q′] of the free game instance of value ε, output an assignment ϕ : A ∪ B → [q] of the projection game of value Ω(ε). The algorithm works greedily as follows. 1. For each a ∈ A, let ϕ(a) ← ϕ′(a). 2. For each b ∈ B, pick ϕ(b) = σ∗ b to be the assignment to b that satisfies maximum number of edges, i.e., maximize {a ∈ Γ(b) π(a,b)(ϕ(a)) = σb}. Trivially, the algorithm runs in polynomial time. Thus, we only need to prove that, with probability 1 − o(1), the produced assignment is of value at least Ω(ε). To prove this, we will use the properties from Lemma 3 and Lemma 4, which holds with probability 1 − o(1). The number of satisfied edges can be written as follows. Xb∈B Xa∈Γ(b) 1π(a,b)(ϕ(a))=ϕ(b) = Xb∈B Xa∈Γ(b) 1π(a,b)(ϕ′(a))=σ∗ b . Let du be the degree of u in (A, B, E) for every u ∈ A∪ B, i.e. du = Γ(u). We can further rearrange the above expression as follows. 1π(a,b)(ϕ′(a))=σ∗ 1π(a,b)(ϕ′(a))=σ∗ 1π(a,b)(ϕ′(a))=σ∗ 1π(a,b)(ϕ′(a))=σ∗ Xb∈B Xa∈Γ(b) 1π(a,b)(ϕ′(a))=σ∗ b = Xb∈B = Xb∈B = Xb∈B = Xb∈B = Xb∈B           1 1 db   Xa∈Γ(b) db   Xa∈Γ(b) db   Xa∈Γ(b) db   Xa∈Γ(b)   Xa∈Γ(b) db Xσb∈[q] 1 1 1 15  db b  1   b  Xa∈Γ(b)    b   Xa∈Γ(b) Xσb∈[q]  b   Xσb∈[q] Xa∈Γ(b)   b  Xa∈Γ(b)  1π(a,b)(ϕ′(a))=σb  1π(a,b)(ϕ′(a))=σb  1π(a,b)(ϕ′(a))=σb        1π(a,b)(ϕ′(a))=σ∗ (From the choice of σ∗ b ) ≥ Xb∈B = Xb∈B = Xb∈B 1 1    Xa∈Γ(b) db Xσb∈[q]   db Xσb∈[q] Xa,a′∈Γ(b)   db Xa,a′∈Γ(b) Xσb∈[q]  2  1π(a,b)(ϕ′(a))=σb  1π(a,b)(ϕ′(a))=σb 1π(a′ ,b)(ϕ′(a′))=σb  1π(a,b)(ϕ′(a))=σb 1π(a′ ,b)(ϕ′(a′))=σb  1 Observe thatPσb∈[q] 1π(a,b)(ϕ′(a))=σb 1π(a′ ,b)(ϕ′(a′))=σb = 1π(a,b)(ϕ′(a))=π(a′ ,b)(ϕ′(a′)). Thus, the number of satisfied edges is at least Xb∈B   1 db Xa,a′∈Γ(b) 1π(a,b)(ϕ′(a))=π(a′ ,b)(ϕ′(a′))  . Moreover, from Lemma 3, db ≤ 10np for every b ∈ B with probability 1 − o(1). This implies that, with probability 1 − o(1), the output assignment satisfied at least 1 10np Xb∈B Xa,a′∈Γ(b) 1π(a,b)(ϕ′(a))=π(a′ ,b)(ϕ′(a′)) edges. We can further reorganize this quantity as follows. 1 10np Xb∈B Xa,a′∈Γ(b) 1π(a,b)(ϕ′(a))=π(a′ ,b)(ϕ′(a′)) ≥ = 1 s.t. a,a′ ∈Γ(b) 10np Xb∈B X(a,a′ )∈A′ ×B′ 10np X(a,a′)∈A′×B′ Xb∈Γ(a)∩Γ(a′) 1 1π(a,b)(ϕ′(a))=π(a′ ,b)(ϕ′(a′)) 1π(a,b)(ϕ′(a))=π(a′ ,b)(ϕ′(a′)). Now, observe that, from its definition, if C(a,a′)(ϕ′(a), ϕ′(a′)) is one, then 1π(a,b)(ϕ′(a))=π(a′ ,b)(ϕ′(a′)) is also one for every b ∈ Γ(a) ∩ Γ(a′). Thus, we have 1 1 1π(a,b)(ϕ′(a))=π(a′ ,b)(ϕ′(a′)) 10np X(a,a′)∈A′×B′ Xb∈Γ(a)∩Γ(a′) 10np X(a,a′)∈A′×B′ Xb∈Γ(a)∩Γ(a′) ≥ 10np X(a,a′)∈A′×B′ Γ(a) ∩ Γ(a′)C(a,a′)(ϕ′(a), ϕ′(a′)). C(a,a′)(ϕ′(a), ϕ′(a′)) = 1 16 1 From Lemma 4, with probability 1 − o(1), Γ(a) ∩ Γ(a′) ≥ np2/10 for every (a, a′) ∈ A′ × B′. Hence, we can conclude that the above expression is, with probability 1 − o(1), at least 10np X(a,a′)∈A′×B′ Next, note that P(a,a′)∈A′×B′ C(a,a′)(ϕ′(a), ϕ′(a′)) is the number of edges sat- isfied by ϕ′ in the free game, which is at least εA′B′ = εn2/16. Thus, we have 100 X(a,a′)∈A′×B′ C(a,a′)(ϕ′(a), ϕ′(a′)) = np2 10 p C(a,a′)(ϕ′(a), ϕ′(a′)). p 100 X(a,a′)∈A′×B′ C(a,a′)(ϕ′(a), ϕ′(a′)) ≥ εn2p 1600 . Finally, again from Lemma 3, the total number of edges is at most 5n2p with probability 1 − o(1). As a result, with probability 1 − o(1), the algorithm out- ε 8000 = Ω(ε) fraction of edges of the puts an assignment that satisfies at least projection game instance as desired. 6 Approximation Algorithm for Densest k-Subgraph The main goal of this section is to prove Corollary 2. As stated previously, we simply use our algorithm from Theorem 1 together with a reduction from Max 2-CSP to DkS from [10]. First, let us start by stating the reduction from Theorem 1, which we rephrase as follows. Lemma 5 ([10]). There exists a randomized polynomial-time algorithm that, given a graph G of N vertices and an integer k ≤ N , produces an instance (q, V, E,{Ce}e∈E) of Max 2-CSP such that • q ≤ N, n = k, and • any solution to the instance can be translated in polynomial time to a subgraph of G of k vertices such that the number of edges in the subgraph equals to the number of edges satisfied by the Max 2-CSP solution, and • with constant probability, the number of edges satisfied by the optimal so- lution to the instance is at least 1/100 times the number of edges in the densest k-subgraph of G. We will not show the proof of Lemma 5 here; please refer to Theorem 6 from [10] for the proof. Instead, we will now show how to use the reduction to arrive at the proof of Corollary 2. Proof of Corollary 2. First, we note that, to prove Corollary 2, it is enough to find a randomized polynomial-time algorithm with similar approximation guar- antee to that in Corollary 2 except that the probability of success is a constant 17 (instead of high probability as stated in Corollary 2). This is because we can then repeatedly run this algorithm Θ(log n) times and produce the desired re- sult. The algorithm proceeds as follows: 1. Use the reduction from Lemma 5 on the input graph G and k to produce (q, V, E,{Ce}e∈E). 2. Run the algorithm from Theorem 1 on (q, V, E,{Ce}e∈E). 3. Transform the assignment from previous step according to Lemma 5 and output the result. From the property of the reduction, we know that, with constant probability, the optimal assignment to (q, V, E,{Ce}e∈E) satisfies Ω(δk2) edges. If this is the case, we can conclude that the density of (V, E) is Ω(δ) and, similarly, that the value of the instance is Ω(δ). As a result, the output assignment from step 2 has value at least Ω(δO(1/γ)N −γ). Since the reduction from Lemma 5 preserves the optimum, our algorithm produces a subgraph of density at least Ω(δO(1/γ)N −γ) as well, which concludes our proof for this corollary. 7 QPTAS for Dense Max 2-CSPs At first glance, it seems that the QPTAS would follow easily for our main the- orem. This, however, is not the case as the algorithm in the main theorem always loses at least a constant factor. Instead, we need to give an algorithm that is similar to that of the main theorem but have a stronger guarantee in approximation ratio for satisfiable instances, which can be stated as follows. Lemma 6. For every positive integer i > 0, there exists an O(cid:0)(nq)O(i)(cid:1)-time algorithm that, for any satisfiable Max 2-CSP instance on the complete graph, produces an assignment of value at least 1/q1/i. Lemma 6 can be viewed as a special case of the main theorem when the graph is complete. However, it should be noted that Lemma 6 is more exact in the sense that the guaranteed lower bound of the value of the output assignment is not asymptotic. The proof of this lemma is also similar to that of Lemma 1 except that we need slightly more complicated algorithm and computation to deal with the fact that the underlying graph is not bipartite. Proof of Lemma 6. We will prove the lemma by induction. Note that through- out the proof, we will not worry about the randomness that the algorithm employs; it is not hard to see that the random assignment algorithms described below can be derandomized via greedy approach so that the approximation guarantees are as good as the expected guarantees of the randomized ones and that we still end up with the same asymptotic running time. 18 1 1 ni Let P (i) represent the following statement: there exists an O(cid:0)(nq)3i(cid:1)-time al- gorithm Approx-CompleteGamei(q, V, E,{Ce}e∈E,{Su}u∈V ) that takes in a satisfiable Max 2-CSP instance (q, V, E,{Ce}e∈V ) where (V, E) is a complete graph and a reduced alphabet set Su for every u ∈ U such that, if σOP T ∈ Su for every u ∈ V , then the algorithm outputs an assignment of value at least (cid:16)Qu∈V Observe that P (i) implies the lemma by simply setting Su = [q] for every u ∈ V . Base Case. The algorithm Approx-CompleteGame1(q, V, E,{Ce}e∈E,{Su}u∈V ) is a simple random assignment algorithm. However, before we randomly pick the assignment, we need to first discard the alphabets that we know for sure are not optimal. More specifically, Approx-CompleteGame1(q, V, E,{Ce}e∈E,{Su}u∈V ) works as follows. Su(cid:17) u . 1. While there exist u, v ∈ U and σu ∈ Su such that C(u,v)(σu, σv) = 0 for every σv ∈ Sv, remove σu from Su. 2. For each u ∈ V , pick ϕ(u) independently and uniformly at random from Su. Output ϕ. It is obvious that the algorithm runs in O(n3q3) time as desired. Now, we will show that, if σOP T u ∈ Su for every u ∈ V , then the algorithm gives 1 n Su(cid:17) an assignment that is of value at least (cid:16)Qu∈V remains in Su after step 1 for every u ∈ V . This is ) = 1 for every v 6= u. First, observe that σOP T because C(u,v)(σOP T in expectation. u , σOP T u v 1 Next, Consider the expected number of satisfied edges by the output assignment, which can be rearranged as follows: E  X(u,v)∈E C(u,v)(ϕ(u), ϕ(v))  = X(u,v)∈E = X(u,v)∈E E(cid:2)C(u,v)(ϕ(u), ϕ(v))(cid:3) SuSv Xσu∈Su Xσv ∈Sv 1 C(u,v)(σu, σv). From the condition of the loop in step 1, we know that after the loop ends, for each σu ∈ Su, there must be at least one σv ∈ Sv such that C(u,v)(σu, σv) = 1. In other words, Xσu∈Su Xσv ∈Sv C(u,v)(σu, σv) ≥ Xσu∈Su 1 = Su. 19 Similarly, we can also conclude that Xσu∈Su Xσv ∈Sv C(u,v)(σu, σv) ≥ Sv. Thus, we have Xσu∈Su Xσv ∈Sv C(u,v)(σu, σv) ≥ max{Su,Sv} for every u 6= v. Hence, we can bound the expected number of satisfied edges as follows: 1 1 1 X(u,v)∈E SuSv 1 min{Su,Sv} SuSv Xσu∈Su Xσv ∈Sv C(u,v)(σu, σv) ≥ X(u,v)∈E = X(u,v)∈E ≥ X(u,v)∈E pSuSv pSuSv (A.M. - G.M. inequality) ≥ E  Y(u,v)∈E  pSuSv = E  Y(u,v)∈E  (Each u ∈ V appears in exactly n − 1 edges) = E Su!(n−1)/2  Yu∈V  Su!1/n = E Yu∈V 1 1 1 1 , max{Su,Sv} 1 E 2 n(n−1) 2 n(n−1) which implies that P (1) is true as desired. Inductive Step. Let j be any positive integer. Suppose that P (j) holds. We will now describe Approx-CompleteGamej+1 based on Approx-CompleteGamej as follows. 1. Define R to be (cid:16)Qu∈V 1 Su(cid:17) 2. Run the following steps 2(a)i to 2(a)iv until no Su is modified by neither 1 n(j+1) , our target value we want to achieve. step 2(a)iv nor step 2(a)ii. (a) For each u ∈ V and σu ∈ Su, do the following: 20 i. For each v ∈ V , compute Su,σu = {σv ∈ Sv C(u,v)(σu, σv) = 1}. This is the set of reduced assignments of v if we assign σu to u. Note that when v = u, let Su = {σu}. v ii. If Su,σu v = ∅ for some v ∈ V , then remove σu from Su and continue to the next u, σu pair. 1 nj 1 v Su,σu (cid:17) next u, σu pair. iii. Compute Ru,σu =(cid:16)Qv∈V iv. Execute Approx-CompleteGamej (q, V, E,{Ce}e∈E,{Su,σu . If R′ < R, continue to the If the output assignment is of value less than Ru,σu , then remove σu from Su. Otherwise, return the output assignment as the output to Approx-CompleteGamej+1. v }v∈V ). 3. If the loop in the previous step ends without outputting any assignment, just output a random assignment (i.e. pick ϕ(u) independently and uni- formly at random from Su). Observe first that the loop can run at most nq times as the total number of elements of Sv's for all v ∈ V is at most nq. This means that we call Approx-CompleteGamej at most nq times. Since every step except the Approx-CompleteGamej calls takes O((nq)3) time and we call Approx- CompleteGamej only at most n2q2 times, we can conclude that the running time of Approx-CompleteGamej+1 is O((nq)3j+3) as desired. The only thing left to show is that the assignment output from the algorithm indeed is of expected value at least R. To do so, we will consider two cases. u is the optimal assignment for u, then σOP T First, if step 3 is never reached, the algorithm must terminate at step 2(a)iv. From the return condition in step 2(a)iv, we know that the output assignment is of value at least Ru,σu ≥ R as desired. In the second case where step 3 is reached, we first observe that when we remove su from Su in step 2(a)iv, the instance is still satisfiable. The reason is that, if σu = σOP T for every v ∈ V . Hence, from our inductive hypothesis, the output assignment from Approx-CompleteGamej (q, V, E,{Ce}e∈E,{Su,σu }v∈V ) must be of value at v least Ru,σu . As a result, we never remove sOP T from Su, and, thus, the instance remains satisfiable throughout the algorithm. Moreover, notice that, if Ru,σu ≥ R for any u, σu, we either remove σu from Su or output the desired assignment. This means that, when step 3 is reached, Ru,σu < R for every u ∈ V and σu ∈ Su. Now, let us consider the expected number of edges satisfied by the random assignment. Since our graph (V, E) is complete, it can be written as follows. remains in Su,σu u v v 21 C(u,v)(ϕ(u), ϕ(v)) E  X(u,v)∈E (From definition of Su,σu v = (A.M.-G.M. inequality) ≥ = (From our definition of Ru,σu, R) = (Since Ru,σu < R) > = = (A.M.-G.M. inequality) ≥ (From our definition of R) = C(u,v)(σu, σv)! ! v v 1 1 1 1 1 v6=u =  = E 2 Xu∈V Xv∈V  2 Xu∈V Xv∈V 2 Xu∈V Xv∈V 2 Xu∈V Xv∈V ) = = v6=u v6=u v6=u 1 1 1 1 1 v6=u Su,σu Sv C(u,v)(ϕ(u), ϕ(v))  E(cid:2)C(u,v)(ϕ(u), ϕ(v))(cid:3) SuSv Xσu∈Su Xσv ∈Sv SuSv Xσu∈Su Su,σu   2 Xu∈V Su Xσu∈Su Xv∈V  (n − 1) n−1vuutYv∈V Su,σu 2 Xu∈V Su Xσu∈Su Sv n−1vuutQ v∈n v6=u Su,σu (n − 1) Su Xσu∈Su 2 Xu∈V Q v∈V v6=u Sv n−1s (Ru,σu )−nj (n − 1) Su Xσu∈Su 2 Xu∈V (n − 1) Su Xσu∈Su 2 Xu∈V n−1pSuRn (n − 1) 2 Xu∈V n−1pSuRn Rn/(n−1) Xu∈V (n − 1) Rn/(n−1) Rn/(n−1) n−1pSu! Su n n(n−1)sYu∈V  R−n(j+1) n n(n−1)sYu∈V  (n − 1) (n − 1) R−n(j+1) Su v6=u 2 1 1 1 2 2 v v R(n−1−j)/(n−1) = n(n − 1) 2 22 (Since R ≤ 1 and j ≥ 0) ≥ n(n − 1) 2 R. Since n(n−1) assignment is indeed of expected value at least R. 2 is the number of edges in (V, E), we can conclude that the random Thus, we can conclude that P (j + 1) is true. As a result, P (i) is true for every positive integer i, which completes the proof for Lemma 6. Next, we will prove Corollary 3 by reducing it to Max 2-CSP on complete graph, and, then plug in Lemma 6 with appropriate i to get the result. First, observe that, since log(1 + ε′) = Ω(ε′) for every 1 ≥ ε′ > 0, by plugging in i = C log q/ε′ for large enough constant C into Lemma 6, we immediately arrive the following corollary. Corollary 4. For any 1 ≥ ε′ > 0, there exists an (1 + ε′)-approximation al- gorithm for satisfiable Max 2-CSP on the complete graph that runs in time N O(ε′−1 log N ). Now, we will proceed to show the reduction and, thus, prove Corollary 3. Proof of Corollary 3. First of all, notice that, since 1 1+ε = 1−Θ(ε). It is enough for us to show that there exists an N O(ε−1δ−1 log N )-time algorithm for satisfiable δ-dense Max 2-CSP that produces an assignment of value at least 1 − ε. On input (q, V, E,{Ce}e∈E), the algorithm works as follows: 1. Construct a Max 2-CSP instance (q, V, E′,{C′ e}e∈E′) where (V, E′) is a complete graph and C′ e is defined as Ce if e ∈ E. Otherwise, Ce := 1. In other words, we put in dummy constraints that are always true just to make the graph complete. 2. Run the algorithm from Corollary 4 on (q, V, E′,{C′ and output the assignment got from the algorithm. e}e∈E′) with ε′ = εδ To see that the algorithm indeed produces an assignment with value 1 − ε for the input instance, first observe that, since (q, V, E,{Ce}e∈E) is satisfi- able, (q, V, E′,{C′ e}e∈E′) is trivially satisfiable. Thus, from Corollary 4, the output assignment has value at least 1/(1 + δε) ≥ 1 − δε with respect to (q, V, E′,{C′ e}e∈E′). In other words, the assignment does not satisfy at most δεn2 edges. Thus, with respect to the input instance, it satisfies at least δn2 − δεn2 = (1 − ε)δn2 edges. In other words, it is of value at least 1 − ε as desired. Lastly, note that the running time of this algorithm is determined by that of the algorithm from Corollary 4, which runs in N O(ε′−1 log N ) = N O(ε−1δ−1 log N ) time as desired. 23 8 Conclusions and Open Questions Finally, we conclude by listing the open questions and interesting directions related to the techniques and problems presented here. We also provide our thoughts regarding each question. • Can our algorithm be extended to work for Max k-CSP for k ≥ 3? Other algorithms for approximating Max 2-CSP such as those from [2, 3, 4] are applicable for Max k-CSP for any value of k as well. So it is possible that our technique can be employed for Max k-CSP too. • Can one also come up with an algorithm that approximates Max 2-CSP to within O(N ε) factor for any ε > 0 for low-value dense Max 2-CSP? Our algorithm needs the value λ to be N −o(1) in order to give such a ratio so it is interesting whether we can remove or relax this condition. However, we do not think that one can remove the condition completely because, with similar technique to the proof of Corollary 3, we can arrive at a reduction from any Max 2-CSP to dense Max 2-CSP where the approximation ratio is preserved but the value decreases. This means that, if we can remove the condition on λ, then we are also able to refute the PGC. This argument nonetheless does not rule out relaxing the condition for λ without removing it completely. • Can our QPTAS be extended to unsatisfiable instances? One of the main disadvantages of our QPTAS is that it requires the instance to be sat- isfiable. This renders our QPTAS useless against many problems such as Max 2-SAT and Max-Cut because the satisfiable instances of those problems are trivial. If we can extend our QPTAS to work on unsatisfi- able instances as well, then we may be able to produce interesting results for those problems. Note, however, that, with similar argument to the preceding question, QPTAS for low-value instances likely does not exist. Instead, the case of unsatisfiable instances where [2, 3, 4] are successful is when they look for an additive error guarantee instead of a multiplica- tive one. Currently, it is unclear whether our technique can achieve such results. • Can one arrive at a similar or even better algorithm using SDP hierar- chies? SDP hierarchies have been very useful in finding approximation algorithms for combinatorial optimization problems. A natural question to ask is whether one can apply SDP hierarchies to get similar results to ours. For example, can the O(i)-level of the Lasserre hierarchy produce an approximation algorithm with ratio O(q1/i) for dense Max 2-CSP? If so, then this may also be an interesting direction to pursue an algorithm with guarantee additive error discussed previously. 24 References [1] S. Aaronson, R. Impagliazzo, and D. Moshkovitz. AM with multiple Mer- lins. In Computational Complexity (CCC), 2014 IEEE 29th Conference on, pages 44 -- 55, June 2014. [2] N. Alon, W. F. de la Vega, R. Kannan, and M. Karpinski. Random sampling and approximation of max-CSPs. J. Comput. Syst. Sci., 67(2):212 -- 243, September 2003. [3] S. Arora, D. Karger, and M. Karpinski. Polynomial time approximation schemes for dense instances of NP-hard problems. In Proceedings of the Twenty-seventh Annual ACM Symposium on Theory of Computing, STOC '95, pages 284 -- 293, New York, NY, USA, 1995. ACM. [4] B. Barak, M. Hardt, T. Holenstein, and D. Steurer. Subsampling math- ematical relaxations and average-case complexity. In Proceedings of the Twenty-second Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '11, pages 512 -- 531. SIAM, 2011. [5] B. Barak, A. Rao, R. Raz, R. Rosen, and R. Shaltiel. Strong parallel repeti- tion theorem for free projection games. In Proceedings of the 12th Interna- tional Workshop and 13th International Workshop on Approximation, Ran- domization, and Combinatorial Optimization. Algorithms and Techniques, APPROX '09 / RANDOM '09, pages 352 -- 365, Berlin, Heidelberg, 2009. Springer-Verlag. [6] M. Bellare, O. Goldreich, and M. Sudan. Free bits, PCPs, and nonapproximability -- towards tight results. SIAM Journal on Computing, 27(3):804 -- 915, 1998. [7] A. Bhaskara, M. Charikar, E. Chlamtac, U. Feige, and A. Vijayaragha- van. Detecting high log-densities: An O(n1/4) approximation for densest k-subgraph. In Proceedings of the Forty-second ACM Symposium on The- ory of Computing, STOC '10, pages 201 -- 210, New York, NY, USA, 2010. ACM. [8] F. G.S.L. Brandao and A. W. Harrow. Quantum de finetti theorems under local measurements with applications. In Proceedings of the Forty-fifth Annual ACM Symposium on Theory of Computing, STOC '13, pages 861 -- 870, New York, NY, USA, 2013. ACM. [9] M. Braverman, Y. K. Ko, and O. Weinstein. Approximating the best nash equilibrium in no(log n)-time breaks the exponential time hypothesis. In Pro- ceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '15, pages 970 -- 982. SIAM, 2015. [10] M. Charikar, M. Hajiaghayi, and H. Karloff. Improved approximation al- gorithms for label cover problems. In ESA, pages 23 -- 34, 2009. 25 [11] U. Feige, D. Peleg, and G. Kortsarz. The dense k -subgraph problem. Algorithmica, 29(3):410 -- 421, 2001. [12] J. Hastad. Some optimal inapproximability results. Journal of the ACM, 48(4):798 -- 859, 2001. [13] S. Khot. Ruling out PTAS for graph min-bisection, densest subgraph and bipartite clique. In Proceedings of the 45th Annual IEEE Symposium on Foundations of Computer Science, FOCS '04, pages 136 -- 145, Washington, DC, USA, 2004. IEEE Computer Society. [14] P. Manurangsi and D. Moshkovitz. Improved approximation algorithms for projection games. In Algorithms ESA 2013, volume 8125 of Lecture Notes in Computer Science, pages 683 -- 694. Springer Berlin Heidelberg, 2013. [15] D. Moshkovitz. The projection games conjecture and the NP-hardness of ln n-approximating set-cover. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques - 15th Interna- tional Workshop, APPROX 2012, volume 7408, pages 276 -- 287, 2012. [16] R. Raz. A parallel repetition theorem. In SIAM Journal on Computing, volume 27, pages 763 -- 803, 1998. [17] R. Shaltiel. Derandomized parallel repetition theorems for free games. Comput. Complex., 22(3):565 -- 594, September 2013. [18] A. Suzuki and T. Tokuyama. Dense subgraph problems with output-density conditions. In Xiaotie Deng and Ding-Zhu Du, editors, Algorithms and Computation, volume 3827 of Lecture Notes in Computer Science, pages 266 -- 276. Springer Berlin Heidelberg, 2005. 26
1107.5550
2
1107
2015-10-09T13:22:36
The solution space geometry of random linear equations
[ "cs.DS", "math.CO" ]
We consider random systems of linear equations over GF(2) in which every equation binds k variables. We obtain a precise description of the clustering of solutions in such systems. In particular, we prove that with probability that tends to 1 as the number of variables, n, grows: for every pair of solutions \sigma, \tau, either there exists a sequence of solutions \sigma,...,\tau, in which successive elements differ by O(log n) variables, or every sequence of solutions \sigma,...,\tau, contains a step requiring the simultaneous change of \Omega(n) variables. Furthermore, we determine precisely which pairs of solutions are in each category. Our results are tight and highly quantitative in nature. Moreover, our proof highlights the role of unique extendability as the driving force behind the success of Low Density Parity Check codes and our techniques also apply to the problem of so-called pseudo-codewords in such codes.
cs.DS
cs
The solution space geometry of random linear equations Dimitris Achlioptas University of Athens∗ Michael Molloy University of Toronto† Abstract We consider random systems of linear equations over GF(2) in which every equation binds k variables. We obtain a precise description of the clustering of solutions in such systems. In particular, we prove that with probability that tends to 1 as the number of variables, n, grows: for every pair of solutions σ, τ , either there exists a sequence of solutions starting at σ and ending at τ such that successive solutions have Hamming distance O(log n), or every sequence of solutions starting at σ and ending at τ contains a pair of successive solutions with distance Ω(n). Furthermore, we determine precisely which pairs of solutions are in each category. Key to our results is establishing the following high probability property of cores of random hypergraphs which is of independent interest. Every vertex not in the r-core of a random k-uniform hypergraph can be removed by a sequence of O(log n) steps, where each step amounts to removing one vertex of degree strictly less than r at the time of removal. 5 1 0 2 t c O 9 ] S D . s c [ 2 v 0 5 5 5 . 7 0 1 1 : v i X r a ∗Research supported by an ERC IDEAS Starting Grant, an NSF CAREER Award, and a Sloan Fellowship. †Dept. of Computer Science, University of Toronto. Research supported by an NSERC Discovery Grant. 1 1 Introduction In Random Constraint Satisfaction Problems (CSPs) one has a set of n variables all with the same domain D and a set of independently chosen constraints, each of which binds a randomly selected subset of k variables. In the most common setting, both D and k are O(1), while m = Θ(n). Two canonical examples are random k-SAT and coloring sparse random graphs. A fundamental quantity in the study of random CSPs is the so-called constraint density, i.e., the ratio of constraints-to-variables m/n. There has been much non-rigorous evidence from statistical physics that for many random CSPs, if the constraint density is higher than a specific value, then all but a vanishing proportion of the solutions can be partitioned into exponentially many sets (clusters) such that each set is: (i) well-separated, i.e., has linear Hamming distance from all others, and (ii) in some sense, well-connected. The solution clustering phenomenon has been a central feature of the statistical physics approach to random CSPs and is central to important algorithmic developments in the area, such as Survey Propagation [19]. The mathematical studying of clustering began in [18, 9] where it was shown that in random k-CNF formulas, above a certain density there exist constants 0 < αk < βk < 1/2 such that w.h.p. no pair of satisfying assignments has distance in the range [αkn, βkn]. Let us say that two solutions are adjacent if they have Hamming distance 1 and consider the connected components under this notion of adjacency. In [4] it was shown that above a certain density, there exist exponentially many connected components of solutions and, moreover, in every one of them the majority of variables are frozen, i.e., take the same value in all assignments in the connected component. Defining a cluster-region to be the union of one or more connected components, [3] proved that above a certain density, not only do exponentially many connected components exist, but there are exponentially many cluster-regions separated from one another by linear Hamming distance. Moreover, asymptotic bounds were given on the volume, diameter, and separation of these cluster regions. Later, in [2], it was shown for random k-SAT and random graph colouring that when clustering occurs, the emergent cluster-regions are also separated by large energetic barriers, i.e., that any path connecting solutions in different cluster-regions passes through value assignments violating linearly many constraints. This picture of cluster-regions remains unchanged if one considers two solutions to be adjacent if they have Hamming distance o(n). At the same time, though, it lends little information regarding the internal organization of cluster-regions, e.g., the connectivity of each such region. Until now, it has not been proven that any random CSP model exhibits clustering into sets that are both well-separated and well-connected. The main contribution of this paper is to prove that this phenomenon does indeed occur for random k-XOR-SAT, i.e., for systems of random linear equations over GF(2) where each equation contains precisely k variables. We also obtain a precise description of the clusters. We remark that the cluster structure for k-XOR-SAT is much simpler than what is hypothesized for most CSPs, e.g., the clusters are all isomorphic and have the same set of frozen variables (see Section 4). Random k-XOR-SAT has long been recognized as one of the most accessible of the fundamental random CSP models, in that researchers have managed to prove difficult results for it that appear to be far beyond our current reach for, e.g., random k-SAT and random graph coloring. For example, the k-XOR-SAT satisfiability threshold was established by Dubois and Mandler[11] for k = 3 and by Dietzfelbinger et al. [10] for general k. 1.1 Random systems of linear equations We consider systems of m = O(n) linear equations over n Boolean variables, where each equation binds a constant number of variables. Clearly, deciding whether such a system has satisfying assignments (solutions) can be done in polynomial time by, say, Gaussian elimination. In fact, the set of solutions forms a subspace, so that the sum of two solutions is also a solution. At the same time, it seems that if one fails to exploit the underlying algebraic structure everything falls apart. For example, if the system is unsatisfiable, finding a value assignment σ that satisfies as many equations as possible, i.e., MAX XOR-SAT, is NP-complete. Moreover, given a satisfiable system and an arbitrary σ ∈ {0, 1}n, finding a solution nearest to σ is also NP-complete [5]. Finally, random systems of linear equations appear to be extremely difficult both for generic CSP solvers and for SAT solvers working on a SAT encoding of the instance. Indeed, very recent 2 work strongly suggests that among a wide array of random CSPs, random k-XOR-SAT, defined below, is the most difficult for random walk type algorithms such as WalkSat [12]. In random k-XOR-SAT, which we study here, each equation binds exactly k ≥ 3 variables (the case k = 2 is trivial). To form the random system of equations Ax = b we take A to be the adjacency matrix of a random k-uniform hypergraph H with n variables and m edges and b ∈ {0, 1}m to be a uniformly random vector. It is straightforward to see, using e.g., Gaussian elimination, that if two systems have the same matrix A, then their solution spaces are isomorphic as b ranges over vectors for which the solution space is not empty. Since we will only be interested in properties of the set of solutions that are invariant under isomorphism, we will assume throughout that b = 0. As a result, throughout the paper we will be able to identify the system of linear equations with its underlying hypergraph. Regarding the choice of random k-uniform hypergraphs we will use both standard models Hk(n, m) and Hk(n, p), which respectively correspond to: including exactly m out of the possible (cid:0)n with probability p. (Results transfer readily betwen the two models when m = p(cid:0)n k(cid:1) edges uniformly and independently, and including each possible edge independently k(cid:1).) Our corresponding models of random k-XOR-SAT are: Definition 1. Xk(n, m), Xk(n, p) are the systems of linear equations over n boolean variables whose under- lying hypergraphs are Hk(n, m), Hk(n, p) and where we set b = 0. The usual model for k-XOR-SAT differs from ours only in that it takes a uniformly random Boolean vector b. As described above, these models are equivalent up to isomorphisms of the solution space, and hence we can use our more convenient definition for the purposes of this paper. We will say that a sequence of events En holds with high probability (w.h.p.) for such a system if limn→∞ Pr[En] = 1. We will analyze Xk(n, p). All our theorems translate to Xk(n, m) where m = p(cid:0)n We are interested in the range p = Θ(n1−k) which is equivalent to m = Θ(n). We note that as n → ∞, the degrees of the variables in such a random system tend to Poisson random variables with mean Θ(1). This implies that w.h.p. there will be Θ(n) variables of degree 0 and 1. Clearly, variables of degree 0 do not affect the satisfiability of the system. Similarly, if a variable v appears in exactly one equation ei, then we can always satisfy ei by setting v appropriately for any constant bi. Therefore, we can safely remove ei from consideration and only revisit it after we have found a solution to the remaining equations. Crucially, this removal of ei can cause the degree of other variables to drop to 1. This leads us to the definition of the core of a hypergraph. k(cid:1) using a standard argument. Definition 2. The r-core of a hypergraph H is the maximum subgraph of H in which every vertex has degree at least r. non-empty r-core suddenly, around a critical edge probability p = c∗k,r/nk−1. It is well known [25, 21, 15] that for every fixed r ≥ 2, as p is increased, Hk(n, p) acquires a (massive) Trivially, removing any vertex of degree less than r and all its incident edges from H does not change its r-core. Therefore, the r-core is the (potentially empty) outcome of the following procedure: repeatedly remove an arbitrary vertex of degree less than r until no such vertices remain. In the case of linear equations we will be particularly interested in 2-cores, as variables outside the 2-core can always be properly assigned. Definition 3. The 2-core system is the subsystem of linear equations induced by the 2-core of the underlying hypergraph, i.e., the set of equations whose variables all lie in the 2-core. A 2-core solution is a solution to the 2-core system. An extension of a 2-core solution, σ, is a solution of the entire system of linear equations that agrees with σ on all 2-core variables. We will show that in the absence of a 2-core, while the diameter of the set of solutions is linear, it is w.h.p. possible to transform any solution to any other solution by changing O(log n) variables at a time. So, the set of solutions is not only well-connected but pairs of solutions exist at, essentially, every distance-scale. On the other hand, the emergence of the 2-core signals the onset of clustering, as now every pair of solutions is either very close with respect to the 2-core variables, or very far. 3 Theorem 1. For every k ≥ 3 and c > c∗k,2, there exists a constant α = α(c, k) > 0 such that in Xk(n, p = c/nk−1), w.h.p. every pair of solutions either disagree on at least αn 2-core variables, or on at most ξ(n) 2-core variables, for any function ξ(n) → ∞ arbitrarily slowly. We will refine the picture of Theorem 1, to prove that as soon as the 2-core emerges, unless two solutions agree on essentially all 2-core variables, transforming one into another requires the simultaneous change of Ω(n) variables. To identify the relevant 2-core disagreements, we need to define the following notion which is central to our work. Definition 4. A flippable cycle in a hypergraph H is a set of vertices S = {v1, . . . , vt}, where t ≥ 2, where the set of edges incident to S can be ordered as e1, . . . et such that each vertex vi lies in ei and in ei+1 and in no other edges of H (addition mod t). Remark 5. Note that the vertices v1, . . . , vt must have degree exactly two in the hypergraph. The remaining vertices in edges e1, . . . , et can have arbitrary degree and are not part of the flippable cycle. Definition 6. A core flippable cycle in a hypergraph H is a flippable cycle in the subhypergraph H0 ⊆ H induced by the 2-core of H. Thus, in a core flippable cycle, the vertices v1, . . . , vt have degree exactly two in the 2-core, but possibly higher degree in H. Note also that H may contain flippable cycles outside the 2-core. We will prove (Lemma 35(b)) that w.h.p. the core flippable cycles are disjoint. As discussed above, any 2-core solution can be readily extended to the remaining variables. Indeed, this can typically be done in numerous ways since the equations not in the 2-core are far less constrained, e.g., a constant fraction of the equations outside the 2-core form hypertrees very loosely attached to the 2-core. In order to understand the emergence of the clustering of solutions, we will focus on whether we can change the value of a 2-core variable without changing many other 2-core variables. If σ is any 2-core solution then flipping the value of all variables in a core flippable cycle readily yields another solution of the 2-core, since every equation contains either zero or two of the flipped variables. It is not hard to show that a random hypergraph often contains a handful of short core flippable cycles, implying that 2-core solutions may have Hamming distance Θ(1). At the same time, though, we will see (Lemma 35) that, for any ξ(n) → ∞ arbitrarily slowly, the total number of vertices in core flippable cycles w.h.p. does not exceed ξ(n), placing a corresponding upper bound on the distance between core solutions that differ only on flippable cycles. In contrast, we will prove that w.h.p. every pair of core solutions that differ on even one 2-core variable not in a flippable cycle, differ in at least Ω(n) 2-core variables. In other words, flipping the handful of variables in potential flippable cycles, w.h.p. is the only kind of movement between 2-core solutions that does not entail the simultaneous change of a massive number of variables. The above indicates that the following is the appropriate definition of clusters in random k-XOR-SAT. Definition 7. Two solutions are cycle-equivalent if on the 2-core they differ only on variables in core flippable cycles (while they may differ arbitrarily on variables not in the 2-core). Definition 8. The solution clusters of Xk(n, p = c/nk−1) are the cycle-equivalence classes, i.e., two solutions are in the same cluster iff they are cycle-equivalent. Note that in the absence of a 2-core, this definition states that all solutions are in the same cluster. We can now state our main theorems in terms of connectivity properties of clusters. Definition 9. Two solutions σ, τ of a CSP are d-connected if there exists a sequence of solutions σ, σ′, . . . , τ such that the Hamming distance of every two successive elements in the sequence is at most d. A set S of solutions is d-connected if every pair σ, τ ∈ S is d-connected. Two solution sets S, S′ are d-separated if every pair σ ∈ S, τ ∈ S′ is not d-connected. 4 It appears that for many random CSP's, there is a constant α > 0 and a function g(n) = o(n) such that if the constraint density is sufficiently large, then all but a vanishing proportion of the solutions can be partitioned into clusters S1, . . . , St such that: • Every Si is g(n)-connected. • Every pair Si, Sj is αn-separated. That is the sense in which we said earlier that each cluster is well-connected and that each pair of clusters is well-separated. Our main theorems are that for k-XOR-SAT, the clusters we defined in Definition 8 satisfy these condi- tions with g(n) = O(log n). Note that for this particular CSP, the clusters contain all the solutions, rather than all but a vanishing proportion of them. Theorem 2. For any constant c 6= c∗k,2 and k ≥ 3, there exists a constant α = α(c, k) > 0 such that in Xk(n, p = c/nk−1), w.h.p. every pair of clusters is αn-separated. In stark contrast, we prove that clusters are internally very well connected. Theorem 3. For any constant c 6= c∗k,2 and k ≥ 3, there exists a constant Q = Q(c, k) > 0 such that in Xk(n, p = c/nk−1), w.h.p. every cluster is Q log n-connected. Theorem 3 is nearly tight due to the following. Observation 10. W.h.p. every cluster contains a pair of solutions that are not g(n)-connected, for some g(n) = Ω(log n/ log log n). Proof. Consider any solution σ to the 2-core, and consider any two extensions σ0, σ1 of σ to the entire system such that, for some non-core variable v, we have σ0(v) = 0 but σ1(v) = 1. Then σ0, σ1 must differ in at least one additional variable in every equation containing v implying that their Hamming distance is at least deg(v) + 1. If T is an acyclic (tree) component of the underlying hypergraph and v is any vertex in T , then, clearly, σ can be extended so that v takes any desired value. Therefore, the maximum degree of any vertex in a tree component is a lower bound for g(n). A tree component T is a d-star if precisely one vertex in T has degree d and all other vertices have degree 1. Computing the second moment of the number of d-stars in a random hypergraph implies that w.h.p. there exist g(n)-stars, where g(n) = Ω(log n/ log log n). So, in a nutshell, we prove that before the 2-core emerges any solution can be transformed to any other solution along a sequence of successive solutions differing in O(log n) variables. In contrast, after the 2-core emerges, the set of solutions shatters into clusters defined by complete agreement on the 2-core, except for the handful of variables in core flippable cycles: any two solutions that disagree on even one 2-core variable not in a core flippable cycle, must disagree on Ω(n) variables. At the same time, solutions in the same cluster behave like solutions in the pre-core regime, i.e., one can travel arbitrarily inside each cluster by changing O(log n) variables at a time. Our proof of Theorem 3 is algorithmic, giving an efficient method to travel between any pair of solutions in the same cluster. Indeed, to prove Theorem 3, we draw heavily from the linear structure of the constraints to: (1) identify a set B of free variables such that the 2B solutions in any cluster are determined by the 2B assignments to B, (2) prove that we can change these free variables one-at-a-time, each time obtaining a new solution by changing only O(log n) other variables. For c < c∗k,2, there is no 2-core, and so all solutions belong to the same cluster. For c > c∗k,2, but below the k-XOR-SAT satisfiability threshold, the number of 2-core variables exceeds the number of 2-core equations by Θ(n) (see [11, 10]), and the number of variables on core flippable cycles has expectation O(1) (Lemma 35); it follows that w.h.p. there are an exponential number of clusters. So Theorems 2, 3 yield: Corollary 11. For every k ≥ 3 and c below the k-XOR-SAT satisfiability threshold: 5 • If c < c∗k,2, then w.h.p. the entire solution-set of Xk(n, p = c/nk−1) is O(log n)-connected. • If c > c∗k,2, then w.h.p. the solution-set of Xk(n, p = c/nk−1) consists of an exponential number of Θ(n)-separated, O(log n)-connected clusters. For k ≥ 3, the threshold for the appearance of a non-empty 2-core was determined in [21, 15] (see also [8]) to be: c∗k,2 = min λ>0 (k − 1)!λ (1 − e−λ)k−1 . For example, when k = 3, an exponential number of clusters emerge at c = 0.13... while the satisfiability threshold[11] is at c = 0.15.... (These values correspond to m/n = 0.818... and m/n = 0.917... in the Xk(n, m) model.) It is not clear what happens, in terms of clustering, at density c = c∗k,2; see the remarks following Theorem 5. Our proof of Theorem 2 easily extends to all uniquely extendable CSPs. Definition 12 ([7]). A constraint of arity k is uniquely extendable if for every set of k − 1 variables and every value assignment to those variables there is precisely one value for the unassigned variable that satisfies the constraint. Linear equations over GF(2) and unique games are the two most common examples of uniquely extendable (UE) CSPs, but many others exist (see, eg. [7]). Clearly, any instance of a UE CSP Φ is satisfiable iff its 2-core is satisfiable. Thus, it is natural to define clusters analogously to XOR-SAT, i.e., two solutions are in the same cluster if and only if their 2-core restrictions differ only on core flippable cycles. Our proof of Theorem 2 applies readily to any UE CSP, yielding a corresponding theorem, i.e., that there exists α > 0 such that if two solutions are not cycle-equivalent they are not αn-connected (see the remark following Proposition 48). However, we do not know whether the analogue of Theorem 3 holds under this definition of clusters, i.e., whether it is possible to travel between cycle-equivalent solutions in small steps. Also, note that while in XOR-SAT changing all the variables in any flippable cycle results in another solution, this is not necessarily the case for every UE CSP Φ. Finally, we note that Theorem 1 follows immediately from Theorem 2 and the fact that w.h.p. there are fewer than ξ(n) vertices on flippable cycles (Lemma 35). Indeed, if two solutions differ on more than ξ(n) 2-core variables, then they disagree on a variable that is not on a flippable cycle. Thus, they are in different clusters and so disagree on at least αn variables, by Theorem 2. So the paper focuses on proving Theorems 2 and 3. Remark: Ibrahimi, Kanoria, Kraning and Montanari [13] have, independently, obtained similar results to ours. Their definition of clusters is equivalent to ours, and they prove that the clusters are well-connected and well-separated. Their cluster separation result is equivalent to our Theorem 2, but uses a different technique. Their internal connectivity result differs from our Theorem 3 in that (a) they prove that the clusters are polylog(n)-connected rather than O(log n)-connected, and (b) they additionally prove that the clusters exhibit a form of high conductance. Again, their approach is different from the one used here. To prove high conductance, they show that w.h.p. the solution space contains a basis which is polylog(n)-sparse, meaning that each vector in the basis has Hamming distance at most polylog(n) from 0. It is easy to see that the set of free variables B that we choose in Section 4 yields a O(log n)-sparse basis. So our proof, along with Lemma 1.1 of [13] combine to yield a stronger conductance result by replacing "(log n)C " with "O(log n)" in their Theorem 1. 1.2 Cores of hypergraphs The main step in our proof of Theorem 3 is to prove a property of the non-2-core vertices in a random hypergraph. As this property is of independent interest, we prove it for non-r-core vertices for general r ≥ 2. 6 For any integers k ≥ 2, r ≥ 2 such that r + k > 4, the threshold for the appearance of a non-empty r-core in a k-uniform random hypergraph was determined in [21, 15] to be: (1) c∗k,r = min λ>0 (k − 1)!λ (cid:2)e−λP∞i=r−1 λi/i!(cid:3)k−1 . For r = k = 2, i.e., for cycles in graphs, the emergence of a 2-core is trivial as any constant-sized cycle has non-zero probability for all c > 0. On the other hand, for r + k > 4, any r-core has linear size w.h.p. The threshold for the emergence of a 2-core of linear size in a random graph coincides with the threshold for the emergence of a giant component [24], so we set c∗2,2 = 1, consistent with the expression above after replacing min with inf. Recall that we can reach the r-core of a hypergraph by repeatedly removing any one vertex of degree less than r, until no such vertices remain. Consider a vertex v not in the r-core, and consider the goal of repeatedly removing vertices of degree less than r until v is removed. We prove that w.h.p. for every non-r-core variable v, this can be achieved by removing only O(log n) vertices. Definition 13. An r-stripping sequence is a sequence of vertices that can be deleted from a hypergraph, one- at-a-time, along with their incident hyperedges such that at the time of deletion each vertex has degree less than r. A terminal r-stripping sequence is one that contains all vertices outside the r-core; i.e., a sequence whose deletion leaves the r-core. Definition 14. For any vertex v not in the r-core, the depth of v is the length of a shortest r-stripping sequence ending with v. Theorem 4. For any integers k ≥ 2, r ≥ 2 and any constant c 6= c∗k,r, let H = Hk(n, p = c/nk−1). There exists a constant Q = Q(c, k, r) > 0 such that w.h.p., every vertex v in H has depth at most Q log n. It is easy to show using standard facts about r-cores of random hypergraphs that for every constant ǫ > 0, there is a constant T = T (ǫ) such that w.h.p. all but ǫn of the non-core vertices have depth at most T . The challenge here is to prove that w.h.p. all non-core vertices have depth O(log n). Remark 15. The case k = r = 2, i.e. the 2-core of a random graph, follows easily from previously known work. The conclusion of Theorem 4 does not hold at c = c∗2,2 = 1. (See the remarks following the statement of Theorem 5 below.) 2 Related work To get an upper bound on the random k-XOR-SAT satisfiability threshold, observe that the expected number of solutions in a random instance with n variables and m constraints is bounded by 2n(1/2)m → 0 if m/n > 1. As one can imagine, this condition is not tight since variables of degree 0 and 1 only contribute fictitious degrees of freedom. Perhaps the next simplest necessary condition for satisfiability is mc/nc = γc ≤ 1, where nc, mc is the number of variables and equations in the 2-core, respectively. In [11] Dubois and Mandler proved that, for k = 3, this simple necessary condition for satisfiability is also sufficient by proving that for all γc < 1, the number of core solutions is strongly concentrated around its (exponential) expectation. Thus, they determined the satisfiability threshold for 3-XOR-SAT. Dietzfelbinger et al. [10] modify and extend the approach of [11] to determine the satisfiability threshold for general k. A full version of [11] has not been published, but a proof for all k ≥ 3 appears in [10]. M´ezard et al. [20] were the first to study clustering in random k-XOR-SAT. Specifically, they defined the clusters by saying that two solutions are in the same cluster iff they agree on all variables in the 2-core. They proved that there exists a constant γ > 0 such that for any θ ∈ (0, γ) and any integer z = θn + o(n), w.h.p. no two solutions differ on exactly z variables in the 2-core. Based on this fact, they claimed that the clusters they defined are Ω(n)-separated, i.e., that every pair of solutions in different clusters is not γn-connected. As we have already seen, this is false since it does not account for the effect of core flippable 7 cycles. Performing the analysis of solutions that differ on o(n) variables is what allows us to establish that 2-core solutions which differ on o(n) variables must differ only on core flippable cycles. Indeed, this is the most difficult part of our proof of Theorem 2. M´ezard et al. [20] also gave a heuristic argument that if σ is any solution and v is a non-core variable, then there exists a solution σ′ in which v takes the opposite value from the one in σ such that the distance between σ and σ′ is O(1). From this they concluded that clusters are well-connected. Regarding internal connectivity, the clusters of [20] are, indeed, well-connected, i.e., the analogue of Theorem 3 holds for them, since they are subsets of the clusters defined in this paper. However their proof of this fact is flawed; it implies that their clusters are O(1)-connected, which is not true by the same argument used as for Observation 10. Proving that the k-XOR-SAT clusters are well-connected was later listed as an open problem in [17]. Finally, as described above, Ibrahimi, Kanoria, Kraning and Montanari [13] have, independently, obtained similar results to ours. 3 Proof Outline 3.1 Theorem 2: Cluster separation Given a solution σ, a flippable set is a set of variables S such that flipping the value of all variables in S yields another solution τ . Proving Theorem 2 boils down to proving that w.h.p., in the subsystem induced by the 2-core, every flippable set other than a flippable cycle has linear size. A common approach to proving analogous statements is to establish that every flippable set, other than a flippable cycle, must deterministically induce a dense subgraph. In particular, if one can prove that for some constant ǫ > 0, every such set is at least 1 + ǫ times as dense as a flippable cycle, then standard arguments yield the desired conclusion. Here, though, this is not the case, due to the possibility of arbitrarily long paths of degree 2 vertices. Specifically, by replacing the edges of any flippable set (that is not a flippable cycle) by 2-linked paths, one can easily create flippable sets whose density is arbitrarily close to that of a flippable cycle (for a more more precise statement, see the definition of 2-linked paths in Section 9). Thus, controlling the number and interactions of these 2-linked paths, an approach similar to that of [1, 23], is crucial to our argument. In order to work on the 2-core, we carry this analysis out on hypergraphs with a given degree sequence. The key to controlling 2-linked paths is to bound a parameter governing the degree to which they tend to branch. Lemma 32 shows that this parameter is bounded below 1, so while arbitrarily long 2-linked paths will occur, their frequency decreases exponentially with their length. We note that if we were working on hypergraphs with minimum degree at least 3, then there would be no 2-linked paths, and the proof would have been very easy. All of the difficulties arise from the problem of degree 2 vertices. We note that our approach applies to general degree sequences of minimum degree 2. 3.2 Theorem 3: Connectivity inside clusters The main step in the proof of Theorem 3 is to prove Theorem 4; i.e. that every vertex outside the r-core can be removed by an r-stripping sequence of length O(log n). It is often useful to consider stripping the vertices in several parallel rounds. Definition 16. The parallel r-stripping process consists of iteratively removing all vertices of degree less than r at once along with any hyperedges containing any of those vertices, until no vertices of degree less than r remain. To prove that all non-core vertices can be removed by a stripping sequence of length O(log n), our approach is significantly different below and above the threshold, c∗k,r, for the emergence of an r-core in random k-uniform hypergraphs. In both cases, we begin by stripping down to HB, the hypergraph remaining after B rounds of the parallel stripping process, for a sufficiently large constant B. A simple argument shows that for any non-core vertex v, the number of vertices removed during this initial phase that are relevant to 8 the removal of v, is bounded. Thus, what remains is to show that any non-core vertex in HB can be removed from HB by a stripping sequence of length O(log n). For c < c∗k,r, we prove that there exists a sufficiently large constant B = B(c, k, r) such that all connected components of HB have size at most W = O(log n); therefore, any remaining vertex can be removed with an additional W strips. To do this we establish analytic expansions for the degree sequence of HB as B grows and then apply a hypergraph extension of the main result of Molloy and Reed [22] regarding the component sizes of a random k-uniform hypergraph with a given degree sequence. For c > c∗k,r, a lot more work is required. Once again, 2-linked paths are a major problem. Indeed, it is not hard to see that a long 2-linked path with one endpoint of degree 1, can create a long stripping sequence leading to the removal of its other endpoint. We first establish that for any ǫ > 0, there exists a sufficiently large constant B = B(c, k, r, ǫ) such that HB is sufficiently close to the r-core for two important properties to hold in HB: (i) there are at most ǫn vertices of degree less than r, and (ii) the "branching" parameter for 2-linked paths, mentioned above, is bounded below 1. Property (ii) allows us to control long 2-linked paths. However, this does not suffice as we need to control, more generally, for large tree-like stripping sequences. To do so, we note that any large tree must either have many leaves, or long paths of degree 2 vertices. Such long paths will correspond to 2-linked paths in the random hypergraph, and so (ii) allows us to control the latter case. Leaves of the tree will have degree less than r, and so (i) enables us to control the former case. 4 An Algorithm for Traveling Inside Clusters In this section, we show how we use Theorem 4 to prove Theorem 3. In fact, we require Theorem 5 below, which is somewhat stronger than Theorem 4. Given a hypergraph H, we consider any terminal r-stripping sequence, v1, . . . , vt, i.e., one that removes every vertex outside of the r-core of H. Let Hi denote the hypergraph remaining after removing v1, . . . , vi−1; so H1 = H and Ht+1 is the r-core of H. Let Ei denote the set of at most r− 1 hyperedges in Hi that contain vi. We form a directed graph, D, as follows: Definition 17. The vertices of D are the non-r-core vertices v1, . . . , vt, as well as any r-core vertex that shares a hyperedge with a vertex not in the r-core. For each vertex vi in the stripping sequence, D contains a directed arc (u, vi) for every vertex u 6= vi contained in the hyperedges of Ei. Note that if vi has degree zero in Hi, then Ei = ∅, and so vi will have indegree zero in D. For every vertex v in D, we define R+(v) to be the set of vertices that can be reached from v. Note that if v is not in the r-core, then the vertices of R+(v) can be arranged into a (not necessarily terminal) r-stripping sequence ending with v. So to prove Theorem 4, it suffices to show R+(v) = O(log n) for every such v. Theorem 5. For any integers k ≥ 2, r ≥ 2 and any constant c > 0, c 6= c∗k,r, let H = Hk(n, p = c/nk−1). There exists a constant Q = Q(k, r, c) > 0 such that w.h.p. there is a terminal r-stripping sequence of H for which in the digraph D associated with the sequence: (a) For every vertex v, R+(v) ≤ Q log n. (b) For r = 2, for every core flippable cycle C, R+(v) ≤ Q log n . Xv∈C Remark 18. The proof of Theorem 5 can be extended to show that w.h.p. for every vertex v ∈ D, the subgraph induced by R+(v) has at most as many arcs as vertices. 9 Remark 19. The case r = k = 2 follows from previously known work. For c < c∗2,2 = 1, it follows from the fact that w.h.p. every component of Gn,p=c/n has size O(log n) below the giant component threshold c∗2,2. For c > c∗k,r, it follows from Lemma 5(b) of [24]. Our proof will work for k = r = 2, but it is convenient to assume (k, r) 6= (2, 2). Remark 20. We think that the conclusion of Theorem 5 does not hold at c = c∗k,r + o(1). This is known to be true for the case k = r = 2. Indeed, when c = 1 − λ, for λ = n−1/3+ǫ, ǫ > 0, w.h.p. the size of the largest component is Θ(λ−2 log n) and no component has more than one cycle [16]. A simple first moment analysis yields that w.h.p. there is no cycle of length greater than log n/λ. Furthermore, w.h.p. no vertex has degree greater than log n. It follows that the largest component must contain an induced subtree, none of whose vertices are in the 2-core, which has size Θ( λ−2 log n log2 n/λ ) = Θ(1/(λ log n)). It is easy to see that such a subtree will contain vertices with depth Θ(1/(λ log n)), which can be as large as nα for any α < 1/3. The proof of Theorem 5 occupies Sections 7 and 8, after we set out some basic facts about cores in Section 5 and some basic calculations in Section 6. But first, we show that it yields Theorems 3 and 4: Proof of Theorem 4. This follows immediately from Theorem 5 because the depth of v is at most R+(v). We are now ready to give our algorithm for traveling between any two assignments in the same cluster while changing O(log n) variables at a time. Proof of Theorem 3. Given an arbitrary system of linear equations consider a terminal 2-stripping sequence v1, . . . , vt of its associated hypergraph and let D be the digraph formed from the sequence. For each core flippable cycle, C, we choose an arbitrary vertex vC ∈ C. Let B be the set consisting of each vertex vC and every non-2-core vertex with indegree zero in D. Consider any 2-core solution σ. Consider the system of equations formed from our system by fixing the value of every 2-core variable that does not belong to a core flippable cycle to its value in σ; we call such vertices fixed vertices. Recall from Definition 4 that the edges of a flippable cycle contain vertices that are not considered to be vertices of the flippable cycle; such vertices will be fixed. Note that the solutions of this system form a cluster, and that every cluster can be formed in this way from some σ. We will perform Gaussian elimination on this system in a manner such that B will be the set of free variables that we obtain. Importantly, this set of free variables does not depend on σ, i.e., it will be the same for every cluster. For each v ∈ B and for each fixed vertex v, set χ(v) = {v}. For each core flippable cycle C, we process all of the edges (i.e., equations) joining consecutive vertices of C except for one of the edges containing vC . For each vertex v ∈ C, we obtain the equation v = vC + zv where zv is a constant (0 or 1) depending only on the assignment to the fixed vertices in the edges of C; we set χ(v) = {vC}. By Lemma 35, the core flippable cycles are vertex-disjoint, and so the equations corresponding to two core flippable cycles can overlap only on fixed variables. Thus, we can carry this out for each core flippable cycle C independently. Next, we process the edges not in the 2-core, in reverse removal order, i.e., Et, . . . , E1. Note that, since r = 2, each Ei contains at most one edge. When processing Ei, we set χ(vi) to the symmetric difference of the sets χ(u), over all u ∈ Ei other than vi. That is, a variable z is in χ(vi) iff z ∈ χ(u) for an odd number of variables u ∈ Ei other than vi. Since Ei is the equation vi =Pu∈Ei;u6=v u, this is equivalent (by induction) to vi =Pw∈χ(vi) w + zvi , where zvi is the sum of zu over all vertices u ∈ χ(vi) that belong to core flippable cycles. We now note that every non-2-core vertex vi /∈ B has indegree at least 1 in D and so Ei = 1 and thus χ(vi) is defined. For each vertex u 6= vi in Ei, either u ∈ B, or u is fixed, or u = vj for some j > i, or u is in a core flippable cycle. Therefore, by induction, χ(vi) contains only vertices that are in B or are fixed. Finally, note that possibly χ(vi) = ∅; in that case, vi = Pw∈χ(vi) w + zvi = zvi in every solution. (It is not hard to adapt the proof of Theorem 5 to show that w.h.p. for every i, χ(vi) 6= ∅. But that is not required for the purposes of this paper.) At this point, all non-fixed vertices are either in B or have been expressed as the sum of vertices in B and fixed vertices. Therefore, the vertices in B are the free variables for the system obtained by fixing the values of the fixed vertices to σ. Thus, there are exactly 2B solutions to that system, one for each assignment to 10 B. We can move between any two such solutions by changing the assignments to the vertices of B, one at a time. Each time we change the value of a non-2-core vertex v ∈ B, in order to get to another solution, we only need to change a subset of R+(v) in the digraph D, because only vertices u ∈ R+(v) can have v ∈ χ(u). Similarly, each time we change the value of some vC ∈ B, we only need to change a subset of ∪v∈C R+(v). Thus, by Theorem 5, we can move between any two such solutions changing at most Q log n variables at a time. This implies Theorem 3, since each cluster is such a solution set. We close this section by showing how the preceding proof extends to determine all of the frozen variables. A variable is said to be frozen in a cluster, if it takes the same value in all assignments of the cluster. In general random CSPs it is hypothesized that the set of frozen variables can differ from cluster to cluster. In random k-XOR-SAT, though, the set of frozen variables depends only on the underlying hypergraph, i.e., is the same for all clusters. Theorem 6. In every cluster, the frozen variables consist of the 2-core vertices not in core flippable cycles, and the non-2-core variables v for which χ(v) ∩ B = ∅. Proof. This follows immediately from the fact that B is the set of free variables in a system of linear equations whose solution set is the cluster. 5 Random hypergraphs and their cores We will use the configuration model of Bollob´as [6] to generate a random k-uniform hypergraph H with a given degree sequence. Suppose we are given the degree d(v) for each vertex v; thusP d(v) = kE where E is the number of hyperedges. We take d(v) copies of each v, and we take a uniformly random partition of these kE vertex-copies into E sets of size k. This naturally yields a k-uniform hypergraph, by mapping each k-set to a hyperedge on the vertices whose copies are in the k-set. Note that the hypergraph may contain loops (two copies of the same vertex in one hyperedge) and multiple edges (two identical hyperedges). It is well known that the probability that this partition yields a simple hypergraph (i.e., one with no loops or multiple edges) is bounded below by a constant for degree sequences1 satisfying certain conditions. Specifically: Definition 21. Say that a degree sequence S is nice if E = Θ(n), Pv d(v)2 = O(n) and d(v) = o(n1/24) for all v. Every degree sequence we will consider will correspond to some subgraph of Hk(n, p) with a linear expected number of edges. Since, as is well known, the degree sequence of such random hypergraphs is nice w.h.p., all the degree sequences we will consider will be nice. With this in mind, we will make heavy use of the following standard proposition (see eg. [8]) and corollary, as working in the configuration model is technically much easier than working with uniformly random hypergraphs with a given degree sequence. Proposition 22. If S is a nice degree sequence, then there exists ǫ > 0 such that the probability that a random hypergraph with degree sequence S drawn from the configuration model is simple is at least ǫ. This immediately yields: Corollary 23. If S is a nice degree sequence then: (a) If property Q holds w.h.p. for k-uniform hypergraphs with degree sequence S drawn from the configu- ration model, then Q holds w.h.p. for uniformly random simple hypergraphs with degree sequence S. (b) For any random variable X, if E(X) = O(1) for k-uniform hypergraphs with degree sequence S drawn from the configuration model, then E(X) = O(1) for uniformly random simple hypergraphs with degree sequence S. 1Clearly, we are referring to a sequence of degree sequences Sn so that asymptotic statements are meaningful. We suppress this point though, throughout, to streamline exposition. 11 The following lemma will be very useful. Its exponential term is not tight, but will suffice for our purposes. Lemma 24. Consider a random k-uniform hypergraph drawn from the configuration model with E edges, i=2 ℓi. The probability that each of these sets appears in some hyperedge, and no two appear in the same hyperedge is less than i.e., with total degree kE. For each i = 2, . . . , k, specify ℓi sets of i vertex-copies, and set L =Pk exp(cid:18) kL2 E − L(cid:19) k Yi=2(cid:18) (k − 1)(k − 2)··· (k − i + 1) (kE)i−1 (cid:19)ℓi . Proof. We choose the partition of the vertex-copies by processing the specified sets one-at-a-time. To process one of the ℓi sets of size i, we first choose one set member γ arbitrarily and then randomly select the remaining k − 1 vertex-copies of the part containing γ. Every time we do this there are at least kE − kL yet unselected vertex-copies. Thus, the probability we chose all other i − 1 members of the specified set is at most (k − 1)(k − 2)··· (k − i + 1) (kE − kL)i−1 < < (k − 1)(k − 2)··· (k − i + 1) (kE)i−1 (k − 1)(k − 2)··· (k − i + 1) (kE)i−1 E − L(cid:19)i−1 ×(cid:18) E × ekL/(E−L), since i ≤ k. So the probability that each of the L tuples is chosen to be in a hyperedge is less than k Yi=2(cid:18) (k − 1)(k − 2)··· (k − i + 1) (kE)i−1 (cid:19)ℓi × e(kL/(E−L))ℓi = ekL2/(E−L) × k Yi=2(cid:18) (k − 1)(k − 2)··· (k − i + 1) (kE)i−1 (cid:19)ℓi . 5.1 Cores Recall from Section 4 that Theorem 5 is already known for k = r = 2. So we will assume that k + r > 4. It is well known that the r-core of a random k-uniform hypergraph is uniformly random conditional on its degree sequence. See [25] for the case k = 2, and [21] for the nearly identical proof for general k. In fact, the same is true of the graph remaining after any number of iterations of the parallel stripping process. Let H = Hk(n, p) be a random k-uniform hypergraph and let H = H0, H1, . . . be the sequence of hypergraphs produced by the parallel r-stripping process. It is well known how (see e.g., [21]) to show the following propositions. Proposition 25. (a) For every i ≥ 0, Hi is uniformly random with respect to its degree sequence. (b) There exist functions ρ0, ρ1, . . . such that for any fixed integer i, w.h.p. Hi contains ρj(i)n + o(n) vertices of degree j and 1 k (Pj≥1 jρj(i))n + o(n) edges. Remark 26. The functions ρj(i) have explicit recursive expressions, which we give in Section 8. An approximation is stated in Proposition 31 below. Proposition 25 allows us to use the configuration model to study Hi. We will begin by showing that we can uniformly approximate the total degree of Hi. Lemma 27. For every fixed integer i ≥ 0, Xv∈Hi degHi (v) = Xj≥1 jρj(i)  n + o(n) . 12 superlinear number of edges. Proof. Proposition 25 implies that Pj≥1 jρj(i) is convergent, else w.h.p. Hi, and hence H, would have a (v)≤J degHi (v) = PJ Consider any fixed J. By Proposition 25, w.h.p. Pv:degHi any θ > 0, the convergence of Pj≥1 jρj(i) implies that we can choose J = J(θ) sufficiently large that (v)>J degHi (v) ≤ Pv:degH (v)>J degH (v). The Pj>J jρj(i) < θ/2. Since Hi ⊆ H0 = H, we have Pv:degHi kPℓ≥1 ℓλℓn. Thus, fact that the latter sum is less than θn/2 for J sufficiently large is well known and follows from the facts that (i) for each constant ℓ, the number of vertices of degree ℓ in H is w.h.p. λℓn + o(n) for a particular λℓ = λℓ(c) and (ii) the number of hyperedges in H is highly concentrated around 1 < θn for every θ > 0, which establishes the lemma. j=1 jρj(i)n + o(n). For (cid:12)(cid:12)(cid:12)Pv∈Hi degHi (v) −(cid:16)Pj≥1 jρj(i)(cid:17) n(cid:12)(cid:12)(cid:12) The following similar bound will also be useful: Lemma 28. For every constant d and fixed integer i > 0: = Xj≥d ρj(i) j! (j − d)!  n + o(n) . Xv:degHi (v)≥d degHi (v)! (degHi (v) − d)! Proof. The proof is almost identical to that of Lemma 27 but exploits the concentration of the number of d-stars in H, rather than of the number of hyperedges. (A d-star is a set of d hyperedges which contain a common vertex.) The concentration of the number of d-stars in H is easily established, e.g., by the Second Moment Method or Talagrand's Inequality. (Indeed, Lemma 27 and its proof are special cases of this lemma and its proof for d = 1.) For any fixed integers k, r and real number λ > 0, we write Ψr(λ) = e−λ Xi≥r−1 λi/i! and fk,r(λ) = f (λ) = (k − 1)!λ Ψr(λ)k−1 . Recall that for k + r > 4, the threshold for the appearance of an r-core in a random k-uniform hypergraph Hk(n, p) with p = c/nk−1 is c∗k,r = min λ>0 fk,r(λ). We will see that f′ has a unique root and, thus, for c > c∗k,r the equation f (λ) = c has two solutions. Definition 29. For c > c∗k,r, let µ = µ(c) denote the larger of the two solutions of f (λ) = c. The following two propositions are standard; see e.g., [21] for proofs. Proposition 30. For every fixed j ≥ r, w.h.p. the r-core contains (e−µµj/j!)n + o(n) vertices of degree j. Furthermore, w.h.p. the r-core contains (µ/k)Ψr(µ)n + o(n) edges. Proposition 31. For every c 6= c∗k,r and θ > 0, there exists B = B(θ) such that w.h.p. (a) HB contains fewer than θn vertices not in the r-core; (b) For each j ≥ r, ρj(B) − e−µµj/j! < θ. The following lemma will be critical for our analysis. Lemma 32. For every c > c∗k,r, there exists ζ = ζ(k, r, c) > 0 such that (k − 1) µr−1 (r − 2)! < (1 − ζ) Xi≥r−1 µi i! , (2) where µ is the larger of the two roots of the equation fk,r(λ) = c. 13 Proof. f′(λ) = 0 ⇐⇒ Ψr(λ) = λ(k − 1)Ψr(λ)k−2Ψ′r(λ) ⇐⇒ Xi≥r−1 λi i! = (k − 1) λr−1 (r − 2)! . (3) Equation (3) yields c∗k,r = f (λ∗) for some λ∗ satisfying the last equation in (3). For c > c∗k,r, since µ = µ(c) is the larger of the two roots of f (λ) = c, it follows that µ > λ∗. The lemma now follows by noting that the RHS of (2) divided by the LHS is proportional to Pi≥r−1 µi−r+1 i! , which is clearly increasing with µ. 6 Preliminaries to the proof of Theorem 5 Recall that we assume k + r > 4 and let H = Hk(n, p) be a random k-uniform hypergraph with p = c/nk−1. Let H = H0, H1, . . . be the sequence of hypergraphs produced by the parallel r-stripping process. As we said above, we will choose a sufficiently large constant B, strip down to HB, and then focus on R+(u) ∩ HB, making use of the fact that HB is very close to the 2-core (by Proposition 31). The following will be used to bound the number of vertices that are removed from R+(u) when stripping down to HB. For integer s ≥ 0, we use N s(v) to denote the s-th neighborhood of v, i.e., the set of vertices within distance s from v. For any set of vertices A, N s(A) =Sv∈A N s(v). We consider a single vertex to be a connected set. A straightforward induction yields the following. Proposition 33. For any integer i and vertex u ∈ Hi, R+(u) ⊆ N i(R+(u) ∩ Hi). Lemma 34. For any c, s ≥ 0, there exists Γ = Γ(c, s) such that in a random graph G(n, p) with p = c/n, w.h.p. for every connected subset A of vertices N s(A) ≤ Γ(A + log n). Proof. We prove this for the case s = 1, i.e., that there is a constant γ > 1 such that w.h.p. every connected subset of vertices A satisfies N (A) ≤ γ(A + log n). By iterating, we obtain that for every s ≥ 1, every connected subset of vertices A satisfies N s(A) ≤ fs(A) where f1(x) = γ(x + log n) fi+1(x) = γ(fi(x) + log n), for i ≥ 1. A simple induction yields fi(x) ≤ γi(x + i log n) and that yields the lemma with Γ = sγs. Given any set A of size a, the probability that A is connected is at most the expected number of spanning trees of A which is aa−2(c/n)a−1. After conditioning that A is connected, the number of neighbors outside of A is distributed as Bin(a(n − a), c/n). The probability that this exceeds z is at most (cid:18)a(n − a) z (cid:19)(cid:16) c n(cid:17)z z (cid:17)z <(cid:16) eca < 2−z, for z > 2eca. For any γ > 2, if N (A) > γ(A + log n), then we must have N (A)\A > 1 the expected number of connected sets A satisfying this last inequality is at most a2 (cid:16) ec 2 γ(A + log n). Taking γ > 4ec, 2γ/2(cid:17)a−1 en a2 (ec)a−1 2− 1 (cid:18)n a(cid:19)aa−2(cid:16) c n(cid:17)a−1 2 γ log n = n−Θ(γ) , 2− 1 2 γ(a+log n) < 2 γ(a+log n) < en 2− 1 for γ sufficiently large. Multiplying by the n choices for a yields the lemma. Lemma 35. Fix k ≥ 3 and let H = Hk(n, p) be a random k-uniform hypergraph with p = c/nk−1, where c > c∗k,2. (a) The expected number of vertices in core flippable cycles of H is O(1). (b) W.h.p. no vertex lies in two core flippable cycles. 14 Proof. Let D be the degree sequence of the 2-core of H. By Corollary 23, we can work in the configuration model. Recalling Definition 29, Proposition 30 and Lemma 32, w.h.p. (i) D has total degree γn + o(n), where γ = µΨr(µ), (ii) D has λ2n + o(n) vertices of degree 2, where λ2 = e−µµ2/2, (iii) there exists ζ > 0 such that 2(k − 1)λ2 < (1 − ζ)γ. We first bound the expected number of core flippable cycles of size a. Let Λ = γn + o(n) be the total number of vertex copies, and let L = λ2n + o(n) be the number of copies of degree 2 vertices. a(cid:1) choices for the connecting vertices, (a−1)! There are (cid:0)L 2 ways to order them into a cycle, and 2a ways to align their vertex-copies. This yields a pairs {y1, z1}, . . . ,{ya, za} of vertex copies, each of which must land in a hyperedge. We process these pairs one-at-a-time, halting if we ever find that the pair does not land in a hyperedge. To process pair i, we ask only whether zi lands in the same hyperedge as yi; if it does we do not expose the other vertex-copies in that hyperedge. Thus, prior to processing pair i, we have exposed exactly 2i − 2 vertex-copies, all of degree 2. There are k − 1 other copies appearing in the same hyperedge as yi. Each of the Λ − (2i − 1) unexposed copies (not including yi) is equally likely to be one of those copies (and, for k ≥ 3, the exposed copies also have positive probability). So the probability that zi is one of them is at most (k − 1)/(Λ − 2i + 1). So the expected number of core flippable cycles of length a is at most: (cid:18)L a(cid:19) (a − 1)! 2 2a a Yi=1 k − 1 Λ − 2i + 1 2(k − 1)(L − i + 1) . Λ − 2i + 1 < 1 2a a Yi=1 2a (1 − 1 By condition (iii) above, 2(k− 1)L/(Λ− 1) < 1− 1 i, since L ≤ 1 vertices on core flippable cycles is at most 1 2 (Λ − 1). So the expected number is at most 1 2Pa≥1(1 − 1 2 ζ, and so 2(k− 1)(L− i + 1)/(Λ− 2i + 1) < 1− 1 2 ζ for each 2 ζ)a, and so the expected total number of 2 ζ)a = O(1). This establishes part (a). We now prove part (b) by using a first moment calculation. We start by showing that if two core flippable cycles have a common vertex, then their union must contain a simple structure: a flippable cycle plus a path. The proof will then follow since w.h.p. any such structure in a sparse random hypergraph must be larger than what is permitted by part (a). Intuitively, this is straightforward, but the details are tedious. Recall that for every flippable cycle C of a hypergraph H, every vertex of C has degree two in H and every edge of H contains either zero or exactly two vertices of C. Let S = x1, x2, . . . , xa be a core flippable cycle and let S′ 6= S be any other core flippable cycle that contains x1, where without loss of generality we assume S′ ≤ S. Let e1 be the edge incident to S that contains x1, x2 and let ea be the edge incident to S that contains x1, xa. Since e1, ea are the only two edges incident to x1, they must be among the edges incident to S′. Let y2 6= x1 be the other vertex of S′ in e1. If y2 = x2, let e2 be the edge containing x2, x3 and let y3 6= y2 be the other vertex of S′ in e2. If y3 = x3, let e3 be the edge containing x3, etc. until we first reach an edge ej containing xj , xj+1 such that yj+1 6= xj+1. Let e′j+1 be the edge containing yj+1, yj+2. Now, let e′j+2 be the edge containing yj+2, yj+3, let e′j+3 be the edge containing yj+3, yj+4 etc., until we first reach an edge e′j+1+q containing a vertex lying in a hyperedge incident to S (this must occur for some q ≥ 0 since ea is incident to S′). Thus, we have a path yj+1, . . . , yj+1+q+1 where yj+1 and yj+1+q+1 lie in hyperedges incident to S, while all other q vertices yj+2, . . . , yj+1+q do not lie in hyperedges incident to S. In the following, to lighten notation, we let j + 1 = ℓ and j + 1 + q + 1 = ℓ∗, i.e., yℓ and yℓ∗ are the vertices in the path lying in hyperedges incident to S. Now we bound the expected number of occurences of such a cycle S of size a plus a path yℓ, ..., yℓ∗, in H = Hk(n, p). Since S = a there are at most a2 choices for the value of ℓ and the value of z such that xz−1, xz, yℓ share a hyperedge. Since S′ ≤ S there are at most a choices for the value of ℓ∗. Setting b = ℓ∗−ℓ+1 to be the number of vertices in the path, the number of choices for x1, ..., xa, yℓ, ..., yℓ∗ is at most na+b. The probability that xℓ−1, xℓ, yℓ share a hyperedge in H is at most (cid:0) n k−3(cid:1) c nk−1 , and the same is true for xz−1, xz, yℓ∗ . For each i 6= ℓ, z, the probability that xi−1, xi share a hyperedge is at most(cid:0) n nk−1 . For each i = ℓ, ..., ℓ∗ − 1, the probability that yi, yi+1 share a hyperedge is at most (cid:0) n nk−1 . So the expected k−2(cid:1) c k−2(cid:1) c 15 number of such subgraphs is at most: a3na+b(cid:18)(cid:18) n k − 3(cid:19) c nk−1(cid:19)2(cid:18)(cid:18) n k − 2(cid:19) c nk−1(cid:19)a+b−3 < a3ca+b−1 n = o(1), for a + b ≤ 1 a + b > 1 core flippable cycle of size at least 1 2 log n then S = a > 1 2 log n. Thus w.h.p. there is no such subgraph with a + b ≤ 1 2 log n. Since S ≥ S′, if 4 log n. But part (a) and Markov's Inequality imply that w.h.p. there is no 4 log n. This proves (b). Remark: By carrying out the first moment calculation more carefully, as in part (a), one obtains that the sum over all a, b of the expected number of occurrences of a core flippable cycle S plus a path yℓ, ..., yℓ∗ as described is, in fact, O(n−1). 7 Proof of Theorem 5 above the r-core threshold Recall that we can assume k + r > 4. We let H = Hk(n, p) be a random k-uniform hypergraph with p = c/nk−1. Let H = H0, H1, . . . be the sequence of hypergraphs produced by the parallel r-stripping process. We will choose a terminal r-stripping sequence that is consistent with the parallel process; i.e., in our stripping sequence: for every i < j, the vertices deleted in round i of the parallel process come before the vertices deleted in round j of the parallel process. Let D be the digraph associated with this terminal r-stripping sequence and recall that R+(u) denotes the set of vertices reachable from a vertex u in D. 7.1 Bound on the length of stripping sequences Our main challenge is to prove the following lemma. The idea is that we will take B large enough so that by stripping down to HB, Proposition 31 gives us control of the degree sequence that remains, and Lemma 32 allows us to prove that a certain branching process involving long paths in a graph constructed from HB dies out. Lemma 36. For every c > c∗k,r there exists B = B(c, k, r) and Q = Q(c, k, r) such that w.h.p. for every vertex u, R+(u) ∩ HB ≤ Q log n. Proof of Theorem 5(a). Consider any vertex u. If u /∈ HB, then by Proposition 33, R+(u) ⊆ N B(u) in which case Lemma 34 immediately implies that R+(u) < Γ(1 + log n) for some constant Γ = Γ(c, B). If u ∈ HB, then R+(u) ⊆ N B(R+(u) ∩ HB), by Proposition 33. Since, by Lemma 36, R+(u) ∩ HB ≤ Q log n, Lemma 34 now implies that R+(u) < Γ(Q log n + log n) = Z log n for Z = ΓQ + 1 = Z(c, B) = Z(c, k, r). Definition 37. For any i, we define Di to be the subdigraph of D induced by the vertices in Hi. Consider a particular constant i. Let T + be a directed tree in Di with edges directed away from a root u that spans the vertices of R+(u) ∩ Hi; e.g., T + could be a Breadth First Search or Depth First Search tree from u. Thus, each vertex has indegree at most 1 in T +, implying: Proposition 38. No two arcs of T + were formed during the removal of the same hyperedge. Definition 39. A deletion tree rooted at u is the undirected tree, T , formed by removing the directions from a tree T + rooted at u. To prove Lemma 36, we will bound the expected number of deletion trees T of size greater than Q log n. The following technical lemma bounds the density of small subgraphs of Hk(n, p). It is of a standard flavour and has a standard proof. Given a subset S of the vertices of Hk(n, p), we let ℓj(S) denote the number of hyperedges that contain exactly j of the vertices of S, and we let L(S) =Pk j=2(j − 1)ℓj. 16 k Xj=2 (j − 1)ℓj ≥ (1 + ζ)a  . (ℓ2, . . . , ℓk) : k La =  Yj=2(cid:18)m ℓj(cid:19)(cid:20)(cid:18)k n(cid:17)Pk X(ℓ2,...,ℓk)∈La(cid:16) a  n(cid:17)(1+ζ)a k Xℓj≥0 Yj=2 k ℓj! (Ja)ℓj j=2(j−1)ℓj n(cid:17)j(cid:21)ℓj j(cid:19)(cid:16) a Yj=2 ℓj!   E(Ya) ≤ (cid:18)n a(cid:19) X(ℓ2,...,ℓk)∈La a (cid:17)a < (cid:16) en a (cid:17)a(cid:16) a < (cid:16) en n(cid:17)ζa < ea(cid:16) a n (cid:19)ζa = (cid:18) ∆a 2∆ , it is standard and straightforward to show E(cid:16)Pθn e(k−1)Ja (Ja)ℓj , for some constant ∆ = ∆(c, k, ζ) > 0 . Choosing θ = 1 a=1 Ya(cid:17) = o(1). , for some constant J = J(c, k) > 0 Lemma 40. For every c, ζ > 0, there is θ > 0, such that w.h.p. every S ⊆ Hk(n, p = c/nk−1) with S ≤ θn has L(S) < (1 + ζ)S. Proof. Rather than working in the Hk(n, p) model, it will be convenient to work in the Hk(n, m) model, where exactly m = (c/k!)n edges are selected uniformly, independently and with replacement (note that m = p(cid:0)n k(cid:1)). Let Ya = Ya(ζ) denote the number of sets S with S = a and L(S) = (1 + ζ)S. We will bound E(Ya) Standard arguments imply that high probability properties in this model transfer to the Hk(n, p) model. as follows. Define Choose a vertices and some (ℓ2, . . . , ℓk) ∈ La, pick ℓj edges for each j, and then multiply by the probability that each edge chooses (at least) the appropriate number of vertices from S. This yields In order to carry out our first moment calculation, we will bound the difference between the degrees of the vertices of T and their degrees in Hi. Lemma 41. For any δ > 0, if i is sufficiently large in terms of δ then w.h.p.: For every vertex u ∈ Di, if T is a deletion tree rooted at u, then degHi (v) ≤ degT (v) + r − 2 for all but at most δT + 3 vertices v ∈ T . Proof. Define S to be the hypergraph with edge set {e ∩ R+(u) : e ∈ Hi,e ∩ R+(u) ≥ 2}. In other words, for each hyperedge e ∈ Hi that contains at least two vertices of R+(u), S contains the edge obtained by removing all vertices outside of R+(u) from e. Since V (T ) = R+(u) ∩ Hi, the r-stripping sequence that yields D contains an r-stripping subsequence which removes from Hi only vertices of T , such that all vertices of T except possibly u are removed. Consider v ∈ T, v 6= u. At the point that v is removed, it has degree at most r − 1 in what remains of Hi. Every other hyperedge of Hi containing v is removed before v, and thus must contain another member of R+(u). At least one of those r − 1 hyperedges contains another vertex of R+(u), namely the parent of v in T . Therefore: degHi (v) ≤ degS(v) + r − 2. For 2 ≤ j ≤ k, let ℓj denote the number of hyperedges with j vertices in S. All vertices of S, except possibly u, are not in the r-core. So, by Lemma 31(a), we know that for any θ > 0 we can select i sufficiently large in terms of θ so that S < θn. If we pick θ sufficiently small in terms of δ, then Lemma 40 implies that w.h.p., Pk j=2(j − 1)ℓj < (1 + δ/2)S. So k k degS(v) = Xv∈R+(u) jℓj ≤ 2 Xj=2 Xj=2 (j − 1)ℓj < (2 + δ)S = (2 + δ)T. 17 Now the total T -degree of the vertices in R+(u) is 2T − 2, since T is a tree with edges of size 2 that spans R+(u). So for i sufficiently large in terms of δ, Xv∈R+(u) degS(v) − degT (v) ≤ (2 + δ)T − (2T − 2) = δT + 2. So degT (v) 6= degS(v) for at most δT + 2 vertices v ∈ R+(u). Also, degHi (v) ≤ degS(v) + r − 2 for all but at most one v ∈ R+(u) (namely v = u). This proves the lemma. Proof of Lemma 36. We will fix a constant δ > 0 that is sufficiently small for various bounds to hold. We also take B sufficiently large for various bounds to hold, including Lemma 41 for i ≥ B. Let Xa = Xa(B) be the number of deletion trees T in DB with a vertices. Our goal is to show that there exists some constant Q > 0 such that w.h.p. Xa = 0 for a > Q log n, so in the following we may allow ourselves to assume that a is greater than some sufficiently large constant. To prove Lemma 36 we first observe that, by Proposition 31, we can assume HB is uniformly random conditional on its degree sequence. Since Lemma 36 asserts a property to hold with high probability, it suffices to establish this property in the configuration model for HB (by Corollary 23(a)). Moreover, recall that by Proposition 31(b), as B is increased w.h.p. the degree sequence of HB tends to that of the r-core. Let v1, . . . , va be the vertices of T . We first specify di = degT (vi) for each i, noting that these degrees must sum to 2a − 2. The number of ways to arrange these a vertices into a tree with a specified degree sequence is (a− 2)!/Q(di − 1)! and there are a choices for the root, u, of the tree. So, the number of choices for this step is: Next we choose the vertices of T . Then for each edge of T , we choose a vertex-copy of each of its endpoints. To do so, for each vi, we choose a copy of vi for each of the di edges in T incident with vi. If degHB (vi) = j, then there are j!/(j − di)! choices for the di copies of vi. Since degHB (vi) ≥ di, the number of choices corresponding to vi is at most Pw:degHB degHB (w)!/(degHB (w) − di)!. By Lemma 28, this number is at most (Y (di) + 1 2 δ)n where (w)≥di . a(a − 2)! Q(di − 1)! Y (d) = YB(d) =Xj≥d j! (j − d)! ρj(B) . Furthermore, if di ≤ degHB (v) ≤ di + r − 2, then we can use Y ′(di) rather than Y (di) where Y ′(d) = Y ′B(d) = d+r−2 Xj=d j! (j − d)! ρj(B) . Using Y ′(di) instead of Y (di) will be particularly useful when di ≤ 2. By Lemma 41, for any δ > 0 we can take B = B(δ) > 0 sufficiently large, so that we must use Y (di) for at most δa + 3 vertices vi. For convenience, we will assume a > 3/δ so we can take δa + 3 ≤ 2δa. We will upper bound E(Xa) by using Y (di) for every vertex vi with di ≥ 3 and for exactly 2δa vertices of degree d ≤ 2. Let t1, t2, t3 denote the number of vertices vi for which di = 1, di = 2, di ≥ 3, respectively. We note that for sufficiently large d, Y (d) is decreasing and so there is a constant d∗ such that for all d ≥ 3, Y (d) ≤ Y (d∗). So, if we were to use Y ′(d) for every vertex of degree d ≤ 2 then the overall contribution of the Y, Y ′ terms would be at most: [(Y ′(1) + 1 2 δ)n]t1 · [(Y ′(2) + 1 2 δ)n]t2 · [(Y (d∗) + 1 2 δ)n]t3 . We correct for the 2δa vertices of degree d ≤ 2 for which we use Y (d). To do so, we multiply by the (cid:0)t1+t2 2δa (cid:1) ≤(cid:0) a 2δa(cid:1) choices for those vertices, and we multiply by Υ2δa where, for δ sufficiently small, Υ = max(cid:18) Y (1) + 1 2 δ Y ′(1) + 1 2 δ , Y (2) + 1 2 δ Y ′(2) + 1 2 δ(cid:19) = O(1) . 18 This brings the overall contribution of the Y, Y ′ terms to at most: (cid:18) a 2δa(cid:19)Υ2δa[(Y (1) + 1 2 δ)n]t1 [(Y (2) + 1 2 δ)n]t2 [(Y (d∗) + 1 2 δ)n]t3 . Having chosen d1, . . . , da and the vertices v1, . . . , va, we divide by the number of rearrangements of those vertices; i.e. we multiply by 1 a! . Finally, we multiply by the probability that each of the a − 1 pairs of vertex-copies corresponding to edges of T , lands in a hyperedge of the configuration. By Proposition 38, no two such pairs lie in the same hyperedge of HB. So, we can apply Lemma 24 to the a − 1 specified pairs of vertex-copies and multiply by kE (cid:19)a−1 (cid:18) k − 1 eka2/(E−a) to get an overall bound, where E is the number of edges in HB. Recall that for c > c∗k,r, µ = µ(c) denotes the larger of the two solutions of f (λ) = c. By Proposition 31 and Lemma 27 for any δ > 0, we can take B sufficiently large so that Our key Lemma 32 now yields that by taking B sufficiently large, we can have δ sufficiently small in terms of ζ that various bounds below hold, including e−µµj j! ≤ δn . n(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) kE − µ Xj≥r−1 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:18) e−µµr (r − 2)! + δ(cid:19) k − 1 kE/n < 1 − ζ 2 . (4) By Lemma 31, for any δ > 0, we can take B sufficiently large so that Y ′(1) ≤ δ/2 and Y ′(2) ≤ e−µµr (r−2)! +δ/2. So, Y ′(1) + 1 2 δ, Y ′(2) + 1 2 δ are bounded above by δ and e−µµr (r−2)! + δ, respectively. We let Ψ = 2Y (d∗) > Y (d∗) + 1 2 δ , for δ sufficiently small. Putting all this together, and recalling that t1 + t2 + t3 = a, yields E(Xa) ≤ (cid:18) a 2δa(cid:19)Υ2δa(cid:18) k − 1 eka2/(E−a) kE (cid:19)a−1 × Xd1+···+da=2a−2 ≤ O(n/a)eka2/(E−a)(cid:18) (δn)t1(cid:20)(cid:18) e−µµr (r − 2)! + δ(cid:19) n(cid:21)t2 (2δ)2δ(1 − 2δ)1−2δ(cid:19)a(cid:18) k − 1 kE/n(cid:19)a Υ2δ (Ψn)t3 a(a − 2)! a!Qa i=1(di − 1)! δt1(cid:18) e−µµr Xd1+···+da=2a−2 (r − 2)! (5) + δ(cid:19)t2 Ψt3 . Note that in the last line, we dropped the Qa 1 for di = 1 or 2, which are the most sensitive values. For δ sufficiently small in terms of ζ, i=1(di − 1)! term. We can afford to do so, since this is equal to Υ2δ (2δ)2δ(1 − 2δ)1−2δ < 1 + ζ 10 . 19 Since we are dealing with the degree sequence of a tree, we have t1 < √δ t3, yielding: √δ t1 > t3. Since δ < 1, we have E(Xa) < O(n/a)eka2/(E−a)(cid:18)1 + × Xd1+···+da=2a−2(cid:18)√δ ζ 10(cid:19)a kE/n(cid:19)t1(cid:18)(cid:20) e−µµr k − 1 (r − 2)! + δ(cid:21) k − 1 kE/n(cid:19)t2(cid:18)√δΨ kE/n(cid:19)t3 k − 1 . Recalling that E/n = Ω(1) and Ψ = O(1), we choose δ sufficiently small in terms of ζ so that √δ k − 1 kE/n , √δΨ k − 1 kE/n < ζ 100 . This and (4) yield . ζ 10(cid:19)a 100(cid:19)a−t2 Xd1+···+da=2a−2(cid:18)1 − E(Xa) ≤ O(n/a)eka2/(E−a)(cid:18)1 + 2(cid:19)t2(cid:18) ζ Now we fix t2 and count the number of choices for d1, . . . , da. There are (cid:0) a t2(cid:1) choices for the values of i with di = 2. The remaining a − t2 degrees sum to 2a − 2 − 2t2. The number of choices for sequences of y non-negative integers that sum to z is (cid:0)y+z−1 y−1 (cid:1), so the number of choices for these degrees is bounded by (cid:0)2(a−t2)−3 a−t2−1 (cid:1) < 22(a−t2)−3 < 4a−t2. Thus, E(Xa) ≤ O(n/a)eka2/(E−a)(cid:18)1 + = O(n/a)eka2/(E−a)(cid:18)1 + < O(n/a)eka2/(E−a)(cid:18)1 − < O(n/a)(cid:18)1 − 10(cid:19)a a Xt2=0(cid:18) a 10(cid:19)a(cid:18)1 − 4(cid:19)a 2(cid:19)t2(cid:18) ζ 100(cid:19)a−t2 t2(cid:19)4a−t2(cid:18)1 − ζ 16(cid:19)a ζ 25(cid:19)a ζ 2 + ζ ζ ζ (6) ζ ζ , where the last inequality holds for all a small enough that eka/(E−a) < 1 + ζ 4 . Thus, there are constants a=Q log n Xa) = o(1) and, therefore, w.h.p. there are no deletion trees of size between Q log n and ξn. Note now that Q, ξ depend only on ζ, c, k, r and ζ depends only on c, k, r. Q, ξ > 0 such that E(Pξn Using Proposition 31(a), we chose B large enough that w.h.p. HB contains fewer than ξn vertices outside of the r-core. Since a deletion tree can have at most one vertex in the r-core, this implies that there are no deletion trees of size at least ξn. Therefore, w.h.p. there are no deletion trees in HB of size greater than Q log n. Therefore, w.h.p. for all u ∈ DB, R+(u) ∩ HB ≤ Q log n. (cid:3) 7.2 Summing over a core flippable cycle for r = 2 Recall that for Theorem 5(b), we have r = 2; i.e., we consider 2-cores for random k-uniform hypergraphs where k ≥ 3. uj to uj+1 for each j (addition mod ℓ). Thus, R+(u1) = ∪ℓ proof of part (a) for this setting. Consider any core flippable cycle C with vertices u1, . . . , uℓ. In our directed graph D, add edges from j=1R+(uj). We modify the arguments from the We define T as in the previous section, this time rooted at u1. 20 We follow the proof of Lemma 41. Since u1, . . . , uℓ are the only 2-core vertices in S, we still have S ≤ θn. Since each ui has degree 2 in the 2-core, it is easy to see that degHB (ui) = degS(ui) + 1. The proof of Lemma 41 still holds, yielding degHB (v) ≤ degT (v) + 1 , for all but at most δT + 3 vertices v ∈ T. (In fact, this time we actually get δT + 2, but that is inconsequential.) As in Section 7.1, we bound the expected number of such trees of size a; u1 is the root and hence plays the role of u from Section 7.1. This time, T has the additional property that there is an edge in D from a vertex of T (i.e. uℓ) to u1. To account for this additional property, we adjust (5) as follows: (i) multiply by the number of choices of one of the a − 1 other vertices to be uℓ; (ii) choose vertex-copies for the extra edge eka2/(E−a) which, by Lemma 24, bounded the probability that from uℓ to u1; (iii) adjust the term (cid:0) k−1 the a− 1 pairs of vertex-copies corresponding to edges of T each landed in a hyperedge of the configuration. For (ii), we use Y (d(uj) + 1) instead of Y (d(uj )) or Y ′(d(uj)) for j = 1, ℓ. For j = 1, ℓ, the adjustment for uj is an increase of a multiplicative factor of at most (Y (d(uj) + 1) + 1 2 δ) < (Y (d∗) + 1 2 δ)/(Y ′(1) + 1 2 δ) = O(1). So the overall effect for (ii) is a multiplicative O(1). 2 δ)/(Y ′(deg(uj)) + 1 kE (cid:1)a−1 This results in another multiplicative factor of k−1 For (iii), the hyperedge containing u1, uℓ is in the 2-core and so is distinct from the other a−1 hyperedges. 16(cid:17)a The net result is to multipy E(Xa) by O(a/n), and so the bound on E(Xa) in (6) becomes O(1)(cid:16)1 − ζ Summing over all a yields that the expected number of core flippable cycles C such that Su∈C R+(u)∩HB > ξ(n) is o(1) for any ξ(n) → ∞, in particular for ξ(n) = O(log n). Proposition 33 and Lemma 34 yield Theorem 5(b). kE to account for that edge, when applying Lemma 24. . (cid:3) 8 Proof of Theorem 5 below the r-core threshold Recall that Theorem 5 is already known for r = k = 2, so we will assume r + k > 4. As in the case for c > c∗k,r, we will carry out a large but fixed number, I, of rounds of the parallel r-stripping process, ending up with a hypergraph HI . Because we are below the r-core threshold, this will delete all but a very small, albeit linear, number of vertices. Proposition 25 asserts that the remaining hypergraph is uniformly random conditional on its degree sequence. We will determine this degree sequence and apply the technique from [22] to show that the maximum component size in the remaining hypergraph has size O(log n). Thus, for every v, we must have R+(v)∩ HI = O(log n). Proposition 33 and Lemma 34 then imply that R+(v) = O(log n) as required. Let Po(µ) denote a Poisson variable with mean µ. Recursively define the following quantities: φ0 = 1 λt = cφk−1 φt = Pr[Po(λt−1) ≥ r − 1] . /(k − 1)! t Write P (µ, j) = Pr[Po(µ) = j]. Lemma 42. For any constants d, t, the number of vertices of degree d after t rounds of the parallel r-stripping process, w.h.p. is ρt(d)n + o(n) , where ρt(d) =  P (λt, d) for d ≥ r, P (λt, d) · Pr [Po(λt−1 − λt) ≥ r − d] for d < r. Proof. We consider a branching process introduced in [25] and analyze it as in [21]. Consider any hypergraph H and any vertex v ∈ H. For each 0 ≤ i ≤ t + 1, let Li(v) be the vertices of distance at most i from v (thus L0(v) = {v}). For any u ∈ Li(v) with 0 ≤ i ≤ t, a child edge of u is an edge containing u and k − 1 members 21 of Li+1(v); thus if the distance t + 1 neighbourhood of v induces a hypertree, then all but at most one of the edges containing u are child edges of u. We define the process STRIP(v, t) as follows: For j from t down to 1 do Remove all vertices in Lj(v) with fewer than r − 1 child edges; Remove all edges that contain a removed vertex. Let Xt denote the number of child edges of v that survive STRIP(v, t), and let Yt denote the number of child edges of v that survive STRIP(v, t − 1) but not STRIP(v, t). If the hypergraph induced by the vertices in Lt+1(v) induces a hypertree, then we see that (A) For d ≥ r: v survives the first t rounds of the parallel r-stripping process, and has degree d in what remains iff Xt = d. (B) For 1 ≤ d < r: v survives the first t rounds of the parallel r-stripping process, and has degree d in what remains iff Xt = d and Yt ≥ r − d. To analyze STRIP(v, t) on H = Hk(n, p = c/nk−1), we make use of the fact that w.h.p. the distance t + 1 neighbourhood of v induces a hypertree, and so both (A) and (B) hold. c nk−1(cid:0)n−O(1) We will argue by induction on t that the probability a particular child u of v survives STRIP(v, t) is φt + o(1). Suppose u ∈ L1(v) and w ∈ L2(v) is in a child edge of u. Note that w survives STRIP(v, t) iff w survives STRIP(u, t−1) the probability of which, by induction on t, is easily seen to be φt−1 +o(1). It follows k−1 (cid:1)(φt−1 + o(1))k−1 = that the expected number of child edges of u that survive STRIP(v, t) is λt−1 +o(1). Standard arguments show that for any fixed i the probability that the number of such edges is i is P (λt−1, i) + o(1) (we elaborate more below on similar arguments for Xt, Yt). Therefore, the probability that u survives STRIP(v, t) is φt +o(1), thus completing the induction. By the same argument, E(Xt) = λt +o(1). Noting that Yt = Xt−1 − Xt, this yields E(Yt) = λt−1 − λt + o(1). Consider any child edge e of v in Lt+1(v). Whether e counts towards Xt, Yt or neither is determined entirely by the subtrees of Lt+1(v) rooted at the vertices of e other than v. In other words, Xt, Yt are determined by the edges containing v in Hk(n, p = c/nk−1), and some local information about each edge where the information for any two edges is w.h.p. disjoint. Also, no edge counts towards both Xt and Yt. From this, it is straightforward to show, using e.g., the Method of Moments, (see [14]) that the joint distribution of Xt, Yt is asymptotic to independent Poisson variables; specifically, for any fixed integers x, y, Pr(Xt = x ∧ Yt = y) is o(1) plus the probability that two independent Poisson variables with means E(Xt), E(Yt) are equal to x, y. (A) and (B) now yield that the probability that v survives the first t rounds of the parallel stripping process and has degree d in Ht is ρt(d) + o(1), and so the expected number of such vertices is ρt(d)n + o(n). The lemma now follows as in [21] from a straightforward concentration argument, e.g., a second moment calculation. We omit the details. The main result of [22] states: Consider a random graph on a fixed degree sequence where Λ(d)· n + o(n) vertices have degree d, and where the degree sequence satisfies certain well-behaved conditions. If d(2 − d)Λ(d) > 0 , Xd≥1 (7) and then w.h.p. all connected components have size O(log n). A simple adaptation of the proof in [22] provides a generalization to hypergraphs. Specifically, for k > 2 it suffices to replace d(2 − d) in (7) with fk(d) = d[1 − (d − 1)(k − 1)] . Proposition 25 allows us to model Ht as a random hypergraph on degree sequence ρ0(t), ρ1(t), .... Using Lemma 28, it is straightforward to verify that this degree sequence satisfies the well-behaved conditions from [22], and so deduce that if ρt(d)fk(d) > 0 , Xd≥1 22 (8) then w.h.p. all components of Ht have size O(log n). Since Pr[Po(λ) ≥ r − 1] is a strictly increasing function of λ, the sequences φt, λt are strictly decreasing. If they do not tend to zero, then there must be a positive fixed point to the recursion defining them, i.e., a positive solution to Rearranging yields λ = c Pr[Po(λ) ≥ r − 1]k−1/(k − 1)! . c = (k − 1)!λ/ Pr[Po(λ) ≥ r − 1]k−1 . Recall now that c∗k,r was defined in (1) as the smallest value of c for which there is such a solution. Since c < c∗k,r, we can conclude that φt, λt → 0 as t → ∞ and we can develop the following asymptotics in t, using Ot() and Θt() to denote asymptotics are with respect to t: λt = c (k − 1)! φk−1 t = c (k − 1)! (Pr[Po(λt−1) ≥ r − 1])k−1 = Θt(λ(k−1)(r−1) t−1 ) . (9) Let λ := λt and θ := λt−1 − λt. Since (k − 1)(r − 1) ≥ 2 for k + r > 4, we see that (9) implies λ = ot(θ). We apply Lemma 42, noting that as θ → 0, Pr[Po(θ) ≥ r − d] → P (θ, r − d). Therefore, as t → ∞, inequality (8) is equivalent to (1 + ot(1)) r−1 Xd=1 P (λ, d)P (θ, r − d)fk(d) + ∞ Xd=r P (λ, d)fk(d) > 0 . (10) Note that fk(1) = 1 and fk(d) ≤ 0 for d ≥ 2. So the first sum in (10) is at least P (λ, 1)P (θ, r − 1) − r−1 Xd=2 P (λ, d)P (θ, r − d)fk(d) . (11) For 1 ≤ d ≤ r − 1, we have fk(d) = Ot(1), so the first term in (11) is Θt(λθr−1) while the sum in (11) is Θt(Pr−1 d=2 λdθr−d) = Θt(λ2θr−2), since λ = ot(θ). Therefore, the first sum in (10) is positive and of order Θt(λθr−1). At the same time, since −fk(d) = kd2 − d2 − kd < kd2 we get − ∞ Xd=r P (λ, d)fk(d) ≤ k ∞ Xd=r P (λ, d)d2 = Ot(λr) , as λ → 0 . Thus, the first sum in (10) is positive Θt(λθr−1), whereas the second sum is Ot(λr). Since λ = ot(θ) it follows that (8) holds for t sufficiently large and, therefore, for I sufficiently large, every component of HI has size O(log n). Theorem 5(b) now follows from Proposition 33 and Lemma 34. (cid:3) 9 Proof of Theorem 2 Given a solution, recall that a set S of variables is flippable if changing the assignment of every variable in S results in another solution. Note that flippable sets can be characterized in terms of the underlying hypergraph. Proposition 43. S is flippable iff every hyperedge contains an even number of members of S. So we define: Definition 44. A flippable set in a hypergraph, H, is a nonempty set of vertices, S, such that every edge in H contains an even number of vertices of S. 23 Recalling Definition 4, we see that a flippable cycle is a flippable set. A flippable set is minimal if it does not contain a flippable proper subset. Note that every flippable set contains a minimal flippable subset. Lemma 45. Let H be a random k-uniform hypergraph Hk(n, p), where p = c/nk−1. For every c > c∗k,2 there exists α > 0 such that w.h.p. every minimal flippable set in the hypergraph induced by the 2-core of H either is a core flippable cycle or has size at least αn. Lemma 45 follows immediately from Lemma 51 below, and yields Theorem 2 as follows: Proof of Theorem 2. Consider any two solutions σ1, σ2 in different clusters. Let S be the variables in the 2-core on which these solutions disagree. Thus, S is a flippable set in the hypergraph induced by the 2-core. Remove all core flippable cycles from S, and let S′ be what remains (recall from Definition 4 that a flippable cycle is a set of vertices). Lemma 35(b) implies that w.h.p. every 2-core hyperedge contains an even number of vertices that lie in core flippable cycles. Therefore S′ must also be a flippable set in the hypergraph induced by the 2-core. By the definition of clusters, S′ 6= ∅ as otherwise σ1, σ2 would be cycle-equivalent. Let S′′ be a mimimal flippable subset of S′. Since S′′ contains no core flippable cycles, Lemma 45 implies that w.h.p. S′′ ≥ αn. Therefore S ≥ αn and so σ1, σ2 differ on at least αn variables. Any sequence σ, σ′, . . . , τ where σ, τ are in different clusters must contain two consecutive solutions that are in different clusters. As argued above, those two solutions differ on at least αn variables. It follows that if σ, τ are in different clusters then σ, t are not αn-connected. If we could show (deterministically) that the hypergraph induced by any minimal flippable set in a 2-core that is not a core flippable cycle is sufficiently dense, then Lemma 45 would follow by a rather standard argument. Unfortunately, there is no useful lower bound on the density, mainly because of the possibility of very long 2-linked paths in S (defined below). Instead, we follow an approach akin to that of [23], forming a graph Γ(S) by contracting those long paths, and making use of the fact that Γ(S) is dense (Lemma 50). The main difference from [23] is that here we need to work in the configuration model. To prove Lemma 45, we first require a few definitions. Note that these concern any hypergraph, not just a 2-core of a random hypergraph. A hyperedge is simple if it is not a loop, i.e., if it does not contain any vertex more than once. Definition 46. Let H be a k-uniform hypergraph. A 2-linked path P of a set S ⊆ V (H) is a set of vertices v0, . . . , vt ∈ S and simple hyperedges e1, . . . , et, where t ≥ 1, such that (i) v0, . . . , vt are all distinct except that when t ≥ 2 we allow v0 = vt. (Note that if v0 = vt then these vertices actually form a cycle and so 2-linked path is somewhat of a misnomer.) (ii) Each ei contains vi−1, vi and no other vertices of S. (iii) v1, . . . , vt−1 all have degree 2 in H; i.e. they do not lie in any edges outside of P . (iv) If v0 = vt then degH(v0) > 2. If v0 6= vt then S is maximal w.r.t. (ii) and (iii); i.e. each of v0, vt either has degree 6= 2 in H, or lies in a hyperedge e /∈ P with e ∩ S 6= 2. We call v0, vt the endpoints of the path and v1, . . . , vt−1 its connecting vertices. Note that if v0 = vt then by (iv), degH(v0) > 2 and hence v0, . . . , vt do not form a flippable cycle. Figure 1: 2-linked paths with t = 3. On the left v0 6= v3, while on the right v0 = v3. Vertices in S are marked with a square. Definition 47. We say that S ⊆ V (H) is a linked set if (i) S does not contain a flippable cycle as a subset, (ii) no hyperedge of H contains exactly one element of S and (iii) every hyperedge e of H with e ∩ S = 2 is in a 2-linked path of S. 24 Proposition 48. Suppose S is a flippable set in a hypergraph where all hyperedges are simple, and S does not contain a flippable cycle as a subset. Then S is a linked set. Proof. By Proposition 43, we only need to check condition (iii) of Definition 47. Consider any hyperedge e with e ∩ S = 2. Since e is simple, either e itself forms a 2-linked path in S, or it is easily seen that e can be extended into such a path, unless e lies in a flippable cycle. Remark: It is easy to see that in any Uniquely Extendible CSP, the set of disagreeing variables of any two solutions must be a flippable set. Since Proposition 48 was derived by only considering the underlying hypergraph (and not the specific constraints), it applies to any UE CSP. Therefore, our Theorem 2 extends readily to every UE CSP since its proof amounts to proving that for some constant α > 0, all linked sets are either flippable cycles or contain at least αn variables. Given a linked set, S, we consider the mixed hypergraph (containing both hyperedges and normal edges) Γ(S) formed as follows: (a) The vertices of Γ(S) are the endpoints of the 2-linked paths in S along with all vertices of S that do not lie in any 2-linked paths. (b) There is an edge in Γ(S) between the endpoints of each 2-linked path in S. That edge is a loop if the two endpoints are the same vertex, and so Γ(S) is not necessarily simple. (c) For every hyperedge e of H with e ∩ S > 2, e ∩ S is a hyperedge of Γ(S). Thus V (Γ(S)) ⊆ S, and since no hyperedge of C contains exactly one element of S, for every v ∈ V (Γ(S)) we have degΓ(S)(v) = degH(v). Any vertex of S that is not in Γ(S) is a connecting vertex of a 2-linked path in S. Proposition 49. If S is a non-empty linked set, then 1 ≤ Γ(S) ≤ S. Proof. Any vertex of S that is not in Γ(S) is a connecting vertex of a 2-linked path in S. The endpoints of that 2-linked path are in Γ(S). Thus Γ(S) ≥ 1. The rest follows from the fact that every vertex of Γ(S) is a vertex of S. number of i-edges in Γ(S). Note that Γ(S) contains hyperedges of size between 2 and k. For each 2 ≤ i ≤ k, we define ℓi to be the Lemma 50. If every vertex in H has degree at least 2 then Pk Proof. As we said above, every v ∈ V (Γ(S)) has the same degree in Γ(S) as it does in H. Thus Γ(S) has minimum degree at least 2. Consider any v of degree 2 in Γ(S). Then v has degree 2 in H and hence cannot be the endpoint of a 2-linked path in S, unless v lies in at least one hyperedge of H containing more than 2 members of S. It follows that v lies in at least one hyperedge of Γ(S) of size greater than 2. Therefore, at most Pk i=3 ℓi vertices of Γ(S) have degree 2, and so letting Z denote the number of vertices i=3 iℓi < kPk i=2(i − 1)ℓi ≥ (1 + 1 with degree at least 3 in Γ(S), we have 2k )V (Γ(S)). By the handshaking lemma, Pk k k Xi=3 V (Γ(S)) ≤ Z + k ℓi ≤ k Z + Xi=3 i=2 iℓi =Pv degΓ(S)(v). Therefore, ℓi! . 25 k Xi=2 (i − 1)ℓi = degΓ(S)(v) + (i/2 − 1)ℓi k 1 2 ℓi Xi=3 since degΓ(S)(v) ≥ 2 for all v k Xi=2 Xi=3 1 2 k 1 1 ≥ 2Xv 2Xv = Xv 1 +Xv ≥ V (Γ(S)) + ≥ (cid:18)1 + 1 2 degΓ(S)(v) + ℓi (degΓ(S)(v) − 2) + ℓi , k 1 2 1 2 Z + Xi=3 2k(cid:19)V (Γ(S)) . 1 Let C be the 2-core of H = Hk(n, p). We will apply Lemma 50 with H = C to prove: Lemma 51. There exists α > 0 such that w.h.p. C has no non-empty linked set of size less than αn. Lemma 45 follows immediately from Lemma 51 and Proposition 48 (since Hk(n, p) contains only simple hyperedges). The proof of Lemma 51 will be reminiscent of the proof of Lemma 40, but significantly more complicated because (i) we are working in the configuration model and (ii) where we had ℓ2 2-edges in Lemma 51, we have ℓ2 2-linked paths here. First, we provide a technical lemma. Lemma 52. For any integers a, t, given a set of a vertices in H = Hk(n, p), with p = c/nk−1 the probability that their total degree exceeds tkca is at most (e/t)act. Proof. Given a set A of a vertices, let EA denote the number of hyperedges containing at least one member of A. The total degree in A is at most kEA. The number of potential edges in EA is at most a(cid:0) n and so EA is dominated from above by Bin(ank−1, c/nk−1) and using (cid:0)n act (cid:19)(cid:16) c nk−1(cid:17)act Pr(cid:2)Bin(ank−1, c/nk−1) > act(cid:3) <(cid:18)ank−1 z(cid:1) ≤ (ne/z)z we get < (e/t)act. k−1(cid:1) < ank−1, Proof of Lemma 51. By Corollary 23, we can work in the configuration model. Let D be the degree sequence of C. Recalling Definition 29, Proposition 30 and our key Lemma 32, we have w.h.p. (i) D has total degree γn + o(n), where γ = µΨr(µ), (ii) D has λ2n + o(n) vertices of degree 2, where λ2 = e−µµ2/2, (iii) there exists ζ > 0 such that 2(k − 1)λ2 < (1 − ζ)γ. For each a ≥ 1, let Xa denote the number of linked sets S in C for which Γ(S) = a and let X =Pαn k Define La =((ℓ2, . . . , ℓk) :(cid:18)1 + 1 2k(cid:19) a ≤ (i − 1)ℓi ≤(cid:18)1 + 1 2k(cid:19) a + (k − 1)) . a=1 Xa. By Lemma 50, for any linked set S in C with Γ(S) = a, there is some (ℓ2, . . . , ℓk) ∈ La so that Γ(S) contains at least ℓi i-edges for each i. Xi=2 26 To bound E(Xa), we begin by choosing a vertices, A ⊆ V (C) and sum over all t ≥ 0 of the probability that their total degree in C lies in the range (tkca, (t+1)kca]. For each t, we upper bound this last probability by the probability that their total degree in H lies in (tkca,∞]. Moreover, to sum over all subsets A ⊆ V (C) we overcount by summing instead over all A ⊆ V (H), and using Lemma 52. Of course, if such a set is not a subset of C then the probability of it contributing to Xa is zero, and so this provides an upperbound on E(Xa). This yields: (cid:18)n a(cid:19)Xt≥0 ( e t )tca. Given A, we sum over all possibilities for the values of (ℓ2, . . . , ℓk) ∈ La. For each 2 ≤ i ≤ k, we choose ℓi i-sets of vertex-copies belonging to vertices of A. If the total degree of A is in (tkca, (t + 1)kca] then the number of choices for these ℓi i-sets is at most (cid:18) ((t + 1)kca)i i! (cid:19)ℓi /ℓi! < ((t + 1)kca)iℓi ℓi! . Denote the ℓ2 2-sets as {u1, w1}, . . . ,{uℓ2, wℓ2}. For each i = 1, . . . , ℓ2, we select ji ≥ 0, the number of connecting variables in the 2-linked path from ui to wi in S, we choose the ji degree two connecting variables for that path, and we choose one of the two possible orientations of the vertex-copies of each of those connecting variables. Let J = j1 + ··· + jℓ2, be the number of connecting variables selected. Let L = λ2n + o(n) be the number of degree 2 vertices in C. Then the total number of choices for the connecting vertices and the orientations of their copies is at most J Yi=1 2(L − i + 1). Next, we apply Lemma 24 to bound the probability that the ℓ3 + ··· + ℓk sets of size at least 3 all land in hyperedges of the configuration and that for each i = 1, . . . , ℓ2, the first pair in the 2-linked path, i.e., ui and the first copy of the first of the ji connecting variables, lands in a hyperedge of the configuration. Note i=2(i − 1)ℓi < 2a + k− 1 < 2a + o(n), by the definition of La. By assuming a < αn for 2 γn. Therefore, Lemma 24 yields that this probability is that ℓ2 + ··· + ℓk ≤Pk some sufficiently small α, we get γn + o(n) − 2a > 1 at most (cid:19) k Yi=2(cid:18) (k − 1)(k − 2)··· (k − i + 1) γn(cid:19)(i−1)ℓi exp(cid:18) k(ℓ2 + ··· ℓk)2 Yi=2(cid:18) k (γn + o(n))i−1 < exp(cid:18) 8ka2 γn (cid:19) k 1 2 γn (cid:19)ℓi . Following the analysis of Lemma 24, we have now exposed ℓ2 + ··· + ℓk hyperedges of the configuration. Let Λ be the number of unmatched vertex-copies remaining. Since ℓ2 + ··· + ℓk < 2a + k − 1, we have Λ ≥ γn − 2ka + o(n). If the other vertex-copies required for the 2-linked paths are still unmatched, then we continue; else we halt observing that in this case, the set of choices made so far cannot lead to a linked set on the chosen vertices. There are J pairs of vertex copies that each need to be in a hyperedge of the configuration in order to complete the 2-linked paths. Following the same argument as in Lemma 35, the probability of this happening is at most Applying (iii) above, and taking a < αn for α sufficiently small in terms of γ, λ2, we obtain: J Yi=1 k − 1 Λ − k(i − 1) . 2(k − 1)L Λ < 2(k − 1)λ2n + o(n) γn − 2ka + o(n) < 1 − ζ 2 . 27 Thus, since 2(k − 1)L ≤ Λ (by the previous line) and k ≤ 2(k − 1), we have 2(k−1)(L−(i−1)) i, leading to ! ((t + 1)kca)iℓi Λ−k(i−1) ℓi! < 1 − ζ 2 for each ( e t a(cid:19)Xt≥0 E(Xa) < (cid:18)n )tca Xℓ2,...,ℓk∈La Xj1,...,jℓ2≥0 γn(cid:19)(i−1)ℓi! J × k Yi=2(cid:18) k Yi=1 a (cid:17)a < (cid:16) en Xt≥0 )tca Xℓ2,...,ℓk∈La × Xj1,...,jℓ2≥0 (1 − ζ/2)J . e8ka2/(γn) k Yi=2 ! 2(k − 1)(L − (i − 1)) Λ − k(i − 1) e8ka2/(γn) k Yi=2 (kca)ℓi e t ( ℓi! (cid:18) k2ca γn (cid:19)(i−1)ℓi (t + 1)iℓi! Since J = j1 + ··· + jℓ2, we have Pj1,...,jℓ2≥0(1 − ζ/2)J =(cid:16)Pj≥0(1 − ζ/2)j(cid:17)ℓ2 )ℓ2Xt≥0 e8ka2/γn Xℓ2,...,ℓk∈La(cid:18) k2ca i=2(i−1)ℓi k Yi=2 γn (cid:19)Pk ℓi! ! ( (kca)ℓi 2 ζ a (cid:17)a E(Xa) <(cid:16) en By our choice of La = (2/ζ)ℓ2, yielding: )tca(t + 1)Pk i=2 iℓi . ( e t 2k )a + k − 1, k ℓ2 ≤ k Xi=2 (i − 1)ℓi ≤ (1 + 1 Xi=2 iℓi ≤ 2 Xi=2 k (i − 1)ℓi ≤ 3a + 2k. Thus, we obtain (2/ζ)ℓ2 < Z a we have 1 for constant Z1 = Z1(c) and, since (e/t)tc(t + 1)3+2k is decreasing for large t, Xt≥0 (e/t)tca(t + 1)Pk i=2 iℓi <Xt≥0 (e/t)tca(t + 1)3a+2k <Xt≥0(cid:16)(e/t)tc(t + 1)3+2k(cid:17)a <Z a 2 , for constant Z2 = Z2(c). Also using a ≤ n we obtain: γn (cid:19)(cid:16)1+ e8ka/γ(Z1Z2)a(cid:18) k2ca a (cid:17)a E(Xa) < (cid:16) en < O(1) 2k γ (cid:19)1+ eZ1Z2e8k/γ(cid:18) k2c  1 a Applying (cid:16)Pℓ≥0 (kca)ℓ = ekca(k−1) we obtain: ℓ! (cid:17)k−1 E(Xa) < O(1)(cid:18)eZ1Z2e8k/γ(k2c/γ)1+ 1 2k (cid:17)a+k−1 k (kca)ℓi Xℓ2,...,ℓk≥0 n(cid:17)a/2k (cid:16) a Xℓ≥0 Yi=2 ℓ!   (kca)ℓ ℓi! k−1 . , 1 2k eck(k−1)(cid:19)a n(cid:17)a/2k (cid:16) a < Y a(cid:16) a n(cid:17)a/2k for a constant Y = Y (γ, λ2, ζ, b, ξ) that does not depend on a, so long as a < αn for sufficiently small √n a=1 Xa) = o(1). Moreover, for all α sufficiently small, E(Xa) < 2−a. Therefore, α > 0. This yields E(P E(Pa≥√n Xa) = o(1) and, thus, E(X) = o(1). Therefore, w.h.p. there is no 2-linked set S with 1 ≤ Γ(S) ≤ αn. The lemma follows from Proposition 49. (cid:3) 28 References [1] D. Achlioptas, P. Beame, and M. Molloy. A sharp threshold in proof complexity yields lower bounds for satisfiability search. J. Comput. Syst. Sci., 68 (2), 238 -- 268 (2004). [2] D. Achlioptas and A. Coja-Oghlan. Algorithmic barriers from phase transitions. In 49th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2008, October 25-28, 2008, Philadelphia, PA, USA, pages 793 -- 802. IEEE Computer Society, 2008. [3] D. Achlioptas, A. Coja-Oghlan and F. Ricci-Tersenghi On the solution-space geometry of random con- straint satisfaction problems. Random Struct. Algorithms, 38 (3), 251-268 (2011). [4] D. Achlioptas and F. Ricci-Tersenghi Random Formulas Have Frozen Variables. SIAM J. Comput., 39 (1), 260-280 (2009). [5] E.R. Berlekamp, R.J. McEliece, and H.C.A. van Tilborg. On the inherent intractability of certain coding problems. IEEE Trans. Inform. Theory 24, 384386 (1978). [6] B. Bollob´as. A probabilistic proof of an asymptotic formula for the number of labelled regular graphs. Europ. J. Combinatorics 1 311-316 (1980). [7] H.S. Connamacher and M. Molloy. The satisfiability threshold for a seemingly intractable random constraint satisfaction problem. SIAM J. Discrete Math., 26(2):768 -- 800, 2012. [8] C. Cooper. The cores of random hypergraphs with a given degree sequence. Random Structures Algo- rithms 25 (2004) 353 - 375. [9] H. Daud´e, M. M´ezard, T. Mora, and R. Zecchina. Pairs of SAT Assignments and Clustering in Random Boolean Formulae. Theoretical Computer Science, 393 (1-3), 260-279 (2008). [10] M. Dietzfelbinger, A. Goerdt, M. Mitzenmacher, A. Montanari, R. Pagh and M. Rink. Tight thresh- olds for cuckoo hashing via XORSAT. In Automata, Languages and Programming, 37th International Colloquium, ICALP 2010, Bordeaux, France, July 6-10, 2010, Part I, pages 213-225. Springer, 2010. [11] O. Dubois and J. Mandler. The 3-XORSAT threshold. In 43rd Symposium on Foundations of Computer Science (FOCS 2002), 16-19 November 2002, Vancouver, BC, Canada, pages 769-778. IEEE Computer Society, 2002. [12] M. Guidetti and A.P. Young. Complexity of several constraint-satisfaction problems using the heuristic classical algorithm WalkSAT. Phys. Rev. E, 84 (1), 011102, July 2011. [13] M. Ibrahimi, Y. Kanoria, M. Kraning, and A. Montanari. The set of solutions of random xorsat formulae. In Proceedings of the Twenty-Third Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2012, Kyoto, Japan, January 17-19, 2012, pages 760 -- 779. SIAM, 2012. [14] S. Janson, T. Luczak and A. Ruci´nski. Random Graphs. Wiley, New York (2000). [15] J.H.Kim. Poisson cloning model for random graphs. arXiv:0805.4133v1 [16] T. Luczak. Component behaviour near the critical point of the random graph process. Rand. Struc. & Alg. 1 (1990), 287 - 310. [17] M. M´ezard and A. Montanari. Information, Physics, and Computation. Oxford University Press, Inc., New York, NY, USA, 2009. [18] M. M´ezard, T. Mora, and R. Zecchina Clustering of Solutions in the Random Satisfiability Problem. Phys. Rev. Lett., 94 (19), 197205 (2005). 29 [19] M. M´ezard, G. Parisi, and R. Zecchina Analytic and Algorithmic Solution of Random Satisfiability Problems. Science, 297, 812 - 815 (2002). [20] M. M´ezard, F. Ricci-Tersenghi, and R. Zecchina. Alternative solutions to diluted p-spin models and XORSAT problems. J. Stat. Phys. 111, 505 - 533, (2003). [21] M. Molloy Cores in random hypergraphs and boolean formulas. Random Structures and Algorithms 27, 124 - 135 (2005). [22] M. Molloy and B. Reed. A critical point for random graphs with a given degree sequence. Random Structures and Algorithms 6 161 - 180 (1995). [23] M. Molloy and M. Salavatipour. The resolution complexity of random constraint satisfaction problems. SIAM J. Comp. 37, 895 - 922 (2007). [24] B. Pittel. On trees census and the giant component in sparse random graphs. Random Structures and Algorithms 1 (1990), 311 - 342. [25] B. Pittel, J. Spencer and N. Wormald. Sudden emergence of a giant k-core in a random graph. J. Comb. Th. B 67, 111 - 151 (1996). 30
1202.4160
4
1202
2016-06-27T08:28:03
Interval Routing Schemes for Circular-Arc Graphs
[ "cs.DS", "cs.DM" ]
Interval routing is a space efficient method to realize a distributed routing function. In this paper we show that every circular-arc graph allows a shortest path strict 2-interval routing scheme, i.e., by introducing a global order on the vertices and assigning at most two (strict) intervals in this order to the ends of every edge allows to depict a routing function that implies exclusively shortest paths. Since circular-arc graphs do not allow shortest path 1-interval routing schemes in general, the result implies that the class of circular-arc graphs has strict compactness 2, which was a hitherto open question. Additionally, we show that the constructed 2-interval routing scheme is a 1-interval routing scheme with at most one additional interval assigned at each vertex and we an outline algorithm to calculate the routing scheme for circular-arc graphs in O(n^2) time, where n is the number of vertices.
cs.DS
cs
Interval Routing Schemes for Circular-Arc Graphs Patrick Gwydion Poullie∗ Frank Gurski University of Dusseldorf Institute of Computer Science University of Zurich Department of Informatics Algorithmics for Hard Problems Group Communication Systems Group D-40225 Dusseldorf [email protected] CH-8050 Zurich [email protected] November 2, 2018 Abstract Interval routing is a space efficient method to realize a distributed routing function. In this paper we show that every circular-arc graph allows a shortest path strict 2-interval routing scheme, i.e., by introducing a global order on the vertices and assigning at most two (strict) intervals in this order to the ends of every edge allows to depict a routing function that implies exclusively shortest paths. Since circular-arc graphs do not allow shortest path 1- interval routing schemes in general, the result implies that the class of circular-arc graphs has strict compactness 2, which was a hitherto open question. Additionally, we show that the constructed 2-interval routing scheme is a 1-interval routing scheme with at most one additional interval assigned at each vertex and we outline an algorithm to calculate the routing scheme for circular-arc graphs in O(n2) time, where n is the number of vertices. Keywords: interval routing, compact routing, circular-arc graphs, cyclic permutations 1 Introduction Routing is an essential task that a network of processors or computers must be able to perform. Interval routing is a space-efficient solution to this problem. Sets of consecutive destination ad- dresses that use the same output port are grouped into intervals and then assigned to this port. In this way, the storage space required is greatly reduced compared to the straight forward approach, in which an output port is stored specifically for every destination address. Of course, the advan- tage in space efficiency depends heavily on the number of intervals assigned to the output ports, which, in turn, depends on the address and network topology. Interval routing was first introduced in [SK82, SK85]; for a discussion of interval routing we refer the reader to [vLT87, FJ88, BvLT91] and for a detailed survey to [Gav00]. When theoretical aspects of interval routing are discussed, the network is represented by a directed (symmetric) graph G = (V, A). As with many routing methods, the problem is that space efficiency and path optimality are conflicting goals [PU89]: as shown in [GG98], for every n ∈ N, there exists an n-vertex graph Gn such that for every shortest path interval routing scheme (for short IRS) for Gn the maximal number of intervals per directed edge is only bounded by Ω(n). Also, it is NP-hard to determine the most space efficient shortest path IRS for a given graph [EMZ02, Fla97]. Other worst case results can be found in [TL99]. On the other hand, there are many special graph classes [FG98] including random graphs [GP98] that are known to allow shortest path IRSs with a constantly bounded number of intervals on all directed edges. If this number is a tight bound, it is denoted the compactness of the graph. The compactness of undirected graphs is defined as the compactness of their directed symmetric ∗Corresponding author. 1 version1 and the compactness of a graph class as the smallest k, such that every graph in this class has compactness at most k, if such k exists. In this paper we show that the class of circular-arc graphs has (strict) compactness 2 by present- ing an algorithm to construct a corresponding IRS. A different approach to realize space efficient, shortest path routing in circular-arc graphs can be found in [DL02]. In [GP08] an O(log(V ))-bit distance labeling scheme is developed that allows for each pair of vertices in circular-arc graphs to compute their exact distance in O(1) time. In [DYL06] an O(log2(V ))-bit routing labeling scheme is developed that allows to make a routing decision in O(1) time for every vertex in an arbitrary circular-arc graph. The resulting routing path has at most two more edges than the respective shortest path. Nevertheless, our result is interesting, since interval graphs and unit circular-arc graphs are included in the class of circular-arc graphs and known to have compactness 1 [FG98, NS96], while for the compactness of circular-arc graphs hitherto only a lower bound of 2 was known (cf. the graph in Fig. 1) and the solutions from [FG98] and [NS96] cannot be extended to the class of circular-arc graphs. While interval graphs can be represented by intervals on a line, circular-arc graphs can be represented by arcs on a circle, that is to say, every circular-arc graph is the intersection graph of a set of arcs on a circle. The first polynomial-time (O(V 3)) algorithm to recognize circular-arc graphs and give a corresponding circular-arc model can be found in [Tuc80]. An algorithm with linear runtime for the same purpose is given in [McC03]. In circular-arc graphs maximum cliques can be computed much faster than in arbitrary graphs; an algorithm that determines a maximum clique in a circular-arc graph in O(E+V ·log(V )) time or even in O(E) time, if the circular-arc endpoints are given in sorted order, is presented in [BK97]. A discussion of circular-arc graphs can be found in [Hsu95]. Circular-arc graphs have, amongst others, applications in cyclic scheduling, compiler design [Gol04, Tuc75], and genetics [Rob76]. This paper is organized as follows. In Section 2 we define cyclic permutations, circular-arc graphs, and interval routing schemes. In Section 3 we prove the main result of this paper, namely that every circular-arc graph allows a shortest path strict 2-interval routing scheme. To this end, we choose an arbitrary circular-arc graph G = (V, A) and fix a cyclic permutation L on V , in Section 3.1. In Section 3.2 we fix an arbitrary vertex v and partition V −{v} into the three sets Av, Bv, and Cv; the vertices in these sets appear consecutively in L and are referred to as the vertices to the right of v, the vertices face-to-face with v, and the vertices to the left of v, respectively. In Section 3.3 we show that the vertices in the three sets Av, Bv, and Cv can be assigned to the edges incident to v, such that the conditions of a shortest path strict 2-interval routing scheme are fulfilled. In Section 4 we show that the upper bound of the number of intervals in a shortest path strict 2-interval routing scheme constructed in this way is close to the number in an 1-IRS. In Section 5 we outline how to implement the implied IRS in O(V 2) time. 2 Preliminaries 2.1 Cyclic Permutations Cyclic permutations are relevant for the two main subjects of this paper, namely circular-arc graphs and non-linear interval routing schemes. Just like a permutation, a cyclic permutation implies an order on a set with the only difference being that there is no distinct first, second, . . ., or n-th element. We also define cyclic permutations on multisets, where we assume that multiple appearances of an element are distinguishable, i.e., a multiset A = {a1, . . . , an} on n elements is identified with A(cid:48) = {(1, a1), . . . , (n, an)}. Definition 2.1 (Cyclic Permutation) A cyclic permutation on a (multi-)set A with n elements is a function C : A → A such that ∀a ∈ A : ∀i ∈ N+ : C i(a) = a ⇔ i mod n = 0.2 We call C (a) the successor of a (in C ) and we write a (cid:31)C C (a). 1The directed symmetric version of an undirected graph Gu = (V, E) is the directed graph Gd = (V, A) with A = {(v, w), (w, v) {v, w} ∈ E}. 2If the condition holds for one element in A, it holds for all elements in A. 2 Every cyclic permutation is a bijective mapping. Let C be a cyclic permutation on a (multi- )set A = {a1, a2, . . . , an}. One could imagine C as an arrangement of A on a clock face, for an n-hour clock. To go through C beginning at ai ∈ A means to consider the elements in A as they appear in C , beginning at ai. Next we define subsets of A that appear consecutively in C . Definition 2.2 (Ring-Interval, Ring-Sequence) For a cyclic permutation C on a (multi-)set A and a, b ∈ A, we recursively define the ring-interval from a to b (in C ) as (cid:40){a} [a, b]C := {a} ∪ [C (a), b]C if a = b else. By ]a, b]C we indicate that the left endpoint is excluded, by [a, b[C that the right endpoint is excluded, and by ]a, b[C that both endpoints are excluded. Therefore we have ]a, a], [a, a[, ]a, a[= ∅ The ring-sequence from a to b (in C ), denoted by S[a, b]C = (a, . . . , b), is the order in which elements of [a, b]C appear when going through C beginning at a. Construction 2.3 Let C be a cyclic permutation on a (multi-)set A and a, b, c, d ∈ A. If [a, b]C ∩ [c, d]C = ∅ and b (cid:31)C c, we have [a, b]C ∪ [c, d]C = [a, d]C . 2.2 Circular-Arc Graphs We assume that the reader is familiar with basic graph theoretical definitions. The intersection graph of a family of sets is the graph where the vertices are the sets, and the edges are the pairs of sets that intersect. Every graph is the intersection graph of some family of sets. A graph is an interval graph if it is the intersection graph of a finite set of intervals (line segments) on a line and a unit interval graph if these intervals have unit length. A graph G is a circular-arc graph if it is the intersection graph of a finite set of arcs on a circle; the latter we call an arc model of G. Since an interval graph is a special case of a circular-arc graph, namely a circular-arc graph that can be represented with a set of arcs that do not cover the entire circle, we define the set of strict circular-arc graphs as the set of circular-arc graphs that are not interval graphs. Every strict circular-arc graph is connected. A unit circular-arc graph is a circular-arc graph that has an arc model in which the arcs have unit length. For a survey on circular-arc graphs see [LS09] and for the definition of further special graph classes see [BLS99]. Fig. 1 illustrates a strict circular-arc graph. (a) Arc model (b) Correspondence (c) Graph representation Figure 1: A (strict) circular-arc graph A difference between interval graphs and circular-arc graphs, that is worth mentioning, is that the maximal cliques of interval graphs can be associated to points of the "interval model" and therefore an interval graph can have no more maximal cliques than vertices. In contrast, circular- arc graphs may contain maximal cliques that do not correspond to points of some arc model 3 121234567891011124576981110123 [LS09]. In fact, just as in arbitrary graphs, the number of maximal cliques in circular-arc graphs can grow exponentially in the size of the graph [Tuc80]. For the special case that there is an arc model where no three arcs cover the whole circle the number of maximal cliques is bounded by the number of vertices of the graph [CFZ08]. Also maximal cliques may occur several times within some arc model, which is addressed by multisets in this paper. The following definition and the subsequent corollary formalize important graph-theoretic prop- erties of circular-arc graphs. Definition 2.4 (Clique-Cycle, Left Clique α(v), and Right Clique β(v)) Let G = (V, E) be a circular-arc graph, MG be an arc model of G, and C be the circle of MG. To each point p on C corresponds a clique that contains the vertices whose corresponding arcs contain p. Let multiset Y contain all cliques that correspond to points on C and define X ⊆ Y as the multiset of cliques we obtain, when we remove all cliques from Y that are not maximal with respect to inclusion among the cliques in Y and all but one cliques that are equal. Pair (X, C ), where C is the cyclic permutation on X that is implied by ordering the elements in X as their corresponding points appear (clockwise) on C, is called a clique-cycle for G. For every vertex v ∈ V , there exist two cliques a, b ∈ X such that a clique x ∈ X contains v if and only if x ∈ [a, b]C . We call a the left clique of v, denoted by α(v), and b the right clique of v, denoted by β(v). When circular-arc graphs are discussed in this paper, the argumentation is based on one of their clique-cycles deduced from some arc model. A frequently used notation in our paper is that of a dominating vertex, which is a vertex adjacent to all other vertices of the graph. The set of all dominating vertices of graph G is denoted by D(G). Since a dominating vertex d is adjacent to all the vertices, all the maximal cliques contain it, wherefore d's left and right clique form a cyclic interval that covers the entire clique cycle. Corollary 2.5 Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E) and d ∈ D(G) a dominating vertex. The left clique α(d) and the right clique β(d) of d are not unique, but can be chosen arbitrarily with β(d) (cid:31)C α(d) being the only constraint. Consider the arc model of a circular-arc graph and two intersecting arcs v, w. The arcs v and w can intersect in the following two ways: 1. The intersection of v and w constitutes another arc. This is the case, (a) if v is included in w or vice versa, (b) if v and w are congruent, i.e., cover the exact same part of the cycle, or (c) if exactly one endpoint of v lies in w and vice versa. 2. The intersection of v and w constitutes two arcs (the corresponding vertices will be defined as counter vertices in the subsequent definition). This is the case, if v and w jointly cover the circle and meet at both ends. Definition 2.6 (Counter Vertex C(v)) Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E). We call w ∈ V a counter vertex of v ∈ V , if α(v), β(v) ∈ [α(w), β(w)]C and α(w), β(w) ∈ [α(v), β(v)]C and α(v) (cid:54)= α(w) (or, equivalently, β(v) (cid:54)= β(w)). We call (v, w) a pair of counter vertices and denote the set of all counter vertices of v by C(v).3 The next corollary follows directly from the arc model of a circular-arc graph. Corollary 2.7 Let G = (V, E) be a circular-arc graph and v ∈ V be a vertex with C(v) (cid:54)= ∅. Then every vertex in V is adjacent to v or to every vertex in C(v), in other words, v and any of its counter vertices constitute a dominating set. Definition 2.8 (Reaching to the Left/Right) Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E), v, w two adjacent vertices with v /∈ C(w) and x ∈ X a clique with v, w ∈ x. We say, w reaches at least as far to the right as v if [x, β(v)]C ⊆ [x, β(w)]C , and w reaches further to the right than v if [x, β(v)]C ⊂ [x, β(w)]C . Analogously, we define w reaches at least as far to the left as v by [α(v), x]C ⊆ [α(w), x]C and w reaches further to the left than v by [α(v), x]C ⊂ [α(w), x]C . 3Note that, w ∈ C(v) ⇔ v ∈ C(w). 4 Although the arcs corresponding to counter vertices cover very different areas of the circle, it is impossible to say which of the two arcs "reaches further to the left or right", when the point of view is the middle of the circle. 2.3 Interval Routing Schemes We assume that the reader is familiar with basic concepts of interval routing and refer to [Gav00] for an exhaustive introduction and survey. If an IRS assigns at most k intervals to each (directed) edge and only implies shortest paths, we denote it by k-IRS. If this k-IRS is furthermore strict, which means that for every vertex v ∈ V no interval assigned to the outgoing edges of v contains v's number, it is denoted by k-SIRS. Definition 2.9 is needed for Definition 2.10, which is an alternative definition for shortest path strict interval routing schemes that is equivalent to definitions in literature but better suited for our purposes. To apply Definition 2.10 to an undirected graph (as for example a circular-arc graph), the graph is converted to its directed, symmetric version. While directed edges are often called arcs, we choose the former term to avoid confusion with the arcs of a graph's arc model. Definition 2.9 (First Vertex F(u, w)) Let G = (V, A) be a directed graph and u, v, w ∈ V . Vertex v ∈ V is a first vertex from u to w, if there exists a shortest directed path (u, v, . . . , w), i.e., there is a shortest directed path from u to w, that first traverses v. The set of first vertices from u to w is denoted by F(u, w) = {v ∈ V v is a first vertex from u to w}. Definition 2.10 (Shortest Path Strict Interval Routing Scheme) Let G = (V, E) be a directed graph. A shortest path strict interval routing scheme for G is a pair R = (L ,I), where L is a cyclic permutation on V , called the vertex order, and I, called the directed-edge-labeling, maps every directed edge to a set of ring-intervals in L such that for every vertex v ∈ V , 1. I maps the outgoing directed edges of v to a set of ring-intervals in L , such that the intervals assigned to different directed edges never intersect, 2. for every vertex u (cid:54)= v one of these these ring-intervals contains u (vertex v must not appear in one of these intervals), and 3. if u is contained in a ring-interval in I((v, w)), then w is a first vertex from v to u. Let F be a vertex order. We say that v ∈ V given F suffices a shortest path k-SIRS, if there exists a directed edge-labeling for G that maps every outgoing directed edge of v to at most k ring-intervals in F , such that v satisfies the three constraints above. Corollary 2.11 A directed graph G = (V, A) supports a shortest path k-SIRS, if a vertex order F exists, such that every vertex v ∈ V given F suffices a shortest path k-SIRS. 3 Main result The compactness of the class of circular-arc graphs has not been determined until now, which is somehow surprising, since the class of circular-arc graphs is closely related to the class of interval graphs and unit circular-arc graphs and both classes are known to have strict compactness 1 [NS96, FG98]. However, for the compactness of the class of circular-arc graphs only a lower bound of 2 was known. In particular, circular-arc graphs exist that do not allow for optimal 1 interval routing schemes, as, for example, a wheel graph, i.e., a cycle together with a dominating vertex, with six outer vertices [FG98]. Also the circular-arc graph shown in Fig. 1 does not allow optimal 1 interval routing schemes. In this section we prove the main result of this paper, which is given by the following theorem and shows that the lower bound of 2 for the compactness of circular-arc graphs is indeed sharp. 5 Theorem 3.1 (Main Theorem) The class of circular-arc graphs has strict compactness 2. Since every non-strict circular-arc graph G is an interval graph and therefore has strict com- pactness 1 [NS96], we only need to consider strict circular-arc graphs in the proof. For the rest of this section let (X, C ) be a clique-cycle for an arbitrary strict circular-arc graph Gu = (V, E) and G = (V, A) be the directed symmetric version of Gu. Outline of the proof To show that there exists a shortest path 2-SIRS for G and thus Theorem 3.1 holds, we proceed as follows. In Section 3.1 we construct a cyclic permutation L on V . In Section 3.2 we choose an arbitrary vertex v ∈ V and partition the vertices in V − {v} in three disjoint ring-intervals Av, Bv, Cv in L in dependency on v. In order to show that v given L suffices a shortest path 2-SIRS, we show how to define an directed edge-labeling Iv for the outgoing directed edges of v that satisfies the corresponding constraints given in Definition 2.10. We consider each of the three ring-intervals Av, Bv, Cv in Section 3.3.1 and 3.3.2 and show how the vertices in the respective ring-interval can be sufficiently mapped to by Iv. Since we have chosen v arbitrarily, it follows that every vertex in V suffices a shortest path 2-SIRS given L and therefore, by Corollary 2.11, G supports a shortest path 2-SIRS. Since Gu is an arbitrary strict circular-arc graph, this proves Theorem 3.1. The following notations are straight forward but may be formalized for convenience. Let (v, w) ∈ E be a directed edge with Iv((v, w)) = S, where S is a set of ring-intervals in L , and R be a ring-interval in L . Assigning R to directed edge (v, w) means to define Iv : (v, w) (cid:55)→ S∪{R}. Of course, when we start constructing Iv, every directed edge is mapped to the empty set. Let [a, b]L and [c, d]L be two ring-intervals that can be joined to one ring-interval [a, d]L by Construction 2.3. If [a, b]L and [c, d]L are assigned to the same directed edge (v, w), we can redefine Iv : (v, w) (cid:55)→ {[a, b]L , [c, d]L } by Iv : (v, w) (cid:55)→ {[a, d]L } and therefore save one ring-interval on directed edge (v, w). This redefinition is called compressing the (two) ring-intervals on directed edge (v, w) (to one ring-interval). Let V (cid:48) ⊆ V be a set of vertices. To distribute V (cid:48) (over the outgoing directed edges of v) means to partition V (cid:48) into ring-intervals and assign these to outgoing directed edges of v (sufficiently). For convenience, we sometimes refer to ring-intervals as intervals. 3.1 Definition of the Vertex Order In this section we consider a circular-arc graph G = (V, E) together with a clique-cycle (X, C ) and show how to construct a cyclic permutation L on V that serves as the given vertex order. The ordering is obtained by sorting the arcs using their left cliques as primary sort key and right cliques as secondary sort key, making the first arc the successor of the last. A pseudocode for this purpose is presented in Listing 1 and its idea is explained next. By Corollary 2.5 the left and right clique of a dominating vertex are not unique. Since it simplifies the proof, if all dominating vertices have the same left and thus also the same right clique, these cliques are unified in Line 1. For a fixed z in Line 1, the generated cyclic permutation is fully deterministic, except for the ordering of true twins.4 The dummy vertex introduced in Line 4 is needed to close the cyclic order once all vertices are integrated in L . The loop in Line 6 runs once through all cliques in X (beginning at f, that is arbitrarily chosen in Line 2) in the order defined by C (Line 13). For every visited clique n the loop in Line 8 integrates every vertex, whose left clique is n, in L . By Line 9, vertices with the same left clique are ordered with respect to their right clique. An example for the defined vertex ordering can be found in Fig. 1. 1 Fix z ∈ X arbitrarily and choose α(d) := C (z) and β(d) := z for all d ∈ D(G) 2 Choose f ∈ X arbitrarily 3 n := f 4Two vertices in a graph are called true twins if they are adjacent to the same set of vertices and to each other. 6 A := {v ∈ V α(v) = n} while(A (cid:54)= ∅) 4 V := V ∪ {t} /∗ add dummy vertex t ∗/ 5 p := t 6 do 7 8 9 10 11 12 13 14 while(n (cid:54)= f) 15 L (p) := L (t) 16 V = V − {t} /∗ remove dummy vertex t ∗/ 17 return L n := C (n) Choose a ∈ A such that every vertex in A reaches at least as far to the right as a. L (p) := a p := a A := A − {a} Listing 1: Definition of a cyclic order L on V that serves as the given vertex order. The following observations are crucial for the rest of this paper. Remark 3.2 1. The vertices are ordered primarily by their left clique, that is to say, vertices having the same left clique appear consecutively in L . 2. Vertices with the same left clique are ordered in ascending order by their right clique. 3. For two vertices v, w ∈ V with v (cid:31)L w, we know that v and w are adjacent and either (a) α(v) = α(w) and w reaches at least as far to the right as v, or (b) α(v) (cid:31)C α(w), in other words, v reaches one clique further to the left than w.5 The next definition is based on Assertion 1 of the preceding remark, that is to say, on the fact that, since vertices having the same left clique appear consecutively in L , for a given clique c ∈ X, two vertices v, w ∈ c exist, such that the vertices in ring-interval [v, w]L are exactly those with left clique c. Definition 3.3 (Head Vertex H(c) and Tail Vertex T (c)) Let (X, C ) be a clique-cycle for some circular-arc graph G = (V, E), L given by Listing 1, c ∈ X, and v, w ∈ c the unique vertices such that [v, w]L = {x ∈ V α(x) = c} (v and w are not necessarily distinct). We call v the head vertex of c and w the tail vertex of c and denote them by H(c) and T (c), respectively. Corollary 3.4 Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E), L given by Listing 1, and c ∈ X. The successor (in L ) of the tail vertex of c is the head vertex of the successor (in C ) of c, i.e., L (T (c)) = H(C (c)). 3.2 Partition of the Vertex Order The cyclic permutation L on V allows to state further definitions. We now fix v ∈ V arbitrarily for the rest of the proof and show that v given L suffices a shortest path 2-SIRS. If v is a dominating vertex, we can define Iv : (v, w) (cid:55)→ [w, w]L for every vertex w ∈ V − {v} and have thereby shown that v given L suffices a shortest path 1-SIRS. Therefore, we now assume that v is not a dominating vertex. Fig. 2a illustrates the subsequent Definition. Definition 3.5 (Left Vertex lv) Let (X, C ) be a clique-cycle for some circular-arc graph G = (V, E), L given by Listing 1, and v ∈ V not a dominating vertex. Let L ⊂ V be the union of the following two vertex sets. (i) The set of vertices that are adjacent to v and reach further to the 5Because the relation "reaching to the right" is not defined, if v and w are counter vertices, we intuitively extend Definition 2.8 to this case by fixing x = α(w). 7 (a) The green vertices are in set L of Definition 3.5. The left vertex of v, which is also in L, is colored in light green and the middle vertex of v in red. (b) The green vertices are to the left of v, the red vertices are to the right of v, and the black vertices are face-to-face with v. Figure 2: Two examples for the Definitions made in this section The fixed vertex v is colored blue. The yellow line connects the vertices as they appear in vertex order L as generated by Listing 1. left than v but are neither counter vertices of v nor dominating vertices. (ii) The set of vertices in [H(α(v)), v[L .6 If L (cid:54)= ∅, we define the left vertex of v, denoted by lv, as the unique vertex in L such that ∀w ∈ L : [w, v[L ⊆ [lv, v[L (or, equivalently, L ⊆ [lv, v[L ). (1) Theorem 3.6 Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E), L given by Listing 1, v ∈ V not a dominating vertex, lv the left vertex of v, and u (cid:54)= lv be a vertex that is adjacent to v and reaches further to the left than v but is neither a dominating vertex nor a counter vertex of v. Then lv reaches at least as far to the left as u. Proof Assume u reaches further to the left than lv. Then by Definition 2.8 we know that [α(lv), α(v)]C ⊂ [α(u), α(v)]C , which implies that S[α(u), α(v)]C = (α(u), . . . , α(lv), . . . , α(v)). Since L is primary ordered by the left cliques of the vertices, it follows u (cid:31)L . . . (cid:31)L lv (cid:31)L . . . (cid:31)L v and therefore [lv, v]L ⊂ [u, v]L . This contradicts (1) in Definition 3.5, since u ∈ L reaches further (cid:3) to the left than v and is neither a dominating vertex nor a counter vertex of v. In Definition 3.8 we partition the vertices in V − {v} into three ring-intervals in L . The following argumentation gives the idea behind this partitioning and also proves Theorem 3.9. Consider we go through L beginning at v. Since the vertices in L are primary ordered by their left cliques, the left clique of the vertices first considered is α(v) (or C (α(v)), if v is the tail vertex of clique α(v)). The next vertices traversed have left clique C (α(v)), followed by vertices with left clique C 2(α(v)), and so on. We eventually reach the set of vertices with left clique β(v). The last vertex we come across in this set is T (β(v)) and fixed in Definition 3.7. The vertices we came across so far (excluding v, including T (β(v))) will be defined as the "vertices to the right of v" in Definition 3.8 and are adjacent to v, as v was contained in their left clique. 6We have D(G) ∩ [H(α(v)), v[L = ∅ and C(v) ∩ [H(α(v)), v[L = ∅. 8 vvmlvv Definition 3.7 (Middle Vertex mv) Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E), L given by Listing 1, and v ∈ V not a dominating vertex. We define the middle vertex of v, denoted by mv = T (β(v)), as the tail vertex of the right clique of v. When we continue visiting the vertices after mv in the same manner, the next vertex u we come across that is not a dominating vertex but adjacent to v has to be lv, as we could find a contradiction in the same manner as in the proof of Theorem 3.6, if we had u (cid:54)= lv. These vertices after mv and before lv are defined as the "vertices face-to-face with v" in Definition 3.8. When we continue to go through L , we eventually reach v again. These vertices from lv to v (excluding v) are defined as the "vertices to the left of v" in Definition 3.8, which is illustrated in Fig. 2b. Definition 3.8 (Av, Bv, Cv) Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E), L given by Listing 1, v ∈ V not a dominating vertex, lv the left vertex of v, if lv exists, and mv the middle vertex of v. We define 1. the vertices to the right of v as Av =]v, mv]L , and 2. the vertices face-to-face with v (a) as Bv =]mv, v[L , if lv does not exist, or else (b) as Bv =]mv, lv[L , and 3. the vertices to the left of v (a) as Cv = [lv, v[L , if lv exists, or else (b) as Cv = ∅.7 The next theorem follows from the argumentation between Theorem 3.6 and Definition 3.8. Theorem 3.9 Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E), L given by Listing 1, and v ∈ V but not a dominating vertex. 1. Every vertex to the right of v is adjacent to v. 2. Every vertex face-to-face with v that is not a dominating vertex is not adjacent to v. 3.3 Definition of the Directed Edge-labeling Next we show that v given L suffices a shortest path 2-SIRS by constructing a mapping Iv from the set of outgoing directed edges of v to at most two ring-intervals in L , according to Definition 2.10. We investigate the vertices to the left of v and the vertices to the right of v in Section 3.3.1 and the vertices face-to-face with v in Section 3.3.2. For every vertex u in the respective interval, we determine a first vertex w from v to u such that u and every vertex that is hitherto assigned to directed edge (v, w) can be embraced by at most two ring-intervals in L . This is a simple task for the vertices in Av and Cv and even for the vertices in Bv the approach is straight forward, if there is a dominating vertex or a counter vertex of v. In fact, it only gets tricky, if there are no dominating vertices and no counter vertices. 3.3.1 Vertices to the Left and Right By the first assertion of Theorem 3.9 every vertex to the right of v is adjacent to v, wherefore these vertices can be distributed by assigning [w, w]L to directed edge (v, w), for every vertex w ∈ Av. Assume that we have Cv (cid:54)= ∅. In general, not every vertex in Cv is adjacent to v. Although lv is adjacent to all vertices in Cv, it is generally not possible to assign Cv to directed edge (v, lv), since Cv may contain vertices that are adjacent to v (other than lv), and therefore must be assigned to 7 We have Cv = L from Definition 3.5. 9 "their own directed edge". Let vi ∈ Cv be a vertex that is adjacent to v and assume we start at vi to go through L until we come across the next vertex that is adjacent to v or v itself. Denote this vertex vj. We can show that vi is adjacent to every in ]vi, vj]L , wherefore we can assign [vi, vj[L to directed edge (v, vi). Therefore the vertices to the left of v can be distributed by assigning every vertex w ∈ Cv to directed edge (v, w), if w is adjacent to v, and else to directed edge (v, w(cid:48)), where w(cid:48) is the first vertex that precedes w in L and is adjacent to v. Theorem 3.10 proves the outlined idea formally. When distributing the vertices in sets Av and Cv as just outlined, every outgoing directed edge of v (except for edges incident to dominating vertices face-to-face with v, which are not yet labeled) gets one ring-interval assigned. Theorem 3.10 Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E), L given by Listing 1, v ∈ V but not a dominating vertex, and lv the left vertex of v (then the vertices in [lv, v[L are the vertices to the left of v). Let S[lv, v]L = (lv = v1, v2, . . . , vn = v) be the sequence of vertices that we obtain, when we order the vertices in [lv, v[L that are adjacent to v as they appear in ring-sequence S[lv, v[L and append v. For 1 ≤ i < n and x ∈ [vi, vi+1[L , vertex vi is a first vertex from v to x. Proof For some i, 1 ≤ i < n, let x ∈ [vi, vi+1[L . Clearly the theorem holds if x = vi. If x (cid:54)= vi, x does not appear in (v1, v2, . . . , vn) and therefore is not adjacent to v. Since the vertices in L are primary ordered by their left clique and vi appears before x in S[lv, v]L , it follows that the left clique of x is in [α(vi), α(v)]C . Since vi is adjacent to v, vi is contained in every clique in [α(vi), α(v)]C . This implies that vi is contained in the left clique of x and thus vi and x are adjacent. Therefore (v, vi, x) is a shortest path between v and x and vi is a first vertex from v to (cid:3) x. 3.3.2 Vertices Face-to-Face This section discusses the distribution of vertices face-to-face with v. It is probably the com- mon case, that neither counter nor dominating vertices exist, since only then path lengths are unbounded. Thus, this case is discussed in the next paragraph and the subsequent paragraph discusses the remaining cases. 3.3.2.1 Neither Dominating nor Counter Vertices exist In this case, lv always reaches further to the left than v and there is at least one vertex adjacent to v that reaches further to the right. Let w ∈ V be a vertex that is not adjacent to v, L be the set of vertices adjacent to v that reach farthest to the left and R be the set of vertices adjacent to v that reach farthest to the right (L and R might intersect). As evident from the arc model of G, every vertex in L or every vertex in R is a first vertex from v to w (cf. Corollary 3.13). Since we have lv ∈ L, we now fix a vertex adjacent to v that reaches farthest to the right. Definition 3.11 (Right Vertex rv) Let (X, C ) be a clique-cycle for a strict circular-arc graph G = (V, E) without dominating vertices and without counter vertices, L given by Listing 1, v ∈ V , lv the left vertex of v, mv the middle vertex of v, and R ⊂ V be the set of vertices that are adjacent to v and reach farthest to the right. We define the right vertex of v, denoted by rv, as lv, if lv ∈ R, or as mv, if mv ∈ R, or else as an arbitrary vertex in R. In order to show that v suffices a shortest path 2-SIRS given L , we could choose rv arbitrarily in R even if lv ∈ R or mv ∈ R. However, we will show that v given L suffices a shortest path 1-SIRS, if lv ∈ R or mv ∈ R. The next definition redefines the notation of the left and right vertex as a function, in order to allow recursive usage to easily determine a first vertex from v to every vertex. The subsequent corollary is clear when illustrated. Definition 3.12 (l(v), r(v) and Lv(u), Rv(u)) Let (X, C ) be a clique-cycle for a strict circular- arc graph G = (V, E) without dominating vertices and without counter vertices, cyclic permutation 10 L given by Listing 1, and v ∈ V . We define l(v) as the left vertex of v and r(v) as the right vertex of v.8 For u ∈ V , we define Lv(u) as the smallest i such that u is adjacent to li(v) and Rv(u) as the smallest i such that u is adjacent to ri(v). Corollary 3.13 Let (X, C ) be a clique-cycle for a strict circular-arc graph G = (V, E) without dominating vertices and without counter vertices, cyclic permutation L given by Listing 1, and v ∈ V . The following three assertions hold for every vertex u ∈ V that is not adjacent to v. 1. If Lv(u) < Rv(u), then lv is a first vertex from v to u. 2. If Lv(u) > Rv(u), then rv is a first vertex from v to u. 3. If Lv(u) = Rv(u), then lv and rv are first vertices from v to u. Since no vertex in Bv is adjacent to v, the corollary implies that lv or rv is a first vertex from v to every vertex in Bv. Since sequence r1(v), r2(v), . . . "runs" through the clique-cycle as implied by C and sequence l1(v), l2(v), . . . "runs" through the clique-cycle as implied by C −1, that is to say, in the other direction, there exists an i ∈ N such that li(v) and ri(v) "meet", or more formally, are adjacent or equal. This number is fixed in the following definition. Definition 3.14 (Apex Number) Let (X, C ) be a clique-cycle for a strict circular-arc graph G = (V, E) without dominating vertices and without counter vertices, L given by Listing 1, and v ∈ V . If we have α(l1(v)) = β(r1(v)) or [α(v), β(v)]C ⊂ [β(r1(v)), α(l1(v))]C we set i = 1, otherwise we define i as the smallest number greater than 1 such that li(v) and ri(v) are adjacent or equal. We call integer i the apex number of v. The separate treatment for apex number i = 1 in Definition 3.14 ensures that the arcs of li(v) and ri(v) intersect/meet adverse to v on the circle and therefore the arcs of l1(v), . . . , li(v), r1(v), . . . , ri(v), and v to cover the entire circle. In particular, if lv and rv intersect in v's arc they cannot cover the entire cycle, since they are not counter vertices, but the apex number would be defined as 1, if only the second part of the case distinction were in place. By the definition, for apex number i > 2 vertices ri(v) and li−1(v) are adjacent if and only if li(v) and ri−1(v) are adjacent. Furthermore, for 2 ≤ j, k < i vertices rj(v) and lk(v) are not adjacent. The following Theorem 3.15 shows that there exists a vertex sv ∈ Bv with li(v), ri(v) ∈ α(sv), where i is the appex number of v, such that rv is a first vertex from v to every vertex in Br = ]mv, sv]L and vertex lv is a first vertex from v to every vertex in Bl =]sv, lv]L . Since Theorem 3.15 implies that the vertices in Bv can be distributed by assigning Bl to directed edge (v, lv) and Br to directed edge (v, rv), the main theorem (Theorem 3.1) follows for the case in which neither dominating vertices nor counter vertices exist. Theorem 3.15 Let (X, C ) be a clique-cycle for a strict circular-arc graph G = (V, E) without dominating vertices and without counter vertices, L given by Listing 1, v ∈ V , lv the left vertex of v, mv the middle vertex of v, and rv the right vertex of v. There exists a vertex sv ∈ ]mv, lv[L such that, for every vertex w ∈ ]mv, sv]L , we have rv ∈ F(v, w), and for every vertex w(cid:48) ∈ ]sv, lv]L , we have lv ∈ F(v, w(cid:48)). Proof Let i the apex number of v. If i = 1 the theorem holds for sv = L −1(lv), since every vertex in ]mv, lv[L is adjacent to rv. If i > 1 and li(v) = ri(v), we have ∀w ∈ ]mv,T (β(ri−1(v)))]L : Rv(w) ≤ i − 1 ≤ Lv(w) and wherefore, by Corollary 3.13, Theorem 3.15 holds for sv = T (β(ri−1(v))). ∀w ∈ ]T (β(ri−1(v))), lv[L : Lv(w) ≤ Rv(w), 11 Figure 3: This picture illustrates the proof of Theorem 3.15 and partially shows a circular-arc graph, where the lines represent arcs. A line ends with a triangle, if it may reach not further to left or right, respectively. The upper two lines with a dotted end illustrate that an arc, that has its right end in the interval depicted by the rotated curly bracket, may reach no further to the left than the triangle of the respective line. We begin to search for u at the right end of the lower curly bracket. The rotated square brackets on top mark the areas of the left cliques of the vertices in sets A, B, C. The case in which li−1(v) = u looks similar. The following argumentation is partially illustrated in Fig. 3. If i > 1 and li(v) (cid:54)= ri(v), let A =]mv,T (β(ri−1(v)))]L , and a ∈ A. We have Rv(a) ≤ i− 1, because a is adjacent to a vertex in {r1(v), r2(v), . . . , ri−1(v)}. When lv reaches further to the right than v, a might appear in a clique in ]β(v), β(lv)]C and, therefore, be adjacent to lv, which implies Lv(a) = 1. However, in this case, we also have Rv(a) = 1. Therefore, we could only have Lv(a) < Rv(a), when a reaches so far to the right, such that it is adjacent to li−2(v). However, in this case a would reach further to the left than li−1(v), because a is adjacent to ri−1(v) and li−1(v) is "at most" adjacent to ri(v). Because li−1(v) is the left vertex of li−2(v) this contradicts Theorem 3.6. Thus, Corollary 3.13 implies ∀a ∈ A : rv ∈ F(v, a). (2) Now we go through L beginning at L (T (β(ri−1(v))) = H(C (β(ri−1(v)))),9 in other words, we begin at the first vertex after the "last" vertex in A, until we eventually come across a vertex u that either is li−1(v) or adjacent to li−1(v).10 We define B =]T (β(ri−1(v))), u[L i.e. B is the set of vertices after T (β(ri−1(v))) and before u in L . Note that, by the choice of u, no vertex in B is adjacent to li−1(v). Assume there is a vertex x ∈ B that is not adjacent to ri(v). When we go through C beginning at α(ri−1(v)) we eventually come across β(ri−1(v)) (since ri(v) and ri−1(v) are adjacent, we have α(ri(v)) ∈ [α(ri−1(v)), β(ri−1(v))]C ). Before we come across α(x), we come across β(ri(v)), since otherwise x and ri(v) would be adjacent. We do not come across α(li−1(v)) until we came across β(x), since otherwise x and li−1(v) would be adjacent. It follows that li−1(v) and ri(v) are not adjacent and, because li(v) is adjacent to li−1(v) and ri(v), it follows that li(v) reaches further to the right than ri(v). Because li(v) and ri(v) are adjacent, α(li(v)) must appear in [α(ri(v)), β(ri(v))]C . It cannot appear in [α(ri(v)), β(ri−1(v))]C , because then li(v) is adjacent to ri−1(v), which contradicts Definition 3.11, since li(v) reaches further to the right than ri(v) and 8It follows that l2(v) is the left vertex of the left vertex of v and r2(v) is the right vertex of the right vertex of v, etc. 9This equality holds by Corollary 3.4. 10This vertex u may be li(v). Also there may be vertices in A that are adjacent to li−1(v), in other words, we may have "passed by" a vertex that is adjacent to li−1(v) already. 12 Ai−2i−1l (v)r (v)i−2ir (v){u{i−1r (v)CBl (v) ri(v) is the right vertex of ri−1(v). Therefore, we have α(li(v)) ∈ ]β(ri−1(v)), β(ri(v))]C . Because we came across β(ri(v)) before α(x), we have ]β(ri−1(v)), β(ri(v))]C ⊂ ]β(ri−1(v)), α(x)[C and, therefore, α(li(v)) ∈ ]β(ri−1(v)), α(x)[C . (3) Since the vertices in L are primary ordered by their left clique, Inclusion (3) implies li(v) ∈ [H(C (β(ri−1(v)))), x]L . (4) Remember that we began at H(C (β(ri−1(v)))) to go through L until we found a vertex u that is adjacent to li−1(v). Inclusion (4) implies that we must have come across li(v) before x. But then we have u = li(v). Since x /∈ [H(C (β(ri−1(v)))), li(v)[L = [L (T (β(ri−1(v)))), u[L = B contradicts the initial assumption, every vertex in B is adjacent to ri(v). Since by the choice of u no vertex in B is adjacent to li−1(v), we have ∀b ∈ B : Lv(b) ≥ i = Rv(b), which, by Corollary 3.13, implies (5) We define sv = L −1(u). Since the ring-intervals A and B appear consecutively in L , by Con- struction 2.3, we have ∀b ∈ B : rv ∈ F(v, b). A ∪ B = ]mv, u[L = ]mv, sv]L . (6) (7) From (2), (5), and (6) it follows ∀w ∈]mv, sv] : rv ∈ F(v, w). Since the vertices in L are primary ordered by their left cliques, no vertex w ∈ [H(C (β(ri−1(v)))), li−1(v)]L is adjacent to ri−1(v) and therefore we have Rv(w) ≥ i. We define C =]sv, li−1(v)[L i.e. C is the set of vertices after sv and before li−1(v) in L . Note that B, C ⊆ [H(C (β(ri−1(v)))), li−1(v)]L . We have (8) since otherwise u = L (sv) would reach further to the left than li(v) although both are adjacent to li−1(v) and li(v) is the left vertex of li−1(v). This would contradict Theorem 3.6. It follows ∀c ∈ [α(L (sv)), α(li−1(v))]C : li(v) ∈ c which, by Corollary 3.13, implies ∀c ∈ C : Lv(c) ≤ i ≤ Rv(c), ∀c ∈ C : lv ∈ F(v, c). Obviously we have ∀w ∈ [li−1(v), lv[L : lv ∈ F(v, w). By Construction 2.3, we have C ∪ [li−1(v), lv[L =]sv, lv[L and therefore (9) and (10) imply ∀w ∈]sv, lv[L : lv ∈ F(v, w). 13 (9) (10) (11) The statement follows from (7) and (11). (cid:3) In Section 3.3.1 we assigned [lv, x]L to directed edge (v, lv) for some vertex x to the left of v. If ]sv, lv[L is assigned to directed edge (v, lv) additionally (as implied by Theorem 3.15) the intervals on directed edge (v, lv) can be compressed. Therefore, if neither dominating vertices nor counter vertices exist, v given L suffices a shortest path 2-SIRS, but only (v, rv) is assigned two ring-intervals. Below Definition 3.11 we stated that v given L suffices a shortest path 1-SIRS, if we can choose rv = lv or rv = mv. This is the case because then the ring-intervals assigned to directed edge (v, rv) can be compressed as well. Theorem 3.16 covers a further case where v given L suffices a shortest path 1-SIRS. Since Theorem 3.16 is not essential for the proof of Theorem 3.1, we leave the proof to the interested reader. Theorem 3.16 Let (X, C ) be a clique-cycle for a circular-arc graph G = (V, E), L given by Listing 1, v ∈ V not a dominating vertex, lv the left vertex of v, and mv the middle vertex of v. If mv is adjacent to every vertex face-to-face with v that lv is not adjacent to, v suffices a shortest path 1-SIRS. 3.3.2.2 Dominating Vertices or Counter Vertices exist In the foregoing section the ex- istence of dominating and counter vertices was excluded and is therefore discussed in this section. The vertices to be distributed are those face-to-face with v, i.e., the vertices in Bv. By Theorem 3.9, the only vertices in Bv that are adjacent to v are dominating vertices; this case is considered first. Next, the case where dominating vertices not face-to-face with v or counter vertices of v exist is addressed. Finally, the case where a pair of counter vertices exists (but v has no counter vertex) is discussed. Dominating Face-to-Face Vertices exist Listing 1 ensures that all dominating vertices appear consecutively in L , wherefore we can find two dominating vertices dl and dr such that [dl, dr]L = D(G). Let x ∈ V such that ]mv, x]L = Bv. Since by Theorem 3.9, D(G) are the only vertices in Bv that are adjacent to v, we can assign ]mv, dl]L to directed edge (v, dl), [dr, x]L to directed edge (v, dr), and for the remaining dominating vertices di ∈ ]dl, dr[, [di, di]L to directed edge (v, di). It follows that v given L suffices a shortest path 1-SIRS. Dominating Face-to-Face Vertices do not exist If there are no dominating vertices in Bv, Theorem 3.9 implies that no vertex in Bv is adjacent to v. Therefore, by Corollary 2.7, every vertex that is a counter vertex of v is adjacent to every vertex in Bv. Let u ∈ C(v) ∪ D(G) and w ∈ Bv. Then u is a first vertex from v to w, wherefore we can assign ring-interval Bv to directed edge (v, u), which had hitherto one ring-interval assigned. Thus, v given L suffices a shortest path 2-SIRS, wherein only directed edge (v, u) has two ring-intervals assigned. By Theorem 3.16, v given L suffices a shortest path 1-SIRS, if mv ∈ C(v) ∪ D(G). Pairs of Counter Vertices Exist but v is in none of them Assume G does not contain dominating vertices and the considered vertex v has no counter vertices but there exists at least one pair (w, cw) of counter vertices. We have Bv = ]mv, lv[L and no vertex in Bv is adjacent to v. We make a distinction of cases for whether v is adjacent to one or to both counter vertices. Assume v is adjacent to w as well as cw. There is a clique c ∈ X that contains v, w, and cw. When we begin at c to go through C , we eventually reach a clique d that contains only one of w or cw and not the other. Without loss of generality, let w be contained in d and let e be the first clique that contains cw again. e is the left clique of cw and contains lv (we might have cw = lv), as otherwise, cw would reach further to the left than lv, which contradicts Theorem 3.6. Since w and cw are counter vertices, all cliques we came across contained w. Since the vertices in L are primary ordered by their left cliques and we also must have traversed β(v), which contains mv, every vertex in Bv = ]mv, lv[L appeared in at least one of the cliques we came across. 14 Therefore, w is adjacent to every vertex in Bv. Since Iv hitherto maps directed edge (v, w) to one ring-interval, we can assign Bv to directed edge (v, w). Thus, v given L suffices a shortest path 2-SIRS, wherein only directed edge (v, w) is actually mapped to two ring-intervals. Now assume v is adjacent to one of the counter vertices and not to the other. Without loss of generality, let this vertex be w. Let r be a vertex adjacent to v that, similar to Definition 3.11, reaches farthest to the right. Since, by Theorem 3.6, lv is one of the vertices adjacent to v that reaches farthest to the left, lv as well as r are adjacent to cw. In fact, we might have w = lv or w = r. Let mr be the middle vertex of r and Ar = ]r, mr]L the set of vertices to the right of r. Ar is not empty, since otherwise G would be an interval graph. Also mv is contained in Ar, if r (cid:54)= mv. By Theorem 3.9, every vertex in Ar is adjacent to r. Consider we go through L beginning at L (mv) until we reach mr or lv. If we have lv = mr, we consider it as reaching lv. If we first reach lv, we exactly traversed the vertices in ]mv, lv]L ⊆ Bv. It follows that we have Bv ⊆ Ar and thus assign Bv =]mv, lv[L to directed edge (v, r). Now assume we first reach mr. By Theorem 3.9, every vertex in ]mv, mr]L ⊆ Ar is adjacent to r, wherefore we can assign ]mv, mr]L to directed edge (v, r). If L (mr) = lv, all vertices in Bv are distributed. Otherwise let X =]mr, lv[L ⊂ Bv be the vertices left to be distributed. Since, by Theorem 3.6, lv is a vertex adjacent to v that reaches farthest to the left and lv is adjacent to cw, for every vertex u ∈ X either (v, lv, u) or (v, lv, cw, u) is a shortest path. Thus, we can assign X to directed edge (v, lv) (and compress the two intervals on this edge), wherefore all vertices are distributed and only directed edge (v, r) is assigned two ring intervals. 4 Improving the Space Requirement This section shows that although circular-arc graphs do not allow shortest path 1-IRSs in general, the number of intervals in a shortest path 2-SIRS for a circular-arc graph is bounded close to the number of intervals in an 1-IRS. Let Gd = (V, A) be the directed symmetric version of a strict circular-arc graph. A shortest path 2-SIRS for Gd can be obtained by ordering the vertices of Gd according to Listing 1 and then labeling the outgoing directed edges of every vertex according to Section 3.3.1 and 3.3.2. As pointed out in these sections, there is at most one outgoing edge per vertex that is assigned two intervals. We have V ≤ A/2, since G is a strict circular-arc graph, and V = A/2 only holds when G is a ring in which case our labeling yields a shortest path 1- SIRS. Therefore, the number of intervals in the constructed 2-SIRS is less than A+V = 1.5·A, while already a 1-IRS for Gd permits up to A intervals. 5 Implementation This section outlines how the interval routing scheme implied by the proof of Theorem 3.1 can be implemented. Let G = (V, E) be a circular-arc graph with V = n and E = m and (X, C ) be a clique-cycle for G with X = c maximal cliques (X does not need to contain sets of vertices; plain elements representing the cliques are sufficient). We discuss how the vertex order L and the critical vertices lv, mv, rv, sv for every vertex v ∈ V can be determined in O(c + n2) time. We assume that every vertex v ∈ V has a pointer α(v) to its left clique and a pointer β(v) to its right clique in X. We define broadness of a vertex v as the number of cliques in X that contain v. By numbering the elements in X as they appear in C , beginning at an arbitrary element, we construct a bijective mapping N : X → {1, 2, . . . ,X}, which allows to compute the broadness of a vertex in O(1) time. Sorting the vertices ascending by their broadness requires O(n · log(n)) time. We introduce a list Q(c) for every clique c ∈ X. Next the vertices are traversed in the sorted order and every vertex v is added to list Q(α(v)). By concatenating the lists as their respective cliques appear in C we obtain the vertex order L in O(n · log(n)) time. The left vertex lv of a given vertex v ∈ V can be determined as follows: we inspect all vertices that are adjacent to v and store the vertex w that reaches farthest to the left (for two adjacent vertices w, w(cid:48), we can determine in constant 15 time which one reaches further to the left, by considering N (α(w)) and N (α(w(cid:48)))) and appears first in Q(α(w)) (this can also be decided in constant time, by numbering the elements in each list consecutively). Vertex w must be lv. It follows that the set of left vertices can be computed in O(m) time. The set of right vertices can be computed in similarly. Determining the set of middle vertices is simpler and can be accomplished in O(n). For a given vertex v, li(v) and ri(v) can be determined by traversing the sequences l1(v), l2(v), . . . and r1(v), r2(v), . . . synchronously; then the determination of sv is a simple task and can be done in O(n) for a specific vertex and in O(n2) for all vertices. Since the algorithm includes constant time operations on the elements in X and X = c is linear within the number of vertices, the overall runtime is O(c + n2 + m) = O(n2). The algorithm can be extended to handle the existence of dominating and counter vertices without exceeding this time bound. 6 Conclusions We showed that the class of circular-arc graphs has strict compactness 2. Throughout the proof special cases of strict circular-arc graphs that allow 1-SIRSs were highlighted (not all cases were pointed out for the sake of brevity), which is in particular interesting, since the class of circular-arc graphs is a super-class of the class of interval and unit circular-arc graphs, which always allow 1-SIRSs. We showed that the constructed 2-SIRS requires a number of intervals that is closer to the maximal number of intervals in an 1-IRS than in a 2-IRS. An open question is, if strict circular-arc graphs exist that allow 1-SIRS but the vertex ordering generated by Listing 1 does not allow these. References [BK97] Binay K. Bhattacharya and Damon Kaller. An O(m + n · log(n)) algorithm for the maximum-clique problem in circular-arc graphs. Journal of Algorithms, 25(2):336 -- 358, 1997. [BLS99] Andreas Brandstadt, Van Bang Le, and Jereny P. Spinrad. Graph Classes: A Survey. Society for Industrial and Applied Mathematics (SIAM), Philadelphia, 1999. [BvLT91] Erwin M. Bakker, Jan van Leeuwen, and Richard B. Tan. Linear interval routing. The Computer Journal, 30:298 -- 307, 1991. [CFZ08] Gabrio Caimi, Martin Fuchsberger, and Rico Zenklusen. About maximal cliques in a certain class of circular-arc graphs. Working paper, Institut fur Operations Research, ETH Zurich, CH-8092 Zurich, 2008. [DL02] Feodor F. Dragan and Irina Lomonosov. New routing schemes for interval, circular-arc, and permutation graphs. In IASTED PDCS'02, pages 78 -- 83, 2002. [DYL06] Feodor F. Dragan, Chenyu Yan, and Irina Lomonosov. Collective tree spanners of graphs. SIAM Journal on Discrete Mathematics, 20(1):241 -- 260, 2006. [EMZ02] Tamar Eilam, Shlomo Moran, and Shmuel Zaks. The complexity of the characterization of networks supporting shortest-path interval routing. Theor. Comput. Sci., 289:85 -- 104, 2002. [FG98] [FJ88] Pierre Fraigniaud and Cyril Gavoille. Interval routing schemes. Algorithmica, 21(2):155 -- 182, 1998. Greg N. Frederickson and Ravi Janardan. Designing networks with compact routing tables. Algorithmica, 3:171 -- 190, 1988. 16 [Fla97] Michele Flammini. On the hardness of devising interval routing schemes. Parallel Process. Lett, 7(1):39 -- 47, 1997. [Gav00] Cyril Gavoille. A survey on interval routing. Theoretical Computer Science, 245:785 -- 796, 2000. [GG98] Eric Guevremont and Cyril Gavoille. Worst case bounds for shortest path interval routing. Journal of Algorithms, 27:1 -- 25, 1998. [Gol04] Martin Charles Golumbic. Algorithmic Graph Theory and Perfect Graphs (Annals of Discrete Mathematics, Vol 57). North-Holland Publishing Co., Amsterdam, The Nether- lands, 2004. [GP98] Cyril Gavoille and David Peleg. The compactness of interval routing for almost all graphs. In Proceedings of Internat. Symp. on Distributed Computing (DISC), volume 1499 of Lecture Notes in Computer Science, pages 161 -- 174. Springer Verlag, 1998. [GP08] Cyril Gavoille and Christophe Paul. Optimal distance labeling for interval graphs and related graph families. SIAM Journal on Discrete Mathematics, 22(3):1239 -- 1258, 2008. [Hsu95] Wen-Lian Hsu. O(m · n) algorithms for the recognition and isomorphism problems on circular-arc graphs. SIAM Journal of Computing, 24:411 -- 439, 1995. [LS09] Min Chih Lin and Jayme L. Szwarcfiter. Characterizations and recognition of circular- arc graphs and subclasses: A survey. Discrete Mathematics, 309(18):5618 -- 5635, 2009. [McC03] Ross M. McConnell. Linear-time recognition of circular-arc graphs. Algorithmica, 37:93 -- 147, 2003. [NS96] Lata Narayanan and Sunil Shende. Characterizations of networks supporting shortest- path interval labeling schemes. 3rd Internat. Coll. on Structural Information and Com- munication Complexity (SIROCCO), pages 73 -- 87, 1996. [PU89] David Peleg and Eli Upfal. A trade-off between space and efficiency for routing tables. Journal of the ACM, 36(3):510 -- 530, 1989. [Rob76] Fred S. Roberts. Discrete mathematical models, with applications to social, biological, and environmental problems. Prentice-Hall, Englewood Cliffs, N.J., 1976. [SK82] [SK85] [TL99] Nicola Santoro and Ramez Khatib. Routing without routing tables. Technical Report SCS-TR-6 School of Computer Science, Carleton University, Ottawa, 1982. Nicola Santoro and Ramez Khatib. Labelling and implicit routing in networks. The Computer Journal, 28(1):5 -- 8, 1985. Savio S.H. Tse and Francis C.M. Lau. On the space requirement of interval routing. IEEE Transactions on Computers, 48:752 -- 757, 1999. [Tuc75] Alan Tucker. Coloring a family of circular arcs. SIAM Journal on Applied Mathematics, 29(3):493 -- 502, 1975. [Tuc80] Alan Tucker. An efficient test for circular-arc graphs. SIAM Journal of Computing, 9:1 -- 25, 1980. [vLT87] Jan van Leeuwen and Richard B. Tan. 30(4):298 -- 307, 1987. Interval routing. The Computer Journal, 17
1610.03788
1
1610
2016-10-12T17:00:21
Computing the Expected Value and Variance of Geometric Measures
[ "cs.DS" ]
Let P be a set of points in R^d, and let M be a function that maps any subset of P to a positive real number. We examine the problem of computing the exact mean and variance of M when a subset of points in P is selected according to a well-defined random distribution. We consider two distributions; in the first distribution (which we call the Bernoulli distribution), each point p in P is included in the random subset independently, with probability pi(p). In the second distribution (the fixed-size distribution), a subset of exactly s points is selected uniformly at random among all possible subsets of s points in P. This problem is a crucial part of modern ecological analyses; each point in P represents a species in d-dimensional trait space, and the goal is to compute the statistics of a geometric measure on this trait space, when subsets of species are selected under random processes. We present efficient exact algorithms for computing the mean and variance of several geometric measures when point sets are selected under one of the described random distributions. More specifically, we provide algorithms for the following measures: the bounding box volume, the convex hull volume, the mean pairwise distance (MPD), the squared Euclidean distance from the centroid, and the diameter of the minimum enclosing disk. We also describe an efficient (1-e)-approximation algorithm for computing the mean and variance of the mean pairwise distance. We implemented three of our algorithms and we show that our implementations can provide major speedups compared to the existing imprecise approaches.
cs.DS
cs
Computing the Expected Value and Variance of Geometric Measures Frank Staals Constantinos Tsirogiannis MADALGO∗ Aarhus University, Denmark [f.staalsconstant]@cs.au.dk Abstract Let P be a set of points in Rd, and let M be a function that maps any subset of P to a positive real number. We examine the problem of computing the exact mean and variance of M when a subset of points in P is selected according to a well-defined random distribution. We consider two distributions; in the first distribution (which we call the Bernoulli distribution), each point p ∈ P is included in the random subset independently, with probability π(p). In the second distribution (the fixed-size distribution), a subset of exactly s points is selected uniformly at random among all possible subsets of s points in P . This problem is a crucial part of modern ecological analyses; each point in P represents a species in d-dimensional trait space, and the goal is to compute the statistics of a geometric measure on this trait space, when subsets of species are selected under random processes. We present efficient exact algorithms for computing the mean and variance of several geometric measures when point sets are selected under one of the described random distributions. More specifically, we provide algorithms for the following measures: the bounding box volume, the convex hull volume, the mean pairwise distance (MPD), the squared Euclidean distance from the centroid, and the diameter of the minimum enclosing disk. We also describe an efficient (1 − ε)-approximation algorithm for computing the mean and variance of the mean pairwise distance. We implemented three of our algorithms: an algorithm that computes the exact mean volume of the 2D bounding box in the Bernoulli distribution, an algorithm that computes the exact mean and variance of the MPD for d-dimensional point sets in the fixed-size distribution, and an (1 − ε)-approximation algorithm for the same measure. We conducted experiments where we compared the performance of our implementations with a standard heuristic approach used in ecological applications. We show that our implementations can provide major speedups compared to the standard approach, and they produce results of higher precision, especially for the calculation of the variance. We also compared the implementation of our exact MPD algorithm with the corresponding (1 − ε)-approximation method; we show that the approximation method performs faster in certain cases, while also providing high-precision approximations. We thus demonstrate that, as an alternative to the exact algorithm, this method can also be used as a reliable tool for ecological analysis. ∗Center for Massive Data Algorithmics, a Center of the Danish National Research Foundation. 1 Introduction Motivation. Scientists in Ecology are devoted to the study of ecosystems and the processes that make these systems viable. Among other properties, ecologists are interested in measuring the biodiversity of an ecosystem: the diversity of the species that live inside the ecosystem. There are different ways to express this diversity, and therefore different measures for evaluating it. These measures are functions that map the set of species living in the ecosystem to a positive real number. One of the most important categories of diversity measures are functional diversity measures; these measures evaluate the diversity of functional traits that are observed within a set of species[18, 15, 20]. More formally, let S be the set of species that appear in an ecosystem that we want to examine. For each species in S, ecologists measure the values of d different traits e.g. body mass, the latitude where this species is commonly observed etc.. In this way, each species in S can be represented as a point in d-dimensional space. For simplicity, from hereon we use S to denote the d-dimensional point set representing the species of the ecosystem. Given the point set S, a functional diversity measure M is a real-valued function which measures a geometric property of S. For example, one of the most popular functional measures used by ecologists is the volume of the convex hull of S [5]. Another frequently used measure is the so-called Mean Pairwise Distance (MPD), which is equal to the average Euclidean distance among all distinct pairs of points in S [21]. Whichever measure M is used, in most ecological applications it is not enough just to compute the value M (S) on the examined point set S. It is also important to determine if M (S) is significantly larger or smaller than the value of this measure for a randomly selected set of species. The result of this comparison could indicate if there is a special reason why the species in S appear together in the same ecosystem, or their co-existence resembles the result of a random process. More specifically, let P ⊇ S be a point set in Rd representing a universal pool of species that we want to consider. To measure the significance of the value of M for a specific set S, ecologists want to estimate the distribution of M (S(cid:48)), where S(cid:48) is a subset of P selected according to a random distribution. To do this, they usually calculate the expected value and the variance of M (S(cid:48)). Based on these two values, they can then decide if the observed set of species S is special, with respect to M , compared to a set resulting from a random process. To calculate the expected value and variance of M (S(cid:48)), we first need to define the distribution based on which we select a random point set S(cid:48). We consider two of the most popular distributions that appear in ecological applications: the Bernoulli distribution and the fixed-size distribution. In the Bernoulli distribution, each point p ∈ P is associated with a probability value π(p); this value represents the abundance of the corresponding species in the real world. To produce a random set S(cid:48) according to the Bernoulli distribution, each point p is selected for inclusion to S(cid:48) by performing an independent Bernoulli trial with probability of success π(p). In the fixed-size distribution a subset of exactly s points is selected from P , and all possible subsets of s species can be selected with equal probability. The size s of the subset equals the number of species of the observed community S that is examined. Note that, unlike in the Bernoulli distribution, the selection of each point in the fixed-size distribution is not statistically independent. Computing the statistics of a geometric measure M for the above random distributions can be a hard computational task. So far, ecologists have been calculating these statistics using a crude heuristic approach; first, a large number of point samples (typically, at least a thousand) is produced based on one of the above distributions. Then, the value of the examined measure M is calculated for each of these samples, and finally an estimation of the mean and the variance of M is derived based on these calculations. This heuristic approach has two main disadvantages. First, it does not provide any approxi- mation guarantee between the calculated mean and variance and the actual statistics of M for the chosen random distribution. Second, it is often very slow in practice since it requires to compute the value of M for a large number of samples. Hence, this crude method is a major 1 obstacle for conducting reliable ecological analyses, let alone to process a large amount of species data. Therefore, there is the need to design efficient algorithms which can calculate exactly the expected value and variance of standard geometric functions over random point set distributions. More than that, it is important to derive robust implementations of these algorithms, that perform very fast when applied on real ecological datasets. Such implementations would improve the quality of the analysis that is presented in ecological case studies, and thus lead to more accurate conclusions on the properties of ecosystems. Our Results. We present algorithms that compute the exact statistical moments of several geometric functions on random point sets selected either under the Bernoulli or the fixed-size distribution. In particular, given a set of n input points we describe: • An O(n log n) time algorithm that computes the expected bounding-box volume for a set of points in R2, selected under the Bernoulli distribution (Section 3). The algorithm can be extended to compute the mean bounding-box volume for points in Rd in O(nd−1 log n) time. • An O(nd log n) time algorithm that computes the mean of the convex hull volume for a set of points in Rd selected either under the Bernoulli or the fixed-size distribution (Section 4). • An O(n) time algorithm that computes the mean and variance for the squared Euclidean distance of the points in a subset S ⊂ Rd from the centroid of S, when S is selected under the fixed-size distribution (Section 5). • An O(n log n + n/εd) time (1 − ε)-approximation algorithm that computes the mean and variance of the mean pairwise distance for a set of points in Rd selected under the fixed-size distribution (Section 6). These statistics can be computed exactly in O(n2) time. • An O(n3 log n) time algorithm that computes the mean diameter of the smallest enclosing disk for a set of points in R3, selected under either distribution (Section 7). We implemented some of the above algorithms, and evaluated their performance on both artificial and real species data (Section 8). More specifically, we implemented the algorithm that computes the mean volume of the 2D bounding box, and the exact and approximate algorithms that compute the mean and variance of the MPD. We compare our algorithms with the heuristic sampling method currently used by ecologists. These experiments show that our implementations can be much faster than the sampling approach, while providing guarantees on the quality of the resulting output. Our implementations were developed in C++ and are publicly available through github [19]. Related Work. There have been several papers in Algorithms that study geometric structures on stochastic point sets [1, 6, 17], yet most of these do not examine the exact computation of the statistical moments of geometric measures. Jørgensen et al. [10] study the problem of computing the distribution of geometric measures on a finite set of points, where each point can be in one out of k given positions with certain probability. Loffler and Phillips [13] present algorithms that approximate the distributions of answers for problems like the minimum enclosing ball radius, when the location of the input points is provided in the form of a distribution. Li et al. [12] study the existence and extraction of core sets to approximate the expected diameter of a sample of points selected under a random distribution. One of the distributions they consider is the Bernoulli distribution (which they refer to as the "existential model"). Huang and Li [9] present approximation algorithms for several related problems, some of which are known to be #P-hard. 2 Definitions and Notation Let P be a set of n points in Rd, where d is a constant. For ease of description, we assume that P is in general position; no pair of these points share the same coordinate, and for any natural number k ≤ d there does not exist any subset of k + 1 points in P that lie on the same (k − 1)-dimensional hyperplane. Let M be a function that maps any set S of points in P 2 (cid:88) to a positive real number; for example, M (S) is the volume of the convex hull of S. We call such a function a measure of S. Consider that we select a subset S from P based on a given random distribution. We study the problem of computing the exact expected value E[M (S)] and variance V[M (S)] for several measures M of S. The expectation of M (S) is defined as M (Q) · P[S = Q], where S is a random variable, and P[S = Q] is the probability E[M (S)] = that the subset of points Q is selected according to the described distribution. The variance a subset of P . We use π(Q) =(cid:81) set Q, and π(Q) =(cid:81) of M (S) is equal to E[M 2(S)] − E[M (S)]2. In the Bernoulli distribution, each point in P is associated with a probability value. For a point p in P , we denote this value by π(p). Let Q be p∈Q π(p) to denote the probability of selecting all points in the p∈Q(1 − π(p)) to denote the probability of not selecting any point in Q. Q⊆P 3 The Volume of the Bounding Box Let S be a subset of points in P , and let BB(S) denote the volume of the bounding box of S. In this section we describe efficient algorithms for computing the expected value of BB(S) when S is selected under the Bernoulli distribution. We begin with the case where P ⊂ R2; for this case, we present an algorithm that runs in O(n log n) time. Let p be a point in R2. We use px and py to denote the x and y coordinates of p, respectively. We have that (cid:20)(cid:18) (cid:21) (cid:20) E[vol(BB(S))] = E max p∈S (cid:20) − E px − min q∈S qx ry − min t∈S ty = E max p∈S px · max r∈S ry max p∈S px · min t∈S ty min q∈S qx · max r∈S ry (cid:19)(cid:21) (cid:21) (cid:20) + E (cid:21) min q∈S qx · min t∈S ty . (1) We focus on computing the term E[maxp∈S px · maxq∈S qy]. The other three terms can be computed in a similar manner. We have (cid:19)(cid:18) (cid:21) max r∈S (cid:20) − E (cid:20) (cid:21) (cid:20) (cid:21) (cid:88) p,q∈P E max p∈S px · max q∈S qy = pxqy · P px = max r∈S rx and qy = max t∈S ty . (2) x (p) be the points that have a larger x-coordinate than p. Similarly, let P + Let P + y (p) be the points with a larger y-coordinate than p. We also use P +(p, q) to denote the set of points that have both a larger x-coordinate than p and a larger y-coordinate than q. The probability value in Eq. (2) is equal to the probability that p and q are selected in S, and there is no point in S that has either a x-coordinate larger than px or a y-coordinate larger than qy. The set of points that violate the latter condition are the points in P in P + x (p) ∪ P + y (q). Lemma 1. Let S be a subset of P selected according to the Bernoulli distribution. We have (cid:88) (cid:88) p∈P g∈P (cid:88) q∈P −x (p)∪P + y (p) qy · π(q) · π(P + y (q)) · 1 π(P +(p, q)) + (3) gxgy · π(g) · π(P + x (g) ∪ P + y (g)) . E[max p∈S px · max q∈S qy] = px · π(p) · π(P + x (p)) Proof. We consider two cases; in the first case, the point that has the maximum x-coordinate in S is different than the point in S with the maximum y-coordinate. In the second case, it is the same point in S that has both the maximum x and y coordinates in this set. Based on this distinction, we can rewrite Eq. (2) as: 3 (cid:20) E (cid:21) max p∈S px · max q∈S qy = (cid:88) (cid:88) p,q∈P p(cid:54)=q g∈P pxqy · P (cid:20) gxgy · P (cid:20) px = max r∈S rx and qy = max t∈S (cid:21) (cid:21) ty + (4) gx = max u∈S ux and gy = max v∈S vy . We continue by expanding further the probability values that appear in the last equation. Let p and q be two distinct points in P . The probability that p has the maximum x-coordinate and q has the maximum y-coordinate in S is zero if either q ∈ P + y (q). Otherwise, this probability is equal to the probability of selecting p and q times the probability of not selecting any point in P + x (p) or p ∈ P + y (q). In the latter situation, we get: (cid:20) P x (p) ∪ P + (cid:21) px = max r∈S rx and qy = max t∈S ty =π(p) · π(q) · π(P + x (p) ∪ P + y (q)) = π(p) · π(q) · π(P + x (p)) · π(P + y (q)) · 1 π(P +(p, q)) . For a single point p ∈ P , the probability that p has the maximum coordinate in S both for x and y is: (cid:20) P (cid:21) px = max r∈S rx and py = max t∈S ty = π(p) · π(P + x (p) ∪ P + y (p)) . The lemma follows by combining the two last equations with Eq. (4). p∈P (cid:88) q∈P −x (p)∪P + y (p) Our next step is to design an efficient method for evaluating the quantities that appear in the statement of Lemma 1. Given that, it is then straightforward to derive an efficient algorithm for computing the expected volume of the bounding box under the Bernoulli distribution. We continue by breaking the formula at the right side of Eq. (3) into simpler quantities. In particular, we can rewrite this formula to E[max p∈S (A(p) · B(p) + C(p)) , where px · max q∈S (cid:88) qy] = A(p) = px · π(p) · π(P + x (p)) , B(p) = qy · π(q) · π(P + y (q)) · 1 π(P +(p, q)) , and C(p) = pxpy · π(p) · π(P + x (p) ∪ P + y (p)). We can compute A(p) for every p ∈ P in O(n log n) time in total in the following manner; we first sort the points in P in decreasing x-coordinate, and then we calculate value π(P + x (q)) for each point q based on the corresponding quantity of its predecessor in this order. However, quantities B(p) and C(p) are more complicated, and we have to follow a more involved approach. Yet, we can prove that these values can be computed for all points in P in O(n log n) time in total. 4 Lemma 2. We can compute B(p) and C(p) for every p ∈ P in O(n log n) time in total. Proof. We begin by describing a method for computing values B(p) for every p ∈ P . We write B(p) as B(p) = q∈P −x (p)∪P + y (p) D(q) · 1 π(P +(p, q)) , (5) where D(q) = qy · π(q)· π(P + y (q)). We can then precompute all values D(q), q ∈ P in O(n log n) time in a similar way as we did with values A(p). Given these values, we proceed with the computation of B(p) for every p ∈ P based on Eq. (5). To do this, we use a data structure Tprod that we call the product tree. The tree Tprod is a persistent augmented balanced binary search tree that stores all points in P in order of increasing y-coordinate. Each leaf node v in Tprod stores exactly one point p = point[v] ∈ P , as well as a boolean field Let v be a node in Tprod. Let P (v) denote the set of points that are stored in the subtree of v, and let Marked(v) denote the set of points in P (v) for which field mark is set to true. Let lc[v] and rc[v] respectively denote the left and right child of v, if these children exist. Node v stores two real numbers iprod[v] and sprod[v]. If v is leaf node, then iprod is set to 1/(1 − π(point[v])) and sprod[v] = D(point[v]). If v is an internal node, these values are defined as follows: mark[v]. Initially, field mark[v] is set to false for all leaves in the tree. (cid:88) (cid:88) (cid:88) sprod[v] = q∈Marked(v) D(q) · 1 π(r∈P (v)\Marked(v) ) ry>qy , iprod[v] = 1 π(P (v) \ Marked(v)) . We can compute the values sprod[v] and iprod[v] in constant time based on the corresponding In particular, we have sprod[v] = sprod[lc[v]] · iprod[rc[v]] + fields of the node's children. sprod[rc[v]], and iprod[v] = iprod[lc[v]] · iprod[rc[v]]. The product tree supports two operations: Addmark(p) and Query(p). For a given point p, Addmark(p) sets the mark field of the corresponding tree leaf to true, and updates accordingly values sprod and iprod for every ancestor of this leaf. Let Marked(Tprod) denote the set of leaves/points in the tree that are currently marked. Given a point p, operation Query(p) returns the following quantity: sprod[Tprod](p) = q∈P + y (p)∩Marked(Tprod) D(q) · 1 π(P + y (p) \ Marked(Tprod)) . (6) Let p be a point in P , and suppose that the set of leaves currently marked in Tprod correspond exactly to those points whose x-coordinate is smaller than px. Then, for this configuration of Tprod, the value returned by Query(p) is equal to B(p). This observation is the key idea for using the product tree in calculating values B(p). We proceed now with describing how we can efficiently perform operation Query(p) for any given value yo; first, we split Tprod into two −(p) and T +(p) (note that this does not affect Tprod, as it is fully persistent). product trees T −(p) stores Tree T +(p) stores the points whose y-coordinates are strictly larger than py, and T the rest of the points. We then output the value of the field sprod stored at the root of T +(p); as it can be concluded from the definition of the product tree, this value is equal to the quantity that appears in Eq. (6). Given that the underlying structure of Tprod is a balanced binary tree, we can perform the described process for Query, but also operation Addmark in O(log n) time.1 1 We can also extract the value described in Eq. (6) in O(log n) time without splitting the tree; it suffices to locate the leaf that stores the successor of p, and then appropriately process the data stored on the path between this leaf and the root. 5 To compute values B(p) for every p ∈ P we work as follows; we first construct Tprod, and we sweep the points in P in order of increasing x-coordinate. For each point p that we process, we execute operation Addmark(p), and then Query(p). As outlined in our description for operation Query, at the moment that we process p the value returned from Query(p) is equal to B(p). Initializing the tree Tprod and sorting the points on increasing x-coordinate take O(n log n) time in total. The operations that we perform on the tree require O(log n) time for each point. It follows that we can compute B(p), for all points p ∈ P , in O(n log n) time in total. The product tree requires O(n) storage, and the lemma follows. Computing C(p) for every p ∈ P is quite simpler. Recall that C(p) = pxpy · π(p) · π(P + x (p) ∪ P + y (p)) . From the latter quantity, we see that computing C(p) fundamentally boils down to calculating π(P + x (p) ∪ P + y (p)). We can do that using a similar approach as with values B(p), except that the data structure T that we use supports a query operation Query(p) that returns the value π(P + y (p) \ Marked(T )). This structure is simpler than the product tree described above, and it is straightforward to prove that all of its operation can be supported in O(log n) time. From Lemmas 1 and 2, and based on the rest of the analysis that we present in this section, we conclude that value E[maxp∈S px · maxq∈S qy] can be computed for the Bernoulli distribution in O(n log n) time. Using this together with Eq. (1), we obtain: Theorem 3. Let P be a set of n points in R2, and let S ⊆ P be a random subset selected according to the Bernoulli distribution. We can compute E[vol(BB(S))] in O(n log n) time. In the appendix, we describe an algorithm that computes E[vol(BB(S))] under the Bernoulli distribution when P is a d-dimensional point set. This algorithm runs in O(nd−1 log n) time, and uses some of the techniques that we present for the 2D version of this problem. For completeness, we also provide in the appendix a description of a O(nd log n) algorithm for solving the d-dimensional version when subsets of points are selected according to the fixed-size distribution. 4 The Volume of the Convex Hull We next examine the problem of computing the expected volume of the convex hull for a sample of points S selected at random from a point set P ⊂ Rd. Let O denote the origin in Rd, and without loss of generality we consider that O falls outside the convex hull of the entire point set P . Let S be a subset of points in P , and let CH(S) denote the convex hull of S. Let F be a (d − 1)-dimensional facet of CH(S). We use SX(F ) to represent the d-dimensional simplex whose vertices consist of O and the vertices of F . We say that F is a lower facet of CH(S) if SX(F ) does not overlap with the d-dimensional volume in the interior of CH(S). Otherwise, we say that F is an upper facet of CH(S). Let UP(S) and LW(S) denote the sets of the upper and lower facets of CH(S) respectively. We get the next lemma. Lemma 4. Let vol(SX(X)) denote the volume of the d-dimensional simplex SX(X). We have (cid:88) (cid:88) vol(CH(S)) = vol(SX(F )) − vol(SX(K)). F∈UP(S) K∈LW(S) (7) Proof. Let T CH(S, O) denote the union of all the line segments Op where p is a point on a k-dimensional facet of CH(S) such that k < d − 1. Clearly, the d-dimensional volume of T CH(S, O) is zero. To prove the lemma, it suffices to show that a) every point in the interior of 6 (cid:88) vol(SX(F )) − K∈LW(S) vol(SX(K))] = (cid:88) E[vol(CH(S))] = E[ (cid:88) F∈UP(S) Z⊆P Z=d CH(S) − T CH(S, O) appears in the interior of exactly one simplex SX(F ) such that F ∈ UP(S), and b) every point in the interior of a simplex SX(K) such that K ∈ LW(S) appears in the interior of exactly one simplex SX(F ) such that F ∈ UP(S). We next prove argument (a), the proof for argument (b) is similar. Let p be a point in the interior of CH(S) such that p /∈ T CH(S, O). Consider the line (cid:96) that connects p and O. Since CH(S) is a convex set and p lies in the interior of CH(S) and p /∈ T CH(S, O), then (cid:96) intersects the boundary of CH(S) in exactly two points; one of these two intersections lies in the interior of a lower facet of the hull, and the other intersection lies in the interior of an upper facet F . By construction, p lies inside SX(F ) and this simplex is unique for p. Equation (7) expresses the volume of CH(S) as a sum of signed volumes, an approach which is similar to the ones of Lasserre [11] and Lawrence [3]. Let S be a randomly selected subset of point set P . Given the above description, and due to the linearity property of expectation, we can express the expected volume of the convex hull CH(S) of S as vol(SX(FZ)) · (P[FZ ∈ UP(S)] − P[FZ ∈ LW(S)]) (8) where FZ is the facet defined by the points in Z. The volume vol(SX(FZ)) is equal to det(SX(FZ))/d! , where det(X) is the Cayley-Menger determinant of simplex X, that is det(X) = det(v2 − v1, .., vd+1 − v1), where v1, .., vd+1 are the vertices of X. Since we consider that d is constant, we can compute the volume of a simplex in constant time, and thus we can compute the volumes of all simplices that appear in Equation (8) in O(nd) time in total. Hence, to calculate the expected volume of CH(S), it remains to compute for every subset Z of d points in P the probabilities P[FZ ∈ UP(S)] and P[FZ ∈ LW(S)]. We next describe how to compute P[FZ ∈ UP(S)] for all required subsets Z both in the fixed-size and the Bernoulli model. The probabilities P[FZ ∈ LW(S)] can be computed in a similar manner. Fixed-Size Distribution. We first consider the case where S is a set of s points selected according to the fixed-size distribution. In this case, we have P[FZ ∈ UP(S)] =(cid:0) nZ (cid:1)/(cid:0)n (cid:1), where nZ is the number of points that appear on the same side of (the hyperplane defining) FZ as the origin. Next, we show how to compute the values nZ, for all subsets Z of d points in O(nd log n) time. It then follows that we can compute E[vol(CH(S))] in O(nd log n) time as well. We fix a set Z(cid:48) ⊂ P of d − 1 points, and consider all hyperplanes defined by Z(cid:48), and one additional point from P . We order the hyperplanes by radially sorting the points in P \ Z(cid:48) "around" Z(cid:48). Each hyperplane (cid:1) = O(nd−1) defines a single candidate facet FZ(cid:48)∪{p}, and it is easy to maintain the number of points that lie on the same side of this hyperplane as the origin. It follows that we can compute all values nZ(cid:48)∪{p}, for all points p ∈ P \ Z(cid:48) in O(n log n) time. Since we have to consider(cid:0) n sets Z(cid:48) the total running time for computing E[vol(CH(S))] is O(nd log n). In case P is a set of points in R2 we can compute the radial order of the points in P \ {p} around p, for every point p ∈ P , in only O(n2) time in total, while still using O(n) space [16]. It then follows we can also compute E[vol(CH(S))] in O(n2) time. We obtain the following result. Theorem 5. Let P be a set of n points in Rd, and let S ⊆ P be a sample selected in the fixed-size model. We can compute E[vol(CH(S))] in O(nd log n) time, or O(n2) time when d = 2. Bernoulli Distribution. For the case where the point set S is selected according to the Bernoulli distribution, we have that P[FZ ∈ UP(S)] = π(Z) · π(CO Z), where CO Z denotes the set of d−1 s−d s 7 points that lie on a different side of FZ than the origin, that is the points from P on the "wrong side" of FZ. We can compute CO Z using a similar approach as with computing values nZ in the fixed-size distribution. We then obtain the following result. Theorem 6. Let P be a set of n points in Rd, and let S ⊆ P be a sample selected in the Bernoulli model. We can compute E[vol(CH(S))] in O(nd log n) time, or O(n2) time when d = 2. 5 The Mean Distance from the Centroid (cid:80) Let S be a set of points in Rd, and let c(S) = 1S p∈S p denote the centroid of S, that is, the point representing the coordinate-wise average of the points in S. Let δ be a distance measure in Rd. The mean centroid distance based on δ is equal to the mean value of δ between any point in S and c(S), that is CD(S) = 1S p∈S δ(p, c(S)). Next, we consider the case where δ is the squared Euclidean distance. For this case, we obtain the following result. (cid:80) Theorem 7. Let P be a set of n points in Rd, and let S ⊆ P be a random subset of s points, selected using the fixed-size distribution. We can compute E[CD(S)] and V[CD(S)] for all subset sizes s ≤ n in O(n) time in total. Proof. The expected value of the mean centroid distance for our sample S is . E[CD(S)] = E (c(S)i − pi)2 (c(S)i − pi)2 The expected value in the last quantity can be expanded as follows: (cid:88) p∈S E (c(S)i − pi)2  1 s (cid:88) d(cid:88) p∈S i=1 q∈S p∈S  = E (cid:88) (cid:88) (cid:88)  1 (cid:88) (cid:88) (cid:88) = E p∈S q∈S = E s 1 s p∈S q∈S pi qi (cid:88) p∈S E d(cid:88) i=1 1 s 2 (cid:34)(cid:88) (cid:88) (cid:34)(cid:88) (cid:88) r∈S t∈S 2 s E r∈S t∈S qi s  =  − pi 2 −  − (cid:88) 2 s qi E (cid:88) m∈P (cid:35) ri ti (cid:35) + E (cid:34)(cid:88) (cid:34)(cid:88) m∈S m2 i (cid:35) m2 i (cid:35) . (9) ri ti + E m∈S Notice that (cid:88) (cid:88) ri ti = 2 ri ti + m2 i . r∈S t∈S t,r∈P t(cid:54)=r Also, the probability that two points p and q are included in S is(cid:0)n−2 (cid:1)/(cid:0)n that a single point m appears in S is(cid:0)n−1 (cid:1)/(cid:0)n (cid:1), while the probability (cid:1). Based on these observations, we can expand s−2 s s−1 s 8 m2 i (cid:88) t∈S 1 s 1 − 1 s 1 − ri ti m∈S + E (cid:35) (cid:34)(cid:88) (cid:1) (cid:0)n−1 (cid:19)(cid:88) (cid:0)n (cid:1) (cid:1) (cid:19)(cid:0)n−1 (cid:1) (cid:88) (cid:0)n m∈P m2 i s−1 s−1 s s m∈P m2 i . (cid:35) (10) q∈P qi), and thus we can compute this term in Equation 9 as follows: s s E E 2 s 1 s 2 s s−2 s−2 r∈S q∈S p∈S pi qi pi qi pi qi + = − = − p,q∈P p(cid:54)=q p,q∈P p(cid:54)=q (cid:88)  − (cid:34)(cid:88) (cid:88) (cid:0)n−2 (cid:1) (cid:18) (cid:88) (cid:1) + (cid:0)n (cid:1) 2(cid:0)n−2 (cid:18) (cid:1) (cid:88) s(cid:0)n p∈P pi(−pi +(cid:80) pi qi =(cid:80) (cid:104)(cid:80) p∈S(c(S)i − pi)2(cid:105) 2 =  1 (cid:88) d(cid:88) 2 E (cid:88) d(cid:88) d(cid:88) (c(S)i − pi)2 p,q∈P p(cid:54)=q p∈S s2 i=1 i=1 j=1 p,q∈S p(cid:54)=q Observe that(cid:80) E[CD2(S)] = E = 1 s2 O(n) time. Clearly, the other term in Eq. (10) can also be evaluated in O(n) time. It follows that we can compute E , and thus E[CD(S)], in O(n) time as well. For the variance V[CD(S)] we use that V[X] = E[X 2] − (E[X])2, and thus we are interested in computing   .  (c(S)i − pi)2 (c(S)j − qj)2 (c(S)i − pi)2(c(S)j − pj)2 (11) E i=1 j=1 q∈S p∈S 1 s2 d(cid:88) d(cid:88) (c(S)i − pi)2 (c(S)j − qj)2 (cid:88) (cid:88)  + E (cid:88) (cid:104)(cid:80) p(cid:54)=q∈S (c(S)i − pi)2 (c(S)j − qj)2(cid:105)  (cid:88)  = E + p2 p∈S s2 ri + s 1 s E r∈S ri (cid:1)2 (cid:80) p,q∈S p(cid:54)=q p2 i − 2pi r∈S ri and get . The second term in (c(S)i − pi)2(c(S)j − qj)2 Next, we describe how to compute E Eq. 11, in which p = q, can be handled analogously. We use that (c(S)i − pi)2 =(cid:0) 1 (cid:80) (cid:88)  (cid:88) (cid:88) (cid:33)2 (cid:33)2 We can write this term as the sum of nine terms of the form E[(cid:80) (cid:32)(cid:88) p(cid:54)=q∈P A(p)B(q)], for some functions A and B. Next, we focus on the most complicated one, and show that we can evaluate this term in O(n) time. The remaining terms can be handled similarly. We have . (12) (cid:32)(cid:88) (cid:32)(cid:88)  1  1 (cid:33)2(cid:32)(cid:88) (cid:33)2(cid:32)(cid:88) (cid:33)2 . (cid:32)(cid:88) s(s − 1) j − 2qj i − 2pi  (cid:33)2 p,q∈S p(cid:54)=q + q2 m∈S (13) r∈S (cid:96)∈S t∈S mj mj mj 1 s 1 s s2 (cid:96)j ri ri ti E  = · E 2 r∈S m∈S r∈S m∈S (cid:88) p,q∈S p(cid:54)=q 9 We can expand the expected value that appears in the last quantity as follows : (cid:32)(cid:88) r∈S E ri (cid:33)2(cid:32)(cid:88) mj m∈S (cid:33)2 = (cid:88) (cid:88) (cid:88) (cid:88) r∈P g∈P m∈P t∈P gi ri mj tj · P[g, r, m, t ∈ S] . (14) We can expand this equation further by considering all possible cases for which g,r,m and t are either pairwise distinct or represent the same element. There can be fifteen different cases: one in which all four variables represent distinct points in P , six cases in which there is exactly one pair of variables representing the same point, etc. We continue with a description on how to efficiently compute one of these cases, the case where r = m and g = t. The other cases can be (cid:1)/(cid:0)n handled in a similar manner. In this case we have P[g, r, m, t ∈ S] =(cid:0)n−2 (cid:1) and s−2 s (cid:88) p∈P 2 (cid:88) p∈P − ri rj ti tj = pi pj i p2 p2 j . (cid:88) (cid:88) r∈P t∈P r(cid:54)=t We can compute these terms in O(n) time. It then follows that we can evaluate the term in Eq. 14, and thus also the term in Eq. 12 in O(n) time. This leads to an O(n) time algorithm for computing E[CD2(S)].2 (cid:1) where k is a constant. We can precompute all of these coefficients, for all naturals In all the quantities that we examine above, parameter s appears in binomial coefficients of the form(cid:0)n−k s−k s ≤ n, in O(n) time in total. After this preprocessing stage, we can extract the expected value and variance of CD(S) in constant time for any sample size s. 6 The Mean Pairwise Distance For a set of points S ∈ P , we call the mean pairwise distance of S the average Euclidean distance between any pair of points in S. We denote this value by MPD(S). More formally, we have (cid:88) MPD(S) = 2 s(s − 1) p,q∈S p(cid:54)=q (cid:107)pq(cid:107) , where (cid:107)pq(cid:107) denotes the Euclidean distance between p and q. We next describe exact and approximate algorithms for computing the expectation and variance of MPD(S) when S is selected according the fixed-size model from a point set P ∈ Rd. Simple Exact Algorithms for the Fixed-size Distribution. For the fixed-size distribution, we can express the expected value of the MPD as E[MPD(S)] = 2 (cid:107)pq(cid:107) · P[{p, q} ⊆ S] , (15) s(s − 1) p,q∈P p(cid:54)=q s s−2 where P[{p, q} ⊆ S] =(cid:0)n−2 (cid:1)/(cid:0)n (cid:1). This leads to a simple algorithm that computes E[MPD(S)] in O(n2) time: compute the Euclidean distance for each pair of points p, q ∈ P and multiply this distance value by the respective probability of choosing p and q in S. Notice that, in the same time asymptotically, it is easy to compute E[MPD(S)] for each possible subset size s. Computing the variance of MPD is slightly more involved, but can be done in O(n2) time as well. we can improve this to a linear dependence by "pushing in" the sum (cid:80)d (cid:80)d 2 The straightforward implementation is quadratic in the dimension d. However, it is easy to show that i,j until we get terms of the form (cid:80)d j(cid:54)=i pj =(cid:80)d i pi(−pi +(cid:80)d j pj). These can be evaluated in O(d) time. i pi (cid:88) 10 Theorem 8. Let P be a set of n points in Rd, and let S ⊆ P be a random subset of s points, selected under the fixed-size distribution. For any given natural s ≤ n, we can compute E[MPD(S)] and V[MPDS] in constant time after O(n2) preprocessing time. is a partition of the(cid:0)n (cid:1) pairs of points into pairs of point sets, such that for every such pair An (1−ε)-Approximation Algorithm. Next, we describe how to compute an (1−ε)-approximation for the expectation and variance of MPD(S) for the fixed-size distribution. Our approximation algorithm uses a distance MPDε(S) which is at least (1 − ε) times that of value MPD(S). More specifically, our algorithm uses a well-separated pair decomposition (WSPD) [4] of the points in P , and runs in O(n log n + n/εd) time. This decomposition can be described as follows; Let z be a positive real ≥ 1. A well-separated pair decomposition Wz(P ) of P with respect to z (A, B) ∈ Wz(P ), each of the sets A and B fits in a ball of radius r, and the distance between these balls is at least zr [4]. We call such a pair a well-separated pair. We refer to z as the separation-factor of Wz(P ). By choosing z = 4/ε, the distance δball(A, B) between the balls (cid:48)(A) and B (cid:48)(B) containing A and B becomes an (1 − ε)-approximation of the distance for B any pair of points a(cid:48) (cid:48)(B). Based on this observation, we consider the following (cid:48)(A), b(cid:48) function for a point set S ⊆ P : ∈ B ∈ B 2 (cid:88) (cid:88) MPDε(S) = 2 s(s − 1) p,q∈S (A,B)∈Wz(P ) p∈A,q∈B δball(A, B) Function MPDε(S) is an (1−ε)-approximation of MPD(S), therefore its expectation E[MPDε(S)] is an (1 − ε)-approximation of E[MPD(S)] . We can easily derive that E[MPDε(S)] is equal to 2(cid:0)n−2 (cid:1) s(s − 1)(cid:0)n s−2 s (cid:1) (cid:88) (A,B)∈Wz(P ) E[MPDε(S)] = ABδball(A, B) . From this last quantity, it is straightforward to conclude that computing E[MPDε(S)] boils down to constructing a well-separated pair decomposition of the desired separation factor. Using the algorithm of Callahan and Kosaraju [4], we can compute a well-separated pair decomposition of P with separation factor z in O(n log n + zdn). Since we set z = 4/ε, the running time of this algorithm becomes O(n log n + n/εd). We continue by describing an (1 − ε)-approximation algorithm for the variance of MPD(S). We need the following lemma. Lemma 9. If X is a (1 − ε)-approximation of Y , then V[X] is a (1 − 2ε)-approximation of V[Y ]. Proof. Let α be the exact value such that X = (1 − α)Y . Since X is a (1 − ε)-approximation of Y we have 0 < α ≤ ε. We then have (1 − 2ε)V[Y ] ≤ (1 − 2α)V[Y ] ≤ (1 − 2α + α2)V[Y ] = (1 − α)2V[Y ] = V[(1 − α)Y ] = V[X], and V[X] = V[(1 − α)Y ] = (1 − α)2V[Y ] < V[Y ]. Recall that MPDε(S) = 2 (cid:88) (cid:88) s(s − 1) p,q∈S (A,B)∈Wz(P ) p∈A,q∈B δball(A, B) , and that MPDε(S) provides an (1 − ε)-approximation of MPD(S). Based on Lemma 9, we get that the variance of function MPDε/2(S) is an (1 − ε)-approximation of V[MPD(S)]. Given this 11 observation, we can derive an efficient algorithm that calculates an (1 − ε)-approximation of V[MPD(S)] in O(n log n + n/εd) time. The (involved) description of this algorithm appears in the proof of the following theorem. Theorem 10. Let P be a set of points n in Rd, and let S be a subset of s points in P selected according to the fixed-size distribution. For any given natural s, we can compute (1 − ε)- approximations for the expected value E[MPD(S)] and the variance V[MPD(S)] of the mean pairwise distance of S in constant time after O(n log n + n/εd) preprocessing time. Proof. In Section 6, we already showed how to compute E[MPDε(S)], which is an (1 − ε)- approximation of E[MPD(S)]. Based on Lemma 9, we concluded that E[MPDε/2(S)] is an (1−ε)- approximation of E[MPD(S)]. We have V[MPDε/2(S)] = E[MPD2 ε/2(S)] − (E[MPDε/2(S)])2, and E[MPDε/2(S)] can be computed in the same way as E[MPDε(S)], in O(n log n + n/εd) time. Hence, we next focus on computing E[MPD2 ε/2(S)]. To do this, we construct a well-separated pair decomposition Wz(P ) with separation factor z = 4/(ε/2) = 8/ε. Let p and q be two points in P with p (cid:54)= q, and let (A, B) be the well- separated pair in Wz(P ) such that p ∈ A and q ∈ B. We use δball(p, q) to denote the value δball(A, B), that is the minimum distance between the ball enclosing A and and the ball enclosing B. We have E[MPD2 ε/2(S)] = 4 s2(s − 1)2 p,q∈P p(cid:54)=q r,t∈P r(cid:54)=t δball(p, q) · δball(r, t) · P[{p, q, r, t} ⊆ S]. We consider three cases for probability P[{p, q, r, t} ⊆ S], depending on whether set {p, q, r, t} consists of four, three, or two distinct elements. Based on that, we expand the last quantity as follows: (cid:88) (cid:88) (cid:32)(cid:0)n−4 (cid:1) (cid:1) (cid:88) (cid:0)n s−4 s p,q,r,t∈P p(cid:54)=q,r(cid:54)=t E[MPD2 ε/2(S)] = (cid:1) (cid:0)n−3 (cid:0)n−4 (cid:1) (cid:0)n (cid:1) s−3 s−4 − s + 4 s2(s − 1)2 (cid:88) p,q,r∈P p(cid:54)=q(cid:54)=r For the first sum in Eq. (16) we have δball(p, q) · δball(p, r) + (cid:33) δball(p, q)2 . (16) δball(p, q) · δball(r, t) = · E[MPDε/2(S)]2 . For the third sum in Eq. (16) we have δball(p, q)2 = δ2 ball(A, B) · A · B . (A,B)∈W(P ) (cid:88) p,q,r∈P p(cid:54)=q(cid:54)=r It is easy to show that the resulting two quantities can be calculated in O(n log n + n/εd) time. For the second sum in Eq. (16) we have δball(p, q) · δball(p, r) = δball(p, q) (cid:88) (cid:88) (G,C)∈W(P ) G(cid:51)p r∈C r(cid:54)=q δball(p, r) (17) (18) (cid:88) (cid:88) (cid:88) p∈P (A,B)∈W(P ) A(cid:51)p q∈B 12 (cid:88) p,q∈P p(cid:54)=q δball(p, q) · δball(r, t) s − s−4 s−2 (cid:0)n−4 (cid:1) (cid:0)n−2 (cid:1) (cid:0)n (cid:1) (cid:0)n−4 (cid:1) 4(cid:0)n−2 (cid:1) s2(s − 1)2 · s−2 (cid:88) s−4 (cid:88) p,q,r,t∈P p(cid:54)=q,r(cid:54)=t (cid:88) p,q∈P p(cid:54)=q (cid:88) (cid:88) (G,C)∈W(P ) G(cid:51)p r∈C r(cid:54)=q q∈B (cid:88) (cid:88) q∈B (A,B)∈W(P ) p∈P (cid:88) (cid:88) (cid:88) p∈P = = p∈P A(cid:51)p (cid:88) (cid:88)  (cid:88) A(cid:51)p (A,B)∈W(P ) (A,B)∈W(P ) A(cid:51)p δball(p, q) (G,C)∈W(P ) r∈C δball(p, r)   (cid:88) (cid:88) q∈B −δball(p, q) + (cid:88) 2 (G,C)∈W(P ) G(cid:51)p − (cid:88) (cid:88) r∈C (cid:88) G(cid:51)p (cid:88) δball(p, q) δball(p, r) − δ2 ball(p, q) Since every pair (p, r) occurs in exactly one well-separated pair (G, C), we have δball(p, r) = −δball(p, q) + δball(p, r) . (cid:88) (cid:88) (G,C)∈W(P ) G(cid:51)p r∈C Thus, we can expand further the quantity in the right side of Eq. 17 as B · δball(A, B) B · δ2 ball(A, B). (19) p∈P (A,B)∈W(P ) A(cid:51)p As it comes to the last quantity, the second double sum can be easily calculated in O(n/εd) time by processing each pair of the decomposition in constant time. It remains to describe how we can efficiently compute the first double sum in the last quantity, that is compute values: (cid:88) SUM(p) = B · δball(A, B) , (A,B)∈W(P ) A(cid:51)p k = B for which (P [v], B) ∈ W(P ). We represent the sum(cid:80) for every point p ∈ P . Let T be the split tree of the well-separated pair decomposition, and let node[p] denote the leaf node in T that represents point p ∈ P . Let v be a node in T . We use Anc[v] to denote the set of the ancestors of v in T . Let P [v] denote the subset of points in P that are represented by the subtree rooted at v. We use ms[v] to indicate the sum of all values u∈Anc[v] ms[u] by SUM[v]. It is obvious that SUM(p) = SUM[node[p]]. Hence, to compute SUM(p) for all points in P , it suffices to compute SUM[v] for all nodes in T . This can be done in O(n) time by a simple top-to-bottom traversal of T , assuming that we have already computed values ms[v] for every node v in the tree. The latter values can be computed easily in O(n log n + n/εd) time when constructing the decomposition. binomial coefficients of the form(cid:0)n−k s−k (cid:1), where k ≤ 4. We can precompute all these O(n) values Notice that parameter s appears in the above quantities either as a constant factor, or within for every possible s in O(n) time, separately from the three sums in Eq. (16). Thus, after this preprocessing stage, for any given s we can plug the appropriate coefficients in Eq. (16) and compute the (1 − ε)-approximation of the MPD variance in constant time. 7 Diameter of the Smallest Enclosing Disk Let D(S) denote the smallest enclosing disk of the set of points P , and let diam(D(S)) denote its diameter. We wish to compute the expected diameter of the smallest enclosing disk of S. That is, E[diam(D(S))]. The smallest enclosing disk of S is determined by either two or three points of this set. Let ∂D denote the circle bounding D, and let DA denote the disk that has the points in A on its boundary. Thus, we have E[diam(D(S))] = diam(D{p,q}) · P[D{p,q} = D(S)] + diam(D{p,q,t}) · P[D{p,q,t} = D(S)]. (cid:88) (cid:88) p,q,t∈P p,q∈P 13 Fig. 1: (a) The disks D(c), D(c(cid:48)), and D(cid:48) from Lemma 11. It follows that D(c)∩ (cid:96)+ ⊆ D(c(cid:48))∩ (cid:96)+. (b) The points t1, .., tn−2. The set of points in Di+1 differs by exactly one point from P ∩ Di. We can easily compute the expected diameter for all disks defined by two points in O(n3) time, so we focus on the case that the smallest enclosing disk is defined by three points, say p, q, and t. We show that we can compute the expected diameter for such disks in O(n3 log n) time. Consider two points p and q and assume without loss of generality that p and q lie on the y-axis, and such that the center m of D{p,q} corresponds to the origin. Let (cid:96) be the (vertical) line through p and q, and let (cid:96)− and (cid:96)+ denote the left and right half-plane defined by (cid:96), respectively. Observe that all disks D(c) whose boundary contains p and q, have their center c on the x-axis. Lemma 11. Let c and c(cid:48) be two points on the x-axis, with c left of c(cid:48). We have that D(c) ∩ (cid:96)+ is contained in D(c(cid:48)) ∩ (cid:96)+. Proof. Let t ∈ (cid:96)+ be a point on the boundary ∂D(c) of D(c). We show by contradiction that t ∈ D(c(cid:48)). Since D(c) ∩ (cid:96)+ and D(c(cid:48)) ∩ (cid:96)+ are convex, the lemma then follows. Let D(cid:48) be the disk that has center c(cid:48) and has t on its boundary (See Fig. 1(a)). Since t (cid:54)∈ D(c(cid:48)) the radius r(cid:48) of D(cid:48) must be larger than the radius of D(c(cid:48)), and thus p, q ∈ D(cid:48). By construction, t is an intersection point of D(cid:48) and D(c), and p, q lie on the boundary ∂D(c). Since c(cid:48) lies to the right of c, it follows that all points in D(cid:48) ∩ ∂D(c), in particular p and q, lie to the right of t. Thus, t lies to the left of p and q. Contradiction. monotonically as we shift c to the right. See Fig. 1(b) for an illustration. It follows from Lemma 11 that the set of points from P ∩ (cid:96)+ that lies in D(c) grows monotonically as we shift c to the right. Analogously, the set of points from P ∩ (cid:96)− shrinks Fix a pair of points p, q ∈ P . Let Tpq = t1, .., tn−2 be the points in P \ {p, q}, ordered by can compute compute F (p, q) =(cid:80)n−2 increasing x-coordinate of the center of D{p,q,t}, let Di = D{p,q,ti}, and let Si = Di ∩ P . We then have that Si+1 = Si ∪ {ti+1} or Si+1 = Si \ {ti+1}. We will show that in both distributions we i=1 diam(Di)·P[Di = D(S)] in O(n) time, given the sequence t1, .., tn−2. A straightforward implementation then uses O(n3 log n) time: for every pair p, q ∈ P , sort the remaining points in O(n log n) time and compute F (p, q). (cid:1)/(cid:0)n we have P[Di = D(S)] = (cid:0)n−2−Si (cid:1). Since Si+1 differs from Si by at most one point, Algorithms for the Fixed Size and Bernoulli Distributions. In the fixed-size distribution we can easily maintain this probability in constant time. Computing diam(Di), for any i, also takes constant time, as Di is defined by only three points. It follows that the total time for computing F (p, q) takes O(n) time in total. In the Bernoulli distribution we have P[Di = D(S)] = π({p, q, ti}) · π(P \ ({p, q} ∪ Si)). Again, since Si+1 differs from Si by at most one point, we can maintain this probability in constant time, and thus compute F (p, q) in O(n) time. We obtain the following result. s−2 s 14 D0D(c0)qptqptiti+1t1t2t3t4t5t6t13t7t8t11t12(a)(b)D(c)c0c'+'−Di+1Di Theorem 12. Given a set of n points in R2 we can compute the expected diameter of the smallest enclosing disk in O(n3 log n) time, in both the Bernoulli and the fixed-size distribution. 8 Experiments and Benchmarks We implemented three of our algorithms, and evaluated their performance in practice. In particular, we implemented the algorithm that computes the expected 2D bounding box volume under the Bernoulli distribution, and the exact and approximate algorithms that compute the expectation and variance of the MPD. As a point of reference, we also implemented the standard heuristic approach [2, 5] currently used in ecological case studies for calculating such values: select a large number of sample point sets according to the examined random distribution (typically a thousand samples), explicitly compute the value of the desired measure on each sample, and extract the mean and variance of these values. We refer to this method as the sampling method. We conducted different sets of experiments, where we measured the running time of our implementations for different values of the size n of the input point set P , the number of dimensions d, and the sample size s. For the MPD, we also measured the relative error of the values calculated by the sampling method and our (1 − ε)-approximation algorithm. Experimental Setup. We implemented all our algorithms, as well as the naive sampling method, in C++ and using the GNU g++ compiler, version 4.8.3. All experiments were run on a standard desktop computer with a quad core 3.20GHz processor and 8GB of RAM running openSUSE 13.2. To evaluate our algorithms we used both artificial point data, as well as real data representing bird species. The real data set was generated based on data of n = 9420 bird species, each of which has ten traits. Since some of these traits admit categorical values (e.g. dietary guild), we had to preprocess the data to map each species to a point in Rd. For this, we used a standard approach in Ecology: we computed a dissimilarity matrix of the species (using the square root of Gower's coefficient [7]), and ran a principle coordinate analysis (PCoA) to produce points of d = 20 coordinates. Since the PCoA produces coordinates sorted according to their importance, whenever we performed experiments with this point set in Rd, with d < 20, we considered only the first d coordinates of these points. The artificial point set was generated by selecting 9420 points uniformly at random from the 20-dimensional unit cube. In our experiments, for each execution of the sampling method, we fixed the number of selected samples to one thousand. 8.1 Experiments on the Mean Pairwise Distance Next we describe how we evaluated the performance of our algorithms that compute the MPD statistics in the fixed-size model, together with the performance of the standard sampling method. Recall that, unlike the sampling method, our algorithms can compute these statistics for all samples sizes s ≤ n for an additional O(n) time. Hence, in all sets of experiments that we describe, the presented running times of our exact and approximation algorithm are for computing the statistics for all sample sizes ≤ n. On the other hand, the presented times for the sampling method indicate the time taken to produce the MPD statistics for a single sample size. In first set of our experiments, we measured the running time of our algorithms as a function of the input size n. We considered points in R3, and we set the sample size to s = 420. For the (1 − ε)-approximation algorithm, we set ε = 1 2 . Both for the real and artificial data, we measured the running times of all methods on point sets with size n = 420 + 500k, where k ranges from 0 to 18. The results are shown in Fig. 2. The first thing to note is that, since we fixed both the sample size s and the number of repetitions for the sampling method, its running time is independent of n. Still, our algorithms are significantly faster than the naive sampling method, even if their running-time measurements include computing the expectation and variance for n different sample sizes, as opposed to the single sample size of the sampling method. On the artificial data, and for the values of n considered, the (1 − ε)-approximation 15 Fig. 2: (left and middle) The running time of our exact MPD algorithm, the (1−ε)-approximation 2 , and the sampling method for points in R3 as a function of n. (right) The algorithm for ε = 1 running time as a function of s. algorithm is slightly slower than the exact algorithm. However, as n increases, the difference becomes smaller. We expect that this is mostly due to the larger constant factors in the analysis of the approximation algorithm. For the real data, and data set sizes up to roughly 4000, both algorithms perform similarly. From that point on, the approximation algorithm is faster than the exact algorithm. This suggests that in the real data there are only few well-separated pairs that the algorithm has to consider than in the artificially generated data. This explanation was confirmed by preliminary measurements on the number of generated well-separated pairs. In the above experiments, we also measured the relative error in the values calculated by the (1 − ε)-approximation algorithm and the sampling method. It may seem that setting ε = 1 for our (1 − ε)-approximation algorithm is fairly large. However, for all values of n that we considered, the error for the expected mean pairwise distance was always below 1.5 percent; much less than the fifty percent that the algorithm guarantees. Similarly, the maximum observed error for the variance is roughly three percent on the artificial data, and varies between one and three percent for the real data. The error for the expected MPD made by the sampling method is generally very small (close to zero). For the variance, the error of the sampling method is comparable to that of the (1 − ε)-approximation, especially for the real data. There does not seem to be a clear relation between the input size n, and the error in the approximation or the sampling method. We illustrate these measurements in Fig. 3. 2 Fig. 3: The observed relative error of our (1 − ε)-approximation algorithm and of the sampling method, for different values of n. For these experiments, the parameter ε of the approximation algorithm is set to ε = 1 2 . However, note that the observed error is much smaller than the guarantee provided by the approximation algorithm. Dependency on s. Fixing the sample size s to a small value gives a somewhat unfair advantage to the sampling method. When we vary s, we really see the advantages of our algorithms 16 0200040006000800010000n012345678TimeinsecondsartificialdataSampling(1−ε)-Approx.Exact0200040006000800010000n012345678Timeinsecondsrealdata0200040006000800010000s02004006008001000TimeinsecondsrealdataSampling(1−ε)-Approx.Exact0200040006000800010000n012345Error%artificialdataSampling,E(1−ε)-Approx.,ESampling,V(1−ε)-Approx.,V0200040006000800010000n0.00.51.01.52.02.53.03.54.0Error%realdata Fig. 4: The running time (left) and observed error (middle and right) of the (1−ε)-approximation algorithm as a function of ε. Fig. 5: Running times of the MPD-related methods, as a function of the dimension d. compared to the sampling method. We measured the running times of all methods on the real data, using the full set of 9420 points with d = 3 dimensions, and for sample size s = 420 + 500k, where k ranges from 0 to 18. The results on the real data are shown in Fig. 2(right). The results on artificial data showed a similar pattern. These results confirm that our algorithms are independent of s, whereas the running time of the sampling method slows down significantly as s increases. For s ≈ 4000 our algorithms are about 200 times faster than the sampling method. Dependency on ε. We also examined how the running time and observed error change for our (1 − ε)-approximation algorithm based on ε. We performed experiments both on the real and artificial data, using in each case the full point set. We fixed d = 3, and s = 500, and we considered ε = 0.05 + 0.05k, with k from 0 to 18. As we see in Fig. 4, the running time for the data set with real species decreases rapidly as we increase ε. Dependency on d. Finally, we examined the performance of our algorithms based on d. We conducted measurements on both real and artificial data, using the full point sets, and we set s = 500 and ε = 1 2 . The running-time results are shown in Fig. 5. As we could expect from our theoretical analysis, the running times of the sampling and exact algorithms seem to increase smoothly with d. On the artificial data, the running time of the (1− ε)-approximation algorithm increases somewhat rapidly for d ≥ 4. On the real data such an increase seems to show up only for d ≥ 10. We do see that, on the real data, the approximation algorithm is faster than the exact algorithm up to d = 13. To examine this further, investigated the number of well-separated pairs that the approximation algorithm considers. We observed that the increase in the running time was due to the increase on the size of the computed well-separated decomposition. This increase was gradual for the real data, and for the largest examined value of d the size of the decomposition did not exceed 15 percent of the potential maximum of(cid:0)n artificial data the size of the decomposition rapidly converged to(cid:0)n 2 (cid:1) pairs. But, for the (cid:1), which affected the running 2 time. For every d, the observed errors did not exceed three percent (see Fig. 6). 17 0.00.20.40.60.81.0ε051015202530TimeinsecondsExactonrealdata(1−ε)-Approx.onrealdataExactonartificialdata(1−ε)-Approx.onartificialdata0.00.20.40.60.81.0ε01234567Error%artificialdata(1−ε)-Approx.,E(1−ε)-Approx.,V0.00.20.40.60.81.0ε0.00.51.01.52.02.5Error%realdata1234568101214161820d020406080100120TimeinsecondsartificialdataSampling(1−ε)-Approx.Exact1234568101214161820d05101520253035TimeinsecondsrealdataSampling(1−ε)-Approx.Exact Fig. 6: The observed relative error of our (1 − ε)-approximation algorithm and of the sampling method, for different values of d. 8.2 Experiments on the Bounding Box We also measured, for different values of n, the running time of our algorithm that computes the expected bounding box volume for points in R2 selected using the Bernoulli distribution. The running time of our method and that of the sampling method on real data is shown in Fig. 7. The results on artificial data are similar. We see that both methods are very fast; they can both process all 9420 points in less than a second. The sampling approach is even slightly faster than our exact algorithm. As with the MPD, the error of the sampling method is close to zero. This could indicate that it may be better to use the standard sampling method on situations where the examined measure can be calculated very fast on a single sample. 9 Conclusions and Future Work Fig. 7: Running times regarding the 2D bounding box volume in the Bernoulli distribution, for different values of n. We presented polynomial-time algorithms that compute the expectation or variance of popular geometric measures when a subset of points is randomly selected from a universal set P of n points in Rd. We implemented the two algorithms that we designed for computing the statistical moments of the mean pairwise distance for points in Rd, and the bounding box volume for points in R2. We conducted experiments and we showed that our algorithms are efficient in practice. As part of future research, it would be interesting to study the conditions under which randomized heuristics can produce a good estimation of the mean and variance of an examined measure. For example, suppose that we want to compute a good estimation of the expected convex hull volume of a subset of s points selected from P under the fixed-size model, and that we want to do that by computing the hull volume for a large number of samples of s points. Using Hoeffding's inequality [8] we could decide what is a sufficient number of samples, so that we produce a good estimation with high probability. However, this inequality requires that we provide a good bound for the minimum and maximum value of the measure for a given sample. This leads to the following interesting problem; given a set of points P and a geometric measure M , what is the minimum and maximum value that M can take if a subset of points is selected from P under the fixed-size or the Bernoulli model. Loffler and van Kreveld [14] have studied similar problems for imprecise points, that is when the inputs points do not have a fixed position, but they are distributed across given regions. To the best of our knowledge, and especially for the fixed-size model, this problem remains open for most of the measures that we examined in 18 1234568101214161820d0123456Error%artificialdataSampling,E(1−ε)-Approx.,ESampling,V(1−ε)-Approx.,V1234568101214161820d012345Error%realdata0200040006000800010000n0.00.10.20.30.40.50.60.70.80.9TimeinsecondsrealdataSamplingExact this paper. Acknowledgments We want to thank Vincent Pellissier for introducing the examined problems, and for providing real-world species data for our experiments. We also want to thank Vissarion Fysikopoulos for his contribution in the early stages of this work, regarding the computation of the expected convex hull volume. This work was supported by the Danish National Research Foundation under grant nr. DNRF84. References [1] P. K. Agarwal, S. Har-Peled, S. Suri, H. Yıldız, and W. Zhang. Convex hulls under uncertainty. In European Symposium on Algorithms, pages 37–48. Springer, 2014. [2] A. K. Brunbjerg, J. Cavender-Bares, W. L. Eiserhardt, R. Ejrnaes, L. W. Aarssen, H. L. Buckley, E. Forey, F. Jansen, J. Kattge, C. Lane, R. A. Lubke, A. T. Moles, A. L. Monserrat, R. K. Peet, J. Roncal, L. Wootton, and J.-C. Svenning. Multi-scale phylogenetic structure in coastal dune plant communities across the globe. Journal of Plant Ecology, 2014. [3] B. Bueler, A. Enge, and K. Fukuda. Exact Volume Computation for Polytopes: A Practical Study, pages 131–154. Birkhauser Basel, Basel, 2000. [4] P. B. Callahan and S. R. Kosaraju. A decomposition of multidimensional point sets with applications to k-nearest-neighbors and n-body potential fields. J. ACM, 42(1):67–90, Jan. 1995. [5] W. K. Cornwell, D. W. Schwilk, and D. D. Ackerly. A trait-based test for habitat filtering: Convex hull volume. Ecology, 87(6):1465–1471, 2006. [6] M. Fink, J. Hershberger, N. Kumar, and S. Suri. Hyperplane separability and convex- ity of probabilistic point sets. In Proceedings of the 32nd International Symposium on Computational Geometry (SoCG), pages 38:1–38:16, 2016. [7] J. C. Gower. A general coefficient of similarity and some of its properties. Biometrics, pages 857–871, 1971. [8] W. Hoeffding. Probability inequalities for sums of bounded random variables. Journal of the American Statistical Association, 58(301):13–30, 1963. [9] L. Huang and J. Li. Approximating the Expected Values for Combinatorial Optimiza- tion Problems over Stochastic Points, pages 910–921. Springer Berlin Heidelberg, Berlin, Heidelberg, 2015. [10] A. Jørgensen, M. Loffler, and J. M. Phillips. Geometric computations on indecisive points. In Workshop on Algorithms and Data Structures, pages 536–547. Springer, 2011. [11] J. B. Lasserre. An analytical expression and an algorithm for the volume of a convex polyhedron in rn. Journal of Optimization Theory and Applications, 39(3):363–377, 1983. [12] H. Lingxiao, J. Li, J. M. Phillips, and H. Wang. epsilon-kernel coresets for stochastic points. In European Symposium on Algorithms, 2016. To appear. 19 [13] M. Loffler and J. M. Phillips. Shape fitting on point sets with probability distributions. In Proceedings of the 17th Annual European Symposium on Algorithms (ESA), pages 313–324, Berlin, Heidelberg, 2009. Springer Berlin Heidelberg. [14] M. Loffler and M. van Kreveld. Largest and smallest convex hulls for imprecise points. Algorithmica, 56(2):235–269, Feb. 2010. [15] M. A. Mouchet, S. Vill´eger, N. Mason, and D. Mouillot. Functional diversity measures: an overview of their redundancy and their ability to discriminate community assembly rules. Functional Ecology, 24(4):867–876, 2010. [16] M. H. Overmars and E. Welzl. New methods for computing visibility graphs. In Proceedings of the Fourth Annual Symposium on Computational Geometry, SCG '88, pages 164–171, New York, NY, USA, 1988. ACM. [17] S. Suri, K. Verbeek, and H. Yıldız. On the most likely convex hull of uncertain points. In European Symposium on Algorithms, pages 791–802. Springer, 2013. [18] N. G. Swenson and M. D. Weiser. On the packing and filling of functional space in eastern north american tree assemblages. Ecography, 37(11):1056–1062, 2014. [19] C. Tsirogiannis. Github repository of geometric-measure statistics code. https://github. com/constantinosTsirogiannis/GeometryStats, 2016. [20] S. Vill´eger, N. Mason, and D. Mouillot. New multidimensional functional diversity indices for a multifaceted framework in functional ecology. Ecology, 89(8):2290–2301, 2008. [21] B. Walker, A. Kinzig, and J. Langridge. Plant attribute diversity, resilience, and ecosystem function: the nature and significance of dominant and minor species. Ecosystems, 2:95–113, 1999. Appendix: The volume of the bounding box in Rd Bernoulli Distribution. Let p be a point in Rd. We use pi to denote the i-th coordinate of this point. Let S be a subset of points in P selected at random according to the Bernoulli distribution. We define (cid:35) (cid:34) d(cid:89) i=1 XP(S) = E max p∈S pi . We next describe an algorithm for computing the expected value of the bounding box volume BB(S) when S is a subset selected according to the Bernoulli distribution. Following a similar analysis as with the 2-dimensional case (see Section 3), it is easy to show that the computation of E[BB(S)] for d-dimensional point sets boils down to calculating 2d quantities that are fundamentally the same as XP(S). Therefore, in the rest of this section we describe an algorithm for computing XP(S) in O(nd−1 log n) time; this can be directly used to derive an algorithm that calculates E[BB(S)] in the Bernoulli distribution in O(2dnd−1 log n) time, which becomes O(nd−1 log n) time in the case that d is a constant. A brute-force approach for calculating XP(S) would be to consider all possible subsets of P , and for each such subset S compute the maximum coordinates maxp∈S pi and the probability that S is selected according to the Bernoulli distribution. Of course, this approach would be infeasible since it would require processing all 2n subsets of P . Yet, we can design a more efficient approach by considering the following observation; for every S ⊆ P , there is a subset S(cid:48) ⊆ S of at most d points that define the maximum coordinates in this subset. We call such 20 a set S(cid:48) a concise set. Instead of checking explicitly all possible subsets in P , we can evaluate XP(S) by considering only the O(nd) concise sets in P . We next describe how we can do that in O(nd−1 log n) time, without even constructing all these sets explicitly. Before we continue with our description, we need the following definitions. Let S be a set of k ≤ d points in P . We say that S is a concise k-set, or simply a concise set, if for every p ∈ S there exists at least one coordinate i such that pi = maxq∈S qi. Recall that no pair of points in P share a common coordinate; hence, for each of the d coordinates there is a unique point in a set S that has the maximum value in S for this coordinate. We use CSk(P ) to denote the set that consists of all concise k-sets that are subsets of P . We use CS(P ) to denote the union of all sets CSk(P ), that is the set of all concise sets in P . Let S be a concise set. We use P +(S) to denote the set of all points p ∈ P such that there exists at least one coordinate i for which pi > maxq∈S qi. We use con(S) to denote the following quantity: con(S) = max p∈S pi π(q) · π(P +(S)) . d(cid:89) i=1 (cid:88) d(cid:89) H∈CS(P ) i=1 (cid:89) q∈S (cid:89) q∈H (cid:88) H∈CS(P ) follows: (cid:34) d(cid:89) i=1 (cid:35) (cid:88) We call con(S) the contribution of S. Based on these definitions, we can rewrite XP(S) as XP(S) = E max p∈S pi = max p∈H π(q) · π(P +(H)) = con(H) . (20) According to the last equation, we can calculate XP(S) by constructing explicitly all possible concise sets in P , and for each such set R compute its contribution. To compute these values efficiently, we break CS(P ) into three parts; the first part contains all concise k-sets with k ≤ d− 2, the second part contains all concise (d− 1)-sets, and the third part contains all concise d-sets: con(H) = W≤d−2(P ) + Wd−1(P ) + Wd(P ) , H∈CS(P ) where W≤d−2(P ) = Wd−1(P ) = Wd(P ) = con(H) , con(Q) , and k=1 H∈CSk(P ) d−2(cid:88) (cid:88) (cid:88) (cid:88) Q∈CSd−1(P ) con(R) . R∈CSd(P ) We next outline how to calculate each of the values W≤d−2(P ), Wd−1(P ), and Wd(P ) in O(nd−1 log n) time. It is straightforward to do this for W≤d−2(P ); we explicitly construct all concise k-sets with k ≤ d − 2, and for each such set R determine π(P +(R)) by naively checking which points in P fall inside P +(R). There are O(nd−2) such concise sets, and it takes O(n) time for each set to determine P +(R), which leads to O(nd−1) time for this process. We continue with the computation of value Wd−1(P ). We need the next lemma. consists of c points. Subset Q is a concise c-set, and there exist exactly(cid:0)k Lemma 13. Let R be a concise k-set in P , and let Q ⊂ R be a non-empty subset of R that which are subsets of R. (cid:1) elements in CSc(P ) c 21 Proof. Point set Q is a concise set because each of its points has the maximum value for at least one coordinate i among the points in R, and therefore the same point has the maximum value for this coordinate among any subset of R. Since every subset of R is a concise set, all subsets of c points in R are elements of CSc(P ). Let Q be a concise k-set in P , and let r be a natural number greater than k. We use SPr(Q) to denote all the concise r-sets that are supersets of Q. Using Lemma 13, we can rewrite Wd−1(P ) as follows: Wd−1(P ) = 1 d − 1 (cid:88) (cid:88) Q∈CSd−2(P ) R∈SPd−1(Q) con(R) . (21) Based on the latter equation, we can calculate Wd−1(P ) by constructing all concise (d − 2)- sets, and for each such set Q compute the contributions of the supersets in SPd−1(Q). We next show how to compute the contributions of all sets in SPd−1(Q) in O(n log n) time. Let S be a k-concise set with k < d. We say that the i-th dimension is non-exclusive with respect to S if the point p that has the maximum coordinate value in S for this dimension also has the maximum coordinate value in S for another dimension j (cid:54)= i. We denote the set of non-exclusive dimensions of S by ND(S). Let R be a concise (k + 1)-set which is a superset of S, and let q be the point such that R = S ∪ {q}. Set R has one less non-exclusive dimension than S, which is a dimension where q has a larger coordinate value compared to the points in S. Let i be this dimension. We say in this case that point q, and respectively superset R, improves S at dimension i. A concise (d − 2)-set S can have either three or four non-exclusive dimensions, and a concise (d − 1)-superset of S can improve S in either one or two of these dimensions. Let SPi d−1(S) denote the concise (d − 1)-sets that improve S in dimension i (including also those which improve S in a second dimension), and let SP# d−1(S) denote the concise (d − 1)-sets that improve S in two different dimensions, whichever these dimensions might be. For a concise (d − 2)-set Q, we have(cid:88) R∈SPd−1(Q) con(R) =  (cid:88) i∈ND(Q) (cid:88) R∈SPi d−1(Q) con(R)  − (cid:88) S∈SP# d−1(Q) con(S) . (22) We can compute the contributions of all sets in SPi d−1(Q) by extracting all points that improve Q in that dimension, sorting these points in order of increasing i-th coordinate, and then computing the contributions of each induced (d − 1)-superset in constant amortized time based on the contribution of the previous induced set in this order. At the same time, we maintain a sum of the contributions for sets in SP# d−1(Q). Each time that we compute the contribution of a concise (d − 1)-set, we check in O(d) time if this set improves Q in exactly two dimensions and, if this is the case, we add this contribution to the sum that we maintain for SP# d−1(Q). The described process requires O(dn + n log n) time for calculating the contributions of all sets in SPd−1(Q). Based on Equation 21, we can use this process to compute the sum of these contributions for all O(nd−2) concise (d − 2)-sets, yielding an algorithm that calculates Wd−1(P ) in O(nd−1 log n) time. To calculate XP(S), it remains to compute Wd(P ). Using again Lemma 13, we can rewrite Wd(P ) as Wd(P ) = 2 (cid:88) (cid:88) d(d − 1) Q∈CSd−2(P ) R∈SPd(Q) con(R) . (23) Let Q be a concise (d − 2)-set in P , and let i and j be two non-exclusive dimensions d (Q) to denote all the concise d-sets that improve Q both in the i-th i, j ∈ ND(Q). We use SPij 22 and j-th dimension. Based on this definition, we get (cid:88) (cid:88) (cid:88) con(R) = con(R) . (24) R∈SPd(Q) i,j∈ND(Q) R∈SPij d (Q) With simple arguments we can show that there can be up to four different pairs i, j of non-exclusive dimensions for which SPij d (Q) (cid:54)= ∅. Let i and j be such a pair of dimensions, and let Validij(Q) be the set of points in P \ Q that improve Q in dimension i and/or dimension j but not in any other of the remaining d − 2 dimensions. Also, let P + ij (p, q) be the set of points in r ∈ P such that ri > pi and rj > qj, and let maxk(Q) be the point with the maximum k-th coordinate in Q. We get(cid:88) d(cid:89) max q∈Q qk · π(P +(Q) \ Validij(Q)) · F (Q, i, j) , con(R) = R∈SPij d (Q) k=1 k(cid:54)=i,j where F (Q, i, j) = (cid:88) pi · π(p) · π(P + i (p) ∩ Validij(Q)) p∈Validij (Q)∩P + i (maxi(Q)) (cid:88) rj · π(r) · π(P + j (q) ∩ Validij(Q)) · 1 π(P + ij (p, q) ∩ Validij(Q)) . r∈Validij (Q)∩P + i (maxj (Q∪{p})) and P +(Q), and derive values(cid:81) We can compute the latter quantity in O(n log n) time; we can extract sets Validij(Q) (cid:80) k(cid:54)=i,j maxq∈Q qk and π(P +(Q) \ Validij(Q)) in O(n) time. To calculate F (Q, i, j), we need to follow an approach that is very similar to computing value p∈P B(p) for the 2D version of the problem–see Lemma 2 in Section 3. This approach requires using a product tree structure, with the difference that in this case the tree should store one leaf for every point in Validij(Q) ∩ P + j (maxj(Q)), and we consider only queries for each point in Validij(Q) ∩ P + i (maxi(Q)). Applying the described process to every concise (d − 2)-set yields an algorithm that computes Wd(P ) in O(nd−1 log n) time. Together with our analysis for computing W≤d−2(p) and Wd−1(p) this leads to an algorithm that computes XP(S) in same time asymptotically, and therefore an algorithm that computes the expected bounding box volume in O(2dnd−1 log n) time, or O(nd−1 log n) time for constant d. Fixed-size Distribution. Let P be a set of n points in Rd and let S be a subset of P which consists of s points and is selected according to the fixed-size distribution. Let H ⊂ S be the concise k-set such that maxp∈H pi = maxq∈S qi . For the fixed-size distribution, we redefine the contribution of H as follows: d(cid:89) i=1 (cid:0)n−k−P +(H) (cid:0)n (cid:1) s−k (cid:1) s con(H) = max p∈H pi · , (25) where P +(H) is the number of points in P +(H). We see that computing the contribution of H reduces to calculating P +(H). The value of XP(S) is equal to the sum of the contributions of all distinct concise sets in P . We can compute XP(S) under the fixed-size distribution in O(nd log n) using a similar approach as with the Bernoulli distribution. For this, we break down XP(S) into two quantities: the first is W≤d−1(P ), the sum of contributions of all concise k-sets with k ≤ d− 1, and the second is Wd(P ), the sum of contributions of all concise d-sets. Quantity W≤d−1(P ) can be trivially computed by explicitly constructing in O(nd log n) time each concise set H with up to d − 1 points and computing P +(H). To evaluate quantity Wd(P ), we first 23 construct all concise sets of d − 1 points. Then, for each such set H we produce all concise d-sets that improve H, and compute their contibutions in O(n log n) time. The last step can be performed in a similar way as the computation of Wd−1(P ) in the Bernoulli model; for each non-exclusive dimension i of H, we sort all points in P +(H) that improve H in increasing order of the i-th coordinate, and then compute the contribution of the induced concise sets in constant amortized time. We can use the above process as a preprocessing stage, and then we can calculate XP(S) in O(n) time for any given subset size s. We can do this as follows; during the process described above, we maintain for every natural g ≤ a sum SUMg k where we store values maxp∈H pi for every concise k-set H such that n − k − P +(H) = g. Given these dn sums, and given a subset (cid:1) (cid:0) g size s, we can compute XP(S) for this subset size in O(n) time using the formula: (cid:0)n (cid:1) . n−k(cid:88) d(cid:88) XP(S) = (26) SUMg k · s−k s k=1 g=0 This leads to the following theorem. Theorem 14. Let P be a set of n points in Rd, and let S ⊆ P be a random sample of s points, selected using the fixed-size distribution. We can compute E[BB(S)] for all subset sizes s ≤ n in O(nd log n + n2) time in total. 24
1801.00202
1
1801
2017-12-30T22:29:04
Efficiently Enumerating all Maximal Cliques with Bit-Parallelism
[ "cs.DS" ]
The maximal clique enumeration (MCE) problem has numerous applications in biology, chemistry, sociology, and graph modeling. Though this problem is well studied, most current research focuses on finding solutions in large sparse graphs or very dense graphs, while sacrificing efficiency on the most difficult medium-density benchmark instances that are representative of data sets often encountered in practice. We show that techniques that have been successfully applied to the maximum clique problem give significant speed gains over the state-of-the-art MCE algorithms on these instances. Specifically, we show that a simple greedy pivot selection based on a fixed maximum-degree first ordering of vertices, when combined with bit-parallelism, performs consistently better than the theoretical worst-case optimal pivoting of the state-of-the-art algorithms of Tomita et al. [Theoretical Computer Science, 2006] and Naud\'e [Theoretical Computer Science, 2016]. Experiments show that our algorithm is faster than the worst-case optimal algorithm of Tomita et al. on 60 out of 74 standard structured and random benchmark instances: we solve 48 instances 1.2 to 2.2 times faster, and solve the remaining 12 instances 3.6 to 47.6 times faster. We also see consistent speed improvements over the algorithm of Naud\'e: solving 61 instances 1.2 to 2.4 times faster. To the best of our knowledge, we are the first to achieve such speed-ups compared to these state-of-the-art algorithms on these standard benchmarks.
cs.DS
cs
Efficiently Enumerating all Maximal Cliques with Bit-Parallelism Pablo San Segundoa,∗, Jorge Artiedaa, Darren Strashb aCentre for Automation and Robotics (UPM-CSIC), Jose Guti´errez Abascal 2, Madrid 28006, Spain. bDepartment of Computer Science, Colgate University, Hamilton, NY, USA. Abstract The maximal clique enumeration (MCE) problem has numerous applications in biology, chemistry, so- ciology, and graph modeling. Though this problem is well studied, most current research focuses on finding solutions in large sparse graphs or very dense graphs, while sacrificing efficiency on the most difficult medium-density benchmark instances that are representative of data sets often encountered in practice. We show that techniques that have been successfully applied to the maximum clique problem give significant speed gains over the state-of-the-art MCE algorithms on these instances. Specifically, we show that a simple greedy pivot selection based on a fixed maximum-degree first ordering of vertices, when combined with bit-parallelism, performs consistently better than the theoretical worst-case optimal pivoting of the state-of-the-art algorithms of Tomita et al. [Theoretical Computer Science, 2006] and Naud´e [Theoretical Computer Science, 2016]. Experiments show that our algorithm is faster than the worst-case optimal algorithm of Tomita et al. on 60 out of 74 standard structured and random benchmark instances: we solve 48 instances 1.2 to 2.2 times faster, and solve the remaining 12 instances 3.6 to 47.6 times faster. We also see consistent speed improvements over the algorithm of Naud´e: solving 61 instances 1.2 to 2.4 times faster. To the best of our knowledge, we are the first to achieve such speed-ups compared to these state-of-the-art algorithms on these standard benchmarks. Keywords: maximal clique, bitstring, branch-and-bound, subgraph enumeration, combinatorial optimization 1. Introduction The maximal clique enumeration (MCE) problem-the problem of enumerating all maximal cliques of a given graph-has numerous applications spanning many disciplines [1, 2, 3]. Unlike the NP-hard maximum clique problem (MCP) [4, 5], the MCE problem is known to require exponential time in the worst case, since there may be an exponential number of maximal cliques to enumerate. For an n-vertex graph, there may be Θ(3n/3) maximal cliques, known as the Moon-Moser bound [6], and therefore any algorithm that enumerates all maximal cliques must use at least this amount of time in the worst case. Interestingly, not only does there exist an algorithm that runs in worst-case optimal Θ(3n/3) time, that of Tomita et al. [7], but it is also among the fastest algorithms in practice. Eppstein et al. [8] further tightened these bounds for the case of graphs with low degeneracy [9], the smallest value d such that every induced subgraph of G has a vertex of degree at most d. They showed that graphs with degeneracy d have Ω(d(n− d)3d/3) maximal cliques, and further give an algorithm to enumerate all maximal cliques in time O(d(n − d)3d/3), which matches the worst-case output size. Moreover, they showed that their method is efficient in practice on real-world complex networks, which typically have low degeneracy. These algorithms, as well as many other efficient algorithms, are derived from the Bron-Kerbosch algorithm-which maintains both a currently growing clique and a set of already examined vertices throughout recursive backtracking search, only reporting a clique when it is found to be maximal [10]. However, a separate class of theoretically-efficient algorithms, those with bounded time delay (the time between reported cliques), exist for the MCE problem, which use the reverse search technique of Avis and Fukuda [11]. Tsukiyama et al. [12] were the first to give a bounded time delay algorithm for this problem, giving an algorithm with delay O(nm) for graphs with m edges. Chiba and Nishizeki [13] ∗Corresponding author Email addresses: [email protected] (Pablo San Segundo), [email protected] (Darren Strash) 1 7 1 0 2 c e D 0 3 ] S D . s c [ 1 v 2 0 2 0 0 . 1 0 8 1 : v i X r a improved this result for graphs with arboricity a, a sparsity measure, giving a O(am)-delay algorithm. Makino and Uno [14] removed the linear dependence on m, reducing the delay to O(∆4), where ∆ is the maximum degree of G; however, their technique uses quadratic space. Chang et al. [15] further showed how to reduce the preprocessing time of Makino and Uno from quadratic to linear, while giving a tighter delay of O(∆h3), where h is the h-index of the graph. Finally, Conte et al. [16] gave the first bounded delay maximal clique enumeration algorithm with sublinear extra space, with delay O(qd(∆ + qd)polylog(n + m)), where q is the size of a maximum clique. Though these bounded time delay algorithms are theoretically efficient, Bron-Kerbosch-derived algo- rithms are much faster in practice. As noted by Conte et al. [16], their algorithm (which is at present the fastest bounded time delay algorithm) is 3.7 times slower than the Bron-Kerbosch-derived algorithm by Eppstein et al. [8] on sparse graphs, which is itself slower than the algorithm by Tomita et al. [7] on dense and medium-density instances that we consider here. Even though the algorithm by Tomita et al. [7] has worst-case exponential time, repeated experiments show that it is fast on a variety of benchmark instances [7, 8, 17, 18, 19]. At the time of writing, we are unaware of any algorithms that achieve significant speedups over this algorithm, though moderate speedups are possible on graphs that are either very sparse [8] or very dense [19]. For sparse graphs, the algorithm by Eppstein et al. [8] rivals that of Tomita et al. [7] while only consuming space linear in the size of the graph, whereas the algorithm of Tomita et al. requires quadratic space to store an adjacency matrix. Dasari et al. [20] further improved this result by factors of 2-4x using bit-parallelism, though the main algorithm remains unchanged. For larger instances, external memory algorithms have been developed which take advantage of the property that real-world sparse graphs typically have small induced subgraphs that can fit into memory [21]. For even larger instances, algorithms have been implemented in the MapReduce framework [22]. In the case of dense graphs, researchers have looked at different strategies for pruning search. In particular, Cazals and Karande [17] showed that detecting and removing dominated vertices is much faster than the traditional pivoting method commonly used in the fastest algorithms, such as that of Tomita et al. [7], when graphs are dense. This is because the time to pick a pivot can be very expensive when there are many edges. Naud´e [19] investigated the pivot computation set, and showed that it is possible to break out of pivot computation early under certain conditions, and still maintain a worst-case optimal running time of O(3n/3). In Naud´e's experiments on small random graphs (with 180 vertices or less), his algorithm is at most 1.56 times faster than that of Tomita et al. [7] on graphs with a high edge density of 0.8; on the other hand, on graphs with a lower edge density of 0.4, the method gives a modest speed up of at most 13%. Surprisingly, recent algorithms have focused only on sparse and high density graphs, and have not considered performance on medium density graphs, which are representative of many real-world in- stances, and where pruning techniques based on structure, different from the theoretical-optimal pivot- ing, are much less effective. In particular, the benchmarks from the second DIMACS challenge [23] and BHOSLIB [24], have medium density and are among the most difficult sets in practice. As far as we are aware, no algorithm gives significant improvement over the algorithm of Tomita et al. [7] for these instances. 1.1. Our Contribution We provide a new algorithm for the MCE problem, and show that it consistently outperforms the state-of-the-art algorithms of Tomita et al. [7] and Naud´e [19] on benchmark graphs that are rep- resentative of difficult instances. This work is inspired by a number of techniques that have been described for branch and bound maximum clique solvers, such as employing an initial ordering of nodes [25, 26, 27, 28, 29, 30], the use of bit-parallelism [28, 29] and keeping a fixed vertex ordering throughout recursion [28, 29]. Note that these solvers differ from any MCE solver in the fact that they also prune enumerable cliques in the search tree when they cannot possibly improve the incumbent solution. While leading MCP solvers (as well as the MCE solver by Eppstein et al. [8], and the improved bitstring encoding proposed by Dasari et al. [20]) attempt to quickly reduce subproblem size by branching on vertices initially (at the root) with low degree (following a degeneracy ordering), we evaluate vertices with high degree according to a maximum-degree-first ordering. This ordering helps us address one of the main challenges when applying bit-parallelism to state-of-the-art MCE solvers: efficient pivot selection, for which most algorithms must enumerate vertices to find a high degree vertex in the current subproblem [7, 8, 17, 18, 19, 31]. Moreover, enumeration of items is a well-known bottleneck of bitstrings. 2 With our proposed initial ordering, we efficiently perform a simple greedy pivot selection strategy, which allows us to pivot without enumeration. We likewise branch on vertices according to the initial ordering, since they are likely to have high degree in the subproblem being evaluated. Although this strategy increases the size of the search space on average when compared to the theoretical algorithm of Tomita et al. [7], our algorithm outperforms state-of-the-art solvers on 60 out of 74 of instances tested, which we attribute to the speed of greedy pivot selection, when combined with a bitstring representation. In contrast, a direct bit-parallel implementation of the state-of-the-art solver by Tomita et al. [7] is slower than the original implementation on most instances. 1.2. Organization The remainder of our paper is organized as follows: in Section 2 we cover useful definitions and other preliminaries and in Section 3 we describe variations of the Bron-Kerbosch algorithm. Our contributions appear in Section 4, where we describe our new enumeration algorithm. We then present our experimental results in Section 6, and conclude and give ideas for future work in Section 7. 2. Preliminaries We work with a simple undirected graph G = (v, E), which consists of a finite set of vertices V = {1, 2, . . . , n} and a finite set of edges E ⊆ V × V made up of pairs of distinct vertices. Two vertices u and v are said to be adjacent (or neighbors) if (u, v) ∈ E. The neighborhood of a vertex v, denoted N (v) (or NG(v) when the graph needs to be mentioned explicitly), is defined as N (v) = {u ∈ V (u, v) ∈ E}. We denote the degree of a vertex v by deg(v), and denote the maximum degree of G by ∆(G) = maxv∈V deg(v). A clique, also called a complete subgraph, is a set K ⊆ V of pairwise adjacent vertices. A clique K is said to be maximal if there is no vertex in V \ K that is adjacent to all vertices in K. Note that this definition is different from a maximum clique, which is a clique of maximum cardinality ω(G). Finally, we also consider the following terminology and definitions for vertex orderings. We define a vertex ordering to be a sequence v1, v2, . . . , vn of the vertices in V , where vi is said to be in position i, and further define a permutation φ : V → {1, 2, . . . , n} that maps each vertex vi ∈ V to its position i; that is φ(vi) = i. The width of a vertex vi, denoted w(vi), is the number of vertices adjacent to vi that precede vi in a given ordering [32]. We further say that the width of a vertex ordering is the maximum width of any of its vertices. The width of a minimum-width ordering is also called the degeneracy of the graph, which we denote by d. An ordering where each vertex has at most d neighbors that come later in the ordering (that is, the reverse of a minimum-width ordering) is called a degeneracy ordering [8]. Finally, a degeneracy ordering can be computed in O(n + m) time by iteratively removing a vertex with minimum degree from the graph until it is empty, and placing these vertices in order by their removal [33]. A minimum-width ordering can be similarly computed in O(n + m) time by placing vertices in reverse order by their removal. 3. Existing Bron-Kerbosch Enumeration Algorithms In this section, we briefly describe the state-of-the-art techniques for enumerating all cliques in a graph. These algorithms are derived from the Bron-Kerbosch algorithm, which we now describe. Algorithm 1 The Bron-Kerbosch algorithm. proc BK(P , R, X) 1: if P ∪ X = ∅ then 2: 3: end if 4: for each vertex v ∈ P do report R as a maximal clique 5: 6: 7: 8: end for BK(P ∩ N (v), R ∪ {v}, X ∩ N (v)) P ← P \ {v} X ← X ∪ {v} 3 3.1. The Bron-Kerbosch Algorithm the common neighborhood of R. That is, (cid:84) The Bron-Kerbosch algorithm (BK) [10] is a recursive backtracking algorithm that computes maximal cliques by maintaining three sets of vertices throughout recursion: a clique R, a set P of candidates that are to be considered for addition to R, and a set X of vertices that have already been evaluated, and thus are excluded from consideration. Throughout execution, BK maintains the invariant that P ∪ X is v∈R N (v) = P ∪ X. During each recursive call a candidate vertex v from P is moved to R, and P and X are updated to maintain this invariant in the next recursive call. Whenever P and X are empty, then R is a maximal clique and it is reported (see Algorithm 1). After a vertex v has been evaluated, it is moved to X in step 7. Initially all vertices are candidates (that is, P = V ), and R and X are empty. Algorithm 2 The Bron-Kerbosch algorithm with pivoting. proc BKPivot(P , R, X) 1: if P ∪ X = ∅ then 2: 3: end if 4: p ← ChoosePivot(P ∪ X) 5: for each vertex v ∈ P \ N (v) do report R as a maximal clique 6: 7: BKPivot(P ∩ N (v), R ∪ {v}, X ∩ N (v)) P ← P \ {v} X ← X ∪ {v} 8: 9: end for 3.2. Bron-Kerbosch with Pivoting One technique, which has been highly effective at improving running time, is that of pivoting, shown in Algorithm 2. In pivoting, a vertex p is chosen from either P or X, and then only non-neighbors of p in P (including p itself, if p ∈ P ) are considered for addition to R in the current recursive call. Such a vertex is called a pivot. Koch [18] initiated a study of different pivoting strategies, including choosing a pivot p from P or X at random or greedily from P to minimize P \ N (p) (or equivalently, maximize P ∩ N (p)). From these strategies, Koch showed that selecting from X at random was a superior strategy, closely followed by greedy selection from P (which was slower due to computing the number of neighbors in P ). However, Cazals and Karande [17] later empirically showed that picking p from P ∪ X to minimize P \ N (p) is even more effective in practice. Tomita et al. [7] showed that this pivoting strategy gives an algorithm with worst-case optimal O(3n/3) time. Naud´e [19] further showed that under certain conditions it is possible to stop pivot selection early, which not only speeds up maximal clique enumeration in practice, but still maintains worst-case optimal running time O(3n/3). While Naud´e's strategy gives a slight running time improvement for graphs with medium density (0.4), speedups of 2x are achieved for graphs with high density (0.8). Algorithm 3 The Bron-Kerbosch algorithm with an initial vertex ordering. proc BKOrdering(G = (V, E)) 1: v1, v2, . . . , vn ← ComputeOrdering(G) 2: for i ← {1..n} do (cid:46) A degeneracy ordering in [8] P ← {vj j > i} ∩ N (vi) R ← {vi} X ← {vj j < i} ∩ N (vi) BKPivot(P , R, X) 3: 4: 5: 6: 7: end for 3.3. Bron-Kerbosch with Vertex Ordering Vertex ordering, a technique frequently used to solve the maximum clique problem (MCP) can be used to further improve the theoretical running time of BK, while giving fast running times in practice In particular, Eppstein et al. [8] showed that for graphs with degeneracy d, for large sparse graphs. 4 evaluating the vertices in degeneracy order gives running time O(d(n − d)3n/3), which matches the worst-case output size. Previous Bron-Kerbosh-derived algorithms store the input graph in an adjacency matrix, while the method of Eppstein et al. [8] supports efficient computation using an adjacency list and other linear-sized auxiliary data structures. Thus, their method can be used on large sparse graphs whose adjacency matrix does not fit into memory. By computing an initial ordering of the vertices, they ensure that vertices in X come before vertices of P in the ordering. Note that such a strategy can be generalized to use any initial ordering (see Algorithm 3); however, the key to their algorithm's running time is that the degeneracy ordering ensures that P ≤ d since each vertex has at most d later neighbors in the ordering. They further efficiently compute pivots using an auxiliary bipartite graph. Their bipartite graph has vertices P ∪ X and P as the left-and right-hand sides respectively, and an edge (u, v) between the two sides when there is an edge in G between u ∈ P ∪ X and v ∈ P . A pivot can be computed by iterating over all neighbor lists in this bipartite graph in time O(P · P ∪ X), and this bipartite graph can be maintained efficiently throughout recursion. For graphs with low degeneracy, their technique rivals the speed of standard pivoting algorithms, while consuming only O(n + m) space. Additionally, their algorithm can be further sped up with bit-parallelism using the strategy of Dasari et al. [20], giving consistent speed gains of 2-4x. Lastly, we note that it is possible to apply the same ordering strategy with an adjacency matrix and achieve the same running time. However, it is not clear how this would compare in practice to the previously mentioned algorithms for non-sparse graphs. 4. The New Enumeration Algorithm Our algorithm combines elements from both Algorithms 2 and 3 above. As in Algorithm 3, we compute a vertex ordering. However, unlike Algorithm 3, we perform pivoting at the top level. We further differ with previous maximal clique enumeration algorithms in our set representation, our chosen vertex ordering, and our pivot and vertex selection. See Algorithm 4 for a high-level overview of the algorithm. To make effective use of bit-parallelism, we store sets P and X as bitstrings on which we can effi- ciently perform the necessary set operations. However, to make bit parallelism a viable option, several algorithmic changes are required. Specifically, finding the candidate pivot that minimizes P \ N (p) is now more expensive than with an array representation of vertex sets, since the vertices in P and X have to be enumerated. We therefore consider a greedy pivot selection strategy based on maintaining an ordering throughout recursion such that 'good' pivots (i.e., those that have many neighbors in P ) appear early in the ordering. Thus, following Algorithm 3, we sort the vertices initially, but instead of computing a degeneracy ordering as in Eppstein et al. [8] in which each vertex has few later neighbors, we compute an order in which each vertex has many later neighbors-which we call a maximum-degree-first ordering (defined formally in Subsection 4.2). We maintain this relative order of vertices throughout recursion, and use it both for branching and to greedily choose pivots. Note that preserving a static ordering during tree traversal is a significant departure from previous MCE algorithms. We now discuss each component in turn. 4.1. Bit-parallelism Encoding and implementation of critical operations. Critical sets P and X are encoded as bitstrings, while set R is a classical array since there is no useful bitmask operation which involves R. We also use an additional bitset to store the candidate set of vertices L = P \ N (p), where p is the pivot selected in each subproblem. The input graph G is also encoded as a list of bitstrings, where each bitset maps to a row of the graph's adjacency matrix, as described in [28, 29]. Finally, we also encode the complement graph ¯G of G in memory in the same manner. This allows implementing inferences concerned with non-neighbor relations as efficient bitmask operations. With the help of the above data structures, the critical operations in Algorithm 4 are implemented as bitmask AND operations as follows: • P ∩ N (v) in step 11: AND operation between bitsets P and the v-th row of G. • X ∩ N (v) in step 11: AND operation between the v-th row of G and bitset X. 5 Algorithm 4 The Bron-Kerbosch algorithm with pivot and vertex selection from the smallest position in the static vertex ordering (given by permutation φ) from those vertices in X or P proc ChoosePivotOrdered(P, X, φ) 1: if X (cid:54)= ∅ then 2: 3: else 4: 5: end if return argminv∈X φ(v) return argminv∈P φ(v) report R as a maximal clique proc BKPivotOrdered(P , R, X) 6: if P ∪ X = ∅ then 7: 8: end if 9: p ← ChoosePivotOrdered(P , X, φ) 10: for v = argminw∈P\N (p)φ(w) do 11: BKPivotOrdered(P ∩ N (v), R ∪ {v}, X ∩ N (v), φ) P ← P \ {v} X ← X ∪ {v} 12: 13: 14: end for • L = P \ N (p) in step 10: AND operation between the p-th row of ¯G and bitset P . If the pivot p is in P (that is, not in X) then it is further added to the candidate set L. Also worth noting is that the empty set test of P and X in step 6 also benefits from the bitset encoding by a constant factor proportional to the number of bitblocks contained in each bitstring. 4.2. Vertex Ordering We consider an initial degenerate ordering (not to be confused with a degeneracy ordering, considered by Eppstein et al. [8]) which selects at each step, the vertex with maximum degree-and removes v and all edges incident to v-from the original graph. Thus, the resulting order is v1, v2, . . . , vn where v1 is the vertex with maximum degree in G, v2 is the vertex with maximum degree in the graph induced by V \ {v1}, v2 is the vertex with maximum degree in the subgraph induced by V \ {v1, v2} and so on. The term degenerate denotes the fact that the selection criteria are restricted to the remaining vertices and not the full set. We refer to this ordering strategy as a maximum-degree-first ordering as opposed to the degeneracy ordering known from literature. Connection to previous approaches. Also, in literature, the term largest-first [32, 34], refers to a (non-degenerate) coloring heuristic which uses an order of vertices based on non-increasing degree; that is, vertices are ordered v1, v2, . . . , vn such that deg(v1) ≥ deg(v2) ≥ ··· ≥ deg(vn). The point of this ordering for approximate coloring is to assign color numbers to the most conflicting vertices as early as possible, so that those remaining will require a small number of colors to complete the partial coloring. A branch-and-bound algorithm for the exact MCP is usually concerned with two vertex orderings, one for branching initially and the other for approximate-coloring-a critical part of the so-called bounding function, since the number of distinct colors required to color a graph G is an upper bound for the cardinality ω(G) of a maximum clique in the graph. In the case of BBMC [28, 29] and MCS [30], two leading algorithms for the MCP, branching at the root node follows a degeneracy ordering where the vertex ordering v1, v2, . . . , vn is produced by iteratively removing a vertex with minimum degree from G along with its incident edges, and vi is the i-th vertex removed in this way. This strategy is well known to reduce the size of the search tree, in some cases even exponentially, by attempting to minimize branching in the shallower levels of the search tree (vertices with low degrees, produce small subproblems with high probability). In the remaining subproblems, both algorithms then switch to branching on a maximum-color-label basis; but the relative order of vertices remains the same (that is, as determined initially) in all subproblems. Consequently, the initial order also implicitly conditions the approximate-coloring bounding procedure. Although no such bounding function exists for the MCE, we follow a similar approach and also preserve the initial order of vertices in all subproblems. We note that, although Eppstein et al. [8] 6 described an ordering heuristic for the MCE, their ordering is only applied at the beginning of the algorithm, and is not maintained throughout recursion. To the best of our knowledge, we are the first to explore this strategy for the MCE. How we use the vertex ordering. We briefly mention two implementation details that involve our initial vertex ordering. • Once we compute the maximum-degree-first ordering, we place the vertices in reverse order (and branch on vertices in reverse order as well, from last to first). Note that this is a practical consid- eration consistent with previous algorithms for MCP, such as MCS or BBMC. • We renumber each vertex according to its position in the initial ordering from left to right, and reconstruct the adjacency matrix with respect to this numbering, i.e. we build the graph isomor- phism which corresponds to the new ordering. This was done by Tomita et al. [30] for the MCS algorithm, and for the bit-parallel algorithm BBMC by San Segundo et al. [28, 29, 35]. Both au- thors note that renumbering ensures locality of data. The new adjacency matrix sets the reference for all bitsets; consequently, the relative order of vertices is preserved in (bitsets) P and X in every subproblem. By maintaining the initial vertex ordering throughout recursion, we are able to quickly select a vertex with many neighbors in the graph, which is likely to have a high degree in the current subproblem. We use this fact to efficiently (and greedily) compute a pivot vertex, which we now describe. 4.3. Pivot Selection As explained previously, we use a maximum-degree-first initial ordering for our new algorithm (and maintain it in all subproblems). The key idea behind this strategy is to use the initial vertex ordering as an implicit pivoting heuristic to quickly find pivots with many neighbors in P , and thus reduce the branching factor. Initially, vertices are in maximum-degree-first order and the first vertex p in the ordering is chosen both as pivot and as starting point of the search. This is consistent with the theoretical optimal pivoting in [7] since it maximizes P ∩ N (p) and, consequently, minimizes branching in step 10 of Algorithm 4. From then on, we greedily select each new pivot from candidate pivot set P ∪ X, choosing the vertex p ∈ X (or is X is empty, the vertex in P ) that appears earliest in the initial ordering among all vertices in X (or P ), which we call the first vertex of X (or P ). We further always branch (in step 10) on the first vertex of P . Since each new pivot is has many later neighbors in the ordering, the hope is that it will also have many neighbors in P , thereby increasing the likelihood of maximizing P ∩ N (p) in future subproblems. Prioritizing set X with respect to P in our greedy pivot selection is also intended to reduce P \ N (p), since any pivot p in X cannot itself make part of the branching set. That is, p (cid:54)∈ P \ N (p) if p ∈ X. Notice that this greedy selection is accomplished in constant time, since we maintain our maximum- degree-first ordering throughout recursion. Thus, the running time for our pivot selection is much faster than other pivot selection routines. For example, the pivoting strategy by Tomita et al. [7] iterates over all vertices and counts their neighbors in P , taking Θ(n2) time in the worst case. Unlike Tomita et al., Naud´e's [19] pivoting strategy also adds vertices to P , increasing the time to select a pivot vertex. His strategy takes Θ((k + 1)n2) time, where k is the number of vertices added to P , and thus takes Θ(n3) time in the worst case. Note that the algorithms of Tomita et al. [7] and Naud´e [19] are worst-case optimal, and their analysis depends on the fact that some elements from P are excluded from immediate recursive calls. In contrast, our greedy pivoting strategy provides no such guarantee. Therefore, it is unclear if our algorithm is any more efficient in the worst case than the standard Bron-Kerbosch algorithm without pivoting, for which no non-trivial analysis is known. Notice also that our greedy selection strategy differs from the greedy pivot strategies of Koch [18], Cazals and Karande [17], and Tomita et al. [7]. They select a vertex p maximizing P ∩ N (p) whereas we select a vertex that has many neighbors in (which hopefully, by extension, has many neighbors in P ), since this selection is fast according to our static ordering. Different pivot strategies. Similar to previous approaches [7, 17, 18, 36], our greedy pivot selection can be applied to the full pivot candidate set P ∪ X, or selectively to sets P and X. Experiments by Koch [18] and Cazals and Karande [17] show that selecting pivots from X (and in Cazals and Karande's case, considering X in addition to P ) is stronger than selecting pivots from P alone. In all of our 7 Figure 1: A demonstration graph ordered with maximum-degree-first order 9, 8, 7, 6, 5, 4, 3, 2, 1: vertex 9 has maximum degree in V , vertex 8 has maximum degree in V \ {9}, vertex 7 has maximum degree in V \ {9, 8}, and so on. The order is reversed in accordance with the current implementation. algorithms, we therefore first select a pivot from X, and only consider pivot candidates from P if X is empty. This method is similar to Koch's variant that selects random pivots exclusively from X [18]; however, it is not clear if Koch's variant also selects a pivot from P when X is empty. Notwithstanding, we differ in our pivot selection criteria: we select p with many neighbors in G, attempting to maximize the number of neighbors in P without explicitly computing the optimal pivot. We consider the following strategies that take advantage of this greedy technique. In all of them, ties are broken in favor of the index with smaller index (in practice, larger since, owing to practical considerations, we order vertices by maximum degree in reverse order). GreedyBB. In this algorithm, we select as pivot the vertex p that is the first vertex in X. If X is empty, then the pivot becomes the first vertex in P . This is our main variant. As mentioned earlier, the idea of selecting pivots from X (if X is not empty) instead of from P ∪ X is based on the fact that any pivot in X will not be in P , so this reduces by one (the pivot) the branching factor at every step. We further consider two variants that use more informed strategies to select a pivot vertex from X: • GreedyBBTX. Here pivot selection is as follows: if X is not empty, then the pivot p is a vertex from X which maximizes P ∩ N (p) (as in the algorithm of Tomita et al. [7]). If X is empty, p is the first vertex in P . • GreedyBBNX. This algorithm is the same as GreedyBBTX, however, it includes the optimiza- tions introduced by Naud´e [19] when computing pivot p from vertices in X. Naud´e considers the mathematical equivalent expression of minimizing P ∩ K(p), where K(p) = V \ N (p) (including p itself). The advantage of this formulation is that it is possible to stop evaluating a candidate pivot p when it cannot improve the best pivot found so far. We compare the new algorithm with the original algorithm by Tomita et al. [7] (Tomita), provided to us by its main developer, and the critical optimizations by Naud´e [19] (Naude). Moreover, we also compare our own bit-parallel implementation of Tomita (TomitaBB). TomitaBB differs from the original algorithm in the bitstring encoding. It also sorts vertices initially as in GreedyBB but, since pivots are selected in the theoretically optimal way, this should not alter performance significantly. 5. An Example Since our greedy pivot selection strategy is simpler than the theoretically optimal one [7], it is to be expected that the new algorithm examines more subproblems. However, the simplicity of our greedy strategy makes pivot selection much faster. We would therefore expect our algorithm to outperform the optimal one if this speed is enough to offset the time spent in the additional subproblems. We justify the "good" behavior of the new greedy pivot selection strategy with the help of the graph G depicted in Figure 1. The graph is sorted initially according to maximum-degree-first and the list 8 Listofmaximalcliques{9,8,7,2}{9,6,5}{9,6,4}{9,6,2}{3,8,7}{3,5}{1,8,7}{1,5}345678912 Although L(cid:48) T BB < L(cid:48) GBB = P (cid:48) of the 8 maximal cliques to be found appear on the right. We compare the behavior of GreedyBB and TomitaBB for this case. As noted, both algorithms will always select vertices with highest de- gree first for branching-at the root node, vertex 9. The new set of candidates P (cid:48) = P ∩ N (9) is {8(2), 7(2), 6(3), 5(1), 4(1), 2(3)}, where the parentheses contain the degree of each vertex in P (cid:48). GreedyBB now selects as new pivot 8, the vertex with highest degree in P (cid:48), since the conflict set \ N (8) to be expanded in P (cid:48) (step 5 of is still empty. Consequently, the set of vertices L(cid:48) Algorithm 2) becomes {8, 6, 5, 4}. On the other hand, TomitaBB selects as pivot vertex 6 because it has maximum degree in P (cid:48). This reduces the set of vertices to be expanded in P (cid:48) to L(cid:48) T BB = {8, 7, 6}. GBB, it turns out that the choice of pivot made by TomitaBB is suboptimal. This can be established by looking at the listing of maximal cliques in the figure. GreedyBB first takes 8 from L(cid:48) GBB-to find the maximum clique {9, 8, 7, 2}-and then 6, to enumerate the family of cliques {9, 6,∗}. This is optimal and the search requires a total of 8 steps, where a step is a recursive call to the algorithm. TomitaBB, however, requires 9 steps, because it branches suboptimally on vertex 7 (instead of 6) after backtracking from 8. This leads to the clique {9, 7, 2}, which is not maximal. To summarize, the new greedy pivot selection strategy defeats the standard strategy in the example because the neighbor set of the TomitaBB pivot 6 contains only vertices preceding the pivot. It does not contain vertex 7, which has higher index and, therefore, higher probability of belonging to a large maximal clique-in the example, the maximum clique. 6. Experiments Setup. Experiments were performed using a Linux workstation running a 64-bit Ubuntu release at 3.00 GHz with an Intel(R) Xeon(R) CPU E5-2690 v2 multi-core processor (two sets of 10 physical cores) and 128 GB of main memory. All algorithms tested were implemented in C or C++, compiled using gcc version 4.8.1 with the -O3 optimization flag, and each algorithm was run on a dedicated core. Data sets. We run the algorithms over a number of structured and uniform random graphs. Specifically, structured graphs are those from the well-known DIMACS clique and color data sets (from the second DIMACS implementation challenge [23]). The DIMACS clique graphs selected include those typically employed elsewhere, as well as new ones which were computed in less than 6 hours by the new algorithm. In the case of the less dense color data set, we report those that required the Tomita algorithm more than 0.2 seconds to solve. Moreover, we also considered the BHOSLIB benchmark [24], but none of the graphs tested run inside the 6-hour time limit. With respect to uniform random graphs, the concrete set of instances shown in the report is borrowed from Eppstein et al. [8]. Algorithms tested. In our tests, we consider the bit-parallel implementations of the new greedy pivot strategy: GreedyBB, GreedyBBTX, and GreedyBBNX, as well our implementation of the bit- parallel of the algorithm by Tomita et al. [7] TomitaBB. We further test the original algorithms by Tomita et al. [7], Naud´e [19] and Eppstein et al. [8]. We use the source code as provided by the main developers-the latter is the same code used in the experiments of Eppstein et al. [8]1. The source code for [19] has also been recently published2, and some modifications were made on demand by the developer to enable us to compute the number of steps (nodes in the search space). We now briefly describe each of these algorithms: • Tomita: This is the original adjacency matrix implementation of the algorithm by Tomita et al. [7]. • Naude: The original implementation of the optimizations over Tomita described in [19]. We note that there is no fundamental change in the theoretical pivoting of the former. • ELS: This is the algorithm by Eppstein et al. [8] computes a degeneracy ordering, evaluates vertices in degeneracy order (as discussed in Section 3), and quickly computes a pivot in O(P · P ∪ X) time by dynamically maintaining a bipartite graph between vertices in P ∪ X and P . We briefly note that the ELS algorithm is tailored to work efficiently on sparse graphs. However, we include it in our experiments since it is the only existing MCE algorithm that uses an ordering strategy. 1The source code is available at https://github.com/darrenstrash/quick-cliques/releases. 2The source code is available at https://github.com/kevin-a-naude/cliques. 9 6.1. Experimental Results We now compare the performance of the three prior leading algorithms, Tomita, Naude and ELS, with the two best new bit-parallel algorithms: our main variant GreedyBB, GreedyBBNX and our bit-parallel implementation of [7], TomitaBB, (see Table 1 and Table 2). The full results obtained by all the algorithms considered in this research are publicly available at [37]. The source code may be found at [38]. The best performance is achieved undoubtedly by GreedyBB, which uses pure greedy pivot selection. Of the 28 different uniformly random graphs considered in Table 1, it is faster than ELS in 25 cases- and GreedyBB is only slower than ELS on the sparse graphs with 10 000 nodes, for which ELS was designed-faster than Tomita in all but 4 cases, and always faster than GreedyBBNX. Moreover, in the 46 structured graphs reported in Table 2, GreedyBB is faster than Tomita in 36 cases, faster than GreedyBBNX in 40, and faster than Naude in 38. Moreover, it is the only algorithm, together with Naude that solves the hard instance p hat500.2 within the 6-hour time limit. Furthermore, the fast speed of our algorithm is only partially due to bit-parallelism. Using bit- parallelism, we can expect an algorithm's running time to decrease by a constant factor cW where is the size of the register word (in our case W = 64) and c < 1 is a constant which models the cost of inefficient operations such us bit-scanning loops. Bit-scanning is required by the theoretical pivot selection strategy, since it requires enumeration of candidates. Thus, it is the combined new greedy pivot selection with the bitstring representation that explains the practical value of GreedyBB. We can see this in the performance of TomitaBB. In the 46 structured instances, GreedyBB is better in most cases, and never worse. Also, in the larger uniform random graphs (n > 1000) the performance of TomitaBB deteriorates considerably because the enumeration during pivoting is now over large bitstrings. It is worth noting at this point, that bitstrings are particularly well suited to preserve the order of elements when encoding set operations. Because of this, pivoting based on relative order is very fast in GreedyBB. This explains why it clearly outperforms not only TomitaBB, but also the original Tomita in the large non-structured graphs. GreedyBB achieves speedups ranging from 1.2 to 20 times Tomita in the structured graphs, but, in the majority of these cases, does not double the speed of the latter. In those graphs where it is more than 3 times faster, san400 0.5 1 constitutes a good example of the success of the greedy pivoting strategy over a difficult instance. In the case of uniform random graphs, the improvement in performance of GreedyBB reaches up to 47 times, and is especially relevant in the large graphs as mentioned previously. If we look at the number of recursive calls (also steps) taken by the algorithms, GreedyBB requires more steps than the theoretical algorithm, on average, when the graphs have some structure. This was to be expected. Notable exceptions are dsjc500.1, dsjc1000.1, hamming6-4, johnson16-2-4, johnson8-2-4 and abb313GPIA. However, the cases where the number of calls doubles the theoretical algorithm are few, and degenerate behavior is only observed in the 2 graphs reported from the wap family. Interestingly, GreedyBB is only a 25% slower than Tomita over wap, which illustrates that the synergies between the new pivoting rule and the bistring encoding achieve a good compromise between pruning and computational overhead. In the case of uniform random graphs, GreedyBB makes fewer calls than the theoretical algorithm in 14 cases out of the 28 families reported. This, we believe to be an interesting, and unexpected, result. The majority of cases in which the greedy pivoting strategy produces a smaller search tree occur in the less dense graphs. As density increases, the theoretical pivoting selection gradually prunes better, which is consistent with intuition. 7. Conclusion and Future Work We have shown that a greedy pivot selection strategy is consistently 1.2 to 2.4 times faster than the state-of-the-art algorithms of Tomita et al. [7] and Naud´e [19] for many structured and unstructured benchmark instances when combined with bit-parallelism and a static maximum-degree-first ordering of the vertices. Though similar techniques have long been known to be successful in solving the MCP, this is the first time, to the best of our knowledge, they are being applied to MCE. Moreover, ordering vertices by maximum degree is not a standard ordering used by exact MCP solvers, as it has been observed to slow down search [26]. In contrast, they branch on those vertices with smaller degree at the root node, which tends to produce small subproblems in the shallower levels of the tree. The success of our approach leaves open three major questions for future research. First, are there other techniques from MCP algorithms that can further improve algorithms for MCE? Next, are there 10 other simple pivot selection methods that can further improve MCE algorithms? Finally, is it possible to gain more speed from bit-parallelism when combined with pivoting in MCE algorithms? Acknowledgments This work is funded by the Spanish Ministry of Economy and Competitiveness (grant NAVEGASE: DPI 2014-53525-C3-1-R). References [1] J. G. Augustson, J. Minker, An analysis of some graph theoretical cluster techniques, J. ACM 17 (4) (1970) 571–588. doi:10.1145/321607.321608. [2] E. J. Gardiner, P. Willett, P. J. Artymiuk, Graph-theoretic techniques for macromolecular docking, J. Chem. Inf. Comput. Sci. 40 (2) (2000) 273–279. doi:10.1021/ci990262o. [3] R. Horaud, T. Skordas, Stereo correspondence through feature grouping and maximal cliques, IEEE Trans. Patt. An. Mach. Int. 11 (11) (1989) 1168–1180. doi:10.1109/34.42855. [4] R. M. Karp, Complexity of computer computations, Springer, 1972, Ch. Reducibility among Combinatorial Problems, pp. 85–103. doi:10.1007/978-1-4684-2001-2_9. [5] M. R. Garey, D. S. Johnson, Computers and Intractability; A Guide to the Theory of NP-Completeness, W. H. Freeman, New York, NY, USA, 1990. [6] J. W. Moon, L. Moser, On cliques in graphs, Israel J. Math. 3 (1) (1965) 23–28. doi:10.1007/BF02760024. [7] E. Tomita, A. Tanaka, H. Takahashi, The worst-case time complexity for generating all maximal cliques and compu- tational experiments, Theor. Comput. Sci. 363 (1) (2006) 28–42. doi:10.1016/j.tcs.2006.06.015. [8] D. Eppstein, M. Loffler, D. Strash, Listing all maximal cliques in large sparse real-world graphs, J. Exp. Algorithmics 18 (2013) 1–21. doi:10.1145/2543629. [9] D. R. Lick, A. T. White, k-degenerate graphs, Canad. J. Math. 22 (1970) 1082–1096. doi:10.4153/CJM-1970-125-1. [10] C. Bron, J. Kerbosch, Algorithm 457: Finding all cliques of an undirected graph, Commun. ACM 16 (9) (1973) 575–577. doi:10.1145/362342.362367. [11] D. Avis, K. Fukuda, Reverse search for enumeration, Discrete Appl. Math. 65 (1–3) (1996) 21–46. doi:10.1016/ 0166-218X(95)00026-N. [12] S. Tsukiyama, M. Ide, H. Ariyoshi, I. Shirakawa, A new algorithm for generating all the maximal independent sets, SIAM J. Comput. 6 (3) (1977) 505–517. doi:10.1137/0206036. [13] N. Chiba, T. Nishizeki, Arboricity and subgraph listing algorithms, SIAM J. Comput. 14 (1) (1985) 210–223. doi: 10.1137/0214017. [14] K. Makino, T. Uno, New algorithms for enumerating all maximal cliques, in: T. Hagerup, J. Katajainen (Eds.), SWAT 2004, Vol. 3111 of Lecture Notes in Computer Science, Springer, Berlin, Heidelberg, 2004, pp. 260–272. doi: 10.1007/978-3-540-27810-8_23. [15] L. Chang, X. Yu, Jeffrey, L. Qin, Fast maximal cliques enumeration in sparse graphs, Algorithmica 66 (1) (2013) 173–186. doi:10.1007/s00453-012-9632-8. [16] A. Conte, R. Grossi, A. Marino, L. Versari, Sublinear-space bounded-delay enumeration for massive network analytics: Maximal cliques, in: Proc. 43rd International Colloquium on Automata, Languages, and Programming (ICALP 2016), LIPIcs, 2016, pp. 148:1–148:15. doi:10.4230/LIPIcs.ICALP.2016.148. [17] F. Cazals, C. Karande, Reporting maximal cliques: new insights into an old problem, Research Report RR-5615, INRIA (2006). URL http://hal.inria.fr/inria-00070393/PDF/RR-5615.pdf [18] I. Koch, Enumerating all connected maximal common subgraphs in two graphs, Theor. Comput. Sci. 250 (1–2) (2001) 1–30. doi:10.1016/S0304-3975(00)00286-3. [19] K. A. Naud´e, Refined pivot selection for maximal clique enumeration in graphs, Theor. Comput. Sci. 613 (2016) 28–37. doi:10.1016/j.tcs.2015.11.016. [20] N. S. Dasari, R. Desh, Z. M, pbitMCE: A bit-based approach for maximal clique enumeration on multicore processors, in: Proc. 20th IEEE International Conference on Parallel and Distributed Systems (ICPADS 2014), 2014, pp. 478–485. doi:10.1109/PADSW.2014.7097844. [21] J. Cheng, L. Zhu, Y. Ke, S. Chu, Fast algorithms for maximal clique enumeration with limited memory, in: Proc. 18th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD 2012), ACM, New York, NY, USA, 2012, pp. 1240–1248. doi:10.1145/2339530.2339724. [22] B. Wu, S. Yang, H. Zhao, B. Wang, A distributed algorithm to enumerate all maximal cliques in MapReduce, in: Proc. 4th International Conference on Frontier of Computer Science and Technology (FCST 2009), 2009, pp. 45–51. doi:10.1109/FCST.2009.30. [23] D. S. Johnson, M. A. Trick, Cliques, Coloring, and Satisfiability: Second DIMACS Implementation Challenge, Work- shop, October 11-13, 1993, American Mathematical Society, Boston, MA, USA, 1996. [24] K. Xu, BHOSLIB: Benchmarks with hidden optimum solutions for graph problems, http://www.nlsde.buaa.edu.cn/ ~kexu/benchmarks/graph-benchmarks.htm (2004). [25] R. Carraghan, P. M. Pardalos, An exact algorithm for the maximum clique problem, Oper. Res. Lett. 9 (6) (1990) 375–382. doi:10.1016/0167-6377(90)90057-C. [26] E. Tomita, T. Kameda, An efficient branch-and-bound algorithm for finding a maximum clique with computational experiments, J. Global Optim. 37 (1) (2006) 95–111. doi:10.1007/s10898-006-9039-7. [27] E. Tomita, T. Seki, An efficient branch-and-bound algorithm for finding a maximum clique, in: C. S. Calude, M. J. Dinneen, V. Vajnovszki (Eds.), DMTCS 2003, Vol. 2731 of Lecture Notes in Computer Science, Springer, Berlin, Heidelberg, 2003, pp. 278–289. doi:10.1007/3-540-45066-1_22. 11 [28] P. San Segundo, D. Rodriguez-Losada, A. Jimenez, An exact bit-parallel algorithm for the maximum clique problem, Computers & Operations Research 38 (2) (2011) 571–581. doi:10.1016/j.cor.2010.07.019. [29] P. San Segundo, F. Matia, D. Rodriguez-Losada, M. Hernando, An improved bit parallel exact maximum clique algorithm, Optim. Lett. 7 (3) (2013) 467–479. doi:10.1007/s11590-011-0431-y. [30] E. Tomita, Y. Sutani, T. Higashi, S. Takahashi, M. Wakatsuki, A simple and faster branch-and-bound algorithm for finding a maximum clique, in: M. S. Rahman, S. Fujita (Eds.), WALCOM 2010, Vol. 5942 of Lecture Notes in Computer Science, Springer, Berlin, Heidelberg, 2010, pp. 191–203. doi:10.1007/978-3-642-11440-3_18. [31] F. Cazals, C. Karande, A note on the problem of reporting maximal cliques, Theor. Comput. Sci. 407 (13) (2008) 564–568. doi:10.1016/j.tcs.2008.05.010. [32] E. C. Freuder, A sufficient condition for backtrack-free search, J. ACM 29 (1) (1982) 24–32. doi:10.1145/322290. 322292. [33] D. W. Matula, L. L. Beck, Smallest-last ordering and clustering and graph coloring algorithms, J. ACM 30 (3) (1983) 417–427. doi:10.1145/2402.322385. [34] D. J. A. Welsh, M. B. Powell, An upper bound for the chromatic number of a graph and its application to timetabling problems, The Computer Journal 10 (1) (1967) 85–86. doi:10.1093/comjnl/10.1.85. [35] P. S. Segundo, C. Tapia, in: Proc. 22nd IEEE International Conference on Tools with Artificial Intelligence, 2010, pp. 352–357. doi:10.1109/ICTAI.2010.58. [36] H. C. Johnston, Cliques of a graph-variations on the Bron–Kerbosch algorithm, Int. J. Parallel Programming 5 (3) (1976) 209–238. doi:10.1007/BF00991836. [37] http://venus.ieef.upm.es/logs/results_enum/ (last accessed 8/17). [38] https://github.com/psanse/clique_enum (last accessed 8/17). 12 Table 1: Performance of different clique enumeration algorithms over uniform random graphs of size n and uniform density p. Cells show average values over 10 runs. Column header µ is the number of maximal cliques found. In bold, the best performance for each row. Times are measured in seconds with millisecond precision. Instance Naude [19] TomitaBB Tomita [7] ELS [8] GreedyBBNX GreedyBB n p µ steps time steps time steps time steps time steps time steps time 100 100 100 100 300 300 300 300 300 300 500 500 500 500 500 700 700 700 1.0K 1.0K 1.0K 2.0K 3.0K 0.6 61.7K 0.7 408.0K 0.8 5.8M 0.9 293.4M 0.1 3.8K 18.4K 0.2 0.3 91.4K 0.4 526.8K 4.4M 0.5 0.6 64.8M 0.1 15.0K 0.2 100.3K 0.3 711.6K 0.4 6.5M 96.6M 0.5 0.1 37.7K 0.2 327.8K 3.1M 0.3 0.1 99.2K 1.2M 0.2 0.3 15.5M 0.1 753.3K 0.1 2.9M 10.0K 0.001 50.0K 10.0K 0.003 142.6K 10.0K 0.005 215.8K 10.0K 0.010 349.7K 10.0K 0.030 3.7M 122.3K 0.019 807.0K 0.108 11.2M 1.175 570.4M 51.900 6.2K 0.002 34.1K 0.007 183.9K 0.040 1.1M 0.235 9.7M 1.807 146.7M 26.557 24.2K 0.005 188.0K 0.042 1.5M 0.343 14.7M 3.428 231.4M 53.703 61.6K 0.014 630.4K 0.163 6.6M 1.785 169.1K 0.049 2.4M 0.749 34.9M 11.211 1.4M 0.614 5.4M 2.920 59.0K 0.119 155.7K 0.219 252.6K 0.321 548.2K 0.643 5.2M 5.548 85.5K 576.0K 8.0M 9.5K 96.0K 883.3K 9.7M 2.5K 17.2K 107.2K 729.3K 6.8M 0.022 0.140 1.526 401.4M 70.235 0.004 0.012 0.062 0.341 3.097 108.6M 48.960 0.014 0.070 0.610 6.701 164.8M 113.829 0.028 0.310 3.772 0.098 1.678 21.1M 28.473 1.544 583.4K 2.3M 8.700 0.162 7.4K 0.478 13.1K 0.823 27.7K 135.8K 2.013 1.4M 21.601 23.6K 321.3K 4.0M 65.2K 1.2M 121.0K 1.0M 10.8M 90.4K 604.4K 8.3M 125.9K 813.5K 7.3M 0.019 0.122 1.532 412.9M 63.986 3.6K <0.001 22.2K <0.001 0.029 0.210 1.888 113.7M 29.062 12.5K <0.001 0.031 0.278 2.992 177.2M 49.815 0.010 0.121 1.332 0.040 0.518 7.240 0.385 1.614 1.618 1.659 1.734 2.050 5.208 31.2K 400.7K 4.6M 91.7K 1.6M 25.0M 916.4K 3.5M 10.2K 17.3K 53.2K 299.6K 1.8M 153.2K 1.0M 14.1M 27.4K 220.3K 1.7M 7.4K 40.4K 216.8K 1.3M 11.6M 0.075 0.412 5.026 706.8M 214.008 0.007 0.024 0.122 0.752 6.501 177.3M 95.941 0.016 0.128 1.093 17.2M 11.238 271.2M 172.629 0.033 0.461 5.451 0.120 2.120 40.3M 32.961 1.447 1.7M 6.610 6.4M 60.2K 0.015 159.5K 0.062 0.135 268.4K 0.478 648.2K 5.6M 8.763 68.6K 725.4K 7.7M 190.0K 2.8M 114.0K 0.016 850.1K 0.089 13.5M 0.983 751.5M 47.112 2.6K 0.002 18.5K 0.010 119.7K 0.031 844.3K 0.181 8.3M 1.628 141.5M 25.258 9.8K 0.009 103.0K 0.038 979.7K 0.302 11.2M 3.221 197.8M 53.718 24.7K 0.014 345.0K 0.145 4.4M 1.705 68.7K 0.043 1.3M 0.716 23.3M 11.881 610.4K 0.589 2.4M 3.278 7.4K 0.051 13.2K 0.145 28.6K 0.276 137.6K 0.743 1.4M 7.617 10.0K 25.3K 2.6K 20.0K 144.8K 0.009 1.1M 0.061 15.3M 0.827 762.6M 39.479 0.001 0.006 140.7K 0.023 1.1M 0.125 12.6M 1.120 252.7M 20.336 0.004 113.1K 0.023 1.2M 0.157 15.8M 1.809 338.1M 35.069 0.011 382.8K 0.076 5.5M 0.774 70.6K 0.024 1.5M 0.295 29.8M 4.964 633.7K 0.211 2.5M 1.067 0.034 7.4K 13.2K 0.082 28.6K 0.133 137.6K 0.299 1.4M 2.316 Table 2: Performance of different clique enumeration algorithms over structured graphs. Column header µ is the number of maximal cliques found. In bold, the best performance for each row. Times are measured in seconds with millisecond precision. A value of '–' indicates that the run did not finish within the 6h time limit. A value of * indicates that the instance could not be run. Instance Naude [19] TomitaBB Tomita [7] ELS [8] GreedyBBNX GreedyBB Name µ steps time steps time steps time steps time steps time steps time C125.9 MANN a9 brock200 1 brock200 2 brock200 3 brock200 4 c-fat200-5 c-fat500-5 c-fat500-10 dsjc1000.1 dsjc1000.5 dsjc.125.9 dsjc.250.5 dsjc500.1 dsjc500.5 hamming8-4 hamming6-2 hamming6-4 johnson16-2-4 johnson8-2-4 johnson8-4-4 keller4 p hat1000-1 p hat1500-1 p hat300-1 p hat300-2 p hat500-1 p hat500-2 p hat700-1 san400 0.5 1 sanr200 0.7 sanr400 0.5 1 338.135 14.4B 7.5B 0.065 590.9K 959.1K 135.897 449.6M 935.0M 0.177 431.6K 912.7K 1.592 9.9M 4.6M 6.498 42.0M 19.6M <0.001 262 7 <0.001 16 865 <0.001 694 8 0.048 166.8K 98.1K 9 453.370 28.5B 10.8B 934.211 10.1B 5.2B 0.626 1.7M 3.7M 0.006 24.3K 15.0K 57.665 102.7M 245.2M 8.603 76.6M 0.202 2.5M <0.001 1.1K 0.711 12.1M <0.001 380 0.021 200.6K 1.200 13.8M 7.817 24.2M 103.296 119.7M 276.2M 0.026 58.2K 111.7K 22.309 79.9M 155.3M 1.1M 548.5K 0.254 50.6B 19 528.780 59.6B 5.0M 2.4M 1.319 2 066.431 52.9M 26.7B 69.6M 147.9M 23.044 12.380 57.9M 25.1M 45.2M 1.3M 464 2.0M 105 114.7K 10.3M 11.1M 10.4B 413.7K 700.4M 621.9K 7.3M 31.0M 521 1.4K 1.4K 64.1K – 7.2B 2.6M 9.6K 175.6M 47.8M 1.8M 495 5.9M 205 156.5K 4.0M 16.1M 191.3M 67.4K 115.1M 724.6K – 3.3M 1 868.772 0.058 232.493 0.224 2.554 10.759 0.003 0.004 0.016 0.094 – 1 262.251 0.930 0.011 102.932 13.374 0.224 <0.001 1.200 <0.001 0.025 1.371 20.825 365.288 0.033 40.961 0.482 – 2.949 862.8M 2 629.124 109.3M 35.342 23.753 40.9M 1 588.730 10.4B 0.040 374.3K 150.180 726.8M 0.160 672.4K 1.760 7.7M 7.500 32.5M <0.001 581 <0.001 1.7K 0.020 1.5K 90.0K 0.040 22.2B 6 422.300 1 126.350 0.670 0.020 48.980 10.200 0.230 <0.001 0.670 <0.001 0.030 1.250 4.840 61.520 0.020 21.210 0.210 – 0.930 866.2M 3 097.100 114.7M 24.880 11.100 44.0M 7.5B 2.7M 12.6K 187.9M 49.4M 1.8M 896 12.1M 380 157.4K 4.0M 17.5M 204.3M 75.5K 116.5M 794.0K – 3.6M 17.5B 954.3K 1.2B 1.1M 12.2M 51.8M 593 1.5K 1.6K 187.5K 5 614.190 0.170 505.020 0.550 5.950 24.610 <0.001 0.020 0.050 0.120 2.6B 25 676.120 4 076.000 4.0B 4.4M 2.450 0.020 27.5K 184.930 287.8M 41.050 97.5M 3.1M 0.940 <0.001 1.4K 4.910 14.3M <0.001 505 0.100 281.9K 14.4M 4.460 17.440 27.8M 218.840 313.0M 0.060 132.7K 194.9M 68.710 0.690 1.3M – – 5.8M 3.350 1.1B 18 209.360 84.940 41.340 182.9M 68.4M 1 262.700 20.1B 0.035 522.3K 127.370 1.1B 0.129 757.7K 1.392 9.6M 5.823 43.0M <0.001 608 0.001 1.5K 0.002 1.5K 67.5K 0.047 24.5B 14 049.509 874.443 14.6B 3.1M 0.533 0.006 1 0.0K 57.344 210.4M 6.095 54.1M 2.5M 0.156 <0.001 495 0.617 5.9M <0.001 205 0.013 174.0K 5.4M 0.736 9.629 17.6M 160.645 208.8M 0.020 75.2K 215.9M 21.752 0.248 804.6K – – 1.419 3.6M 956.527 871.3M 158.5M 20.114 11.806 49.4M 1 083.396 20.5B 0.029 522.3K 116.126 1.8B 0.084 1.0M 1.107 15.5M 4.848 70.0M <0.001 1.4K <0.001 3.4K 0.001 9.2K 0.025 69.3K 6 987.053 47.9B 755.715 15.0B 0.375 4.6M 0.003 10.2K 39.479 360.2M 4.632 57.5M 0.125 2.5M <0.001 495 0.364 5.9M <0.001 205 0.014 181.7K 0.563 6.1M 3.801 23.0M 51.242 289.1M 0.012 87.1K 17.167 240.6M 994.0K 0.148 217.7B 17 219.771 0.687 871.392 17.589 7.717 Continued on next page → 4.6M 874.3M 262.6M 78.8M Table 2: Performance of different clique enumeration algorithms over structured graphs. Column header µ is the number of maximal cliques found. In bold, the best performance for each row. Times are measured in seconds with millisecond precision. A value of '–' indicates that the run did not finish within the 6h time limit. A value of * indicates that the instance could not be run. Instance Naude [19] TomitaBB Tomita [7] ELS [8] GreedyBBNX GreedyBB Name µ steps time steps time steps time steps time steps time steps time 4-FullIns 5 abb313GPIA flat300 20 0 flat300 26 0 flat300 28 0 flat1000 50 0 flat1000 60 0 flat1000 76 0 qg.order60 r1000.5 school1 school1 nsh wap03a wap04a 80.2K 76.2K 3.8M 2.6M 5.5M 2.5M 6.4M 2.9M 6.5M 2.9M 18.9B 7.2B 20.4B 7.7B 22.0B 8.3B 73.8K 120 588.5K 1.4M 247.5M 348.8M 48.1M 355.0K 364.0K 33.1M 84.1K 84.7K 0.056 0.719 1.038 1.205 1.206 6 177.177 6 645.092 7 106.404 0.052 0.954 33.710 4.230 0.439 0.454 0.109 3.7K 2.033 1.5M 1.623 3.8M 1.926 4.5M 4.5M 1.936 13.6B 15 088.180 14.6B 16 286.397 15.8B 17 786.329 3.106 15.030 54.634 6.588 6.349 6.960 110.5K 4.3M 110.1M 15.1M 521.4K 513.1K 0.220 4.5K 0.320 1.9M 1.060 4.1M 1.200 4.8M 4.9M 1.240 14.7B 4 243.590 15.8B 4 557.290 17.1B 4 896.330 0.320 80.7K 4.3M 6.410 20.630 115.1M 16.7M 2.630 0.610 455.8K 453.1K 0.690 82.2K * 6.6M 7.6M 7.8M 0.200 * 3.810 4.480 4.550 194.3M 18 059.100 1.8B 19 268.240 3.7B 20 735.820 3.570 4.2M 29.810 5.1M 70.420 350.8M 48.8M 10.310 3.510 4.2M 4.2M 3.530 0.047 4.8K 0.557 1.5M 0.972 4.6M 1.077 5.4M 5.5M 1.099 16.0B 11 402.193 17.2B 11 151.300 18.7B 12 652.670 1.507 6.969 28.156 4.027 2.989 3.366 110.5K 52.1M 238.3M 39.2M 693.7K 673.5K 4.8K 1.7M 6.8M 8.3M 8.3M 31.3B 33.4B 36.3B 111.7K 67.0M 286.4M 47.9M 3.3M 3.2M 0.024 0.445 0.605 0.720 0.754 4 859.020 4 888.690 5 173.690 0.027 7.349 26.230 3.810 0.803 0.830
1001.2613
2
1001
2010-05-02T19:19:42
Approximating Matrix p-norms
[ "cs.DS", "cs.CC" ]
We consider the problem of computing the q->p norm of a matrix A, which is defined for p,q \ge 1, as |A|_{q->p} = max_{x !=0 } |Ax|_p / |x|_q. This is in general a non-convex optimization problem, and is a natural generalization of the well-studied question of computing singular values (this corresponds to p=q=2). Different settings of parameters give rise to a variety of known interesting problems (such as the Grothendieck problem when p=1 and q=\infty). However, very little is understood about the approximability of the problem for different values of p,q. Our first result is an efficient algorithm for computing the q->p norm of matrices with non-negative entries, when q \ge p \ge 1. The algorithm we analyze is based on a natural fixed point iteration, which can be seen as an analog of power iteration for computing eigenvalues. We then present an application of our techniques to the problem of constructing a scheme for oblivious routing in the l_p norm. This makes constructive a recent existential result of Englert and R\"acke [ER] on O(log n)-competitive oblivious routing schemes (which they make constructive only for p=2). On the other hand, when we do not have any restrictions on the entries (such as non-negativity), we prove that the problem is NP-hard to approximate to any constant factor, for 2 < p \le q, and p \le q < 2 (these are precisely the ranges of p,q with p\le q, where constant factor approximations are not known). In this range, our techniques also show that if NP does not have quasi-polynomial time algorithms, the q->p cannot be approximated to a factor 2^{(log n)^{1-eps}}, for any \eps>0.
cs.DS
cs
Approximating Matrix p-norms Aditya Bhaskara ∗ Aravindan Vijayaraghavan † We consider the problem of computing the q 7→ p norm of a matrix A, which is defined for p, q ≥ 1, as Abstract kAkq7→p = max x6=~0 kAxkp kxkq . This is in general a non-convex optimization problem, and is a natural generalization of the well-studied question of computing singular values (this corresponds to p = q = 2). Dif- ferent settings of parameters give rise to a variety of known interesting problems (such as the Grothendieck problem when p = 1 and q = ∞). However, very little is understood about the approximability of the problem for different values of p, q. Our first result is an efficient algorithm for computing the q 7→ p norm of matrices with non-negative entries, when q ≥ p ≥ 1. The algorithm we analyze is based on a natural fixed point iteration, which can be seen as an analog of power iteration for computing eigenvalues. We then present an application of our techniques to the problem of constructing a scheme for oblivious routing in the ℓp norm. This makes constructive a recent existential result of Englert and Racke [ER09] on O(log n) competitive oblivious routing schemes (which they make constructive only for p = 2). On the other hand, when we do not have any restrictions on the entries (such as non- negativity), we prove that the problem is NP-hard to approximate to any constant factor, for 2 < p ≤ q and p ≤ q < 2 (these are precisely the ranges of p, q with p ≤ q where constant factor approximations are not known). In this range, our techniques also show that if NP /∈ DTIME(npolylog(n)), the problem cannot be approximated to a factor 2(log n)1−ε , for any constant ε > 0. 0 1 0 2 y a M 2 ] S D . s c [ 2 v 3 1 6 2 . 1 0 0 1 : v i X r a ∗Center for Computational Intractability, and Department of Computer Science, Princeton University. Supported by NSF CCF 0832797. Email: [email protected] †Center for Computational Intractability, and Department of Computer Science, Princeton University. Supported by NSF CCF 0832797. Email: [email protected] 1 1 Introduction We study the problem of computing norms of matrices. The ℓq to ℓp norm of a matrix A ∈ Rm×n is defined to be kAkq7→p = max x∈Rn,x6=~0 kAxkp kxkq , where kxkp = (x1p + · · · + xnp)1/p Throughout, we think of p, q ≥ 1. If we think of the matrix as an operator from Rn with the ℓq norm to the space Rm with ℓp norm, the norm kAkq7→p measures the 'maximum stretch' of a unit vector. Computing the q 7→ p-norm of a matrix is a natural optimization problem. For instance, it can be seen as a natural generalization of the extensively studied problem of computing the largest singular value of a matrix [HJ85]. This corresponds to the case p = q = 2. When p = 1 and q = ∞, it turns out to be the well-studied Grothendieck problem [Gro53, AN04], which is defined as max xi,yi∈{−1,1}Xi,j aijxiyj. Thus for different settings of the parameters, the problem seems to have very different flavors. We study the question of approximating kAkq7→p for different ranges of the parameters p, q. The case p = q is referred to as the matrix p-norm (denoted by kAkp), and has been considered in the scientific computing community. For instance, it is known to have connections with matrix condition number estimates (see [Hig92] for other applications). Computing kAkq7→p has also been studied because of its connections to robust optimization [Ste05]. Another special case which has been studied [Boy74, Ste05] is one where the entries of the matrix A are restricted to be non- negative. Such instances come up in graph theoretic problems, like in the ℓp oblivious routing question of [ER09]. Note that computing the matrix q 7→ p norm is a problem of maximizing a convex function over a convex domain. While a convex function can be minimized efficiently over convex domains using gradient descent based algorithms, it is in general hard to maximize them. Thus it is interesting that our algorithm can efficiently compute the norm for non-negative matrices for a range of parameters. Known algorithms. Very little is known about approximating kAkq7→p in general. For comput- ing p-norms (i.e., q = p), polynomial time algorithms for arbitrary A are known to exist only for p = 1, 2, and ∞. For the general problem, for p ≤ 2, q > 2, Nesterov[Nes98] shows that the problem can be approximated to a constant factor (which can be shown to be < 2.3), using a semidefinite programming relaxation. When the matrix has only non-negative entries, this relaxation can be shown to be exact [Ste05]. For other ranges of p, q, the best known bounds are polynomial factor approximations, obtained by 'interpolating'. For instance, for computing kAkp7→p, computing the vectors that maximize the norm for p = 1, 2, ∞, and picking the best of them gives an O(n1/4) approximation for all p (see [Hig92]). For the general problem of computing kAkq7→p, Steinberg [Ste05] gives an algorithm with an improved guarantee of O(n25/128), by taking into account the approximation algorithms of Nesterov for certain ranges. These algorithms use Holder's inequality, and a fact which follows from the duality of ℓp spaces (this sometimes allows one to 'move' from one range of parameters to another): where AT is the transpose of the matrix A, and p′ and q′ are the 'duals' of p, q respectively (i.e. 1/p + 1/p′ = 1). See Appendix A.2 for a proof. kAkq7→p = kAT kp′7→q′, 2 The hardness front. The problem is known to be NP-hard in the range q ≥ p ≥ 1 [Ste05]. Very recently in independent work, [HO09] show that it is NP-hard to compute the p-norm to arbitrary relative precision when p 6∈ {1, 2, ∞} (i.e., there cannot be a (1 + δ) approximation algorithm with run time poly(n, m, 1/δ)). 1.1 Our Results Non-negative matrices. We first consider the case of matrices A with non-negative entries. Here we prove that if 1 ≤ p ≤ q, then kAkq7→p can be computed in polynomial time. More precisely we give an algorithm which gives a (1 + δ) approximation in time polynomial in n, m, and (1/δ). Thus in particular, we give the first poly time guarantee (to the best of our knowledge) for computing the matrix p-norm for non-negative matrices. We give an analysis of a power iteration type algorithm for computing p-norms proposed by Boyd [Boy74]. The algorithm performs a fixed point computation, which turns out to mimic power iteration for eigenvalue computations. Heuristic approaches to many optimization problems involve finding solutions via fixed point computations. Our analysis proves polynomial convergence time for one such natural fixed point algorithm. These techniques could potentially be useful in other similar settings. We believe that this algorithm could be useful as an optimization tool for other problems with objectives that involve p-norms (or as a natural extension of eigenvalue computations). We now mention one such application, to oblivious routing in the ℓp norm. Application to Oblivious Routing. In the oblivious routing problem, we are given a graph G, and we need to output a 'routing scheme', namely a unit flow between every pair of vertices. Now given a set of demands (for a multicommodity flow), we can route them according to this scheme (by scaling the flows we output according to the demand in a natural way), and the total flow on each edge is obtained. The aim is to compete (in terms of, for instance, max congestion) with the best multicommodity flow 'in hindsight' (knowing the set of demands). For max-congestion (maximum total flow on an edge – which is the ℓ∞ norm of the vector of flows on edges), a beautiful result of [R08] gives an O(log n) competitive routing scheme. Englert and Racke [ER09] recently showed that there exists an oblivious routing scheme which attains a competitive ratio of O(log n) when the objective function is the ℓp-norm of the flow vector (E dimensional vector). However, they can efficiently compute this oblivious routing scheme only for p = 2. From the analysis of our algorithm, we can prove that for matrices with strictly positive entries there is a unique optimum. Using this and a related idea (Section 4), we can make the result of [ER09] constructive. Here matrix p-norm computation is used as a 'separation oracle' in a multiplicative weights style update, and this gives an O(log n)-competitive oblivious routing scheme for all ℓp-norms (p ≥ 1). Hardness of approximation. For general matrices (with negative entries allowed), we show the inapproximability of almost polynomial factor for computing the q 7→ p norm of general matrices when q ≥ p and both p, q are > 2. By duality, this implies the same hardness when both p, q are < 2 and q ≥ p.1 More precisely, for these ranges, we prove that computing kAkq7→p upto any constant factor is NP-hard. Under the stronger assumption that NP /∈ DTIME(2polylog(n)), we prove that the problem is hard to approximate to a factor of Ω(2(log n)1−ε ), for any constant ε > 0. 1When p ≤ 2 and q ≥ 2, Nesterov's algorithm gives a constant factor approximation. 3 Techniques. We first consider p 7→ p norm approximation, for which we show constant factor hardness by a gadget reduction from the gap version of MaxCut. Then we show that the p 7→ p norm multiplies upon tensoring, and thus we get the desired hardness amplification. While the proof of the small constant hardness carries over to the q 7→ p norm case with q > p > 2, in general these norms do not multiply under tensoring. We handle this by giving a way of starting with a hard instance of p 7→ p norm computation (with additional structure, as will be important), and convert it to one of q 7→ p norm computation. We find the hardness results for computing the q 7→ p norm interesting because the bounds are very similar to hardness of combinatorial problems like label cover, and it applies to a natural numeric optimization problem. The question of computing kAk∞7→p has a simple alternate formulation (Definition 6.9): given vectors a1, a2, . . . , an, find a {±} combination of the vectors so as to maximize the length (in ℓp norm) of the resultant. The previous hardness result also extends to this case. Comparison with previous work. For clarity, let us now tabulate our algorithmic and hardness results in Tables 1.1 and show how they compare with known results for different values of the parameters p, q. Each row and column in the table gives three things: the best known algorithm in general, the best known approximation algorithm when all entries of A are non-negative, and the best known hardness for this range of p, q. An entry saying "NP-hard" means that only exact polynomial time algorithms are ruled out. Discussion and open questions. All our algorithms and hardness results apply to the case p ≤ q, but we do not know either of these (even for non-negative matrices) for p > q (which is rather surprising!). For algorithmic results (for positive matrices, say) the fact that we can optimize kAxkp/kxkq seems closely tied to the fact that the set {x : kxkp/kxkq > τ } is convex for any τ > 0 and p ≤ q. However, we are not aware of any formal connection. Besides, when p > q, even for non-negative matrices there could be multiple optima (we prove uniqueness of optimum when p ≤ q). On the hardness front, the q < p case seems more related to questions like the Densest k- subgraph problem (informally, when the matrix is positive and p < q, if there is a 'dense enough' submatrix, the optimum vector would have most of its support corresponding to this). Thus the difficulties in proving hardness for the norm question may be related to proving hardness for densest subgraph. Hypercontractive norms (corresponding to q < p) have been well-studied [KKL88], and have also found prior use in inapproximability results for problems like maxcut. Also, known integrality gap instances for unique games [KV05] are graphs that are hypercontractive. We believe that computability of hypercontractive norms of a matrix could reveal insights into the approximability of problems like small set expansion [RS10] and the planted dense k-subgraph problem [BCC+10]. 1.2 Related work. A question that is very related to matrix norm computation is the Lp Grothendieck problem, which has been studied earlier by [KNS08]. The problem is to compute max xp≤1 xtBx The question of computing kAkp7→2 is a special case of the Lp Grothendieck problem (where B (cid:23) 0). [KNS08] give an optimal (assuming UGC) O(p) approximation algorithm. For B being p.s.d., 4 Table 1: Previous work Best Approximation 1 < p < 2 Hardness Non-negative matrices 1 < q < 2 poly(n) q = 2 q > 2 O(1) [Nes98] O(1)[Nes98] p < q: NP-hard NP-hard NP-hard Exact [Ste05] Exact [Ste05] Best Approximation p = 2 poly(n) Hardness Non-negative matrices Exact Exact O(1) [Nes98] NP-hard Exact [Ste05] Best Approximation p > 2 poly(n) poly(n) poly(n) Hardness Non-negative matrices p < q: NP-hard Table 2: Our results. We give better algorithms for non-negative matrices and obtain almost- polynomial hardness results when q ≥ p. Hardness 1 < p < 2 Non-negative matrices Hardness Non-negative matrices Hardness Non-negative matrices p = 2 p > 2 1 < q < 2 p ≤ q: 2(log n)1−ǫ p ≤ q: Exact -hard q = 2 q > 2 Exact Exact Exact Exact p ≤ q: 2(log n)1−ǫ p ≤ q: Exact -hard constant factor approximation algorithms are known, due to [Nes98]. Computing kAk∞7→2 reduces to maximizing a quadratic form over ±1 domain for p.s.d matrices [CW04, Nes98]. Recently, [DVTV09] studies an optimization problem which has an ℓp norm objective – they wish to find the best k-dimensional subspace approximation to a set of points, where one wishes to minimize the ℓp distances to the subspace (there are other problems in approximation theory which are of similar nature). When k = n − 1 this can be shown to reduce to the Lp Grothendieck problem for the matrix A−1. 1.3 Paper Outline We start by presenting the algorithm for positive matrices (Section 3.1), and prove poly time convergence (Section 3.2). Some additional properties of the optimization problem are discussed in Section 4 (such as unique maximum, concavity around optimum), which will be useful for an oblivious routing application. This will be presented in Section 5. Finally in Section 6, we study the inapproximability of the problem: we first show a constant factor hardness for kAkp7→p (Section 6.1), and show how to amplify it (Section 6.2). Then we use this to show hardness for kAkq7→p in section 6.3. 5 2 Notation and Simplifications We write R+ for the set of non-negative reals. For a matrix A, we let Ai denote the ith row of A. Also aij denotes the element in the ith row and jth column. Similarly for a vector x, we denote the ith co-ordinate by xi. We say that a vector x is positive if the entries xi are all > 0. Finally, for two vectors x, y, we write x ∝ y to mean that x is proportional to y, i.e., x = λy for some λ (in all places we use it, λ will be > 0). For our algorithmic results, it will be much more convenient to work with matrices where we restrict the entries to be in [1/N, 1], for some parameter N (zero entries can cause minor problems). If we are interested in a (1 + δ) approximation, we can first scale A such that the largest entry is 1, pick N ≈ (m + n)2/δ, where m, n are the dimensions of the matrix, and work with the matrix A+ 1 N J (here J is the m×n matrix of ones). The justification for this can be found in Appendix A.3. We will refer to such A as a positive matrix. 3 An Iterative Algorithm In this section, we consider positive matrices A, and prove that if 1 < p ≤ q, we can efficiently compute kAkq7→p. Suppose A is of dimensions n × n, and define f : Rn 7→ R by f (x) = kAxkp kxkq = (Pi Aixp)1/p (Pi xiq)1/q . We present an algorithm due to Boyd [Boy74], and prove that it converges quickly to the optimum vector. The idea is to consider ∇f , and rewrite the equation ∇f = 0 as a fixed point equation (i.e., as Sx = x, for an appropriate operator S). The iterative algorithm then starts with some vector x, and applies S repeatedly. Note that in the case p = 2, this mimics the familiar power iteration (in this case S will turn out to be multiplication by the matrix A (up to normalization)). 3.1 Algorithm description Let us start by looking at ∇f . kxkqkAxk1−p p ∂f ∂xi = ·Pj aijAjxp−1 − kAxkpkxk1−q kxk2 q q At a critical point, ∂f ∂xi = 0 for all i. Thus for all i, xiq−1 = kxkq q kAxkp p ·Xj aijAjxp−1 · xiq−1 (1) (2) Define an operator S : Rn + → Rn +, with the ith co-ordinate of Sx being (note that all terms involved are positive) (Sx)i =(cid:0)Xj aij(Ajx)p−1(cid:1)1/(q−1) Thus, at a critical point, Sx ∝ x. Now consider the the following algorithm: (Input. An n×n matrix A with all entries in [ 1 1: Initialize x = 1 k1kp 2: loop {T times (it will turn out T = (N n) · polylog(N, n, 1/δ))} N , 1], error parameter δ.) . 6 3: set x ← Sx. normalize x to make kxkq = 1. 4: 5: end loop A fixed point of the iteration is a vector x such that Sx ∝ x. Thus every critical point of f is a fixed point. It turns out that every positive fixed point is also a critical point. Further, there will be a unique positive fixed point, which is also the unique maximum of f . 3.2 Analyzing the Algorithm We will treat f (x) as defined over the domain Rn must be attained in Rn S n q = {x : x ∈ Rn moves to another point, until it converges. +. Since the matrix A is positive, the maximum +. Since f is invariant under scaling x, we restrict our attention to points in q , and in each iteration +, kxkq = 1}. Thus the algorithm starts with a point in S n First, we prove that the maximum of f over Rn + occurs at an interior point (i.e., none of the co-ordinates are zero). Let x∗ denote a point at which maximum is attained, i.e., f (x∗) = kAkq7→p (x∗ need not be unique). Since it is an interior point, ∇f = 0 at x∗, and so x∗ is a fixed point for the iteration. Lemma 3.1. Let x∗ ∈ S n at least 1 (N n)2 . q be a point at which f attains maximum. Then each co-ordinate of x∗ is The proof of this can be found in Section 4. Next, we show that with each iteration, the value of the function cannot decrease. This was proved by [Boy74] (we refer to their paper for the proof). Lemma 3.2. ([Boy74]) For any vector x, we have kASxkp kSxkq ≥ kAxkp kxkq The analysis of the algorithm proceeds by maintaining two potentials, defined by m(x) = min i (Sx)i xi and M (x) = max i (Sx)i xi . If x is a fixed point, then m(x) = M (x). Also, from Section 3.1, each is equal to (cid:0) kxkq As observed in [Boy74], these quantites can be used to 'sandwich' the norm – in particular, p(cid:1)1/(q−1). q kAxkp Lemma 3.3. For any positive vector x with kxkq = 1, we have m(x)q−1 ≤ kAkp q7→p ≤ M (x)q−1 The lemma is crucial – it relates the norm (which we wish to compute) to certain quantities we can compute starting with any positive vector x. We now give a proof of this lemma. Our proof, however, has the additional advantage that it immediately implies the following: Lemma 3.4. The maximum of f on S n unique critical point of f on S n q is attained at a unique point x∗. Further, this x∗ is the q (which also means it is the unique fixed point for the iteration). Proof (of Lemma 3.3). Let x ∈ S n f (x). q be a positive vector. Let x∗ ∈ S n q be a vector which maximizes 7 i = Pi xi ·Pj aij(Ajx)p−1 Pi xq = Pj(Ajx)p−1Pi aijxi Pi xq = Pj(Ajx)p Pi xq kAxkp p kxkq q = i i ≤ kAkp q7→p (3) (4) (5) The first inequality is a simple averaging argument: i Pi xi · (Sx)q−1 Pi xi · xq−1 i The last inequality uses kxkq = 1. Thus there exists an index i such that (Sx)q−1 i ≤ kAxkq7→p. The latter inequality is more tricky – it gives an upper bound on f (x∗), no matter which x ∈ S n q /xq−1 we start with. To prove this, we start by observing that x∗ is a fixed point, and thus for all k, i m(x∗)q−1 = M (x∗)q−1 = (Sx∗)q−1 k (x∗)q−1 k . Call this quantity λ. Now, let θ > 0 be the smallest real number such that x − θx∗ has a zero j for j 6= k. Since kxkq = kx∗kq and x 6= x∗, θ is well- j (strictly) for some index j. Because of these, and since each aij is strictly co-ordinate, i.e., xk = θx∗ defined, and xj > θx∗ positive, we have Sx > S(θx∗) = θ(p−1)/(q−1)S(x∗) (clear from the definition of S). k, and xj ≥ θx∗ Now, for the index k, we have (Sx)q−1 k xq−1 k > θp−1(Sx∗)q−1 k k)q−1 = θ(p−q) · λ (θx∗ Thus we have M (x)q−1 > λ (since q ≥ p, and 0 < θ < 1), which is what we wanted to prove. Let us see how this implies Lemma 3.4. q (thus x∗ is one Proof (of Lemma 3.4). Let x∗ ∈ S n fixed point of S). Suppose, if possible, that y is another fixed point. By the calculation in Eq.(5) (and since y is a fixed point and x∗ maximizes f ), we have q denote a vector which maximizes f over S n M (y)q−1 = m(y)q−1 = kAykp p kykq q = f (y)q ≤ f (x∗)p Now since y 6= x∗, the argument above (of considering the smallest θ such that y − θx∗ has a zero co-ordinate, and so on) will imply that M (y)q−1 > λ = f (x∗)p, which is a contradiction. This proves that there is no other fixed point. The next few lemmas say that as the algorithm proceeds, the value of m(x) increases, while M (x) decreases. Further, it turns out we can quantify how much they change: if we start with an x such that M (x)/m(x) is 'large', the ratio drops significantly in one iteration. Lemma 3.5. Let x be a positive vector. Then m(x) ≤ m(Sx), and M (x) ≥ M (Sx). Proof. Suppose m(x) = λ. So for every i, we have (Sx)i ≥ λxi. Now fix some index i and consider the quantity (SSx)q−1 i =Xj aij(AjSx)q−1. 8 Since A is a positive matrix and (Sx)i ≥ λxi, we must have (AjSx) ≥ λ · (Ajx) for every j. Thus (SSx)q−1 i ≥ λq−1Xj aij(Ajx)q−1 = λq−1(Sx)q−1 i . This shows that m(Sx) ≥ λ. A similar argument shows that M (Sx) ≤ M (x). Lemma 3.6. Let x be a positive vector with kxkq = 1, and suppose M (x) ≥ (1 + α)m(x). Then m(Sx) ≥(cid:0)1 + α N n(cid:1)m(x). Proof. Let m(x) = λ, and suppose k is an index such that (Sx)k ≥ (1 + α)λ · xk (such an index exists because M (x) > (1 + α)λ. In particular, (Sx) ≥ λx + αλ · ek, where ek is the standard basis vector with the kth entry non-zero. Thus we can say that for every j, Aj(Sx) ≥ λAjx + αλAj ek. The second term will allow us to quantify the improvement in m(x). Note that Ajek = ajk ≥ 1 N n Aj1 (since Ajk is not too small). Now 1 ≥ x since x has q-norm 1, and thus we have Thus (SSx)q−1 i ≥(cid:0)1 + α , implying that m(Sx) ≥(cid:0)1 + α N n(cid:1)λ. Aj(Sx) ≥(cid:0)1 + N n(cid:1)q−1λq−1(Sx)q−1 i α N n(cid:1)λ · Ajx This immediately implies that the value kAkq7→p can be computed quickly. In particular, Theorem 3.7. For any δ > 0, after O(N n·polylog(N, n, 1 finds a vector x such that f (x) ≥ (1 − δ)f (x∗) δ )) iterations, the algorithm of Section 3.1 Proof. To start with, the ratio M (x) matrix lie in [1/N, 1]). Lemma 3.6 now implies that the ratio drops from (1 + α) to (1 + α N n iterations. Thus in T = (N n)polylog(N, n, 1/δ) steps, the x we end up with has M (x) m(x) is at most N n (since we start with 1, and the entries of the 2 ) in m(x) at most (cid:0)1 + δ iterations. (N n)c(cid:1) for any constant c. This then implies that f (x) ≥ f (x∗)(cid:0)1 − δ (N n)c(cid:1), after T 4 Proximity to the optimum The argument above showed that the algorithm finds a point x such that f (x) is close to f (x∗). We proved that for positive matrices, x∗ is unique, and thus it is natural to ask if the vector we obtain is 'close' to x∗. This in fact turns out to be important in an application to oblivious routing which we consider in Section 5. We can prove that the x we obtain after T = (N n)polylog(N, n, 1/δ) iterations is 'close' to x∗. The rough outline of the proof is the following: we first show that f (x) is strictly concave 'around' the optimum 2. Then we show that the 'level sets' of f are 'connected' (precise definitions follow). Then we use these to prove that if f (x) is close to f (x∗), then x − x∗ is 'small' (the choice of norm does not matter much). Some of these results are of independent interest, and shed light into why the q 7→ p problem may be easier to solve when p ≤ q (even for non-negative matrices). 2Note that the function f is not concave everywhere (see Appendix A.1) 9 Concavity around the optimum. We now show that the neighborhood of every critical point (where ∇f vanishes) is strictly concave. This is another way of proving that every critical point is a maximum (this was the way [ER09] prove this fact in the p = q case). Taking partial derivatives of f (x) = kAxkp kxkq , we observe that ∂f ∂xi = f (x)(cid:16)Pk(Akx)p−1aki kAxkp p − xq−1 i kxkq q(cid:17) where Ak refers to the kth row of matrix A. Now, consider a critical point z, with kzkq = 1 (w.l.o.g.). We can also always assume that w.l.o.g. the matrix A is such that kAzkp = 1. Thus at a critical point z, as in Eq.(2), we have that for all i: (6) (7) (Akz)p−1aki = zq−1 i Xk Computing the second derivative of f at z, and simplifying using kAzkp = kzkq = 1, we obtain 1 p · ∂2f ∂xi∂xj(cid:12)(cid:12)(cid:12)(cid:12)z i(cid:12)(cid:12)(cid:12)(cid:12)z ∂2f ∂x2 1 p · = (p − 1)Xk = (p − 1)Xk (Akz)p−2akiakj + (q − p)zq−1 i zq−1 j (Akz)p−2a2 ki + (q − p)z2q−2 i − (q − 1)zq−2 i (8) (9) We will now show that the Hessian Hf is negative semi-definite, which proves that f is strictly in (9) is concave at the critical point z. Let ε be any vector in Rn. Then we have (the (q − 1)zq−2 split as (p − 1)zq−2 i + (q − p)zq−2 i i , and Pi,j includes the case i = j) εT Hf ε = p(p − 1)(cid:16)Xi,j Xk + p(q − p)(cid:16)Xi,j (Akz)p−2 · akiakj · εiεj −Xi i(cid:17) (zizj)q−1εiεj −Xi zq−2 i ε2 ≡ T1 + T2 (say) zq−2 i ε2 i(cid:17) We consider T1 and T2 individually and prove that they are negative. First consider T2. Since i to be a probability distribution on integers 1, . . . , n. Cauchy-Schwartz i = 1, we can consider zq Pi zq now implies that Ei[(εi/zi)2] ≥(cid:0)Ei[(εi/zi)](cid:1)2. This is equivalent to zq i · ε2 i z2 i Xi zq i · ≥(cid:16)Xi εi zi(cid:17)2 =Xi,j zq i zq j · εiεj zizj (10) Noting that q ≥ p, we can conclude that T2 ≤ 0. Now consider T1. Since z is a fixed point, it satisfies Eq. (7), thus we can substitute for xq−1 in the second term of T1. Expanding out (Akz) once and simplifying, we get T1 i p(p − 1) =Xi,j Xk = −Xk (Akz)p−2akiakj(cid:16)εiεj − (Akz)p−2Xi,j akiakj · zizj ·(cid:16) εi zi · ε2 i(cid:17) − zj zi εj zj(cid:17)2 ≤ 0 This proves that f is concave around any critical point z. 10 Level sets of f . Let S n Nτ denote {x ∈ S n q continuous and A is positive, Nτ is closed). q , as earlier, denote the (closed, compact) set {x ∈ Rn + : kxkq = 1}. Let : f (x) ≥ τ }, i.e., Nτ is an 'upper level set'. (it is easy to see that since f is Let S ⊆ S n q . We say that two points x and y are connected in S, if there exists a path (a continuous curve) connecting x and y, entirely contained in S (and this is clearly an equivalence relation). We say that a set S is connected if every x, y ∈ S are connected in S. Thus any subset of S n q can be divided into connected components. With this notation, we show ([ER09] proves the result when p = q). Lemma 4.1. The set Nτ is connected for every τ > 0. This follows easily from techniques we developed so far. Proof. Suppose if possible, that Nτ has two disconnected components S1 and S2. Since there is a unique global optimum x∗, we may suppose S1 does not contain x∗. Let y be the point in S1 which attains maximum (of f ) over S1 (y is well defined since N is closed). Now if ∇f y = ~0, we get a contradiction since f has a unique critical point, namely x∗ (Lemma 3.4). If ∇f y 6= ~0, it has to be normal to the surface S n q (else it cannot be that y attains maximum in the connected component S1). Let z be the direction of the (outward) normal to S n q at the point y. Clearly, hz, yi > 0 (intuitively this is clear; it is also easy to check). We argued that ∇f y must be parallel to z, and thus it has a non-zero component along y – in particular if we scale y (equivalent to moving along y), the value of f changes, which is clearly false! Thus Nτ has only one connected component. Since we need it for what follows, let us now prove Lemma 3.1. Proof of Lemma 3.1. Let x∗ be the optimum vector, and suppose kx∗kq = 1. Consider the quantity f (x∗)p = Pi(Aix∗)p (cid:0)Pi(x∗)q(cid:1)p/q . First, note that x∗ 6= 0 for any i. Suppose there is such an i. If we set xi = δ, each term in the i numerator above increases by at least p·δ N p (1 + pδ)), while the denominator increases from 1 to (1 + δq)p/q ≈ 1 + (p/q)δq for small enough δ. Thus since q > 1, we can set δ small enough and increase the objective. This implies that x∗ is a positive vector. N p (because Aix∗ is at least 1 N )p > 1 N , and ( 1 N + δ Note that Ajx∗ ≥ ~1 N · x∗ ≥ 1 N (because the kx∗k1 ≥ kx∗kq = 1). Thus for every i, (Sx∗)q−1 i =Xj aij(Ajx∗)p−1 ≥ n N p . Further, kAkp co-ordinate of x). Now since Eqn.(2) holds for x∗, we have p ≤ np+1, because each aij ≤ 1 and so Ajx ≤ nxmax (where xmax denotes the largest np+1 ≥ kAkp p = (Sx∗)q−1 (x∗)q−1 i i ≥ n N p(x∗)q−1 i . This implies that x∗ i > 1 (N n)2 , proving the lemma (we needed to use q ≥ p > 1 to simplify). 11 We now show that if x ∈ S n q is 'far' from x∗, then f (x) is bounded away from f (x∗). This, along with the fact that Nτ is connected for all τ , implies that if f (x) is very close to f (x∗), then kx − x∗k1 must be small. For ease of calculation, we give the formal proof only for p = q (this is also the case which is used in the oblivious routing application). It should be clear that as long as we have that the Hessian at x∗ is negative semidefinite, and third derivatives are bounded, the proof goes through. Lemma 4.2 (Stability). Suppose x ∈ S n q , with kx − x∗k1 = δ ≤ 1 (N n)12 . Then f (x) ≤ f (x∗)(cid:16)1 − δ2 (N n)6(cid:17) (11) Proof. Let ε denote the 'error vector' ε = x − x∗. We will use the Taylor expansion of f around x∗. Hf denotes the Hessian of f and gf is a term involving the third derivatives, which we will get to later. Thus we have: (note that ∇f and Hf are evaluated at x∗) f (x) = f (x∗) + ε · ∇fx∗ + 1 2 εT Hf x∗ε + gf (ε′) (12) At x∗, the ∇f term is 0. From the proof above that the Hessian is negative semidefinite, we have εT Hf ε = −p(p − 1)Xs (Asx∗)p−2(cid:16)Xi,j asiasjx∗ i x∗ j(cid:0) εi x∗ i − εj x∗ j(cid:1)2(cid:17) (13) We want to say that if kεk1 is large enough, this quantity is sufficiently negative. We should crucially use the fact that kx∗kp = kx∗ + εkp = 1 (since x is a unit vector in p-norm). This is the same as Xi x∗ i + εip =Xi x∗ i p. Thus not all εi are of the same sign. Now since kεk1 > δ, at least one of the εi must have absolute value at least δ/n, and some other εj must have the opposite sign, by the above observation. Now consider the terms corresponding to these i, j in Eqn.(13). This gives εT Hf ε ≤ −p(p − 1)Xs ≤ −p(p − 1)Xs ≤ −p(p − 1) · (Asx∗)p−2 · asiasj · (Asx∗)p−2 (Pi asi)2 δ2 N 4n6 · kAx∗kp (N n)2 p x∗ j x∗ i · δ2 n2 · 1 (N n)2 · δ2 n2 (14) (15) (16) Note that we used the facts that entries aij lie in [ 1 remains to bound the third order terms (gf , in Eqn.(12)). This contribution equals N , 1] and that x∗ i ∈ [ 1 (N n)2 , 1]. Thus it only gf (ε) = ε3 i ∂3f ∂x3 i + 1 3!Xi 1 2!Xi,j ε2 i εj ∂3f i ∂xj ∂x2 + Xi<j<k εiεjεk ∂3f ∂xi∂xj∂xk It can be shown by expanding out, and using the facts that msi ≤ N (Msx∗) and 1 x∗ i for i, j, k, ∂3f ∂xi∂xj∂xk ≤ 10p3(N n)3kAx∗kp p. 12 (17) ≤ (N n)2, that Thus, the higher order terms can be bounded by gf (ε) ≤ 10p3 · n6N 3 · kAx∗kp p · δ3 So, if δ < 1 10p3 · 1 (N n)12 , the Hessian term dominates. Thus we have, as desired: f (x) ≤ f (x∗)(cid:16)1 − δ2 (N n)6(cid:17) This proves that the vector we obtain at the end of the T iterations (for T as specified) has an (N n)c to x∗. Thus we have a polynomial time algorithm to compute x∗ to any 1 ℓ1 distance at most accuracy. 5 An Application - O(log n) Oblivious routing scheme for ℓp We believe that our algorithm for computing the kAkq7→p (for non-negative matrices) could find good use as an optimization tool. For instance, eigenvalue computation is used extensively, not just for partitioning and clustering problems, but also as a subroutine for solving semi-definite programs [GLS88]. We now give one application of our algorithm and the techniques we developed in section 4 to the case of oblivious routing in the ℓp norm. Oblivious routing. As outlined in the Introduction, the aim in oblivious routing is, given a graph G = (V, E), to specify how to route a unit flow between every pair of vertices in V . Now, given a demand vector (demands between pairs of vertices), these unit flows are scaled linearly by the demands, and routed (let us call this the oblivious flow). This oblivious flow is compared to the best flow in hindsight i.e. knowing the demand vector, with respect to some objective (say congestion), and we need to come up with a scheme which bounds this competitive ratio in the worst case. Gupta et al. [GHR06] consider the oblivious routing problem where the cost of a solution is the ℓp norm of the 'flow vector' (the vector consisting of total flow on each edge). In the case p = ∞, this is the problem of minimizing congestion, for which the celebrated result of [R08] gave an O(log n) competitive scheme. For the ℓ1 version of the problem, the optimal solution (as is easily seen) is to route along shortest paths for each demand pair. The ℓp version tries to trade-off between these two extremes. By a clever use of zero sum games, [ER09] reduced the problem of showing existence good oblivious routing schemes for any p to the ℓ∞ case. This showed (by a non-constructive argument) the existence of an O(log n) oblivious routing scheme for any p ≥ 1. They then make their result constructive for p = 2 (the proof relies heavily on eigenvectors being orthogonal). Using our algorithm for finding the ℓp-norm of a matrix and the stability of our maxima (Lemma 4.2), we make the result constructive for all ℓp. Zero-sum game framework of [ER09]: We first give a brief overview of the non-constructive proof from [ER09]. The worst-case demands for any tree-based oblivious routing scheme can be shown to be those with non-zero demands only on the edges of the graph. The competitive ratio of any tree-based oblivious routing scheme can then be reduced to a matrix p-norm computation: if M is a E × E-dimensional matrix which represents a tree-based oblivious routing scheme which 13 specifies unit flows for each demand across an edge of the graph, the competitive ratio is given by maxkukp≤1kM ukp where u ∈ RE. To show the existence of an oblivious routing scheme with competitive ratio O(log n), [ER09] define a continuous two player zero-sum game. The first player (row player) chooses from the set of all tree-based oblivious routing matrices (of dimension E × E). The second player's (column player) strategy set is the set of vectors u ∈ RE with positive entries, and kukp = 1, and the value of the game is kM ukp. With a clever use of min-max duality in zero sum games and the oblivious routing scheme of [R08] for congestion (ℓ∞-norm) as a blackbox, [ER09] show the non-constructive existence of an oblivious routing scheme M which gets a value of O(log n) for all demand vectors. Finding such a (tree-based) oblivious routing scheme requires us to solve this zero-sum game ef- ficiently. The constructive algorithm from [ER09] for ℓ2, however crucially uses the ortho-normality of the eigenspace for kM k2 computation, to solve the aforementioned zero-sum game. First we state without proof a couple of lemmas from [ER09], which will also feature in our algorithm. Lemma 5.1. Let OBL be a tree-based oblivious routing scheme given by a E ×(cid:0)n matrix (non-negative entries) and let its restriction to edges be OBL′ ∈ RE×E. The competitive ratio of the oblivious algorithm is at most kOBL′kp. 2(cid:1) dimensional Henceforth, we shall abuse notation and use OBL to refer to both the tree-based Oblivious routing matrix and its restriction to edges interchangeably. Further, Lemma 5.2. For any given vector u ∈ RE, there exists an tree-based Oblivious routing scheme (denoted by matrix OBL) such that kOBL · ukp ≤ O(log n)kukp This lemma shows that for every vector u, there exists some routing scheme (which could depend on the vector) that is O(log n) competitive. We will now show how to compute one tree- based routing matrix OBL that works for all vectors i.e. kOBLkp ≤ 1. From Lemma 5.2, we know that for every unit vector u, there exists an tree-based oblivious routing matrix such that kM · ukp ≤ O(log n). We use this to construct one tree-based oblivious routing matrix OBL that works for every load vector u. Note that the set of tree-based oblivious routing schemes is convex. Before, we show how to construct the oblivious routing scheme, we present a simple lemma which captures the continuity of the p-norm function. Lemma 5.3. Let f = kAxkp p kxkp p n-dimensional vector with minimum entry kx − yk1 = δ ≤ 1 N and let y be an (N n)2 . Let x be a vector in the δ-neighborhood of y i.e. , where A is an n × n matrix with minimum entry 1 (N n)12 . Then, 1 Proof. The proof follows just from the continuity and differentiability of the p-norm function at every point. Using the Taylor's expansion of f , we see that f (x) ≤ f (y) + 1 (18) f (x) = f (y) + ε · ∇fy + 1 2 ε′T Hf yε′ (19) where 0 ≤ ε′ ≤ ε. Choosing ε = δ = 1 co-ordinates of y as in Lemma 4.2, we see that the lemma follows. (N n)12 and using the lower bounds the matrix entries and the We now sketch how to find a tree-based oblivious routing matrix when the aggregation function is an ℓp norm. 14 Theorem 5.4. There exists a polynomial time algorithm that computes an oblivious routing scheme with competitive ratio O(log n) when the aggregation function is the ℓp norm with p > 1 and the load function on the edges is a norm. Proof sketch. The algorithm and proof follow roughly along the lines of the constructive version for p = 2 in [ER09]. As mentioned earlier, their proof uses inner products among the vectors (and the computation of eigenvalues). However, we show that the procedure still works because of the stability of our solution (Lemma 4.2. Let Jε be an E × E matrix will all entries being ǫ. Let f (M ) = kM + J 1 kp. We want a tree- based oblivious routing matrix OBL such that f (OBL) ≤ c log n for some large enough constant c. We follow an iterative procedure to obtain this matrix OBL starting with an arbitrary tree-based routing matrix M0. At stage i, we check if for the current matrix Mi , kMikp ≤ c log n. If not, using (i) which maximizes kM(i)xkp. Let M(i) the iterative algorithm in Section 3, we obtain unit vector x∗ be the tree-based oblivious routing matrix from Lemma 5.2 such that k M(i)x∗ (i)kp ≤ c log n/2 − 2. We now update E Mi+1 = (1 − λ)Mi + λ Mi Observe that this is also a tree-based oblivious routing matrix. We now show that kMi+1kp decreases by an amount Ω( 1 poly(n) ). At step i, roughly speaking, for all vectors y that are far enough from x∗ 1 (i), kMiykp ≤ kMiykp − poly(n) from Lemma 4.2 (stability). Choosing λ = Θ(n−c) for some large enough constant c > 0, it easily follows that kMi+1ykp ≤ kMiykp − 1 poly(n) . On the other hand, consider y in the δ- neighborhood of x∗ (i). Using Lemma 5.3, Hence, k Miykp ≤ c log n 2 kMi+1ykp = (1 − λ)kMiykp + λ log n ≤ kMiykp − λ × (since kMiykp ≥ c log n ) c 2 log n c 2 1 ≤ kMiykp − poly(n) poly(n) ) in Hence, it follows that the matrices Mi decrease in their p-norm by a small quantity Ω( every step. It follows that this iterative algorithm finds the required tree-based oblivious routing scheme in poly(n) steps. 1 6 Inapproximability results We will now prove that it is NP-hard to approximate kAkq7→p-norm of a matrix to any fixed constant, for any q ≥ p > 2. We then show how this proof carries over to the hardness of computing the ∞ 7→ p norm. 6.1 Inapproximability of kAkp7→p Let us start with the question of approximating kAkp7→p. We first show the following: 15 Proposition 6.1. For p ≥ 2 it is NP-hard to approximate that kAkp to some (small) constant factor η > 1. Proof: We give a reduction from the gap version of the MaxCut problem. The following is well-known (c.f. [Has01]) There exist constants 1/2 ≤ ρ < ρ′ < 1 such that given a regular graph G = (V, E) on n vertices and degree d, it is hard to distinguish between: Yes case: G has a cut containing at least ρ′(nd/2) edges, and No case: No cut in G cuts more that ρ(nd/2) edges. Suppose we are given a graph G = (V, E) which is regular and has degree d. The p-norm instance we consider will be that of maximizing g(x0, . . . , xn) (xi ∈ Rn), defined by g(x0, x1, . . . , xn) = Pi∼j xi − xjp + Cd ·(cid:0)Pi x0 + xip + x0 − xip(cid:1) . nx0p +Pi xip Here C will be chosen appropriately later. Note that if we divide by d, we can see g(x) as the ratio g(x) d = Pi∼j(cid:0)xi − xjp + C(x0 + xip + x0 − xip + x0 + xjp + x0 − xjp)(cid:1) . (20) The idea is to do the analysis on an edge-by-edge basis. Consider the function Pi∼j 2x0p + xip + xjp f (x, y) = x − yp + C(cid:0)1 + xp + 1 − xp + 1 + yp + 1 − yp(cid:1) 2 + xp + yp . Definition. A tuple (x, y) is good if both x and y lie in the interval (1 − ε, 1 + ε), and xy < 0. A technical lemma concerning f is the following Lemma 6.2. For any ε > 0, there is a large enough constant C such that f (x, y) ≤(C · 2p−1 + (1+ε)2p C · 2p−1 2+xp+yp , if (x, y) is good otherwise (21) We now present the proof of Lemma 6.2. We first start with a simpler inequality - note that this is where the condition p > 2 comes in. Lemma 6.3. For all x ∈ R, we have 1 + xp + 1 − xp 1 + xp ≤ 2p−1. Further, for any ε > 0, there exists a δ > 0 such that if x 6∈ [1 − ε, 1 + ε], then 1 + xp + 1 − xp 1 + xp ≤ 2p−1 − δ. Proof. We may assume x > 0. First consider x > 1. Write x = 1 + 2θ, and thus the first inequality simplifies to (cid:2)(1 + 2θ)p − (1 + θ)p(cid:3) ≥ (1 + θ)p − 1 + 2θp. 16 Now consider I =Z 1+θ x=1 (cid:0)(x + θ)p−1 − xp−1(cid:1)dx. For each x, the function being integrated is ≥ θp−1, since p > 2 and x > 0. Thus the integral is at least θp. Now evaluating the integral independently and simplifying, we get (1 + 2θ)p − 2(1 + θ)p + 1 ≥ p · θp, which gives the inequality since p > 2. Further there is a slack of (p− 2)θp. Now suppose 0 < x < 1. Writing x = 1 − 2θ and simplifying similarly, the inequality follows. Further, since we always have a slack, the second inequality is also easy to see. Proof (of Lemma 6.2). The proof is a straight-forward case analysis. Call x (resp. y) 'bad' if x 6∈ [1 − ε, 1 + ε]. Also, b(x) denotes a predicate which is 1 if x is bad and 0 otherwise. Case 1. (x, y) is good. The upper bound in this case is clear (using Lemma 6.3). Case 2. Neither of x, y are bad, but xy > 0. Using Lemma 6.3, we have f (x, y) ≤ C · 2p−1 + ε, which is what we want. Case 3. At least one of x, y are bad (i.e., one of b(x), b(y) is 1). In this case Lemma 6.3 gives f (x, y) ≤ x − yp + C(cid:0)(1 + xp)(2p−1 − δb(x)) + (1 + yp)(2p−1 − δb(y))(cid:1) 2 + xp + yp = C · 2p−1 + x − yp − C(cid:0)δb(x)(1 + xp) + δb(y)(1 + yp)(cid:1) 2 + xp + yp Since x−yp ≤ 2p−1(xp +yp), and one of b(x), b(y) > 0, we can choose C large enough (depending on δ), so that f (x, y) ≤ C · 2p−1. Soundness. Assuming the lemma, let us see why the analysis of the No case follows. Suppose the graph has a Max-Cut value at most ρ, i.e., every cut has at most ρ · nd/2 edges. Now consider the vector x which maximizes g(x0, x1, . . . , xn). It is easy to see that we may assume x0 6= 0, thus we can scale the vector s.t. x0 = 1. Let S ⊆ V denote the set of 'good' vertices (i.e., vertices for which xi ∈ (1 − ε, 1 + ε)). Lemma 6.4. The number of good edges is at most ρ · (S+n)d 4 . Proof. Recall that good edges have both end-points in S, and further the corresponding x values have opposite signs. Thus the lemma essentially says that there is no cut in S with ρ · (S+n)d edges. 4 Suppose there is such a cut. By greedily placing the vertices of V \ S on one of the sides of this cut, we can extend it to a cut of the entire graph with at least ρ · (S + n)d 4 + (n − S)d 4 = ρnd 2 + (1 − ρ)(n − S) 4 > ρnd 2 edges, which is a contradiction. This gives the bound. 17 Let N denote the numerator of Eq.(20). We have f (xi, xj)(2 + xip + xjp) N =Xi∼j ≤ C · 2p−1 ·(cid:0)nd + dXi ≤ Cd · 2p−1 ·(cid:0)n +Xi (1 + ε)2p xip(cid:1) + Xi∼j, good xip(cid:1) + 4 ρd(n + S) · 2p(1 + ε). Now observe that the denominator is n +Pi xip ≥ n + S(1 − ε)p, from the definition of S. Thus we obtain an upper bound on g(x) g(x) ≤ Cd · 2p−1 + ρd 4 · 2p(1 + ε)(1 − ε)−p. Hardness factor. at least Cd · 2p−1 + ρ′d In the Yes case, there is clearly an assignment of ±1 to xi such that g(x) is 4 · 2p. Thus if ε is small enough (this will make us pick C which is large), the gap between the optimum values in the Yes and No cases can be made (cid:0)1 + Ω(1) term is determined by the difference ρ′ − ρ. This proves that the p-norm is hard to approximate to some fixed constant factor. Note. In the analysis, ε was chosen to be a small constant depending on p and the gap between ρ and ρ′; C is a constant chosen large enough, depending on ε. C (cid:1), where the Ω(1) The Instance. We have argued about the hardness of computing the function g(x0, x1, . . . , xn) to some constant factor. This can be formulated as an instance of p-norm in a natural way. We describe this formally (though this is clear, the formal description will be useful when arguing about certain properties of the tensored instance which we need for proving hardness of kAkq7→p for p < q). First we do a simple change of variable and let z = n1/px0. Now, we construct the 5E × (n + 1) matrix M . For each edge e = {i, j} in E(G), we have five rows in M . Let the column indices run from 0 ≤ ℓ ≤ n. Me1,ℓ =(1 if ℓ = i 0 − 1 if ℓ = j and otherwise 0 Me2,ℓ =(n−1/p Me3,ℓ =(n−1/p 0 if ℓ = 0 if ℓ = 0 − 1 and otherwise and 1 otherwise if ℓ = i if ℓ = i We have two similar rows for Me4,ℓ and Me5,ℓ where we have corresponding values with j instead of i. It is easy to see that this matrix actually takes the same value kM kp as g. Further in the Yes case, there is a vector x = (n1/p, x1, x2, . . . , xn) with xi = ±1, that attains the high value (C.d.2p−1 + ρ′d.2p−2). 18 6.2 Amplifying the gap by tensoring We observe that the matrix p 7→ p-norm is multiplicative under tensoring. More precisely, Lemma 6.5. Let M , N be square matrices with dimensions m × m and n × n respectively, and let p ≥ 1. Then kM ⊗ N kp = kM kp · kN kp. The tensor product M ⊗ N is defined in the standard way – we think of it as an m × m matrix of blocks, with the i, jth block being a copy of N scaled by mij. It is well-known that eigenvalues (p = 2) mutliply under tensoring. We note that it is crucial that we consider kAkp. Matrix norms kAkq7→p for p 6= q do not in general multiply upon tensoring. Proof. Let λ(A) denote the p-norm of a matrix A. Let us first show the easy direction, that λ(M ⊗ N ) ≥ λ(M ) · λ(N ). Suppose x, y are the vectors which 'realize' the p-norm for M, N respectively. Then k(M ⊗ N )(x ⊗ y)kp (Mi · x)(Nj · y)p p =Xi,j =(cid:16)Xi (Mi · x)p(cid:17)(cid:16)Xj (Nj · y)p(cid:17) = λ(M )p · λ(N )p Also kx ⊗ ykp = kxkp · kykp, thus the inequality follows. Let us now show the other direction, i.e., λ(M ⊗ N ) ≤ λ(M ) · λ(N ). Let x, z be mn dimensional vectors such z = (A ⊗ B)x. We will think of x, z as being divided into m blocks of size n each. Further by x(i) (and z(i)), we denote the vector in Rn which is formed by the ith block of x (resp. z). For ease of notation, let us consider n × m matrix X with the ith column of X being vector x(i) j refer to the jth row of matrix (and similarly define Z). At the expense of abusing notation, let X t X. Also, let the element-wise p-norm of matrix M be defined as M ⊙p =(cid:0)Xi,j mp ij(cid:1)1/p It is easy to observe that Z t = AX tBT . Further, kzkp = Z⊙p. We now expand out Z and rearrange the terms to separate out the operations of B and A, in order to bound Z⊙p using the p-norms of A and B. Hence, we have kzkp p = AX tBtp ⊙p = m Xi=1 n j(cid:17)p Xj=1(cid:16)(AiX1, AiX2, . . . , AiXn)Bt But from definition, kM xkp p =Pk(Bkx)p ≤ λ(M )kxkp p. 19 Hence, by applying the operator p-norm bound of B, kzkp k(AiX1, AiX2, . . . , AiXn)kp p m n = λ(B)p p ≤ λ(B)pXi Xi=1 Xk=1 ≤ λ(B)pλ(A)pXk = λ(A)pλ(B)pXp ⊙p (AiXk)p = λ(B)pXk Xi (AiXk)p kXkkp p Since X⊙p = kxkp = 1, we have kzkp ≤ λ(A)λ(B). Note. We note that the tensoring result is stated for square matrices, while the instances above are rectangular. This is not a problem, because we can pad 0s to the matrix to make it square without changing the value of the norm. The tensored matrix and amplification Consider any constant γ > 0. We consider the instance of the matrix M obtained in the proof of Proposition 6.1, and repeatedly tensor it with M k = logη γ times to obtain M ′ = M ⊗k. From Lemma 6.5, there exist τC and τS where τC/τS > γ such that in the No case, for every vector y ∈ R(n+1)k, kAykp ≤ τS. Further, in the Yes case, there is a vector y′ = (n1/p, x1, x2, . . . , xn)⊗k where xi = ±1 (for i = 1, 2, . . . n) such that kM ′y′kp ≥ τC. Note: Our techniques work even when we take the tensor product logc n for some constant c. Thus we can conclude: Theorem 6.6. For any γ > 0 and p ≥ 2, it is NP-hard to approximate the p-norm of a matrix within a factor γ. Also, it is hard to approximate the matrix p-norm to a factor of Ω(2(log n)1−ε ) for any constant ε > 0, unless NP ⊆ DTIME(2polylog(n))). Properties of the tensored instance: We now establish some structure about the tensored instance, which we will use crucially for the hardness of q 7→ p norm. Let the entries in vector y′ be indexed by k-tuple I = (i1, i2, . . . , ik) where ik ∈ {0, 1, . . . , n). It is easy to see that I = ±nw(I)/p where w(I) number of 0s in tuple y′ Let us introduce variables xI = n−w(I)/pyI where w(I) = number of 0s in tuple I. It is easy to observe that there is a matrix B such that kM ′ykp kykp = kBxkp PI nw(I)xI p = g′(x) Further, it can also be seen that in the Yes case, there is a ±1 assignment for xI which attains the value g′(x) = τC. 6.3 Approximating kAkq7→p when p 6= q. Let us now consider the question of approximating kAkq7→p. The idea is to use the hardness of approximating kAkp7→p. We observed in the previous section that the technique of amplifying 20 hardness for computing the q 7→ p-norm by tensoring a (small) constant factor hardness does not work when q 6= p. However, we show that we can obtain such amplified label-cover like hardness if the instance has some additional structure. In particular, we show the instances that we obtain from the tensoring the hard instances of kAkp can be transformed to give such hard instances for kAkq7→p. We illustrate the main idea by first showing a (small) constant factor hardness: let us start with the following maximization problem (which is very similar to Eqn.(20)) g(x0, x1, . . . , xn) = (cid:16)Pi∼j xi − xjp + Cd ·(cid:0)Pi x0 + xip + x0 − xip(cid:1)(cid:17)1/p . (22) Notice that x0 is now 'scaled differently' than in Eq.(20). This is crucial. Now, in the Yes case, we have (cid:0)nx0q +Pi xiq(cid:1)1/q g(x) ≥ (cid:0)ρ′(nd/2) · 2p + Cnd · 2p(cid:1)1/p (2n)1/q . max x Indeed, there exists a ±1 solution which has value at least the RHS. Let us write N for the numerator of Eq.(22). Then g(x) = N (cid:0)nx0p +Pi xip(cid:1)1/p × (cid:0)nx0p +Pi xip(cid:1)1/p (cid:0)nx0q +Pi xiq(cid:1)1/q . Suppose we started with a No instance. The proof of the q = p case implies that the first term in this product is at most (to a (1 + ε) factor) (cid:0)ρ(nd/2) · 2p + Cnd · 2p(cid:1)1/p (2n)1/p . Now, we note that the second term is at most (2n)1/p/(2n)1/q. This follows because for any vector y ∈ Rn, we have kykp/kykq ≤ n(1/p)−(1/q). We can use this with the 2n-dimensional vector (x0, . . . , x0, x1, x2, . . . , xn) to see the desired claim. From this it follows that in the No case, the optimum is at most (upto an (1 + ε) factor) (cid:0)ρ(nd/2) · 2p + Cnd · 2p(cid:1)1/p (2n)1/q . This proves that there exists an α > 1 s.t. it is NP-hard to approximate kAkq7→p to a factor better than α. A key property we used in the above argument is that in the Yes case, there exists a ±1 solution for the xi (i ≥ 0) which has a large value. It turns out that this is the only property we need. More precisely, suppose A is an n × n matrix, let αi be positive integers (we will actually use the fact that they are integers, though it is not critical). Now consider the optimization problem maxy∈Rn g(y), with (23) In the previous section, we established the following claim from the proof of Theorem 6.6. Claim 6.7. For any constant γ > 1, there exist thresholds τC and τS with τC/τS > γ, such that it is NP-hard to distinguish between: 21 g(y) = kAykp (Pi αiyip)1/p Yes case. There exists a ±1 assignment to yi in (23) with value at least τC, and No case. For all y ∈ Rn, g(y) ≤ τS. Proof. Follows from the structure of Tensor product instance. We can now show that Claim 6.7 implies the desired result. Theorem 6.8. It is NP-hard to approximate kAkq7→p to any fixed constant γ for q ≥ p > 2. Proof. As in previous proof (Eq.(22)), consider the optimization problem maxy∈Rn h(y), with h(y) = By definition, h(y) = g(y) · (24) (25) . kAykp (Pi αiyiq)1/q (Pi αiyip)1/p (Pi αiyiq)1/q Completeness. Consider the value of h(y) for A, αi in the Yes case for Claim 6.7. Let y be a ±1 solution with g(y) ≥ τC. Because the yi are ±1, it follows that h(y) ≥ τC ·(cid:0)Xi αi(cid:1)(1/p)−(1/q). Soundness. Now suppose we start with an A, αi in the No case for Claim 6.7. First, note that the second term in Eq.(25) is at most (cid:0)Pi αi(cid:1)(1/p)−(1/q). To see this, we note that αi are positive integers. Thus by considering the vector (y1, . . . , y1, y2, . . . , y2, . . . ), (where yi is duplicated αi times), and using kukp/kukq ≤ d(1/p)−(1/q) for u ∈ Rd, we get the desired inequality. This gives that for all y ∈ Rn, h(y) ≤ g(y) ·(cid:0)Xi αi(cid:1)(1/p)−(1/q) ≤ τS ·(cid:0)Xi αi(cid:1)(1/p)−(1/q). This proves that we cannot approximate h(y) to a factor better than τC/τS, which can be made an arbitrarily large constant by Claim 6.7. This finishes the proof, because the optimization problem maxy∈Rn h(y) can be formulated as a q 7→ p norm computation for an appropriate matrix as earlier. Note that this hardness instance is not obtained by tensoring the q 7→ p norm hardness instance. It is instead obtained by considering the kAkp hardness instance and transforming it suitably. 6.4 Approximating kAk∞7→p The problem of computing the ∞ 7→ p norm of a matrix A turns out to have a very natural and elegant statement in terms of column vectors of the matrix A. We first introduce the following problem: Definition 6.9 (Longest Vector Problem). Let v1, v2, . . . , vn be vectors over R. The Longest Vector problem asks for the max x∈{−1,1}n kXi xivikp 22 Note that this problem differs from the well-studied Shortest Vector Problem [Kho04] for lat- tices,which has received a lot of attention in the cryptography community over the last decade [Reg06]. The shortest vector problem asks for minimizing the same objective in Definition 6.9 when xi ∈ Z. We now observe that computing the ∞ 7→ p norm of the matrix is equivalent to finding the length of the longest vector, where the vectors vi are the columns of A. Observation 6.10. Computing the kAk∞7→p norm of a matrix is equivalent to computing the length of the Longest vector problem where the vectors are the column vectors of A. Proof. First note that kAxkp = kPi xiaikp. The observation follows by noticing that this is maximized when xi = 1 for all i. The ∞ 7→ p norm of the matrix also seems like a natural extension of the Grothendieck problem[AN04, KNS08]. When p = 1, we obtain the original Grothendieck problem, and the p = 2 case is the ℓ2 Grothendieck problem and maximizes the quadratic form for p.s.d. matri- ces. Further, as mentioned earlier there is a constant factor approximation for 1 ≤ p ≤ 2 using [Nes98]. However, for the p > 2, we show that there is Ω(2(log n)1−ǫ ) hardness for computing ∞ 7→ p norm assuming N P does not have quasipolynomial time algorithms using the same techniques from Theorem 6.8. Theorem 6.11. It is NP-hard to approximate kAk∞7→p to any constant γ for p > 2 and hard to ap- proximate within a factor of Ω(2(log n)1−ε ) for any constant ε > 0, assuming NP /∈ DTIME(2polylog(n)). The proof of Theorem 6.8 also works out for q = ∞ by noting that the second expression in Eq. (25) is instead maxx (Pi αixip)1/p x∞ which is also maximized when xi = 1 for all i. 7 Acknowledgements We would like to thank our advisor Moses Charikar for many useful suggestions and comments throughout the progress of the work. We would also like to thank David Steurer for several dis- cussions and pointing out connections to other problems. Finally we would like to thank Rajsekar Manokaran for various interactions about the inapproximability results. References [AN04] Noga Alon and Assaf Naor. Approximating the cut-norm via grothendieck's inequality. In STOC '04: Proceedings of the thirty-sixth annual ACM symposium on Theory of computing, pages 72–80, New York, NY, USA, 2004. ACM. [BCC+10] Aditya Bhaskara, Moses Charikar, Eden Chlamtac, Uriel Feige, and Aravindan Vi- jayaraghavan. Detecting high log-densities – an o(n1/4) approximation for densest k-subgraph. CoRR, abs/1001.2891, 2010. [Boy74] David W. Boyd. The power method for p norms. Linear Algebra and its Applications, 9:95 – 101, 1974. [CW04] Moses Charikar and Anthony Wirth. Maximizing quadratic programs: Extending grothendieck's inequality. Foundations of Computer Science, Annual IEEE Symposium on, 0:54–60, 2004. 23 [DVTV09] Amit Deshpande, Kasturi R. Varadarajan, Madhur Tulsiani, and Nisheeth K. Vishnoi. Algorithms and hardness for subspace approximation. CoRR, abs/0912.1403, 2009. [ER09] Matthias Englert and Harald Racke. Oblivious routing in the l p-norm. In Proc. of the 50th FOCS, 2009. [GHR06] Anupam Gupta, Mohammad T. Hajiaghayi, and Harald Racke. Oblivious network design. In SODA '06: Proceedings of the seventeenth annual ACM-SIAM symposium on Discrete algorithm, pages 970–979, New York, NY, USA, 2006. ACM. [GLS88] Martin Grotschel, L´aszl´o Lov´asz, and Alexander Schrijver. Geometric Algorithms and Combinatorial Optimization. Springer-Verlag, New York, 1988. [Gro53] Alexander Grothendieck. Resume de la theorie metrique des produits tensoriels topologiques. Bol. Soc. Mat. Sao Paulo, 8:1–79, 1953. [Has01] Johan Hastad. Some optimal inapproximability results. J. ACM, 48(4):798–859, 2001. [Hig92] Nicholas J. Higham. Estimating the matrix p-norm. Numer. Math, 62:511–538, 1992. [HJ85] [HO09] Roger A. Horn and Charles R. Johnson. Matrix analysis / Roger A. Horn, Charles R. Johnson. Cambridge University Press, Cambridge [Cambridgeshire] ; New York, 1985. Julien M. Hendrickx and Alex Olshevsky. Matrix p-norms are np-hard to approximate if p neq 1,2,infty. CoRR, abs/0908.1397, 2009. [Kho04] Subhash Khot. Hardness of approximating the shortest vector problem in lattices. Foundations of Computer Science, Annual IEEE Symposium on, 0:126–135, 2004. [KKL88] J. Kahn, G. Kalai, and N. Linial. The influence of variables on boolean functions. In SFCS '88: Proceedings of the 29th Annual Symposium on Foundations of Computer Science, pages 68–80, Washington, DC, USA, 1988. IEEE Computer Society. [KNS08] Guy Kindler, Assaf Naor, and Gideon Schechtman. The ugc hardness threshold of the ℓp grothendieck problem. In SODA '08: Proceedings of the nineteenth annual ACM-SIAM symposium on Discrete algorithms, pages 64–73, Philadelphia, PA, USA, 2008. Society for Industrial and Applied Mathematics. [KV05] [Nes98] [R08] Subhash A. Khot and Nisheeth K. Vishnoi. The unique games conjecture, integrality gap for cut problems and embeddability of negative type metrics into ℓ1. In FOCS '05: Proceedings of the 46th Annual IEEE Symposium on Foundations of Computer Science, pages 53–62, Washington, DC, USA, 2005. IEEE Computer Society. Yurii Nesterov. Semidefinite relaxation and nonconvex quadratic optimization. Opti- mization Methods and Software, 9:141–160, 1998. Harald Racke. Optimal hierarchical decompositions for congestion minimization in networks. In STOC '08: Proceedings of the 40th annual ACM symposium on Theory of computing, pages 255–264, New York, NY, USA, 2008. ACM. [Reg06] Oded Regev. Lattice-based cryptography. In In Proc. of the 26th Annual International Cryptology Conference (CRYPTO, pages 131–141, 2006. 24 [RS10] [Ste05] Prasad Raghavendra and David Steurer. Graph expansion and the unique games con- jecture. In STOC '10: Proceedings of ACM symposium on Theory of Computing, 2010. Daureen Steinberg. Computation of matrix norms with applications to robust optimiza- tion. Research thesis, Technion - Israel University of Technology, 2005. A Miscellany A.1 Non-convex optimization Note that computing the p 7→ p norm is in general not a convex optimization problem. function f defined by f (x) = kAxkp kxkp is not in general concave. For example, consider i.e., the A =(cid:18) 1 2 3 1 (cid:19) ; x =(cid:18) 0.1 0.1 (cid:19) ; y =(cid:18) 0.2 0.5 (cid:19) In this case, with p = 2.5, for instance, it is easy to check that f ((x + y)/2) < (f (x) + f (y))/2. Thus f is not concave. However, it could still be that f raised to a certain power is concave. A.2 Duality The following equality is useful in 'moving' from one range of parameters to another. We use the fact that kukp = maxy : kykp′ =1 yT x, where p′ is the 'dual norm', satisfying 1/p+1/p′ = 1. (similarly q′ denotes the dual norm of q) kAkq7→p = max kxkq=1 kAxkp = max kxkq=1 kykp′ =1 yT Ax = max kxkq=1 kykp′ =1 xT AT y = kAT kp′7→q′ (26) A.3 Moving to a positive matrix We now show that by adding a very small positive number to each entry of the matrix, the q 7→ p- norm does not change much. Lemma A.1. Let A be an n × n matrix where the maximum entry is scaled to 1. Let Jǫ be the matrix with all entries being ǫ. Proof. We first note that kAkq7→p ≥ 1 (because the maximum entry is 1). It is also easy to see that Jε is maximized by the vector with all equal entries. Hence kJεkq7→p ≤ n1+ 1 q ǫ. Hence, by using the fact that k·kq7→p is a norm, the lemma follows. p − 1 q(cid:1) kA + Jεkq7→p ≤ kAkq7→p(cid:0)1 + ǫn1+ 1 p − 1 25
1204.5442
1
1204
2012-04-24T17:33:56
Faster Treasure Hunt and Better Strongly Universal Exploration Sequences
[ "cs.DS" ]
In this paper, we investigate the explicit deterministic treasure hunt problem in a $n$-vertex network. This problem was firstly introduced by Ta-Shma and Zwick in \cite{TZ07} [SODA'07]. Note also it is a variant of the well known rendezvous problem in which one of the robot (the treasure) is always stationary. In this paper, we propose an $O(n^{c(1+\frac{1}{\lambda})})$-time algorithm for the treasure hunt problem, which significantly improves the currently best known result of running time $O(n^{2c})$ in \cite{TZ07}, where $c$ is a constant induced from the construction of an universal exploration sequence in \cite{R05,TZ07}, and $\lambda \gg 1$ is an arbitrary large, but fixed, integer constant. The treasure hunt problem also motivates the study of strongly universal exploration sequences. In this paper, we also propose a much better explicit construction for strongly universal exploration sequences compared to the one in \cite{TZ07}.
cs.DS
cs
Faster Treasure Hunt and Better Strongly Universal Exploration Sequences✩ Faculty of Science and Technology, University of the Faroe Islands, Torshavn, Faroe Islands Qin Xin1,∗ Abstract In this paper, we investigate the explicit deterministic treasure hunt problem in a n-vertex network. This problem was firstly introduced by Ta-Shma and Zwick in [10] [SODA'07]. Note also it is a variant of the well known rendezvous problem in which one of the robot (the treasure) is always stationary. In this paper, we propose an O(nc(1+ 1 λ ))-time algorithm for the treasure hunt problem, which significantly improves the currently best known result of running time O(n2c) in [10], where c is a constant induced from the construction of an universal exploration sequence in [9, 10], and λ ≫ 1 is an arbitrary large, but fixed, integer constant. The treasure hunt problem also motivates the study of strongly universal exploration sequences. In this paper, we also propose a much better explicit construction for strongly universal exploration sequences compared to the one in [10]. Keywords: Design and analysis of algorithms, distributed computing, graph searching and robotics, rendezvous, strongly universal exploration sequences. ✩ A preliminary version of this paper appears in the Proceedings of the 18th International Sym- posium on Algorithms and Computation, ISAAC 2007. ∗Correspondence to: Faculty of Science and Technology, University of the Faroe Islands, Noatun 3, FO 100, Torshavn, Faroe Islands. Tel.: +298 352575. Email address: [email protected] (Qin Xin) 1Part of this research was performed while this author was a senior research fellow at Universit´e catholique de Louvain, Belgium, a scientist/postdoctoral research fellow at Simula Research Lab- oratory and a postdoctoral research fellow at The University of Bergen, Norway. This work was partially supported by Visiting Scholarship of State Key Laboratory of Power Transmission Equip- ment & System Security and New Technology (Chongqing University) (2007DA10512710408). Preprint submitted to Theoretical Computer Science June 15, 2018 1. Introduction In the rendezvousproblem ([3, 7, 10]), two robots are placed in an unknown environment modeled by a finite, connected, undirected graph G = (V, E). We assume that V = n. The size of the network, i.e., the number of vertices in the graph is not known to the robots. The edges incident on a vertex u ∈ V are numbered 0, 1, 2,· · · , deg(u)− 1, in a predetermined manner, where deg(u) is the degree of u. In general, the numbering is not assumed to be consistent, i.e., an edge (u, v) ∈ E may be the i-th edge of u but the j-th edge of v, where i 6= j. When a robot is in a vertex u ∈ V it is told the degree deg(u) of u. However, all vertices of the same degree are not distinguishable. The robots are not allowed to put any information such as tokens or markers at the vertices that they visit. At any time step a robot is only allowed to either traverse an edge, or stay in place. When the robot is at a vertex u it may ask to traverse the i-th edge (u, v) ∈ E of u, where 0 ≤ i ≤ deg(u) − 1. The robot observes itself at vertex v, the another endpoint of this edge. As described before, the i-th edge of u is the j-th edge of v, for some 0 ≤ j ≤ deg(v) − 1. In general j 6= i. There are two different variants of the model used in the field. In the first one, the robot is told the index j of the edge it used to enter v. This allows the robot to return to u at the next step, if it wants to do so. This variant of the problem is called the rendezvous problem with backtracking. In the second variant of the model, the robot observes itself at vertex v without knowing which edge it used to get there. We call this variant of the problem the general rendezvous problem. Same as most of work [3, 7, 10] described, the main strategy is to give the two robots deterministic sequences of instructions which will gurrantee that two robots would eventually meet each other, no matter in which graph they are located, and no matter when they are activated. It is, however, expected that such a meeting would happen as soon as possible. A robot is unaware of the whereabouts of another robot, even it is very close to another one in the graph. The two robots meet only when they are both active and are at same vertex at same time. In particular, the two robots may traverse the same edge but in different directions, and still miss each other. For the deterministic solutions, it has to be assumed that two robots have dif- ferent labels, e.g. L1 6= L2. Without such an assumption there is no deterministic way of breaking symmetry and no deterministic strategy is possible. An example has been shown in [10] if the two robots are completely identical. Assume G is a ring on n vertices and that the edges are labeled so that out of every vertex, edge 0 goes clockwise, while edge 1 goes anti-clockwise. If the two robots start the 2 same time at different vertices and follow the same instructions, they would never meet! Same as the previous work [10], We also assume that the moves of the two robots are synchronous after both of them are activated. The crutial feature of this problem is that the two robots may be activated at different times which decides arbitrarily by the adversary. A meeting can happen only when both robots are ac- tive. The time complexity of any solution is bounded by the number of steps used to complete such a task, which counts from the activation of the second robot. The treasure hunt problem is a variant of the rendezvous problem in which the robots are assigned the labels 0 and 1 and robot 0, the treasure, cannot move, which firstly introduced in [10]. As in the rendezvous problem, the treasure and the seeking robot are not necessarily activated at the same time. 1.1. Previous work Dessmark etal. [3] presented a deterministic solution of the rendezvous prob- lem which guarantees a meeting of the two robots after a number of steps which is polynomial in n, the size of the graph, l, the length of the shorter of the two labels, and τ, the difference between their activation times. More specifically, the bound on the number of steps that they obtain is O(n5√τ l + n10l). In the same paper, Dessmark etal. [3] also ask whether it is possible to obtain a polynomial bound that is independent of τ. Kowalski and Malinowski [7] have recently presented a deterministic solution to the rendezvous problem that guarantees a meeting af- ter at most O(n15 + l3) steps, which is independent of τ, and also firstly answer the open problem of [3] when backtracking is allowed. Very recently in [10], Ta- Shma, and Zwick propose a deterministic solution that guarantees a rendezvous within O(n5l) time units after the activation of the second robot, and also uses backtracking. This is the currently best known solution. All the solutions men- tioned above rely on the existence of a universal traversal sequences, introduced by Aleliunas etal. [1], and are therefore non-explicit. The first explicit solution for both rendezvous problem and treasure hunt problem can be found in [10]. This work allows backtracking, by using the explicit construction of a stronglyuniver- sal exploration sequence SUES. The time complexity of the solutions for both problems is O(n2c), where c is a huge constant. Other variants of the rendezvous problem could be found in [5]. Note if randomization is allowed, then both the rendezvous problem and the treasure hunt problem have the trivial solutions using a polynomial number of steps in term of the size of the graph with high probability, e.g. a random walk by Coppersmith etal. [2]. 3 1.2. Our results We mainly study here the explicit deterministic treasure hunt problem with backtracking in a n-vertex network. It is a variant of the well known rendezvous problem in which one of the robot (the treasure) is always stationary. We propose an O(nc(1+ 1 λ ))-time algorithm for treasure hunt problem, which significantly im- proves currently best known result with running time O(n2c) in [10], where c is a constant induced from the construction of an universal exploration sequence in [9, 10], λ ≫ 1 is a constant integer. The treasure hunt problem also motivates the study of strongly universal exploration sequences. In this paper, we also propose a much better explicit construction for strongly universal exploration sequences (SUESs) compared to the one in [10]. The improved explicit SUESscould be also used to improve the explicit solution of the rendezvous problem in [10]. 2. The treasure hunt problem The treasure hunt problem is a variant of the well known rendezvous problem in which one of the robots, the treasure, is always stationary. A seeking robot and the treasure are placed in an unknown location in an unknown environment, modeled again by a finite, connected, undirected graph. Same as in the rendezvous problem, the treasure and the seeking robot searching for it are not necessarily activated at the same time. The most difficult case of the problem is when the seeking robot is activated before the treasure. To clarify our presentation, we give a formal definition for the treasure hunt problem, which is a modified version from the rendezvous problem by Ta-Shma and Zwick [10]. Formally, a deterministic solution for the general treasure hunt problem (with- out backtracking) is a deterministic algorithm that computes a function f : Z + × Z + → Z +, where for d ≥ 1 and t ≥ 0 we have 0 ≤ f (d, t) ≤ d− 1. This function defines the walk carried out by the seeking robot as follows: at the t-th time unit since activation, when at a vertex of degree d, use edge number f (d, t) to walk in the next step. A deterministic solution for the treasure hunt problem with backtracking is a deterministic algorithm that computes a function f : Z + × Z + × (Z +)∗ → Z +, where for every d ≥ 1, t ≥ 0, and T ∈ (Z +)∗ we have 0 ≤ f (d, t, T ) ≤ d − 1. This function defines the walk carried out by the seeking robot as follows: at the t-th time unit since activation, when at a vertex of degree d, if the sequence of edge numbers assigned to the edges that were used to enter the vertices at the previous time units is T ∈ (Z +)∗ the robot will exit the current node using the 4 edge number f (d, t, T ), in the next step. In our solutions that use this model, the function f depends on T only through its last element, which is the same as [10]. Throughout most of this paper we shall assume that the graph G in which the robots (seeking robot and the treasure robot) are placed is a d-regular graph, for some d ≥ 3. Note it is easy to extend the solutions given for the d-regular graphs to general graphs using the ideas from [3]. 3. Universal and strongly universal exploration sequences For clarity of presentation, we use the same definitions as in [10]. Let G = (V, E) be a d-regular graph. A sequence τ1τ2 · · · τk ∈ {0, 1, 2, · · · , d − 1}k and a starting edge e0 = (v−1, v0) ∈ E define a walk v−1, v0,· · · , vk as follows: For 1 ≤ i ≤ k, if (vi−1, vi) is the s-th edge of vi, let ei = (vi, vi+1) be the (s + τi)-th edge of vi, where we assume here that the edges of vi are numbered 0, 1,· · · , d − 1, and that s + τi is computed by modulo d. Definition 1. (Universal Exploration Sequences (UESs) [6, 10]) A sequence τ1τ2 · · · τl ∈ {0, 1,· · · , d − 1}l is a universal exploration sequence for d-regular graphs of size at most n if for every connected d-regular graph G = (V, E) on at most n vertices, any numbering of its edges, and any starting edge (v−1, v0) ∈ E, the walk obtained visits all the vertices of the graph. Reingold [9] obtains an explicit construction of polynomial-size UES: Theorem 1. ([9]) There exists a constant c ≥ 1 such that for every d ≥ 3 and n ≥ 1, a UES of length O(nc) for d-regular graphs of size at most n can be constructed, deterministically, in polynomial time. Definition 2. (Strongly Universal Exploration Sequences (SUESs) [10]) A pos- sibly infinite sequence τ = τ1τ2 · · · , where τi ∈ {0, 1,· · · , d − 1}, is a strongly universal exploration sequence (SUES) for d-regular graphs with cover time p(·), if for any n ≥ 1, any contiguous subsequence of τ of length p(n) is a UES for d-regular graphs of size n. Let O(nc) be the length of a UES (see [9, 10]), the main Theorem of this section shows that strongly universal exploration sequences (SUESs) do exist and they can be constructed deterministically in polynomial time with cover time p(n) = O(nc(1+ 1 λ )), which significantly improves the currently best known result in [10] with p(n) = O(n2c), where c is a constant induced from the construction 5 of an universal exploration sequence in [9, 10], and λ ≫ 1 is an arbitrary large, but fixed, integer constant. c), then we In this section, we firstly give a weak solution with p(n) = O(n 3 2 show our main result described above. 3.1. Explicit SUESs with p(n) = O(n 3 2 c) In this section, we propose a new explicit strongly universal exploration se- quence with cover time p(n) = O(n c) for the d-regular graphs of size at most n, where c is the same constant as was used in [9, 10]. It is a weak version (a special case) of our main result in Section 3.2, but which gives more intuition on our new approaches in Section 3.2. 3 2 3.1.1. Properties of exploration sequences k τ−1 , where τ−1 k−1 · · · τ−1 A very useful property of exploration sequences [6, 10] is that walks defined by an exploration sequence can be reversed. For τ = τ1τ2 · · · τk ∈ {0, 1,· · · , d − 1}k, we let τ−1 = τ−1 i = d − τi (mod d). It is not difficult to see that a walk defined by an exploration sequence τ can be backtracked by executing the sequence 0τ−10. Note that if e0, e1,· · · , ek is the sequence of edges defined by τ, starting with e0, then executing 0τ−10, starting with ek defines the sequence ek, ek, ek−1,· · · , e0, e0, where e is the reverse of edge e. Also, if τ is a universal exploration sequence for graphs with size at most n, then so is 0τ−1 starting with the last edge defined by τ. 1 3.1.2. Construction of SUESs Let Un be a sequence of length n which is a universal exploration sequence for d-regular graphs of size at most bn c , for some constants b > 1, and c > 1, which can be constructed, deterministically, in polynomial time of n due to Theorem 1. We are interested in sequences Un only if n is a power of 2. For the sake of . Therefore, Uk is a prefix of technique, we can construct Un = U1U1U2U4 · · · U n Un, for every k = 2i and n = 2j, where i < j. 2 1 A strongly universal exploration sequence Sn is a sequence defined in a re- cursive manner. Our approach is based on the similar idea in [10], but different interleaving components between the symbols which originate from Un. We begin with S1 = U1. Assume that Un = u1u2 · · · un and that n ≥ 2. Define, Sn = u1Sr10S−1 r1 0u2Sr20S−1 r2 0u3 · · · uiSri0S−1 ri 0ui+1 · · · un−1Srn−10S−1 rn−10un, 6 for every 1 ≤ i < n, we set ri = hii, where hii = max{2j2 2 j ≤ i, j ∈ Z +}. ) is also adopted Similar construction strategy for Un (e.g., Un = U1U1U2U4 · · · U n to construct Sn. Note that the sequence Sk is a prefix of Sn for every k = 2p and n = 2j, where p < j. Moreover, we also assign ri = rn−i, for every 1 ≤ i < n. inate from Un and in the alignment of the 0′s: n differs with Sn only on the symbols that orig- Furthermore, the sequence S−1 2 3 i+10Srn−i0S−1 rn−i u−1 i · · · u−1 2 0Srn−10S−1 rn−1 u−1 1 . n 0Sr10S−1 r1 n−1 · · · u−1 u−1 n = u−1 S−1 Note that ri ≤ 3√i2. Thus, if r n S 3√( n 2 )2, the first half of Sn is equal to = 3p( n 2 )20, and ends with a full copy of S 3√( n 2 )2, followed by a 0. Similarly, the S n 2 second half of Sn starts with a full copy of S−1 . In the following, we bound 3√( n 2 )2 the length of Sn. 2 Lemma 1. For every n = 2j, where j ≥ 1, Sn < 258n. PROOF. Let sn = Sn. It is not difficult to see that s1 = 1, s2 = 6, s4 = 16, s8 = 46, s16 = 126, s32 = 286,· · · , s256 = 3426. The claim that sn ≤ 258n for every n ≥ 512 then follows by using simple induction. It is not difficult to see that S2i = U2i + (U2i − 1) · 2(S1 + 1) + ⌊ 2i 3 ⌋−1 X j=1 ⌊U2i − 1 3j 2 2 ⌋ · 2(S2j − S2j−1) s2i ≤ 2i + 4 · 2i + 2i · ⌊ 2i 3 ⌋−1 X j=1 2(s2j − s2j−1) 3j 2 2 = 2i + 4 · 2i + 2i · ( 4 X j=1 2(s2j − s2j−1) 3j 2 2 + ⌊ 2i 3 ⌋−1 X j=5 2(s2j − s2j−1) 3j 2 2 ) ≤ 5 · 2i + 2i · ≤ 5 · 2i + 2i · ≤ 5 · 2i + 2i · 4 X j=1 4 X j=1 4 X j=1 + 2i · + 2i · + 2i · 2(s2j − s2j−1) 3j 2 2 2(s2j − s2j−1) 3j 2 2 2(s2j − s2j−1) 3j 2 2 7 ⌊ 2i 3 ⌋−1 X j=5 +∞ X j=5 +∞ X j=5 2(s2j−1 + 2s ) 2(j−1) 3 2 3j 2 2 + 2i · +∞ X j=5 4 3j 2 2 2(s2j−1 + 2s 2 3j 2 2 + 2) 2(j−1) 3 2(s2j−1 + 2s + 2) 2(j−1) 3 2 3j 2 2 < 6 · 2i + 2i · 4 X j=1 2(s2j − s2j−1) +∞ X j=5 + 2i · +∞ X 2(s2j−1 + 2s ) 2(j−1) 3 2 ) 3j 2 2 2(j−1) 3 2 3j 2 2 35√2 8 2(s2j−1 + 2s ) + 2i · 2(s2j−1 + 2s +∞ X j=5 3j 2 2 j=5 3j 2 2 ) 2(j−1) 3 2 2(258 · 2j−1 + 2 · 258 · 2 2(j−1) 3 ) ≤ 6 · 2i + 2i · (5 + ≤ 6 · 2i + 12 · 2i + 2i · ≤ 18 · 2i + 2i · +∞ X j=5 3j 2 2 2− 17 1 − 1 2 6 5 6 ) + 2 2− 5 ≤ 18 · 2i + 2i · 258 · ( 1 − 1√2 < 18 · 2i + 2i · 258 · (0.93) = (257.94) · 2i < 258 · 2i. The sequence Sn possesses the following interesting combinatorial property: Lemma 2. Let k and n ≥ 2k Sn or S−1 2k subsequence, Sk or 0S−1 k . n of length s 3 2 3 2 be powers of 2. Then, every subsequence T of 2 contains, as a contiguous 3 + 1 = S 2k 3 2 + 1 ≤ 516k PROOF. We prove the claim by induction on n. If n = 2k vacuously satisfied as Sn contains a full Sk. 3 2 then the claim is 3 Assume, therefore, that the claim holds for every m = 2j ′ that satisfies 2k 2 ≤ m < n = 2j. We show that it also holds for n. Let T be a subsequence of Sn of length s + 1. Essentially the same argument works if T is a subsequence of n . We use the exactly same arguments as in Lemma 6.2 [10]. such length of S−1 For completeness of our presentaion, we reproduce the analysis from [10]. 2k 3 2 We consider the following cases: Case 1: T is completely contained in a subsequence Sm or S−1 m < n. m of Sn, for some The claim then follows immediately from the induction hypothesis. Case 2: T is completely contained in a subsequence Sm0S−1 m < n. m of Sn, for some 8 3 2 3 2 2k or T ′′ ≥ 1 2 s . Assume that T ′′ ≥ 1 2 s In this case, T = T ′0T ′′, where T ′ is a suffix of Sm and T ′′ is a prefix of S−1 m . . Another case is m , and T ′′ ≥ 1 2 . , it follows that m ≥ 2k 2 s m , in the sense that they differ only in symbols , half Either T ′ ≥ 1 2 s 2k analogous. As T ′′ is a prefix of S−1 Now, S−1 is almost a prefix of S−1 that originate directly from Sm. In particular, a prefix of S−1 the length of S , ends with a full copy of Sk, followed by 0. Case 3: T contains a symbol ul of Sn that originates from Un. In this case, T = T ′ulT ′′. Again, we have either T ′ ≥ 1 2 s or T ′′ ≥ 1 2 s m of length 1 2 s . 3 2 2k 2k 2k 2k 2k 2k 3 2 3 2 3 2 3 2 3 2 k 3 Assume again that T ′′ ≥ 1 2 s 3 2 2k . Another case is analogous. Let Sn,l = ulSrl0S−1 rl 0ul+1 · · · un−1Srn−10S−1 rn−10un 3 3 2 ⌉k 2 be the first index after l which is divisible by k be the suffix of Sn that starts with the symbol ul that originates from the l-th symbol of Un. We claim that the prefix of Sn,l of length 1 contains a copy of 2 s Sk. Let l′ = ⌈ l 2 . Clearly rl 0 · · · ul′Sk is a rl′ ≥ k and hence Sk is a prefix of Srl′ . Thus, S′ = ulSrl0S−1 prefix of Sm,l which ends with a complete Sk. As for every l ≤ i < l′ we have , we have that S′ is contained in the first half of S , and hence ri = r as expected. S′ ≤ 1 2 s i mod k 2k 2k 2k 3 2 3 2 3 2 3 2 k 3 We are now ready to prove the following Theorem. Theorem 2. If for any n ≥ 1 of the power of 2 there exists an UES of length O(nc) for a d-regular graph of size at most n, then there is an infinite SUES for this d- regular graph with cover time p(n) = O(n 2 c), where c is the fixed constant from the construction of an universal exploration sequence in [9, 10]. Furthermore, the SUESs can be constructed deterministically in polynomial time. 3 PROOF. Let us look at the recursive definition of Sn and ignore all the recursive components of Sj such as j < n, and their inverses, which because that 0S−1 j 0 reverses the actions of Sj. The left parts are Un = u1, u2, u3,· · · , un. However, c , for some con- note that Un is a UES for for d-regular graphs of size at least bn stants b ≥ 1 and c > 1 due to Theorem 1. Theorem 1 also show that such a UES can be constructed, deterministically, in polynomial time. According to Lemma 2, we know that every subsequence T of the SUES we constructed of length s 2 ) contains, as a contiguous subsequence, a full copy of Sn. Consequently, there is an infinite SUES for d-regular graphs with cover time + 1 = O(n 2n 3 2 3 1 9 3 2 c), where c is the fixed constant from the construction of an univer- p(n) = O(n sal exploration sequence in [9, 10]. Furthermore, the SUESs can be constructed deterministically in polynomial time. This thus gives us an explicit solution to the treasure hunt problem. In fact, the seeking robot just need run the SUES. The adversary will decide when the treasure is put into the graph. But note that the subsequence of a SUES with length p(n) starting at the activation point forms a UES, and then the seeking robot finds the treasure by following the instruction of the sequence. 3.2. Explicit SUESs with p(n) = O(nc(1+ 1 λ )) In this section, we propose our main result, a new explicit strongly universal exploration sequence with cover time p(n) = O(nc(1+ 1 λ )), which significantly improves the currently best known result in [10] with p(n) = O(n2c), where c is a fixed constant induced from the construction of an universal exploration sequence in [9, 10], and λ ≫ 1 is an arbitrary large, but fixed, integer constant. 3.2.1. Treasure sequences A treasure sequence is an infinite sequence Q(λ) = q1, q2, q3, q4,· · · , based on a constant integer λ ≫ 1 such as qi = +∞ X j=i (2 −j λ + 2−( 2λ+1 λ2+λ·j+ λ λ+1−2) + 2−( λ+1 λ ·j−2)), where i ≥ 1. It is easy to see that the treasure sequences Q(λ) are monotonely decreasing, limi→+∞ qi = 0. We call the first element or term qi < 1 in Q(λ) a golden ball, where i ≥ 1. Similarly, we call the fixed index i of the golden ball of Q(λ) as the goldenpoint, where λ ≫ 1 is an arbitrary large, but fixed, integer constant. The following Lemma follows directly. Lemma 3. There exists a golden ball in the treasure sequence. The property of the treasure sequence will be used to further reduce the length of the cover time p(n) of the SUESs later. 10 3.2.2. Construction of SUESs d-regular graphs of size at most bn for every k = 2i and n = 2j, where i < j, Uk is a prefix of Un. Same as in Section 3.1.2, let Un be a sequence of length n which is a UES for c , for some constants b ≥ 1, and c > 1. And We now define recursively a sequence Sn of strongly universal exploration sequences. We start with S1 = U1. Assume that Un = u1u2 · · · un and that n ≥ 2. Define, 1 r1 0u2Sr20S−1 Sn = u1Sr10S−1 r2 0u3 · · · uiSri0S−1 ri 0ui+1 · · · un−1Srn−10S−1 where for every 1 ≤ i < n, we set ri = hhiii, where hhiii = max{2j2 λ j ≤ i, j ∈ Z +}. Note that as n = 2j, for some j ≥ 1, for every k = 2p, where p < j, the sequence Sk is constructed as a prefix of Sn. Moreover, we also assign ri = rn−i for every 1 ≤ i < n. rn−10un, λ+1 Note that ri ≤ λ+1√iλ. Thus, if r n S λ+1√( n 2 )λ0, and ends with a full copy of S λ+1√( n S n 2 the second half of Sn starts with a full copy of S−1 = λ+1p( n 2 2 )λ, the first half of Sn is equal to 2 )λ, followed by a 0. Similarly, λ+1√( n 2 )λ . We next bound the length of Sn. Let q[λ] g , g denote the golden ball and golden point of the treasure sequence 2(S2j −S2j−1) Q(λ), respectively. Further more, if g ≥ 2, we set Cf inite = Pg−1 , and Cmax = max{yy = S2j 2j , f or 1 ≤ j ≤ g− 1}, otherwise Cf inite = Cmax = 0 (e.g. g = 1). Consequently, q[λ] g , g, Cf inite, and Cmax are constants due to the definition of the treasure sequence and the fact that only a finite number of terms are involved in the calculations, where 0 < q[λ] (λ+1)j j=1 2 λ g < 1, and g ≥ 1. We are now ready to prove the following Lemma. Lemma 4. For every n = 2j, where j ≥ 1, Sn < ( 5+Cf inite PROOF. Let sn = Sn. For every n ≤ 2g−1, we know it is true due to the defi- nition of the constant Cmax. The claim that sn < ( 5+Cf inite + Cmax)n for every n ≥ 2g then follows by using the induction. It is not difficult to see that + Cmax)n. 1−q 1−q [λ] g [λ] g S2i = U2i + (U2i − 1) · 2(S1 + 1) + 11 ⌊ λ λ+1⌋·i−1 X j=1 ⌊U2i − 1 (λ+1)j λ 2 ⌋ · 2(S2j − S2j−1) s2i ≤ 2i + 4 · 2i + 2i · ⌊ λ λ+1⌋·i−1 X j=1 2(s2j − s2j−1) (λ+1)j 2 λ g−1 X j=1 2(s2j − s2j−1) (λ+1)j 2 λ ⌊ λ λ+1⌋·i−1 X j=g 2(s2j − s2j−1) (λ+1)j 2 λ = 2i + 4 · 2i + 2i · g−1 X < 5 · 2i + 2i · j=1 2(s2j − s2j−1) (λ+1)j 2 λ ≤ 5 · 2i + Cf inite · 2i + 2i · +∞ X j=g + 2i · +∞ X + 2i · 2(s2j−1 + 2s j=g 2(s2j − s2j−1) (λ+1)j 2 λ + 2) (j−1)λ λ+1 2 < 5 · 2i + Cf inite · 2i + 2i · ( = 5 · 2i + Cf inite · 2i + 2i · ( g 5 + Cf inite 1 − q[λ] 5 + Cf inite 1 − q[λ] g < 5 · 2i + Cf inite · 2i + 2i · Cmax · (1 − q[λ] g ) + 2i · ( = 2i · ( 5 + Cf inite 1 − q[λ] g + Cmax). (λ+1)j λ 2 + Cmax) · +∞ X j=g + Cmax) · q[λ] g (j−1)λ λ+1 + 2) 2(2j−1 + 2 · 2 (λ+1)j 2 λ 5 + Cf inite 1 − q[λ] g + Cmax) · q[λ] g Using the same arguments as in Lemma 2, we can prove the following Lemma. Lemma 5. Let k and n ≥ 2k n of length s Sn or S−1 a full of Sk or 0S−1 k . λ+1 2k λ λ+1 λ be powers of 2. Then, every subsequence T of λ ) contains, as a contiguous subsequence, λ+1 +1 = O(k PROOF. We prove the claim by induction on n. If n = 2k vacuously satisfied as Sn contains a full Sk. λ+1 λ then the claim is Assume, therefore, that the claim holds for every m = 2j ′ that satisfies 2k λ ≤ m < n = 2j. We show that it also holds for n. Let T be a subsequence of Sn of length s + 1. Essentially the same argument works if T is a subsequence of such length of S−1 n . λ+1 2k λ λ+1 Same as in Lemma 2, we study the following cases: Case 1: T is completely contained in a subsequence Sm or S−1 m < n. m of Sn, for some 12 The claim then follows immediately from the induction hypothesis. Case 2: T is completely contained in a subsequence Sm0S−1 m < n. m of Sn, for some λ λ 2k 2k λ+1 λ+1 λ+1 λ . Now, S−1 or T ′′ ≥ 1 2 s In this case, T = T ′0T ′′, where T ′ is a suffix of Sm and T ′′ is a prefix of S−1 m . . Another 2k , it follows that m , in the sense that they differ only m of length Either T ′ ≥ 1 2 s case is analogous. As T ′′ is a prefix of S−1 m ≥ 2k in symbols that originate directly from Sm. In particular, a prefix of S−1 1 2 s Case 3: T contains a symbol ul of Sn that originates from Un. In this case, T = T ′ulT ′′. Again, we have either T ′ ≥ 1 2 s . Assume that T ′′ ≥ 1 2 s m , and T ′′ ≥ 1 2 s , ends with a full copy of Sk, followed by 0. is almost a prefix of S−1 , half the length of S or T ′′ ≥ λ+1 λ+1 λ+1 λ+1 λ+1 2k 2k 2k λ 2k λ k λ λ λ 1 2 s λ+1 λ 2k . Assume again that T ′′ ≥ 1 2 s λ+1 λ 2k . Another case is analogous. Let Sn,l = ulSrl0S−1 rl 0ul+1 · · · un−1Srn−10S−1 rn−10un λ+1 λ+1 be the suffix of Sn that starts with the symbol ul that originates from the l-th contains a copy symbol of Un. We claim that the prefix of Sn,l of length 1 2 s λ+1 of Sk. Let l′ = ⌈ l λ . Clearly rl′ ≥ k and hence Sk is a prefix of Srl′ . Thus, S′ = ulSrl0S−1 rl 0 · · · ul′Sk is a prefix of Sm,l which ends with a complete Sk. As for every l ≤ i < l′ we have , and hence ri = r S′ ≤ 1 2 s , we have that S′ is contained in the first half of S as expected. λ be the first index after l which is divisible by k λ ⌉k i mod k λ+1 λ+1 λ+1 λ+1 2k 2k 2k k λ λ λ λ Furthermore, by the same arguments as in Theorem 2, we have: Theorem 3. If for every n ≥ 1 of the power of 2 there is an UES of length O(nc) for d-regular graphs of size at most n, then there exists an infinite SUES for d- regular graphs with cover time p(n) = O(nc(1+ 1 λ )), where c is the constant in- duced from the construction of an universal exploration sequence in [9, 10], and λ ≫ 1 is an arbitrary large, but fixed, integer constant. Moreover, the SUESs can be constructed deterministically in polynomial time. PROOF. Let us ignore all the recursive components of Sj from Sn such as j < n, and their inverses, which because that 0S−1 j 0 reverses the actions of Sj. The left parts are Un = u1, u2, u3,· · · , un. Moreover, note that Un is a UES for for d- regular graphs of size at least bn c , for some constants b ≥ 1 and c > 1 due to 1 13 Theorem 1. Theorem 1 also show that such a UES could be constructed, deter- ministically, in polynomial time. According to Lemma 5, we know that every subsequence T of the SUES we constructed of length s λ ) con- tains, as a contiguous subsequence, a full copy of Sn. Consequently, there is an λ c), where c is infinite SUES for d-regular graphs with cover time p(n) = O(n the fixed constant from the construction of an universal exploration sequence in [9, 10]. Furthermore, the SUESs can be constructed deterministically in polyno- mial time. + 1 = O(n λ+1 λ+1 λ+1 λ 2n Finally, by employing the standard double techniques in d-regular graphs of size at most n, we get the desired result. Theorem 4. If for every n ≥ 1 there is an UES of length O(nc) for d-regular graphs of size at most n, then there exists an infinite SUES for d-regular graphs with cover time p(n) = O(nc(1+ 1 λ )), where c is the fixed constant induced from the construction of an universal exploration sequence in [9, 10], and λ ≫ 1 is an arbitrary large, but fixed, integer constant. Moreover, the SUESs can be constructed deterministically in polynomial time. Remark 1. It is easy to extend the solutions given for the d-regular graphs to general graphs by using the ideas from [3, 10]. Remark 2. The proposed explicit SUESs could be also used to improve the run- ning time of the explicit solution suggested for the rendezvous problem with back- tracking in [10]. 4. Conclusion and open problems We proposed an improved explicit deterministic solution for the treasure hunt problem with backtracking. More precisely, we derived an O(nc(1+ 1 λ ))-time algo- rithm for the treasure hunt, which significantly improves the currently best known result with running time O(n2c) in [10], where c is the constant induced from the construction of an universal exploration sequence in [9, 10], λ ≫ 1 is an arbitrary large, but fixed, integer constant. In this work, we also proposed a much better explicit construction for strongly universal exploration sequences compared to the one in [10]. The proposed explicit SUESs could be also used to further improve the time complexity of the explicit solution addressed for the rendezvous problem with backtracking in [10]. 14 The existence of strongly universal exploration sequences without backtrack- ing is left as an intriguing open problem. References [1] R. Aleliunas, R.M. Karp, R.J. Lipton, L. Lovasz, and C. Rackoff. Random walks, universal traversal sequences, and the complexity of maze problems. InProceedingsofthe20thAnnualSymposiumonFoundationsofComputer Science,FOCS, pp. 218 -- 223, 1979. [2] D. Coppersmith, P. Tetali, and P. Winkler. Collisions among random walks on a graph. SIAM Journal on Discrete Mathematics, 6(3): pp. 363 -- 374, 1993. [3] A. Dessmark, P. Fraigniaud, D. Kowalski, and A. Pelc. Deterministic ren- dezvous in graphs. Algorithmica,46(1): pp. 69 -- 96, 2006. [4] A. Dessmark, P. Fraigniaud, and A. Pelc. Deterministic rendezvous in graphs. InProceedingsof11thAnnualEuropeanSymposiumonAlgorithms, ESA, pp. 184 -- 195, 2003. [5] G. De Marco, L. Gargano, E. Kranakis, D. Krizanc, A. Pelc, and U. Vac- caro. Asynchronous deterministic rendezvous in graphs. Theoretical Com- puterScience, 355(3): pp. 315 -- 326, 2006. [6] M. Koucky: Universal traversal sequences with backtracking. J. Comput. Syst.Sci., 65(4): 717-726 (2002) [7] D.R. Kowalski and A. Malinowski. How to meet in anonymous network. In Proceedingsofthe13thInternationalColloquiumonStructuralInformation andCommunicationComplexity,SIROCCO, pp. 44 -- 58, 2006. [8] D.R. Kowalski and A. Pelc. Polynomial deterministic rendezvous in arbitrary graphs. InProceedingsofthe15thInternationalSymposiumonAlgorithms andComputation,ISAAC, pp. 644 -- 656, 2004. [9] O. Reingold. Undirected ST-connectivity in logspace. InProceedingsofthe 37thAnnualACMSymposiumonTheoryofComputing, STOC, pp. 376 -- 385, 2005. 15 [10] A. Ta-Shma, and U. Zwick. Deterministic rendezvous, treasure hunts and strongly universal exploration sequences, inProceedingsofthe18thAnnual ACM-SIAM Symposium on Discrete Algorithms, SODA, pp. 599 -- 608, 2007. 16
1211.1002
1
1211
2012-11-05T20:53:18
OSNAP: Faster numerical linear algebra algorithms via sparser subspace embeddings
[ "cs.DS", "math.PR" ]
An "oblivious subspace embedding (OSE)" given some parameters eps,d is a distribution D over matrices B in R^{m x n} such that for any linear subspace W in R^n with dim(W) = d it holds that Pr_{B ~ D}(forall x in W ||B x||_2 in (1 +/- eps)||x||_2) > 2/3 We show an OSE exists with m = O(d^2/eps^2) and where every B in the support of D has exactly s=1 non-zero entries per column. This improves previously best known bound in [Clarkson-Woodruff, arXiv:1207.6365]. Our quadratic dependence on d is optimal for any OSE with s=1 [Nelson-Nguyen, 2012]. We also give two OSE's, which we call Oblivious Sparse Norm-Approximating Projections (OSNAPs), that both allow the parameter settings m = \~O(d/eps^2) and s = polylog(d)/eps, or m = O(d^{1+gamma}/eps^2) and s=O(1/eps) for any constant gamma>0. This m is nearly optimal since m >= d is required simply to no non-zero vector of W lands in the kernel of B. These are the first constructions with m=o(d^2) to have s=o(d). In fact, our OSNAPs are nothing more than the sparse Johnson-Lindenstrauss matrices of [Kane-Nelson, SODA 2012]. Our analyses all yield OSE's that are sampled using either O(1)-wise or O(log d)-wise independent hash functions, which provides some efficiency advantages over previous work for turnstile streaming applications. Our main result is essentially a Bai-Yin type theorem in random matrix theory and is likely to be of independent interest: i.e. we show that for any U in R^{n x d} with orthonormal columns and random sparse B, all singular values of BU lie in [1-eps, 1+eps] with good probability. Plugging OSNAPs into known algorithms for numerical linear algebra problems such as approximate least squares regression, low rank approximation, and approximating leverage scores implies faster algorithms for all these problems.
cs.DS
cs
OSNAP: Faster numerical linear algebra algorithms via sparser subspace embeddings Jelani Nelson∗ Huy L. Nguyen† January 9, 2014 Abstract An oblivious subspace embedding (OSE) given some parameters ε, d is a distribution D over matrices Π ∈ Rm×n such that for any linear subspace W ⊆ Rn with dim(W ) = d it holds that PΠ∼D (∀x ∈ W kΠxk2 ∈ (1 ± ε)kxk2 ) > 2/3. We show an OSE exists with m = O(d2 /ε2) and where every Π in the support of D has exactly s = 1 non-zero entries per column. This improves previously best known bound in [Clarkson- Woodruff, arXiv abs/1207.6365]. Our quadratic dependence on d is optimal for any OSE with s = 1 [Nelson-Nguyen, 2012]. We also give two OSE’s, which we call Oblivious Sparse Norm- Approximating Pro jections (OSNAPs), that both allow the parameter settings m = O(d/ε2 ) and s = polylog(d)/ε, or m = O(d1+γ /ε2 ) and s = O(1/ε) for any constant γ > 0.1 This m is nearly optimal since m ≥ d is required simply to no non-zero vector of W lands in the kernel of Π. These are the first constructions with m = o(d2 ) to have s = o(d). In fact, our OSNAPs are nothing more than the sparse Johnson-Lindenstrauss matrices of [Kane-Nelson, SODA 2012]. Our analyses all yield OSE’s that are sampled using either O(1)-wise or O(log d)- wise independent hash functions, which provides some efficiency advantages over previous work for turnstile streaming applications. Our main result is essentially a Bai-Yin type theorem in random matrix theory and is likely to be of independent interest: i.e. we show that for any U ∈ Rn×d with orthonormal columns and random sparse Π, all singular values of ΠU lie in [1 − ε, 1 + ε] with good probability. Plugging OSNAPs into known algorithms for numerical linear algebra problems such as ap- proximate least squares regression, low rank approximation, and approximating leverage scores implies faster algorithms for all these problems. For example, for the approximate least squares regression problem of computing x that minimizes kAx − bk2 up to a constant factor, our em- beddings imply a running time of O(nnz(A) + rω ), which is essentially the best bound one could hope for (up to logarithmic factors). Here r = rank(A), nnz(·) counts non-zero entries, and ω is the exponent of matrix multiplication. Previous algorithms had a worse dependence on r. ∗ Institute for Advanced Study. [email protected]. Supported by NSF CCF-0832797 and NSF DMS-1128155. †Princeton University. [email protected]. Supported in part by NSF CCF-0832797 and a Gordon Wu fellowship. 1We say g = Ω(f ) when g = Ω(f /polylog(f )), g = O(f ) when g = O(f · polylog(f )), and g = Θ(f ) when g = Ω(f ) and g = O(f ) simultaneously. 1 1 Introduction There has been much recent work on applications of dimensionality reduction to handling large datasets. Typically special features of the data such as low “intrinsic” dimensionality, or sparsity, are exploited to reduce the volume of data before processing, thus speeding up analysis time. One success story of this approach is the applications of fast algorithms for the Johnson-Lindenstrauss lemma [JL84], which allows one to reduce the dimension of a set of vectors while preserving all pairwise distances. There have been two popular lines of work in this area: one focusing on fast embeddings for all vectors [AC09, AL09, AL11, HV11, KMR12, KW11, Vyb11], and one focusing on fast embeddings specifically for sparse vectors [Ach03, BOR10, DKS10, KN10, KN12]. In this work we focus on the problem of constructing an oblivious subspace embedding (OSE) [Sar06] and on applications of these embeddings. Roughly speaking, the problem is to design a data-independent distribution over linear mappings such that when data come from an unknown low-dimensional subspace, they are reduced to roughly their true dimension while their structure (all distances in the subspace in this case) is preserved at the same time. It can be seen as a continuation of the approach based on the Johnson-Lindenstrauss lemma to subspaces. Here we focus on the setting of sparse inputs, where it is important that the algorithms take time proportional to the input sparsity. These embeddings have found applications in numerical linear algebra problems such as least squares regression, low rank approximation, and approximating leverage scores [CW09, CW12, DMIMW12, NDT09, Sar06, Tro11]. We refer the interested reader to the surveys [HMT11, Mah11] for an overview of this area. Throughout this document we use k · k to denote ℓ2 norm in the case of vector arguments, and ℓ2→2 operator norm in the case of matrix arguments. Recall the definition of the OSE problem. Definition 1. The oblivious subspace embedding problem is to design a distribution over m × n matrices Π such that for any d-dimensional subspace W ⊂ Rn , with probability at least 2/3 over the choice of Π ∼ D , the fol lowing inequalities hold for al l x ∈ W simultaneously: (1 − ε)kxk ≤ kΠxk ≤ (1 + ε)kxk. Here n, d, ε, δ are given parameters of the problem and we would like m as smal l as possible. OSE’s were first introduced in [Sar06] as a means to obtain fast randomized algorithms for several numerical linear algebra problems. To see the connection, consider for example the least squares regression problem of computing argminx∈Rd kAx − bk for some A ∈ Rn×d . Suppose Π ∈ Rm×n preserves the ℓ2 norm up to 1 + ε of all vectors in the subspace spanned by b and the columns of A. Then computing argminx kΠAx − Πbk instead gives a solution that is within 1 + ε of optimal. Since the subspace being preserved has dimension at most r + 1 ≤ d + 1, where r = rank(A), one only needs m = f (r + 1, ε) for whatever function f is achievable in some OSE construction. Thus the running time for approximate n × d regression becomes that for f (r, ε) × d regression, plus an additive term for the time required to compute ΠA, Πb. Even if A has full column rank and r = d this is still a gain for instances with n ≫ d. Also note that the 2/3 success probability guaranteed by Definition 1 can be amplified to 1 − δ by running this procedure O(log(1/δ)) times with independent randomness and taking the best x found in any run. Naively there is no gain from the above approach since the time to compute ΠA could be as large as matrix multiplication between an m × n and n × d matrix. Since m ≥ d in any OSE, this is O(ndω−1 ) time where ω < 2.373 . . . [Wil12] is the exponent of square matrix multiplication, and 2 exact least squares regression can already be computed in this time bound. The work of [Sar06] overcame this barrier by choosing Π to be a special structured matrix, with the property that ΠA can be computed in time O(nd log n) (see also [Tro11]). This matrix Π was the Fast Johnson- Lindenstrauss Transform of [AC09], which has the property that Πx can be computed in roughly O(n log n) time for any x ∈ Rn . Thus, multiplying ΠA by iterating over columns of A gives the desired speedup. The O(nd log n) running time of the above scheme to compute ΠA seems almost linear, and thus nearly optimal, since the input size is already nd to describe A. While this is true for dense A, in many practical instances one often expects the input matrix A to be sparse, in which case linear time in the input description actually means O(nnz(A)), where nnz(·) is the number of non-zero entries. For example consider the case of A being the Netflix matrix, where Ai,j is user i’s score for movie j : A is very sparse since most users do not watch, let alone score, most movies [ZWSP08]. In a recent beautiful and surprising work, [CW12] showed that there exist OSE’s with m = poly(d/ε), and where every matrix Π in the support of the distribution is very sparse: even with only s = 1 non-zero entries per column! Thus one can transform, for example, an n × d least squares regression problem into a poly(d/ε) × d regression problem in nnz(A) time. They gave two sparse OSE constructions: one with m = O(d4 /ε4 ), s = 1, and another with m = O(d2 /ε4 ), s = O((log d)/ε).2 The second construction is advantageous when d is larger as a function of n and one is willing to slightly worsen the nnz(A) term in the running time for a gain in the input size of the final regression problem. We also remark that the analyses given of both constructions in [CW12] require Ω(d)-wise independent hash functions, so that from the O(d)-wise independent seed used to generate Π naively one needs an additive Ω(d) time to identify the non-zero entries in each column just to evaluate the hash function. In streaming applications this can be improved to additive O(log2 d) time using fast multipoint evaluation of polynomials (see [KNPW11, Remark 16]), though ideally if s = 1 one could hope for a construction that allows one to find, for any column, the non-zero entry in that column in constant time given only a short seed that specifies Π (i.e. without writing down Π explicitly in memory, which could be prohibitively expensive for n large in applications such as streaming and out-of-core numerical linear algebra). Recall that in the entry-wise turnstile streaming model, A receives entry-wise updates of the form ((i, j ), v), which cause the change Ai,j ← Ai,j + v . Updating the embedding thus amounts to adding v times the j th row of Π to ΠA, which should ideally take O(s) time and not O(s) + O(log2 d). In the following paragraph we let SΠ be the space required to store Π implicitly (e.g. store the seed to some hash function that specifies Π). We let tc be the running time required by an algorithm which, given a column index and the length-SΠ seed specifying Π, returns the list of all non-zeroes in that column in Π. Our Main Contribution: We give an improved analysis of the s = 1 OSE in [CW12] and show that it actually achieves m = O(d2 /ε2 ), s = 1. Our analysis is near-optimal since m = Ω(d2 ) is re- quired for any OSE with s = 1 [NN12]. Furthermore, for this construction we show tc = O(1), SΠ = O(log(nd)). We also show that the two sparse Johnson-Lindenstrauss constructions of [KN12] both 2Recently after sharing the statement of our bounds with the authors of [CW12], independently of our methods they have been able to push their own methods further to obtain m = O((d2/ε2 ) log6 (d/ε)) with s = 1, nearly matching our bound, though only for the s = 1 case. This improves the two bounds in the topmost row of Figure 1 under the [CW12] reference to come within polylog d or polylog k factors of the two bounds in our topmost row. 3 reference [CW12] regression O(nnz(A)) + O(d5 ) O(nnz(A) log n) + O(r3 ) this work O(nnz(A) + d3 log d) O(nnz(A) + rω ) leverage scores low rank approximation O(nnz(A)) + O(nk5 ) O(nnz(A) + r3 ) O(nnz(A) log k) + O(nk2 ) O(nnz(A)) + O(nk2 ) O(nnz(A) + rω ) O(nnz(A) logO (1) k) + O(nkω−1 ) O(nnz(A)) + O(nkω−1+γ ) Figure 1: The improvement gained in running times by using our OSE’s. Dependence on ε sup- pressed for readability; see Section 3 for dependence. yield OSE’s that allow for the parameter settings m = O(d/ε2 ), s = polylog(d)/ε, tc = O(s), SΠ = O(log d log(nd)) or m = O(d1+γ /ε2 ), s = Oγ (1/ε), tc = O((log d)/ε), SΠ = O(log d log(nd)) for any desired constant γ > 0. This m is nearly optimal since m ≥ d is required simply to ensure that no non-zero vector in the subspace lands in the kernel of Π. Plugging our improved OSE’s into previous work implies faster algorithms for several numerical linear algebra problems, such as approximate least squares regression, low rank approximation, and approximating leverage scores. We remark that both of the OSE’s in this work and [CW12] with s ≫ 1 have the added benefit of preserving any subspace with 1/ poly(d), and not just constant, failure probability. 1.1 Problem Statements and Bounds We now formally define all numerical linear algebra problems we consider. Plugging our new OSE’s into previous algorithms for the above problems yields the bounds in Figure 1; the value r used in bounds denotes rank(A). Approximating Leverage Scores: A d-dimensional subspace W ⊆ Rn can be written as W = {x : ∃y ∈ Rd , x = U y} for some U ∈ Rn×d with orthonormal columns. The squared Euclidean norms of rows of U are unique up to permutation, i.e. they depend only on A, and are known as the leverage scores of A. Given A, we would like to output a list of its leverage scores up to 1 ± ε. Least Squares Regression: Given A ∈ Rn×d , b ∈ Rn , compute x ∈ Rd so that kA x − bk ≤ (1 + ε) · minx∈Rd kAx − bk. Low Rank Approximation: Given A ∈ Rn×d and integer k > 0, compute Ak ∈ Rn×d with rank( A) ≤ k so that kA − Ak kF ≤ (1 + ε) · minrank(Ak )≤k kA − Ak kF , where k · kF is Frobenius norm. 1.2 Our Construction and Techniques The s = 1 construction is simply the TZ sketch [TZ12]. This matrix Π is specified by a random hash function h : [d] → [n] and a random σ ∈ {−1, 1}d . For each i ∈ [d] we set Πh(i),i = σi , and every other entry in Π is set to zero. Observe any d-dimensional subspace W ⊆ Rn can be written as W = {x : ∃y ∈ Rd , x = U y} for some U ∈ Rn×d with orthonormal columns. The analysis of the s = 1 construction in [CW12] worked roughly as follows: let I ⊂ [n] denote the set of “heavy” rows, i.e. those rows ui of U where kui k is “large”. We write x = xI + x[n]\I , where xS for a set S denotes x with all coordinates in [n]\S zeroed out. Then kxk2 = kxI k2 + kx[n]\I k2 + 2hxI , x[n]\I i. The argument in [CW12] conditioned on I being perfectly hashed by h so that kxI k2 is preserved exactly. 4 Using an approach in [KN10, KN12] based on the Hanson-Wright inequality [HW71] together with a net argument, it was argued that kx[n]\I k2 is preserved simultaneously for all x ∈ W ; this step required Ω(d)-wise independence to union bound over the net. A simpler concentration argument was used to handle the hxI , x[n]\I i term. The construction in [CW12] with smaller m and larger s followed a similar but more complicated analysis; that construction involving hashing into buckets and using the sparse Johnson-Lindenstrauss matrices of [KN12] in each bucket. Our analysis is completely different. First, just as in the TZ sketch’s application to ℓ2 estimation in data streams, we only require h to be pairwise independent and σ to be 4-wise independent. Our observation is simple: a matrix Π preserving the Euclidean norm of all vectors x ∈ W up to 1 ± ε is equivalent to the statement kΠU yk = (1 ± ε)kyk simultaneously for all y ∈ Rd . This is equivalent to all singular values of ΠU lying in the interval [1 − ε, 1 + ε].3 Write S = (ΠU )∗ΠU , so that we want to show all eigenvalues values of S lie in [(1 − ε)2 , (1 + ε)2 ]. We can trivially write S = I + (S − I ), and thus by Weyl’s inequality (see a statement in Section 2) all eigenvalues of S are 1 ± kS − I k. We thus show that kS − I k is small with good probability. By Markov’s inequality P(kS − I k ≥ t) = P(kS − I k2 ≥ t2 ) ≤ t−2 · EkS − I k2 ≤ t−2 · EkS − I k2 F . Bounding this latter quantity is a simple calculation and fits in under a page (Theorem 3). The two constructions with smaller m ≈ d/ε2 are the sparse Johnson-Lindenstrauss matrices of [KN12]. In particular, the only properties we need from our OSE in our analyses are the following. Let each matrix in the support of the OSE have entries in {0, 1/√s, −1/√s}. For a randomly drawn Π, let δi,j be an indicator random variable for the event Πi,j 6= 0, and write Πi,j = δi,j σi,j /√s, where the σi,j are random signs. Then the properties we need are • For any j ∈ [n], Pm i=1 δi,j = s with probability 1. • For any S ⊆ [m] × [n], E Q(i,j )∈S δi,j ≤ (s/m)S . The second property says the δi,j are negatively correlated. We call any matrix drawn from an OSE with the above properties an oblivious sparse norm-approximating projection (OSNAP). The work of [KN12] gave two OSNAP distributions, either of which suffice for our current OSE problem. In the first construction, each column is chosen to have exactly s non-zero entries in random locations, each equal to ±1/√s uniformly at random. For our purposes the signs σi,j need only be O(log d)-wise independent, and each column can be specified by a O(log d)-wise independent permutation, and the seeds specifying the permutations in different columns need only be O(log d)-wise independent. In the second construction we pick hash functions h : [d] × [s] → [m/s], σ : [d] × [s] → {−1, 1}, both O(log d)-wise independent, and thus each representable using O(log d log nd) random bits. For each (i, j ) ∈ [d] × [s] we set Π(j−1)s+h(i,j ),i = σ(i, j )/√s, and all other entries in Π are set to zero. Note also that the TZ sketch is itself an OSNAP with s = 1. Just as in the TZ sketch, it suffices to show some tail bound: that P(kS − I k > ε′ ) is small for some ε′ = O(ε), where S = (ΠU )∗ΠU . Note that if the eigenvalues of S − I are λ1 , . . . , λd , then the d . Thus for ℓ even, tr((S − I )ℓ ) = Pd i=1 λℓ 1 , . . . , λℓ eigenvalues of (S − I )ℓ are λℓ i is an upper bound on kS − I kℓ . Thus by Markov’s inequality with ℓ even, P(kS − I k ≥ t) = P(kS − I kℓ ≥ tℓ ) ≤ t−ℓ · EkS − I kℓ ≤ t−ℓ · Etr((S − I )ℓ ). 3Recall that the singular values of a (possibly rectangular) matrix B are the square roots of the eigenvalues of B ∗B , where (·)∗ denotes conjugate transpose. (1) 5 Our proof works by expanding the expression tr((S − I )ℓ ) and computing its expectation. This expression is a sum of exponentially many monomials, each involving a product of ℓ terms. Without delving into technical details at this point, each such monomial can be thought of as being in correspondence with some undirected multigraph (see the dot product multigraphs in the proof of Theorem 9). We group monomials corresponding to the same graph, bound the contribution from each graph separately, then sum over all graphs. Multigraphs whose edges all have even multiplicity turn out to be easier to handle (Lemma 10). However most graphs G do not have this property. Informally speaking, the contribution of a graph turns out to be related to the product over its edges of the contribution of that edge. Let us informally call this “contribution” F (G). Thus if E ′ ⊂ E is a subset of the edges of G, we can write F (G) ≤ F ((GE ′ )2 )/2 + F ((GE \E ′ )2 )/2 by AM-GM, where squaring a multigraph means duplicating every edge, and GE ′ is G with all edges in E \E ′ removed. This reduces back to the case of even edge multiplicities, but unfortunately the bound we desire on F (G) depends exponentially on the number of connected components of G. Thus this step is bad, since if G is connected, then one of GE ′ , GE ′ \E can have many connected components for any choice of E ′ . For example if G is a cycle on N vertices, for E ′ a single edge almost every vertex in GE ′ is in its own connected component, and even if E ′ is every odd-indexed edge then the number of components blows up to N/2. Our method to overcome this is to show that any F (G) is bounded by some F (G′ ) with the property that every connected component of G′ has two edge-disjoint spanning trees. We then put one such spanning tree into E ′ for each component, so that GE \E ′ and GE ′ both have the same number of connected components as G. Our approach follows the classical moment method in random matrix theory; see [Tao12, Section 2] or [Ver12] introductions to this area. In particular, our approach is inspired by one taken by Bai and Yin [BY93], who in our notation were concerned with the case n = d, U = I , Π dense. Most of the complications in our proof arise because U is not the identity matrix, so that rows of U are not orthogonal. For example, in the case of U having orthogonal rows all graphs G in the last paragraph have no edges other than self-loops and are trivial to analyze. 2 Analysis In this section let the orthonormal columns of U ∈ Rn×d be denoted u1 , . . . , ud . Recall our goal is to show that all singular values of ΠU lie in the interval [1 − ε, 1 + ε] with probability 1 − δ over the choice of Π as long as s, m are sufficiently large. We assume Π is an OSNAP with sparsity s. As in [BY93] we make use of Weyl’s inequality (see a proof in [Tao12, Section 1.3]). Theorem 2 (Weyl’s inequality). Let M , H, P be n×n Hermitian matrices where M has eigenvalues µ1 ≥ . . . ≥ µn , H has eigenvalues ν1 ≥ . . . ≥ νn , and P has eigenvalues ρ1 ≥ . . . ≥ ρn . Then ∀ 1 ≤ i ≤ n, it holds that νi + ρn ≤ µi ≤ νi + ρ1 . Let S = (ΠU )∗ΠU . Letting I be the d × d identity matrix, Weyl’s inequality with M = S , H = (1 + ε2 )I , and P = S − (1 + ε2 )I implies that all the eigenvalues of S lie in the range [1 + ε2 + λmin (P ), 1 + ε2 + λmax (P )] ⊆ [1 + ε2 − kP k, 1 + ε2 + kP k], where λmin (M ) (resp. λmax (M )) is the smallest (resp. largest) eigenvalue of M . Since kP k ≤ ε2 + kS − I k, it thus suffices to show P(kS − I k > 2ε − ε2 ) < δ, (2) since kP k ≤ 2ε implies that all eigenvalues of S lie in [(1 − ε)2 , (1 + ε)2 ]. 6 (3) Sk ,k ′ = (S − I )k ,k ′ = Before proceeding with our proofs below, observe that for all k , k ′ i ! i ! nXi=1 mXr=1 nXi=1 δr,iσr,iuk ′ δr,iσr,iuk δr,i! + · mXr=1 nXi=1 mXr=1 Xi 6=j 1 i uk ′ i uk ′ uk δr,iδr,j σr,iσr,j uk i j s mXr=1 Xi 6=j 1 i uk ′ = huk , uk ′ δr,iδr,j σr,iσr,j uk j s Noting huk , uk i = kuk k2 = 1 and huk , uk ′ i = 0 for k 6= k ′ , we have for all k , k ′ mXr=1 Xi 6=j i uk ′ δr,iδr,j σr,iσr,j uk j . Theorem 3. For Π an OSNAP with s = 1 and ε ∈ (0, 1), with probability at least 1 − δ al l singular values of ΠU are 1 ± ε as long as m ≥ δ−1 (d2 + d)/(2ε − ε2 )2 , σ is 4-wise independent, and h is pairwise independent. Proof. We show Eq. (2). Our approach is to bound EkS − I k2 then use Markov’s inequality. Since P(kS−I k > 2ε−ε2 ) = P(kS−I k2 > (2ε−ε2 )2 ) ≤ (2ε−ε2 )−2 ·EkS−I k2 ≤ (2ε−ε2 )−2 ·EkS−I k2 F , (4) we can bound EkS − I k2 F to show Eq. (2). Here k · kF denotes Frobenius norm. Now we bound EkS − I k2 F . We first deal with the diagonal terms of S − I . By Eq. (3), mXr=1 Xi 6=j 2 i )2 (uk m2 (uk j )2 2 m · kuik4 2 , m and thus the diagonal terms in total contribute at most 2d/m to EkS − I k2 F . We now focus on the off-diagonal terms. By Eq. (3), E(S − I )2 k ,k ′ is equal to j (cid:17) . m Xi 6=j (cid:16)(uk j (cid:17) = mXr=1 Xi 6=j (cid:16)(uk 1 1 i )2 (uk ′ i uk ′ i )2 (uk ′ i uk ′ j uk ′ j uk ′ j )2 + uk i uk j )2 + uk i uk m2 j we have that Pi 6=j uk i )2 + Pi 6=j uk Noting 0 = huk , uk ′ i2 = Pn j uk ′ i uk ′ j uk ′ i uk ′ i )2 (uk ′ i uk i uk k=1 (uk j ≤ 0, so m Xi 6=j 1 i )2 (uk ′ (uk j )2 E(S − I )2 k ,k ′ ≤ 1 m kui k2 · kuj k2 E(S − I )2 k ,k = ≤ = 1 s 1 s = i + ≤ 7 = . 1 m Thus summing over i 6= j , the total contribution from off-diagonal terms to EkS − I k2 F is at most d(d − 1)/m. Thus in total EkS − I k2 F ≤ (d2 + d)/m, and so Eq. (4) and our setting of m gives d2 + d P (cid:0)kS − I k > 2ε − ε2(cid:1) < 1 (2ε − ε2 )2 · m ≤ δ. Before proving the next theorem, it is helpful to state a few facts that we will repeatedly use. Recall that ui denotes the ith column of U , and we will let ui denote the ith row of U . Lemma 4. Pn k=1 uk u∗ k = I . Proof. i nXk=1 k! ej = nXk=1 k!i,j = e∗ uk u∗ uk u∗ and this inner product is 1 for i = j and 0 otherwise. nXk=1 (uk )i (uk )j = hui , uj i, (cid:4) (cid:4) Lemma 5. For al l i ∈ [n], kui k ≤ 1. Proof. We can extend U to some orthogonal matrix U ′ ∈ Rn×n by appending n − d columns. For the rows u′ i of U ′ we then have kui k ≤ ku′ i k = 1. (cid:4) Theorem 6 ( [NW61, Tut61]). A multigraph G has k edge-disjoint spanning trees iff EP (G) ≥ k(P − 1) for every partition P of the vertex set of G, where EP (G) is the set of edges of G crossing between two different partitions in P . The following corollary is standard, and we will later only need it for the case k = 2. Corollary 7. Let G be a multigraph formed by removing at most k edges from a multigraph G′ that has edge-connectivity at least 2k. Then G must have at least k edge-disjoint spanning trees. Proof. For any partition P of the vertex set, each partition must have at least 2k edges leaving it in G′ . Thus the number of edges crossing partitions must be at least k P in G′ , and thus at least k P − k in G. Theorem 6 thus implies that G has k edge-disjoint spanning trees. (cid:4) Fact 8. For any matrix B ∈ Cd×d , kB k = supkxk,kyk=1 x∗B y . Proof. We have supkxk,kyk=1 x∗B y ≤ kB k since x∗B y ≤ kxk · kB k · kyk. To show that unit norm x, y exist which achieve kB k, let B = U ΣV ∗ be the singular value decomposition of B . That is, U, V are unitary and Σ is diagonal with entries σ1 ≥ σ2 ≥ . . . σd ≥ 0 so that kB k = σ1 . We can then achieve x∗B y = σ1 by letting x be the first column of U and y be the first column of V . (cid:4) Theorem 9. For Π an OSNAP with s = Θ(log3 (d/δ)/ε) and ε ∈ (0, 1), with probability at least 1 − δ, al l singular values of ΠU are 1 ± ε as long as m = Ω(d log8 (d/δ)/ε2 ) and σ, h are Ω(log(d/δ))- wise independent. 8 Proof. We will again show Eq. (2). Recall that by Eq. (1) we have P(kS − I k ≥ t) ≤ t−ℓ · Etr((S − I )ℓ ) for ℓ any even integer. We thus proceed by bounding Etr((S − I )ℓ ) then applying Eq. (5). It is easy to verify by induction on ℓ that for any B ∈ Rn×n and ℓ ≥ 1, ℓYk=1 ℓYk=1 (B ℓ )i,j = Xt1 ,...,tℓ+1∈[n] Btk ,tk+1 , and thus tr(B ℓ ) = Xt1 ,...,tℓ+1∈[n] t1=tℓ+1 t1=i,tℓ+1=j Applying this identity to B = S − I yields sℓ · E Xk1 ,k2 ,...,kℓ+1 1 k1=kℓ+1 i1 6=j1 ,...,iℓ 6=jℓ r1 ,...,rℓ δrt ,it δrt ,jt σrt ,it σrt ,jt ukt it Etr((S − I )ℓ ) = ℓYt=1 Btk ,tk+1 . ukt+1 jt . (5) (6) The general strategy to bound the above summation is the following. Let Ψ be the set of all monomials appearing on the right hand side of Eq. (6). For ψ ∈ Ψ define K (ψ) = (k1 , . . . , kℓ ) as the ordered tuple of kt values in ψ , and similarly define P (ψ) = ((i1 , j1 ), . . . , (iℓ , jℓ )) and W (ψ) = (r1 , . . . , rℓ ). For each ψ ∈ Ψ we associate a three-layered undirected multigraph Gψ with labeled edges and unlabeled vertices. We call these three layers the left, midd le, and right layers, and we refer to vertices in the left layer as left vertices, and similarly for vertices in the other layers. Define M (ψ) to be the set {i1 , . . . , iℓ , j1 , . . . , jℓ } and define R(ψ) = {r1 , . . . , rℓ}. We define y = M (ψ) and z = R(ψ). Note it can happen that y < 2ℓ if some it = it′ , jt = jt′ , or it = jt′ , and similarly we may also have z < ℓ. The graph Gψ has x = ℓ left vertices, y middle vertices corresponding to the distinct it , jt in ψ , and z right vertices corresponding to the distinct rt . For the sake of brevity, often we refer to the vertex corresponding to it (resp. jt , rt ) as simply it (resp. jt , rt ). Thus note that when we refer to for example some vertex it , it may happen that some other it′ or jt′ is also the same vertex. We now describe the edges of Gψ . For ψ = Qℓ ukt+1 t=1 δrt ,it δrt ,jt σrt ,it σrt ,jt ukt we it jt draw 4ℓ labeled edges in Gψ with distinct labels in [4ℓ]. For each t ∈ [ℓ] we draw an edge from the tth left vertex to it with label 4(t − 1) + 1, from it to rt with label 4(t − 1) + 2, from rt to jt with label 4(t − 1) + 3, and from jt to the (t + 1)st left vertex with label 4(t − 1) + 4. Observe that many different monomials ψ will map to the same graph Gψ ; in particular the graph maintains no information concerning equalities amongst the kt , and the y middle vertices may map to any y distinct values in [n] (and similarly the right vertices may map to any z distinct values in [m]). We handle the right hand side of Eq. (6) by grouping monomials ψ that map to the same graph, bound the total contribution of a given graph G in terms of its graph structure when summing over all ψ with Gψ = G, then sum the contributions from all such graphs G combined. Before continuing further we introduce some more notation then make a few observations. For a graph G as above, recall G has 4ℓ edges, and we refer to the distinct edges (ignoring labels) as bonds. We let E (G) denote the edge multiset of a multigraph G and B (G) denote the bond set. We refer to the number of bonds a vertex is incident upon as its bond-degree, and the number of edges as its edge-degree. We do not count self-loops for calculating bond-degree, and we count them twice for edge-degree. We let LM (G) be the induced multigraph on the left and middle vertices of G, and M R(G) be the induced multigraph on the middle and right vertices. We let w = w(G) be 9 = = ukt it ukt+1 jt Etr((S − I )ℓ ) ≤ the number of connected components in M R(G). We let b = b(G) denote the number of bonds in M R(G) (note M R(G) has 2ℓ edges, but it may happen that b < 2ℓ since G is a multigraph). Given G we define the undirected dot product multigraph bG with vertex set M (ψ). Note every left vertex of G has edge-degree 2. For each t ∈ [ℓ] an edge (i, j ) is drawn in bG between the two middle vertices that the tth left vertex is adjacent to (we draw a self-loop on i if i = j ). We do not label the edges of bG, but we label the vertices with distinct labels in [y ] in increasing order of when each vertex was first visited by the natural tour of G (by following edges in increasing label order). We name bG the dot product multigraph since if some left vertex t has its two edges connecting to vertices i, j ∈ [n], then summing over kt ∈ [d] produces the dot product hui , uj i. Now we make some observations. Due to the random signs σr,i , a monomial ψ has expectation zero unless every bond in M R(G) has even multiplicity, in which case the product of random signs in ψ is 1. Also, note the expectation of the product of the δr,i terms in ψ is at most (s/m)b by OSNAP properties. Thus letting G be the set of all such graphs G with even bond multiplicity in M R(G) that arise from some monomial ψ appearing in Eq. (6), we have (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) · (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) m (cid:17)b sℓ · XG∈G (cid:16) s ℓYt=1 Xψ:Gψ =G 1 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) m (cid:17)b (cid:18)m z (cid:19) · sℓ · XG∈G (cid:16) s Xψ:Gψ =G R(ψ)=[z ] Xk1 ,...,kℓ 1 ukt+1 jt (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) m (cid:17)b (cid:18)m z (cid:19) · sℓ · XG∈G (cid:16) s Ye∈E ( bG) Xa1 ,...,ay ∈[n] 1 huai , uaj i ∀i 6=j ai 6=aj e=(i,j ) Before continuing further it will be convenient to introduce a notion we will use in our analysis called a generalized dot product multigraph. Such a graph bG is just as in the case of a dot product multigraph, except that each edge e = (i, j ) is associated with some matrix Me . We call Me the edge-matrix of e. Also since bG is undirected, we can think of an edge e = (i, j ) with edge-matrix Me also as an edge (j, i), in which case we say its associated edge-matrix is M ∗ e . We then associate with bG the product Ye∈ bG huai , Meuaj i. e=(i,j ) Note that a dot product multigraph is simply a generalized dot product multigraph in which Me = I for all e. Also, in such a generalized dot product multigraph, we treat multiedges as representing the same bond iff the associated edge-matrices are also equal (in general multiedges may have different edge-matrices). Lemma 10. Let H be a connected generalized dot product multigraph on vertex set [N ] with E (H ) 6= ∅ and where every bond has even multiplicity. Also suppose that for al l e ∈ E (H ), kMek ≤ 1. Define nXaN =1 Ye∈E (H ) nXa2=1 hvai , Me vaj i, · · · f (H ) = e=(i,j ) 10 ℓYt=1 ukt it (7) where vai = uai for i 6= 1, and va1 equals some fixed vector c with kck ≤ 1. Then f (H ) ≤ kck2 . Proof. Let π be some permutation of {2, . . . , N }. For a bond q = (i, j ) ∈ B (H ), let 2αq denote the multiplicity of q in H . Then by ordering the assignments of the at in the summation Xa2 ,...,aN ∈[n] Ye∈E (H ) hvai , Mevaj i e=(i,j ) according to π , we obtain the exactly equal expression nXaπ(2)=1 Yq∈B (H ) nXaπ(N )=1 Yq∈B (H ) q=(π(1),j ) q=(π(N ),j ) 2≤π−1 (j ) N ≤π−1 (j ) Here we have taken the product over t ≤ π−1 (j ) as opposed to t < π−1 (j ) since there may be self- loops. By Lemma 5 and the fact that kck ≤ 1 we have that for any i, j , hvi , vj i2 ≤ kvik2 · kvj k2 ≤ 1, so we obtain an upper bound on Eq. (8) by replacing each hvaπ(t) , vaj i2αv term with hvaπ(t) , vaj i2 . We can thus obtain the sum nXaπ(N ) =1 Yq∈B (H ) nXaπ(2)=1 Yq∈B (H ) hvaπ(N ) , Mq vaj i2 · · · q=(π(N ),j ) q=(π(2),j ) q≤π−1 (j ) 2≤π−1 (j ) hvaπ(N ) , Mq vaj i2αq · · · hvaπ(2) , Mq vaj i2αq . (8) hvaπ(2) , Mq vaj i2 , (9) (10) which upper bounds Eq. (8). Now note for 2 ≤ t ≤ N that for any nonnegative integer βt and for {q ∈ B (H ) : q = (π(t), j ), t < π−1 (j )} non-empty (note the strict inequality t < π−1 (j )), nXaπ(t)=1 Yq∈B (H ) nXaπ(t)=1 kvaπ(t) k2βt · Yq∈B (H ) hvaπ(t) , Mq vaj i2 hvaπ(t) , Mq vaj i2 ≤ q=(π(t),j ) q=(π(t),j ) t≤π−1 (j ) t≤π−1 (j ) hvaπ(t) , Mq vaj i2  nXaπ(t)=1 ≤ Yq∈B (H ) q=(π(t),j ) t<π−1 (j )  Mq vaj  nXaπ(t)=1 = Yq∈B (H ) q vaπ(t) v∗ aj M ∗ v∗ aπ(t) q=(π(t),j ) t<π−1 (j ) i ! Mq vaj (Mq vaj )∗ nXi=1 = Yq∈B (H ) uiu∗ q=(π(t),j ) t<π−1 (j ) = Yq∈B (H ) kMq vaj k2 q=(π(t),j ) t<π−1 (j ) (11) 11 ≤ Yq∈B (H ) q=(π(t),j ) t<π−1 (j ) kvaj k2 , (12) where Eq. (10) used Lemma 5, Eq. (11) used Lemma 4, and Eq. (12) used that kMq k ≤ 1. Now consider processing the alternating sum-product in Eq. (9) from right to left. We say that a bond (i, j ) ∈ B (H ) is assigned to i if π−1 (i) < π−1 (j ). When arriving at the tth sum-product and using the upper bound Eq. (11) on the previous t − 1 sum-products, we will have a sum over kvaπ(t) k2 raised to some nonnegative power (specifically the number of bonds incident upon π(t) but not assigned to π(t), plus one if π(t) has a self-loop) multiplied by a product of hvaπ(t) , vaj i2 over all bonds (π(t), j ) assigned to π(t). There are two cases. In the first case π(t) has no bonds assigned to it. We will ignore this case since we will show that we can choose π to avoid it. The other case is that π(t) has at least one bond assigned to it. In this case we are in the scenario of Eq. (11) and thus summing over aπ(t) yields a non-empty product of kvaj k2 for the j for which (π(t), j ) is a bond assigned to π(t). Thus in our final sum, as long as we choose π to avoid the first case, we are left with an upper bound of kck raised to some power equal to the edge-degree of vertex 1 in H , which is at least 2. The lemma would then follow since kckj ≤ kck2 for j ≥ 2. It now remains to show that we can choose π to avoid the first case where some t ∈ {2, . . . , N } is such that π(t) has no bonds assigned to it. Let T be a spanning tree in H rooted at vertex 1. We then choose any π with the property that for any i < j , π(i) is not an ancestor of π(j ) in T . This can be achieved, for example, by assigning π values in reverse breadth first search order. (cid:4) Lemma 11. Let bG be any dot product graph as in Eq. (7). Then (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Ye∈ bG Xa1 ,...,ay ∈[n] ≤ y ! · dy−w+1 . huai , uaj i ∀i 6=j ai 6=aj e=(i,j ) Proof. We first note that we have the inequality (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) = (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)   y−1Xt=1 Xay =at Ye∈E ( bG) nXay =1 Ye∈E ( bG) Xa1 ,...,ay−1∈[n] Ye∈E ( bG) Xa1 ,...,ay ∈[n] huai , uaj i huai , uaj i − huai , uaj i ∀i 6=j ai 6=aj ∀i 6=j∈[y−1] ai 6=aj e=(i,j ) e=(i,j ) e=(i,j ) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) y−1Xt=1 nXay =1 Ye∈E ( bG) Xay =at Ye∈E ( bG) Xa1 ,...,ay−1∈[n] Xa1 ,...,ay−1∈[n] huai , uaj i huai , uaj i ∀i 6=j∈[y−1] ai 6=aj ∀i 6=j∈[y−1] ai 6=aj e=(i,j ) e=(i,j ) We can view the sum over t on the right hand side of the above as creating t − 1 new dot product multigraphs, each with one fewer vertex where we eliminated vertex y and associated it with vertex t for some t, and for each edge (y , a) we effectively replaced it with (t, a). Also in first sum where we sum over all n values of ay , we have eliminated the constraints ay 6= ai for i 6= y . By recursively ≤ + 12 F (G′ ) applying this inequality to each of the resulting t summations, we bound (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Ye∈E ( bG) Xa1 ,...,ay ∈[n] huai , uaj i ∀i 6=j ai 6=aj e=(i,j ) by a sum of contributions from y ! dot product multigraphs where in none of these multigraphs do we have the constraint that ai 6= aj for i 6= j . We will show that each one of these resulting multigraphs contributes at most dy−w+1 , from which the lemma follows. Let G′ be one of the dot product multigraphs at a leaf of the above recursion so that we now wish to bound (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) = (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) nXa1 ,...,ay=1 Ye∈E (cG′ ) def huai , Me uaj i e=(i,j ) where Me = I for all e for G′ . Before proceeding, we first claim that every connected component of G′ is Eulerian. To see this, observe G has an Eulerian tour, by following the edges of G in increasing order of label, and thus all middle vertices have even edge-degree in G. However they also have even edge-degree in M R(G), and thus the edge-degree of a middle vertex in LM (G) must be even as well. Thus, every vertex in bG has even edge-degree, and thus every vertex in each of the recursively created leaf graphs also has even edge-degree since at every step when we eliminate a vertex, some other vertex’s degree increases by the eliminated vertex’s degree which was even. Thus every connected component of G′ is Eulerian as desired. We now upper bound F (G′ ). Let the connected components of G′ be C1 , . . . , CCC (G′ ) , where C C (·) counts connected components. An observation we repeatedly use later is that for any gen- eralized dot product multigraph H with components C1 , . . . , CCC (H ) , CC (H )Yi=1 We treat G′ as a generalized dot product multigraph so that each edge e has an associated matrix Me (though in fact Me = I for all e). Define an undirected multigraph to be good if all its connected components have two edge-disjoint spanning trees. We will show that F (G′ ) ≤ F (G′′ ) for some generalized dot product multigraph G′′ that is good then will show F (G′′ ) ≤ dy−w+1 . If G′ itself is good then we can set G′′ = G′ . Otherwise, we will show F (G′ ) = F (H0 ) = . . . = F (Hτ ) for smaller and smaller generalized dot product multigraphs Ht (i.e. with successively fewer vertices) whilst maintaining the invariant that each Ht has Eulerian connected components and has kMek ≤ 1 for all e. We stop when some Hτ is good and we can set G′′ = Hτ . Let us now focus on constructing this sequence of Ht in the case that G′ is not good. Let H0 = G′ . Suppose we have constructed H0 , . . . , Ht−1 for i ≥ 1 none of which are good, and now we want to construct Ht . Since Ht−1 is not good it cannot be 4-edge-connected by Corollary 7, so there is some connected component Cj ∗ of Ht−1 with some cut S ( V (Cj ∗ ) with 2 edges crossing the cut (S, V (Cj ∗ )\S ) (note that since Cj ∗ is Eulerian, any cut has an even number of edges crossing it). Choose such an S ( V (Cj ∗ ) with S minimum amongst all such cuts. Let the two edges crossing F (H ) = (13) F (Ci ). (14) 13 u∗ ag M(g,h) uah V (Cj∗ )\S X aV (Cj∗ )\S ∈[n] the cut be (g , h), (g ′ , h′ ) with h, h′ ∈ S (note that it may be the case that g = g ′ and/or h = h′ ). Note that F (Cj ∗ ) equals the magnitude of       Y X Y       huai , Me uaj i huai , Meuaj i e∈E (Cj∗ (S )) e∈E (V (Cj∗ )\S ) aS ∈[n]S e=(i,j ) e=(i,j ) {z M (15) We define Ht to be Ht−1 but where in the j ∗ th component we replace Cj ∗ with C ∗ j (V (C ∗ j )\S ) and add an additional edge from g to g ′ which we assign edge-matrix M . We thus have that F (Ht−1 ) = F (Ht ) by Eq. (14). Furthermore each component of Ht is still Eulerian since every vertex in Ht−1 has either been eliminated, or its edge-degree has been preserved and thus all edge-degrees are even. It remains to show that kM k ≤ 1. We first claim that Cj ∗ (S ) has two edge-disjoint spanning trees. Define C ′ to be the graph Cj ∗ (S ) with an edge from h to h′ added. We show that C ′ (S ) is 4-edge-connected so that Cj ∗ (S ) has two edge-disjoint spanning trees by Corollary 7. Now to see this, consider some S ′ ( S . Consider the cut (S ′ , V (C ′ )\S ′ ). C ′ is Eulerian, so the number of edges crossing this cut is either 2 or at least 4. If it 2, then since S ′ < S this is a contradiction since S was chosen amongst such cuts to have S minimum. Thus it is at least 4, and we claim that the number of edges crossing the cut (S ′ , S \S ′ ) in C ′(S ) must also be at least 4. If not, then it is 2 since C ′(S ) is Eulerian. However since the number of edges leaving S ′ in C ′ is at least 4, it must then be that h, h′ ∈ S ′ . But then the cut (S \S ′ , V (C ′ )\(S \S ′ )) has 2 edges crossing it so that S \S ′ is a smaller cut than S with 2 edges leaving it in C ′ , violating the minimality of S , a contradiction. Thus C ′ (S ) is 4-edge-connected, implying Cj ∗ (S ) has two edge-disjoint spanning trees T1 , T2 as desired. Now to show kM k ≤ 1, by Fact 8 we have kM k = supkxk,kx′ k=1 x∗M x′ . We have that  · huah′ , M(h′ ,g ′ )x′ i  Ye∈E (Cj∗ (S )) x∗M x′ = XaS ∈[n]S huai , Meuaj i hx, M(g ,h)uah i · e=(i,j ) huah′ , M(h′ ,g ′ )x′ i · Ye∈E (Cj∗ (S ))\T1 hx, M(g ,h)uah i · Ye∈T1 huai , Me uaj i · = XaS ∈[n]S e=(i,j ) e=(i,j ) 2 ·  XaS ∈[n]S huai , Me uaj i2 hx, M(g ,h)uah i2 · Ye∈T1 1 e=(i,j ) huah′ , M(h′ ,g ′ )x′ i2 · Ye∈E (Cj∗ (S ))\T1 + XaS ∈[n]S e=(i,j ) 2 (cid:0)kxk2 + kx′k2 (cid:1) 1 14 huai , Meuaj i2  (16) (17) ≤ ≤ u∗ ah′ M(h′ ,g′ ) uag′ . }  huai , Me uaj i = 1, where Eq. (16) used the AM-GM inequality, and Eq. (17) used Lemma 10 (note the graph with ver- tex set S ∪ {g ′ } and edge set E (Cj ∗ (S ))\T1 ∪ {(g ′ , h′ )} is connected since T2 ⊆ E (Cj ∗ (S ))\T1 ). Thus we have shown that Ht satisfies the desired properties. Now notice that the sequence H0 , . . . , H1 , . . . must eventually terminate since the number of vertices is strictly decreasing in this sequence and any Eulerian graph on 2 vertices is good. Therefore we have that Hτ is eventually good for some τ > 0 and we can set G′′ = Hτ . It remains to show that for our final good G′′ we have F (G′′ ) ≤ dy−w+1 . We will show this in two parts by showing that both C C (G′′ ) ≤ dy−w+1 and F (G′′ ) ≤ dCC (G′′ ) . For the first claim, note that C C (G′′ ) ≤ C C ( bG) since every Ht has the same number of connected components as G′ , and C C (G′ ) ≤ C C ( bG). This latter inequality holds since in each level of recursion used to eventually obtain G′ from bG, we repeatedly identified two vertices as equal and merged them, which can only decrease the number of connected components. Now, all middle vertices in G lie in one connected component (since G is connected) and M R(G) has w connected components. Thus the at least w − 1 edges connecting these components in G must come from LM (G), implying that LM (G) (and thus bG) has at most y − w + 1 connected components, which thus must also be true for G′′ as argued above. It only remains to show F (G′′ ) ≤ dCC (G′′ ) . Let G′′ have connected components C1 , . . . , CCC (G′′ ) with each Cj having 2 edge-disjoint spanning trees T j 1 , T j 2 . We then have CC (G′′ )Yt=1 CC (G′′ )Yt=1 CC (G′′ )Yt=1 CC (G′′ )Yt=1 F (Ct ) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) huai , Meuaj i(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) nXa1 ,...,aV (Ct )=1 Ye∈E (Ct ) e=(i,j ) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)   Ye∈E (Ct )\T t  ·  Ye∈T t nXa1 ,...,aV (Ct )=1 huai , Meuaj i huai , Me uaj i 1 1 e=(i,j ) e=(i,j )  nXa1=1 nXa2 ,...,aV (Ct )=1 Ye∈E (Ct )\T t nXa2 ,...,aV (Ct )=1 Ye∈T t 1 huai , Meuaj i2 + 2 1 1 e=(i,j ) e=(i,j ) CC (G′′ )Yt=1 nXa1=1 CC (G′′ )Yt= kU k2 F = dCC (G′′ ) nXa1=1 kua1 k2 ≤ ≤ = huai , Meuaj i2 (18) (19) F (G′′ ) = = = 15 where Eq. (18) used the AM-GM inequality, and Eq. (19) used Lemma 10, which applies since V (Ct ) with edge set T t 1 is connected (since T t 1 is connected, and V (Ct ) with edge set E (Ct )\T t 2 ⊆ E (Ct )\T t 1 ). (cid:4) Now, for any G ∈ G we have y + z ≤ b + w since for any graph the number of edges plus the number of connected components is at least the number of vertices. We also have b ≥ 2z since every right vertex of G is incident upon at least two distinct bonds (since it 6= jt for all t). We also have y ≤ b ≤ ℓ since M R(G) has exactly 2ℓ edges with no isolated vertices, and every bond has even multiplicity. Finally, a crude bound on the number of different G ∈ G with a given b, y , z is (zy2 )ℓ ≤ (b3 )ℓ . This is because when drawing the graph edges in increasing order of edge label, when at a left vertex, we draw edges from the left to the middle, then to the right, then to the middle, and then back to the left again, giving y2z choices. This is done ℓ times. Thus by Lemma 11 and Eq. (7), and using that t! ≤ e√t(t/e)t for all t ≥ 1, sℓ Xb,y ,z ,w XG∈G 1 Etr((S − I )ℓ ) ≤ d · b(G)=b,y(G)=y w(G)=w ,z (G)=z sℓ Xb,y ,z ,w (b/e)b sb XG∈G ≤ ed√ℓ · 1 b(G)=b,y(G)=y w(G)=w ,z (G)=z b3ℓ (b/e)b sb · (cid:18) d m (cid:19)b−z sℓ Xb,y ,z ,w ≤ ed√ℓ · 1 m !b b3ℓ (sb/e)r d sℓ Xb,y ,z ,w ≤ ed√ℓ · 1 m !b s (cid:19)ℓ−b (b4/e)r d 2≤b≤ℓ (cid:18) b3 ≤ edℓ4√ℓ · max Define ǫ = 2ε − ε2 . For ℓ ≥ ln(edℓ9/2 /δ) = O(ln(d/δ)), s ≥ eℓ3/ǫ = O(log(d/δ)3 /ε), and m ≥ dℓ8 /ǫ2 = O(d log(d/δ)8 /ε2 ), the above expression is at most δǫℓ . Thus as in Eq. (2), by Eq. (5) we have 1 ǫℓ · Etr((S − I )ℓ ) ≤ δ. P (kS − I k > ǫ) < y ! · sb · mz−b · dy−w (cid:18) d m (cid:19)b−z (20) (cid:4) The proof of Theorem 9 reveals that for δ = 1/poly(d) one could also set m = O(d1+γ /ε2 ) and s = Oγ (1/ε) for any fixed constant γ > 0 and arrive at the same conclusion. Indeed, let γ ′ < γ be any positive constant. Let ℓ in the proof of Theorem 9 be taken as O(log(d/δ)) = O(log d). It suffices to ensure max2≤b≤ℓ (b3 /s)ℓ−b · ((b4 /e)pd/m)b ≤ εℓ δ/(edℓ9/2 ) by Eq. (20). Note dγ ′ > b3ℓ as long as b/ ln b > 3γ−1 ℓ/ ln d = O(1/γ ′ ), so dγ ′ > b3ℓ for b > b∗ for some b∗ = Θ(γ−1/ log(1/γ )). We choose s ≥ e(b∗ )3 /ε and m = d1+γ /ε2 , which is at least d1+γ ′ ℓ8/ε2 for d larger than some fixed constant. Thus the max above is always as small as desired, which can be seen by looking at b ≤ b∗ and b > b∗ separately (in the former case b3/s < 1/e, and in the latter case (b3 /s)ℓ−b · ((b4 /e)pd/m)b < (ε/e)ℓ b3ℓd−γ ′ b = (ε/e)ℓ e3ℓ ln b−γ ′ b ln d < (ε/e)ℓ is as small as desired). This observation yields: 16 Theorem 12. Let α, γ > 0 be arbitrary constants. For Π an OSNAP with s = Θ(1/ε) and ε ∈ (0, 1), with probability at least 1 − 1/dα , al l singular values of ΠU are 1 ± ε for m = Ω(d1+γ /ε2 ) and σ, h being Ω(log d)-wise independent. The constants in the big-Θ and big-Ω depend on α, γ . Remark 13. Section 1 stated the time to list all non-zeroes in a column in Theorem 9 is tc = O(s). For δ = 1/poly(d), naively one would actually achieve tc = O(s · log d) since one needs to evaluate an O(log d)-wise independent hash function s times. This can be improved to O(s) using fast multipoint evaluation of hash functions; see for example the last paragraph of Remark 16 of [KNPW11]. 3 Applications We use the fact that many matrix problems have the same time complexity as matrix multipli- cation including computing the matrix inverse [BH74] [Har08, Appendix A], and QR decompo- sition [Sch73]. In this paper we only consider the real RAM model and state the running time in terms of the number of field operations. The algorithms for solving linear systems, computing inverse, QR decomposition, and approximating SVD based on fast matrix multiplication can be implemented with precision comparable to that of conventional algorithms to achieve the same error bound (with a suitable notion of approximation/stability). We refer readers to [DDH07] for details. Notice that it is possible that both algorithms based on fast matrix multiplication and conventional counterparts are unstable, see e.g. [AV97] for an example of a pathological matrix with very high condition number. In this section we describe some applications of our subspace embeddings to problems in nu- merical linear algebra. All applications follow from a straightforward replacement of previously used embeddings with our new ones as most proofs go through verbatim. In the statement of our bounds we implicitly assume nnz(A) ≥ n, since otherwise fully zero rows of A can be ignored without affecting the problem solution. 3.1 Approximate Leverage Scores This section describes the application of our subspace embedding from Theorem 9 or Theorem 12 to approximating the leverage scores. Consider a matrix A of size n × d and rank r . Let U be a n × r matrix whose columns form an orthonormal basis of the column space of A. The leverage scores of A are the squared lengths of the rows of U . The algorithm for approximating the leverage scores and the analysis are the same as those of [CW12], which itself uses essentially the same algorithm outline as Algorithm 1 of [DMIMW12]. The improved bound is stated below (cf. [CW12, Theorem 21]). Theorem 14. For any constant ε > 0, there is an algorithm that with probability at least 2/3, approximates al l leverage scores of a n × d matrix A in time O(nnz(A)/ε2 + rω ε−2ω ). Proof. As in [CW12], this follows by replacing the Fast Johnson-Lindenstrauss embedding used in [DMIMW12 ] with our sparse subspace embeddings. The only difference is in the parameters of our OSNAPs. We essentially repeat the argument verbatim just to illustrate where our new OSE parameters fit in; nothing in this proof is new. Now, we first use [yCKL12] so that we can assume A has only r = rank(A) columns and is of full column rank. Then, we take an OSNAP Π with m = O(r/ε2 ), s = (polylog r)/ε and compute ΠA. We then find R−1 so that ΠAR−1 has 17 2 of the rows of AR−1 are 1 ± ε orthonormal columns. The analysis of [DMIMW12 ] shows that the ℓ2 times the leverage scores of A. Take Π′ ∈ Rr×t to be a JL matrix that preserves the ℓ2 norms of the n rows of AR−1 up to 1 ± ε. Finally, compute R−1Π′ then A(R−1Π′ ) and output the squared row norms of ARΠ′ . Now we bound the running time. The time to reduce A to having r linearly independent columns is O((nnz(A) + rω ) log n). ΠA can be computed in time O(nnz(A) · (polylog r)/ε). Computing R ∈ Rr×r from the QR decomposition takes time O(mω ) = O(rω /ε2ω ), and then R can be inverted in time O(rω ); note ΠAR−1 has orthonormal columns. Computing R−1Π′ column by column takes time O(r2 log r) using the FJLT of [AL11, KW11] with t = O(ε−2 log n(log log n)4 ). We then multiply the matrix A by the r × t matrix R−1Π′ , which takes time O(t · nnz(A)) = O(nnz(A)/ε2 ). (cid:4) 3.2 Least Squares Regression In this section, we describe the application of our subspace embeddings to the problem of least squares regression. Here given a matrix A of size n × d and a vector b ∈ Rn , the ob jective is to find x ∈ Rd minimizing kAx − bk2 . The reduction to subspace embedding is similar to those of [CW12, Sar06]. The proof is included for completeness. Theorem 15. There is an algorithm for least squares regression running in time O(nnz(A) + d3 log(d/ε)/ε2 ) and succeeding with probability at least 2/3. Proof. Applying Theorem 3 to the subspace spanned by columns of A and b, we get a distribution over matrices Π of size O(d2 /ε2 ) × n such that Π preserves lengths of vectors in the subspace up to a factor 1 ± ε with probability at least 5/6. Thus, we only need to find argminx kΠAx − Πbk2 . Note that ΠA has size O(d2 /ε2 ) × d. By Theorem 12 of [Sar06], there is an algorithm that with probability at least 5/6, finds a 1 ± ε approximate solution for least squares regression for the smaller input of ΠA and Πb and runs in time O(d3 log(d/ε)/ε2 ). (cid:4) The following theorem follows from using the embedding of Theorem 9 and the same argument as [CW12, Theorem 32]. Theorem 16. Let r be the rank of A. There is an algorithm for least squares regression running in time O(nnz(A)((log r)O(1) + log(n/ε)) + rω (log r)O(1) + r2 log(1/ε)) and succeeding with probability at least 2/3. 3.3 Low Rank Approximation In this section, we describe the application of our subspace embeddings to low rank approximation. Here given a matrix A, one wants to find a rank k matrix Ak minimizing kA − Ak kF . Let ∆k be the minimum kA − Ak kF over all rank k matrices Ak . Notice that our matrices are of the same form as sparse JL matrices considered by [KN12] so the following property holds for matrices constructed in Theorem 9 (cf. [CW12, Lemma 24]). [KN12, Theorem 19] Fix ε, δ > 0. Let D be the distribution over matrices given in Theorem 17. Theorem 9 with n columns. For any matrices A, B with n rows, PS∼D [kAT S T SB − AT B kF > 3ε/2kAkF kB kF ] < δ 18 The matrices of Theorem 3 are the same as those of [CW12] so the above property holds for them as well. Therefore, the same algorithm and analysis as in [CW12] work. We state the improved bounds using the embedding of Theorem 3 and Theorem 9 below (cf. [CW12, Theorem 36 and 38]). Theorem 18. Given a matrix A of size n × n, there are 2 algorithms that, with probability at least 3/5, find 3 matrices U, Σ, V where U is of size n × k, Σ is of size k × k, V is of size n × k, U T U = V T V = Ik , Σ is a diagonal matrix, and kA − U ΣV ∗ kF ≤ (1 + ε)∆k The first algorithm runs in time O(nnz(A))+ O(nk2+nkω−1ε−1−ω +kω ε−2−ω ). The second algorithm runs in time O(nnz(A) logO(1) k) + O(nkω−1 ε−1−ω + kω ε−2−ω ). Proof. The proof is essentially the same as that of [CW12] so we only mention the difference. We use 2 bounds for the running time: multiplying an a × b matrix and a b × c matrix with c > a takes O(aω−2 bc) time (simply dividing the matrices into a × a blocks), and approximating SVD for an a × b matrix M with a > b takes O(abω−1 ) time (time to compute M T M , approximate SVD of M T M = QDQT in O(bω ) time [DDH07], and compute M Q to complete the SVD of M ). (cid:4) Acknowledgments We thank Andrew Drucker for suggesting the SNAP acronym for the OSE’s considered in this work, to which we added the “oblivious” descriptor. References [AC09] [Ach03] [AL09] [AL11] [AV97] [BH74] [BOR10] Nir Ailon and Bernard Chazelle. The Fast Johnson–Lindenstrauss transform and approximate nearest neighbors. SIAM J. Comput., 39(1):302–322, 2009. Dimitris Achlioptas. Database-friendly random pro jections: Johnson-Lindenstrauss with binary coins. J. Comput. Syst. Sci., 66(4):671–687, 2003. Nir Ailon and Edo Liberty. Fast dimension reduction using Rademacher series on dual BCH codes. Discrete Comput. Geom., 42(4):615–630, 2009. Nir Ailon and Edo Liberty. Almost optimal unrestricted fast Johnson-Lindenstrauss transform. In Proceedings of the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 185–191, 2011. Noga Alon and Van H. Vu. Anti-Hadamard matrices, coin weighing, threshold gates, and indecomposable hypergraphs. J. Comb. Theory, Ser. A, 79(1):133–160, 1997. James R. Bunch and John E. Hopcroft. Triangular factorization and inversion by fast matrix multiplication. Math. Comp., 28:231–236, 1974. Vladimir Braverman, Rafail Ostrovsky, and Yuval Rabani. Rademacher chaos, random Eulerian graphs and the sparse Johnson-Lindenstrauss transform. CoRR, abs/1011.2590, 2010. 19 [BY93] [CW09] [CW12] [DDH07] [DKS10] Z.D. Bai and Y.Q. Yin. Limit of the smallest eigenvalue of a large dimensional sample covariance matrix. Ann. Probab., 21(3):1275–1294, 1993. Kenneth L. Clarkson and David P. Woodruff. Numerical linear algebra in the stream- ing model. In Proceedings of the 41st ACM Symposium on Theory of Computing (STOC), pages 205–214, 2009. Kenneth L. Clarkson and David P. Woodruff. Low rank approximation and regression in input sparsity time. CoRR, abs/1207.6365v2, 2012. James Demmel, Ioana Dumitriu, and Olga Holtz. Fast linear algebra is stable. Numer. Math., 108(1):59–91, October 2007. Anirban Dasgupta, Ravi Kumar, and Tam´as Sarl´os. A sparse Johnson-Lindenstrauss transform. In Proceedings of the 42nd ACM Symposium on Theory of Computing (STOC), pages 341–350, 2010. [DMIMW12] Petros Drineas, Malik Magdon-Ismail, Michael Mahoney, and David Woodruff. Fast approximation of matrix coherence and statistical leverage. In Proceedings of the 29th International Conference on Machine Learning (ICML), 2012. [Har08] [HMT11] [HV11] [HW71] [JL84] Nicholas J. A. Harvey. Matchings, Matroids and Submodular Functions. PhD thesis, Massachusetts Institute of Technology, 2008. Nathan Halko, Per-Gunnar Martinsson, and Joel A. Tropp. Finding structure with randomness: Probabilistic algorithms for constructing approximate matrix decompo- sitions. SIAM Rev., Survey and Review section, 53(2):217–288, 2011. Aicke Hinrichs and Jan Vyb´ıral. Johnson-lindenstrauss lemma for circulant matrices. Random Struct. Algorithms, 39(3):391–398, 2011. David Lee Hanson and Farroll Tim Wright. A bound on tail probabilities for quadratic forms in independent random variables. Ann. Math. Statist., 42(3):1079–1083, 1971. William B. Johnson and Joram Lindenstrauss. Extensions of Lipschitz mappings into a Hilbert space. Contemporary Mathematics, 26:189–206, 1984. [KMR12] Felix Krahmer, Shahar Mendelson, and Holger Rauhut. Suprema of chaos processes and the restricted isometry property. arXiv, abs/1207.0235, 2012. [KN10] [KN12] Daniel M. Kane and Jelani Nelson. A derandomized sparse Johnson-Lindenstrauss transform. CoRR, abs/1006.3585, 2010. Daniel M. Kane and Jelani Nelson. Sparser Johnson-Lindenstrauss transforms. In SODA, pages 1195–1206, 2012. [KNPW11] Daniel M. Kane, Jelani Nelson, Ely Porat, and David P. Woodruff. Fast moment esti- mation in data streams in optimal space. In Proceedings of the 43rd ACM Symposium on Theory of Computing (STOC), pages 745–754, 2011. 20 [KW11] [Mah11] [NDT09] [NN12] [NW61] [Sar06] [Sch73] [Tao12] [Tro11] [Tut61] [TZ12] [Ver12] [Vyb11] [Wil12] [yCKL12] Felix Krahmer and Rachel Ward. New and improved Johnson-Lindenstrauss embed- dings via the Restricted Isometry Property. SIAM J. Math. Anal., 43(3):1269–1281, 2011. Michael W. Mahoney. Randomized algorithms for matrices and data. Foundations and Trends in Machine Learning, 3(2):123–224, 2011. Nam H. Nguyen, Thong T. Do, and Trac D. Tran. A fast and efficient algorithm for low-rank approximation of a matrix. In Proceedings of the 41st ACM Symposium on Theory of Computing (STOC), pages 215–224, 2009. Jelani Nelson and Huy L. Nguyen. Sparsity lower bounds for dimensionality-reducing maps. Manuscript, 2012. Crispin St. John Alvah Nash-Williams. Edge-disjoint spanning trees of finite graphs. J. London Math. Soc., 36:445–450, 1961. Tam´as Sarl´os. Improved approximation algorithms for large matrices via random pro jections. In Proceedings of the 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 143–152, 2006. Arnold Schonhage. Unitare transformationen grosser matrizen. Numer. Math., 20:409– 417, 1973. Terence Tao. Topics in random matrix theory, volume 132 of Graduate Studies in Mathematics. American Mathematical Society, 2012. Joel A. Tropp. Improved analysis of the subsampled randomized Hadamard trans- form. Adv. Adapt. Data Anal., Special Issue on Sparse Representation of Data and Images, 3(1–2):115–126, 2011. William Thomas Tutte. On the problem of decomposing a graph into n connected factors. J. London Math. Soc., 142:221–230, 1961. Mikkel Thorup and Yin Zhang. Tabulation-based 5-independent hashing with ap- plications to linear probing and second moment estimation. SIAM J. Comput., 41(2):293–331, 2012. Roman Vershynin. Introduction to the non-asymptotic analysis of random matrices. In Y. Eldar and G. Kutyniok, editors, Compressed Sensing, Theory and Applications, chapter 5, pages 210–268. Cambridge University Press, 2012. Jan Vyb´ıral. A variant of the Johnson-Lindenstrauss lemma for circulant matrices. J. Funct. Anal., 260(4):1096–1105, 2011. Virginia Vassilevska Williams. Multiplying matrices faster than Coppersmith- Winograd. In STOC, pages 887–898, 2012. Ho yee Cheung, Tsz Chiu Kwok, and Lap Chi Lau. Fast matrix rank algorithms and applications. In Proceedings of the 44th Symposium on Theory of Computing (STOC), pages 549–562, 2012. 21 [ZWSP08] Yunhong Zhou, Dennis M. Wilkinson, Robert Schreiber, and Rong Pan. Large- scale parallel collaborative filtering for the netflix prize. In Proceedings of the 4th International Conference on Algorithmic Aspects in Information and Management (AAIM), pages 337–348, 2008. 22
1804.07458
2
1804
2019-09-11T19:56:49
Online Vertex-Weighted Bipartite Matching: Beating 1-1/e with Random Arrivals
[ "cs.DS" ]
We introduce a weighted version of the ranking algorithm by Karp et al. (STOC 1990), and prove a competitive ratio of 0.6534 for the vertex-weighted online bipartite matching problem when online vertices arrive in random order. Our result shows that random arrivals help beating the 1-1/e barrier even in the vertex-weighted case. We build on the randomized primal-dual framework by Devanur et al. (SODA 2013) and design a two dimensional gain sharing function, which depends not only on the rank of the offline vertex, but also on the arrival time of the online vertex. To our knowledge, this is the first competitive ratio strictly larger than 1-1/e for an online bipartite matching problem achieved under the randomized primal-dual framework. Our algorithm has a natural interpretation that offline vertices offer a larger portion of their weights to the online vertices as time goes by, and each online vertex matches the neighbor with the highest offer at its arrival.
cs.DS
cs
Online Vertex-Weighted Bipartite Matching: Beating 1 − 1 with Random Arrivals∗ e ZHIYI HUANG, Department of Computer Science, The University of Hong Kong ZHIHAO GAVIN TANG†, ITCS, Shanghai University of Finance and Economics, China XIAOWEI WU‡, Faculty of Computer Science, University of Vienna, Austria YUHAO ZHANG, Department of Computer Science, The University of Hong Kong, China We introduce a weighted version of the ranking algorithm by Karp et al. (STOC 1990), and prove a competitive ratio of 0.6534 for the vertex-weighted online bipartite matching problem when online vertices arrive in random order. Our result shows that random arrivals help beating the 1-1/e barrier even in the vertex-weighted case. We build on the randomized primal-dual framework by Devanur et al. (SODA 2013) and design a two dimensional gain sharing function, which depends not only on the rank of the offline vertex, but also on the arrival time of the online vertex. To our knowledge, this is the first competitive ratio strictly larger than 1-1/e for an online bipartite matching problem achieved under the randomized primal-dual framework. Our algorithm has a natural interpretation that offline vertices offer a larger portion of their weights to the online vertices as time increase, and each online vertex matches the neighbor with the highest offer at its arrival. CCS Concepts: • Theory of computation → Approximation algorithms analysis; Online algorithms. Additional Key Words and Phrases: Vertex Weighted, Online Bipartite Matching, Randomized Primal-Dual ACM Reference Format: Zhiyi Huang, Zhihao Gavin Tang, Xiaowei Wu, and Yuhao Zhang. 2019. Online Vertex-Weighted Bipartite Matching: Beating 1 − 1 with Random Arrivals. ACM Trans. Algor. 15, 3, Article 38 (June 2019), 15 pages. e https://doi.org/10.1145/3326169 1 INTRODUCTION With a wide range of applications, Online Bipartite Matching and its variants are a focal point in the online algorithms literature. Consider a bipartite graph G(U , V , E) on vertices U ∪ V , where the set V of offline vertices is known in advance and vertices in U arrive online. On the arrival of an online vertex, its incident edges are revealed and the algorithm must irrevocably either match it to one of its unmatched neighbors or leave it unmatched. In a seminal paper, Karp et al. [21] proposed the ∗A preliminary version of this paper appeared in ICALP 2018 [18]. This work is partially supported by grants from Hong Kong RGC under the contract 17202715 and HKU17202115E. †Part of the work was done when the author was a PhD student at the University of Hong Kong. ‡Part of the work was done when the author was a postdoc at the University of Hong Kong. The research leading to these results has received funding from the European Research Council under the European Community's Seventh Framework Programme (FP7/2007-2013) / ERC grant agreement No. 340506. Authors' addresses: Zhiyi Huang, Department of Computer Science, The University of Hong Kong, [email protected]; Zhihao Gavin Tang, ITCS, Shanghai University of Finance and Economics, China, [email protected]; Xiaowei Wu, Faculty of Computer Science, University of Vienna, Austria, [email protected]; Yuhao Zhang, Department of Computer Science, The University of Hong Kong, China, [email protected]. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. © 2019 Association for Computing Machinery. 1549-6325/2019/6-ART38 $15.00 https://doi.org/10.1145/3326169 ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. 38 38:2 Z. Huang, Z. Tang, X. Wu, and Y. Zhang Ranking algorithm, which picks at the beginning a random permutation over the offline vertices V , and matches each online vertex to the first unmatched neighbor according to the permutation. They proved a tight competitive ratio 1 − 1 of Ranking, when online vertices arrive in an arbitrary order. e The analysis has been simplified in a series of subsequent works [5, 13, 15]. Further, the Ranking algorithm has been extended to other variants of the Online Bipartite Matching problem, including the vertex-weighted case [2], the random arrival model [20, 23], and the Adwords problem [7, 12, 25]. As a natural generalization, Online Vertex-Weighted Bipartite Matching was considered by Aggarwal et al. [2]. In this problem, each offline vertex v ∈ V has a non-negative weight wv, and the objective is to maximize the total weight of the matched offline vertices. A weighted version of the Ranking algorithm was proposed in [2] and shown to be (1 − 1 e )-competitive, matching the problem hardness in the unweighted version. They fix a non-increasing perturbation function ψ : [0, 1] → [0, 1], and draw a rank yv ∈ [0, 1] uniformly and independently for each offline vertex v ∈ V . The offline vertices are then sorted in decreasing order of the perturbed weight wv · ψ(yv). Each online vertex matches the first unmatched neighbor on the list upon its arrival. It is shown that by choosing the perturbation function ψ(y) := 1 − ey−1, the weighted Ranking algorithm achieves a tight competitive ratio 1 − 1 . In a subsequent work, Devanur et al. [13] simplified the e analysis under the randomized primal-dual framework and gave an alternative interpretation of the algorithm: each offline vertex v makes an offer of value wv · (1 − д(yv)) as long as it is not matched, where д(y) := ey−1 = 1 − ψ(y), and each online vertex matches the neighbor that offers the highest. Motivated by the practical importance of Online Bipartite Matching and its applications for online advertisements, another line of research seeks for a better theoretical bound beyond the worst-case hardness result provided by Karp et al. [21]. Online Bipartite Matching problem with random arrivals was considered independently by Karande et al. [20] and Mahdian et al. [23]. They both studied the performance of Ranking assuming that online vertices arrive in a uniform random order and proved competitive ratios 0.653 and 0.696 respectively. On the negative side, Karande et al. [20] explicitly constructed an instance for which Ranking performs no better than 0.727, which is later improved to 0.724 by Chan et al. [10]. In terms of problem hardness, Manshadi et al. [24] showed that no algorithm can achieve a competitive ratio larger than 0.823. with random arrivals. Do random arrivals help beating 1 − 1 The natural next step is then to consider the Online Vertex-Weighted Bipartite Matching problem e even in the vertex-weighted case? Unweighted Vertex-weighted 1 − 1 Arbitrary Arrivals e ≈ 0.632 [5, 13, 15, 21] e ≈ 0.632 [2, 13] 1 − 1 Random Arrivals 0.696 [23] 0.6534 (this paper) 1.1 Our Results and Techniques We answer this affirmatively by showing that a generalized version of the Ranking algorithm achieves a competitive ratio 0.6534. Theorem 1.1. There exists a 0.6534-competitive algorithm for the Online Vertex-Weighted Bipartite Matching problem with random arrivals. Interestingly, we do not obtain our result by generalizing existing works that break the 1 − 1 e barrier on the unweighted case [20, 23] to the vertex-weighted case. Instead, we take a totally different path, and build our analysis on the randomized primal-dual technique introduced by Devanur et al. [13], which was used to provide a more unified analysis of the algorithms for the Online Bipartite Matching problem with arbitrary arrival order and its extensions. ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. Online Vertex-Weighted Bipartite Matching: Beating 1 − 1 e with Random Arrivals 38:3 e We first briefly review the proof of Devanur et al. [13]. The randomized primal-dual technique can be viewed as a charging argument for sharing the gain of each matched edge between its two endpoints. Recall that in the algorithm of [2, 13], each unmatched offline vertex offers a value of wv · (1 − д(yv)) to online vertices, and each online vertex matches the neighbor that offers the highest at its arrival. Whenever an edge (u, v) is added to the matching, where v ∈ V is an offline vertex and u ∈ U is an online vertex, imagine a total gain of wv being shared between u and v such that u gets wv · (1 − д(yv)) and v gets wv · д(yv). Since д is non-decreasing, the smaller the rank of v, the smaller share it gets. For any edge (u, v) and any fixed ranks of online vertices other than v, they showed that by fixing д(y) = ey−1, the expected gains of u and v (from all of their incident edges) combined is at least (1 − 1 e ) · wv over the randomness of yv. This implies the 1 − 1 competitive ratio. Now we consider the problem with random arrivals. Analogous to the offline vertices, as the online vertices arrive in random order, in the gain sharing process, it is natural to give an online vertex u a smaller share if u arrives early (as it is more likely be get matched), and a larger share when u arrives late. Thus we consider the following version of the weighted Ranking algorithm. Let yu be the arrival time of online vertex u ∈ U , which is chosen uniformly at random from [0, 1]. Analogous to the ranks of the offline vertices, we also call yu the rank of u ∈ U . Fix a function д : [0, 1]2 → [0, 1] that is non-decreasing in the first dimension and non-increasing in the second dimension. On the arrival of u ∈ U , each unmatched neighbor v ∈ V of u makes an offer of value wv · (1 − д(yv , yu)), and u matches the neighbor with the highest offer. This algorithm straightforwardly leads to a gain sharing rule for dual assignments: whenever u ∈ U matches v ∈ V , let the gain of u be wv · (1 − д(yv , yu)) and the gain of v be wv · д(yv , yu). It suffices to show that, for an appropriate function д, the expected gain of u and v combined is at least 0.6534 · wv over the randomness of both yu and yv. The main difficulty of the analysis is to give a good characterization of the behavior of the algorithm when we vary the ranks of both u ∈ U and v ∈ V , while fixing the ranks of all other vertices arbitrarily. The previous analysis for the unweighted case with random arrivals [20, 23] heavily relies on a symmetry between the random ranks of offline vertices and online vertices: Properties developed for the offline vertices in previous work directly translate to their online counterparts. Unfortunately, the online and offline sides are no longer symmetric in the vertex- weighted case. In particular, for the offline vertex v, an important property is that for any given rank yu of the online vertex u, we can define a unique marginal rank θ such that v will be matched if and only if its rank yv < θ. However, it is not possible to define such a marginal rank for the online vertex u in the vertex-weighted case: As its arrival time changes, its matching status may change back and forth. In particular, since the function д depends on the arrival time of u, it may happen that u prefers neighbor v to z at one arrival time, but prefers z to v at another. The most important technical ingredient of our analysis is an appropriate lower bound on the expected gain which allows us to partially characterize the worst-case scenario (in the sense of minimizing the lower bound on the expected gain). Further, the worst-case scenario does admit simple marginal ranks even for the online vertex u. This allows us to design a symmetric gain sharing function д and complete the competitive analysis of 0.6534. As we will discuss in Section 5, our framework may be able to give stronger lower bound on the competitive ratio, potentially matching or even improving the one of Mahdian and Yan [23], if we had a tight analysis of a complex system of differential inequalities. Numerical results suggest that the integration shown in Section 5 may give a much larger lower bound on the competitive ratio than the one we present in this paper. However, giving a tight analysis on the integration is ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. 38:4 Z. Huang, Z. Tang, X. Wu, and Y. Zhang highly non-trivial. Indeed, a significant portion of our analysis, e.g., Section 4 and part of Section 3, is devoted to provide analyzable relaxations on this integration. 1.2 Other Related Works There is a vast literature on problems related to Online Bipartite Matching. For space reasons, we only list some of the most related here. Kesselheim et al. [22] considered the edge-weighted Online Bipartite Matching problem with random arrivals, and proposed a 1 -competitive algorithm. The competitive ratio is tight as it e matches the lower bound on the classical secretary problem [8]. Wang and Wong [26] considered a different model of Online Bipartite Matching problem with both sides of vertices arriving online (in an arbitrary order): A vertex can only actively match other vertices at its arrival; if it fails to match at its arrival, it may still get matched passively by other vertices later. They showed a 0.526-competitive algorithm for a fractional version of the problem. order) on regular graphs, and provided a (1 − O((cid:112)log d/d))-competitive algorithm, where d is the Recently, Cohen and Wajc [11] considered the Online Bipartite Matching (with arbitrary arrival degree of vertices. Very recently, Huang et al. [17] proposed a fully online matching model, in which all vertices of the graph arrive online (in an arbitrary order). Extending the randomized primal-dual technique, they obtained competitive ratios above 0.5 for both bipartite graphs and general graphs. Similar but different from the Online Bipartite Matching problem with random arrivals, in the stochastic Online Bipartite Matching, the online vertices arrive according to some known probability distribution (with repetition). Competitive ratios breaking the 1 − 1 barrier have been e achieved for the unweighted case [4, 6, 14] and the vertex-weighted case [6, 16, 19]. The Online Bipartite Matching problem with random arrivals is closely related to the oblivious matching problem [1, 3, 10] (on bipartite graphs). It can be easily shown that Ranking has equivalent performance on the two problems. Thus competitive ratios above 1 − 1 [20, 23] directly translate e to the oblivious matching problem. Generalizations of the problem to arbitrary graphs have also been considered, and competitive ratios above half are achieved for the unweighted case [3, 10] and vertex-weighted case [1, 9]. 2 PRELIMINARIES We consider the Online Vertex-Weighted Bipartite Matching with random arrival order. Let G(U , V , E) be the underlying graph, where vertices in V are given in advance and vertices in U arrive online in random order. Each offline vertex v ∈ V is associated with a non-negative weight wv. Without loss of generality, we assume the arrival time yu of each online vertex u ∈ U is drawn independently and uniformly from [0, 1]. Mahdian and Yan [23] use another interpretation for the random arrival model. They denote the order of arrival of online vertices by a permutation π and assume that π is drawn uniformly at random from the permutation group Sn. It is easy to see the equivalence between two interpretations: The algorithm draws n independent random variables from [0, 1] uniformly at random before any online vertex arrives, and assigns the i-th smallest variable to the i-th online vertex in the random permutation as its arrival time. Weighted Ranking. Fix a function д : [0, 1]2 → [0, 1] such that ∂д(x,y) ≤ 0. Each offline vertex v ∈ V draws independently a random rank yv ∈ [0, 1] uniformly at random. Upon the arrival of online vertex u ∈ U , u is matched to its unmatched neighbor v with maximum wv · (1 − д(yv , yu)). ≥ 0 and ∂д(x,y) ∂y ∂x ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. Online Vertex-Weighted Bipartite Matching: Beating 1 − 1 e with Random Arrivals 38:5 Remark 2.1. In the adversarial model, Aggarwal et al.'s algorithm [2] can be interpreted as choosing д(yv , yu) := eyv−1 in our algorithm. Our algorithm is a direct generalization of theirs to the random arrival model. [0, 1] to denote the vector of all ranks. For simplicity, for each u ∈ U , we also call its arrival time yu the rank of u. We use (cid:174)y : U ∪ V → Consider the linear program relaxation of the bipartite matching problem and its dual. max : (u,v)∈E wv · xuv s.t.   v:(u,v)∈E xuv ≤ 1 u:(u,v)∈E xuv ≤ 1 xuv ≥ 0 min :  u∈U αu + s.t. αu + αv ≥ wv v ∈V αv ∀u ∈ U ∀v ∈ V ∀(u, v) ∈ E αu ≥ 0 αv ≥ 0 ∀(u, v) ∈ E ∀u ∈ U ∀v ∈ V Randomized Primal-Dual. Our analysis builds on the randomized primal-dual technique by Devanur et al. [13]. We set the primal variables according to the matching produced by Ranking, i.e. xuv = 1 if and only if u is matched to v by Ranking, and set the dual variables so that the dual objective equals the primal. In particular, we split the gain wv of each matched edge (u, v) between vertices u and v; the dual variable for each vertex then equals the share it gets. Given primal feasibility and equal objectives, the usual primal-dual techniques would further seek to show approximate dual feasibility, namely, αu + αv ≥ F · wv for every edge (u, v), where F is the target competitive ratio. Observe that the above primal and dual assignments are themselves random variables. Devanur et al. [13] claimed that the primal-dual argument goes through given approximate dual feasibility in expectation. We formulate this insight in the following lemma and include a proof for completeness. •(u,v)∈E xuv = offline solution of the problem: have OPT ≤ Lemma 2.1. Ranking is F-competitive if we can set (non-negative) dual variables such that • E(cid:174)y [αu + αv] ≥ F · wv for all (u, v) ∈ E. Proof. We can set a feasible dual solution αu := E(cid:174)y [αu]/F for all u ∈ V . It's feasible because we have αu + αv = E(cid:174)y [αu + αv]/F ≥ wv for all (u, v) ∈ E. Then by duality we know that the dual solution is at least the optimal primal solution PRIMAL, which is also at least the optimal u∈V αu ≥ PRIMAL ≥ OPT. Then by the first assumption, we F E [ALG], □ E (cid:174)y[αu] which implies an F competitive ratio. (cid:2)(u,v)∈E wv · xuv u∈V αu = (cid:3) = 1 u∈V αu] = 1 u∈V αu; and F E(cid:174)y u∈V F In the rest of the paper, we set д(x, y) = 1 2 ∀x, y ∈ [0, 1] where h : [0, 1] → [0, 1] is a non-decreasing function (to be fixed later) with h′(x) ≤ h(x) for all x ∈ [0, 1]. Observe that ∂д(x,y) 2h′(y) ≤ 0. By definition of д, we have д(x, y) + д(y, x) = 1. Moreover, for any x, y ∈ [0, 1], we have the following fact that will be useful for our analysis. 2h′(x) ≥ 0 and ∂д(x,y) = − 1 = 1 ∂y ∂x Claim 2.1. ∂д(x,y) ∂y Proof. ∂д(x,y) = − 1 ≥ д(x, y) − 1. 2h′(y) ≥ − 1 ∂y 2h(y) ≥ 1 2(h(x) + 1 − h(y)) − 1 = д(x, y) − 1. □ ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. = 1 F E(cid:174)y [ (cid:0)h(x) + 1 − h(y)(cid:1), 38:6 Z. Huang, Z. Tang, X. Wu, and Y. Zhang 3 A SIMPLE LOWER BOUND 4 − e−0.5 ≈ 0.6434, as a warm-up of In this section, we prove a slightly smaller competitive ratio, 5 the later analysis. We reinterpret our algorithm as follows. As time t increases, each unmatched offline vertex v ∈ V is dynamically priced at wv · д(yv , t). Since д is non-increasing in the second dimension, the prices do not increase as time increases. Upon the arrival of u ∈ U , u can choose from its unmatched neighbors by paying the corresponding price. The utility of u derived by choosing v equals wv − wv · д(yv , yu). Then u chooses the one that gives the highest utility. Recall that д is non-decreasing in the first dimension. Thus, u prefers offline vertices with smaller ranks, as they offer lower prices. This leads to the following monotonicity property as in previous works [2, 13]. Fact 3.1 (Monotonicity). For any (cid:174)y, if v ∈ V is unmatched when u ∈ U arrives, then when yv increases, v remains unmatched when u arrives. Equivalently, if v ∈ V is matched when u ∈ U arrives, then when yv decreases, v remains matched when u arrives. Gain Sharing. The above interpretation induces a straightforward gain sharing rule: whenever u ∈ U is matched to v ∈ V , let αv := wv · д(yv , yu) and αu := wv · (1 − д(yv , yu)) = wv · д(yu , yv). Note that the gain of an offline vertex is larger if it is matched earlier, i.e., being matched earlier is more beneficial for offline vertices (αv is larger). However, the fact does not hold for online vertices. For each online vertex u ∈ U , the earlier u arrives (smaller yu is), the more offers u sees. On the other hand, the prices of offline vertices are higher when u comes earlier. Thus, it is not guaranteed that earlier arrival time yu induces larger αu. This is where our algorithm deviates from previous ones [2, 13], in which the prices of offline vertices are static (independent of time). The above observation is crucial and necessary for breaking the 1 − 1 To apply Lemma 2.1, we consider a pair of neighbors v ∈ V and u ∈ U . We fix an arbitrary e ·E [αu + αv], assignment of ranks to all vertices but u, v. Our goal is to establish a lower bound of 1 wv where the expectation is simultaneously taken over yu and yv. barrier in the random arrival model. at time yu = y, Lemma 3.1. For each y ∈ [0, 1], there exist thresholds 1 ≥ θ(y) ≥ β(y) ≥ 0 such that when u arrives • if yv < β(y), v is matched when u arrives; • if yv ∈ (β(y), θ(y)), v is matched to u; • if yv > θ(y), v is unmatched after u's arrival. Moreover, β(y) is a non-decreasing function and if θ(x) = 1 for some x ∈ [0, 1], then θ(x′) = 1 for all x′ ≥ x. Proof. Consider the moment when u arrives. By Fact 3.1, there exists a threshold β(yu) such that v is matched when u arrives iff yv < β(yu). Now suppose yv > β(yu), in which case v is not matched when u arrives. Thus v is priced at wv · д(yv , yu) and u can get utility wv · д(yu , yv) by choosing v. Recall that д(yu , yv) is non-increasing in terms of yv. Let θ(yu) ≥ β(yu) be the minimum value of yv such that v is not chosen by u. In other words, when β(yu) < yv < θ(yu), u matches v and when yv > θ(yu), v is unmatched after u's arrival. Next we show that β is a non-decreasing function of yu. By definition, if yv < β(yu), then v is matched when u arrives. Straightforwardly, when yu increases to y′ u (arrives even later), v would remain matched. Hence, we have β(y′ u > yu, i.e. β is non-decreasing (refer to Figure 1). u) ≥ β(yu) for all y′ ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. Online Vertex-Weighted Bipartite Matching: Beating 1 − 1 e with Random Arrivals 38:7 Fig. 1. θ(yu) and β(yu) (left hand side); truncated θ(yu) and β(yu) (right hand side). Finally, we show that if θ(x) = 1 for some x ∈ [0, 1], then θ(x′) = 1 for all x′ ≥ x. Assume for the sake of contradiction that θ(x′) < 1 for some x′ > x. In other words, when yu = x′ and yv = 1, v is unmatched when u arrives, but u chooses some vertex z (cid:44) v, such that wz · д(x′, yz) > wv · д(x′, 1). Now consider the case when u arrives at time yu = x. Recall that we have θ(x) = 1, which means that u matches v when yu = x and yv = 1. By our assumption, both v and z are unmatched when u arrives at time x′. Thus when u arrives at an earlier time x, both v and z are unmatched. Moreover, choosing z induces utility ′ , yz) · д(x, yz) , 1) · h(x) + 1 − h(yz) , 1) · д(x, 1) д(x′, yz) > wv · д(x h(x′) + 1 − h(yz) ≥ wv · д(x д(x′, 1) = wv · д(x, 1), ′ ′ , 1) · д(x, yz) д(x′, yz) , 1) · h(x) + 1 − h(1) ′ h(x′) + 1 − h(1) ′ wz · д(x, yz) = wz · д(x = wv · д(x = wv · д(x where the second inequality holds since h is a non-decreasing function and x < x′. strictly higher utility. This gives a contradiction, since when yu = x and yv = 1, u chooses v, while choosing z gives □ Remark 3.1. In the previous analysis by Devanur et al. [13] on the arbitrary arrival model, a single marginal rank (independent of yu) of v is defined, and they do not distinguish whether v is matched with u, as the gain sharing depends only on the rank of v, e.g., the definition of β is unnecessary. Remark 3.2. Observe that the function θ is not necessarily monotone. This comes from the fact that u may prefer v to z when u arrives at time t but prefer z to v when u arrives later at time t′ > t. Note that this happens only when the offline vertices have general weights: for the unweighted case, it is easy to show that θ must be non-decreasing. θ(τ) = 1. Let γ := β(1). Note that it is possible that γ ∈ {0, 1}. We define τ , γ ∈ [0, 1], which depend on the input instance, as follows. If θ(y) < 1 for all y ∈ [0, 1], then let τ = 1; otherwise let τ be the minimum value such that Since β is non-decreasing, we define β−1(x) := sup{y : β(y) = x} for all x ≤ γ. In the following, we establish a lower bound for 1 wv · E [αu + αv]. ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. γ𝜏𝛽(𝑦𝑢)𝜃(𝑦𝑢)110𝑦𝑢𝑦𝑣γ𝜏𝛽(𝑦𝑢)110𝑦𝑢𝑦𝑣𝜃(𝑦𝑢) 38:8 Z. Huang, Z. Tang, X. Wu, and Y. Zhang Lemma 3.2 (Main Lemma). For each pair of neighbors u ∈ U and v ∈ V , we have (cid:110)(1 − τ) · (1 − γ) + ∫ γ ∫ τ 0 (cid:111) . 1 wv · E [αu + αv] ≥ min 0≤γ ,τ ≤1 д(x, τ)dx + д(x, γ)dx 0 · E [αu + αv] ≥ minθ{∫ θ 1 wv It is worthwhile to make a comparison with a similar claim in the previous analysis by Devanur 0 д(y)dy + 1 − д(θ)}. The first et al. [13] on the arbitrary arrival model: term in their lower bound comes from the gain of the offline vertex v while the 1− д(θ) term comes from the fact that the online vertex u has gained at least 1 − д(θ) for all values of yv. Compared to theirs, our lower bound beats 1 − 1 0 д(x, τ)dx of v e and the "marginal" arrival time τ of u: in the previous analysis, only the trade-off between the gain 1 − д(θ) of u and the marginal rank θ of v is utilized. by utilizing the trade-off between the gain∫ γ We prove Lemma 3.2 by the following three lemmas. Observe that for any yu ∈ [0, 1], if yv ∈ (β(yu), θ(yu)), u, v are matched to each other, which implies αu + αv = wv. Hence we have the following lemma immediately. Lemma 3.3 (Corner Gain). E [(αu + αv) · 1(yu > τ , yv > γ)] = wv · (1 − τ) · (1 − γ). Now we give a lower bound for the gain of v when yv < γ, i.e., αv · 1(yv < γ), plus the gain of u when yv < γ and yu > τ, i.e., αu · 1(yv < γ , yu > τ). The key to prove the lemma is to show that for all yv < γ, no matter when u arrives, we always have αv ≥ wv · д(yv , β−1(yv)). Lemma 3.4 (v's Gain). E [αv · 1(yv < γ) + αu · 1(yv < γ , yu > τ)] ≥ wv ·∫ γ 0 д(x, τ)dx. Proof. Fix yv = x < γ. We first show that for all yu ∈ [0, 1], αv ≥ wv ·д(x, β−1(x)). By definition, we have β−1(x) < 1. Hence when yu > β−1(x), v is already matched when u arrives. Suppose v is matched to some z ∈ U , then we have yz ≤ β−1(x) and hence αv ≥ wv · д(x, β−1(x)). Now consider when u arrives at time y < β−1(x). If y > yz, then v is still matched to z when u arrives, and αv ≥ wv · д(x, β−1(x)) holds. Now suppose y < yz. We compare the two processes, namely when yu > β−1(x) and when yu = y. We show that for each vertex w ∈ V , the time it is matched is not later in the second case (compared to the first case). In other words, we show that decreasing the rank of any online vertex is not harmful for all offline vertices. Suppose otherwise, let w be the first vertex in V that is matched later when yu = y than when yu > β−1(x). I.e. among all these vertices, w's matched neighbor arrives the earliest when yu > β−1(x). Let u1 be the vertex w is matched to when yu > β−1(x) and u2 be the vertex w is matched to when yu = y. By assumption, we have yu2 > yu1. Consider when yu = y and the moment when u1 arrives, w remains unmatched but is not chosen by u1. However, w is the first vertex that is matched later than it was when yu > β−1(x), we know that at u1's arrival, the set of unmatched neighbor of u1 is a subset of that when yu > β−1(x). This leads to a contradiction, since w gives the highest utility, but is not chosen by u1. In particular, this property holds for vertex v, i.e. v is matched earlier or at the arrival of z and hence αv ≥ wv · д(x, yz) ≥ wv · д(x, β−1(x)), as claimed. Observe that for yv < γ and yu ∈ (τ , β−1(yv)), we have αu + αv = wv. Thus for yv = x < γ, we · Eyu [αv · 1(yv < γ) + αu · 1(yv < γ , yu > τ)] by lower bound 1 wv f (x, β −1(x))). It suffices to show that f (x, β−1(x)) ≥ д(x, τ). Consider the following two cases. (1) If β−1(x) < τ, then f (x, β−1(x)) = д(x, β−1(x)) ≥ д(x, τ), since ∂д(x,y) −1(x) − τ} · (1 − д(x, β −1(x)) + max{0, β −1(x)) := д(x, β ≤ 0. ∂y ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. Online Vertex-Weighted Bipartite Matching: Beating 1 − 1 e with Random Arrivals 38:9 (2) If β−1(x) ≥ τ, then f (x, β−1(x)) is non-decreasing in the second dimension, since −1(x) − τ) · ∂д(x, β−1(x)) ∂β−1(x) ∂ f (x, β−1(x)) ∂д(x, β−1(x)) + 1 − д(x, β −1(x)) − (β ∂β−1(x) ∂β−1(x) = ≥ 0, where the inequality follows from Claim 2.1 and the fact that ∂д(x, β−1(x)) have f (x, β−1(x)) ≥ f (x, τ) = д(x, τ). Hence for every fixed yv = x < γ we have Eyu [αv · 1(yv < γ) + αu · 1(yv < γ , yu > τ)] ≥ wv · д(x, τ). ∂β−1(x) ≤ 0. Therefore, we Taking integration over x ∈ (0, γ) concludes the lemma. □ Next we give a lower bound for the gain of u when yu < τ, i.e., αu · 1(yu < τ), plus the gain of v when yu < τ and yv > γ, i.e., αv · 1(yu < τ , yv > γ). The following proof is in the same spirit as in the proof of Lemma 3.4, although the ranks of offline vertices have different meaning from the ranks (arrival times) of online vertices. yv is, the gain of αu is always at least wv · д(yu , θ(yu)). Lemma 3.5 (u's Gain). E [αu · 1(yu < τ) + αv · 1(yu < τ , yv > γ)] ≥ wv ·∫ τ Similar to the proof of Lemma 3.4, the key is to show that for all yu < τ, no matter what value 0 д(x, γ)dx. Proof. Fix yu = x < τ. By definition we have θ(x) < 1. The analysis is similar to the previous. We first show that for all yv ∈ [0, 1], we have αu ≥ wv · д(x, θ(x)). We use θ to denote the value that is arbitrarily close to, but larger than θ(x). By definition, when yv = θ, u matches some vertex other than v. Thus we have αu ≥ wv · д(x, θ(x)). Hence, when yv > θ, i.e. v has a higher price, u would choose the same vertex as when yv = θ, and αu ≥ wv · д(x, θ(x)) still holds. Now consider the case when yv = y < θ. As in the analysis of Lemma 3.4, we compare two processes, when yv = θ and when yv = y < θ. We show that for each vertex w ∈ U (including u) with yw ≤ x = yu, the utility of w when yv = y is not worse than its utility when yv = θ. Suppose otherwise, let w be such a vertex with earliest arrival time. Let v′ be the vertex that is matched to w when yv = θ. Then we know that (when yv = y) at w's arrival, w chooses a vertex that gives less utility comparing to v′. Hence, at this moment v′ is already matched to some w′ with yw′ < yw. This implies that when yv = θ, v′ (which is matched to w) is unmatched when w′ arrives, but not chosen by w′. Therefore, w′ has lower utility when yv = y compared to the case when yv = θ, which contradicts the assumption that w is the first such vertex. Observe that when yv ∈ (γ , θ(x)), we have αu + αv = wv. Thus for any fixed yu = x < τ, we lower bound 1 wv · Eyv [αu · 1(yu < τ) + αv · 1(yu < τ , yv > γ)] by f (x, θ(x)) := д(x, θ(x)) + max{0, θ(x) − γ} · (1 − д(x, θ(x))). In the following, we show that f (x, θ(x)) ≥ д(x, γ). Consider the following two cases. (1) If θ(x) ≤ γ, then f (x, θ(x)) = д(x, θ(x)) ≥ д(x, γ), since ∂д(x,y) (2) If θ(x) > γ, then ∂ f (x, θ(x)) ∂д(x, θ(x)) ≤ 0. ∂y + 1 − д(x, θ(x)) − (θ(x) − γ) · ∂д(x, θ(x)) ∂θ(x) ≤ 0. Therefore, we have ≥ 0, where the inequality follows from Claim (2.1) and ∂д(x,θ(x)) ∂θ(x) f (x, θ(x)) ≥ f (x, γ) = д(x, γ). ∂θ(x) = ∂θ(x) ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. 38:10 Z. Huang, Z. Tang, X. Wu, and Y. Zhang Finally, take integration over x ∈ (0, τ) concludes the lemma. □ Proof of Lemma 3.2: Observe that αu + αv = (αu + αv) · 1(yu > τ , yv > γ) + αv · 1(yv < γ) + αu · 1(yv < γ , yu > τ) + αu · 1(yu < τ) + αv · 1(yu < τ , yv > γ) Combing Lemma 3.3, 3.4 and 3.5 finishes the proof immediately. Theorem 3.6. Fix h(x) = min{1, ex−0.5}. For any pair of neighbors u and v, and any fixed ranks of vertices in U ∪ V \ {u, v}, we have 1 wv · Eyu,yv [αu + αv] ≥ 5 4 − e−0.5 ≈ 0.6434. Proof. It suffices to show that the RHS of Lemma 3.2 is at least 5 symmetric for τ and γ, we assume τ ≥ γ without loss of generality. Let f (τ , γ) be the term on the RHS of Lemma 3.2 to be minimized. By our choice of д, 4 − e−0.5. Since the expression is ∫ γ 1 f (τ , γ) =1 − τ − γ + τ · γ + 2 2(1 + h(γ)) − γ 2(1 + h(τ)) + τ · γ + ∂ f (τ , γ) = γ − 1 (cid:0)h(x) + 1 − h(τ)(cid:1)dx + ∫ γ =1 − τ 2(1 + h(γ)) − γ 2 · h 1 2 0 0 ∂τ Observe that It is easy to check that (cid:40)≤ 0 > 0 γ − 1 2h(γ) ′(τ) + 1 2h(τ). when γ ≤ 1 2 , 1 when γ > 2 . ∫ τ 1 2 h(x)dx + 0 (cid:0)h(x) + 1 − h(γ)(cid:1)dx ∫ τ h(x)dx . 1 2 0 Hence when γ ≤ 1 2, we have ∂ f (τ , γ) ∂τ ≤ γ − 1 2h(γ) − 1 ∫ γ 2(1 − h(τ)) ≤ 0, ∫ 1 which means that the minimum is attained when τ = 1. Note that when γ ≤ 1 2, we have f (1, γ) = 1 2(1 − h(γ)) + 1 2 0 which attains its minimum at γ = 0 (since h′(γ) = h(γ) for γ ≤ 1 2): 5 4 − e 2(1 1 2 + 1 − e 1 2(1 − e h(x)dx + −0.5) = −0.5) + 1 2 0 h(x)dx, −0.5 ≈ 0.6434. When τ ≥ γ > f (1, 0) = 1 2, we have ∂ f (τ , γ) 2 · 0 + ∫ γ Hence the minimum is attained when τ = γ, which is 2(1 + h(γ)) − γ ∂τ = γ − 1 f (γ , γ) = 1 − 2γ + γ 2 + 1 2 = γ − 1 2h(γ) > 0 h(x)dx . 0 Observe that d f (γ , γ) = −2 + 2γ + h(γ) ≥ −2 + 1 + 1 = 0. dγ The minimum is attained when γ = 1 2, which equals f ( 1 2 , ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. 2) = 5 1 4 − e−0.5 ≈ 0.6434. □ Online Vertex-Weighted Bipartite Matching: Beating 1 − 1 e with Random Arrivals 38:11 4 IMPROVING THE COMPETITIVE RATIO Observe that in Lemma 3.2, we relax the total gain of αu + αv into two parts: (1) when yu ≥ τ and yv ≥ γ, αu + αv = wv; (2) for other ranks yu , yv, we lower bound αu and αv by wv ·д(yu , γ) and wv ·д(yv , τ) respectively. For the second part, the inequalities used in the proof of Lemma 3.4 and 3.5 are tight only if β, θ are two step functions (refer to Figure 1). On the other hand, given these β, θ, when yu ≤ τ and yv ≤ γ, we actually have αu + αv = wv, which is strictly larger than our estimate wv · (д(yu , γ) + д(yv , τ)). With this observation, it is natural to expect an improved bound if we can retrieve this part of gain (even partially). In this section, we prove an improved competitive ratio 0.6534, using a refined lower bound for 1 wv · E [αu + αv] (compared to Lemma 3.2) as follows. Lemma 4.1 (Improved Bound). For any pair of neighbors u ∈ U and v ∈ V , we have 1 wv · E [αu + αv] ≥ min 0≤γ ,τ ≤1 (1 − τ)(1 − γ) + (1 − τ) д(x, τ)dx (cid:26) ∫ τ (cid:110) ∫ γ ∫ θ 0 д(y, τ)dy Proof. Let γ and τ be defined as before, i.e., γ = β(1) and τ = min{x : θ(x) = 1}. We divide 1 wv · E [αu + αv] into three parts, namely (1) when yu > τ and yv > γ; (2) when yu > τ д(y, x)dy + д(x, θ) + min θ ≤γ + 0 0 and yv < γ; and (3) when yu < τ: ∫ γ θ (cid:111) dx (cid:27) . 1 wv · E [αu + αv] = + + 1 wv 1 wv 1 wv · E [(αu + αv) · 1(yu > τ , yv > γ)] · E [(αu + αv) · 1(yu > τ , yv < γ)] · E [(αu + αv) · 1(yu < τ)] . ∫ γ (cid:16)(1 − τ) · д(yv , β −1(yv) − τ} ·(cid:0)1 − д(yv , β −1(yv))(cid:1)(cid:17) As shown in Lemma 3.3, the first term is at least (1 − τ) · (1 − γ), as we have αu + αv = wv for all yu > τ and yv > γ. Then we consider the second term, the expected gain of αu + αv when yv < γ and yu > τ. For any yv < γ, as we have shown in Lemma 3.4, αv ≥ wv · д(yv , β−1(yv)) for all yu > τ. Moreover, when yu < β−1(yv), we have αu + αv = wv. Hence the second term can be lower bounded by 0 −1(yv)) + max{0, β Now we consider the last term and fix a yu < τ. As we have shown in Lemma 3.5, for all yv ∈ [0, 1], αu ≥ wv · д(yu , θ(yu)). Consider the case when θ(yu) > γ, then for yv ∈ (0, γ), αv ≥ wv · д(yv , yu); for yv ∈ (γ , θ(yu)), αu + αv = wv. Thus the expected gain of αu + αv (taken over the randomness of yv) can be lower bounded by dyv . д(yv , yu)dyv + (θ(yu) − γ) · (1 − д(yu , θ(yu)))(cid:17) . wv ·(cid:16) д(yu , θ(yu)) + As we have shown in Lemma 3.5, the partial derivative with respect to θ(yu) is non-negative, · E [αu + αv], we can assume that θ(yu) ≤ γ for all Given that θ(yu) ≤ γ, we have αv ≥ wv · д(yv , yu) when yv ∈ (0, , θ(yu)); and αv ≥ wv · thus for the purpose of lower bounding 1 wv yu < τ. д(yv , β−1(yv)) when yv ∈ (θ(yu), γ). ∫ γ 0 ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. 38:12 Z. Huang, Z. Tang, X. Wu, and Y. Zhang (cid:16) ∫ τ ∫ θ(yu) Hence the third term can be lower bounded by ∫ γ θ(yu) д(yv , β for those β−1(yv) > τ, we have a non-negative derivative as follows: д(yv , yu)dyv + д(yu , θ(yu)) + 0 0 (cid:17) dyu −1(yv))dyv Putting the three lower bounds together and taking the partial derivative with respect to β−1(yv), ∂д(yv , β−1(yv)) ∂β−1(yv) Thus for lower bounding 1 wv 1 wv · E [αu + αv] ≥ min 0≤γ ,τ ≤1 −1(yv)) − (β + 1 − д(yv , β ≥ 0. · E [αu + αv], we assume β−1(yv) ≤ τ for all yv < γ. Hence −1(yv) − τ) · ∂д(yv , β−1(yv)) ∂β−1(yv) ∫ γ (cid:110)(1 − τ)(1 − γ) + (1 − τ) ∫ θ(yu) д(yu , θ(yu)) + (cid:16) 0 д(yv , τ)dyv 0 д(yv , yu)dyv + (cid:17) dyu (cid:111) . □ ∫ γ θ(yu) д(yv , τ)dyv ∫ γ д(y, τ)dy. 0 ∫ τ 0 + ∫ θ 0 ∫ γ θ Taking the minimum over θ(yu) concludes Lemma 4.1. Observe that for any θ ≤ γ, we have д(x, θ) + д(y, x)dy + д(y, τ)dy ≥ д(x, γ) + Thus the lower bound given by Lemma 4.1 is not worse than Lemma 3.2. Theorem 4.2. Fix h(x) = min{1, 2ex}. For any pair of neighbors u and v, and any fixed ranks of 1 vertices in U ∪ V \ {u, v}, we have 1 wv · Eyu,yv [αu + αv] ≥ 1 − ln 2 2 ≈ 0.6534. Proof. For h(x) = min{1, Let f (τ , γ) be the expression on the RHS to be minimized in Lemma 4.1. Using д(x, y) = 1 2ex}, we have h′(x) = h(x) when x < ln(2), and h′(x) = 0, h(x) = 1 1 2(h(x + when x > ln(2). 1 − h(y))), we have (cid:0)γ · (1 − h(τ)) + h(x)dx(cid:1) 1 − τ 2 (cid:110)1 + γ + h(x) − h(θ) − θ · h(x) − (γ − θ) · h(τ) + ∫ τ h(x)dx + 1 2 min θ ≤γ 0 ∫ γ (cid:111) (cid:8)q(τ , x, θ)(cid:9)dx, h(x)dx dx 0 (1) =(1 − τ)(1 − γ) + γ 2 · (1 − h(τ)) + τ 2 + f (τ , γ) =(1 − τ)(1 − γ) + ∫ τ 0 1 2 + min θ ≤γ where q(τ , x, θ) := h(x) − h(θ) − θ · h(x) + θ · h(τ). Observe that ∂q(τ , x, θ) ∂θ = h(τ) − h(x) − h ′(θ) < 0 ≥ 0 when θ < ln 2, when θ ≥ ln 2. Thus we can lower bound q(τ , x, θ) by (recall that θ ≤ γ and x < τ) q(τ , x, min{ln 2, γ}) ≥ h(x) − h(γ) − ln 2 · h(x) + ln 2 · h(τ). ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. ∫ γ ∫ γ 0 0 1 2 (cid:40) Online Vertex-Weighted Bipartite Matching: Beating 1 − 1 e with Random Arrivals 38:13 Applying the lower bound on q(τ , x, θ) in Equation (1), we have ∫ γ f (τ , γ) ≥(1 − τ)(1 − γ) + γ ∫ τ 0 1 2 + =(1 − τ)(1 − γ) + 0 1 2 2 · (1 − h(τ)) + τ 2 + h(x) − h(γ) − ln 2 · h(x) + ln 2 · h(τ)(cid:17) (cid:16) ∫ γ h(x)dx ∫ τ 2(1 − h(γ)) + 2(1 − h(τ)) + τ 1 − ln 2 h(x)dx . 1 2 γ 0 0 dx h(x)dx ln 2 2 τ · h(τ) + + combined with Lemma 4.1) yields Theorem 4.2. 2 In the following, we show that f (τ , γ) ≥ 1 − ln 2 First, observe that ∂ f (τ , γ) ′(γ) + 1 2(1 − h(τ)) + 1 2h(γ) = 1 2 ∂γ = −(1 − τ) − τ 2 · h which is non-decreasing in γ. Then we know that for τ ≤ τ ∗, 2 ≈ 0.6534 for all τ , γ ∈ [0, 1], which (when (cid:16)(h(γ) − τ · h ′(γ)) − (1 + h(τ) − 2τ)(cid:17) . Note that 1 + h(τ)− 2τ is strictly decreasing. Let τ ∗ ≈ 0.3574 be the solution for 1 + h(τ)− 2τ = 1. Thus, f (τ , γ) ≥ f (τ , 1) = 1 2(1 − h(τ)) + Recall that for τ < τ ∗, h′(τ) = h(τ) = 1 ∂ f (τ , 1) ∂τ = −1 2h(τ) + ln 2 2 h(τ) + we have (for τ < τ ∗) f (τ , γ) ≥ f (τ , 1) ≥ f (0, 1) = ∂ f (τ , γ) ∂γ ≤ 1 2 (h(γ) − 1) ≤ 0 ∫ 1 ln 2 2 τ · h(τ) + 1 2 0 h(y)dy + ∫ τ 0 1 − ln 2 2 h(x)dx . 1 − ln 2 2 h(τ) = ln 2 2 τ · h(τ) ≥ 0, 1 2 0 h(y)dy = 1 − ln 2 2 ≈ 0.6534. 2eτ . Since ln 2 2 τ · h(τ) + ∫ 1 1 2(1 − h(0)) + (cid:40) Now we consider τ > τ ∗, in which case 1 + h(τ) − 2τ < 1. Observe that 1 + h(τ) − 2τ > 1 − τ for all τ ∈ [0, 1], we have when γ < ln 2, when γ > ln 2. ∂ f (τ , γ) < 0 > 0 ∂γ Hence for τ > τ ∗ we have f (τ , γ) ≥ f (τ , ln 2) = (1 − τ)(1 − ln 2) + Taking derivative over τ on the RHS, we have ln 2 2 · (1 − h(τ)) + ln 2 2 τ · h(τ) + 1 4 + 1 − ln 2 2 ∫ τ 0 h(x)dx . ∂ f (τ , ln 2) ∂τ = −(1 − ln 2) − ln 2 2 · h ′(τ) + ln 2 2 τ · h ′(τ) + 1 2h(τ), ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. 38:14 Z. Huang, Z. Tang, X. Wu, and Y. Zhang which is 1 2 − (1 − ln 2) > 0 when τ > ln 2. For τ ≤ ln 2, we have when τ < τ0, when τ ≥ τ0, < 0 ≥ 0 where τ0 ≈ 0.564375 is the solution of ∂f (τ ,ln 2) ∂ f (τ , ln 2) ∂τ = 0. Thus for τ > τ ∗ we have (cid:40) ∂τ f (τ , γ) ≥ f (τ , ln 2) ≥ f (τ0, ln 2) =(1 − τ0)(1 − ln 2) + ln 2 4 · (2 − eτ0 + τ0 · eτ0) + Thus for all τ , γ ∈ [0, 1], we have f (τ , γ) ≥ 1 − ln 2 1 − ln 2 4 + (eτ0 − 1) ≈ 0.6557 > 1 − ln 2 2 . 2 , as claimed. 1 4 □ 5 CONCLUSION In this paper, we show that competitive ratios above 1 − 1 can be obtained under the randomized e primal-dual framework when equipped with a two dimensional gain sharing function. The key of the analysis is to lower bound the expected combined gain of every pair of neighbors (u, v), over the randomness of the rank yv of the offline vertex, and the arrival time yu of the online vertex. Referring to Figure 1, it can be shown that the competitive ratio F ≥∫ 1 ∫ 1 θ(yu) д(yv , β f (yu) :=(1 − θ(yu) + β(yu)) · д(yu , θ(yu)) + θ(yu) − β(yu) 0 f (yu)dyu, where ∫ β(yu) −1(yv))dyv + −1(yv))dyv . Note that here we assume β−1(yv) = 1 for all yv ≥ γ, and д(x, 1) = 0 for all x ∈ [0, 1]. For every fixed д, there exist threshold functions θ and β that minimize the integration. Thus the main difficulty is to find a function д such that the integration has a large lower bound for all functions θ and β (which depend on the input instance). We have shown that there exists a choice of д such that the minimum is attained when θ and β are step functions, based on which we can give a lower bound on the competitive ratio. It is thus an interesting open problem to know how much the competitive ratio can be improved by (fixing an appropriate function д and) giving a tighter lower bound for the integration. We believe that it is possible to give a lower bound very close to (or even better than) the 0.696 competitive ratio obtained for the unweighted case [23]. д(yv , β + 0 ACKNOWLEDGEMENTS The first author would like to thank Nikhil Devanur, Ankit Sharma, and Mohit Singh with whom he made an initial attempt to reproduce the results of Mahdian and Yan using the randomized primal-dual framework. REFERENCES [1] Melika Abolhassani, T.-H. Hubert Chan, Fei Chen, Hossein Esfandiari, MohammadTaghi Hajiaghayi, Hamid Mahini, and Xiaowei Wu. 2016. Beating Ratio 0.5 for Weighted Oblivious Matching Problems. In ESA (LIPIcs), Vol. 57. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 3:1 -- 3:18. [2] Gagan Aggarwal, Gagan Goel, Chinmay Karande, and Aranyak Mehta. 2011. Online Vertex-Weighted Bipartite Matching and Single-bid Budgeted Allocations. In SODA. 1253 -- 1264. [3] Jonathan Aronson, Martin Dyer, Alan Frieze, and Stephen Suen. 1995. Randomized greedy matching. II. Random Struct. Algorithms 6, 1 (Jan. 1995), 55 -- 73. https://doi.org/10.1002/rsa.3240060107 [4] Bahman Bahmani and Michael Kapralov. 2010. Improved Bounds for Online Stochastic Matching. In ESA (1) (Lecture Notes in Computer Science), Vol. 6346. Springer, 170 -- 181. ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019. Online Vertex-Weighted Bipartite Matching: Beating 1 − 1 e with Random Arrivals 38:15 [5] Benjamin Birnbaum and Claire Mathieu. 2008. On-line bipartite matching made simple. ACM SIGACT News 39, 1 (2008), 80 -- 87. [6] Brian Brubach, Karthik Abinav Sankararaman, Aravind Srinivasan, and Pan Xu. 2016. New Algorithms, Better Bounds, and a Novel Model for Online Stochastic Matching. In ESA (LIPIcs), Vol. 57. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 24:1 -- 24:16. [7] Niv Buchbinder, Kamal Jain, and Joseph Naor. 2007. Online Primal-Dual Algorithms for Maximizing Ad-Auctions Revenue. In ESA (Lecture Notes in Computer Science), Vol. 4698. Springer, 253 -- 264. [8] Niv Buchbinder, Kamal Jain, and Mohit Singh. 2014. Secretary Problems via Linear Programming. Math. Oper. Res. 39, 1 (2014), 190 -- 206. [9] T.-H. Hubert Chan, Fei Chen, and Xiaowei Wu. 2018. Analyzing Node-Weighted Oblivious Matching Problem via Continuous LP with Jump Discontinuity. ACM Trans. Algorithms 14, 2 (2018), 12:1 -- 12:25. [10] T.-H. Hubert Chan, Fei Chen, Xiaowei Wu, and Zhichao Zhao. 2014. Ranking on Arbitrary Graphs: Rematch via Continuous LP with Monotone and Boundary Condition Constraints.. In SODA. 1112 -- 1122. [11] Ilan Reuven Cohen and David Wajc. 2018. Randomized Online Matching in Regular Graphs. In SODA. SIAM, 960 -- 979. [12] Nikhil R. Devanur and Kamal Jain. 2012. Online matching with concave returns. In STOC. ACM, 137 -- 144. [13] Nikhil R. Devanur, Kamal Jain, and Robert D. Kleinberg. 2013. Randomized Primal-Dual analysis of RANKING for [14] Jon Feldman, Aranyak Mehta, Vahab S. Mirrokni, and S. Muthukrishnan. 2009. Online Stochastic Matching: Beating [15] Gagan Goel and Aranyak Mehta. 2008. Online budgeted matching in random input models with applications to Online BiPartite Matching. In SODA. SIAM, 101 -- 107. 1-1/e. In FOCS. IEEE Computer Society, 117 -- 126. Adwords. In SODA. 982 -- 991. [16] Bernhard Haeupler, Vahab S. Mirrokni, and Morteza Zadimoghaddam. 2011. Online Stochastic Weighted Matching: Improved Approximation Algorithms. In WINE (Lecture Notes in Computer Science), Vol. 7090. Springer, 170 -- 181. [17] Zhiyi Huang, Ning Kang, Zhihao Gavin Tang, Xiaowei Wu, Yuhao Zhang, and Xue Zhu. 2018. How to match when all vertices arrive online. In STOC. ACM, 17 -- 29. [18] Zhiyi Huang, Zhihao Gavin Tang, Xiaowei Wu, and Yuhao Zhang. 2018. Online Vertex-Weighted Bipartite Matching: Beating 1-1/e with Random Arrivals. In ICALP (LIPIcs), Vol. 107. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 79:1 -- 79:14. [19] Patrick Jaillet and Xin Lu. 2014. Online Stochastic Matching: New Algorithms with Better Bounds. Math. Oper. Res. 39, [20] Chinmay Karande, Aranyak Mehta, and Pushkar Tripathi. 2011. Online bipartite matching with unknown distributions. [21] Richard M. Karp, Umesh V. Vazirani, and Vijay V. Vazirani. 1990. An Optimal Algorithm for On-line Bipartite Matching. 3 (2014), 624 -- 646. In STOC. 587 -- 596. In STOC. 352 -- 358. [22] Thomas Kesselheim, Klaus Radke, Andreas Tönnis, and Berthold Vöcking. 2013. An Optimal Online Algorithm for Weighted Bipartite Matching and Extensions to Combinatorial Auctions. In ESA (Lecture Notes in Computer Science), Vol. 8125. Springer, 589 -- 600. [23] Mohammad Mahdian and Qiqi Yan. 2011. Online bipartite matching with random arrivals: an approach based on strongly factor-revealing LPs. In STOC. 597 -- 606. [24] Vahideh H. Manshadi, Shayan Oveis Gharan, and Amin Saberi. 2012. Online Stochastic Matching: Online Actions Based on Offline Statistics. Math. Oper. Res. 37, 4 (2012), 559 -- 573. [25] Aranyak Mehta, Amin Saberi, Umesh V. Vazirani, and Vijay V. Vazirani. 2007. AdWords and generalized online matching. J. ACM 54, 5 (2007), 22. [26] Yajun Wang and Sam Chiu-wai Wong. 2015. Two-sided Online Bipartite Matching and Vertex Cover: Beating the Greedy Algorithm. In ICALP (1) (Lecture Notes in Computer Science), Vol. 9134. Springer, 1070 -- 1081. ACM Trans. Algor., Vol. 15, No. 3, Article 38. Publication date: June 2019.
1307.4355
4
1307
2018-06-18T05:51:53
Near Linear Time Approximation Schemes for Uncapacitated and Capacitated b--Matching Problems in Nonbipartite Graphs
[ "cs.DS" ]
We present the first near optimal approximation schemes for the maximum weighted (uncapacitated or capacitated) $b$--matching problems for non-bipartite graphs that run in time (near) linear in the number of edges. For any $\delta>3/\sqrt{n}$ the algorithm produces a $(1-\delta)$ approximation in $O(m \poly(\delta^{-1},\log n))$ time. We provide fractional solutions for the standard linear programming formulations for these problems and subsequently also provide (near) linear time approximation schemes for rounding the fractional solutions. Through these problems as a vehicle, we also present several ideas in the context of solving linear programs approximately using fast primal-dual algorithms. First, even though the dual of these problems have exponentially many variables and an efficient exact computation of dual weights is infeasible, we show that we can efficiently compute and use a sparse approximation of the dual weights using a combination of (i) adding perturbation to the constraints of the polytope and (ii) amplification followed by thresholding of the dual weights. Second, we show that approximation algorithms can be used to reduce the width of the formulation, and faster convergence.
cs.DS
cs
Near Linear Time Approximation Schemes for Uncapacitated and Capacitated b -- Matching Problems in Nonbipartite Graphs∗ Kook Jin Ahn† Sudipto Guha‡ Abstract We present the first near optimal approximation schemes for the maximum weighted (unca- pacitated or capacitated) b -- matching problems for non-bipartite graphs that run in time (near) √ n the algorithm produces a (1 − δ) approxi- linear in the number of edges. For any δ > 3/ mation in O(m poly(δ−1, log n)) time. We provide fractional solutions for the standard linear programming formulations for these problems and subsequently also provide (near) linear time approximation schemes for rounding the fractional solutions. Through these problems as a vehi- cle, we also present several ideas in the context of solving linear programs approximately using fast primal-dual algorithms. First, even though the dual of these problems have exponentially many variables and an efficient exact computation of dual weights is infeasible, we show that we can efficiently compute and use a sparse approximation of the dual weights using a combination of (i) adding perturbation to the constraints of the polytope and (ii) amplification followed by thresholding of the dual weights. Second, we show that approximation algorithms can be used to reduce the width of the formulation, and faster convergence. Introduction 1 The b -- matching problem is a fundamental problem with a rich history in combinatorial optimiza- tion, see [29, Chapters 31 -- 33]. In this paper we focus on finding near optimal approximation schemes for finding fractional as well as integral solutions for maximum b -- matching problems in non-bipartite graphs. The algorithms produce a (1 − O(δ)) approximations and run in time O((m + n) · poly(log n, 1/δ)) time for δ ≥ 3/ Definition 1. [29, Chapter 31] In the b -- matching problem we are given a weighted (possibly non- bipartite) graph G = (V, E,{wij},{bi}) where wij is the weight of edge (i, j) and bi is the capacity of the vertex i. Let V = n and E = m. We assume bi are integers in [1, poly n]. We can select j:(i,j)∈E yij ≤ bi for all vertices i and the goal is to an edge (i, j) with multiplicity yij such that P maximize P (i,j)∈E wijyij. Let B =P i bi, and note B ≥ n. √ n. Definition 2. [29, Chapters 32 & 33] In the Capacitated b -- matching problem we have an additional restriction that the multiplicity of an edge (i, j) ∈ E is at most cij where cij are also given in the input (also assumed to be an integer in [0, poly n]). Observe that we can assume cij ≤ min{bi, bj} without loss of generality. A problem with cij = 1 for all (i, j) ∈ E is also referred to as an "unit capacity" or "simple" b -- matching problem in the literature. ∗A previous extended abstract of this paper appeared in SODA 2014 [2]. †Google, 1600 Amphitheatre Parkway Mountain View, CA 94043. Email [email protected]. This work was done while the author was at University of Pennsylvania. ‡Department of Computer and Information Sciences, University of Pennsylvania, Philadelphia, PA. Email: [email protected]. Research supported in part by NSF Award CCF-1546151. 1 Müller-Hannemann and Schwartz [26] provide an excellent survey of different algorithms for variants of b -- matching. Approaches that solve regular matching do not extend to b-matchings without significant loss of efficiency. We revisit some of the reasons shortly. In the interest of space we summarize the main results for the b-matching problem briefly. Gabow [14] gave an O(nm log n) algorithm for the unweighted (wij = 1) capacitated problem. For cij = 1 this reduces to O(min{√ Bm, nm log n}). For the weighted uncapacitated case Anstee [4] gave an O(n2m) algo- rithm; an O(m2) algorithm is in [14]. Letchford et al. [23], building on Padberg and Rao [27], gave an O(n2m log(n2/m)) time algorithm for the decision version of the weighted, uncapaci- tated/capacitated problem. In summary the best exact algorithms to date for the b -- matching problem in general graphs are super -- linear (see [29, Chapter 31]) in the size of the input. It is known that solving the bipartite relaxation for the weighted b -- matching problem within a (1 − δ) approximation (for any δ > 0) will always produce a ( 2 3 − δ)-approximation algorithm for general non-bipartite graphs [12, 13]. This approximation is also tight (consider all bi = 1, wij = 1 for a triangle graph) -- no approach which only uses bipartite relaxations will breach the 2 3 barrier. Distributed algorithms with O(1) or weaker approximation guarantees have been discussed by 3 − δ) approximation algorithm running Koufogiannakis and Young [22]. Mestre [25] provided a ( 2 in O(m(maxi bi) log 1 δ ) time for weighted unit capacity b -- matching [25]. However a constant factor approximation does not seem to be a natural stopping point. Given the recent growth in data sets and sizes of the graphs defining instances of matching it is natural to consider approximation algorithms that trade off the quality of the solution versus running time. Typically these algorithms provide an f-approximation, that is, for any instance we return a feasible solution whose value is at least f times the value of the true optimum for that instance (maximum version). In particular efficient algorithms which are (1 − δ)-approximation schemes (for any absolute constant δ > 0, independent of n) and faster than computing the opti- mum solution are useful in this context. It would be preferable that the running time depended polynomially on 1/δ (instead of exponential dependence) -- even though δ is assumed constant. It is possible that each vertex has bi = n and a linear dependence on B is not a near linear time algorithm. This paper provides the first near linear time approximation scheme for b -- matching. √ 1.1 Existing Approaches and Challenges We begin with the natural question about similarity and differences vis-a-vis weighted matching, which correspond to bi = 1 for all vertices i. Efficient approximation schemes exist for maximum weighted matching, even for the non-bipartite case, see [9, 10] and references therein. All of these algorithms maintain a feasible matching and repeatedly use augmentation paths -- paths between two unmatched vertices such that the alternate edges are matched. In the non-bipartite case, if the two endpoints are the same vertex then this path is known as a "blossom". An efficient search for good augmentation paths, in the weighted case, requires contraction of blossoms. However this approach does not extend to non-bipartite b -- matching for the case bi > 1. The augmentation structures needed for b -- matching are not just blossoms but also blossoms with forests that are attached to the blossom (often known as petals/arms), see the discussion in [26]. Searching over this space of odd cycles with attached forests is significantly more difficult and inefficient. In the language of linear programming (which we discuss in more detail shortly), augmentation paths preserve primal feasibility for the matching problem. In our approach we explicitly maintain a primal infeasible solution (by violating the capacities) except at the last step. It is known that if we copy each node bi times then the b -- matching problems reduce to maximum weighted matching. As an example the pairs of edges (u, v) and (v, w) where the vertex capacities are 3, 2, 3 as shown, correspond to 8 vertices and 12 edges. 2 3 u 2 v 3 w u1 u2 u3 v1 v2 w1 w2 w3 The size of the graph increases significantly under such a transformation -- consider a star graph where the central node has bi = n and the leaf nodes have bi = 1 -- replication of that central node will make the number of edges n2. If we are seeking near linear running times then transformations such as copying do not help since the number of edges and vertices can increase by polynomial factors. This blowup was known since [14], judicious use of this approach has been used to achieve superlinear time (in n) optimal algorithms that also depend on B, for example as in [15]. However near linear time algorithms have remained elusive. Linear Programming Formulations. Consider the following definition and linear program- E = m, and non-negative integer bi for each i ∈ V , for each U ⊆ V let kUkb =P ming formulation LP1 for the uncapacitated b -- matching problem. Definition 3 (Odd Sets and Small Odd Sets). Given a graph G = (V, E), with V = n and i∈U bi. Define O = {U kUkb is odd and ≥ 3, U has more than one vertex}. Let Oδ = {U U ∈ O;kUkb ≤ 1/δ}. wijyij (i,j)∈E yij ≤ bi yij ≤ bkUkb/2c β∗ = LP1(b) = max X X X j:(i,j)∈E (i,j)∈E:i,j∈U yij ≥ 0 ∀i ∈ V ∀U ∈ O ∀(i, j) ∈ E (LP1) The constraints of LP1 represent the "b-matching polytope"; any vector in this polytope can be expressed as a convex combination of integral b -- matching solutions, see [29, Chapter 31]. The constraints in LP1 correspond to the vertices and odd sets. The variable yij (which is the same as yji) corresponds to the fractional relaxation of the "multiplicity" of the edge (i, j) in the uncapacitated b -- matching. It is known that the formulation LP1 has an integral optimum solution when bi are integers. The formulation has m variables and 2Ω(n) constraints -- but can be solved in polynomial time since the oracle for computing the maximum violated constraint can be implemented in polynomial time using standard techniques [23]. That approach is the "minimum odd-cut" approach of Padberg and Rao [27]. If we only retain the constraints for odd sets U ∈ Oδ then a fractional solution of the modified system, when multiplied by (1 − δ), satisfies LP1. That relaxed formulation, still has n1/δ constraints which is exponential in 1/δ. Note that an approximate solution of the dual does not immediately provide us a solution for the primal1. It may be tempting to postulate that applying existing multiplicative weight algorithms such as [24, 28, 18] and many others (see the surveys [11, 5]) can help provide us approximate solutions to LP1 efficiently. However that is not the case due to several reasons. First, the existing algorithms have to maintain weights for each of the n1/δ constraints. Second, even if we are provided an 1In subsequent work, in manuscript [3], we show that we can solve the dual to identify the subgraph containing the maximum uncapacitated b -- matching; but that manuscript uses the results in this paper to construct an actual feasible primal solution on that subgraph. Further the methods of [3] do not apply to the dual of the capacitated b -- matching problem. 3 approximately feasible fractional solution, no efficient algorithm exists that easily computes the maximum violation of the constraints in LP1. Moreover it is nontrivial to verify that we have already achieved an approximately feasible solution. The only known algorithms for computing the maximum violation (for just the odd-sets) still correspond to the minimum odd-cut problem. Those solutions are at least cubic (see [23]). Capacitated b -- Matching The situation is more dire in presence of edge capacities. The capacitated b -- matching problem has two known solution approaches. In the first one [29, Theorem 32.2, page 564], the matching polytope is defined by where the set constraints are for every subset U and every subset F of the cut defined by U. yij ≤ bi X X j:(i,j)∈E yij ≤ cij (i,j)∈E:i,j∈U yij ≥ 0 yij + X (i,j)∈F yij ≤ 1 2 kUkb + X (i,j)∈F cij ∀i ∈ V ∀(i, j) ∈ E  ∀U ⊆ V, F ⊆ {(i, j)i ∈ U, j 6∈ U} and kUkb +P ∀(i, j) ∈ E (i,j)∈F cijis odd (LP2) Expressing the dual of LP2 is already nontrivial, let alone any combinatorial manipulation. The second approach corresponds to compressed representations introduced in [14], see also [29, Theorem 32.4,page 567]. It corresponds to subdividing each edge e = (i, j) to introduce two new vertices pei and pej and creating three edges, where bpei = cij as shown in the example below. There are no capacities on edges but we are constrained to always saturate the newly created vertices pei, pej for every edge (i, j), i.e., yipei + ypeipej = cij and ypej j + ypeipej = cij 3 i c=3 4 j c=2 3 u 3 i 3 3 4 j 2 2 3 u pij,i pij,j pju,j pju,u Observe that the equality rules out simply scaling the vector y by a constant smaller than 1. The all-zero vector 0 is not even in the polytope! Even though the polytope is convex, the lack of closure under affine transformations makes it unwieldy for most known techniques that produce fast approximate solutions. The transformation creates unusual difficulties for approaches that are not based on linear programming as well, see [21]. New ideas are required to address these issues and the development of such is the goal of this paper. 1.2 Contributions The paper combines several novel structural properties of the b -- matching polytope with novel modifications of the multiplicative weights method, and uses approximation algorithms to efficiently solve the subproblems produced by the said multiplicative weights method. All three of these facets function in tandem, and the overall technical theme of the solution are independently of interest. Main Results We assume that the edges in the graph G = (V, E) are presented as a read only list h. . . , (i, j, wij), . . .i in arbitrary order where wij is the weight of the edge (i, j). The space complexity will be measured in words and we assume that the integers in the input are bounded from above by poly n to avoid bit-complexity issues. We prove the following theorems about b -- matching. 4 n < δ ≤ 1/16, Theorem 1 (Fractional b -- matching). Given any non-bipartite graph, for any 3√ we find a (1 − O(δ))-approximate (to LP1) fractional weighted b-matching using additional "work" space (space excluding the read-only input) O(n poly(δ−1, ln n)) and making T = O(δ−4(ln(1/δ)) ln n) passes over the list of edges. The running time2 is O(mT + n poly(δ−1, ln n)). Theorem 2 (Integral b -- matching). Given a fractional b-matching y for a non-bipartite graph which satisfies the constraints in the standard LP formulation and has weight W0, we find an integral b -- matching of weight at least (1 − 2δ)W0 in O(m0δ−3 ln(1/δ)) time and O(m0/δ2) space where m0 = {(i, j)yij > 0}. The computation for the capacitated b -- matching problem maintains the invariant that edge capacities are never violated at any stage of the algorithm. This yields a new approximation version of the capacitated matching problem where we exceed the vertex capacities but do not exceed the edge capacities at all and (almost) preserve the objective function. We prove: Theorem 3 (Fractional, Capacitated). Given any weighted non-bipartite graph, for any 3√ n < δ ≤ 1/16, we find a (1 − O(δ))-approximate fractional capacitated b-matching using O(mR/δ + min{B, m} poly(δ−1, ln n)) time, O(min{m, B} poly(δ−1, ln n)) additional "work" space with R = i bi. The algorithm returns a solution (i,j)∈ E wijcij ≤ 16Rβ∗,c where β∗,c is the weight of the integral maximum capacitated b -- matching. O(δ−4(ln2(1/δ)) ln n) passes over the list of edges where B =P {yij} such that the subgraph E = {(i, j)(i, j) ∈ E, yij > 0} satisfiesP The restriction onP and P at least (1− δ)P Theorem 4 (Integral, Capacitated). Given a feasible fractional solution y to the linear pro- gram referred in Theorem 3 for a non-bipartite graph such that the optimum solution is at most β∗,c (i,j)∈ E wijcij ≤ 16Rβ∗,c where E = {(i, j)yij > 0}, we find an integral b-matching of weight (i,j) wijyij − δβ∗,c in O(m0Rδ−3 ln(R/δ)) time and O(m0/δ2) space where m0 = E is the number of nontrivial edges (as defined by the linear program) in the fractional solution. As a consequence we have a (1 − O(δ))-approximate integral solution. (i,j)∈ E wijcij is explicitly used in the next theorem. Technical Themes To prove the Theorems 1 -- 4 this paper makes novel contributions towards the structure of b -- matching polytope as well as techniques for speeding up multiplicative weights methods. Multiplicative Weights Methods. We show that we can use existing constant factor approxi- mation algorithms for b -- matching to produce a (1 − δ)-approximate solution. The approximation factor surfaces in the speed of convergence of the multiplicative weights method used but the final solution produced is a (1 − δ) approximation. This provides fairly straightforward proofs for near linear time (1−δ) approximation schemes for bipartite graphs using standard multiplicative weights methods. While the results for bipartite case in this paper do not completely dominate existing results (e.g., [1]), they serve as a warmup for non-bipartite graphs. Many of the pieces which are demonstrated with relatively less complexity in the bipartite case (initial solutions, Lagrangians, etc.) are also re-used in the non-bipartite case. We then use specific structural properties of the b -- matching polytope (and perturbations, de- scribed shortly) to show that the non-bipartite b -- matching problem can be solved via a sequence of weighted bipartite b -- matching problems. The overall approach can be viewed as dual thresholding where we only focus on the large weights in the multiplicative weights method (which are candidate 2The exact exponent of δ, log n in the poly() term depends on [20, 6] and we omit further discussion in this paper. 5 dual variables) and ignore the remainder. If we modify (perturb) the b -- matching polytope then the number of constraints with large weights is small. However the choice of these constraints vary from iteration to iteration -- and our algorithm differs from the application of standard multiplicative weights techniques in this aspect. Naturally, this requires a proof that the modified approach con- verges. This is shown in Section 3 and is used to prove Theorem 1 for uncapacitated b -- matching. The framework extends to capacities helping prove Theorem 3. Polytope and Perturbations. We investigate the laminarity of the sets corresponding to the unsatisfied constraints in LP1 at the neighborhood of any infeasible primal. A collection of sets L is a laminar family if for any two sets U, U0 ∈ L, U ∩ U0 is either U, U0 or ∅. We show that if we modify the polytope by introducing a small perturbation, then the constraints corresponding to the small odd sets that are "almost maximally violated" define a laminar family. Since a laminar family has O(n) sets, this provides the small subset of constraints to the modified multiplicative weights method (note that the total number of constraints is Ω(n1/δ)). In that sense this approach generalizes the minimum odd-cut approach. λU. If δ ≤ 1 . Let λU = (P Many algorithms using the minimum odd-cut approach rely on the following fact: the sets corresponding to the nonzero variables of the optimum dual solution of LP1 define a laminar family (see Giles and Pulleyblank [16], Cook [7], Cunningham and Marsh [8], and also Schrijver [29]). However all these techniques rely on the exact optimality of the pair of primal and dual solutions. In fact, such relationships do not exist for arbitrary candidate primal or dual solutions. It is surprising that the maximally violated constraints of the perturbed polytope shows this property. This is shown in Theorem 5. are given y satisfying yii = 0 for all i and P Theorem 5. For a graph G with n vertices and any non-negative edge weights y suppose that we j:(i,j)∈E yij ≤ bi for all i. Define a perturbation of bi, bU = bkUkb/2c as bi = (1 − 4δ)bi and bU = bkUkb/2c − δ2kUk2 (i,j)∈E:i,j∈U yij)/bU b4 16 and λ ≥ 1 + 3δ, the set L1 = {U : λU ≥ λ − δ3; U ∈ Oδ} forms a and λ = maxU∈Oδ laminar family. Moreover for any x ≥ 2 we have {U : λU ≥ λ−δx; U ∈ Oδ} ≤ n3+(n/δ)1+δ(x−3)/2. In other words, if we were provided an infeasible (with respect to the perturbed polytope) primal solution {yij} then the constraints that are almost as violated as the maximum violated constraint P of the perturbed polytope (in ratio of LHS to RHS) correspond to a laminar family. Intuitively, (i,j):i,j∈U yij = λU bU and for a fixed λU, if we could ignore the floor and ceil functions, the right hand side is a concave function of kUkb. As a result if two such U1, U2 intersect at a non-singleton odd set U3 6= U1, U2 (the union U4 6= U1, U2 is also an odd set) then max{λU3, λU4} will exceed min{λU1, λU2} by δ3. Of course, the floor and ceil functions, singleton sets cannot be ignored and more details are required, and Theorem 5 is proved in Section 4. However Theorem 5, does not give us an algorithm. But the laminarity of the "almost maximally violated" constraints allow us to design an algorithm that finds these constraints (small odd sets) without the knowledge of the maximum violation. Since the laminarity guarantees that at most O(n) such sets can be found, we can compute the maximum violated constraint more efficiently than the existing algorithms. This is formalized in Theorem 6. Theorem 6. For a graph G with n vertices and {yij} and the definitions of {λU} exactly as in the statement of Theorem 5 and δ ∈ (0, 1 10; U ∈ Oδ} in O(m0 + n poly{δ−1, log n}) time using O(nδ−5) space where m0 = {(i, j)yij > 0}. 16], if λ ≥ 1+3δ we can find the set L2 = {U : λU ≥ λ− δ3 The proof of Theorem 6 combines the insights of the minimum odd-cut approach [27] along with the fact that L2 ⊆ L1 is a laminar family as proved in Theorem 5. 6 Roadmap. Theorems 5 and 6 are proved in Sections 4 and 5 respectively. We discuss the bipartite b -- matching problem in Section 2 to serve as a warmup as well as to develop pieces (such as initial solutions, etc.) that would be required to solve the non-bipartite problem. In particular we make the connection between fast constant factor approximation algorithms and the convergence of the multiplicative weights method. Section 3 which discusses perturbations and thresholding and provides a modified multiplicative weights framework which is likely of interest in other problems where we have a large number of constraints. Theorem 1 follows immediately from the application of the framework and the bipartite relaxation discussed in Section 2. Section 6 proves Theorem 2. Section 7 discusses capacitated b -- matching. 2 Approximations to speed up Multiplicative Weights Method The goal of this section is to illustrate how multiplicative weights method can be used in the context of b -- matching. We focus on the bipartite case in this section. The results obtained in this section do not always dominate the best known results for bipartite b -- matching, see for example [1]. But the main purpose of this section is to provide a simple illustration of the ideas that are required for the non-bipartite case. We use existing multiplicative weights methods (see [5] for a comprehensive review of these) and show how they apply to the bipartite b -- matching case without any modification. At the end of the section we discuss why existing techniques will not work directly in the non-bipartite case. However the different parts of the overall solution for bipartite graphs will be reused in the non-bipartite context. From the perspective of algorithms for matching problems, the multiplicative weights method provides an approach different from that of augmentation paths. Instead of maintaining a feasible solution and increasing the value of that feasible solution using augmenting paths, we maintain an infeasible solution of a certain value and reduce the infeasibility. The overall algorithm is iterative, at each point we identify parts of the graph where our solution is infeasible -- we construct a new partial solution that reduces the effect of these parts and consider a convex combination of the old and new solutions. However the new partial solution, in itself can be significantly unhelpful for the original problem! In particular the new solution will either be a matching that allows vertex i to have up to 6bi edges instead of the at most bi as specified in the problem, or have 1/6 the desired objective value (which depends both on the weight of the maximum matching as well constraints in the framework). Of course, this deviation also allows us to find the solution efficiently. However, even though each individual solution is not helpful, the average of the solutions is a (1 − O(δ)) approximation for the original problem for a small δ > 3/ √ n. 2.1 Existing Multiplicative Weights Methods Let A0 be a non-negative m × N matrix, and suppose b0 ≥ 0. Suppose that we seek to solve A0y ≤ b0, y ∈ P0 where P0 ⊆ {yy ≥ 0} is convex. The literature on Multiplicative Weights method shows that it suffices to repeatedly average y(t) corresponding to iteration t. In iteration t, given a non-negative vector u(t), the methods ask for an oracle to supply y(t) such that u(t)T A0y(t) ≤ (1 + O(δ))u(t)T b0, y(t) ∈ P0 and A0y(t) ≤ ρb0 where ρ > 1 is the width parameter. The u(t) are referred to as the Multiplicative Weights, because the vector u(t) in the expression u(t)T A0y(t) implies an assignment weights to the rows of A0 which correspond to constraints. The multiplicative weights method states that as long as we have bounded solutions A0y(t) ≤ ρb0, a (weighted) average y of y(t) satisfies A0y ≤ (1 + O(δ))b0. We note that many variations of the multiplicative weights method exist but for the purposes of this section we focus on the version in [28]. In that version the average is a predetermined weighted average and the j-th entry of u(t) corresponds to a scaled 7 j where y0 is the corresponding weighted average of y(0), . . . , y(t − 1). exponential of (A0y0)j/b0 Intuitively, if the j-th constraint is violated more, its weight would be large and the desired y(t) would prioritize satisfying the j-th constraint. Theorem 7. [28] Starting from an initial solution y(0) such that A0y(0) ≤ ρb0, after O(ρ(δ−2 + log ρ) log N) iterations we have a y ∈ P0 that satisfies A0y0 ≤ (1 + δ)b0. 2.2 Boosting Constant Factor Approximations to (1 − δ)-approximations We begin with Theorem 8 and consider its applications. Theorem 8 (Proved in Section 2.3). Let f1, f2 > 0, h ≥ 0. Let bQ ⊆ bP ⊆ {y y ≥ 0}. Suppose bP, bQ are convex and 0 ∈ bQ. Suppose we have a subroutine that for any z (which can be negative) provides a y ∈ bP such that zT y ≥ (1 − δ/2) max{zT y0 y0 ∈ bQ}.3 1. If {ywT y ≥ f1, hT y ≤ f2, y ∈ bQ} is non-empty then using O(ln 1 routine we can find a y ∈ bP such that wT y ≥ (1 − δ)f1 and hT y ≤ f2. 2. Suppose bA,bb are non-negative and b ∈ RN, let bβ = max{wT y bAy ≤ bb, y ∈ bQ}. {y/λ0 y ∈ bP} ⊆ {y bAy ≤ bb, y ∈ bQ} then we can compute y that satisfies wT y ≥ (1−δ)2bβ, bAy ≤ (1 + δ)bb and y ∈ bP using O(λ0(δ−2 + δ−1 log λ0)(log N)(log 1/δ)) invocations of the Note that if {λ0y bAy ≤ bb, y ∈ bQ} = bP for some λ0 ≥ 1, then a (1/λ0)-approximate solution to max{wT y bAy ≤ bb, y ∈ bQ} can be multiplied by λ0 to achieve the subroutine mentioned above and therefore using O((λ0(δ−2 + log λ0) log N + δ−1 log λ0) log(1/δ)) invocations we find a (fractional) y as described in (2). δ ) invocations of the sub- subroutine. If Bipartite Uncapacitated b -- matching. The problem is expressed by linear program LP3. Vari- able yij corresponds to the fraction with which (i, j) ∈ E is present in the solution. b = max X  X (i,j)∈E j:(i,j)∈E yij ≥ 0 wijyij β∗ Q : yij ≤ bi ∀i ∈ V ∀(i, j) ∈ E (LP3) Observe that negative weight edges can simply be ignored by any approximation algorithm. While many constant factor approximation algorithms for uncapacitated b -- matching exist, we use Theorem 9 which has no dependence on B =P i bi. Theorem 9. [Proved in Section 2.4] For the bipartite uncapacitated b -- matching problem we can provide a 1/6 approximation in O(m log n) time and O(n) space. We now define Q as in LP3 and set bQ = Q, {bAy ≤ bb} = Q and bP = {6yy ∈ bQ}. We multiply we obtain a non-negative (fractional) solution {yij} that satisfies P the solution provided by Theorem 9 by a factor 6 and as a consequence of the final part of Theorem 8 i ∈ V corresponding to bAy ≤ (1+ δ)bb. Dividing each yij by (1+ δ) provides us a ((1− δ)2/(1+ δ))- j:(i,j)∈E yij ≤ (1 + δ)bi for all 3While it may be appealing to discuss closure of bQ, note the (1 − δ/2) factor and therefore lim sup suffices. approximation to the optimum bipartite b -- matching solution in time O(mδ−2(log2 n)(log 2/δ)). 8 Bipartite Capacitated b -- matching. The problem is expressed as a linear program in LP4 where cij are integer capacities on the edge (i, j) ∈ E. Without loss of generality cij ≤ min{bi, bj}. β wijyij ∗,c b = max X  X (i,j)∈E j:(i,j)∈E yij ≤ cij yij ≥ 0 Qc : yij ≤ bi ∀i ∈ V ∀(i, j) ∈ E ∀(i, j) ∈ E (LP4) (LP5) Define P c as:  P c : X j:(i,j)∈E yij ≤ cij yij ≥ 0 yij ≤ λ0bi/2 ∀i ∈ V ∀(i, j) ∈ E ∀(i, j) ∈ E †,c ∗,c b /λ0. If E = {(i, j) y ij > 0} then P Theorem 10. [Proved in Section 2.4] If cij ≤ min{bi, bj} then given any weight vector w, using Theorem 9 at most k = O(log 1/δ) times we can compute a solution y†,c ∈ P c with λ0 = 16 ln 2 such that wT y†,c ≥ 2β We cannot use an arbitrary algorithm in lieu of Theorem 10 -- because we only relax a part of the rounded in near linear time (Theorem 4). We define bAy ≤ bb to be {P constraints. The final property of Theorem 10 is used to guarantee that a fractional solution can be let bQ = Qc and bP = P c for λ0 = 16 ln 2/δ. We apply Theorem 8 to get a solution which satisfies j:(i,j)∈E yij ≤ bi,∀i ∈ V } and P j:(i,j)∈E yij ≤ (1 + δ)bi for all i as well as yij ≤ cij for all (i, j) ∈ E. An appropriate scaling of the solution provides a (1 − O(δ))-approximation. Theorem 11. We can compute a fractional solution which is a (1 − δ) approximation to the optimum capacitated b -- matching in O(mδ−2(log2 n)(log2 1/δ)) time in a bipartite graph. (i,j)∈ E wijcij ≤ 8kβ ∗,c b . δ 2.3 Proof of Theorem 8 Theorem 8. Let f1, f2 > 0, h ≥ 0. Let bQ ⊆ bP ⊆ {y y ≥ 0}. Suppose bP, bQ are convex and 0 ∈ bQ. Suppose we have a subroutine that for any z (which can be negative) provides a y ∈ bP such that zT y ≥ (1 − δ/2) max{zT y0 y0 ∈ bQ}. 1. If {ywT y ≥ f1, hT y ≤ f2, y ∈ bQ} is non-empty then using O(ln 1 routine we can find a y ∈ bP such that wT y ≥ (1 − δ)f1 and hT y ≤ f2. 2. Suppose bA,bb are non-negative and b ∈ RN, let bβ = max{wT y bAy ≤ bb, y ∈ bQ}. {y/λ0 y ∈ bP} ⊆ {y bAy ≤ bb, y ∈ bQ} then we can compute y that satisfies wT y ≥ (1−δ)2bβ, bAy ≤ (1 + δ)bb and y ∈ bP using O(λ0(δ−2 + δ−1 log λ0)(log N)(log 1/δ)) invocations of the Note that if {λ0y bAy ≤ bb, y ∈ bQ} = bP for some λ0 ≥ 1, then a (1/λ0)-approximate solution to max{wT y bAy ≤ bb, y ∈ bQ} can be multiplied by λ0 to achieve the subroutine mentioned above and therefore using O((λ0(δ−2 + log λ0) log N + δ−1 log λ0) log(1/δ)) invocations we find a (fractional) y as described in part (2). δ ) invocations of the sub- subroutine. If 9 Proof: Define g() = max{(wT − hT )y y ∈ bQ}. Since {ywT y ≥ f1, hT y ≤ f2, y ∈ bQ} is non-empty, g() exists and is at least f1 − f2. Let L(y, ) = (wT − hT )y and let y be the solution returned by the subroutine for z = wT − hT . For  = 0, the returned solution y0 satisfies L(y0, 0) = (wT − hT )y0 ≥ (1 − δ/2)g(0) = (1− δ/2)(f1 − f2). This implies wT y0 ≥ (1− δ/2)f1. If y0 also satisfies hT y0 ≤ f2, then y0 is our Consider  = f1/f2 and set y = 0. Note we do not run the subroutine. Note y ∈ bP and desired solution for the first part of the theorem. We therefore consider the case hT y0 > f2. f2 f2) = (1 − δ/2)(f1 − f2) hT y = 0 ≤ f2 and L(y, ) = (wT − hT )y = 0 ≥ (1 − δ/2)(f1 − f1 Therefore over the endpoints of the interval  ∈ [0, f1/f2] = [−, +] we have two solutions y− , y+ that satisfy (1) L(y− (2) L(y+ , −) ≥ (1 − δ/2)(f1 − −f2), hT y− > f2 , +) ≥ (1 − δ/2)(f1 − +f2), hT y+ ≤ f2 Now consider running the subroutine for  = 1 2(− + +). Again based on the subroutine we know that we will obtain a solution y which satisfies: L(y, ) = (wT − hT )y ≥ (1 − δ/2)g() ≥ (1 − δ/2)(f1 − f2) If hT y > f2 then we focus on [, +]. Otherwise we focus on [−, ]. Observe that we are maintaining the invariants (1) and (2). Now we use binary search to find +, − such that 0 ≤ , a ∈ [0, 1] such that hT y = f2. Since y+, y− ∈ bP, their linear combination + − − ≤ δf1 δ ) invocations of the subroutine. We take a linear combination y is also in bP. Note that y = ay+ + (1 − a)y− 2f2 . This requires O(ln 2 , +) + (1 − a)L(y− aL(y+ ≥ (1 − δ)f1 − −f2 , −) ≥ (1 − δ/2)f1 − (1 − δ/2)−f2 − a(1 − δ/2)(+ − −)f2 because a ≤ 1, + − − ≤ δf1 2f2 and f2 ≥ 0. Thus wT y = aL(y+ , +) + (1 − a)L(y− , −) + a+hT y+ + (1 − a)−hT y− ≥ (1 − δ)f1 − −f2 + a(+ − −)hT y+ + hT (a−y+ + (1 − a)−y−) ≥ (1 − δ)f1 − −f2 + hT (a−y+ + (1 − a)−y−) ≥ (1 − δ)f1 − −f2 + hT −y (Using y = ay+ + (1 − a)y−) ≥ (1 − δ)f1 − −(f2 − hT y) = (1 − δ)f1 (Since hT y = f2 by construction) (Using hT y+ ≥ 0 and + − − ≥ 0) an initial solution. Observe that the width is λ0 by construction. We can now apply Theorem 7. For the second part, observe that setting z = w we get a y(0) ∈ bP such that zT y(0) ≥ (1 − δ)bβ The first part of the theorem follows. Note that hT y ≤ f2 from the case hT y0 ≤ f2. using the subroutine. Moreover zT y(0) ≤ λ0bβ since y(0)/λ0 ∈ {ybAy ≤ bb, y ∈ bQ}. This provides If 0 < β ≤ bβ we get a solution for y ∈ bP that satisfies wT y ≥ (1 − δ)β and u(t)TbAy ≤ u(t)Tbb from the first part of the theorem setting f1 = β, f2 = u(t)Tbb. If we fail to find a solution to the β at most O(δ−1 log λ0) times and eventually we would reach (1 − δ)bβ ≤ β ≤ bβ since the initial first part for some β then we decrease β by a factor of (1 − δ). Observe that we would decrease β = wT y(0) is at most λ0β. Note wT y ≥ (1 − δ)β ≥ (1 − δ2)bβ. Observe that the iterations for larger β remain valid for a smaller β. Therefore if we classify the iterations according to (a) decrease of β because we did not find a solution for for the first part and 10 (b) invocations where we succeed in finding a solution for the first part. The number corresponding to (a) is at most O(δ−1 log λ0) (decreases of β) times O((log1/δ)), the multiplier due to the reduc- tion. The number corresponding to (b) cannot be more than O(λ0(δ−2 + log λ0) log N)(log(1/δ)) because then we would have already gotten a better solution based on Theorem 7 -- once again, because the y found for larger β remain valid for a smaller β. The total number of invocations of the subroutine is O((λ0(δ−2 + log λ0) log N + δ−1 log λ0) log(1/δ)). The second part of the theorem follows. satisfying bAy0 ≤ bb, y0 ∈ Q. The claim follows from the second part. For the final remark, a λ0 approximation implies that we have a feasible solution solution y0 (cid:3) 2.4 Proofs of Theorem 9 and 10 In this section we provide primal-dual approximation algorithms for both uncapacitated and ca- pacitated b -- matching. The capacities bi, cij, for vertices and edges respectively are integral. Each edge (i, j) has weight wij. In the uncapacitated case the edge constraints are not present; one can model that by setting cij = min{bi, bj} for every edge (i, j). The formulation LP4 expresses ∗,c b ≥ β∗,c (the maximum a bipartite relaxation which omits non-bipartite constraints. Therefore β ∗,c b ≥ β∗ (the maximum uncapacitated b -- matching, assuming capacitated b-matching) as well as β cij = min{bi, bj} for every edge (i, j)). The system LP6 is the dual of LP4. b = minX ∗,c β i pi + X (i,j)∈E qij ≥ wij ∀(i, j) ∈ E + pj bj + qij cij pi bi pi, qij ≥ 0 ∀i,∀(i, j) ∈ E (LP6) β ∗,c b = max X X (i,j)∈E yij ≤ 1 1 bi 1 cij yij ≥ 0 j:(i,j)∈E yij ≤ 1 ∀(i, j) ∈ E ∀(i, j) ∈ E wijyij ∀i (LP4) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Algorithm 1 satisfies the following invariants; and the next lemma is the core of the proof. (I1) We maintain a feasible primal solution {yij}. (I2) If we insert an edge into the solution yij = cij (but some copies of this edge can be deleted later). (I3) Once an edge is processed (ignored or inserted) we ensure that pi bi (I4) We ensure that {pi, qij} are non-decreasing and therefore the final {pi, qij} satisfies the con- + qij cij + pj bj ≥ wij. straints of LP6, andP i pi +P (I5) At the end of step 3(e), we have the invariant pi ≥ 2P Lemma 12. Let ∆ be the decrease inP (i,j) qij ≥ β the edge (i, j) is added in Step 3(e). ∆ ≤ wijcij/2. ∗,c b . j wijyij. (i,j) wijyij in Steps 3(c) and 3(d) due to the deletions before 11 Algorithm 1 A near linear time algorithm for capacitated b -- matching 1: We start with all pi = 0. Initially the graph is empty and all yij = qij = 0. In the following yij = yji, the variables are defined on the edges. 2: Order the edges E according to an arbitrary ordering and consider the edges one by one. 3: for each new edge e = (i, j) do + pj bj ≥ wij then ignore the edge, otherwise: (a) If pi bi (b) We will be eventually inserting cij copies of the edge (i, j). Recall for the uncapacitated case cij = min{bi, bj}. j yij > bi. In that case we need to delete (P (c) Suppose that cij +P when we add the cij copies of (i, j) the vertex constraintP delete xi = max{0,P (d) Likewise we delete the xj = max{0,P (e) Set yij = cij, (if required) increase pi, pj to be at least 2P wij0 with yij0 > 0. amongst yi0j > 0. j wijyij, 2P j0 yij0 − bi + cij) edges such that j0 yij0 ≤ bi will be satisfied. Therefore we j0 yij0 − bi + cij} edges incident to i -- but we delete the edges with the lowest i0 yi0j − bj + cij} edges incident to j, with the lowest wi0j i wijyij respectively. Set qij = wijcij. 4: Output {(i, j)yij > 0} and {pi},{qij}. bi−cijP P bi j0 yij0 P j0 wij0yij0 since P P j0 wij0yij0. But since 2P Proof: Suppose we deleted edges at i for Step 3(c) and xi > 0. Note that we retained the heaviest bi − cij edges and therefore the total retained edges have weight at least j0 wij0yij0 which is at least bi−cij j0 yij0 ≤ bi because {yij0} are feasible. Thus the total weight j0 wij0yij0 ≤ pi at Step 3(e) in the iteration deleted at i is at most cij bi . Using the same reasoning before (i, j) was considered, the total weight deleted at i is at most cij pi 2bi which is at most at j, the the total weight deleted by (i, j) at both i, j is at most cij pi 2bi (cid:3) cijwij/2 since we are past Step 3(a). uncapacitated b-matching. This because the net direct increase toP Note that we now immediately have a factor 1/10 approximation for both capacitated and (i,j) qij due to inserting Combined with Lemma 12 we have a 1/10 approximation because the total increase in P (i, j) is at most 5wijcij. At each of the endpoints i, j the increase is 2wijcij and qij ≤ cijwij. P i pi + (i,j) qij due to (i, j) is the direct increase from (i, j) plus the increase due to all edges deleted by i pi +P all such recursively deleted edges is at most wijcij. Therefore 10P (i, j) (and the edges which have been recursively deleted). But using Lemma 12 the total weight of (i,j) qij ≥ ∗,c . For the remainder of the paper any absolute constant approximation suffices. However since β b the approximation factor relates to the speed of convergence, we provide a slightly better analysis, and space complexity. (i,j) wijyij ≥P i pi +P + cij pj 2bj Theorem 9. For the bipartite uncapacitated b -- matching problem we can provide a 1/6 approx- (i,j) wijyij ≥ P to 1/8. We then prove 6P imation in O(m log n) time and O(n) space. Proof: We first observe that qij = 0 for every edge (i, j) which already improves the approximation . In the uncapacitated this case cij = min{bi, bj} and the edge (i, j) is inserted with yij = cij. Therefore both pi, pj ≥ 2cijwij ≥ wij which implies due to Step 3(e). Therefore at least one of pi/bi, pj/bj is 2wij. Thus pi bi qij = 0. This also means that at each insertion at least one vertex has exactly one edge (but possibly multiple copies of it) and therefore the total number of edges in the solution is O(n). We i pi is at most 4wijcij − 2∆ (recall ∆ is defined in now observe that the increase in Step 3(e) of P i pi +P (i,j) qij ≥ β + pj bj ∗,c b 12 Lemma 12). Suppose that we maintained 6P (i,j) wijyij ≥P in Steps 3(c) and 3(d). Then the left hand side increased by 6wijcij − 6∆ but i pi before we considered the deletions 6wijcij − 6∆ = (4wijcij − 2∆) + (2wijcij − 4∆) i pi. Therefore the invariant continues to hold and the theorem follows. (i,j) wijyij after Step 3(e) is more than the (cid:3) Theorem 13. We can solve the capacitated b -- matching problem to an approximation factor 1/8 in time O(m log n). If E0 is the set of edges (i, j) such that yij > 0 at any point of time in the and ∆ ≤ wijcij/2. This implies that the increase in 6P increase inP algorithm then P 8P (i,j) wijyij ≥ P (i,j)∈E0 wijcij ≤ 8β i pi +P ∗,c b . Proof: Unlike the proof of Theorem 9 we cannot assert qij = 0. But observe that if we maintained (i,j) qij, then the increase to the left hand side is 8wijcij − 8∆ (again following the definition of ∆ from Lemma 12) and the increase to the right hand side is 4wijcij − 2∆ + wijcij (the addition is due to qij). But 8wijcij − 8∆ = 4wijcij − 2∆ + wijcij + 3 (wijcij − 2∆) ≥ 4wijcij − 2∆ + wijcij P (i,j)∈E0 wijcij = P Therefore the invariant continues to hold after Step 3(e). For the second part, observe that (i,j) wijyij and {yij} are feasible. Therefore the (cid:3) (i,j) qij but P (i,j) qij ≤ 8P wijyij ≥ ∗,c b β (cid:18) 1 − δ 2 (cid:19) 8 ln 2 δ X X (i,j)∈E j:(i,j)∈E yij ≤ cij yij ≥ 0 theorem follows. We use Theorem 13 to prove Theorem 10. satisfies Theorem 10. Using Algorithm 1 at most k ≤ 8 ln 2 (cid:19) (cid:18) δ times we get an integral solution that yij ≤ bi ∀i (LP7) Moreover if E = {(i, j) ∈ Eyij > 0} then P 0 we can find a solution y(1) such that P ∀(i, j) ∈ E ∀(i, j) ∈ E (i,j)∈ E wijcij ≤ (8k) β (i,j) wijyij(1) = τ1 ≥ β ∗,c b . Theorem 13. Proof: We reuse the notation y(t) since we would be using an iterative algorithm. For any bi, cij ≥ ∗,c b /8 using Algorithm 1 and . We now run an iterative procedure where we remove the edges (i, j) corresponding to yij(1) > 0 and decrease the corresponding capacities. The decrease in capacities corresponds to modifying LP4 by adding the constraint yij ≤ max{0, cij − yij(1)}. Let optimum solution of LP4 on this modified graph be denoted by β(2). We have Define β(1) = β ∗,c b β(1) − τ1 ≤ β(2) ≤ β(1) Consider the optimum solution of LP4 on the unmodified graph. Let that solution be {y∗ P ij = max{y∗ Consider y0 i,j wijyij ≥ β(1) − τ1. Equation (1) follows. (1) ij}. ij} is a feasible solution of the modified LP4 and β(2) ≤ β(1) follows from the fact that capacities are decreased and ij − yij(1), 0}. Then {y0 13 (i,j) wijyij(2) = τ2 ≥ β(2)/8. We now repeat the process by modifying LP4 to yij ≤ max{0, cij − yij(1) − yij(2)}. Proceeding in this fashion we δe or we have no further edges to pick. Observe, that obtain solutions {yij(')}k '=1 yij(') ≤ cij for all (i, j) and therefore the union of these k solutions satisfies j yij(') ≤ bi and therefore for the union of these k Now we obtain a solution y(2) such that P by constructionPk '=1 where k ≤ d8 ln 2 yij ≤ cij. Moreover for every ' we have P (cid:18) 1 −(cid:16) 7 P We now claim that Pk (i,j) wijyij(') ≥ (cid:17)k−1(cid:19) β(2). Thus: (cid:18) 1 −(cid:16) 7 P Pk case follows from τ1 ≥ β(1)/8. In the inductive case, applying the hypothesis on 2, . . . , k we get (i,j) wijyij(') ≥ (cid:19)k−1! (cid:18)7 X kX (cid:17)k(cid:19) β(1) by induction on k. The base solutions the vertex constraints hold as described in the statement of Theorem 10. (cid:19)k−1! (cid:19)k−1 '=1 '=2 8 8 β(2) ≥ τ1+ 1 − ( β(1)−τ1) = β(1)− β(1) wijyij(') ≥ τ1+ 1 − 8 '=1 (i,j) (cid:18)7 8 (cid:18)7 8 (cid:19)k−1 (cid:18)7 8 +τ1 and the claim follows since τ1 ≥ β(1)/8. The first part of the theorem follows. For the second (cid:3) part, Theorem 13 was applied k times and the result follows. 3 Perturbations, Thresholding, and Non-bipartite b -- matching approximate solution for max{wT y bAy ≤ bb, y ∈ bQ}, by repeatedly, for any z finding a solution We considered the bipartite case in Section 2. We provided an algorithm that produces an (1− δ)2- y ∈ bP such that zT y ≥ (1−δ/2) max{zT y0 y0 ∈ bQ} (we omit the connections between bQ, bP for the for each constraint/row of matrix bA. For the bipartite case, the number of constraints was n for the moment). However that algorithm relied on the Theorem 7 which computes a multiplicative weight uncapacitated case and n + m for the capacitated case for a graph with n vertices and m edges. In this section we consider non-bipartite matching -- the number of constraints are exponential. The number of constraints can be reduced to nΩ(1/δ) to seek a (1 − δ) approximation, but computing the multiplicative weights for all rows of the constraint matrix is infeasible for a near linear time algorithm. We now provide a framework that bypasses the computation of the weights for all rows in Section 3.1. We then apply the framework to uncapacitated b -- matching in Section 3.2. 3.1 A Dual Thresholding Framework Suppose that Q ⊆ P ⊆ {y y ≥ 0}. Suppose further that P,Q are convex and 0 ∈ bQ. The overall goal in this section to solve max{wT y Ay ≤ b, y ∈ Q}, by repeatedly, for any z finding a solution y ∈ P such that zT y ≥ (1 − δ/2) max{zT y0 y0 ∈ Q}. However, we would like to achieve the reduction by only evaluating the multiplicative weights for the constraints L which are close to the maximum violated constraint. Note that this set L would change every iteration. We achieve this by perturbing the constraints and focusing on Ay ≤ b. We present the basic Algorithm 2. The proof of convergence is provided in Theorem 16. The theorem follows from Lemma 15 which computes the rate of monotonic decrease of a potential function (Definition 4). Lemma 14 demonstrates how the ideas in Section 2 are used as critical pieces of Algorithm 2. The remainder of this section uses the notation introduced in Algorithm 2. P Definition 4. Extend u as u' = exp(αλ')/b' for all ' in Line 11 of Algorithm 2. Define Ψ = ' eλ'α = uT b which only depends on the current solution. 14 Algorithm 2 A Dual Thresholding Multiplicative Weights Algorithm. M (cid:29) m (cid:29) K ≥ 1. 1: Let P,Q be convex with Q ⊆ P ⊆ {y ≥ 0}. Let A is nonnegative matrix of dimension M × m. 16]. Let λ0, K, f(δ), α be parameters. λ0 ≥ 1, f(δ) < δ, α ≤ 1 2: Fix δ ∈ (0, 1 3: Find an initial solution y0 ∈ P with wT y = β0 and Ay0 ≤ λ0b. Set β = β0. 4: Let  = 1 5: Start a superphase corresponding to  = 1 8. The algorithm proceeds in superphases corresponding to a fixed value of . We will be decreasing . The algorithm ends when λ ≤ 1 + 8δ. We will not assume λ decreases monotonically. f(δ) ln(cid:0) M λ0 8 (note  ≥ δ) and t = 0. (cid:1). δ 6: while true do 7: 8: 9: 10: Define λ' = (Ay)'/b' and λ = max' λ'. Find L = {'λ' ≥ λ − f(δ)}, assert L ≤ K. If (λ ≤ 1 + 8δ) output y which satisfies wT y ≥ (1 − δ)β and Ay ≤ (1 + 8δ)b and stop. If λ < 1 + 8 then declare the current superphase to be over. Repeatedly set  ← max{2/3, δ} till λ > 1 + 8 and start a new superphase corresponding to this new . Define u(L) as u(L)' = exp(αλ')/b' if ' ∈ L and 0 otherwise. Let γ = u(L)T b. Using O(ln 2 δ/2) max{zT yy ∈ Q}, to find a solution y of LP8, otherwise decrease β ← (1 − δ)β. δ ) invocations of a subroutine that for any z finds a y ∈ P such that zT y ≥ (1 − 11: 12: wT y ≥ (1 − δ)β, u(L)T Ay ≤ γ 1 − δ , y ∈ P (LP8) Set y ← (1 − σ)y + σy where σ = /(4αλ0). 13: 14: end while λ0 . If β = max{wT y u(L)T Ay ≤ γ Lemma 14. Suppose Ψ ≤ γ + δγ 1−δ , y ∈ Q} exists then we have an algorithm for Line 12 of Algorithm 2 for any β < β. Further the final output of Algorithm 2 satisfies wT y ≥ (1 − δ) min{(1 − δ)2 β, β0}. Ay ≤ b. Part (1) of Theorem 8 applies with bP = P and bQ = Q and we succeed in solving LP8. Proof: The assumption implies that u(L)T Ay ≤ uT Ay ≤ uT b = Ψ ≤ γ/(1− δ) for any y satisfying This implies that β cannot decrease below (1 − δ) β; the last decrease of β corresponds to a value greater than β. (cid:3) For α = 1 (cid:17) we satisfy the precondition of Lemma 14 because f(δ) ln(cid:16) M λ0 Ψ − u(L)T b = uT b − u(L)T b = X δ exp(αλ') ≤ δ λ0 eαλ ≤ δ λ0 u(L)T b = δγ λ0 ':λ'<λ−f(δ) However we include the condition in the statements of Lemma 15 and Theorem 16 because in the specific case of b -- matching we would use a value of α which is better by a factor of 1/δ -- therefore we can use Lemma 15 and Theorem 16 without any change. A smaller value of α will result in faster convergence. Lemma 15. Suppose Ψ ≤ γ + δγ/λ0. Let Ψ0 be the new potential corresponding to the new y computed in Step 13. Then if λ ≥ 4 and  = 1/8 then Ψ0 ≤ (1 − λ 128λ0 )Ψ otherwise we have Ψ0 ≤ (1 − 2 Proof: Observe that the algorithm maintains the invariant λ ≥ 1 + 8, even though λ may not be monotone. After the update, let the new current solution be denoted by y00, i.e., y00 = (1− σ)y+ σy where y is the solution of LP8. Recall ασ = /(4λ0). Let 8λ0 )Ψ. λ00 ' = (Ay00)' /b', and λ' = (Ay)' /b' therefore λ00 ' = (1 − σ)λ' + σλ' ∀' 15 uT Ay. Observe that P ' eαλ'λ' = P ' (cid:16)b'u' (cid:17) (Ay)'b' = uT Ay. Likewise P ' eαλ'λ' = P ' (cid:16)b'u' (cid:17) (Ay)'b' = 2 eαλ00 (cid:17) 2 σαλ'eαλ' eαλ00 ' ≤ eαλ' which implies that σαλ'eαλ' −(cid:16)1 −  (cid:17) (cid:19) 2 σα(λ' + λ') (cid:17) ' ≤ Ψ +(cid:16)1 +  (cid:17) 4; we have ea+∆ ≤ ea(1 + ∆ + ∆/2). Therefore: (cid:17) = eαλ' +(cid:16)1 +  eαλ' λ' −(cid:16)1 −  X σαuT Ay −(cid:16)1 −  (cid:17) Since y ∈ P we have λ' ≤ λ0 from Step 2 of Algorithm 2. Since we repeatedly take convex combination of the current candidate solution y with a y ∈ P, and the initial solution satisfies λ ≤ λ0; we have λ' ≤ λ0 throughout the algorithm. Since λ' ≤ λ0 we have all ασ(λ' − λ') ≤ /4. Now for ∆ ≤  4 ≤ 1 (cid:18) 1 + σα(λ' − λ') + 1 Ψ0 =X = Ψ +(cid:16)1 +  uT Ay = u(L)T Ay + X X Finally observe that since λ > 1 + 8, f(δ) ≤ δ, and γ =P  X uT Ay ≥ u(L)T Ay = X  = (λ − f(δ))γ ≥ (λ − δ)γ 1−δ, which along with λ' ≤ λ0, δ ≤ 1/16, implies: y satisfies LP8 and therefore u(L)T Ay ≤ γ + λ0 (Ψ − γ) ≤ (1 + 3δ)γ λ'eλ'α ≥ (λ − f(δ)) ':λ'>λ−f(δ) λ'eλ'α, λ'eλ'α ≤ γ 1 − δ eλ'α ≤ γ 1 − δ ':λ'<λ−f(δ) ':λ'<λ−f(δ) σαuT Ay X eαλ'λ' σα 2 σα 2 ' 2 + λ0 (3) (2) 2 ' ' ':λ'≥λ−f(δ) ':λ'≥λ−f(δ) Using Equations (2) -- (4) we have: Ψ0 ≤ Ψ − (cid:18) λ − 1 − 4δ − (λ + 4δ + 1)  γασ 2 ≥ λ/2. From the statement of the lemma, 128λ0 . Thus in the case when λ ≥ 4 and  = 1/8, Note δ ≤  ≤ 1/8. If λ ≥ 4 then λ − 1 − 4δ − (λ+4δ+1) Ψ ≤ 2γ. Note that if λ ≥ 4 and  = 1 (cid:19) (cid:18) (cid:17) − (1 + 4δ)(cid:16)1 +  Combining with Equation (5) we get Ψ0 ≤ Ψ − σαγ ≤ Ψ(cid:0)1 − ασ 2 (cid:18) 8 then λασ 4 = λ 2 ≤ Ψ ≥ (1 + 8)(cid:16)1 −  Otherwise using λ ≥ 1 + 8, λ − 1 − 4δ − (λ + 4δ + 1)  Ψ0 ≤ Ψ − λασγ 1 − λασ 4 ≤ Ψ 2 2 2 (cid:19) 1 − λ 128λ0 Lemma 15 proves that Ψ decreases monotonically, even though λ may not. Theorem 16. Suppose Ψ ≤ γ+δγ/λ0. Algorithm 2 converges within τ = O invocations of LP8 and provides a solution as described in line 8. (cid:17) ≥ 7 − 4δ − (42 + 2δ) ≥  (cid:1) = Ψ(1 − 2 (cid:16) 8λ0 ). (cid:16) ln(2K) 2 (cid:3) (cid:17)(cid:17) λ0 δ2 + α δ + α ln λ0 eλ'α (cid:19) (4) (5) 16 Proof: Observe that eαλ ≤ γ ≤ Keαλ since there are at most K constraints in L. Since γ ≤ Ψ ≤ 2γ we know that eαλ ≤ Ψ ≤ 2Keαλ. We partition the number of iterations into three parts: (C1) The number of iterations till we observe λ < 4 for the first time. (C2) The number of iterations after we observe λ < 4 for the first time till λ < 2 for the first time. (C3) The number of iterations since λ < 2 for the first time. Observe (C1) and (C2) correspond to the first superphase during which  = 1 8. In case (C1), consider the total number of iterations when 4 ≤ 2j ≤ λ ≤ 2j+1. The potential Ψ must be below 2Keα2j+1. If we perform r updates to y then the potential decreased by at least (1 − 2j−5/λ0)r but if r ≥ λ0 2j−5 (ln(2K) + 2j+1α) then the new potential will be below 1, which is impossible since the potential must be at least e4α. Therefore the total number of updates corresponding to 4 ≤ 2j ≤ λ ≤ 2j+1 for a fixed j is at most 128λ02−j ln(2K) + 256λ0α. Summed over all j ≥ 2 the number of updates in case (C1) is O(λ0 ln(2K) + λ0α ln λ0). In case (C2), the potential decreases by a factor (1 − 1/(512λ0)). By the same exact argument as in case (C1), if the number of updates exceed 512λ0(ln(2K) + 4α) then the potential would be below 1, which again is impossible since the potential must be at least e2α. Therefore the number of updates in this case is O(λ0(ln(2K) + α)). In case (C3), we partition a superphase into a number of different phases. Definition 5. A phase starts when a superphase starts, and we remember the λ value at the start of a phase. Let the value of λ at the start of phase t be λt. If at some point of time during phase t, we observe λ < (1 − δ)λt, then we mark the end of phase t and start phase t + 1 with λt+1 = λ. A phase also ends when λ < 1 + 8 because the corresponding superphase ends as well. (cid:18) Note that while λ is not monotone, λt are monotone and we will use λt to bound the number of iterations. Since in each phase λ decreases by at least (1 − δ) factor the number of phases in the superphase corresponding to  is O δ ). In each of these phases (say in phase t) we have eα(1−δ)λt ≤ Ψ ≤ 2Keαλt and Ψ decreases by a factor (1 − 2/(8λ0)). Note that if Ψ decreases by a factor of 2Keδαλt then the phase would be over. Therefore the number of updates 2 (ln(2K) + 2δα) using λt ≤ 2 -- note λt decreases monotonically. Therefore in a phase is at most 4λ0 the number of updates in a superphase corresponding to an  is log 1 (1−δ) (1+12) (1+8) (cid:19) = O( 4 4 δ 4λ0 2 (ln(2K) + 2δα) = 16λ0 δ ln(2K) + 48αλ0  (6) However note that  decreases by a factor of at least 2/3 (unless it is close to δ) and the terms in Equation (6) define a geometric series each and the smallest two values of  dominate because we may have  = 1.01δ followed by  = δ. Therefore the total number of updates in this case is O(λ0( ln(2K) δ +α ln λ0)). The bound on the number of non-zero edges follows from multiplying the number of updates by the number of nonzero entries guaranteed by LP8 which is O(n0). This proves Theorem 16. (cid:3) Note that λt and its monotonicity was used in (C3), even though λ need not be monotone. δ )). Summing up the three cases, the number of updates is O(λ0( ln(2K) δ2 + α δ2 + α 17 3.2 Applying Algorithm 2 to Uncapacitated b -- matching X Ay ≤ b,Q and P are defined below: X ∀i ∈ V where bi = (1 − 4δ)bi ∀U ∈ Oδ where bU =(cid:16)jkUkb {Ay ≤ b} = yij ≤ bU yij ≤ bi i:(i,j)∈E k − δ2kUk2 b4 (cid:17) 2    Q = P = (i,j)∈E:i,j∈U X X j:(i,j)∈E yij ≥ 0 j:(i,j)∈E yij ≥ 0 yij ≤ bi ∀i ∈ V ∀(i, j) ∈ E yij ≤ λ0bi/2 ∀i ∈ V ∀(i, j) ∈ E Note the number of constraints in Ay ≤ b is M = nO(1/δ) (cid:29) m, the number of edges. We observe that {y/λ0 y ∈ P} ⊆ {y , Ay ≤ b,Q} for δ ≤ 1/16. Definition 6. Let β = {wT y Ay ≤ b, y ∈ Q}; note β exists. We can now apply Lemma 14 and Theorem 16 and obtain a solution wT y ≥ (1 − δ)2 β and Ay ≤ (1 + 8δ)b (we ignore P). We can extract a (1 − O(δ)) approximation to the optimum uncapacitated b -- matching from y. Set y corresponding to vertices and U ∈ Oδ are satisfied in LP1. For the U 6∈ Oδ, which have kUkb ≥ 1/δ observe thatX (1+8δ) yij. Since bi ≤ bi and bU ≤jkUkb2 k the constraints (cid:22)kUkb ij = (1−δ) † X X X (cid:23) † ij ≤ (1 − δ)bi y =⇒ j:(i,j)∈E (i,j)∈E,i,j∈U i∈U j:(i,j)∈E ij ≤ 1 † 2 y † ij ≤ (1 − δ)kUkb 2 ≤ y 2 At the same time wT y ≥ (1 − δ)2 β and thus wT y† ≥ (1−δ)2 β. Note that the same argument also (1+8δ) proves that if we consider the optimum solution of max{wty Ay ≤ b, y ∈ Q} and multiply by (1− δ) then we satisfy the constraints of LP1. Therefore (1− δ) β ≤ β∗. We observe β ≥ (1−4δ)β∗. The latter equation follows from Likewise consider the optimum b -- matching and multiply that solution by (1 − 4δ). That modified solution y0 satisfies Ay0 ≤ b when δ ≤ 1/16. Thus β ≥ (1 − 4δ)β∗. Therefore y† provides a (1 − O(δ))-approximation to LP1 (page 3), the uncapacitated b -- matching LP that characterizes the optimum solution. We set λ0 = 12. The initial solution is a solution of the bipartite relaxation (Theorem 9) multiplied by λ0/2 = 6. This solution value β0 will be at least β∗ b due to the approximation guarantee. But β∗ b (the bipartite optimum) which is at most 9β∗ since the gap between bipartite and non-bipartite solution is at most a factor of 1.5. But 9β∗ ≤ 1 β ≤ 12 β. This proves the bound on the initial solution. 1−4δ The parameter λ0 can be improved (e.g., it can be argued that β ≤ β∗), but that only affects the running time by a O(1) factor. Observe that an algorithm for solving LP8 is also provided by Theorem 9 and multiplying the solution by 6. We now focus on Step (7). b ≥ β, based on the constraints. On the other hand β0 can be as large as 6β∗ We set f(δ) = δ3/10. We show that in Step (7) the sparse set of constraints will be of size at most K = 2n, since that collection would define a laminar family. More specifically: 16. If λ > 1 + 8δ then we can find L = {UλU ≥ λ − δ3/10; U ∈ Oδ} Lemma 17. Let in O(m + n poly(δ−1, ln n)) time. We find L without knowing λ and once L is known, we know λ as well. n ≤ δ ≤ 1 3√ 18 P P j yij/bi} and yij = yij/λ. Let λU = Proof: Let λ = max{1, maxi(1 − 4δ)λi} = max{1, maxi NoteP λU. Observe that λU = λλU and if λ > maxi λi then λ = λλ. i,j∈U yij/bU and λ = maxU∈Oδ Suppose that λ ≤ 1+3δ and λ = 1. Then for all U we have λU = λλU ≤ λλ ≤ λ(1+3δ) < 1+8δ and maxi λi ≤ 1/(1− 4δ) ≤ 1 + 8δ for δ ∈ (0, 1 16]. This contradicts the assumption that λ > 1 + 8δ. Therefore, if λ ≤ 1 + 3δ then we must have λ > 1. Now consider the vertex i which defined λ; then j yij ≤ bi. λ ≥ λi = λ 1 − 4δ ≥ (1 + 4δ)λ ≥ (1 + 3δ)λ + δλ > λλ + δ which implies λ − δ ≥ λU for every U. In this case L = ∅ and {U : λU ≥ λ − δx; U ∈ Oδ} = 0 for x ≥ 2. Therefore the remaining case is λ > 1 + 3δ. But in this case Theorems 5 and 6 apply j yij ≤ bi. To find L, compute λ, yij and run the algorithm in Theorem 6. We (cid:3) can compute λ = {λλ, maxi λi} and return the sets satisfying λU ≥ λ − δ3/10. To compute zT = wT − u(L)T A in LP8, note that zij = wij −  corresponds to the vertices and zU correspond to the odd set in u. These weights can be computed U∈L,i,j∈U zU for each pair of vertices (i, j). Note there can be at because we satisfyP in O(1) time if we precompute theP mostPO(1/δ) (cid:17) where xi (cid:17) we get an algorithm (cid:16) xi + xj +P f(δ) ln(cid:16) M λ0 which converges in O(δ−5 log n) invocations of LP8 and provides a (1 − O(δ))-approximation. We show that α can be chosen to be smaller. Lemma 18. For 3√ 16, n ≥ λ0, α = 50δ−3 ln n and the definition of γ in Algorithm 2: n s s2 = O(nδ−2) such pairs for any L. If we use α = 1 U:i,j∈U zU s=1 δ X n ≤ δ ≤ 1 bixi + X bU = X zU eλiα + X eλU α ≤ eλαδ n ≤ δγ n < δγ λ0 i:λi≤λ−δ3/10 λU <λ−δ3/10 i:λi≤λ−δ3/10 λU <λ−δ3/10 Proof: Observe that eλα ≤ γ since λ = maxi λi or λ = maxU∈L λU. We first focus on U ∈ Oδ. Observe the U considered in the left hand side of the statement of the inequality in the Lemma can be partitioned into three classes (i) λU ≤ λ − δ2 (ii) λ − δ(x0+3)/2 ≤ λU ≤ λ − δ3/10, where x0 is the largest value of x ≥ 2 such that δ(x−3)/2 ≥ 2. Note that x0 < 3 exists4 given δ ≤ 1/16, and (iii) λ − δ2 ≤ λU < λ − δ(x0+3)/2. For case (i) observe that the corresponding eλU α ≤ eλα−δ2α ≤ eλαe−50δ−1 ln n = eαλ/n(50/δ). There are at most n1/δ such sets and thereforeP U:λU≤(1−δ2)λ eλU α ≤ eλα/n(49/δ). For case (ii), perform the same transformation as in the first two lines of Lemma 17. The bound on λU corresponds to λU ≥ (λ − δ(3+x0)/2)/λ ≥ λ − δ(3+x0)/2 since λ ≥ 1. Using Theorem 5 we know that there are at most n3 + (n/δ)1+δ(x0−3)/2 ≤ 2(n/δ)3 such sets. For each such set U, eλU α ≤ eλαe−δ3α/10 = eλαe−5 ln n = eλα/n5. Summing up over such 2(n/δ)3 sets the total contribution to the left hand side of the inequality in the statement of the lemma is at most 2eλαδ−3/n2. For case (iii), we partition the interval (λ − δ2, λ − δ(x0+3)/2] into subintervals of the form (λ − δx, λ − δ(x+3)/2] for different values of x. The last subinterval corresponds to x = x0. If we set x1 = 2x0 − 3 we have (3 + x1)/2 = x0 and thus x1 < x0 < 3, which corresponds to the second subinterval. The j-th subinterval is defined by xj satisfying 3 + xj = 2xj−1. The number of such subintervals is at most 2 + log log(1/δ). Consider the case λU ∈ (λ − δx, λ − δ(x+3)/2]. Again, performing the transformation as in the first two lines of Lemma 17, we get that λU ≥ (λ− δx)/λ ≥ λ− δx (again, λ ≥ 1). Using Theorem 5 4 Consider h = δ(x−3)/2 as x increases from 2 to 3. The value of h decreases from δ−1/2 to 1. 19 and δ ≥ 1/ √ n, the number of odd-sets corresponding to this subinterval is at most n3 + (n/δ)1+δ(x−3)/2 ≤ 2(n/δ)1+δ(x−3)/2 ≤ 2n1.5+1.5δ(x−3)/2 However note that λU ≤ λ − δ(3+x)/2 and therefore eαλU is at most eαλ eαλ eαλ/eαδ(x+3)/2 = e50δ(x−3)/2 ln n n50δ(x−3)/2 = Therefore the total contribution to the left hand side of the inequality in the statement of the lemma for all U such that λU ∈ (λ − δx, λ − δ(x+3)/2] is at most (since x ≤ x0 ): For i ∈ V such that λi ≤ λ−δ3/10 the calculation as in the case (iii) applies andP 2eαλ n48.5δ(x−3)/2−1.5 ≤ 2eαλ n97−1.5 ≤ eαλ n94 n94 18: + 4δ−3 n2 ≤ 5δ−3 n49/δ + 2+log log(1/δ) 1 2eλαδ−3/n2 as well. Since (cid:3) We can now conclude Theorem 1 based on the discussion above, Theorems 8, 16 and Lemmas 17 -- n < δ ≤ 1/16 we find a (1 − O(δ))- approximate maximum fractional weighted b-matching using additional "work" space (space exclud- ing the read-only input) O(n poly(δ−1, ln n)) and making T = O(δ−4(ln(1/δ)) ln n) passes over the list of edges. The running time is O(mT + n poly(δ−1, ln n)). Theorem 1. Given any non-bipartite graph, for any 3√ n; the lemma follows. n2 ≤ δ i:λi≤λ−δ3/10 eλiα ≤ 4 Proof of Theorem 5 Before proving Theorem 5, recall that bU = jkUkb2 k − f(kUkb) where f(') = δ2'2 (F1): For 3 ≤ kUkb ≤ 2/δ − 1 (irrespective of odd or even) we have bU ≥ (1 − δ)jkUkb2 We can verify that f(') is convex, monotonic for 0 ≤ ' ≤ 2/δ and: 4 k. and δ ∈ (0, 1 16]. (F2): For any '1, '2; f('1) + f('2) = f('1 + '2 − 1) − (2'1'2 − 2'1 − 2'2 + 1) δ2 4 . (F3): For integers '1, '2, '3, '4 ∈ [3, 2/δ] and t ≥ 0, such that '1 + 2t ≤ '2 ≤ '3 ≤ '4 − 2t and '1 + '4 = '2 + '3, we have f('2) + f('3) ≤ f('1) + f('4) − 2t2δ2. 16], define: λU = that yii = 0 for all i, P j yij ≤ bi for all i, and δ ∈ (0, 1 Theorem 5. For a graph G with n vertices and any non-negative edge weights yij = yji such and λU. If λ ≥ 1 + 3δ, the set L1 = {U : λU ≥ λ − δ3; U ∈ Oδ} defines a laminar family. λ = maxU∈Oδ Moreover for any x ≥ 2 we have {U : λU ≥ λ − δx; U ∈ Oδ} ≤ n3 + (n/δ)1+δ(x−3)/2. Proof: Consider two sets A1, A2 ∈ Oδ such that λA1, λA2 ≥ λ − δx > 1 + 2δ (since x ≥ 2) and neither A1 − A2, A2 − A1 6= ∅. For any set U (with kUkb ≥ 1, even or odd, large or small) define (i,j):i,j∈U yij and bU. For kUkb = 1 we have YU = 0. Let λU = YU /bU. There are now two YU =P Case I: kA1 ∩ A2kb is even. Let D = A1 ∩ A2 and t = kDkb/2. Let Q1 =P cut between D and A1 − A2 using the edge weights yij) and Q2 = P P j∈A1−A2 yij (the i∈D j∈A2−A1 yij. Without loss of generality, assume that Q1 ≤ Q2 (otherwise we can switch A1, A2). Let C = A1 − A2 and (i,j):i,j∈U yij cases. P i∈D bU P 20 A = A1. Let 2'−1 = kCkb which is odd. From the definitions of YC, YD we have YC = YA−Q1− YD and YD ≤ 1 . Using Q1 ≤ Q2 we get: 2 i∈D P j yij − Q1 − Q2) ≤ kDkb2 − Q1+Q2 2(P YC ≥ YA − kDkb 2 − Q1 k ≥jkAkb2 bA > (1 + 2δ)(1 − δ)jkAkb2 (cid:23) (cid:22)kCkb (cid:22)kAkb 2 + Q2 2 ≥ YA − kDkb k using Condition F1, and the lower bound on 2 = YA − t. (7) Now YA = λA λ. Therefore YA > t and YC > 0 which means kCkb ≥ 3. Therefore we can refer to bC, λC. Since kDkb = kAkb − kCkb, bA − bC = + f(kCkb) = kDkb − f(kAkb) − (cid:23) 2 − (f(kAkb) − f(kCkb)) 2 2 where the last line uses 1 and YC = λC bC, YA = λA λbC ≥ λC bC = YC ≥ YA − t = λA = t − tδ(t + 2' − 1)δ ≥ (1 − δ)t (8) δ ≥ kAkb ≥ (2t + 2' − 1) because A ∈ Oδ. From Equations (7) and (8), bA we get: bA − t ≥ (λ − δx)bA − t = λbA − δxbA − t ≥ λ(bC + (1 − δ)t) − δxbA − t > λbC + (1 + 3δ)(1 − δ)t − δxbA − t ≥ λbC + δt − δxbA λC ≤ λ Since bA ≤ 1/δ this implies that t < δx−1bA ≤ δx−2 which contradicts A1 ∩ A2 6= ∅ for x ≥ 2. Case II: kA1 ∩ A2kb is odd. Let C = A1 ∪ A2, and D = A1 ∩ A2. Let kA1kb = '1,kA2kb = '2. We prove (9) If kCkb ≤ 1/δ then Equation (9) is true by definition since λ explicitly optimizes over Oδ and C ∈ Oδ. We focus on the case kCkb > 1/δ. We extend the definitions bC =jkCkb2 since P λC = YC/bC for all odd subsets with k · kb ≤ 2/δ. Now YC ≤ kCkb2 (cid:19) kCkb = kA1kb + kA2kb − kDkb and kDkb ≥ 1. Thus kCkb ≤ 2/δ − 1 and using Condition F1: ≥ (1 − δ)2kCkb 2 k +jkA2kb2 (cid:23) (cid:22)kCkb Now, YC + YD ≥ YA1 + YA2 andjkCkb2 which implies that λC ≤ (1 − δ)−2 ≤ 1 + 3δ < λ. Thus Equation (9) holds in this case as well. (cid:18) 1 − 1 kCkb k =jkA1kb2 = (1 − δ)kCkb 2 k +jkDkb2 k − f(kCkb) and k. Therefore: j yij ≤ bi. Note that bC ≥ (1 − δ) 2 YC + YD ≥ YA1 + YA2 = λA1 bA1 + λA2 If kDkb = 1, then by Condition F3: bC = bA1 + bA2 − δ2 Equation (9), bA2 ≥ (λ − δx)(bA1 + bA2) (10) 4 (2'1'2 − 2'1 − 2'2 + 1), and using (cid:18) '1 + '2 − 2 (cid:19) λbC ≥ λC bC = YC ≥ (λ − δx)(bA1 + bA2) ≥ λ(bA1 + bA2) − δx(bA1 + bA2) ≥ λbC + δ2λ(2'1'2 − 2'1 − 2'2 + 1) − δx 4 2 since bA1 + bA2 ≤ ('1 + '2 − 2)/2. Therefore we would have a contradiction if (11) Observe that for x ≥ 3 the term 2δx−2('1 + '2 − 2) is at most 2 whereas (2'1'2 − 2'1 − 2'2 + 1) ≥ 7 since 3 ≤ '1, '2 ≤ 1 δ . Since λ > 1 we have a contradiction for kDkb = 1, x ≥ 3. λ(2'1'2 − 2'1 − 2'2 + 1) − 2δx−2('1 + '2 − 2) > 0 21 Now consider kDkb ≥ 3. Without loss of generality, kA2 − Dkb ≥ kA1 − Dkb. Let kA1 − Dkb = 2t. Using Condition F3, bC + bD ≤ bA1 + bA2 − 2t2δ2. Note λD ≤ λ, and from Equation (9) λC ≤ λ. Therefore λ bD and from Equation (10): bC + λD (cid:16)bC + bD (cid:17) ≥ λC λ(cid:0)bC + bD (cid:1) ≥ λC bC + λD bD = YC + YD ≥ λ(bA1 + bA2) − δx(bA1 + bA2) ≥ λ(bC + bD) + 2t2δ2λ − δx(bA1 + bA2) We now prove the second part. Consider L0 (12) Again, this is infeasible if x ≥ 3 since bA1 + bA2 ≤ 2/δ and λ ≥ 1. Therefore for x ≥ 3, in all cases we arrived at a contradiction to A1 ∩ A2 6= ∅. Thus we have proved that {U : λU ≥ λ− δ3; U ∈ Oδ} is a laminar family. ' = {U : λU ≥ λ − δx; U ∈ Oδ;kUkb = '}. From Case I, no two distinct sets A1, A2 ∈ L0 ' intersect when kA1 ∩ A2kb is even. From Case II for ' ≥ 5, they cannot have kDkb = 1 because (2'2 − 4' + 1) − 2(2' − 2) > 0 for ' ≥ 5. Note kA1 − Dkb = kA2 − Dkb because kA1kb = kA2kb = '. Moreover for t ≥ δ(x−3)/2 we would have 2t2δ2λ > δx(bA1 + bA2) in Equation 12. Therefore two distinct sets A1, A2 ∈ L0 ' which intersect, ' ≤ (n/δ)1+δ(x−3)/2 for ' ≥ 5 -- to cannot differ by δ(x−3)/2 or more elements. This means that L0 see this choose a maximal collection of disjoint sets in L0 '. This would be at most n. Every other set S in L0 ' has to intersect one of these sets in the maximal collection. To upper bound the number of such sets S with intersection t, we can start from a set in that maximal collection; throw out t elements in 't ways and include new elements in nt ways. Note ' ≤ 1/δ. Thus the number of such sets for a fixed t is n(n/δ)δ(x−3)/2. Observe that t ≤ 1/δ and the bound follows. Finally note L0 3 ≤ n3. Thus the total number of sets is n3 + (n/δ)1+δ(x−3)/2. The lemma follows. (cid:3) 5 Proof of Theorem 6 An Overview. We combine the insights of the minimum odd-cut approach [27] along with the fact that L2 ⊆ L1 is a laminar family as proved in Theorem 5. The algorithm picks the sets based on their sizes. Define L1(') = {UU ∈ L1,kUkb = '} and L2(') = {UU ∈ L2,kUkb = '} for ' ∈ [3, 1/δ]. Note that L1(') ⊇ L2('). Observe that it suffices to identify L2(') for different values of '. We construct an unweighted graph Gϕ(', λ) where ϕ = O(δ−4) with a new special node r(') with the following two properties: Property 1. If λ − δ3 100 < λ ≤ λ, then (i) all sets in L2(') have a cut which is of size at most κ(') and (ii) all odd sets of Gϕ(', λ) which do not contain r(') and have cut of size at most κ(') belong to L1('). Here κ(') = bϕλ(1 − δ2'2/2)c + 12' Property 2. We show in Lemma 19 that we can extend the algorithm in [27] to efficiently extract a collection ¯L(') of maximal odd-sets in Gϕ(', λ), not containing r(') and cut of size at most κ(') -- such that any such set which is not chosen must intersect with some set in the collection. Lemma 19. Given an unweighted graph G with parameter κ(') and a special node r('), in time O(n poly(κ, log n)) we can identify a collection ¯L(') of odd-sets such that (i) each U ∈ ¯L(') does not contain r(') (ii) each U ∈ ¯L(') defines a cut of size at most κ in G and (iii) every other odd set not containing r(') and with a cut less than κ(') intersects with a set in ¯L('). δ + 1 < 2ϕ. The second property follows without much difficulty from the properties of Gomory-Hu trees [17, 19] -- trees which represent all pairwise mincuts over a set of nodes. Observe that property 1 implies that we can restrict our attention to only those regions of the graph Gϕ(', λ) which have 22 cuts of size at most O(δ−4). Therefore if we are given a subset of vertices such that any partition of that vertex set induces a large cut, then either that subset is included entirely within one odd set or excluded completely. This is the notion of a Steiner Mincut which is used to compute the "partial Gomory Hu tree" -- where for some κ we represent all pairwise min cuts of value at most κ. Such representations can be computed for unweighted undirected graphs in time O(m + nκ3 log2 n) [20] (see also improvements in [6]). The graph Gϕ(', λ) is used exactly for this purpose. If we have a maximal collection ¯L(') then ¯L(') ⊆ L1(') by condition (ii) of Property 1. Due to Theorem 5, the intersection of two such sets U1, U2 ∈ L1(') will be either empty or have k · kb = ' by laminarity -- the latter implies U1 = U2. Therefore the sets in L1(') are disjoint. Any U ∈ L2(')− ¯L(') has a cut of size at most κ(') using condition (i) of Property 1 and therefore must intersect with some set in ¯L('). This is impossible because U ∈ L2(') implies U ∈ L1(') and ¯L(') ⊆ L1(') and we just argued that the sets in L1(') are disjoint! Therefore no such U exists and L2(') ⊆ ¯L('). We now have a complete algorithm: we perform a binary search over the estimate λ ∈ [1 + 3δ, 3 2 + δ2], and we can decide if there exists a set U ∈ L2(') in time O(n poly(δ−1, log n)) as we vary ', λ. This gives us λ. We now find the collection ¯L(') for each ' and compute all λU exactly (either remembering the yij of the the edges stored in Gϕ or by another pass over G). We can now return ∪'L2('). We now prove Lemma 19. 5.1 Proof Of Lemma 19 The parameter ' is not relevant to the proof and is dropped. Algorithm 3 provides the algorithm for this lemma. Lemma 19. Given an unweighted graph G with parameter κ and a special node r, in time O(n poly(κ, log n)) we can identify a collection ¯L of odd-sets such that (i) each U ∈ ¯L does not contain r (ii) each U ∈ ¯L defines a cut of size at most κ in G and (iii) every other odd set not containing r and with a cut less than κ intersects with a set in ¯L. Assign the r duplicity br = 1 ifP Algorithm 3 Algorithm: Finding a maximal collection of odd-sets 1: ¯L ← ∅. Initially G0 = G. The node r ∈ V (G). 2: repeat 3: Construct a tree T that represents all low s -- t cuts in G0 using Theorem 20. The nodes of this tree 4: T correspond to subsets of vertices of V (G0). 5: Make the vertex set containing r the root of T and orient all edges towards the root. The oriented edges represent an edge from a child to a parent. Let D(e) indicate the set of descendant subsets of an edge e (including the child subset which is the tail of the edge, but not including the parent subset which is the head of the edge). Using dynamic programming starting at the leaf, mark every edge as admissible/inadmissible based i∈V (G0) bi is odd. Otherwise let br = 2. 6: i∈S bi over the descendant subsets of that edge being odd/even respectively. P on theP (corresponding to a cut) is at most κ, (c2)P S∈D(e) P 7: Starting from the root s downwards, pick the edges e in parallel such that (c1) the weight of e i∈S bi is odd and (c3) no edge e0 on the path from e to r satisfies (c1) and (c2). Let the odd-set Ue corresponding to this edge e ∈ T be Ue = ∪S∈D(e)S. If the odd-sets found are Ue1, . . . , Uef then ¯L ← ¯L ∪ {Ue1, . . . , Uef}. Observe that the sets Ueg are mutually disjoint for 1 ≤ g ≤ f and do not contain r. g=1 Ueg with r. Observe that for any set U that does not contain r and does not intersect with any Ueg, the cut Cut(U) is unchanged. This defines the new G0. 9: Merge all vertices inSf S∈D(e) 8: 10: until no new odd set has been found in G0 11: return ¯L. Proof: First, consider the following known theorem and Lemma: 23 Theorem 20 ([6, 20]). Given a graph with n nodes and m edges (possibly with parallel edges), in time O(m) + O(nκ2) we can construct a weighted tree T that represents all min s -- t cuts in G0 of value at most κ. The nodes of this tree are subsets of vertices. The mincut of any pair of vertices that belong to the same subset (the same node in the tree T) is larger than κ and for any pair of vertices i, j belonging to different subsets (nodes in the tree T) the mincut is specified by the partition corresponding to the least weighted edge in the tree T between the two nodes that contain i and j respectively. Lemma 21 (Implicit in [27]). Suppose that for a graph G = (V, E), P i∈V bi is even. For any odd-set U in G with cut κ, there exists an edge e in the low min s-t cut tree T such that removing e from the tree results in two connected components of odd sizes and the component Ue not containing the root intersects U. In addition, the cut between Ue and rest of the graph is at most κ. Proof:(Of Lemma 21) Observe that the min u-v cut for any u ∈ U and v 6∈ U is at most κ. We provide an algorithmic proof of the existence -- this is not the algorithm to find the odd sets. Let H0 = V (G). We will maintain the three invariants that (1) kHzkb is even (2) H(z) defines a connected component in the low min s-t cut tree T and (3) Hz ∩ U 6= ∅ and Hz ∩ (V (G) − U) 6= ∅. These hold for H0. Staring from Hz until we find a desired edge e or find Hz+1 ⊂ Hz which satisfies the same invariants. This process has to stop eventually and we would have found the desired edge e. Given the invariant, there exists u ∈ Hz ∩ U and v ∈ Hz ∩(V (G)− U) such that the min u-v cut is at most κ and therefore there must exist an edge ez (corresponding to a min u -- v cut) within the component Hz such that ez separates u, v. Let the two connected sub-components of Hz defined by the removal of ez be S1 and S2. If kS1kb,kS2kb are both even, then one of them must satisfy condition (3), since kUkb is odd. This process has to stop eventually and we would have found the desired edge e. Observe that all the subcomponents of T created in this manner define even sets until we find e. If we add back all the sub-components such that we have the two components corresponding to the two sides of e, both of those components must have odd k · kb. The component not containing r defines Ue. In (cid:3) addition, the corresponding cut size is less than κ. (Continuing with Proof of Lemma 19.) All that remains to be proven is that the loop in Algorithm 3 needs to be run only a few times. Suppose after t0 repetitions Qt0 is the maximum collection of disjoint odd-sets which are attached to the remainder of T with cuts of size at most κ and we choose Ue1, . . . , Uef to be added to L in the t0 + 1st iteration. We first claim that Qt0+1 ≤ f. To see this we first map every odd-set in Qt0+1 to an edge in the tree as specified by the existence proof P in Lemma 21. This map need not be constructive -- the map is only used for this proof. Note that i bi is even, by construction, in Algorithm 3 as required in Lemma 21. Observe that this can be Now every edges e1, . . . , ef chosen in Algorithm 3 satisfy the property for all j: no edge e0 on the path from the head of ej (recall that the edges are oriented towards the root r) to r is one of the edges in our map. Because in that case we would have chosen that edge e0 instead of ej. Therefore the sets in Qt0+1 could not have mapped to any edges in the path towards r. Now, if a set in Qt0+1 mapped to an edge e0 which is a descendant of the tail of some ej (again, the edges are oriented towards r) then this set intersects with our chosen Uej which is not possible. a many to one map; i.e., several sets mapping to the same edge. Therefore any set in Qt0+1 must have mapped to the same edges in the tree; i.e., e1, . . . , ef. But then the vertex at the head of the edge belongs to the set in Qt0+1. Therefore there can be at most f such sets. This proves Qt0+1 ≤ f. 24 We next claim that Qt0+1 ≤ Qt0− f. Consider Q0 = Qt0+1 ∪{Ue1, . . . , Uef}. Q0 is a collection of disjoint odd-sets which define a cut of size κ in G after t0 repetitions. Obviously Q0 = Qt0+1+f and by the definition of Qt0, Q0 ≤ Qt0. Therefore, Qt0+1 ≤ Qt0 − f. Therefore, in the worst case, Qt0 decreases by a factor 1/2 and therefore in O(log n) iterations over this loop we would eliminate all odd-sets that define a cut of size κ in G0. (cid:3) yij bU (i,j):i,j∈U P P k − j yij ≤ bi for all i; and δ ∈ (0, 1 where bU =jkUkb2 5.2 Proof of Theorem 6 Theorem 6. For a graph G with n vertices and any non-negative edge weights yij = yji such that yii = 0 and P observe that for any U we have P and λ = maxU∈Oδ 16], define: λU = P j yij ≤ 1 2 4 ) < 3 2 /(1 − δ2 (i,j):i,j∈U yij ≤ 1 2 δ2kUk2 λU. If λ ≥ 1 + 3δ we can find the set L2 = {U : λU ≥ λ − δ3/10; U ∈ Oδ} b4 in O(m0 + n poly(δ−1, log n)) time using O(nδ−5) space where m0 = {(i, j)yij > 0}. P Proof: We first observe that L2 is a laminar family using Theorem 5 and L2 ⊆ L1. Second, i∈U bi = kUkb/2. Therefore 2 + δ2. We maintain an estimate λ of such that λ − δ3 100 < λ ≤ λ ≤ 3 λ ≤ 3 2 + δ2. This estimate can be found using binary search (as described below) We now show how to find the sets U ∈ L2 with kUkb = ', denoted by L2('). Create a graph Gϕ with pij = bϕyijc parallel edges between i and j where ϕ = 50/δ4 (this parameter can be optimized but we omit that in the interest of simplicity). This is an unweighted graph. This graph can be constructed in a single pass over {(i, j)}. We also "merge" all pairs of vertices i and j if pij exceeds 2ϕ. Moreover delete vertices i with 2ϕ/δ edges -- note that these vertices must have j yij > 1/δ and cannot participate in any odd set in Oδ. This gives us a graph Gϕ with at most O(nδ−5) edges. Now for an odd ' ∈ [3, 1/δ] and λ, create Gϕ(', λ) as follows: We begin with Gϕ. Let qi(') = j pij (because λ is large) we can add a new j pij edges between r(') and i (for all i). This gives us a graph Gϕ(', λ) bi ≥P bϕλ(1 − δ2')bic for all i. Since qi(') > (1 + δ)ϕbi >P node r(') and add qi(')−P i∈U of size O(nδ−5) edges for all '. Let κ(') = bϕλ(1 − δ2'2/2)c + 12' δ + 1 < 2ϕ. Now: (i,j):i,j∈U pij. δ 2 − 2 δ − 12' pij − κ(') i∈U qi−2P qi(') − 2 X which is positive for ϕ = 50/δ4 and ' ≥ 3. Therefore qi(') > κ('). We now show that for kUkb > 1/δ, Cut(U) > κ('). For any odd set U ∈ O with kUkb > 1/δ: qi(') − κ(') ≥ ϕλ(1 − δ2') − 1 − ϕλ(1 − δ2'2/2) − 12' − 1 = ϕλδ2'(' − 2) Define Cut(U) to be the cut induced by U in Gϕ(', λ), that is, Cut(U) =P Cut(U) − κ(') = X ≥ X ≥ ϕλ(1 − δ2')kUkb − U − ϕkUkb − ϕλ(1 − δ2'2/2) − 12' (cid:1) = ϕ(cid:0)λ(1 − δ)kUkb − λ − (1 + δ2)kUkb ≥ ϕλ(1 − δ)kUkb − ϕkUkb − ϕλ − δ2ϕkUkb (cid:19) (cid:18) (cid:19) 2 − δ2 − (1 + δ2)kUkb 2(1 − 2δ) − 3 (1 + 3δ)(1 − δ)kUkb − 3 2δ(1 − 2δ)kUkb − 3 2 − δ2 yij − ϕλ(1 − δ2'2/2) − 12' (Since 1 + 3δ ≤ λ ≤ λ ≤ 3 (ϕλ(1 − δ2')bi − 1) − 2ϕ (SinceP 2 − δ2 (Since ' ≤ 1/δ and δ2ϕkUkb > U + 12' (Since δkUkb > 1) X (cid:18) (cid:18) (i,j):i,j∈U (i,j):i,j∈U ≥ ϕ i∈U i∈U − 1 δ − 1 δ > ϕ (cid:19) > 0 (i,j):i,j∈U yij ≤ kUkb/2) δ + 1) 2 + δ2) > ϕ 25 where the last inequality follows δ ∈ (0, 1 Cut(U) ≤ κ('). 16]. Therefore no odd-set with kUkb > 1/δ satisfies 100 < λ ≤ λ, then (i) all sets in L2(') have a cut which is at most κ(') and (ii) all odd sets of Gϕ(', λ) which do not contain s and have cut at most κ(') belong to L1('). For part (i) for a set U ∈ L2(') with kUkb = ', note U ≤ kUkb = ' and: We now show Property 1, namely: If λ− δ3 Cut(U) = X qi − 2 X pij ≤X i∈U (i,j):i,j∈U X yij + U2 (cid:18) λ − δ3 100 − δ3 10 (cid:19) bU + '2 ϕλ(1 − δ2')bi − 2ϕ i∈U (i,j):i,j∈U bU + '2 ≤ ϕλ(1 − δ2')kUkb − 2ϕ + '2 = ϕλ(1 − δ2'2/2) + 11bU (since bU < kUkb = ' ≤ 1/δ) δ + '2 ! i∈U i∈U i∈U ! ≥ 1 2 qi − Cut(U0) X (cid:0)ϕλ(1 − δ2')bi − 1(cid:1) − κ(') X X ! (cid:0)ϕλ(1 − δ2')bi − 1(cid:1) − ϕλ(1 − δ2'2/2) (cid:18)(cid:22)kUkb (cid:23) ≥ ϕλ = ϕλbU + ϕλδ2 λU = ϕP 4 bU ≥ ϕλbU + ϕλδ2 4 − δ2kUk2 + ϕλδ2 4 (kUkb − ')2 − U 2 − 12' (i,j):i,j∈U yij ≥P (i,j):i,j∈U pij we have − 12' − 1 (kUkb − ')2 − U 2 − 12' (kUkb − ')2 − U 2 − 12' (cid:19) − 1 b 4 2 δ δ δ − 1 δ − 1 (13) To prove part (ii) if Cut(U) ≤ κ(') then: ≤ ϕλ(1 − δ2')kUkb − 2ϕλU = ϕλ(1 − δ2'2/2) + 11δ3ϕbU 50 ≤ ϕλ(1 − δ2'2/2) + 12' ≤ κ(') X δ (i,j):i,j∈U pij = 1 2 ≥ 1 2 But since λ ≥ λ ≥ λU and ϕbU ϕλbU ≥ ϕλU But that is a contradiction unless kUkb = ', otherwise the quadratic term, ϕλδ2 (kUkb − ')2 ≥ 4 12.5δ−2 is larger than the negative terms which are at most 1 δ2 + 1 in the RHS of Equation 13. Therefore Cut(U) ≤ κ(') for an odd-set implies kUkb = '. But then Equation 13 implies (again using U ≤ kUkb = '): 2δ + 12 ϕλU bU ≥ ϕλbU − ' 2 − 12' δ − 1 Now bU ≥ ' 3(1 − 3δ λU ≥ λ − ' 2ϕbU 4 ) when kUkb = ' ≥ 3; thus: − 12' δϕbU − 1 ϕbU ≥ λ − 3δ4 100(1 − 3δ 4 ) − 36δ3 50(1 − 3δ 4 ) − δ4 50 > λ − δ3 ≥ λ − δ3 in other words, Cut(U) ≤ κ(') for an odd-set implies U ∈ L1('), as claimed in part(ii). We now apply Lemma 19 to extract a collection ¯L(') of odd-sets in Gϕ(', λ), not containing r(') and cut at most κ(') -- such that any such set which is not chosen must intersect with some set in the collection ¯L('). If we have a maximal collection ¯L(') then ¯L(') ⊆ L1(') by part (ii) of Property 1. Due to Theorem 5, the intersection of two such sets U1, U2 ∈ L1(') will be either empty or of size 26 ' by laminarity -- the latter implies U1 = U2. Therefore the sets in L1(') are disjoint. Any U ∈ L2(') − ¯L(') has a cut of size at most κ(') using part (i) of Property 1 and therefore must intersect with some set in ¯L('). This is impossible because U ∈ L2(') implies U ∈ L1(') and ¯L(') ⊆ L1(') and we just argued that the sets in L1(') are disjoint. Therefore no such U exists and L2(') ⊆ ¯L('). We now have a complete algorithm: we perform a binary search over the estimate λ ∈ [1 + 3δ, 3 2 + δ2], and we can decide if there exists a set U ∈ L2(') in time O(n poly(δ−1, log n)) as we vary ', λ. This gives us λ. We now find the collections ¯L(') for each ' and compute all λU exactly. We can now return ∪'L2('). Observe that Gϕ does not need to be constructed more than (cid:3) once; it can be stored and reused. The running time follows from simple counting. 6 Rounding Uncapacitated b-matchings Theorem 2.(Integral b -- matching) Given a fractional b-matching y for a non-bipartite graph which satisfies LP1(b) (parametrized over b) where {(i, j)yij > 0} = m0, we find an integral b -- matching of weight at least (1 − 2δ)P (i,j) wijyij in O(m0δ−3 log(1/δ)) time and O(m0/δ2) space. Algorithm 4 Rounding a fractional b -- matching 1: First Phase: (large multiplicities) Let t = d2/δe and M(0) = ∅. ij = byijc − 1 copies of (i, j) to M(0). (0) ij = 0 if yij ≥ t and y (1) (1) ij = yij otherwise. (1) (0) j y ij ,dP ij e + 1o. bi −P j y (1) (a) If yij ≥ t add y (b) Set y (c) Let b i = minn (a) While ∃i s.t. P 2: Second Phase: (large capacities) ij ≥ 3t do (1) j y (i) Order the vertices adjacent to i arbitrarily. Select the prefix S in that order such that the sum is between t and 2t (each edge is at most t from Step 1b). Create a new copy i0 of i for j ∈ S and delete the edges from S incident to i. Observe with this prefix and y that the procedure describes a process where given a set of numbers q1, . . . , qk such that each j qj = Y ≥ 3; we partition the set of numbers such that each partition S satisfies (1) i0j = y (1) ij qj ≤ 1 andP 1 ≤P j∈S qj ≤ 2. (b) If no copies of i were created then b the partition S (which may have now become S0 with subsequent splits), assign b (2) ij = (1 − δ)y (2) Note b i ≤ 3t for all vertices. We now have a vertex set V (2). Set y (2) . For every new i0 (corresponding to i) created from ij c. (1) for i, j ∈ V (2). (2) i = b j∈S0 y (1) ij (1) i i0 = bP 3: Third Phase: Reduction to weighted matching. (a) For each i ∈ V (2) with b (b) For each edge (i, j), create a complete bipartite graph between i(1), i(2),··· and j(1), j(2),··· with , create i(1), i(2),··· , i(b (2) i (2) i ). every edge having weight wij. Let this new graph be G(3). (c) Run any fast approximation for finding a (1−)-approximate maximum weighted matching in G(3) let this matching be M(3). Matching M(3) provides a b -- matching M(2) in G(2) of same weight (merge edges). (ii) Matching M(2) provides a b -- matching M(1) in G(1) of same weight (merge vertices). 4: Output: M(0) ∪ M(1). As an example of Step 3(b), consider 27 3 u 2 v 3 w u1 u2 u3 v1 v2 w1 w2 w3 i0,j∈U i0∈U j i0∈U (cid:23) 2 = 2 X yi0j ≤ 1 yij − y (1) ij yi0j ≤ 1 2 andP 2((X The algorithm is given in Algorithm 4. We begin with the following lemma: Lemma 22. (First Phase and the Output Phase) Suppose that all vertex constraints are satisfied j yij ≤ bi − 1 for some i ∈ V . Then, for any odd set U that contains i, the corresponding odd set constraint is satisfied. The fractional solution {y ij } obtained in the first phase of Algorithm 4 (1) is feasible for LP1(b(1)) -- and an integral M(1) which is a (1 − 2δ)-approximation of LP1(b(1)) can be output along with M(0). X Proof: For any U ∈ O, i ∈ U, X . Thus it follows that any vertex which has an edge incident to it in M(0) cannot be in any violated odd-set in LP1(b(1)). Then any violated odd-set in LP1(b(1)) with respect to {y ij } must also be a violated (1) odd-set in LP1(b); contradicting the fact that we started with a {yij} is feasible for LP1(b). Now M(0) ∪ M(1) is feasible since both are integral and we know that b (1) (0) ij . Observe (0) ij wij. Therefore if (i,j)∈E y (i,j)∈E wijyij as (cid:3) ij } satisfies LP1(b(2)) (2) i ≤ bi −P (cid:16) then w(M(0)) + w(M(1)) is at least (1 − 2δ)P ij } satisfies LP1(b(1)) over V , then {y (1) (cid:17) where w(M(0)) = P that w(M(0)) ≥ (1 − δ)P w(M(1)) ≥ (1 − 2δ)P over G(2) and P tionally) at least t edges. After scaling we have (1−δ)P desired. Lemma 23. (Second Phase) If {y ij = (1 − δ)P (i,j)∈E wij (1) (i,j)∈E wijy ij bi0)− 1) = kUkb − 1 ij −δt ≤P ij ≤P (cid:22)kUkb (1) (1) j y j y j y ij −2 ≤ b (1) Proof: Observe that any vertex which participates in any split produces vertices which have (frac- i −1 (2) from the definition of b(2) in line (3b) of Algorithm 4. Therefore the new vertices cannot be in any violated vertex or set constraint; from the first part of Lemma 22 (now applied to LP1(b(2)) instead (cid:3) of LP1(b)). Therefore the Lemma follows. Finally, observe that any integral b -- matching in G(2) has an integral matching in G(3) of the same weight and vice versa -- moreover given a matching for G(3) the integral b -- matching for G(2) can be constructed trivially. Also, the number of edges in G(3) is at most O(δ−2m0) since each vertex in G(2) is split into O(δ−1) vertices in G(3). We are guaranteed a maximum b -- matching in G(2) of weight ij } satisfies LP1(b(2)) over G(2). Therefore we are guaranteed (2) a matching of the same weight in G(3). Now, we use the approximation algorithm in [9, 10] which returns a (1 − δ)-approximate maximum weighted matching in G(3) in O(m0δ−3 log(1/δ)) time and space. From the (1− δ)-approximate maximum matching we construct a b -- matching in G(2) of the same weight (and therefore a b -- matching M(1) in G(1) of the same weight). Theorem 2 follows. at least P (i,j)∈E(2) wijy since {y (2) ij i,j wijy (1) ij . (2) i,j wijy j y 7 The Capacitated b -- Matching Problem Definition 2.[29, Chapters 32 & 33] The Capacitated b -- matching problem is a b -- matching problem where we have an additional restriction that the multiplicity of an edge (i, j) ∈ E is at 28 pij,i = bc pij,j = cij. For i ∈ V set bc most cij. The vertex and edge capacities {bi},{cij} are given as input and for this paper are assumed to be integers in [0, poly n]. Observe that we can assume cij ≤ min{bi, bj} without loss of generality. Long and Short Representations: We follow the reduction of the capacitated problem to the uncapacitated problem outlined in [29, Chapter 32], with modifications. Definition 7. Given a graph G = (V, E) with vertex and edge capacities. Consider subdividing each edge e = (i, j) into (i, pij,i), (pij,i, pij,j), (pij,j, j) where pij,i, pij,j are new additional vertices i = bi. We use the weights denoted by wc to be with capacity bc 1 2 wij, 0, 1 2 wij for (i, pij,i), (pij,i, pij,j), (pij,j, j) respectively. Let the transformation of G be denoted as Long (G); let the vertices and edges of Long (G) be V c and Ec respectively. Long (G) does not have any edge capacities. kU ckb is odd, are denoted by Oc and define Oc The above transformation is inspired by the proof of [29, Theorem 32.4, Vol A, page 567] which used the weights wij, wij, wij instead of 1 2 wij for (i, pij,i), (pij,i, pij,j), (pij,j, j) respectively. (i,j)∈E wijcij. How- (i,j)∈E wijcij need not provide an approximation of β∗,c because (i,j)∈E wijcij can be significantly larger. We will eventually use the algorithm in [29, Theorem 32.4] (i,j)∈ E wijcij where E is the edgeset in our candidate fractional solution. An example of the transformation is as follows (the edges only have weight in the new graph). δ = {U c ∈ Oc,kU ckb ≤ 1/δ}. In fact [29, Theorem 32.4] computes an optimum solution of value β∗,c +P ever an approximation of β∗,c +P P to find an integral solution in Section 7.2. We need to boundP For U c ⊆ V c let kU ckb = P s as before. The odd-sets in Long (G) , i.e. U c such that 2 wij, 0, 1 s∈U c bc 3 i1 4 i2 c=3 w=2 c=2 w=4 3 i3 3 i1 3 1 3 1 0 4 i2 2 2 0 2 2 3 i3 pi1i2,i1 pi1i2,i2 pi2i3,i2 pi2i3,i3 Notation: We will use i, j to denote vertices (and edges) in the original graph G and use s, r, u, v to denote vertices (and edges) in Long (G). We will use the superscript such as yc, U c to indicate variables, subsets in Long (G) to distinguish them from G. However we can switch between G and Long (G) as described next. Definition 8. Let λc0 be a parameter which is determined later. Define: sr ≤ bc yc pij,ipij,j + yc s ∀s ∈ V c ∀(i, j) ∈ E pij,j j = cij ∀(i, j) ∈ E ∀(s, r) ∈ Ec = cij and Qc :  X j:(i,j)∈E yij ≤ cij yij ≥ 0 yij ≤ bi ∀i ∈ V ∀(i, j) ∈ E ∀(i, j) ∈ E sr ≤ λc s/2 0bc yc = cij ∀s ∈ V c ∀(i, j) ∈ E pij,j j = cij ∀(i, j) ∈ E ∀(s, r) ∈ Ec r:(s,r)∈EL + yc yc ipij,i yc pij,ipij,j sr ≥ 0 yc pij,ipij,j + yc Long (P c) : j:(i,j)∈E yij ≤ cij yij ≥ 0 Given yc ∈ Long (P c) define Short (yc) as yij ← yc pij,j ,j). Observe that Short (yc) ∈ (= yc pij,j ,j ← yij and ypij,i,pij,j ← (cij − P c. Likewise given a y ∈ P c define Long (y) as yc , yc yij). Observe that Long (y) ∈ Long (P c). Moreover Long (·) , Short (·) are inverse operations; ∀(i, j) ∈ E ∀(i, j) ∈ E and P c : i,pij,i i,pij,i yij ≤ λc 0bi/2 ∀i ∈ V X   X r:(s,r)∈Ec + yc yc ipij,i yc pij,ipij,j sr ≥ 0 yc X Long (Qc) : And likewise:  29 Short (yc) = y iff Long (y) = yc and define bijections between Long (P c) ,P c and between Long (Qc) ,Qc. Moreover for any yc ∈ Long (P c) (therefore also Long (Qc)) we have wT Short (yc) = (wc)T yc. Similarly for any y ∈ P c (therefore also Qc) (wc)T Long (y) = wT y. The next theorem provides the linear program we will use for capacitated b -- matching. Theorem 24. The maximum integral weighted capacitated b -- matching problem is expressed by the following linear programming relaxation on Long (G). β∗,c = max X wc sryc sr (s,r)∈Ec {Acyc ≤ bc} = Long (Qc) =   (cid:23) ∀s ∈ V c ∀U c ∈ Oc δ ∀U c ∈ Oc − Oc δ (LP9) r:(s,r)∈Ec X X X X (s,r)∈Ec:s,r∈U (s,r)∈Ec:s,r∈U sr ≤ bc yc s (cid:22)kU ckb (cid:23) (cid:22)kU ckb 2 sr ≤ yc sr ≤ yc sr ≤ bc yc 2 s ∀s ∈ V c ∀(i, j) ∈ E pij,j j = cij ∀(i, j) ∈ E ∀(s, r) ∈ Ec = cij pij,ipij,j + yc r:(s,r)∈Ec + yc yc ipij,i yc pij,ipij,j sr ≥ 0 yc The final solution is given by y ← Short (yc). Some of the constraints are redundant by design. Proof: Given an integral feasible solution y for capacitated b -- matching, the constraints {AcLong (y) ≤ bc} hold because Long (y) defines an integral uncapacitated b-matching over Long (G). The new constraints Long (Qc) are satisfied since y is feasible, i.e., y ≤ c. Note that the objective function value does not change as a consequence of Definition 7. This proves that β∗,c is an upper bound on the maximum capacitated integral b -- matching. In the reverse direction, given a fractional solution yc with objective value β∗,c, observe that yc satisfies the conditions of being in the uncapacitated b-matching polytope of Long (G) (recall these constraints are in LP1). Therefore yc can be expressed as a convex combination of integral uncapacitated b -- matchings over Long (G). Since yc satisfies that the vertex capacities in V c − V as an equality (see Long (Qc)) -- every integral uncapacitated b -- matching in the decomposition of yc must satisfy the vertex capacities V c − V as equality. Therefore there exists at least one integral uncapacitated b -- matching yc in the decomposition of yc which has objective value at least β∗,c and satisfies the vertex capacities for V c − V as equality. Now Short ( yc) is an integral capacitated b -- matching in G of weight at least β∗,c. (cid:3) Approximate Satisfiability. Since we will not be satisfy the constraints LP9 exactly the next lemma provides an ability to scale solutions. Lemma 25. Let q be an arbitrary integer and let ζ ≥ 1. Suppose that we have a yc ∈ Long (P c) which for all U c ⊆ V c in Long (G) with kU ckb ≤ q satisfies then yc = Long(cid:16) 1 ζ ζ Short (yc)(cid:17) satisfies for all U c ⊆ V c in Long (G) with kU ckb ≤ q, (s,r)∈Ec,s,r∈U c yc sr yc sr (14) (cid:23) 2 (cid:22)kU ckb (cid:23) (cid:22)kU ckb 2 ≥ X ≥ X (s,r)∈Ec,s,r∈U c 30 Algorithm 5 An approximation scheme for capacitated b -- matching . 1: Define Long (Qc) , Long (P c) as in Definition 8. Define Acyc ≤fbc as: {Acyc ≤ ebc} = X X r:(s,r)∈Ec  (s,r)∈Ec:s,r∈U sr ≤ bc yc s ∀s ∈ V c, where bc s = (1 − 4δ)bc sr ≤ bc yc U ∀U c ∈ Oc δ where bc U = j kU ckb 2 s k − δ2kU ck2 b 4 (LP10) 2: Fix δ ∈ ( 1√ 5n 3: Find a solution yc ∈ Long (P c) where β0 = (wc)T yc and Acyc ≤ λ0fbc. δ . Let α = 50δ−3 ln(2m + n). , 1 16]. Let λc0 = 16 ln 2 8 (note  ≥ δ) and t = 0. 4: Let  = 1 5: while true do 6: ( λs =P λU c =P 7: 8: 9: 10: 11: sr/bc s ∀s ∈ V c ∀U c ∈ Oc δ δ U sr/bc δ, λU c ≥ λ − δ3 zU c = exp(αλU c)/bc r:(s,r)∈Ec yc Define λ = max{maxi λi, maxU c∈Oc λU c} where (s,r)∈Ec:s,r∈U c yc 10} (without computing all λU c). Find a collection of odd sets Lc = {U c U c ∈ Oc If (λ ≤ 1 + 8δ) output (1−δ) (1+8δ)Short (yc) and stop. If λ < 1 + 8 then a new superphase starts; repeatedly set  ← max{2/3, δ} till λ ≥ 1 + 8. s if λs > λ − δ3/10 and 0 otherwise Set Define ηsr = (xc U if λU c > λ − δ3/10 and 0 otherwise . Let γc =P eyc ∈ Long (P c) (cid:26) xs = exp(αλs)/bc  X zU c). Find a solutionfyc of LP11, otherwise decrease β ← (1− δ)β. r + X sreyc X Set yc ← (1 − σ)yc + σfyc where σ = /(4αλc0). s +P  srηsr ≤ γc 1 − δ sr ≥ (1 − δ)β, U c∈Lc;s,r∈U c zU cbc U. s + xc (LP11) eyc U c∈Oc (s,r)∈Ec (s,r)∈Ec s xs bc wc , δ 12: 13: end while Proof: Suppose not. Consider the subset U c with the smallest kU ckb which violates the assertion 14. Observe that U c cannot contain both pij,i, pij,j for any edge (i, j) ∈ E (in the original G). Because in that case U c − {pij,i, pij,j} will be a smaller set which violates the assertion -- since the LHS of Equation 14 will decrease by cij as well as the RHS! But if U c does not contain both pij,i, pij,j for any edge (i, j) ∈ E (in G) then sr ≤ 1 yc (cid:22)kU ckb X X sr ≤ yc (cid:23) ζ which is a contradiction. The lemma follows. (s,r)∈Ec,s,r∈U c (cid:3) Therefore the scaling operation still succeeds (on Short (yc)) but its proof is more global compared to the proof in the uncapacitated case. Here we are proving the statement for all subsets of a certain size simultaneously, whereas in the uncapacitated case the proof of feasibility of U c (s,r)∈Ec,s,r∈U c 2 followed from the bound ofP (i,j)∈E,i,j∈U c yij for that particular subset U c itself. 7.1 Algorithm for Capacitated b -- Matching The algorithm is provided in Algorithm 5. Lemma 18 also follows. Note that λ∗ = min{λ yc ∈ Long (Qc) , Acyc ≤ λfbc} is not 1. Note that Step 7 follows from Lemma 17. Moreover if we adjust α for the number of vertices, In Lemma 27 we show that λ∗ ≤ 1/(1 − 4δ) and moreover we can always find a solution of LP11 for 31 without any modification. Before discussing the algorithm for LP11 we argue that the returned solution returned in Line 8 of Algorithm 5 is a feasible capacitated b -- matching. We apply Lemma 25 with ζ = (1 + 8δ) and β ≤ (1 − 4δ)β∗,c. However the choice of Acyc ≤ fbc implied that we can reuse Lemma 17 and 18 Short (yc)(cid:17). Since Acyc ≤ (1 + 8δ) bc ≤ (1 + 8δ)bc. Note q = 1/δ. Consider yc,† = Long(cid:16) 1 X that this operation will imply that all the vertex constraints in Vc are satisfied as well as constraints corresponding to all U c ∈ Oc δ. For the odd subsets U c with kU ckb ≥ 1/δ, since the vertex constraints are satisfied we have: (cid:22)kU ckb (cid:23) 1+8δ 1 sr ≤ kU ckb 2 ≤ yc,† (1 − δ) 2 (s,r)∈Ec,s,r∈U c the violation is at most ζ = 1 (1−δ) for any odd set. We now apply the lemma again with ζ = 1 (1−δ) for all odd sets, i.e., q = ∞. The result of the two operations compose and correspond to the output in Line 8. Solving LP11. We now focus on the algorithm for solving LP11. Before providing the algorithm we prove Lemma 26 which proves structural properties of the weights resulting from the dual thresholding. Lemma 26. Suppose that λ > 1 + 8δ (otherwise the algorithm has stopped) and the current can- didate solution in Algorithm 5 is yc. (a) xs = 0 for any s ∈ V c − V (the new vertices that are introduced). (b) Suppose U c ∈ Oc δ contains pij,i, pij,j for some edge (i, j) ∈ E (of G). If neither i, j /∈ U, zU c = 0. (c) If for some edge (i, j) ∈ E we have yc to an add set U c ∈ Oc O(m0 poly{δ−1, log n}) where m0 = {(i, j)yc fine any odd set in Lc. = yc pij,j j = 0, then neither pij,i, pij,j belong δ with zU c > 0. As a consequence, We can compute Lc in time pij,j j 6= 0} because the other edges cannot de- ipij,i (d) Let Short(η)ij = ηipij,i + ηpij,j j − ηpij,ipij,j. Then Short(η)ij ≥ 0 for every (i, j) ∈ E. (e) Let Shift(η) = X (i,j)∈E cijηpij,ipij,j then γc (1−δ) ≥ Shift(η). Proof: Part (a) follows from the fact that λs = 1 For part (b) suppose that pij,i, pij,j ∈ U c, zU c 6= 0 for some U c ∈ Oc thus:X (cid:19) (cid:22)kU ckb 1−4δ < λ − δ3/10. ! (cid:23) (cid:18) (cid:19) (cid:18) b,c λ − δ3 10 bc U = sr ≥ yc (s,r)∈Ec:s,r∈U c (15) Consider U c1 = U c − {pij,j, pij,i}. Let kU c1kb = '. Note since kU ckb is odd, ' ≥ 1 and ' is odd. kUkb = ' + 2cij ≥ 3. Since ypij,ipij,j ≤ cij and i, j 6∈ U c, − λ ≥ 4 2 2 λ − δ3 10 δ. Note kU ckb ≤ 1/δ and (cid:19) kU ckb − 1 δ2kUk2 b,c (cid:18) λ − δ3 10 − δ2kU ck2 4 (s,r)∈Ec:s,r∈U c 1 (s,r)∈Ec:s,r∈U X yc sr = X (cid:19) (cid:18) λ − δ3 10 yc sr − ypij,ipij,j ≥ X (cid:22) ' + 2cij (cid:18) (s,r)∈Ec:s,r∈U c (cid:19) (1−δ) λ − δ3 10 2 If U c1 is a singleton node then the LHS of Equation (16) is 0. Using Equation (15) and 3 ≤ kUkb,c ≤ (cid:19) 1/δ, (cid:18)(cid:18) (cid:23) (cid:19) sr−ypij,ipij,j ≥ yc U−cij ≥ bc −cij ≥ cij λ − δ3 10 (1 − δ) − 1 0 = X (s,r)∈Ec:s,r∈U c sr − cij yc (16) 32 which is impossible for λ > 1 + 8δ. If U c1 is an odd set, then it is in Oc (cid:18) λ − δ3 10 (cid:19) ' + 2cij − 1 2 δ and thus − cij δ2(' + 2cij)2 4 − λ = λbU c 1 ≥ (cid:18) ' − 1 2 − δ2'2 4 but Equation 17 rearranges to λ (cid:19) + λcijδ2(cij + ') ≥ (cid:18) (cid:19) 10 − 1 λ − δ3 cij (cid:19) (cid:18) ' − 1 2 δ3 10 (17) 20 ≥ (1 − δ)λ which is which in turn (if we divide by cij and use ' + 2cij ≤ 1/δ ) implies 1 + δ3 impossible for λ > 1 + 8δ. Part (b) of the Lemma follows. For part (c), suppose for contradiction, pij,i ∈ U c yc pij,ipij,j = cij and zU c > 0. Observe Equa- tion (15) applies because zU c > 0. If pij,j ∈ U c then we consider U c1 = U c − {pij,i, pij,j} and in part (b). Equation (16) of part (b) holds irrespective of i, j ∈ U c because neither pij,i, pij,j have nonzero edges in yc to any other vertex. The remainder of part (b) applies as well and we have a contradiction. Therefore we need to only consider the case pij,j 6∈ U c. But then consider U c2 = U c − {pij,i}. In this case, since pij,i has no non-zero edge to any vertex in U c2: 10 + δ2 sr > 0 yc (18) X yc sr = X X r:(s,r)∈Ec s∈U c 2 sr ≤ 1 yc 2 (cid:22)kU ckb (cid:23) 2 (1 − δ) s = (1 − 4δ)' λ 2 (cid:19) (cid:18) λ − δ3 10 (cid:23) (cid:22) ' + cij 2 (1 − δ) = (s,r)∈Ec:s,r∈U c 2 (s,r)∈Ec:s,r∈U c Again let kU c2kb = ', thus kU ckb = ' + cij. Note kU ckb ≤ 1/δ. Now λ bc X X X Combining the above with Equations 18 and (first part of) 15 (s,r)∈Ec:s,r∈U c 2 (cid:19) (cid:18) λ − δ3 10 (1 − 4δ)' 2 λ ≥ bU c ≥ and since cij ≥ 1, the above implies (cid:18) (1 − 4δ)' 2 (cid:19) s∈U c 2 sr ≤ 1 yc 2 (cid:18) λ − δ3 10 (cid:19) λ − δ3 10 λ ≥ (1 − δ) ' 2 =⇒ (1 − δ) δ3 10 ≥ 3δλ which is not possible for λ > 1 + 8δ. Part (c) follows. For part (d) observe that: Short(η)ij = xi + xpij,i + X  + xpij,i + xpij,j + X zU c + X = xi + xj + X U c;i,pij,i∈U c xj + xpij,j + X  zU c − X U c;pij,i,pij,j∈U c zU c zU c − U c;j,pij,j∈U U c;i,pij,i∈U c U c;j,pij,j∈U c U c;pij,i,pij,j∈U c  zU c zU c but then Short(η)ij can be negative only if there exists a set U c ∈ Lc such that pij,i, pij,j ∈ U c, neither i, j 6∈ U c and zU c > 0. The first part of Lemma rules out that possibility. 33 Finally for part (d) observe that there exists a solution yc = 0. This solution corresponds to not picking any edges in the original graph G. This solution belongs to Qc and satisfies Acyc ≤fbc. Therefore for this solution, for every odd set U c ∈ Oc pij,ipij,j = cij and yc = yc i,pij,j i,pij,i δ: X (cid:22)kUkb (cid:23) 2 sr ≤ yc (s,r)∈Ec:s,r∈U ≤ 1 (1 − δ) bU c (19) sr 6= 0 only for (s, r) = (pij,i, pij,j) for every edge (i, j) ∈ E; and that yc X Observe that yc  Therefore multiplying Equation 19 by zU c ≥ 0 and summing over all U c ∈ Oc X (1 − δ) γc ≥ X (1 − δ) γc =⇒ (cid:0)ηpij,j ,pij,i − xpij,i − xpij,j X  = X  ≤ X (i,j)∈E:pij,j ,pij,i∈U c δ we get: zU cbU c ≤ (1 − δ)  U c∈Oc U∈Oc zU c cij cij cij δ 1 zU 1 1 δ (i,j)∈E U c∈Oc δ,pij,j ,pij,i∈U c (i,j)∈E (cid:1) = X (i,j)∈E cijηpij,j ,pij,i sr = cij. where the last part follows from xs = 0 for any s ∈ V c \ V (since λs = 1/(1 − 4δ) < λ − δ3/10). (cid:3) The conclusion (c) follows from the definition of Shift(η). 4δ)fβc. This reduces the approximation ratio but the overall approximation remains a (1 − O(δ)) We now provide a solution for LP11, but notice that the solution is only provided for β ≤ (1 − approximation. Lemma 27. Recall LP11 in Algorithm 5.  X sr yc wc sr ≥ (1 − δ)β X eyc srηsr ≤ γc 1 − δ  eyc ∈ Long (P c) (LP11) (s,r)∈Ec (s,r)∈Ec where ηsr are as defined in Step 10. A solution of LP11 is always found for β ≤ (1 − 4δ)fβc. The the subgraph (in G) E = {(i, j)(i, j) ∈ E, Short (yc)ij > 0} satisfies P δ ) invocations of Theorem 13 and returns a solution yc such that (i,j)∈ E wijcij ≤ (16')β∗,c. solution requires at most ' = O(ln2 1 Recall that β∗,c is the weight of the optimum capacitated b -- matching. Proof: First observe that for any H1, H2 and y = Short (yc) (equivalently yc = Long (y)), X (i,j)∈E X (i,j)∈E wijyij ≥ (1 − δ)β Short(η)ijyij ≤ γc (1 − δ) − Shift(η), y ∈ P c (LP12) for any β ≥ (1 − 4δ)β∗, then we have proved the lemma by considering Long (y). Consider the optimum capacitated b -- matching yc,∗, and let yc,† = Long ((1 − 4δ)Short (y∗,c)). Observe yc,† ∈ Long (Qc). Note that for i ∈ V , yc,∗ ir ≤ bi yc,† ir ≤ (1 − 4δ)bi = bi X =⇒ X r r 34 X X (s,r)∈EL wc sryc sr = H1 sr = H2 ηsryc r:(s,r)∈EL yc ∈ Long (P c) (resp. Long (Qc))  ⇐⇒  X X (i,j)∈E (i,j)∈E y ∈ P c Suppose that we can provide a solution for the system: wijyij = H1 Short(η)ijyij = H2 − Shift(η) (resp. Qc) We argue that for any U c ∈ Oc δ such that if zU c > 0, X sr ≥ X yc,∗ (s,r):s,r∈U c (s,r):s,r∈U c yc,† sr (20) pij,i,pij,j If for every edge (i, j) ∈ E both pij,i, pij,j are not present in U c then Equation (20) follows immediately because in the transformation of yc,∗ to yc,† the only yc values that increase correspond for some edge (i, j) ∈ E. On the other hand, suppose that for some (i, j) ∈ E to yc both pij,i, pij,j are present then using Lemma 26, either i or j ∈ U c. Without loss of generality, suppose i ∈ U c. But then the increase in yc . Therefore Note P Equation (20) follows. sr = (1 − 4δ)β∗,c (discussion following Algorithm 5) and xs = 0 for s ∈ r:(s,r)∈Ec wc V c \ V (Lemma 26, part(a)). Omitting the implied U c ∈ Oc δ for notational simplicity in the sum below, we get: X pij,i,pij,j cancels out the the decrease in yc rsyc,† ipij,i sr = X = X r:(s,r)∈Ec xi i:xi>0 ≤ 1 (1 − δ) zU c U c∈Lc;s,r∈U xs + xr + X ! X + X  X bs + X yc,† U c:zU c >0  yc,† sr =X  X  = γc (s,r):s,r∈U c zU cbU c zU c xs xs ir s r s:xs>0 U c:zU c >0 (1 − δ) yc,† ! X + X  ≤ X yc,† xs  X bs + X zU c U c:zU c >0 sr sr r s:xs>0 U:zU c >0 (s,r):s,r∈U c bU c (1 − δ) zU c  yc,† sr ηsryc,† r:(s,r)∈Ec Therefore there exists a solution for sryc,† wc sr = (1 − 4δ)β∗,c yc,† ∈ Long (Qc) X r:(s,r)∈Ec ηsryc sr ≤ γc (1 − δ) which, by the observation made in this proof, implies that for β ≤ (1 − 4δ)β∗,c there exists a (s,r)∈Ec  X solution for X   X (i,j)∈E (i,j)∈E y ∈ Qc wijyij ≥ β, Short(η)ijyij = γc Theorem 10 involves Theorem 13 repeatedly. The bound on P that we average solutions of Theorem 9 for whichP (1 − δ) − Shift(η), (1−δ) − Shift(η) (by Lemma 26, f2 ≥ 0) We can now apply Theorem 8 with f1 = β > 0, f2 = γc and P1 = Qc and P2 = P c. Note that Short(η) ≥ 0 by Lemma 26. Finally 0 ∈ Qc ⊆ P c. and the algorithm desired by Theorem 8 is provided by Theorem 10. Therefore we have a solution of LP12. The number of iterations in Theorem 8 is O(ln(2/δ)) each of which invokes Theorem 10. (i,j)∈ E wijcij follows from the fact (the bipartite maximum) (cid:3) n < δ ≤ 1/16, we find a (1 − O(δ))- approximate fractional solution to LP9 using O(mR/δ+min{B, m} poly{δ−1, ln n}) time, additional "work" space O(min{m, B} poly{δ−1, ln n}) making R = O(δ−4(ln2(1/δ)) ln n) passes over the list i bi. The algorithm returns a solution {yij} = Short (yc) such that the (i,j)∈ E wijcij ≤ 16Rβ∗,c where β∗,c is the weight of edges where B = P subgraph E = {(i, j)(i, j) ∈ E, yij > 0} satisfies P which can be bounded by 16β∗,c. We can now conclude Theorem 3. Theorem 3. Given any non-bipartite graph, for any 3√ (i,j):yij >0 wijcij ≤ 8β ∗,c b of the optimum integral capacitated b -- matching. 35 7.2 Rounding Capacitated b-Matchings We prove Theorem 4 based on Algorithm 6. Algorithm 6 Rounding capacitated b -- matchings 1: First Phase: Removing edges with large multiplicities (no change from Algorithm 4 except tracking c = ∅. edge capacities). Let t = d2/δe and M(0) (a) If yij ≥ t add y (b) Set y (cid:26) 0 if yij ≥ t otherwise . (1) ij = min{cij,dy ij e + 1}. This describes the graph G (1) Set b ij = byijc − 1 copies of (i, j) to M(0) (0) = minn (1) i yij . c bi −P ij ,dP (0) j y j y ij e + 1o and c (1) (1) ij = (1) c = (V, E(1)). Note c ij ≤ t + 1. (1) 2: Second Phase: Subdividing vertices with large multiplicities. (no change from Algorithm 4 except ij where the edge (i, j) got assigned to i0 and j0 which are (1) tracking edge capacities). We set c (2) copies of i and j respectively. This defines G c = (V (2), E(2)). Note only vertices are split, -- the edges are not split, even though they can be assigned to a copy of an original vertex, i.e., E(1) = E(2). Let (2) i0j0 = c W =P (i,j)∈E(2) c (2) ij wij. 3: Third Phase: Reducing the problem to a weighted matching on small graph. (different from (2) i ). For each edge e = (i, j), we create 2c (2) ij (3) c (2) c , define G Algorithm 4). Given G (a) For each i ∈ V (2) with b vertices pei,1, pei,2,··· , pei,c pei,1, pei,2,··· with edge weight wij. (2) i (2) ij as follows: , create i(1), i(2),··· , i(b , pej,1, pej,2,··· , pej,c . (2) ij (b) Add edges (pei,', pej,') with edge weight wij. Add a complete bipartite graph between i1, i2,··· and (c) Run any fast approximation for finding a (1 − δ 32R)-approximate maximum weighted matching in G(3)c. Let this matching be M(3)a c of weight W. (d) Observe that given any integral matching in G(3)c, we can construct a matching of same or greater weight such that every one of the vertices pei,', pej,' (for all e = (i, j), ') are matched -- if for some e, ' neither pei,', pej,' are matched then we can match them, if only one of the pair is matched then we delete the matching edge incident to the other one in the pair and add the matching edge between pei,', pej,' which is of the same weight. Applying this procedure to M(3)a of weight at least W. 4: We now merge all the vertices i(') to i, pei,' to pei and pej,' to pej for all e = (i, j), '. Observe G (cid:17) with different edge weights, i.e., for an edge e = (i, j) of weight wij in the we get M(3)b (3) c c c original graph we have the weights of (i, pei), (peipej) and (pej, j) are all wij instead of 1 2 wij, 0, 1 2 wij as reduces to Long(cid:16) in the definition of Long(cid:16) (2) G c (cid:17). (2) G c However if we merge all the corresponding edges of M(3)b vertices pei and pej are matched to capacity cij for every edge e = (i, j). Note that M(3) least W. M(3) provides a b -- matching M(2) c M(2) (1) c then we get a matching M(3) such that the c has weight at . of weight at least W − W, where we set y c provides a b -- matching M(1) of same weight (merge vertices). † ij = y in G in G † ipei (2) c c c 5: Output M(0) c ∪ M(1) c . For example, in Step 3(b) 36 b = 3 p c = 3 w = 1 b = 4 q b = 3 r c = 2 w = 2 1 p1 p2 p3 1 1 1 1 2 q1 q2 q3 q4 2 2 2 r1 r2 r3 which in turn reduces to b = 3 b = 3 1 b = 3 b = 4 q 2 1 b = 2 2 b = 2 b = 3 r 2 1 p . (1) is a feasible fractional capacitated b -- matching in G c (cid:17) with the new capacities b Lemma 28. y Proof: Consider Long(cid:16)y(1)(cid:17) and Long(cid:16) (1) ij (1) G c . The only vertices whose capacities were affected in Long(cid:16) (1) and edges in G c lowing vertices: (i) the corresponding vertex in G has an edge incident to it in M(1) and (ii) the corresponding edge (i, j) ∈ G had cij > dy ij e + 1. In both cases the difference between the (1) sum of the new edge multiplicities and the new capacities (the slack) is at least 1 and the first (cid:17) are the fol- (cid:17) cannot be part of a violated odd-set (cid:17). Therefore y(1) is a feasible fractional (uncapacitated) b -- matching. The lemma part of Lemma 22 tells us that these vertices in Long(cid:16) in Long(cid:16) for the vertices (1) c (cid:3) follows from Theorem 24. Therefore the remaining task is to find a (1 − δ) approximate rounding of the fractional solution (1) ij on G y c = (V, E(1)) with vertex and edge capacities {b (1) ij } respectively. (1) ij } and {c (1) (1) G c (1) ij (1) i , c (1) c G G c Lemma 29. Let W =P (i,j)∈E(2) c ij wij. Then W ≤ 16Rβ∗,c. (2) Proof: Observe that E(2) = E(1) and E(1) ⊆ E as defined in the statement of Theorem 4. Moreover c ij ≤ cij. Therefore: (1) (2) i0j0 = c W = X i0j0wi0j0 = X (2) c ij wij ≤ X (1) c cijwij ≤ X cijwij ≤ 16Rβ∗,c (i0,j0)∈E(2) (i,j)∈E(1) (i,j)∈E(1) (i,j)∈ E Lemma 30. Algorithm 6 outputs a capacitated b -- matching of weight at least (1−δ)P (cid:3) (i,j)∈E wijyij− δβ∗. Proof: Let the weight of the maximum matching of this graph G ij + W wijy 2W ≥ w(M∗) ≥ X (cid:17)-approximate maximum matching in G ij wij to w(M∗). (2) can contribute at most 2c (i,j)∈E(2) (2) since each edge (i, j) ∈ G Suppose that we find a(cid:16)1 − δ (2) c c be w(M∗). Then (3) in [9, 10] which takes time E(G us a matching of weight at least W where W ≥ w(M∗) − δ 32R c ) times O( R (3) , using the algorithm δ log(R/δ)) which is O(m0Rδ−3 log(R/δ)). This gives 32R w(M∗) which corresponds to a (3) c 37 Since the second phase is exactly the same as in the uncapacitated case in Section 6, we have (2) wijy (i,j)∈E(2) (i,j)∈E(2) (i,j)∈E(2) w(M∗) − δ 32R = X w(M∗) − W ≥ X ≥ X ij − δw(M∗) 32R X ij ≥ (1 − δ) X (i,j)∈E(1) (cid:16) c ) ≥ (1 − δ)P of weight w(M(1) c ) is at least (1 − δ)P (i,j)∈E wij (1) in G c (i,j)∈E(2) wijy (2) Thus we get a matching M(1) Observe that w(M(0) w(M(0) Therefore we can conclude Theorem 4. c ) + w(M(1) c wijy (1) ij c ) ≥ (1 − δ)P (cid:17) where w(M(0) c ) =P ij − δβ∗,c. (1) (i,j)∈E(1) wijy (0) ij wij. Then (i,j)∈E wijyij − δβ∗ as desired. This proves Lemma 30. (cid:3) yij − y (i,j)∈E y (1) ij capacitated b -- matching in G c with weight at least w(M∗) − δ (2) 32R w(M∗) − W. Now wijy (2) ij + W − δ 32R w(M∗) − W wijy ij − δβ∗,c (2) y = Short (yc) and E = {(i, j)yij > 0}. Further suppose we are promised that P 16Rβ∗,c. We find an integral b-matching of weight at least (1−δ)P Theorem 4. Given a fractional capacitated b-matching yc which is feasible for LP9. Let (i,j)∈ E wijcij ≤ time and O(m0/δ2) space where m0 = E is the number of nontrivial edges (as defined by the linear program) in the fractional solution. As a consequence we have a (1 − O(δ))-approximate integral solution. (i,j) wijyij−δβ∗,c in O(m0Rδ−3 ln(R/δ)) References [1] K. J. Ahn and S. Guha. Linear programming in the semi-streaming model with application to the maximum matching problem. Inf. Comput., 222:59 -- 79, 2013. [2] K. J. Ahn and S. Guha. Near linear time approximation schemes for uncapacitated and capacitated b -- matching problems in nonbipartite graphs. Proc. SODA, previous version of this manuscript, also at CORR, arXiv 1307.4355, 2014. [3] K. J. Ahn and S. Guha. Access to data and the number of iterations: Dual primal algorithms for maximum matching under resource constraints. Proc. SPAA, also at CORR, 1307.4359, 2015. [4] R. P. Anstee. A polynomial algorithm for b-matchings: An alternative approach. Information Processing Letters, 24(3):153 -- 157, 1987. [5] S. Arora, E. Hazan, and S. Kale. The multiplicative weights update method: a meta algorithm and applications. Theoretical Computer Science, 8(6):121 -- 164, 2012. [6] A. Bhalgat, R. Hariharan, T. Kavitha, and D. Panigrahi. An O(mn) Gomory-Hu tree con- struction algorithm for unweighted graphs. Proc. STOC, 2007. [7] W. Cook. On box totally dual integral polyhedra. In Mathematical Programming, pages 48 -- 61, 1986. 38 [8] W. H. Cunningham and A. B. Marsh. A primal algorithm for optimum matching. Polyhedral Combinatorics, 8:50 -- 72, 1978. [9] R. Duan and S. Pettie. Approximating maximum weight matching in near-linear time. In Proc. FOCS, pages 673 -- 682, 2010. [10] R. Duan, S. Pettie, and H.-H. Su. Scaling algorithms for approximate and exact maximum weight matching. In Arxiv http://arxiv.org/abs/1112.0790, 2011. [11] D. Foster and R. Vohra. Regret in the on-line decision problem. Games and Economic Behav- ior, 29:7 -- 35, 1999. [12] Z. Füredi. Maximum degree and fractional matchings in uniform hypergraphs. Combinatorica, 1(2):155 -- 162, 1981. [13] Z. Füredi, J. Kahn, and P. D. Seymour. On the fractional matching polytope of a hypergraph. Combinatorica, 13(2):167 -- 180, 1993. [14] H. N. Gabow. An efficient reduction technique for degree-constrained subgraph and bidirected network flow problems. Proc. STOC, pages 448 -- 456, 1983. [15] H. N. Gabow and R. E. Tarjan. Faster scaling algorithms for general graph-matching problems. J. ACM, 38(4):815 -- 853, 1991. [16] F. R. Giles and W. R. Pulleyblank. Total dual integrality and integer polyhedra. Linear Algebra and Applications, 25:191 -- 196, 1979. [17] R. E. Gomory and T. C. Hu. Multi-terminal network flows. Journal of the Society for Industrial and Applied Mathematics, 9(4):551 -- 570, 1961. [18] M. D. Grigoriadis and L. G. Khachiyan. A sublinear-time randomized approximation algorithm for matrix games. Operations Research Letters, 18:53 -- 58, 1995. [19] D. Gusfield. Very simple methods for all pairs network flow analysis. SIAM Journal on Computing, 19(1):143 -- 155, 1990. [20] R. Hariharan, T. Kavitha, and D. Panigrahi. Efficient algorithms for computing all low s-t edge connectivities and related problems. Proc. SODA, 2007. [21] S. Hougardy. Linear time approximation algorithms for degree constrained subgraph problems. Research Trends in Comb. Opt., Springer, pages 185 -- 200, 2008. [22] C. Koufogiannakis and N. E. Young. Distributed fractional packing and maximum weighted b-matching via tail-recursive duality. DISC, pages 221 -- 238, 2009. [23] A. N. Letchford, G. Reinelt, and D. O. Theis. A faster exact separation algorithm for blossom inequalities. Proceedings of IPCO, LNCS 3064, pages 196 -- 205, 2004. [24] M. Luby and N. Nisan. A parallel approximation algorithm for positive linear programming. Proc. STOC, pages 448 -- 457, 1993. [25] J. Mestre. Greedy in approximation algorithms. ESA, pages 528 -- 539, 2006. [26] M. Müller-Hannemann and A. Schwartz. Implementing weighted b-matching algorithms: to- wards a flexible software design. J. Exp. Algorithmics, 4, 1999. 39 [27] M. W. Padberg and M. R. Rao. Odd minimum cut-sets and b-matchings. Mathematics of Operations Research, 7(1):67 -- 80, 1982. [28] S. A. Plotkin, D. B. Shmoys, and É. Tardos. Fast approximation algorithms for fractional packing and covering problems. Math. of OR, 20:257 -- 301, 1995. [29] A. Schrijver. Combinatorial Optimization - Polyhedra and Efficiency, volume 24 of Algorithms and Combinatorics. Springer, 2003. 40
1511.01287
2
1511
2017-02-02T12:38:21
Local Conflict Coloring
[ "cs.DS", "cs.DC" ]
Locally finding a solution to symmetry-breaking tasks such as vertex-coloring, edge-coloring, maximal matching, maximal independent set, etc., is a long-standing challenge in distributed network computing. More recently, it has also become a challenge in the framework of centralized local computation. We introduce conflict coloring as a general symmetry-breaking task that includes all the aforementioned tasks as specific instantiations --- conflict coloring includes all locally checkable labeling tasks from [Naor\&Stockmeyer, STOC 1993]. Conflict coloring is characterized by two parameters $l$ and $d$, where the former measures the amount of freedom given to the nodes for selecting their colors, and the latter measures the number of constraints which colors of adjacent nodes are subject to.We show that, in the standard LOCAL model for distributed network computing, if $l/d \textgreater{} \Delta$, then conflict coloring can be solved in $\tilde O(\sqrt{\Delta})+\log^*n$ rounds in $n$-node graphs with maximum degree $\Delta$, where $\tilde O$ ignores the polylog factors in $\Delta$. The dependency in~$n$ is optimal, as a consequence of the $\Omega(\log^*n)$ lower bound by [Linial, SIAM J. Comp. 1992] for $(\Delta+1)$-coloring. An important special case of our result is a significant improvement over the best known algorithm for distributed $(\Delta+1)$-coloring due to [Barenboim, PODC 2015], which required $\tilde O(\Delta^{3/4})+\log^*n$ rounds. Improvements for other variants of coloring, including $(\Delta+1)$-list-coloring, $(2\Delta-1)$-edge-coloring, $T$-coloring, etc., also follow from our general result on conflict coloring. Likewise, in the framework of centralized local computation algorithms (LCAs), our general result yields an LCA which requires a smaller number of probes than the previously best known algorithm for vertex-coloring, and works for a wide range of coloring problems.
cs.DS
cs
Local Conflict Coloring Pierre Fraigniaud∗1,2, Marc Heinrich†1,2, and Adrian Kosowski∗1,2 1CNRS and Paris Diderot University 2GANG Project, Inria Paris Abstract Locally finding a solution to symmetry-breaking tasks such as vertex-coloring, edge-coloring, max- imal matching, maximal independent set, etc., is a long-standing challenge in distributed network com- puting. More recently, it has also become a challenge in the framework of centralized local computation. We introduce conflict coloring as a general symmetry-breaking task that includes all the aforementioned tasks as specific instantiations - conflict coloring includes all locally checkable labeling tasks from [Naor & Stockmeyer, STOC 1993]. Conflict coloring is characterized by two parameters l and d, where the former measures the amount of freedom given to the nodes for selecting their colors, and the latter measures the number of constraints which colors of adjacent nodes are subject to. We show that, in the standard LOCAL model for distributed network computing, if l/d > ∆, then conflict coloring can polylog factors in ∆. The dependency in n is optimal, as a consequence of the Ω(log∗ n) lower bound by [Linial, SIAM J. Comp. 1992] for (∆ + 1)-coloring. An important special case of our result is a sig- nificant improvement over the best known algorithm for distributed (∆+ 1)-coloring due to [Barenboim, be solved in eO(√∆) + log∗ n rounds in n-node graphs with maximum degree ∆, where eO ignores the PODC 2015], which required eO(∆3/4) + log∗ n rounds. Improvements for other variants of coloring, including (∆ + 1)-list-coloring, (2∆ − 1)-edge-coloring, coloring with forbidden color distances, etc., also follow from our general result on conflict coloring. Likewise, in the framework of centralized local computation algorithms (LCAs), our general result yields an LCA which requires a smaller number of probes than the previously best known algorithm for vertex-coloring, and works for a wide range of coloring problems. Keywords: Distributed Network Computing, Symmetry Breaking, List-coloring, (∆ + 1)-coloring, Local Computation Algorithm. ∗Additional support from ANR project DISPLEXITY. †Supported by ENS Paris. 1 Introduction 1.1 Context and Objective Distributed network computing considers the computing model in which every node of a graph is an au- tonomous computing entity, and nodes exchange information by sending messages along the edges of the graph. In this context, symmetry breaking, which is arguably the most important problem in distributed network computing has attracted a lot of attention, and several local forms of symmetry breaking tasks have been considered, including the construction of proper graph colorings [5, 7, 25, 30, 33, 39], of maximal independent sets (MIS) [1, 26], of maximal matchings [18, 20], etc., to mention just a few. The main ques- tion in this framework is whether these tasks can be solved locally, i.e., by exchanging data between nodes at short distance in the network. To tackle the locality issue, the complexity of a distributed algorithm is measured in term of number of rounds in the LOCAL model [35], where a round consists in synchronously exchanging data along all the links of the network, and performing individual computations at each node. That is, a t-round algorithm is an algorithm in which every node exchanges data with nodes at distance at most t (i.e., at most t hops away) from it. It is worth taking the example of coloring for understanding the computational challenges induced by the question of locality in distributed network computing. The main concern of distributed coloring is solving the (∆ + 1)-coloring task, in which the nodes of a network G are free to choose any color from the set {1, . . . , ∆ + 1}, where ∆ is the maximum degree of G, as long as each node output a color that is different from all the colors output by its neighbors.1 Several breakthroughs were almost simultaneously obtained towards the end of the 1980's. Awerbuch, Goldberg, Luby, and Plotkin [2] devised a deterministic distributed (∆ + 1)-coloring algorithm running in a subpolynomial-in-n number of rounds, which was subsequently improved by Panconesi and Srinivasan [33] to run in 2O(√log n) rounds. Despite a quarter of a century of intensive research, this is still the best known distributed deterministic algorithm for (∆ + 1)-coloring in general graphs. Around the same time, Goldberg, Plotkin and Shannon [17] and Linial [25] designed distributed (∆ + 1)-coloring algorithms, performing in O(∆2 + log∗ n) rounds, where log∗ n denotes the least number of times the log-function should be applied on n to get a value smaller than one2. These algorithms are significantly faster than the one in [33] for graphs with reasonably small maximum degree (e.g., ∆ = O(logc n) for arbitrarily large constant c > 0). Interestingly, the achieved dependence in n is optimal for constant degree graphs, as [25] also proves that 3-coloring the n-node ring requires Ω(log∗ n) rounds, and this lower bound also holds for randomized algorithms [30]. As a consequence, since Linial's contributions to (∆ + 1)-coloring, lots of effort has been devoted to decreasing the time dependence in ∆ of coloring algorithms. Szegedy and Vishwanathan [39] show that a wide class of locally iterative algorithms for (∆ + 1)- coloring must perform in Ω(∆ log ∆) rounds, where an algorithm belongs to the locally iterative class if it has the property that, at each round, every node considers only its own current color together with the current colors of its neighbors, and updates its color value accordingly. This result was made more explicit by Kuhn and Wattenhofer [24], who considered an almost identically defined model and proposed a locally iterative algorithm performing in O(∆ log ∆ + log∗ n) rounds. Three years later, Barenboim and Elkin [5], and Kuhn [22] independently proposed distributed (∆+1)-coloring algorithms performing in O(∆+log∗ n) rounds (see also [8]). These latter algorithms are not iterative. Finally, Barenboim [3] recently presented a distributed (∆ + 1)-coloring algorithm performing in O(∆3/4 log ∆ + log∗ n) rounds. Other forms of coloring problems have also been tackled in the distributed network computing setting, including relaxations of the classical vertex coloring problem, such as: edge-coloring, weak-coloring, de- 1Solving k-coloring for k < ∆ + 1 cannot be local, even if G is ∆-colorable, because the decision of a node can impact nodes far away from it, as witnessed by 2-coloring even cycles [25]. 2Formally, define log(0) x = x, and log(k+1) x = log log(k) x for k ≥ 0; Then log∗ x denotes the least integer k such that log(k) x < 1. 1 fective coloring, vertex coloring with more than (∆ + 1) colors, etc. (see, e.g., [7] for a survey). In a number of practical scenarios, nodes aiming at breaking symmetry are also subject to more specific individual con- straints. This is typically the case in frequency assignments in radio networks [16, 41], in scheduling [29], and in digital signal processing [42], to mention just a few scenarios. In all these latter settings, each node u is not initially free to choose any value from a color set C, but is a priori restricted to choose only from some subset L(u) ⊆ C of colors. This framework is not captured by classical coloring, but rather by list-coloring. As in the case of vertex coloring, distributed list-coloring can be approached from a locality perspective only if the lists satisfy L(u) ≥ degG(u) + 1 for every node u of a graph G having degree degG(u). Vertex (∆ + 1)-coloring, as well as all of its previously mentioned relaxed variants, can be solved in o(∆) + O(log∗ n) rounds [7]. However, the more complex task of (∆ + 1)-list-coloring was (prior to this work) only known to be solvable in eO(C3/4) + O(log∗ n) [3] rounds, which is sublinear-in-∆ only for C = o(∆4/3). Moreover, no sublinear (in ∆) algorithms are known for MIS or maximal matching, for which the currently best algorithms run is O(∆) + log∗ n rounds [5, 7, 22]. (Again, the additional factor log∗ n is unavoidable, and can be seen as an inherent cost of distributed symmetry breaking [38]). In fact, there is evidence suggesting that no sublinear algorithms exist for these problems. For instance, for maximal matching, a time lower bound of Ω(∆ + log∗ s) is known to hold for an anonymous variant of the LOCAL model in which edges are equipped with locally unique identifiers from the range {1, . . . , s} [20]. In the standard LOCAL model, a lower bound of Ω(∆) is known to hold for the fractional variant of the maximal matching problem [18], while an Ω(∆/ log ∆ + log∗ n) lower bound holds for an extension of MIS called greedy coloring [15]. In order to better understand which tasks can be solved in a number of rounds sublinear in ∆, we focus on the general class of locally checkable labelings (LCL) introduced by Naor and Stockmeyer [31], which includes all tasks mentioned so far in this paper. Recall that a LCL is defined as a set of bad labeled balls in graphs, where the ball of radius r ≥ 0 centered at node u in a graph G is the subgraph of G induced by all nodes at distance at most r from u in G (excluding edges between nodes at distance exactly r from u), and where a label is assigned to each node. For instance, the bad balls for coloring are the balls of radius 1 in which the center node has the same label as one of its neighbors. Similarly, the bad balls for MIS are the balls of radius 1 for which either the center of the ball as well as one of its neighbors are both in the MIS, or none of the nodes in the ball are in the MIS. Every ball which is not bad is good. To each LCL is associated a distributed task in which all nodes of an unlabeled graph G must collectively compute a label at each node, such that all balls are good. Thus, our general objective is to tackle the following question: What LCL tasks can be deterministically solved in o(∆) + O(log∗ n) rounds? Given the state-of-the-art, we know since recently that answer to the above question is affirmative for (∆ + 1)-coloring [3], and there is also some very partial evidence hinting that this may not be true for MIS-type problems [18, 15]. This also leads us to ask what makes (∆ + 1)-coloring and MIS so different? In the study of the randomized LOCAL model, a separation in time complexity between (∆ + 1)-coloring and MIS has very recently been obtained by contrasting the randomized (∆ + 1)-coloring algorithms of Harris, Schneider, and Su [19] with lower bounds for MIS due to Kuhn, Moscibroda, and Wattenhoffer [23]. However, this separation does not carry over directly to the deterministic setting. Here, in an attempt to advance understanding of the question for the deterministic scenario, we put forward the framework of con- flict coloring, and show that efficient solutions to problems in the LOCAL model can be obtained by taking advantage of their amenability to the conflict coloring framework. 1.2 Our Results The setting. We define the general conflict coloring task, which can be instantiated so as to correspond to any given LCL task. Roughly, conflict coloring is defined by a list of candidate colors given to each node (in 2 the same spirit as list-coloring), and a list of conflicts between colors associated to each edge (following a convention used, e.g., when formulating unique games, CSP-s with binary conflict relations, etc.). For edge {u, v}, a conflict is a pair of the form (cu, cv), indicating that a coloring where u has color cu and v has color cv is illegal. Intuitively, given a LCL, the corresponding instance of conflict coloring is obtained by giving the list of all good balls centered at u to every node u, and two balls given to adjacent nodes are in conflict whenever they are not consistent. Every LCL task is therefore a possible instantiation of conflict coloring (a given LCL task may have more than one conflict coloring representation). Note however that the power of conflict coloring extends beyond such a formulation of LCL tasks: depending on the instance, two colors in conflict along an edge e do not, in general, need to be in conflict along another edge e′ 6= e. We will speak of a conflict coloring with lists of length l and conflict degree d, or more compactly of (l, d)-conflict-coloring, when all color lists given to the nodes are of length at least l, and for every edge e and color c, the number of colors conflicting with color c on edge e does not exceed d. Intuitively, the larger the value of l, the easier the problem is, as every node has a choice among a large number of outputs. Conversely, the larger d is, the harder the problem becomes as some nodes have to deal with many conflicts with at least one of their neighbors. Distributed algorithm. Our main result is the design of a generic distributed algorithm which solves the conflict coloring task whenever l/d > ∆ in graphs with maximum degree ∆. In the classical LOCAL model for distributed network computing, our algorithm performs in eO(√∆) + log∗ n rounds in n-node graphs, where the eO notation disregards polylogarithmic factors in ∆. The implications of our result are the following. There exists a trivial representation of (∆ + 1)-coloring as a conflict coloring task with l/d ≥ ∆ + 1. Therefore, our algorithm can be used to solve (∆ + 1)-coloring in eO(√∆) + log∗ n rounds, which outperforms the currently fastest known (∆ + 1)-coloring algorithm by Barenboim [3] performing in eO(∆3/4) + log∗ n rounds. In fact, for most classical variants of coloring, including (2∆ − 1)-edge-coloring, (∆ + 1)-list-coloring, coloring with forbidden color-distance sets [36] given a sufficiently large palette, etc., our algorithm solves all these tasks in eO(√∆) + log∗ n rounds, also improving the best results known for each of them. For small values of ∆, our (deterministic) algorithm for conflict coloring is even faster than the best known randomized algorithms for (∆ + 1)-coloring [19]. Interestingly, the bound l/d > ∆ is essentially the best bound for which there exists a generic algorithm solving conflict coloring locally. Indeed, for every l and d such that l/d ≤ ∆, there exists an instance of conflict coloring for which no solutions can be sequentially computed by a greedy algorithm selecting the nodes in arbitrary order. That is, the output of a node can impact the possible legal outputs of far away nodes in the network (like for ∆-coloring [25]). In particular, we are not aware of any instantiations of conflict coloring for MIS or maximal matching satisfying l/d > ∆, which prevents us from solving these problems with a generic algorithm for conflict coloring. It might well be the case that there are no instantiation of conflict coloring for these problems satisfying l/d > ∆, which might be another hint that there are no algorithms running in o(∆) + O(log∗ n) rounds for these tasks. The techniques. From a technical point of view, the design of our algorithm required the development of a new technique, called a simplification mechanism. This mechanism aims at iteratively reducing the difficulty of a given problem until it becomes simple enough to be trivially solved. More specifically, let P0 be the problem we are aiming at solving. Our mechanism constructs a sequence P1, . . . , Pt of problems with the following three properties: (1) Pk+1 is "easier" to solve than Pk, and can be constructed from Pk in O(1) rounds, (2) Pt is simple enough to be solved individually at each node, without any communication, and (3) given a solution to Pk+1, there is a O(1)-round algorithm computing a solution to Pk. Conflict coloring is perfectly suited to an application of the aforementioned simplification mechanism. Indeed, the set of colors in P0 are those in the lists given to the nodes in G. Constructing Pk+1 from Pk increases the size of the lists (which is good), but the number of conflicts between colors also increases (which is bad). 3 However, the increase rate of the number of conflicts will be shown to be lower than the increase rate of the size of the lists, which will eventually ensure that Pt is easily solvable thanks to large lists, but a relatively small number of conflicts. In conflict coloring, the main difficulty lies in obtaining a O(log∗ n)-round algorithm for solving an instance with ratio l/d ≥ 10~∆2 ln ∆, given a graph with maximum degree ∆ and edge orientation with maximum outdegree ~∆. Subsequently, the conflict coloring problem then turns out to be directly amenable to an application of the arbdefective coloring approach (cf. [6, 7]), without having to resort to constructions of polynomials of the type used in [3] during the recombination phase. This is because the class of conflict coloring problems solved by our algorithm includes precoloring extension (i.e., completing a partially given coloring of a graph), which can be handled directly through a modification of color lists available to vertices. By a careful (adaptive) choice of parameters of the arbdefective coloring, the complexity of our algorithm is reduced to eO(√∆) + log∗ n rounds. Disregarding polylogarithmic-in-∆ factors, the √∆-running time of our algorithm appears to be the limit of the precoloring extension technique, unless radically new algorithms are found to construct color- ings in O(log∗ n) rounds using significantly fewer colors than eO(∆2). This latter problem has resisted all attempts for more than 20 years, since the publication of [25]. Additional results. Our result has also impact on centralized local computation [12, 27, 28, 32, 37]. In this model, the local computation algorithm (LCA) is executed by a single computing unit which has access to the whole input graph, and needs to answer queries about a solution to the considered problem (e.g., "is node u in the MIS?"). For answering queries, the LCA probes the input graph, learning in each probe about some node u and its neighborhood. The answers to the queries provided by the LCA must be consistent, that is, there must exist an implicit global solution that fits with the answers of the LCA. The complexity of such an algorithm is the number of probes that the LCA performs per query. Using our algorithm for conflict coloring, we show that there is a deterministic oblivious LCA for solving (∆ + 1)-list-coloring (and thus also (∆ + 1)-coloring) using only ∆O(√∆ log5/2 ∆) log∗ n probes, improving the bound in [12]. 1.3 Other Related Work In addition to the aforementioned deterministic algorithms for (∆ + 1)-coloring, it is worth mentioning the randomized algorithms for MIS in [1, 26], which both perform in O(log n) rounds, with high probability. Both algorithms can be transformed into randomized (∆ + 1)-coloring algorithms with the same round- complexity (e.g., using the reduction in [25]). A "direct" randomized algorithm for (∆+1)-coloring with the same performances as these latter algorithms can be found in [7]. As a function of ∆ and n, the best known randomized algorithms for (∆ + 1)-coloring, as well as for (∆ + 1)-list-coloring, perform in O(√log ∆) + 2O(√log log n) rounds with high probability [19]. This result, combined with a previous lower bound on MIS of Ω(log ∆/ log log ∆) rounds [23], which also holds for randomized algorithms, implies a separation between the (∆ + 1)-coloring and MIS problems in the randomized case. On the positive side, MIS can be solved in O(log2 ∆) + 2O(√log log n) rounds with high probability [9]. We remark that the randomized and deterministic flavors of the LOCAL model are significantly different, and in fact admit an exponential time separation, which has been recently shown for specific case of the problem of coloring a tree with ∆ colors [10]. Whether a similar separation between randomized and deterministic complexity holds for MIS and the general (∆ + 1)-coloring problem is one of the main open questions of the field. The list-coloring problem was introduced independently by Vizing [40], and Erdos, et al. [11]. It is defined as follows. Let G be a graph, let C be a set of colors, and let L : V → 2C. If there exists a function f : V → C such that f (v) ∈ L(v) for every v ∈ V (G), and f (u) 6= f (v) for every {u, v} ∈ E(G), then G is said to be L-list-colorable. A graph is k-choosable, or k-list-colorable, if it has a list-coloring no matter how one assigns a list of k colors to each node. The choosability number ch(G) of a graph G is the 4 least number k such that G is k-choosable. Clearly, ch(G) ≥ χ(G), where χ(G) denotes the chromatic number of G. Computing the choosability number is actually believed to be harder than computing the chromatic number, because deciding the former is ΠP 2 -complete, while deciding the latter is NP-complete. In a distributed setting, (∆ + 1)-list-coloring is solvable in O(∆ + log∗ n) rounds by reduction to vertex- coloring. It was also recently proved to be solvable in time dependent on the size of the set of allowed colors, in eO(C3/4) + O(log∗ n) rounds [3]. It is also worth specifically mentioning the weak-coloring problem, which asks for a coloring of the nodes such that every non isolated node has at least one neighbor colored differently from it. It was proved in [31] that, in bounded-degree graphs with odd degrees, 2-weak-coloring can be solved in a constant num- ber of rounds. This is one of the rare non-trivial distributed symmetry-breaking tasks that are known to be solvable in a constant number of rounds (in general, it is undecidable whether a solution to a locally checkable task can be constructed in constant time [31]). In graphs with constant maximum degree, for all locally checkable tasks, as well as their probabilistic extension [14], any randomized construction algorithm running in a constant number of rounds can be derandomized into a deterministic algorithm running in the same number of rounds [31, 13]. However, this derandomization result does not necessarily hold for ran- domized algorithms running in a non-constant numbers of rounds. For example, it is not known whether there exists a deterministic (∆ + 1)-coloring algorithm running in a polylogarithmic number of rounds, or in other words, it is not known whether randomization helps for distributed (∆ + 1)-coloring. Many other types of coloring have been considered in the literature, including using a larger number of colors, coloring the edges instead of the nodes, defective coloring, etc., and some of these tasks have been tackled in specific classes of graphs (planar, bounded arboricity, etc.). We refer to [7] for an excellent survey, also describing the various techniques of reductions between coloring, MIS, maximal matching, etc. Regarding the centralized local model, essentially the same problems as for the distributed LOCAL model have been studied, such as, e.g., maximal independent set [37], and Maximum Matching [27], for which algorithms were devised. A recent paper [12] studies the relationship between the LOCAL model and the centralized local computation model, including ways to adapt algorithms from the LOCAL model to the centralized local setting. The resulting LCAs are deterministic and oblivious (they do not require to store information between queries), and, above all, they require a smaller number of probes than previously known algorithms. In particular, the method from [12] yields a centralized ∆2-coloring LCA running in O(poly(∆) · log∗ n) probes per query, and a centralized (∆ + 1)-coloring LCA running in ∆O(∆2) · log∗ n probes per query. 2 Model, Problem Setting, and Preliminaries 2.1 The LOCAL Model We consider the usual framework for the analysis of locality in network computing, namely the LOCAL model [35]. In this model, a network is modeled as a connected and simple n-node graph (i.e., no loops, and no multiple edges). Each node v of a network is given an identity, denoted by id(v). This identity is a positive integer that is assumed to be encoded on O(log n) bits, and the identities of the nodes in the same network are pairwise distinct. In addition, every node v may also be given an input inp(v) ∈ {0, 1}∗. For the sake of defining conflict coloring, we assume that the edges incident to a degree-δ node are identified by pairwise distinct labels in {1, . . . , δ}, called port numbers. No consistency between the port numbers at different nodes is assumed (in particular, an edge may have two different port numbers at its two extremities). Again, these port numbers are solely used for describing the input to every node in the context of conflict coloring, and provide no additional computing power to the LOCAL model (since nodes have identities). In any execution of an algorithm A in the LOCAL model, all nodes start at the same time. Initially, every 5 node is only aware of its identity, and its input. As is usual in the framework of network computing, and for simplifying the description of the algorithm, we also assume that each node initially knows a polynomial upper bound on the total number n of nodes. (See [21] for techniques enabling to get rid of this assumption). Then all nodes perform a sequence of synchronous rounds. At each round, every node sends a message to its neighbors, receives the messages of its neighbors, and performs some individual computation. Which mes- sages to send, and what computation to perform depend on the algorithm A. The complexity of algorithm A in n-node graphs is the maximum, taken over all n-node graphs G, of the number of rounds performed by A in G until all nodes terminate. Note that, whenever t is known a priori, an algorithm A performing in t rounds can be simulated by an algorithm B performing in two phases: First, in a network G, every node v collects all data from nodes at hop distance at most t from v (i.e., their identities, their inputs, as well as the structure of the connections between these nodes); Second, every node simulates the execution of A in BG(v, t), where BG(v, t) is the ball of radius t around node v in graph G, that is, BG(v, t) is the subgraph of G induced by all nodes at distance at most t from v, excluding the edges between the nodes at distance exactly t from v. Hence, the LOCAL model enables to measure the locality of a problem. An algorithm satisfying the property that the output of every node is the same for all possible identity assignments to the nodes of the network is called identity-oblivious, or ID-oblivious for short. Notation. We denote by degG(v) the degree of a node v in a graph G, that is the number of neighbors of v in G, or, alternatively, the number of edges incident to v in G (recall that G is a simple graph). We denote by ∆G = maxv∈V (G) degG(v) the maximum degree of the nodes in G. The set of neighbors of node v in graph G is denoted by NG(v). Given an orientation of the edges of G, the set of out-neighbors of v (nodes connected to v by edges having their tail at v) is denoted by ~NG(v), and the maximum node outdegree is denoted by ~∆G. When the graph G is clear from the context, the index G will be omitted from notation. 2.2 Conflict Coloring Conflict coloring is defined as follows. Let C be a finite set, whose elements are called colors. In graph G, each node u ∈ V (G) is given as input • a list L(u) of colors in C, and • for every port number i ∈ {1, . . . , degG(u)}, a list Ci(u) = (cid:0)(c1, c′1), . . . , (ck, c′k)(cid:1) of conflicts, where cj ∈ L(u) and c′j ∈ C for every j = 1, . . . , k. To be well defined, the instance must satisfy the constraint that if (c, c′) ∈ Ci(u) and u′ is the neighbor of u reachable from u via port i, then (c′, c) ∈ Cj(u′), where j is the port number of edge {u, u′} at u′. Each node u in G must output a color out(u) ∈ L(u) such that, for every edge {u, v} with port number i at u, we have (out(u), out(v)) /∈ Ci(u). That is, two adjacent nodes cannot be colored with a pair of colors that is indicated as a conflict for that edge. A given conflict coloring instance has conflict degree d if, for all colors c, there are at most d pairs of the form (c,·) in any of the lists Ci(u). The conflict degree d represents the maximum number of possible conflicts of one colors with other colors of one given neighbor. For instance, (∆ + 1)-coloring is the instance of conflict coloring with L(u) = {1, . . . , ∆ + 1}, and all conflict lists are of the form (c, c) for all c ∈ {1, . . . , ∆ + 1}. Expressing MIS as an instance of conflict coloring is not as straightforward. One way of doing this is the following. Assign lists of the form L(u) = {0, 1} × {1, . . . , ∆} to every node u. A color is thus a pair of integer values, where a color in the form of a pair (1, i), for any i ∈ {1, . . . , ∆}, is interpreted as "u ∈ MIS", and a color (0, i) is likewise interpreted as "u /∈ MIS, but the neighbor of u reachable via port i belongs to the MIS". We set a conflict along the edge from vertex v, following the i-th port to a neighboring vertex u, for all color pairs of the form 6 (1, j) at v and (1, k) at u, for all j, k ∈ {1, . . . , ∆}, as well as for all color pairs of the form (0, i) at v and (0, j) at u, for all j ∈ {1, . . . , ∆}. In fact, any LCL task can be expressed as an instance of conflict coloring. To see why, let us revisit MIS, and let us define MIS as an instance of conflict coloring in a brute force manner. One assigns L(u) = {S1, . . . , S2δ} to every node u of degree δ, where S1 is the (δ + 1)-node star with center labeled 1 and all leaves labeled 0, and, for j > 1, Sj is a (δ + 1)-node star with center labeled 0,(cid:0)δ x(cid:1) leaves labeled 1 for some x ∈ {1, . . . , δ}, and all other leaves labeled 0. Conflicts in Ci(u) are between incompatible stars Sj at u and S′k at u′ where the latter is the neighboring node of u reachable from u via port i. More generally, any LCL task can be expressed as an instance of conflict coloring by assigning to every node u a list of colors consisting of all good balls centered at u, and conflicts are between inconsistent balls between neighboring nodes. For the sake of describing our algorithm, we define the conflict graph F associated to an instance of conflict coloring on G = (V, E). The conflict graph F is the simple undirected graph with vertex set and edge set V (F ) = {(v, c) : v ∈ V (G), c ∈ L(v)}, E(F ) = {{(u, c), (u′, c′)} : (c, c′) ∈ Ci(u) where i = port number of {u, u′} ∈ E(G) at node u}. In other words, to every edge e = {u, u′} ∈ E(G) corresponds a bipartite graph with partitions L(u) and L(u′), and there is an edge between a color c ∈ L(u) and a color c′ ∈ L(u′) if and only if these two colors are in conflict for edge e. For a conflict coloring in a graph of maximum degree ∆, and conflict degree d, the conflict graph has degree at most d∆. Let us note that, in conflict coloring, there is an interplay between the size, l, of the lists of available colors at each node (the larger the better as far as solving the task is concerned), and the conflict degree, d, of the colors along each edge.We define (l, d)-conflict coloring as conflict coloring with all lists of size l, and the degree of the conflict graph is at most d. In the rest of the paper, we shall show that if the ratio between these two quantities is large enough, namely l/d > ∆, then (l, d)-conflict coloring in solvable in a sublinear (in ∆) number of rounds. For instance, (∆ + 1)-list-coloring corresponds to l = ∆ + 1, and d = 1, hence the ratio l/d is sufficient to be covered by our approach. By contrast, for the previously described representation of MIS as conflict coloring, we have l = 2∆ and d = ∆, hence l/d = 2.3 2.3 Organization and Proof Outline In Sections 3 and 4 we provide the techniques and algorithms for solving (l, d)-conflict coloring for l/d > ∆. Section 3 lays out the main ingredient, namely, a routine for conflict coloring in O(log∗ n) rounds when l/d ≥ 10∆2 ln ∆ in a graph of maximum degree ∆, or more generally when l/d ≥ 10~∆2 ln ∆ and an orientation of the edges of the graph with outdegree ~∆ is given. This is achieved by an application of our instance simplification technique, since the existence of color lists in the problem description precludes the application of simpler color reduction mechanisms (e.g., of the sort used by Linial [25] for ∆2-vertex color- ing). In Section 4 we then solve any conflict coloring problem with l/d > ∆ by applying the routines from Section 3 on specific vertex-disjoint oriented subgraphs of G. These subgraphs are carefully constructed using the technique of arbdefective coloring [3], in such a way as to have sufficiently small outdegree β for the condition l/d ≥ 10β2 ln ∆ to hold within them. Finally, in Section 5 we discuss implications of our conflict coloring routines for centralized LCAs, both in the case of l/d ≥ 10∆2 ln ∆ and l/d > ∆. 3A simple argument illustrating that l/d = 2 is essentially the best ratio which can be achieved when using natural conflict- coloring-based representations of MIS is given in Appendix A. 7 3 Instance Simplification Our simplification mechanism, which allows us to generate progressively easier conflict coloring problems on a graph G, is now captured by the following key lemma. We will apply it to "simplify" a (l, d)-conflict- coloring problem P = P0, such that l/d ≥ 10~∆2 ln ∆, into one with a larger ratio l/d. Lemma 3.1. Let G be a graph with maximum degree ∆ and a given edge orientation of outdegree at most ~∆. Let Pi be an instance of a (li, di)-conflict-coloring problem on graph G. Then, for some integers li+1, di+1, there exists an instance Pi+1 of (li+1, di+1)-conflict-coloring on graph G, such that: 1. There exists an ID-oblivious single-round local distributed algorithm which, given the input of each node in Pi, outputs for each node its input in Pi+1. 2. There exists an ID-oblivious single-round local distributed algorithm which, given any valid output of each node in Pi+1, outputs for each node a valid output for Pi. 3. The following condition is fulfilled for any ε > 0, when ~∆ is larger than a sufficiently large constant: li+1 di+1 > 1 ∆ exp 1 (e2 + ε)~∆2 li di! . (For improved readability, the proof of the Lemma is postponed to Appendix B at the end of the paper.) The construction used in the proof of Lemma 3.1 is the most technically involved part of our paper. Since the values of both l and d change in the steps of simplification mechanism, we inherently exploit the properties of conflict coloring, displaying that for our purposes, the class of conflict coloring problems needs to be addressed in its full generality of formulation. Indeed, even if the original problem P0 is chosen as a relatively simple task, such as a list coloring problem (with d = 1), all the subsequent problems Pi, i ≥ 1, which appear later on in the scheme, are of more general conflict form (with d > 1). The following lemma provides a criterion which allows us to determine the necessary number of itera- tions of the proposed simplification mechanism. It states that we can solve a (l, d)-conflict-coloring problem directly, without any further communication, given that the ratio l/d is sufficiently large, subject to some additional assumptions constraining the structure of the input instance. This is achieved through a greedy assignment of colors for the sufficiently simplified problem instance. Lemma 3.2. Consider an instance of the (l, d)-conflict coloring problem on a graph G with maximum degree ∆, such that the list of colors available to all nodes is {1, . . . , l}. Suppose the following information available to all nodes: • Each node v ∈ V receives its input inp(v) for the corresponding (l, d)-conflict coloring instance P for v, accompanied by an integer label λ(v) ∈ {1, . . . , s}, such that λ(V ) is a s-vertex-coloring of the graph (i.e., λ(u) 6= λ(v) for all {u, v} ∈ E(G)), If l • A promise is given to all nodes v ∈ V that inp(v) ∈ I, where I is a set known to all nodes. d > ∆sI, then a solution to P can be found in a local manner without communication (in 0 rounds). The proof of the lemma relies on the observation that all nodes can use their shared knowledge of set I to determine an assignment of non-conflicting colors to each possible input from I, without communication. 8 Proof. Let I′ = I × {1, . . . , s}. We construct the (l, d)-conflict-coloring as a simple function c : I′ → {1, . . . , l}, where the color out(v) of a node v with input inp(v) and label λ(v) is given as out(v) = c(inp′(v)), where inp′(v) = (inp(v), λ(v)). The function c is decided locally, by each node in an identical way, based only on knowledge of I′. To do this, we consider a fixed enumeration I′ = (inp′1, inp′2, . . . , inp′ I ′) of set I′. For i ∈ {1, . . . ,I′}, σ ∈ {1, . . . , ∆}, γ ∈ {1, . . . , l}, let Si,σ(γ) ⊆ {1, . . . , l} be the set of colors defined in inp′i as forbidden in a solution to P for a vertex initialized with inp′i, given that the σ-th neigh- bor of this vertex obtains color γ. Notice that, by the conflict degree constraint for problem P , we have Si,σ(γ) ≤ d, for all i, σ, γ. We now define function c over input set I′ sequentially and greedily, fixing for successive i = 1, . . . ,I′ the value c(inp′i) as the first (smallest) color value which can be assigned to a vertex having input inp′i without causing a conflict with any potentially neighboring vertex which has already been colored, i.e., which has input inp′j, for some j < i: c(inp′i) := min{1, . . . , l} \ [j<i,1≤σ≤∆ Si,σ(c(inp′j)) (1) Since each of the I′ possible input configurations conflicts with at most d colors of its neighbor, for each of its ∆ possible placements, and l > d∆I′ = d∆sI by assumption, it follows that using the rule (1) we can assign a color for all feasible inputs and labels of nodes without running out of colors. We also remark that, for all {u, v} ∈ E(G), we have λ(u) 6= λ(v) by assumption, hence inp′(u) = (inp(u), λ(u)) 6= (inp(v), λ(v)) = inp′(v). The correctness of the obtained conflict coloring out(v) = c(inp′(v)) now follows directly from the definition of function c (cf. Eq. (1)). We can now combine the claims of Lemma 3.1 and Lemma 3.2 to show that any conflict coloring prob- lem P0, given a sufficiently large initial ratio l0/d0, will after a small number of rounds be simplified by iterated application of Lemma 3.1 into a conflict coloring problem Pt, which is solvable without communi- cation in view of Lemma 3.2. This leads us to the main technical lemma of this Section. Lemma 3.3. For a graph G with maximum degree ∆, a s-coloring of the vertex set, and a given orientation of edges with maximum outdegree ~∆, where ~∆ is at least a sufficiently large constant, any instance of the d ≥ 10~∆2 ln ∆ can be solved with a local distributed algorithm in at (l, d)-conflict coloring problem with l most 3(log∗ max{s, l, ∆} − log∗ l d ) + 10 rounds. In particular, the number of rounds of the algorithm can be written as O(log∗ s + log∗ ∆ + log∗ d), where to obtain this bound we restrict excessively long color lists, so that l0 = d0⌈10∆2 ln ∆⌉. Proof. To allow for a more compact write-up, we do not optimize the exact values of constants in the d ≥ (e2 + 2 + ε′)~∆2 ln ∆, for any analysis. (In fact, the condition of the lemma can also be strengthened to l ε′ > 0, where e2 + 2 ≈ 9.39.) Throughout the proof, we will assume that ~∆ is sufficiently large that Clause 3 of Lemma 3.1 holds for the considered (l, d)-coloring problem with parameter ε = 0.1. Now, let P0 be the initially considered (l, d)-coloring problem (l0 = l, d0 = d). By iterating the simplification procedure from Lemma 3.1 in successive rounds, we obtain a sequence of problems Pi with a . Indeed, by applying Lemma 3.1 with ε = 0.1, we have for sufficiently large ~∆: rapidly increasing ratio li di l1 d1 1 > exp 10~∆2 ln ∆ − ln ∆! > exp (2.51 ln ∆) > ∆2.5 ln ∆ ≥ ~∆2.5 ln ∆. (e2 + 0.1)~∆2 9 Moreover, whenever li obtain for sufficiently large ~∆: di ≥ ~∆2.5 ln ∆, we have: ~∆ ≤ (cid:16) li li di ~∆2 ≥ (cid:16) li di(cid:17)1/5 log ∆4/5. We , hence di log ∆(cid:17)2/5 di − ln ∆! di! li di − ~∆2.5 li li 1 li+1 di+1 1 1 > exp > exp > exp (cid:18) li (e2 + 0.1)~∆2 (e2 + 0.1)~∆2 di(cid:19)0.2! . By an application of the above inequality over two successive steps, it follows that for all i ≥ 1 the following condition: li+2 di+2 > exp(cid:18) li di(cid:19) , holds when ~∆ is sufficiently large (we require l1/d1 > x to hold, where x is the solution to the equality exp[x0.2] = x5; we have x ≈ 2.45 · 1010, and we recall that l1/d1 > ~∆2.5). Thus, we have: log∗ lt dt − log∗ l0 d0 ≥ t 2 − 1, for all t ≥ 0. (2) We will now focus on finding a value of t such that Lemma 3.2 can be applied to problem Pt. In order to bound the size of the set I of feasible inputs for problems Pt in our sequence, we will assume that the initial (l0, d0)-coloring problem P0 is presented in standard interval form, i.e., so that the color lists of each vertex v ∈ V are identified with the set of consecutive integers, L(v) = {1, . . . , l0}. Should the initial color lists be of different form, a relabeling of colors by all nodes to obtain standard interval form can be performed in one computational round, preserving the conflict graph F0 up to isomorphism. Then, for a node v ∈ V , its input in P0 consists of a subset of forbidden color pairs from {1, . . . , l}2, assigned to each of the ports incident to v. By considering all possible input configurations, for given l0 and ∆ we define a set I0 of feasible input configurations of problem P0, obtaining: I0 ≤ 2∆l2 0. Set I0 can be computed locally (without communication) by all nodes of the graph. By iteratively applying Clause 1 of Lemma 3.1, we obtain that the input for a node v in problem Pt can be constructed by a t-round distributed ID-oblivious algorithm, using only the inputs of nodes in problem P0 within a radius-t ball around v in graph G. Given l0 and ∆, by considering all possible topologies of a radius-t ball of the graph and considering all possible inputs of P0 for nodes within this ball, each node can compute without communication a set It of feasible problem inputs for problem Pt. Since a radius-t ball in G contains fewer than 2∆t nodes, we obtain a rough bound on the size of set It: It < I02∆t Now we find a value of t for which the assumption lt dt Eq. (2), it suffices to choose any value of t which satisfies: < 22l2 0∆t+1 > ∆sIt of Lemma 3.2 is met. Taking into account (3) t ≥ 2 log∗(∆sIt) − 2 log∗ l0 d0 + 1. (4) 10 Moreover, in view of Eq. (3), we have: 2 log∗(∆sIt) ≤ 2 log∗(cid:0)∆s(2l2 0∆t+1)(cid:1) ≤ 2 log∗ max{s, l0, ∆} + 2 log∗ t + 8. d0 Taking into account (5), by a very rough bound, condition (4) is thus fulfilled for a suitably chosen value ) + 10. In particular, we have t = O(log∗ s + log∗ ∆ + log∗ d0). For this t = 3(log∗ max{s, l0, ∆}− log∗ l0 value t, we can solve problem Pt in zero rounds by Lemma 3.2 as long as it is represented in standard interval form (with color lists {1, . . . , lt} for each vertex); obtaining such a formulation requires one communication round. Overall, we obtain an algorithm for solving the (l0, d0)-conflict-coloring instance P0 in O(t) rounds, by constructing an instance of Pt from P0 in t rounds through t-fold application of Lemma 3.1, solving problem Pt in its standard interval form using Lemma 3.2, and eventually obtaining a solution to the original instance P0 after a further t rounds again in view of Lemma 3.1. This completes the proof of the Lemma. (5) Lemma 3.3 can be applied to solve (l, d)-conflict coloring on any graph G, using a O(∆2) initial col- oring, and an arbitrary orientation of its edges. This coloring is computed in log∗ n + O(1) rounds using Linial's algorithm [25]. We thus obtain the following theorem. (We note that we put ~∆ = ∆ in the claim of Lemma 3.3, whose claim holds if ∆ is at least a sufficiently large constant. The case of ∆ = O(1) can be handled separately, by first obtaining a O(∆2)-coloring of the graph using Linial's algorithm in O(log∗ n) rounds, and then solving the conflict coloring problem in a further O(∆2) = O(1) rounds by greedily as- signing in each round colors to all vertices of successive independent sets, corresponding to color classes of the given O(∆2)-coloring of G.) Theorem 3.1. There is a local distributed algorithm which solves the (l, d)-conflict-coloring problem in O(log∗ d + log∗ ∆) + log∗ n rounds when l d ≥ 10∆2 ln ∆. For example, for the special case of list coloring, this gives the following corollary. Corollary 3.1. There is a local distributed algorithm which finds a (10∆2 ln ∆)-list-coloring in log∗ n + O(log∗ ∆) rounds. In the next section, we will use Theorem 3.1 as a building block for solving conflict coloring instances with a smaller value of ratio l/d. 4 Conflict Coloring with a Small Number of Colors In this section we show how to apply the techniques from Section 3 to obtain a distributed solution to (l, d)-conflict coloring problems with l ≥ d · ∆ + 1, such as (∆ + 1)-list-coloring. Whereas we choose to speak of conflict colorings throughout the rest of the paper, we will no longer make use of the general structure of conflict colorings in our technical arguments. The reader focusing on results directly relevant to the (∆ + 1)-coloring problem may from now on assume that the problem being solved is (∆ + 1)-list-coloring (and specifically, that the conflict degree is d = 1), and in this context, may rely on Corollary 3.1 instead of Theorem 3.1 as the relevant ingredient used in the subsequent construction. In the designed algorithm we will also make use of the following recent result on arbdefective coloring, shown by Barenboim [3]. For β ≥ 0, a (possibly improper) vertex coloring of a graph G is said to be β- arbdefective if there is an orientation of the edges of G such that, for every node v, at most β out-neighbors of v have the same color as v. Lemma 4.1 ([3]). There is a distributed algorithm, parameterized by k ≥ 1, which, given any graph G with a ∆2-coloring of its vertex set, produces for β = O( ∆ k log ∆) a β-arbdefective k-coloring V = V1∪. . .∪Vk of G, together with a corresponding orientation of each G[Vi] having outdegree at most β. The running time of the algorithm is O(k log ∆) rounds. 11 Our conflict coloring procedure will assume our graph G is already equipped with a ∆2-coloring. This can be initially computed using Linial's algorithm [25], in log∗ n rounds. Lemma 4.2. Given a ∆2-vertex coloring of graph G of maximum degree at most ∆, there is an algorithm which solves any conflict-coloring instance on G having conflict degree at most d and color lists L such that L(v) ≥ d · degG(v) + 1 for all v ∈ V , in at most O(√∆ log1.5 ∆(log ∆ + log∗ d)) rounds. Proof. We restrict considerations to the case where ∆ is larger than some fixed constant ∆′ > 0; otherwise, an appropriate conflict coloring can be obtained in O(∆′2) = O(1) rounds by greedily assigning in each round colors to all vertices of successive independent sets, corresponding to color classes of the given ∆2- coloring of G. We will design a conflict-coloring procedure A, which satisfies the assumptions of the lemma. For a graph G, the procedure starts by constructing the β-arbdefective k-coloring V = V1 ∪ . . . ∪ Vk from Lemma 4.1, for a certain parameter k that will be explicitly stated later. Each of the subgraphs G[Vi] now has an edge orientation with maximum outdegree at most β = ∆ k log ∆, and its vertices are also equipped with locally unique identifiers in the range {1, . . . , ∆2} by virtue of the given ∆2-vertex coloring. Now, we are ready to solve the conflict-coloring problem on G for a given assignment of lists L such that L(v) ≥ d · degG(v) + 1 for all v ∈ V . Our algorithm proceeds in k stages, obtaining in the i-th stage a valid (final) conflict-coloring of G[Ui] for a specifically defined subset Ui ⊆ V1 . . . ∪ Vi (we let U0 = ∅), i.e., out(v) ∈ L(v) and the color pair (out(v), out(u)) is not forbidden for the edge (v, u), for all v ∈ Ui, u ∈ NG[Ui](v). Let Sv(u, cu) ⊆ L(v) denote the set of colors available to a node v which are in conflict with a color cu at neighboring node u; we recall that Sv(u, cu) ≤ d. For i ≥ 1, given a valid conflict-coloring of G[Ui−1] at the beginning of the stage, we create for each v ∈ Vi a list of colors L′(v) = L(v) \Su∈Ui−1∩NG(v) Sv(u, out(u)), which may be used at v to extend the conflict coloring of Ui−1. Now, we use Lemma 3.3 to perform a conflict coloring, restricted to color lists L′, for the oriented subgraph of G[Vi] induced by those vertices v ∈ Vi, for which the assumptions of the Lemma are satisfied (i.e., L′(v) ≥ 10dβ2 ln ∆). This coloring routine takes O(log∗ ∆ + log∗ d) rounds. We observe that if a vertex v ∈ Vi is colored during the phase, then it receives a color out(v) ∈ L′(v) ⊆ L(v), which does not conflict with the colors of any of its neighbors in Ui−1 or simultaneously colored vertices from Vi; we thus construct Ui by adding to Ui−1 all vertices colored in the current phase. If, on the other hand, if vertex v ∈ Vi does not receive a color, then we must have L′(v) < 10dβ2 ln ∆. By definition, L′(v) consists of the colors in L(v) which are not in conflict with colors chosen in a previous step. For a previously colored neighbor u ∈ Ui, the color out(u) is in conflict with at most d colors in L(v). Hence, the number of already colored neighbors is NG[Ui−1](v) ≥ (L(v) − L′(v))/d > degG(v) − 10β2 ln ∆. In other words, there are at most 10β2 ln ∆ neighbors of v who did not receive a color yet. Finally, at the end of the k-th stage of the coloring process, we are left with a set V ∗ = V \ Uk of We observe that our conflict-coloring of G can now be completed correctly by conflict-coloring the graph G∗ = G[V ∗]. We define ∆∗ = 10β2 ln ∆, having ∆∗ ≥ ∆G∗. Moreover, we can complete the conflict-coloring of G by merging the so-far obtained coloring out on Uk with the conflict-coloring of G∗, with inherited conflicting color pairs and color lists L∗ defined for v ∈ V ∗ as: Sv(u, out(u)). uncolored vertices. L∗(v) = L(v) \ [u∈Uk∩NG(v) Since L(v) ≥ d degG(v) + 1 and Uk ∩ NG(v) = degG(v) − degG∗(v), it follows that L∗(v) ≥ d degG∗(v) + 1, for all v ∈ V ∗. Thus, we may now complete procedure A by recursively applying A to find a list-coloring on G∗ with lists L∗, and merge the obtained colorings for Uk and V ∗. By assumption, 12 procedure A on G∗ must be given a (∆∗)2-vertex coloring of G∗, which we can compute using Linial's color reduction mechanism, based on the given ∆2-coloring of G, in log∗ ∆ rounds. Overall, denoting by TA(∆) an upper bound on the running time of algorithm A on a graph of maximum degree at most ∆, we obtain the following bound: TA(∆) ≤ O(k log ∆) + O(k(log∗ ∆ + log∗ d)) + O(log∗ ∆) + TA(O(β2 log ∆)), where the first component of the sum comes from the routine of Lemma 4.1, the second one is the time of the k stages of coloring graphs G[Vi], the third stage is the time of (∆∗)2-coloring graph G∗, and the final stage comes from the recursive application of procedure A. Taking into account that β = O( ∆ k log ∆), we obtain: TA(∆) ≤ O(k(log ∆ + log∗ d)) + TA(O( ∆2 k2 log3 ∆)). The above expression is minimized for an appropriately chosen (sufficiently large) value k = O(p∆ log3 ∆), for which we eventually obtain TA(∆) = O(√∆ log1.5 ∆(log ∆ + log∗ d)). We thus obtain the main result of our paper. Theorem 4.1. There is a distributed algorithm which solves any conflict-coloring instance on G with con- flict degree at most d and color lists L such that L(v) ≥ d degG(v) + 1 for all v ∈ V , in at most O(√∆ log1.5 ∆(log ∆ + log∗ d)) + log∗ n rounds. We remark that, for any conflict coloring problem in which the conflict degree d is constant or bounded by any reasonable function of ∆ (i.e., log∗ d = O(log ∆)), the obtained round complexity simplifies to O(√∆ log2.5 ∆) + log∗ n. In particular, for the case of (∆ + 1)-list-coloring, we have d = 1, giving the following corollary. Corollary 4.1. There is a distributed algorithm for the distributed (∆+1)-list-coloring problem, performing in O(√∆ log2.5 ∆) + log∗ n rounds. 5 A Centralized Local Algorithm for Conflict-Coloring In this section, we provide algorithms for solving the conflict coloring problem in the model of centralized local computation. These LCAs are obtained by adapting our distributed algorithms for the LOCAL model to the centralized local model, using the guidelines in [12]. As a special case, we obtain an LCA for (∆ + 1)- coloring algorithm with a smaller probe complexity (in terms of n and ∆) than the best previously known approach. Throughout this section we assume a reasonably small conflict degree for the problem (i.e., log∗ d = O(log ∆)). Theorem 5.1. There is a deterministic oblivious LCA for solving an instance of (l, d)-conflict coloring, satisfying the following: • if l/d ≥ 10∆2 ln ∆, then the algorithm performs ∆O(log∗ ∆) log∗ n probes per query. • if l/d > ∆, then the algorithm performs ∆O(√∆ log2.5 ∆) log∗ n probes per query. Proof. The proof relies on the method from [34] for simulating distributed algorithms for the LOCAL model in the centralized local model (cf. also [37, 12]). Suppose that we have a distributed local algorithm running in r rounds. We can simulate its execution in the centralized local model with ∆r probes, as follows: to answer a query for a node v, we probe the whole r-neighborhood of v, and then run the local algorithm on this neighborhood. Applying this technique directly to a distributed conflict coloring algorithm whose 13 runtime is of the form O(f (∆)) + log∗ n, where f represents some non-decreasing function, we would get an LCA with probe complexity ∆O(f (∆))+log∗ n. To get the log∗ n term out of the exponent, we modify the method in [12] a bit. For this purpose, notice that if we assume that we already know a ∆2-coloring of G, then our conflict-coloring algorithms perform in a distributed manner in a number of rounds dependent on ∆, only (cf. Lemma 3.3 and Lemma 4.2, respectively, for the two considered cases of the problem). Moreover, there exists an LCA for ∆2-coloring which performs in O(poly(∆)) log∗ n probes per query, due to [12]. We thus propose an LCA for (l, d)-conflict-coloring, which, in order to solve a query for a vertex v, performs in two phases: 1. Perform multiple runs of the ∆2-coloring LCA from [12] for queries corresponding to all nodes in the r-neighborhood of v; 2. Simulate r rounds of a distributed algorithm for (l, d)-conflict-coloring for node v using the given ∆2-coloring of the r-neighborhood of v. The first phase requires ∆rpoly(∆) log∗ n probes of the input graph (i.e., poly(∆) log∗ n probes for each of the ∆r queries pased to the ∆2-coloring LCA), while the second phase does not require any additional probes. To be able to run the (l, d)-conflict-coloring algorithm on the r-neighborhood, for the case l/d ≥ 10∆2 ln ∆, we set r = c log∗ ∆, for some sufficiently large positive constant c (cf. Lemma 3.3). This yields an LCA performing ∆O(log∗ ∆) log∗ n probes per query. We apply essentially the same method for the case l/d > ∆, putting r = c√∆ log2.5 ∆ for some sufficiently large positive constant c (cf. Lemma 4.2). We obtain an LCA performing ∆O(√∆ log2.5 ∆) log∗ n probes per query. Considering list-coloring as a special case of conflict-coloring, we get the following corollary. Corollary 5.1. There is a deterministic oblivious LCA for list-coloring, which runs in ∆O(log∗ ∆) log∗ n probes per query when all color lists are of length at least 10∆2 ln ∆, and in ∆O(√∆ log2.5 ∆) log∗ n probes per query when all color lists are of length at least ∆ + 1. 6 Conclusion This paper presents the problem of (l, d)-conflict-coloring in a twofold light. First of all, we show that it is a generalization of numerous symmetry-breaking tasks, which can be solved efficiently in a distributed setting. Secondly, we rely on conflict coloring as a tool to describe intermediate instances of tasks when applying the simplification technique used in our algorithms (cf. Lemma 3.1). In view of our results, the deterministic round complexities of (∆+1)-coloring, (∆+1)-list-coloring, and (l, d)-conflict-coloring with l/d > ∆, all collapse to eO(√∆) + log∗ n rounds. The sufficiently large value of the ratio l/d in the conflict coloring formulation appears to be what sets these problems apart from not easier tasks, such as MIS, for which no approaches with deterministic o(∆) + log∗ n runtime are currently known. We close the paper by remarking briefly on practical aspects, related to the amount of local computations which individual nodes need to perform to run the proposed algorithms. The most computationally-intensive steps are related to Lemma 3.2, which relies on an enumeration of a potentially large set of inputs I to perform a color assignment to each element of the set. The size of this set I, and consequently the complexity of local computations of our algorithms, can be bounded as 2∆O(log∗ ∆). This value is polynomially bounded with respect to n for values of ∆ = (log n)o(1/ log∗ n). Since the enumeration of set I is the only bottleneck in our algorithms, there exist several ways of speeding up local computations. For example, one can introduce into the algorithms an element of non-uniformity with respect to maximum degree ∆, and for a given upper bound on ∆, construct the solution in Lemma 3.2 through a pre-computed hash function on set I, known 14 to the algorithm, rather than a greedy color selection algorithm. This reduces the local computation time of our algorithms to ∆O(log∗ ∆), while preserving the same asymptotic bounds on the round complexity. In the context of LCA's discussed in Section 5, the cost of local computations in the approach is comparable to its probe complexity. In this sense, our algorithms may be considered satisfactory from a practical perspective in almost the entire range of ∆ sub-polynomial in n, which is naturally the main area of focus. 15 References [1] N. Alon, L. Babai, and A. Itai. A fast and simple randomized parallel algorithm for the maximal independent set problem. J. Algorithms 7(4):567-583, 1986. [2] B. Awerbuch, A.V. Goldberg, M. Luby, S.A. Plotkin. Network Decomposition and Locality in Dis- tributed Computation. In Proc. 30th Annual Symposium on Foundations of Computer Science (FOCS), pp. 364-369, 1989. [3] L. Barenboim. Deterministic (∆ + 1)-coloring in sublinear (in ∆) Time in Static, Dynamic and Faulty Networks. In Proc. 34th ACM Symp. on Principles of Distributed Computing (PODC), pp. 345-354, 2015. [4] L. Barenboim and M. Elkin. Sublogarithmic distributed MIS algorithm for sparse graphs using Nash- Williams decomposition. In Proc. 27th ACM Symp. on Principles of Distributed Computing (PODC), pp. 25-34, 2008. [5] L. Barenboim and M. Elkin. Distributed (∆ + 1)-coloring in linear (in ∆) time. In Proc. 41th ACM Symp. on Theory of Computing (STOC), pp. 111-120, 2009. [6] L. Barenboim and M. Elkin. Deterministic distributed vertex coloring in polylogarithmic time. In Proc. 29th ACM Symp. on Principles of Distributed Computing (PODC), pp. 410-419, 2010. [7] L. Barenboim and M. Elkin. Distributed Graph Coloring: Fundamentals and Recent Developments. Synthesis Lectures on Distributed Computing Theory, Morgan & Claypool Publishers, 2013. [8] L. Barenboim, M. Elkin, and F. Kuhn. Distributed (∆ + 1)-coloring in linear (in ∆) time. SIAM J. Comput. 43(1):72-95 (2014) [9] L. Barenboim, M. Elkin, S. Pettie, and J. Schneider. The locality of distributed symmetry breaking. In Proc. 53rd IEEE Symp. on Foundations of Computer Science (FOCS), pp. 321-330, 2012. [10] Y-J. Chang, T. Kopelowitz, S. Pettie, An Exponential Separation Between Randomized and Determin- istic Complexity in the LOCAL Model, http://arxiv.org/abs/1602.08166. [11] P. Erdos, A.L. Rubin, and H. Taylor. Choosability in graphs. In Proc. West Coast Conf. on Combina- torics, Graph Theory and Computing, Congres. Num. 26, pp. 125-157, 1979. [12] G. Even, M. Medina, and D. Ron. Deterministic Stateless Centralized Local Algorithms for Bounded Degree Graphs. Proc. 22nd Annual European Symposium on Algorithms (ESA) pp. 394-405, 2014. [13] L. Feuilloley and P. Fraigniaud. Randomized Local Network Computing. In Proc. 27th ACM Symp. on Parallelism in Algorithms and Architectures (SPAA), pp. 340-349, 2015. [14] P. Fraigniaud, A. Korman, and D. Peleg. Towards a complexity theory for local distributed computing. J. ACM 60(5):35 (2013) [15] C. Gavoille, R. Klasing, A. Kosowski, L. Kuszner, and A. Navarra. On the complexity of distributed graph coloring with local minimality constraints. Networks 54(1):12-19 (2009) [16] N. Garg, M. Papatriantafilou, and P. Tsigas. Distributed list-coloring: how to dynamically allocate frequencies to mobile base stations. In Proc. 8th IEEE Symp. on Parallel and Distributed Processing (SPDP), pp. 18-25, 1996. 16 [17] A.V. Goldberg, S.A. Plotkin, G.E. Shannon. Parallel Symmetry-Breaking in Sparse Graphs. SIAM J. Discrete Math. 1(4): 434-446 (1988). [18] M. Goos, J. Hirvonen, and J. Suomela. Linear-in-Delta lower bounds in the LOCAL model. In Proc. 33rd ACM Symp. on Principles of Distributed Computing (PODC), pp. 86-95, 2014. [19] D.G. Harris, J. Schneider, H-H. Su: Distributed (∆ + 1)-Coloring in Sublogarithmic Rounds, In Proc. 48th Annual Symposium on the Theory of Computing (STOC), 2016, to appear. [20] J. Hirvonen and J. Suomela. Distributed maximal matching: greedy is optimal. In Proc. 31st ACM Symp. on Principles of Distributed Computing (PODC), pp. 165-174, 2012. [21] A. Korman, J.-S. Sereni, and L. Viennot. Toward more localized local algorithms: removing assump- tions concerning global knowledge. Distributed Computing 26(5-6): 289-308 (2013) [22] F. Kuhn. Weak graph colorings: distributed algorithms and applications. In Proc. 21st ACM Symp. on Parallel Algorithms and Architectures (SPAA), pp. 138-144, 2009. [23] F. Kuhn, T. Moscibroda, and R. Wattenhofer. What cannot be computed locally! In Proc. 23rd ACM Symp. on Principles of Distributed Computing (PODC), pp. 300-309, 2004. [24] F. Kuhn and R. Wattenhofer. On the complexity of distributed graph coloring. In Proc. 25th ACM Symp. on Principles of Distributed Computing (PODC), pp. 7-15, 2006. [25] N. Linial. Locality in Distributed Graph Algorithms. SIAM J. Comput. 21(1): 193-201 (1992) [26] M. Luby. A simple parallel algorithm for the maximal independent set problem. SIAM J. on Computing 15:1036-1053 (1986) [27] Y. Mansour, A. Rubinstein, S. Vardi, and N. Xie. Converting online algorithms to local computation algorithms. In Proc. 39th Int. Colloq. on Automata, Languages, and Programming (ICALP), pp. 653- 664, 2012. [28] Y. Mansour and S. Vardi. A local computation approximation scheme to maximum matching. In proc. 16th APPROX- 17th RANDOM, Springer LNCS 8096, pp. 260-273, 2013. [29] D. Marx. Graph coloring problems and their applications in scheduling. Periodica Polytechnica Ser. El. Eng. 48(1):11-16 (2004) [30] M. Naor. A lower bound on probabilistic algorithms for distributive ring coloring. SIAM J. on Discrete Mathematics 4(3):409-412, 1991. [31] M. Naor and L.J. Stockmeyer. What Can be Computed Locally? SIAM J. Comput. 24(6):1259-1277 (1995) [32] H. Nguyen and K. Onak. Constant-time approximation algorithms via local improvements. In proc. 49th IEEE Symp. on Foundations of Computer Science (FOCS), pp. 327-336, 2008. [33] A. Panconesi and A. Srinivasan. Improved Distributed Algorithms for Coloring and Network Decom- position Problems. In Proc. 24th ACM Symp. on Theory of Computing (STOC), pp. 581-592, 1992. [34] M. Parnas and D. Ron. Approximating the minimum vertex cover in sublinear time and a connection to distributed algorithms. Theor. Comp. Sci. 381(1-3):183-196 (2007) [35] D. Peleg. Distributed Computing: A Locality-Sensitive Approach. SIAM, Philadelphia, PA, 2000. 17 [36] F. R. Roberts. T-colorings of graphs: recent results and open problems. Discrete Mathematics 93:229- 245 (1991) [37] R. Rubinfeld, G. Tamir, S. Vardi, and N. Xie. Fast local computation algorithms. In Proc. Innovations in Computer Science (ICS), pp. 223-238, 2011. [38] J. Suomela. Survey of local algorithms. ACM Comput. Surv. 45(2):24 (2013) [39] M. Szegedy and S. Vishwanathan: Locality based graph coloring. In Proc. 25th ACM Symp. on Theory of Computing (STOC), pp. 201-207, 1993. [40] V. G. Vizing. Coloring the vertices of a graph in prescribed colors. Diskret. Analiz. 29:3-10 (1976) [41] W. Wang and X. Liu. List-coloring based channel allocation for open-spectrum wireless networks. In Proc. 62nd IEEE Vehicular Technology Conf. (VTC), pp. 690-694, 2005. [42] T. Zeitlhofer and B. Wess. List-coloring of interval graphs with application to register assignment for heterogeneous register-set architectures. Signal Processing 83(7): 1411-1425 (2003) Acknowledgements We have revised Lemma 3.3 and its proof following comments from Michael Elkin and Mohsen Ghaffari. 18 A Remark on Conflict Coloring Formulations for MIS The Proposition below shows that there does not exist a (l, d)-conflict coloring formulation of MIS with a ratio l/d > 2, which can be decoded by nodes into a valid MIS by a deterministic local algorithm without subsequent communication. The argument is laid out for the trivial case of a star, i.e., for a tree of diameter 2, and is intended mainly to highlight the general point that the constraints of the MIS problem cannot be conveniently expressed through sets of constraints on individual edges of the graph. Proposition A.1. Suppose graph G is a star and consider any instance of (l, d)-conflict-coloring over color set C on G. If there exists a function f : C → {0, 1}, such that a solution c : V → C to the considered conflict coloring problem is valid if and only if {v ∈ V : f (c(v)) = 1} is a MIS on G, then l/d ≤ 2. Proof. Let L(v) be the list of colors allowed for a vertex v ∈ V in the considered conflict coloring instance on the star. Let L1(v) ⊆ L(v) be the set of all colors a ∈ L(v) such that f (a) = 1 and color a may be assigned to vertex v in at least one valid solution to the considered conflict coloring instance, and let L0(v) = L(v)\ L1(v). Fix r to be the central vertex of the star. Since each of the two possible MIS's on the star must correspond to some solution to the considered conflict coloring problem, we have L0(r) 6= ∅ and L1(r) 6= ∅. A conflict must exist between each color of L1(r) and each color of L1(u), for all u 6= r, since otherwise one could extend some conflict coloring c of G \ {u}, for which f (c(r)) = 1, in such a way that f (c(u)) = 1, which does not correspond to a valid MIS. It follows that d ≥ maxu∈V \{r} L1(u). Moreover, for each color a ∈ L0(r), there must exist a vertex w 6= r such that for the edge {r, w}, color a at vertex r is in conflict with all colors b ∈ L0(w) at vertex w; otherwise, we could construct a valid conflict coloring in which c(r) = a and c(w) = b. This would be a contradiction since neither w nor its only neighbor r would not be in the corresponding MIS because f (c(r)) = f (c(w)) = 0. It follows that d ≥ L0(w). By combining the last two observations, we have 2d ≥ L0(w) + maxu∈V \{r} L1(u) ≥ L0(w) + L1(w) ≥ l, which gives the claim. B Proof of Lemma 3.1 We construct instance Pi+1 = (Li+1, Fi+1) over color set Ci+1 from instance Pi = (Li, Fi) over color set Ci as follows. We define the color set Ci+1 as the collection of all the subsets of size ki = ⌊ li e2di ~∆⌋ of Ci. For each node v, we will now appropriately define its color list Li+1(v) ⊆(cid:0)Li(v) ki (cid:1) by selecting into Li+1(v) a constant proportion of all ki-element-subsets of Li(v). The adopted value of parameter ki is the result of a certain tradeoff: increasing ki further would indeed increase the list length li+1, but would also result in an explosion of the number of conflicts di+1 (the ratio li+1/di+1 needs to be controlled in view of Clause 3). The details of the construction of lists Li+1 are deferred until later in the proof. Next, let τi = ⌊ ki ~∆⌋ − 1 be a threshold parameter, which we will use to define the edge set of the conflict graph Fi+1. For a pair of neighboring nodes {u, v} ∈ E, we denote by Su i (v, cv) the set of all colors at vertex u in conflict with color cv at vertex v in problem Pi. We now define the following symmetric conflict relation (∼) on V × Ci+1 for the problem Pi+1: (u, Cu) ∼ (v, Cv) ⇔(cid:26) When looking a the left-hand-side of the above relation, it is convenient to think of Cu and Cv as candidates for color values, which are being considered for inclusion in the lists Li+1(u) and Li+1(v) of nodes u and v, respectively, in problem Pi+1. When looking at the right-hand side, we treat Cu and Cv as sets of colors with respect to problem Pi. Subsequently, when defining the color lists in problem Pi+1, we or (cid:12)(cid:12)Cu ∩Scv∈Cv Su (cid:12)(cid:12)Cv ∩Scu∈Cu Sv i (v, cv)(cid:12)(cid:12) > τi i (u, cu)(cid:12)(cid:12) > τi 19 will eliminate those configurations of candidates which generate too many conflicts in node neighborhoods in problem Pi. The above relation, when restricted to permissible vertex colors, defines conflict edges for Fi+1: given colors Cu ∈ Li+1(u) and Cv ∈ Li+1(v) (where we recall that Cu ⊆ Li(u) and Cv ⊆ Li(v)), we put: {(u, Cu), (v, Cv)} ∈ E(Fi+1) ⇐⇒ (u, Cu) ∼ (v, Cv). (6) For this definition of the edge set of Fi+1, we immediately show how to convert any valid solution to Pi+1 into a solution for Pi in a single communication round. Indeed, observe that if a node v knows its output outi+1(v) for Pi+1 and the outputs of all its out-neighbors in the considered orientation, then it can obtain a valid color in Pi by returning an arbitrary element of the set outi+1(v) which does not conflict with any of the colors belonging to the corresponding sets of its out-neighbors: outi(v) ∈ outi+1(v) \ [u∈ ~NG(v) [cu∈outi+1(u) Sv i (u, cu). (7) Since, by assumption, the considered solution to Pi+1 was correct, we have (u, outi+1(u)) 6∼ (v, outi+1(v)). It follows from the definition of relation (∼) that in the right-hand-side of expression (7), each element of the union over u ∈ ~NG(v) eliminates at most τi elements from the set outi+1(v). Moreover, since we have outi+1(v) = ki ≥ ~∆τi + 1, the set from which we are choosing outi(v) is always non-empty. Finally, the construction of (7) is such that color outi(v) cannot conflict with any other color assigned to any of its neighbors in the obtained solution to Pi. Thus the obtained solution to Pi is conflict-free with respect to every edge of G, which completes the proof of Clause 2 of the Lemma. In the rest of the construction, we focus on a careful construction of color lists Li+1(v) ⊆(cid:0)Li(v) to ensure the local constructibility of the input instance to Pi+1 in a single round (Clause 1) and a sufficiently large ratio li+1/di+1 (Clause 3). The value of di+1 will be fixed as: ki (cid:1), so as di+1 := 8∆(cid:18)kidi τi (cid:19)(cid:18) li ki − τi(cid:19). 2 (cid:27) We will proceed with the construction of lists Li+1 by including all ki-element subsets of Li(v) in Li+1(v), and then we eliminate some colors from Li+1(v) which would generate too many conflicts in Pi+1 with any of the possible colors for neighbors u ∈ NG(v). Formally, for all v ∈ V , we set: Di,v(u) :=(cid:26)Cv : {Cu : (u, Cu) ∼ (v, Cv)} > Li+1(v) :=(cid:18)Li(v) ki (cid:19) \ [u∈NG(v) The above setting guarantees that the conflict degree bound of di+1 is indeed satisfied by problem Pi+1. We ki(cid:1) is met for all vertices. To lower bound the size of Li+1(v), 2(cid:0) li now show that the condition Li+1(v) ≥ 1 ki(cid:1) subsets are removed from Li+1(v) when 2∆(cid:0) li we will prove that for each neighbor u of a node v, at most 1 considering conflicts between u and v. Claim B.1. For any v ∈ V and u ∈ NG(v), we have: 2∆(cid:18) li ki(cid:19) Di,v(u) ≤ Di,v(u) (8) (9) di+1 1 20 2 with on its nodes. Our goal is to bound the number of vertices in partition Av having degree at least di+1 Proof. Consider the bipartite graph with vertex partition Av∪Au, where Av = {(v, Cv) : Cv ∈(cid:0)Li(v) ki (cid:1)} and Au = {(u, Cu) : Cu ∈(cid:0)Li(u) ki (cid:1)}, and a set of edges E∼ defined by the conflict relation (u, Cu) ∼ (v, Cv) respect to E∼ . We will first bound the number of edges in E∼ as follows. For a fixed set Cu ∈(cid:0)Li(u) ki (cid:1), we bound the number x1 of sets Cv ∈(cid:0)Li(v) ki (cid:1) satisfying the first of the conditions which appear in the definition of relation (∼): i (v, cv)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Cu ∩ [cv∈Cv i (v, cv) ≤Pcv∈Cv di = kidi. It follows that x1 can be bounded i (v, cv), and so Scv∈Cv Su x1 ≤(cid:18)kidi ki − τi(cid:19) = τi (cid:19)(cid:18) li i (u, cu)(cid:12)(cid:12) > τi), is also 1 ki(cid:1). Overall, we have: 8∆ di+1(cid:0) li ki(cid:19). di+1(cid:18) li Taking into account that Pi is an instance of conflict coloring with conflict degree at most di, for any color cv at v we have Su by the following expression: Thus, overall, the number of edges of E∼ satisfying Eq. (10) is at most x1Au ≤ 1 symmetric argument, the number of edges contributed by the other condition in the definition of relation (∼) (i.e.,(cid:12)(cid:12)Cv ∩Scu∈Cu Sv ki(cid:1). By a 8∆ di+1(cid:0) li E∼ ≤ 1 8∆ di+1. Su > τi. (10) 1 4∆ The average degree δ∼ of a node in Av with respect to E∼ is thus bounded by δ∼ ≤ 1 most Av2∆ = 1 ki(cid:1) nodes in Av can have a degree higher than 2∆δ∼ ≤ di+1 2∆(cid:0) li As a direct corollary of the above claim and of the definition of Li+1(v) in (8), we have obtained the ki(cid:1). Formally, to guarantee that Pi+1 is an instance of a (li+1, di+1)-conflict- 2(cid:0) li sought bound Li+1(v) ≥ 1 coloring problem with lists of size precisely equal to: 4∆ di+1. Since only at 2 , the claim follows. li+1 := 1 ki(cid:19), 2(cid:18) li in the case when the size of some Li+1(v) still exceeds li+1, node v removes arbitrarily some elements of Li+1(v) so that its size becomes exactly li+1. Bearing in mind the description of color lists Li+1 according to Eq. (8) and the edges of the conflict graph Fi+1 according to Eq. (6), a single-round distributed algorithm for computing an instance of Pi+1 based on an instance of Pi follows directly from the construction. This completes the proof of Clause 1 of the Lemma. Finally, we complete the proof of the lemma with the following claim, which shows that Clause 3 is also satisfied. Claim B.2. For any ε > 0, the following inequality holds when ~∆ is at least a sufficiently large constant: li+1 di+1 > 1 ∆ exp 1 (e2 + ε)~∆2 li di! . 21 Proof. Using the inequality n! ≥(cid:0) n li+1 di+1 e(cid:1)n, and the definitions of li+1, di+1, ki, and τi, we get: (cid:0) li ki(cid:1)/2 8∆(cid:0)kidi τi (cid:1)(cid:0) li ki−τi(cid:1) τi!(kidi − τi)!(ki − τi)!(li − ki + τi)! (li − ki)τi τi! i (kidi)τi ≥ kτi ki!(li − ki)!(kidi)! 16∆ 16∆ ek2 1 1 = = ≥ 1 i di (cid:19)τi 16∆(cid:18) (li − ki)τi e2di ~∆ − 1, and so li ≥ e2di ~∆ki, we can e2di ~∆⌋ ≥ li (11) li Taking into account that τi = ⌊ ki lower-bound the base of the last expression in (11) as: ~∆⌋ − 1 ≥ ki ~∆ − 2, ki = ⌊ (li − ki)τi i di ≥ ek2 ~∆ − 2) i di ek2 (e2di ~∆ki − ki)( ki = e(cid:18)1 − > e 1 − e2di ~∆(cid:19) 1 − ki ! . 1 ~∆ − 2~∆ 1 2~∆ ki ! In what follows, we assume that li di true (since li+1 and so: di+1 ≥ 1 always holds). We obtain that for sufficiently large ~∆, ki ≥ ~∆ ln ~∆ − 1 > 1 > e2 ~∆2 ln ∆ ≥ e2 ~∆2 ln ~∆; otherwise, the claim of the lemma is trivially ~∆ ln ~∆, 2 (li − ki)τi ek2 i di > e 1 − > e(cid:18)1 − 2~∆ ki ! > e(cid:18)1 − 1 1 ~∆ − ~∆ − ln ~∆(cid:19) > exp(1 − ε/10), 5 4 ln ~∆(cid:19) where the last inequality holds for ~∆ sufficiently large with respect to ε. Now, taking into account that τi ≥ ki e2di ~∆2 − 3, we obtain from Eq. (11): ~∆ − 2 ≥ li li+1 di+1 > > 1 16∆ exp(cid:20)(1 − ε/10)(cid:18) li e2di ~∆2 − 3(cid:19)(cid:21) exp di! , (e2 + ε)~∆2 li 1 1 ∆ where again the last bound holds for ~∆ sufficiently large with respect to ε. This completes the proof of the claim. 22
1108.1320
2
1108
2011-11-28T18:02:58
Compressed Matrix Multiplication
[ "cs.DS", "math.NA", "stat.CO" ]
Motivated by the problems of computing sample covariance matrices, and of transforming a collection of vectors to a basis where they are sparse, we present a simple algorithm that computes an approximation of the product of two n-by-n real matrices A and B. Let ||AB||_F denote the Frobenius norm of AB, and b be a parameter determining the time/accuracy trade-off. Given 2-wise independent hash functions $_1,h_2: [n] -> [b], and s_1,s_2: [n] -> {-1,+1} the algorithm works by first "compressing" the matrix product into the polynomial p(x) = sum_{k=1}^n (sum_{i=1}^n A_{ik} s_1(i) x^{h_1(i)}) (sum_{j=1}^n B_{kj} s_2(j) x^{h_2(j)}) Using FFT for polynomial multiplication, we can compute c_0,...,c_{b-1} such that sum_i c_i x^i = (p(x) mod x^b) + (p(x) div x^b) in time \~O(n^2+ n b). An unbiased estimator of (AB)_{ij} with variance at most ||AB||_F^2 / b can then be computed as: C_{ij} = s_1(i) s_2(j) c_{(h_1(i)+h_2(j)) mod b. Our approach also leads to an algorithm for computing AB exactly, whp., in time \~O(N + nb) in the case where A and B have at most N nonzero entries, and AB has at most b nonzero entries. Also, we use error-correcting codes in a novel way to recover significant entries of AB in near-linear time.
cs.DS
cs
Compressed Matrix Multiplication∗ Rasmus Pagh IT University of Copenhagen [email protected] 1 1 0 2 v o N 8 2 ] S D . s c [ 2 v 0 2 3 1 . 8 0 1 1 : v i X r a ABSTRACT Motivated by the problems of computing sample covariance matrices, and of transforming a collection of vectors to a basis where they are sparse, we present a simple algorithm that computes an approximation of the product of two n- by-n real matrices A and B. Let ABF denote the Frobe- nius norm of AB, and b be a parameter determining the time/accuracy trade-off. Given 2-wise independent hash functions h1, h2 : [n] → [b], and s1, s2 : [n] → {−1, +1} the algorithm works by first “compressing” the matrix product into the polynomial (cid:33) Aiks1(i) xh1(i) Bkjs2(j) xh2(j) . (cid:32) n(cid:88) n(cid:88) p(x) = i=1 k=1 c0, . . . , cb−1 such that(cid:80) (cid:33)(cid:32) n(cid:88) j=1 Using FFT for polynomial multiplication, we can compute i cixi = (p(x) mod xb)+(p(x) div xb) in time O(n2 + nb). An unbiased estimator of (AB)ij with variance at most AB2 F /b can then be computed as: Cij = s1(i) s2(j) c(h1(i)+h2(j)) mod b . Our approach also leads to an algorithm for computing AB exactly, whp., in time O(N + nb) in the case where A and B have at most N nonzero entries, and AB has at most b nonzero entries. Also, we use error-correcting codes in a novel way to recover significant entries of AB in near-linear time. Categories and Subject Descriptors F.2 [ANALYSIS OF ALGORITHMS AND PROB- LEM COMPLEXITY]: Numerical Algorithms and Prob- lems; G.3 [PROBABILITY AND STATISTICS]; G.4 [MATHEMATICAL SOFTWARE]; E.2 [DATA STOR- AGE REPRESENTATIONS]: Hash-table representations ∗This work was done while visiting Carnegie Mellon Uni- versity. Foundation under the Sapere Aude program. It is supported by the Danish National Research . 1. INTRODUCTION Several computational problems can be phrased in terms of matrix products where the normalized result is expected to consist mostly of numerically small entries: • Given m samples of a multivariate random variable (X1, . . . , Xn), compute the sample covariance matrix which is used in statistical analyses. If most pairs of random variables are independent, the corresponding entries of the sample covariance matrix will be concen- trated around zero. • Linearly transform all column vectors in a matrix B to an orthogonal basis AT in which the columns of B are approximately sparse. Such batch transformations are common in lossy data compression algorithms such as JPEG, using properties of specific orthogonal bases to facilitate fast computation. In both cases, an approximation of the matrix product may be as good as an exact computation, since the main issue is to identify large entries in the result matrix. In this paper we consider n-by-n matrices with real values, and devise a combinatorial algorithm for the special case of computing a matrix product AB that is “compressible”. For example, if AB is sparse it falls into our class of compressible products, and we are able to give an efficient algorithm. More generally, if the Frobenius norm of AB is dominated by a sparse subset of the entries, we are able to quickly compute a good approximation of the product AB. Our method can be seen as a compressed sensing method for the matrix product, with the nonstandard idea that the sketch of AB is computed without explicitly constructing AB. The main technical idea is to use FFT [11] to efficiently compute a linear sketch of an outer product of two vectors. We also make use of error-correcting codes in a novel way to achieve recovery of the entries of AB having highest magnitude in near-linear time. Our main conceptual messages are: • It is possible to derive a fast and simple, “combinato- rial” algorithm for matrix multiplication in two cases: When the output matrix is sparse, and when an addi- tive error on each output entry is acceptable. • It is interesting to consider the use of compressed sens- ing techniques for computational problems where re- sults (or important intermediate results) can be rep- resented using sparse vectors. We outline some such targets in the conclusion. • The interface between theoretical computer science and statistics is an area where there is high potential for cross-fertilization (see also [21] for arguments in this direction). 1.1 Related work Matrix multiplication with sparse output. Lingas [20] considered the problem of computing a ma- trix product AB with at most ¯b entries that are not trivially zero. A matrix entry is said to be trivially zero if every term in the corresponding dot product is zero. In general ¯b can be much larger than the number b of nonzeros because zeros in the matrix product may be due to cancellations. Lingas showed, by a reduction to fast rectangular matrix multiplica- tion, that this is possible in time O(n2¯b0.188). Observe that for ¯b = n2 this becomes identical to the O(n2.376) bound by Coppersmith and Winograd [12]. Yuster and Zwick [25] devised asymptotically fast algo- rithms for the case of sparse input matrices, using a matrix partitioning idea. Amossen and Pagh [4] extended this re- sult to be more efficient in the case where also the output matrix is sparse. In the dense input setting of Lingas, this leads to an improved time complexity of O(n1.724 ¯b0.408) for n ≤ ¯b ≤ n1.25. Iwen and Spencer [19] showed how to use compressed sens- ing to compute a matrix product AB in time O(n2+ε), for any given constant ε > 0, in the special case where each column of AB contains at most n0.29462 nonzero values. (Of course, by symmetry the same result holds when there is sparseness in each row.) All the results described above work by reduction to fast rectangular matrix multiplication, so the algorithms are not “combinatorial.” However, Lingas [20] observed that a time complexity of O(n2 + ¯bn) is achieved by the column-row method, a simple combinatorial algorithm. Also, replac- ing the fast rectangular matrix multiplication in the result of Iwen and Spencer [19] by a naıve matrix multiplication algorithm, and making use of randomized sparse recovery methods (see [15]), leads to a combinatorial algorithm run- ning in time O(n2 +nb) when each column of AB has O(b/n) nonzero values. Approximate matrix multiplication. The result of [19] is not restricted to sparse matrix prod- ucts: Their algorithm is shown to compute an approximate matrix product in time O(n2+ε) assuming that the result can be approximated well by a matrix with sparse column vectors. The approximation produced is one with at most n0.29462 nonzero values in each column, and is almost as good as the best approximation of this form. However, if some column of AB is dense, the approximation may differ significantly from AB. Historically, Cohen and Lewis [10] were the first to con- sider randomized algorithms for approximate matrix mul- tiplication, with theoretical results restricted to the case where input matrices do not have negative entries. Sup- pose A has column vectors a1, . . . , an and B has row vectors b1, . . . , bn. The product of A and B can be written as a sum of n outer products: n(cid:88) k=1 The method of Cohen and Lewis can be understood as sam- pling each outer product according to the weight of its en- tries, and combining these samples to produce a matrix C where each entry is an unbiased estimator for (AB)ij. If n2c samples are taken, for a parameter c ≥ 1, the difference between C and AB can be bounded, whp., in terms of the Frobenius norm1 of AB, namely √ AB − CF = O(ABF / c) . (This is not shown in [10], but follows from the fact that each estimator has a scaled binomial distribution.) Drineas, Kannan, and Mahoney [14] showed how a sim- pler sampling strategy can lead to a good approximation of the form CR, where matrices C and R consist of c columns and c rows of A and B, respectively. Their main error √ bound is in terms of the Frobenius norm of the difference: AB − CRF = O(AFBF / c). The time to compute CR using the classical algorithm is O(n2c) — asymptoti- cally faster results are possible by fast rectangular matrix multiplication. Drineas et al. also give bounds on the ele- mentwise differences (AB−CR)ij, but the best such bound √ obtained is of size Ω(M 2n/ c), where M is the magnitude of the largest entry in A and B. This is a rather weak bound in general, since the largest possible magnitude of an entry in AB is M 2n. Sarl´os [23] showed how to achieve the same Frobenius norm error guarantee using c AMS sketches [2] on rows of A and columns of B. Again, if the classical matrix multiplica- tion algorithm is used to combine the sketches, the time com- plexity is O(n2c). This method gives a stronger error bound for each individual entry of the approximation matrix. If we write an entry of AB as a dot product, (AB)ij = ai · bj, the √ magnitude of the additive error is O(ai2bj2/ c) with high probability (see [23, 1]). In contrast to the previous re- sults, this approximation can be computed in a single pass over the input matrices. Clarkson and Woodruff [8] further refine the results of Sarl´os, and show that the space usage is nearly optimal in a streaming setting. 1.2 New results In this paper we improve existing results in cases where the matrix product is “compressible” — in fact, we produce a compressed representation of AB. Let N ≤ 2n2 denote the number of nonzero entries in A and B. We obtain an approximation C by a combinatorial algorithm running in time O(N + nb), making a single pass over the input while using space O(b lg n), such that: • If AB has at most b nonzero entries, C = AB whp. • If AB has Frobenius norm q when removing its b largest entries, the error of each entry is bounded, whp., by Cij − (AB)ij < q/ √ b . Compared to Cohen and Lewis [10] we avoid the restric- tion that input matrices cannot contain negative entries. Also, their method will produce only an approximate result 1The Frobenius norm of a matrix A is defined as (cid:115)(cid:88) AF = A2 ij . AB = akbk . (1) i,j even when AB is sparse. Finally, their method inherently uses space Θ(n2), and hence is not able to exploit compress- ibility to achieve smaller space usage. Our algorithm is faster than existing matrix multiplication algorithms for sparse outputs [4, 20] whenever b < n6/5, as well as in situations where a large number of cancellations mean that b (cid:28) ¯b. As a more conceptual contribution it is to our knowledge the only “simple” algorithm to signif- icantly improve on Strassen’s algorithm for sparse outputs with many entries that are not trivially zero. The simple, combinatorial algorithms derived from Drineas et al. [14] and Sarl´os [23] yield error guarantees that are gen- erally incomparable with those achieved here, when allow- ing same time bound, i.e., c = Θ(b/n). The Frobenius error bound we achieve is: AB − CF ≤ ABF (cid:112)n/c . Our result bears some similarity to the result of Iwen and Spencer [19], since both results be seen as compressed sens- ing of the product AB. One basic difference is that Iwen and Spencer perform compressed sensing on each column of AB (n sparse signals), while we treat the whole matrix AB as a single sparse signal. This means that we are robust towards skewed distribution of large values among the columns. 2. ALGORITHM AND ANALYSIS (1), and then compute(cid:80) We will view the matrix AB as the set of pairs (i, j), where the weight of item (i, j) is (AB)ij. Our approach is to compute a linear sketch pakbk for each outer product of k pakbk to obtain a sketch for AB. For exposition, we first describe how to compute an AMS sketch of this weighted set in time O(n), and then extend this to the more accurate Count Sketch. In the following we use [n] to denote the set {1, . . . , n}. 2.1 AMS sketches the sign function), and compute the sum X = (cid:80) Alon, Matias, and Szegedy [2] described and analyzed the following approach to sketching a data stream z1, z2, . . . , where item zi ∈ [n] has weight wi: Take a 2-wise inde- pendent2 function s : [n] → {−1, +1} (which we will call i s(zi) wi (which we refer to as the AMS sketch). We will use a sign function on pairs (i, j) that is a product of sign functions on the coordinates: s(i, j) = s1(i) s2(j). Indyk and McGre- gor [18], and Braverman et al. [5] have previously analyzed moments of AMS sketches with hash functions of this form. However, for our purposes it suffices to observe that s(i, j) is 2-wise independent if s1 and s2 are 2-wise independent. The AMS sketch of an outer product uv, where by definition (uv)ij = uivj, is: (cid:32) n(cid:88) (cid:33)(cid:32) n(cid:88) (cid:33) s(i, j) (uv)ij = s1(i) ui s2(j) vj . (i,j)∈[n]×[n] i=1 j=1 (cid:88) That is, the sketch for the outer product is simply the prod- uct of the sketches of the two vectors (using different hash functions). A single AMS sketch has variance roughly uv2 F , which is too large for our purposes. Taking the average of 2We will use “h is a a k-wise independent hash function” as a shorthand for “h is chosen uniformly at random from a k-wise independent family of hash functions, independently of all other random choices made by the algorithm”. √ b such sketches to reduce the variance by a factor b would increase the time to retrieve an estimator for an entry in the matrix product by a factor of b. By using a different sketch we can avoid this problem, and additionally get better esti- mates for compressible matrices. 2.2 Count sketches Our algorithm will use the Count Sketch of Charikar, Chen and Farach-Colton [7], which has precision at least as good as the estimator obtained by taking the average of b AMS sketches, but is much better for skewed distributions. The method maintains a sketch of any desired size b, using a 2-wise independent splitting function h : [n] → {0, . . . , b−1} to divide the items into b groups. For each group, an AMS sketch is maintained using a 2-wise independent hash func- tion s : [n] → {−1, +1}. That is, the sketch is the vector i, h(zi)=k s(zi) wi. An unbiased estimator for the total weight of an item z is ch(z)s(z). To obtain stronger guarantees, one can take the median of sev- eral estimators constructed as above (with different sets of hash functions) — we return to this in section 3.3. (c0, . . . , cb−1) where ck =(cid:80) Sketching a matrix product naïvely. Since Count Sketch is linear we can compute the sketch for AB by sketching each of the outer products in (1), and adding the sketch vectors. Each outer product has O(n2) terms, which means that a direct approach to computing its sketch has time complexity O(n2), resulting in a total time complexity of O(n3). Improving the complexity We now show how to improve the complexity of the outer product sketching from O(n2) to O(n + b lg b) by choosing the hash functions used by CountSketch in a “decompos- able” way, and applying FFT. We use the sign function s(i, j) defined in section 2.1, and similarly decompose the function h as follows: h(i, j) = h1(i) + h2(j) mod b, where h1 and h2 are chosen independently at random from a 3-wise indepen- dent family. It is well-known that this also makes h 3-wise independent [6, 22]. Given a vector u ∈ Rn and functions ht : [n] → {0, . . . , b − 1}, st : [n] → {−1, +1} we define the following polynomial: pht,st u (x) = st(i) ui xht(i) . i=1 The polynomial can be represented either in the standard basis as the vector of coefficients of monomials x0, . . . , xb−1, or in the discrete Fourier basis as the vector (pht,st u (ω0), pht,st u (ω1), . . . , pht,st u (ωb−1)), where ω is a complex number such that ωb = 1. The ef- ficient transformation to the latter representation is known as the fast Fourier transform (FFT), and can be computed in time O(b log b) when b is a power of 2 [11]. Taking componentwise products of the vectors representing ph1,s1 in the Fourier basis we get a vector p∗ where and ph2,s2 p∗ t = ph1,s1 (ωt) ph2,s2 (ωt). Now consider the following poly- u nomial: u v v ∗ uv(x) = p s(i, j) (uv)ij xk (cid:88) (cid:88) k i,j h(i,j)=k n(cid:88) Using ωt h(i,j) = ωt h1(i)+t h2(j) we have that (cid:88) (cid:32)(cid:88) i,j ∗ uv(ωt) = p = s(i, j) (uv)ij ωh(i,j)t s1(i) ui ωt h1(i) (cid:33)(cid:32)(cid:88) (cid:33) s2(j) vj ωt h2(j) ∗ t = p i . j uv. Now observe that the coefficients of p∗ That is, p∗ is the representation, in the discrete Fourier basis, of p∗ uv(x) are the entries of a Count Sketch for the outer prod- uct uv using the sign function s(i, j) and splitting function h(i, j). Thus, applying the inverse FFT to p∗ we compute the Count Sketch of uv. The pseudocode of figure 1, called with parameter d = 1, summarizes the encoding and decoding functions discussed so far. For simplicity the pseudocode assumes that the hash functions involved are fully random. A practical implemen- tation of the involved hash functions is character-based tab- ulation [22], but for the best theoretical space bounds we use polynomial hash functions [13]. Time and space analysis. We analyze each iteration of the outer loop. Computing puv(x) takes time O(n + b lg b), where the first term is the time to construct the polynomials, and the last term is the time to multiply the polynomials, using FFT [11]. Comput- ing the sketch for each outer product and summing it up takes time O(n2 + nb lg b). Finally, in time O(n2) we can obtain the estimate for each entry in AB. The analysis can be tightened when A and B are sparse or rectangular, and it suffices to compute the sketch that allows random access to the estimate C. Suppose that A is n1-by- n2, and B is n2-by-n3, and they contain N (cid:28) n2 nonzero entries. It is straightforward to see that each iteration runs in time O(N + n2b lg b), assuming that A and B are given in a form that allows the nonzero entries of a column (row) to be retrieved in linear time. The required hash functions, with constant evaluation time, can be stored in space O(d) using polynomial hash func- tions [13]. The space required for the rest of the compu- tation is O(db), since we are handling O(d) polynomials of degree less than b. Further, access to the input is restricted to a single pass if A is stored in column-major order, and B is stored in row-major order. Lemma 1. CompressedProduct(A, B, b, d) runs in time O(d(N + n2b lg b)), and uses space for O(db) real numbers, in addition to the input. We note that the time bound may be much smaller than n2, which is the number of entries in the approximate product C. This is because C is not constructed explicitly. In section 4 we address how to efficiently extract the b largest entries of C. 3. ERROR ANALYSIS We can obtain two kinds of guarantees on the approxi- mation: One in terms of the Frobenius norm (section 3.1), which applies even if we use just a single set of hash func- tions (d = 1), and stronger guarantees (section 3.3) that require the use of d = O(lg n) hash functions. Section 3.2 function CompressedProduct(A, B, b, d) for t := 1 to d do s1[t], s2[t] ∈R Maps({1, . . . , n} → {−1, +1}) h1[t], h2[t] ∈R Maps({1, . . . , n} → {0, . . . , b − 1}) p[t] := 0 for k := 1 to n do (pa, pb) := (0,0) for i := 1 to n do pa[h1(i)] := pa[h1(i)] + s1[t](i) Aik end for for j := 1 to n do pa[h2(j)] := pb[h2(j)] + s2[t](j) Bkj end for (pa, pb) := (FFT(pa), FFT(pb)) for z := 1 to b do p[t][z] := p[t][z] + pa[z] pb[z] end for end for end for end for for t := 1 to d do p[t] := FFT−1(p[t]) end for return (p, s1, s2, h1, h2) end function Decompress(i, j) for t := 1 to d do Xt := s1[t](i) s2[t](j) p[t][(h1(i) + h2(j)) mod b] return Median(X1, . . . , Xd) end Figure 1: Method for encoding an approximate representation of AB of size bd, and corresponding method for decoding its entries. Maps(D → C) de- notes the set of functions from D to C, and ∈R de- notes independent, random choice. (Limited ran- domness is sufficient to obtain our guarantees, but this is not reflected in the pseudocode.) We use 0 to denote a zero vector (or array) of suitable size that is able to hold complex numbers. FFT(p) de- notes the discrete fourier transform of vector p, and FFT−1 its inverse. considers the application of our result to covariance matrix estimation. 3.1 Frobenius norm guarantee Theorem 2. For d = 1 and any (i∗, j∗), the function call Decompress(i∗, j∗) computes an unbiased estimator for (AB)i∗j∗ with variance bounded by AB2 F /b. Proof. For i, j ∈ {1, . . . , n} let Ki,j be the indicator variable for the event h(i, j) = h(i∗, j∗). Since h is 3-wise independent these events are 2-wise independent. We can write X as: ∗ X = s(i , j ∗ ) Ki,js(i, j)(AB)ij . i,j Observe that K(i∗, j∗) = 1, E[s(i∗, j∗)s(i, j)] = 0 whenever (i, j) (cid:54)= (i∗, j∗), and E[s(i∗, j∗)2] = 1. This implies that E[X] = (AB)i∗j∗ . To bound the variance of X we rewrite (cid:88) it as: X = (AB)i∗j∗ + s(i ∗ ∗ ) , j (cid:88) (i,j)(cid:54)=(i∗,j∗) Ki,js(i, j)(AB)ij (2) norm of Q is: E[ Q2 F ] = 2 Since s(i∗, j∗)2 = 1 and the values Ki,j, i, j ∈ {1, . . . , n}, and s(i, j), i, j ∈ {1, . . . , n} are 2-wise independent the terms have covariance zero, so the variance is simply the sum (cid:88) (i,j)(cid:54)=(i∗,j∗) Var(Ki,js(i, j)(AB)ij) . We have that E[Ki,js(i, j)(AB)ij] = 0, so the variance of each term is equal to its second moment: E[(Ki,js(i, j)(AB)ij)2] = (AB)2 ijE[Ki,j] = (AB)2 Summing over all terms we get that Var(X) ≤ AB2 ij/b . F /b. As a consequence of the lemma, we get from Chebychev’s √ inequality that each estimate is accurate with probability 3/4 up to an additive error of 2ABF / b. For sufficiently large d = O(lg n) this holds for all entries with high proba- bility, by Chernoff bounds. 3.2 Covariance matrix estimation We now consider the application of our result to covari- ance matrix estimation from a set of samples. The covari- ance matrix captures pairwise correlations among the com- ponents of a multivariate random variable X = (X1, . . . , Xn)T . It is defined as cov(X) = E[(X−E[X])(X−E[X])T ]. We can arrange observations x1, . . . , xm of X as columns in an n-by- m matrix A. Figure 2 illustrates how approximate matrix multiplication can be used to find correlations among rows of A (corresponding to components of X). In the following we present a theoretical analysis of this approach. The sample mean of X is ¯x = 1 m i=1 xi. The sample covariance matrix Q is an unbiased estimator of cov(X), given by: (cid:80)m m(cid:88) Q = 1 m−1 (xi − ¯x)(xi − ¯x)T . i=1 Let ¯x1 denote the n-by-m matrix that has all columns equal to ¯x. Then we can write Q as a matrix product: Q = 1 m−1 (A − ¯x1)(A − ¯x1)T . To simplify calculations we consider computation of Q which is derived from Q by setting entries on the diagonal to zero. Notice that a linear sketch of Q can be transformed easily into a linear sketch of Q, and that a sketch of Q also allows us to quickly approximate Q. Entry Qij, i (cid:54)= j is a random variable that has expectation 0 if Xi and Xj are m−1 times the sum over m independent. It is computed as observations of (Xi − E[Xi])(Xj − E[Xj]). Assuming inde- pendence and using the formula from [17], this means that its variance is m Var(Xi)Var(Xj), for m ≥ 2. If cov(X) is a diagonal matrix (i.e., every pair of variables is independent), the expected squared Frobenius (m−1)2 Var(Xi)Var(Xj) < 4 m 1 i<j (cid:88) (cid:88) (cid:32)(cid:88) i<j < 8 m < 4 m (cid:88) i<j Var(Qij) E[Q2 ij] = 2 Var(Xi)Var(Xj) (cid:33)2 Var(Xi) . i In a statistical test for pairwise independence one will as- sume independence, and test if the sample covariance matrix is indeed close to diagonal. We can derive an approximation guarantee from Theorem 2 for the sketch of Q (and hence Q), assuming the hypothesis that cov(X) is diagonal. If this is not true, our algorithm will still be computing an unbi- ased estimate of cov(X), but the observed variance in each entry will be larger. Theorem 3. Consider m observations of random vari- ables X1, . . . , Xn that are pairwise independent. We can compute in time O((n + b)m) and space O(b) an unbiased approximation to the sample covariance matrix with additive error on each entry (whp.) O((cid:80)n √ mb). i=1 Var(Xi)/ No similar result follows from the method of Cohen and Lewis [10], which gives no theoretical guarantees when ap- plied to matrices with negative entries. Similarly, the al- gorithms of Drineas et al. [14] and Sarl´os [23] do not have sufficiently strong guarantees on the error of single entries to imply Theorem 3. We note that a similar result could be obtained by the method of Iwen and Spencer [19]. ticular interest. Then(cid:80)n The special case of indicator random variables is of par- i=1 Var(Xi) ≤ n, and if m ≥ n we can achieve additive error o(1) in time slightly superlinear in the size of the input matrix: Corollary 4. Consider m observations of indicator ran- dom variables X1, . . . , Xn that are pairwise independent. Us- ing space b ≥ n and time O(mb) we can compute an approx- √ imation to the sample covariance matrix with additive error O(n/ mb). 3.3 Tail guarantees We now provide a stronger analysis of our matrix mul- tiplication algorithm, focusing on the setting in which we compute d = O(lg n) independent sketches as described in section 2.2, and the estimator returned is the median. 3.3.1 We first show that sparse outputs are computed exactly Sparse outputs. with high probability. Theorem 5. Suppose AB has at most b/8 nonzero en- tries, and d ≥ 6 lg n. Then CompressedProduct(A, B, b, d) together with Decompress correctly computes AB with prob- ability 1 − o(1). Proof. Let S0 denote the set of coordinates of nonzero entries in AB. Consider again the estimator (2) for (AB)i∗j∗ . We observe that X (cid:54)= (AB)i∗j∗ can only happen when Ki,j (cid:54)= 0 for some (i, j) (cid:54)= (i∗, j∗) with (AB)ij (cid:54)= 0, i.e., (i, j) ∈ S0 and h(i, j) = h(i∗, j∗). Since h is 2-wise inde- pendent with range b and S0 ≤ b/8, this happens with probability at most 1/8. The expected number of sketches Figure 2: Finding correlations using approximate matrix multiplication. Upper left: 100-by-100 random matrix A where all entries are sampled from [−1; 1], independently except rows 21 and 66 which are positively correlated. Upper right: AAT has mostly numerically small values off diagonals, expect entries (66,21) and (21,66) corresponding to the correlated rows in A. Lower left: Approximation of AAT output by our algorithm using b = 2000. Lower right: After subtracting the contribution of diagonal elements of AAT and thresholding the resulting approximation, a small set of entries remains that are “candidates for having a large value”, including (66,21). with X (cid:54)= (AB)i∗j∗ is therefore at most d/8. If less than d/2 of the sketches have X (cid:54)= (AB)i∗j∗ , the median will be (AB)i∗j∗ . By Chernoff bounds, the probability that the ex- pected value d/8 is exceeded by a factor 4 is (e4−1/44)d/10 = o(2−d/3). In particular, if we choose d = 6 lg n then the prob- ability that the output is correct in all entries is 1−o(1). Skewed distributions. 3.3.2 Our next goal is to obtain stronger error guarantees in the case where the distribution of values in AB is skewed such that the Frobenius norm is dominated by the b/20 largest entries. Let Errk F (M ) denote the squared Frobenius norm (i.e., sum of entries squared) of a matrix that is identical to matrix M except for its k largest entries (absolute value), where it is zero. Theorem 6. Suppose that d ≥ 6 lg n. Then Decom- press in conjunction with CompressedProduct(A, B, b, d) computes a matrix C such that for each entry Cij we have (cid:113) 4. SUBLINEAR RESULT EXTRACTION In analogy with the sparse recovery literature (see [15] for an overview) we now consider the task of extracting the most significant coefficients of the approximation matrix C in time o(n2). In fact, if we allow the compression algorithm to use a factor O(lg n) more time and space, the time complexity for decompression will be O(b lg2 n). Our main tool is error- correcting codes, previously applied to the sparse recovery problem by Gilbert et al. [16]. However, compared to [16] we are able to proceed in a more direct way that avoids iterative decoding. We note that a similar result could be obtained by a 2-dimensional dyadic decomposition of [n] × [n], but it seems that this would result in time O(b lg3 n) for decompression. For ∆ ≥ 0 let S∆ = {(i, j) (AB)ij > ∆} denote the set of entries in AB with magnitude larger than ∆, and let L denote the b/κ largest entries in AB, for some constant κ. Our goal is to compute a set S of O(b) entries that con- tains L ∩ S∆ where ∆ = O( F (AB)/b). Intuitively, with high probability we should output entries in L if their magnitude is significantly above the standard deviation of entries of the approximation C. 4.1 Approach (cid:113) Errb/κ The basic approach is to compute a sequence of Count Sketches using the same set of hash functions to approxi- mate different submatrices of AB. The set of sketches that contain a particular entry will then reveal (with high prob- ability) the location of the entry. The submatrices are con- structed using a good error-correcting code E : [n] → {0, 1}(cid:96), where (cid:96) = O(lg n). Let IEr denote the diagonal matrix where entry (i, i) equals E(i)r, bit number r of E(i). Then IEr A is the matrix that is derived from A by changing entries to zero in those rows i for which E(i)r = 0. Similarly, we can derive BIEr from B by changing entries to zero in columns j where E(j)r = 0. The matrix sketches that we compute are: Cr· = (IEr A)B, for r ∈ {1, . . . , (cid:96)}, and C·r = A(BIEr−(cid:96) ), for r ∈ {(cid:96) + 1, . . . , 2(cid:96)} (3) We aim to show the following result. (cid:113) Theorem 7. Assume d = O(lg n) is sufficiently large. There exists a constant κ such that if ∆ ≥ κ F (AB)/b then FindSignificantEntries(∆) returns a set of O(b) po- sitions that includes the positions of the b/κ entries in AB having the highest magnitudes, possibly omitting entries with magnitude below ∆. The running time is O(b lg2 n), space usage is O(b lg n), and the result is correct with probability 1 − 1 n . Errb/κ Cij − (AB)ij < 12 with probability 1 − o(n−2). Errb/20 F (AB)/b Proof. Consider again equation (2) that describes a sin- gle estimator for (AB)i∗j∗ . Let v be the length n2−1 vector with entries (Ki,j(AB)ij)ij, ranging over all (i, j) (cid:54)= (i∗, j∗). The error of X is s(i∗, j∗) times the dot product of v and the ±1 vector represented by s. Since s is 2-wise independent, Var(X) ≤ v2 2. Let L denote the set of coordinates of the b/20 largest entries in AB (absolute value), different from (i∗, j∗), with ties resolved arbitrarily. We would like to argue that with probability 9/10 two events hold simultaneously: • K(i, j) = 0 for all (i, j) ∈ L. • v2 2 ≤ σ2, where σ2 = 20 Errb/20 F (AB)/b. When this is the case we say that v is “good”. The first event holds with probability 19/20 by the union bound, since Pr[K(i, j) = 1] = 1/b. To analyze the second event we focus on the vector v(cid:48) obtained from v by fixing K(i, j) = 0 for (i, j) ∈ L. The expected value of v(cid:48)2 2 is bounded by σ2/20. Thus by Markov’s inequality we have v(cid:48)2 2 ≤ σ2 with probability 19/20. Note that when the first event holds we have v(cid:48) = v. So we conclude that v is good with probability at least 9/10. For each estimator X, since Var(X) ≤ v2 2 the proba- bility that the error is of magnitude t or more is at most v2 2/t2 by Chebychev’s inequality. So for a good vector v the probability that t2 ≥ 7σ2 ≥ 7v2 2 is at most 1/49. Thus for each estimator the probability that it is based on a good vector and has error less than (cid:113) √ 7σ2 ≤ 12 Errb/20 (AB)/b Combining this with Theorem 5 and Lemma 1 we obtain: F is at least 1 − 1/10 − 1/49 > 7/8. Finally observe that it is unlikely that d/2 or more estima- tors have larger error. As in the proof of Theorem 5 we get that the probability that this occurs is o(2−d/3) = o(n−2). Thus, the probability that the median estimator has larger error is o(n−2). Corollary 8. Let A be an n1-by-n2 matrix, and B an n2-by-n3 matrix, with N nonzero entries in total. Further suppose that AB is known to have at most b nonzero entries. Then a sparse representation of AB, correct with probability 1 − 1 using space O(b lg n) in addition to the input. n , can be computed in time O(N + n2b lg b + b lg2 n), function FindSignificantEntries(∆) S := ∅ for t := 1 to d do for k := 1 to b do for r := 1 to 2(cid:96) do Xr := p(t,r)[k] end for s :=  for r := 1 to 2(cid:96) do if Xr > ∆/2 then s := s1 else s := s0 end for (i, j) :=Decode(s) Insert((i, j), S) end for end for for (i, j) ∈ S do if {(i, j)} ∩ S < d/2 then Delete((i, j), S) end if end for return S end Figure 3: Method for computing the positions of O(b) significant matrix entries of magnitude ∆ or more. String concatenation is denoted , and  de- notes the empty string. Decode(s) decodes the (cor- rupted) codewords formed by the bit string s (which must have length a multiple of (cid:96)), returning an arbi- trary result if no codeword is found within distance δ(cid:96). Insert(x, S) inserts a copy of x into the multiset S, and Delete(x, S) deletes all copies of x from S. FindSignificantEntries can be used in conjunction with Decompress to obtain a sparse approximation. 4.2 Details We now fill in the details of the approach sketched in section 4.1. Consider the matrix sketches of (3). We use p(t,r) to denote polynomial t in the sketch number r, for r = 1, . . . , 2(cid:96). For concreteness we consider an expander code [24], which is able to efficiently correct a fraction δ = Ω(1) errors. Given a string within Hamming distance δ(cid:96) from E(x), the input x can be recovered in time O((cid:96)), if the decoding algorithm is given access to a (fixed) lookup table of size O(n). (We assume without loss of generality that δ(cid:96) is integer.) 1 (i) + h(t) Pseudocode for the algorithm computing the set of po- sitions (i, j) can be found in figure 3. For each splitting function h(t)(i, j) = (h(t) 2 (j)) mod b, and each hash value k we try to recover any entry (i, j) ∈ L ∩ S∆ with h(t)(i, j) = k. The recovery will succeed with good proba- bility if there is a unique such entry. As argued in section 3.3 we get uniqueness for all but a small fraction of the splitting functions with high probability. The algorithm first reads the relevant magnitude Xr from each of the 2(cid:96) sketches. It then produces a binary string s that encodes which sketches have low and high magnitude (below and above ∆/2, respectively). This string is then decoded into a pair of coordinates (i, j), that are inserted in a multiset S. A post-processing step removes “spurious” entries from S that were not inserted for at least d/2 splitting functions, before the set is returned. 4.2.1 Proof of theorem 7 It is easy to see that FindSignificantEntries can be im- plemented to run in expected time O(db(cid:96)), which is O(b lg2 n), and space O(db), which is O(b lg n). The implementation uses the linear time algorithm for Decode [24], and a hash table to maintain the multiset S. Also, since we insert db positions into the multiset S, and output only those that have cardinality d/2 or more, the set returned clearly has at most 2b distinct positions. It remains to see that each entry (i, j) ∈ L ∩ S∆ is returned with high probability. Notice that (cid:40) (cid:40) ((IEr A)B)ij = (A(BIEr ))ij = (AB)ij 0 (AB)ij 0 if E(i)r = 1 otherwise if E(j)r = 1 otherwise . (cid:113) Therefore, conditioned on h(t)(i, j) = k we have that the random variable Xr = p(t,r)[k] has E[Xr] ∈ {0,(AB)ij}, where the value is determined by the rth bit of the string s = E(i)E(j). The algorithm correctly decodes the rth bit if Xr ≤ ∆/2 for sr = 0, and Xr > ∆/2 for sr = 1. In particular, the decoding of a bit is correct if (AB)ij ≥ ∆ and Xr deviates by at most ∆/2 from its expectation. From the proof of Theorem 6 we see that the proba- bility that the error of a single estimator is greater than Errb/20 F (AB)/b is at most 1/8. If ∆ is at least twice as 12 large, this error bound implies correct decoding of the bit derived from the estimator, assuming (AB)i∗j∗ > ∆. Ad- justing constants 12 and 20 to a larger value κ the error probability can be decreased to δ/3. This means that the probability that there are δ(cid:96) errors or more is at most 1/3. So with probability 2/3 Decode correctly identifies (i∗, j∗), and inserts it into S. Repeating this for d different hash functions the expected number of copies of (i∗, j∗) in S is at least 2d/3, and by Chernoff bounds the probability that there are less than d/2 copies is 2−Ω(d). For sufficiently large d = O(lg n) the prob- ability that any entry of magnitude ∆ or more is missed is less than 1/n. 5. ESTIMATING COMPRESSIBILITY To apply theorems 5 and 6 it is useful to be able to com- pute bounds on compressibility of AB. In the following sub- sections we consider, respectively, estimation of the number of nonzero entries, and of the ErrF value. 5.1 Number of nonzero entries An constant-factor estimate of ¯b ≥ b can be computed in time O(N lg N ) using Cohen’s method [9] or its refinement for matrix products [3]. Recall that ¯b is an upper bound on the number of nonzeros, when not taking into account that there may be zeros in AB that are due to cancellation of terms. We next show how to take cancellation of terms into consideration, to get a truly output-sensitive algorithm. The idea is to perform a doubling search that terminates (whp.) when we arrive at an upper bound on the number of nonzero entries that is within a factor O(1) from the true value. Initially, we multiply A and B by random diagonal matrices (on left and right side, respectively). This will not change the number of nonzero entries, but by the Schwartz- Zippel lemma it ensures that a linear combination of entries in AB is zero (whp.) only when all these entries are zero. The doubling search creates sketches for AB using b = 2, 4, 8, 16, . . . until, say, 4 5 b entries of the sketch vector be- come zero for all hash functions h(1), . . . , h(d). Since there is no cancellation (whp.), this means that the number of dis- tinct hash values (under h(i, j)) of nonzero entries (i, j) is at most b/5. We wish to bound the probability that this happens when the true number b of nonzero entries is larger than b. The expected number of hash collisions is (cid:0)b (cid:1)/b. If the number 2 of distinct hash values of nonzero entries is at most b/5 the average number of collisions per entry is b/(b/5) − 1. This means that, assuming b ≥ b, the observed number of colli- sions can be lower bounded as: /2 ≥ b2 b/5 5 /2 ≥ 2b b + 1 (cid:32)b (cid:33) (cid:18) b (cid:19) − 1 /b . b/5 b 2 4 2b b+1 ≥ 4/3 larger Note that the observed value is a factor than the expectation. So Markov’s inequality implies that this happens with probability at most 3/4. If it happens for all d hash functions, we can conclude with probability 1 − (3/4)−d that b is an upper bound on the number of nonzero entries. Conversely, as soon as b/5 exceeds the number b of nonzero entries we are guaranteed to finish the doubling search. This means we get a 5-approximation of the number of non-zeros. 5.2 Upper bounding Errb/κ F (AB) To be able to conclude that the result of FindSignificant- Entries is correct with high probability, using theorem 7, (cid:113) we need an upper bound on fact show how to estimate the larger value √ F (AB)/b = ABF / b, (cid:113) Err0 Errb/κ F (AB)/b. We will in so the allowed value for ∆ found may not be tight. We leave it as an open problem to efficiently compute a tight upper (cid:113) bound on Errb/κ F (AB)/b. The idea is to make use of the AMS sketch X of AB using the approach described in section 2.1 (summing the sketches for the outer products). If we use 4-wise indepen- dent hash functions s1 and s2, Indyk and McGregor [18] (see also Braverman et al. [5] for a slight correction of this result) have shown that X 2 is an unbiased estimator for the sec- ond moment of the input, which in our case equals AB2 F , with variance at most 8E[X 2]2. By Chebychev’s inequality this means that X 2 is a 32-approximation of AB2 F with probability 3/4. (Arbitrarily better approximation can be achieved, if needed, by taking the mean of several estima- tors.) To make sure that we get an upper bound with high probability we take the median of d = O(log n) estimators, and multiply this value by 32. The total time for computing the upper bound is O(dn2). 6. CONCLUSION We have seen that matrix multiplication allows surpris- ingly simple and efficient approximation algorithms in cases where the result is sparse or, more generally, its Frobenius norm is dominated by a sparse subset of the entries. Of course, this can be combined with known reductions of ma- trix multiplication to (smaller) matrix products [14, 23] to yield further (multiplicative error) approximation results. Acknowledgement. The author thanks the anonymous reviewers for insightful comments, Andrea Campagna, Kon- stantin Kutzkov, and Andrzej Lingas for suggestions improv- ing the presentation, Petros Drineas for information on re- lated work, and Seth Pettie for pointing out the work of Iwen and Spencer. 7. REFERENCES [1] Noga Alon, Phillip B. Gibbons, Yossi Matias, and Mario Szegedy. Tracking join and self-join sizes in limited storage. J. Comput. Syst. Sci, 64(3):719–747, 2002. [2] Noga Alon, Yossi Matias, and Mario Szegedy. The space complexity of approximating the frequency moments. J. Comput. Syst. Sci, 58(1):137–147, 1999. [3] Rasmus Resen Amossen, Andrea Campagna, and Rasmus Pagh. Better size estimation for sparse matrix products. In Proceedings of 13th International Workshop on Approximation, Randomization, and Combinatorial Optimization (APPROX-RANDOM), volume 6302 of Lecture Notes in Computer Science, pages 406–419. Springer, 2010. [4] Rasmus Resen Amossen and Rasmus Pagh. Faster join-projects and sparse matrix multiplications. In Proceedings of 12th International Conference on Database Theory (ICDT), volume 361 of ACM International Conference Proceeding Series, pages 121–126. ACM, 2009. [5] Vladimir Braverman, Kai-Min Chung, Zhenming Liu, Michael Mitzenmacher, and Rafail Ostrovsky. AMS without 4-wise independence on product domains. In 27th International Symposium on Theoretical Aspects of Computer Science (STACS), volume 5 of Leibniz International Proceedings in Informatics (LIPIcs), pages 119–130, 2010. [6] J. Lawrence Carter and Mark N. Wegman. Universal classes of hash functions. Journal of Computer and System Sciences, 18(2):143–154, 1979. [7] Moses Charikar, Kevin Chen, and Martin Farach-Colton. Finding frequent items in data streams. Theor. Comput. Sci, 312(1):3–15, 2004. [8] Kenneth L. Clarkson and David P. Woodruff. Numerical linear algebra in the streaming model. In Proceedings of Symposium on Theory of Computing (STOC), pages 205–214. ACM Press, 2009. [9] Edith Cohen. Structure prediction and computation of sparse matrix products. J. Comb. Optim, 2(4):307–332, 1998. [10] Edith Cohen and David D. Lewis. Approximating matrix multiplication for pattern recognition tasks. Journal of Algorithms, 30(2):211–252, 1999. [11] James W. Cooley and John W. Tukey. An algorithm for the machine calculation of complex Fourier series. Mathematics of Computation, 19(90):297–301, 1965. [12] Don Coppersmith and Shmuel Winograd. Matrix multiplication via arithmetic progressions. Journal of Symbolic Computation, 9(3):251–280, 1990. [13] Martin Dietzfelbinger, Joseph Gil, Yossi Matias, and Nicholas Pippenger. Polynomial hash functions are reliable (extended abstract). In Werner Kuich, editor, Automata, Languages and Programming, 19th International Colloquium, volume 623 of Lecture Notes in Computer Science, pages 235–246, Vienna, Austria, 13–17 July 1992. Springer-Verlag. [14] Petros Drineas, Ravi Kannan, and Michael W. Mahoney. Fast Monte Carlo algorithms for matrices I: Approximating matrix multiplication. SIAM Journal on Computing, 36(1):132–157, 2006. [15] A. Gilbert and P. Indyk. Sparse recovery using sparse matrices. Proceedings of the IEEE, 98(6):937 –947, 2010. [16] Anna C. Gilbert, Yi Li, Ely Porat, and Martin J. Strauss. Approximate sparse recovery: optimizing time and measurements. In Proceedings of the 42nd ACM symposium on Theory of computing, STOC ’10, pages 475–484, New York, NY, USA, 2010. ACM. [17] Leo A. Goodman. On the exact variance of products. Journal of the American Statistical Association, 55(292):pp. 708–713, 1960. [18] Piotr Indyk and Andrew McGregor. Declaring independence via the sketching of sketches. In Proceedings of the 19th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 737–745. SIAM, 2008. [19] Mark A. Iwen and Craig V. Spencer. A note on compressed sensing and the complexity of matrix multiplication. Inf. Process. Lett, 109(10):468–471, 2009. [20] Andrzej Lingas. A fast output-sensitive algorithm for boolean matrix multiplication. In ESA, volume 5757 of Lecture Notes in Computer Science, pages 408–419. Springer, 2009. [21] Michael W. Mahoney. Algorithmic and statistical perspectives on large-scale data analysis, October 08 2010. To appear in Combinatorial Scientific Computing, Chapman and Hall/CRC Press, 2011. [22] Mihai Patra¸scu and Mikkel Thorup. The power of simple tabulation hashing. In Proceedings of the 43rd annual ACM Symposium on Theory of Computing (STOC), pages 1–10. ACM, 2011. [23] Tam´as Sarl´os. Improved approximation algorithms for large matrices via random projections. In IEEE Symposium on Foundations of Computer Science (FOCS), pages 143–152. IEEE Computer Society, 2006. [24] Michael Sipser and Daniel A. Spielman. Expander codes. IEEE Transactions on Information Theory, 42(6):1710–1722, 1996. [25] Raphael Yuster and Uri Zwick. Fast sparse matrix multiplication. ACM Transactions on Algorithms, 1(1):2–13, 2005.
1702.06256
2
1702
2017-09-05T22:04:04
A $(1.4 + \epsilon)$-approximation algorithm for the $2$-Max-Duo problem
[ "cs.DS" ]
The maximum duo-preservation string mapping (Max-Duo) problem is the complement of the well studied minimum common string partition (MCSP) problem, both of which have applications in many fields including text compression and bioinformatics. $k$-Max-Duo is the restricted version of Max-Duo, where every letter of the alphabet occurs at most $k$ times in each of the strings, which is readily reduced into the well known maximum independent set (MIS) problem on a graph of maximum degree $\Delta \le 6(k-1)$. In particular, $2$-Max-Duo can then be approximated arbitrarily close to $1.8$ using the state-of-the-art approximation algorithm for the MIS problem. $2$-Max-Duo was proved APX-hard and very recently a $(1.6 + \epsilon)$-approximation was claimed, for any $\epsilon > 0$. In this paper, we present a vertex-degree reduction technique, based on which, we show that $2$-Max-Duo can be approximated arbitrarily close to $1.4$.
cs.DS
cs
A (1.4 + )-approximation algorithm for the 2-Max-Duo problem∗† Yao Xu1, Yong Chen2,1, Guohui Lin‡1, Tian Liu3, Taibo Luo4,1, and Peng Zhang‡5 1 Department of Computing Science, University of Alberta. Edmonton, Alberta T6G 2E8, Canada. {xu2,taibo,guohui}@ualberta.ca 2 Department of Mathematics, Hangzhou Dianzi University. Hangzhou, Zhejiang 310018, China. [email protected] 3 Key Laboratory of High Confidence Software Technologies (MOE), Institute of Software, School of Electronic Engineering and Computer Science, Peking University. Beijing 100871, China. [email protected] 4 Business School, Sichuan University. Chengdu, Sichuan 610065, China. 5 School of Computer Science and Technology, Shandong University. Jinan, Shandong 250101, China. [email protected] Abstract The maximum duo-preservation string mapping (Max-Duo) problem is the complement of the well studied minimum common string partition (MCSP) problem, both of which have applica- tions in many fields including text compression and bioinformatics. k-Max-Duo is the restricted version of Max-Duo, where every letter of the alphabet occurs at most k times in each of the strings, which is readily reduced into the well known maximum independent set (MIS) problem on a graph of maximum degree ∆ ≤ 6(k − 1). In particular, 2-Max-Duo can then be approx- imated arbitrarily close to 1.8 using the state-of-the-art approximation algorithm for the MIS problem. 2-Max-Duo was proved APX-hard and very recently a (1.6 + )-approximation was claimed, for any  > 0. In this paper, we present a vertex-degree reduction technique, based on which, we show that 2-Max-Duo can be approximated arbitrarily close to 1.4. 1998 ACM Subject Classification F.2.2 Pattern matching; G.2.1 Combinatorial algorithms; G.4 Algorithm design and analysis Keywords and phrases Approximation algorithm, duo-preservation string mapping, string par- tition, independent set Digital Object Identifier 10.4230/LIPIcs... Introduction 1 The minimum common string partition (MCSP) problem is a well-studied string comparison problem in computer science, with applications in fields such as text compression and bioinformatics. MCSP was first introduced by Goldstein et al. [16], and can be defined as follows: Consider two length-n strings A = (a1, a2, . . . , an) and B = (b1, b2, . . . , bn) over some alphabet Σ, such that B is a permutation of A. Let PA be a partition of A, which is a ∗ This work was partially supported by NSERC Canada and NSF China. † An extended abstract appears in Proceedings of the 28th International Symposium on Algorithms and Computation (ISAAC 2017). LIPICS 92, Article No. 66, pp. 66:1 -- 66:12. ‡ Correspondence authors. © Yao Xu, Yong Chen, Guohui Lin, Tian Liu, Taibo Luo, Peng Zhang; licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl -- Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany XX:2 (1.4 + )-approximation for 2-Max-Duo multi-set of substrings whose concatenation in a certain order becomes A. The cardinality of PA is the number of substrings in PA. The MCSP problem asks to find a minimum cardinality partition PA of A which is also a partition of B. k-MCSP denotes the restricted version of MCSP where every letter of the alphabet Σ occurs at most k times in each of the two strings. Goldstein et al. [16] have shown that the MCSP problem is NP-hard and APX-hard, even when k = 2. There have been several approximation algorithms [10, 11, 12, 16, 18, 19] presented since 2004, among which the current best result is an O(log n log∗ n)-approximation for the general MCSP and an O(k)-approximation for k-MCSP. On the other hand, MCSP is proved to be fixed parameter tractable (FPT), with respect to k and/or the cardinality of the optimal partition [13, 17, 7, 8]. An ordered pair of consecutive letters in a string is called a duo of the string [16], which is said to be preserved by a partition if the pair resides inside a substring of the partition. Therefore, a length-' substring in the partition preserves ' − 1 duos of the string. With the complementary objective to that of MCSP, the problem of maximizing the number of duos preserved in the common partition is referred to as the maximum duo-preservation string mapping problem by Chen et al. [9], denoted as Max-Duo. Analogously, k-Max-Duo is the restricted version of Max-Duo where every letter of the alphabet Σ occurs at most k times in each string. In this paper, we focus on 2-Max-Duo, to design an improved approximation algorithm. Along with Max-Duo, Chen et al. [9] introduced the constrained maximum induced subgraph (CMIS) problem, in which one is given an m-partite graph G = (V1, V2, . . . , Vm, E) i vertices arranged in an ni × ni matrix, and the goal is to find ni with each Vi having n2 vertices in each Vi from different rows and different columns such that the number of edges in the induced subgraph is maximized. k-CMIS is the restricted version of CMIS where ni ≤ k for all i. Given an instance of Max-Duo, we may construct an instance of CMIS by setting m to be the number of distinct letters in the string A, and ni to be the number of occurrences of the i-th distinct letter; the vertex in the (s, t)-entry of the ni × ni matrix "means" mapping the s-th occurrence of the i-th distinct letter in the string A to its t-th occurrence in the string B; and there is an edge between a vertex of Vi and a vertex of Vj if the two corresponding mappings together preserve a duo. Therefore, Max-Duo is a special case of CMIS, and furthermore k-Max-Duo is a special case of k-CMIS. Chen et al. [9] presented a k2-approximation for k-CMIS and a 2-approximation for 2-CMIS, based on a linear programming and randomized rounding techniques. These imply that k-Max-Duo can also be approximated within a ratio of k2 and 2-Max-Duo can be approximated within a ratio of 2. Alternatively, an instance of the k-Max-Duo problem with the two strings A = (a1, a2, . . . , an) and B = (b1, b2, . . . , bn) can be viewed as a bipartite graph H = (A, B, F), constructed as follows: The vertices in A and B are a1, a2, . . . , an in order and b1, b2, . . . , bn in order, respectively, and there is an edge between ai and bj if they are the same letter. The two edges (ai, bj), (ai+1, bj+1) ∈ F are called a pair of parallel edges. This way, a common partition of the strings A and B corresponds one-to-one to a perfect matching in H, and the number of duos preserved by the partition is exactly the number of pairs of parallel edges in the matching. Moreover, from the bipartite graph H = (A, B, F), we can construct another graph G = (V, E) in which every vertex of V corresponds to a pair of parallel edges of F, and there is an edge between two vertices of V if the two corresponding pairs of parallel edges of F cannot co-exist in any perfect matching of H (called conflicting, which can be determined in Y. Xu et al. XX:3 constant time; see Section 2 for more details). This way, one easily sees that a set of duos that can be preserved together, by a perfect matching of H, corresponds one-to-one to an independent set of G [16, 5]. Therefore, the Max-Duo problem can be cast as a special case of the well-known maximum independent set (MIS) problem [15]; furthermore, Boria et al. [5] showed that in such a reduction, an instance of k-Max-Duo gives rise to a graph with a maximum degree ∆ ≤ 6(k − 1). It follows that the state-of-the-art(cid:0)(∆ + 3)/5 + (cid:1)- approximation algorithm for MIS [2], for any  > 0, is a (cid:0)(6k − 3)/5 + (cid:1)-approximation algorithm for k-Max-Duo. Especially, 2-Max-Duo can now be better approximated within a ratio of 1.8 + . Boria et al. [5] proved that 2-Max-Duo is APX-hard, similar to 2-MCSP [16], via a linear reduction from MIS on cubic graphs. For MIS on cubic graphs, it is NP-hard to approximate within 1.00719 [3]. Besides, Boria et al. [5] claimed that 2-Max-Duo can be approximated within 1.6 + , for any  > 0. Recently, Boria et al. [4] presented a local search 3.5-approximation for the general Max-Duo problem. In the meantime, Brubach [6] presented a 3.25-approximation using a novel combinatorial triplet matching. Max-Duo has also been proved to be FPT by Beretta [1], with respect to the number of preserved duos in the optimal partition. Most et al. recently, two local search algorithms were independently designed for the general Max-Duo problem at the same time, achieving approximation ratios of 2.917 [20] and 2 +  [14] for any algorithm for k-Max-Duo, when k ≥ 3. In this paper, we focus on the 2-Max-Duo problem; using the above reduction to the MIS problem, we present a vertex-degree reduction scheme and design an improved (1.4 + )-approximation, for any  > 0.  > 0, respectively. They both exceed the previously the best(cid:0)(6k − 3)/5 + (cid:1)-approximation The rest of the paper is organized as follows. We provide some preliminaries in Section 2, including several important structural properties of the graph constructed from the two given strings. The vertex-degree reduction scheme is also presented as a separate subsection in Section 2. The new approximation algorithm, denoted as Approx, is presented in Section 3, where we show that it is a (1.4 + )-approximation for 2-Max-Duo. We conclude the paper in Section 4. 2 Preliminaries Consider an instance of the k-Max-Duo problem with two length-n strings A = (a1, a2, . . . , an) and B = (b1, b2, . . . , bn) such that B is a permutation of A. Recall that we can view the instance as a bipartite graph H = (A, B, F), where the vertices in A and B are a1, a2, . . . , an in order and b1, b2, . . . , bn in order, respectively, and there is an edge between ai ∈ A and bj ∈ B if they are the same letter, denoted as ei,j. See Figure 2.1a for an example, where A = (a, b, c, d, e, f, b, c, d, e) and B = (f, b, c, d, e, a, b, c, d, e). Note that F ≤ kn, and so H can be constructed in O(n2) time. The two edges ei,j, ei+1,j+1 ∈ F are called a pair of parallel edges (and they are said to be parallel to each other); when both are included in a perfect matching of H, the corresponding duo (ai, ai+1) of A is preserved. Two pairs of parallel edges are conflicting if they cannot co-exist in any perfect matching of H. This motivates the following reduction from the k-Max-Duo problem to the MIS problem: From the bipartite graph H = (A, B, F), we construct another graph G = (V, E) in which a vertex vi,j of V corresponds to the pair of parallel edges (ei,j, ei+1,j+1) of F; two vertices of V are conflicting if and only if the two corresponding pairs of parallel edges are conflicting, and two conflicting vertices of V are adjacent in G. One can see that a set of duos of A that can be preserved all together, a set of pairwise non-conflicting pairs of parallel edges of F, and an independent set in G, are XX:4 (1.4 + )-approximation for 2-Max-Duo (a) The bipartite graph H = (A, B, F ), where the ten edges in bold form a perfect matching. (b) The instance graph G = (V, E) of MIS, where the eight filled vertices form an independent set. Figure 2.1 An instance of the k-Max-Duo problem with A = (a, b, c, d, e, f, b, c, d, e) and B = (f, b, c, d, e, a, b, c, d, e). Figure 2.1a is the graphical view as a bipartite graph H = (A, B, F ), where a perfect matching consisting of the ten bold edges form into eight pairs of parallel edges, corresponding to the eight preserved duos (a, b), (b, c), (c, d), (d, e), (f, b), (b, c), (c, d) and (d, e). Fig- ure 2.1b shows the instance graph G = (V, E) of MIS constructed from H, where the independent set {v1,6, v2,7, v3,8, v4,9, v6,1, v7,2, v8,3, v9,4} corresponds to the eight pairs of parallel edges shown in Figure 2.1a, and consequently also corresponds to the eight preserved duos. In this instance, we have k = 2. Any maximum independent set of G must contain some of the degree-6 vertices, invalidating the (1.6 + )-approximation for 2-Max-Duo proposed in [5]. equivalent to each other. See Figure 2.1b for an example of the graph G = (V, E) constructed from the bipartite graph H shown in Figure 2.1a. We note that V ≤ k(n − 1) and thus G can be constructed in O(k2n2) time from the instance of the k-Max-Duo problem. In the graph G, for any v ∈ V , we use N(v) to denote the set of its neighbors, that is, the vertices adjacent to v. The two ordered letters in the duo corresponding to the vertex v is referred to as the letter content of v. For example, in Figure 2.1b, the letter content of v1,6 is "ab" and the letter content of v6,1 is "f b". Recall from the construction that there is an edge ei,j in the graph H = (A, B, F) if ai = bj, and there is a vertex vi,j in the graph G = (V, E) if the parallel edges ei,j and ei+1,j+1 are in H = (A, B, F). (cid:73) Lemma 2.1. The graph G = (V, E) has the following properties. 1. If vi,j, vi+2,j+2 ∈ V , then vi+1,j+1 ∈ V . 2. Given any subset of vertices V 0 ⊂ V , let F 0 = {ei,jvi,j ∈ V 0}, A0 = {aiei,j ∈ F 0}, and B0 = {bjei,j ∈ F 0}. If the subgraph H0 = (A0, B0, F 0) in H is connected, then all the vertices of V 0 have the same letter content; and consequently for any two vertices vi,j, vh,' ∈ V 0, we have both vh,j, vi,' ∈ V . 3. For any vi,j ∈ V , we have N(vi,j) = [ {vi0+p,j+p ∈ V i0 6= i} ∪ [ p=−1,0,1 p=−1,0,1 {vi+p,j0+p ∈ V j0 6= j}. (1) acebdbcdcabA:B:bdfcefede1234567891012345678910v1,6v2,7v3,8v4,9v2,2v3,3v4,4v7,7v8,8v9,9v6,1v7,2v8,3v9,4 Y. Xu et al. XX:5 to vi+1,j+1 ∈ V . Proof. By definition, vi,j ∈ V if and only if ei,j, ei+1,j+1 ∈ F. 1. If also vi+2,j+2 ∈ V , that is, ei+2,j+2, ei+3,j+3 ∈ F, then ei+1,j+1, ei+2,j+2 ∈ F leading 2. Note that an edge ei,j ∈ F if and only if the two vertices ai and bj are the same letter, and clearly each connected component in H is complete bipartite and all the vertices are the same letter. It follows that if the induced subgraph H0 = (A0, B0, F 0) in H is connected, then all its vertices are the same letter; furthermore, all the duos starting with these vertices have the same letter content; and therefore for any two vertices vi,j, vh,' ∈ V 0, both vh,j, vi,' ∈ V . 3. For any vertex vi,j, or equivalently the pair of parallel edges (ei,j, ei+1,j+1) in F, which are incident at four vertices ai, ai+1, bj, bj+1, a conflicting pair of parallel edges can be one of the six kinds: to share exactly one of the four vertices ai, ai+1, bj, bj+1, to share exactly two vertices ai and ai+1, and to share exactly two vertices bj and bj+1. The sets of these six kinds of conflicting pairs are as described in the lemma, for example, {vi0−1,j−1 ∈ V i0 6= i} is the set of conflicting pairs each sharing only the vertex bj with the pair vi,j. (cid:74) From Lemma 2.1 and its proof, we see that for any vertex of V there are at most k − 1 conflicting vertices of each kind (corresponding to a set in Equation (1)). We thus have the following corollary. (cid:73) Corollary 2.2. The maximum degree of the vertices in G = (V, E) is ∆ ≤ 6(k − 1). 2.1 When k = 2 We examine more properties for the graph G = (V, E) when k = 2. First, from Corollary 2.2 we have ∆ ≤ 6. Berman and Fujito [2] have presented an approximation algorithm with a performance ratio arbitrarily close to (∆ + 3)/5 for the MIS problem, on graphs with maximum degree ∆. This immediately implies a (1.8 + )-approximation for 2-Max-Duo. Our goal is to reduce the maximum degree of the graph G = (V, E) to achieve a better approximation algorithm. To this purpose, we examine all the degree-6 and degree-5 vertices in the graph G, and show a scheme to safely remove them from consideration when computing an independent set. This gives rise to a new graph G2 with maximum degree at most 4, leading to a desired (1.4 + )-approximation for 2-Max-Duo. We remark that, in our scheme we first remove the degree-6 vertices from G to compute an independent set, and later we add half of these degree-6 vertices to the computed independent set to become the final solution. Contrary to the claim that there always exists a maximum independent set in G containing no degree-6 vertices [5, Lemma 1], the instance in Figure 2.1 shows that any maximum independent set for the instance must contain some degree-6 vertices, thus invalidating the (1.6 + )-approximation for 2-Max-Duo proposed in [5]. In more details, the instance of 2-Max-Duo, illustrated in Figure 2.1, consists of two length-10 strings A = (a, b, c, d, e, f, b, c, d, e) and B = (f, b, c, d, e, a, b, c, d, e). The bipartite graph H = (A, B, F) is shown in Figure 2.1a and the instance graph G = (V, E) of the MIS problem is shown in Figure 2.1b. In the graph G, we have six degree-6 vertices: v2,2, v7,7, v3,3, v3,8, v8,3 and v8,8. One can check that {v1,6, v2,7, v3,8, v4,9, v6,1, v7,2, v8,3, v9,4} is an independent set in G, of size 8. On the other hand, if none of these degree-6 vertices is included in an independent set, then because the four vertices v4,4, v4,9, v9,4, v9,9 form a square implying that at most two of them can be included in the independent set, the XX:6 (1.4 + )-approximation for 2-Max-Duo independent set would be of size at most 6, and thus can never be a maximum independent set in G. Consider a duo (ai, ai+1) of the string A and for ease of presentation assume its letter content is "ab". If no duo of the string B has the same letter content "ab", then this duo of the string A can never be preserved; in fact this duo does not even become (a part of) a vertex of V of the graph G. If there is exactly one duo (bj, bj+1) of the string B having the same letter content "ab", then these two duos make up a vertex vi,j ∈ V , and from Lemma 2.1 we know that the degree of the vertex vi,j ∈ V is at most 5, since there 6= j sharing exactly the two letters ai and ai+1 with vi,j. is no such vertex vi,j0 with j0 Therefore, if the degree of the vertex vi,j ∈ V is six, then there must be two duos of the string A and two duos of the string B having the same letter content "ab". Assume the other duo of the string A and the other duo of the string B having the same letter content "ab" are (ai0, ai0+1) and (bj0, bj0+1), respectively. Then all four vertices vi,j, vi,j0, vi0,j, vi0,j0 exist in V . We call the subgraph of G induced on these four vertices a square, and denote it as S(i, i0; j, j0) = (V (i, i0; j, j0), E(i, i0; j, j0)), where V (i, i0; j, j0) = {vi,j, vi,j0, vi0,j, vi0,j0} and E(i, i0; j, j0) = {(vi,j, vi,j0), (vi,j, vi0,j), (vi0,j0, vi,j0), (vi0,j0, vi0,j)} due to their conflicting relationships. One clearly sees that every square has a unique letter content, which is the letter content of its four member vertices. In Figure 2.1b, there are three squares S(2, 7; 2, 7), S(3, 8; 3, 8) and S(4, 9; 4, 9), with their letter contents "bc", "cd" and "de", respectively. The above argument says that every degree-6 vertex of V must belong to a square, but the converse is not necessarily true, for example, all vertices of the square S(4, 9; 4, 9) have degree 4. We next characterize several properties of a square. The following lemma is a direct consequence of how the graph G is constructed and the fact that k = 2. (cid:73) Lemma 2.3. In the graph G = (V, E) constructed from an instance of 2-Max-Duo, 1. 2. for each index i, there are at most two distinct j and j0 such that vi,j, vi,j0 ∈ V ; if vi,j, vi,j0 ∈ V where j0 6= j, and vi+1,j00+1 ∈ V (or symmetrically, vi−1,j00−1 ∈ V ), then either j00 = j or j00 = j0. (cid:73) Lemma 2.4. For any square S(i, i0; j, j0) in the graph G = (V, E), N(vi,j) = N(vi0,j0), N(vi,j0) = N(vi0,j), and N(vi,j) ∩ N(vi,j0) = ∅. (Together, these imply that every vertex of V is adjacent to either none or exactly two of the four member vertices of a square.) Proof. Consider the two vertices vi,j and vi0,j0, which have common neighbors vi,j0 and vi0,j in the square. Note that vi,j0 and vi,j share both the letters ai and ai+1. If there is a vertex adjacent to vi,j by sharing ai+1 but not ai, then this vertex is vi+1,j00+1 with j00 6= j, and thus it has to be vi+1,j0+1 (by Lemma 2.3). We consider two subcases: If i + 1 = i0 − 1, then j0 + 1 = j − 1 due to k = 2. Thus, this vertex vi+1,j0+1 actually shares ai+1 and bj with vi,j; also, it shares ai0 and bj0+1 with vi0,j0; and therefore it is adjacent to vi0,j0 too, but not adjacent to vi,j0 or vi0,j. If i + 1 6= i0 − 1, then this vertex vi+1,j0+1 shares only aj+1 with the vertex vi,j; also it shares only bj0+1 with vi0,j0; and therefore it is adjacent to vi0,j0 too, but not adjacent to vi,j0 or vi0,j. The other three symmetric cases can be discussed exactly the same and the lemma is (cid:74) proved. (cid:73) Corollary 2.5. In the graph G = (V, E), the degree-6 vertices can be partitioned into pairs, where each pair of degree-6 vertices belong to a square in G and they are adjacent to the same six other vertices, two inside the square and four outside of the square. Y. Xu et al. XX:7 Proof. We have seen that every degree-6 vertex in the graph G must be in a square. The above Lemma 2.4 states that the four vertices of a square S(i, i0; j, j0) can be partitioned into two pairs, {vi,j, vi0,j0} and {vi,j0, vi0,j}, and the two vertices inside each pair are non-adjacent to each other and have the same neighbors. In particular, if the vertex vi,j in the square S(i, i0; j, j0) has degree 6, then Lemma 2.1 states that it is adjacent to the six vertices (cid:74) vi−1,j0−1, vi,j0, vi+1,j0+1, vi0−1,j−1, vi0,j, vi0+1,j+1 (see an illustration in Figure 2.2). Figure 2.2 The square S(i, i0; j, j0) shown in bold lines. The two non-adjacent vertices vi,j and vi0,j0 of the square form a pair stated in Corollary 2.5; they have 6 common neighbors, of which two inside the square and four outside of the square. (cid:73) Corollary 2.6. If there is no square in the graph G = (V, E), then every degree-5 vertex is adjacent to a degree-1 vertex. Proof. Assume the vertex vi,j has degree 5. Due to the non-existence of any square in the graph G and Lemma 2.1, either there is no vertex sharing exactly the two letters ai and ai+1 with vi,j, or there is no vertex sharing exactly the two letters bj and bj+1 with vi,j. We assume without loss of generality that there is no vertex sharing exactly the two letters ai and ai+1 with vi,j, and furthermore assume vi0,j, i0 6= i, is the vertex sharing exactly the two letters bj and bj+1 with vi,j. It follows that N(vi,j) = {vi−1,j00−1, vi+1,j000+1, vi0−1,j−1, vi0,j, vi0+1,j+1}, for some j00 6= j and j000 6= j. Due to k = 2, this implies that ai−1 6= bj−1 = ai0−1 and ai+2 6= bj+2 = ai0+2. Therefore, there is no vertex of V sharing exactly the letter ai0 (ai0+1, bj, bj+1, respectively) with the vertex vi0,j, neither a vertex of V sharing exactly the two letters ai0 and ai0+1 with (cid:74) the vertex vi0,j. That is, the vertex vi0,j is adjacent to only vi,j in the graph G. We say the two vertices vi,j and vi+1,j+1 of V are consecutive; and we say the two squares S(i, i0; j, j0) and S(i + 1, i0 + 1; j + 1, j0 + 1) in G are consecutive. Clearly, two consecutive squares contain four pairs of consecutive vertices. The following Lemma 2.7 summarizes the fact that when two consecutive vertices belong to two different squares, then these two squares are also consecutive (and thus contain the other three pairs of consecutive vertices). (cid:73) Lemma 2.7. In the graph G, if there are two consecutive vertices vi,j and vi+1,j+1 belonging to two different squares S(i1, i0 2 = 1 + 1, j2 = j1 + 1, j0 i0 Proof. This is a direct result of the fact that no two distinct squares have any member vertex (cid:74) in common. A series of p consecutive squares {S(i + q, i0 + q; j + q, j0 + q), q = 0, 1, . . . , p − 1} in the graph G, where p ≥ 1, is maximal if none of the square S(i − 1, i0 − 1; j − 1, j0 − 1) and the square S(i + p, i0 + p; j + p, j0 + p) exists in the graph G. Note that the non-existence of 1 + 1, i.e., these two squares are consecutive. 1) and S(i2, i0 2 = j0 1; j1, j0 2; j2, j0 2) respectively, then i2 = i1 + 1, i0 vi,jvi′,j′vi−1,j′−1vi,j′vi+1,j′+1vi′−1,j−1vi′,jvi′+1,j+1 XX:8 (1.4 + )-approximation for 2-Max-Duo (a) The bipartite graph H = (A, B, F ). (b) The instance graph G = (V, E). (c) The bipartite graph H0 = (A0, B0, F 0) after removal of S2(2, 8; 2, 8). (d) The updated instance graph G0 = (V 0, E0) after removal of S2(2, 8; 2, 8). Figure 2.3 An instance of the 2-Max-Duo problem with A = (a, b, c, d, e, f, g, b, c, d, e, h, y, x) and B = (g, b, c, d, e, h, a, b, c, d, x, y, e, f). The bipartite graph H = (A, B, F ) is shown in Figure 2.3a and the instance graph G = (V, E) of the MIS problem is shown in Figure 2.3b. There is a maximal series of 2 squares S2(2, 8; 2, 8) in the graph G, with the four substrings "bcd". The bipartite graph H0 = (A0, B0, F 0) is shown in Figure 2.3c and the graph G0 = (V 0, E0) is shown in Figure 2.3d, on A0 = (a, d, e, f, g, d, e, h, y, x) and B0 = (g, d, e, h, a, d, x, y, e, f). Applying the vertex contracting process on G also gives the graph G0. the square S(i − 1, i0 − 1; j − 1, j0 − 1) in G does not rule out the existence of some of the four vertices vi−1,j−1, vi0−1,j0−1, vi−1,j0−1, vi0−1,j−1 in V ; in fact by Lemma 2.1 there can be as many as two of these four vertices existing in V (however, more than two would imply the existence of the square). Similarly, there can be as many as two of the four vertices vi+p,j+p, vi0+p,j0+p, vi+p,j0+p, vi0+p,j+p existing in V . In the sequel, a maximal series of p consecutive squares starting with S(i, i0; j, j0) is denoted as S p(i, i0; j, j0), where p ≥ 1. See for an example in Figure 2.3b where there is a maximal series of 2 consecutive squares S2(2, 8; 2, 8), where the instance of the 2-Max-Duo is expanded slightly from the instance shown in Figure 2.1. (cid:73) Lemma 2.8. Suppose S p(i, i0; j, j0), where p ≥ 1, exists in the graph G. Then, 1. the two substrings (ai, ai+1, . . . , ai+p) and (ai0, ai0+1, . . . , ai0+p) of the string A and the two substrings (bj, bj+1, . . . , bj+p) and (bj0, bj0+1, . . . , bj0+p) of the string B are identical and do not overlap; if a maximum independent set of G contains less than 2p vertices from S p(i, i0; j, j0), then it must contain either the four vertices vi−1,j−1, vi0−1,j0−1, vi0+p,j+p, vi+p,j0+p or the four vertices vi0−1,j−1, vi−1,j0−1, vi+p,j+p, vi0+p,j0+p. 2. Proof. By the definition of the square S(i + q, i0 + q; j + q, j0 + q), we have ai+q = ai0+q and ai+q+1 = ai0+q+1; we thus conclude that the two substrings (ai, ai+1, . . . , ai+p) and (ai0, ai0+1, . . . , ai0+p) are identical. In Figure 2.3b, for S2(2, 8; 2, 8) the two substrings are "bcd". If these two substrings overlapped, then there would be three occurrences of at least one letter, contradicting the fact that k = 2. This proves the first item. Note that the square S(i − 1, i0 − 1; j − 1, j0 − 1) does not exist in the graph G, and thus abcdefgbgbcdehabA:B:12345678123456789c10d11e12h13y14xcdxyef91011121314v2,2v3,3v4,4v10,4v1,7v2,8v3,9v7,1v8,2v9,3v8,8v9,9v11,5v5,13adefggdehaA:B:145671456710d11e12h13y14xdxyef1011121314v4,4v10,4v1,7v7,1v11,5v5,13 Y. Xu et al. XX:9 at most two of its four vertices (which are vi−1,j−1, vi0−1,j−1, vi−1,j0−1 and vi0−1,j0−1) exist in V . We claim that if no vertex of the square S(i, i0; j, j0) is in I∗, then there are exactly two of the four vertices vi−1,j−1, vi0−1,j−1, vi−1,j0−1 and vi0−1,j0−1 exist in V and they both are in I∗. Suppose otherwise there is at most one of the four vertices in I∗, say vi−1,j−1; we may increase the size of I∗ by removing vi−1,j−1 while adding either the two vertices vi,j and vi0,j0 or the two vertices vi0,j and vi,j0 (depending on which vertices of the square S(i + 1, i0 + 1; j + 1, j0 + 1) are in I∗), a contradiction. To summarize, we proved in the above two paragraphs that if I∗ contains less than 2p ver- Assume next that a vertex of the square S(i, i0; j, j0) is in I∗, say vi,j; then due to maximality of I∗ and Lemma 2.4 both vi,j and vi0,j0 are in I∗. We claim and prove similarly as in the last paragraph that if no vertex of the square S(i+1, i0 +1; j +1, j0 +1) is in I∗, then there are exactly two of the four vertices vi−1,j−1, vi0−1,j−1, vi−1,j0−1 and vi0−1,j0−1 exist in V and they both are in I∗. If there is a vertex of the square S(i+1, i0 +1; j +1, j0 +1) in I∗, then it must be one of vi+1,j+1 and vi0+1,j0+1; and due to maximality and Lemma 2.4 both vi+1,j+1 and vi0+1,j0+1 are in I∗. And so on; repeatedly applying this argument, we claim and prove similarly that if no vertex of the square S(i+ p−1, i0 + p−1; j + p−1, j0 + p−1) is in I∗, then there are exactly two of the four vertices vi−1,j−1, vi0−1,j−1, vi−1,j0−1 and vi0−1,j0−1 exist in V and they both are in I∗. If there is a vertex of the square S(i+p−1, i0+p−1; j+p−1, j0+p−1) in I∗, then it must be one of vi+p−1,j+p−1 and vi0+p−1,j0+p−1; and due to maximality and Lemma 2.4 both vi+p−1,j+p−1 and vi0+p−1,j0+p−1 are in I∗. tices from S p(i, i0; j, j0), then there are exactly two of the four vertices vi−1,j−1, vi0−1,j−1, vi−1,j0−1 and vi0−1,j0−1 exist in V and they both are in I∗; and these two vertices are either vi−1,j−1 and vi0−1,j0−1 or vi0−1,j−1 and vi−1,j0−1. Symmetrically, there are exactly two of the four vertices vi+p,j+p, vi0+p,j+p, vi+p,j0+p and vi0+p,j0+p exist in V and they both are in I∗; and these two vertices are either vi+p,j+p and vi0+p,j0+p or vi0+p,j+p and vi+p,j0+p. Clearly from the above, when the combination is vi−1,j−1 and vi0−1,j0−1 versus vi+p,j+p and vi0+p,j0+p, we may increase the size of I∗ to contain exactly 2p vertices from S p(i, i0; j, j0) without affecting any vertex outside of S p(i, i0; j, j0), a contradiction. Therefore, the only possible combinations are vi−1,j−1 and vi0−1,j0−1 versus vi0+p,j+p and vi+p,j0+p, and vi0−1,j−1 and vi−1,j0−1 versus (cid:74) vi+p,j+p and vi0+p,j0+p. This proves the second item of the lemma. Suppose S p(i, i0; j, j0), where p ≥ 1, exists in the graph G. Let A0 denote the string ob- tained from A by removing the two substrings (ai, ai+1, . . . , ai+p−1) and (ai0, ai0+1, . . . , ai0+p−1) and concatenating the remainder together, and B0 denote the string obtained from B by removing the two substrings (bj, bj+1, . . . , bj+p−1) and (bj0, bj0+1, . . . , bj0+p−1) and concat- enating the remainder. Let the graph G0 = (V 0, E0) denote the instance graph of the MIS problem constructed from the two strings A0 and B0. See for an example G0 in Figure 2.3d, where there is a maximal series of 2 consecutive squares S2(2, 8; 2, 8) in the graph G. (cid:73) Corollary 2.9. Suppose S p(i, i0; j, j0), where p ≥ 1, exists in the graph G. Then, the union of a maximum independent set in the graph G0 = (V 0, E0) and certain 2p vertices from S p(i, i0; j, j0) becomes a maximum independent set in the graph G = (V, E), where these certain 2p vertices are vi,j, vi+1,j+1, . . . , vi+p−1,j+p−1 and vi0,j0, vi0+1,j0+1, . . . , vi0+p−1,j0+p−1 if vi−1,j−1 or vi+p,j+p is in the maximum independent set in G0, or they are vi0,j, vi0+1,j+1, . . ., vi0+p−1,j+p−1 and vi,j0, vi+1,j0+1, . . . , vi+p−1,j0+p−1 if vi0−1,j−1 or vi0+p,j+p is in the maximum independent set in G0. Proof. Consider the construction of the graph G0 = (V 0, E0) from the two strings A0 and B0. Equivalently, starting with the graph G = (V, E), if we contract the p vertices vi,j, vi+1,j+1, . . . , vi+p−1,j+p−1 into the vertex vi+p,j+p if it exists or otherwise into a void XX:10 (1.4 + )-approximation for 2-Max-Duo vertex, contract the p vertices vi0,j0, vi0+1,j0+1, . . . , vi0+p−1,j0+p−1 into the vertex vi0+p,j0+p if it exists or otherwise into a void vertex, contract the p vertices vi0,j, vi0+1,j+1, . . . , vi0+p−1,j+p−1 into the vertex vi0+p,j+p if it exists or otherwise into a void vertex, and contract the p vertices vi,j0, vi+1,j0+1, . . . , vi+p−1,j0+p−1 into the vertex vi+p,j0+p if it exists or otherwise into a void vertex, then we obtain a graph that is exactly G0. In the graph G0, the vertices vi−1,j−1 and vi0+p,j+p, if both exist in V , become adjacent to each other; so are the vertices vi0−1,j−1 and vi+p,j+p, if both exist in V . It follows that the maximum independent set in the graph G0 = (V 0, E0) does not contain both vertices vi−1,j−1 and vi0+p,j+p, or both vertices vi0−1,j−1 and vi+p,j+p. Therefore, starting with the maximum independent set in the graph G0 = (V 0, E0), we can add exactly 2p vertices from S p(i, i0; j, j0) to form an independent set in G, of which the maximality can be proved by a simple contradiction. We remark that in the extreme case where none of the vertices of S(i−1, i0−1; j−1, j0−1) and none of the vertices of S(i + p, i0 + p; j + p, j0 + p) are in the maximum independent set in G0, we may add either of the two sets of 2p vertices from S p(i, i0; j, j0) to form a maximum (cid:74) independent set in G. Iteratively applying the above string shrinkage process, or equivalently the vertex con- tracting process, associated with the elimination of a maximal series of consecutive squares. In O(n) iterations, we achieve the final graph containing no squares, which we denote as G1 = (V1, E1). An approximation algorithm for 2-Max-Duo 3 A high-level description of the approximation algorithm, denoted as Approx, for the 2-Max- Duo problem is depicted in Figure 3.1. Algorithm Approx 1: Construct the graph G = (V, E) from two input strings A and B; 2: while (there is a square in the graph) do 3: 4: 5: 6: end while 7: denote the resultant graph as G1 = (V1, E1); 8: set L1 to contain all degree-0 and degree-1 vertices of G1; 9: set N[L1] to be the closed neighborhood of L1 in G1, i.e. N[L1] = L1 ∪ N(L1); 10: set G2 = G1[V1 − N[L1]], the subgraph of G1 induced on V1 − N[L1]; 11: compute an independent set I2 in G2 by the ((∆ + 3)/5 + )-approximation in [2]; 12: set I1 = I2 ∪ L1, an independent set in G1; 13: return an independent set I in G using I1 and Corollary 2.9. find a maximal series of squares; locate the four identical substrings of A and B as in Lemma 2.8; remove the corresponding substrings and accordingly update the graph; Figure 3.1 A high-level description of the approximation algorithm for 2-Max-Duo. In more details, given an instance of the 2-Max-Duo problem with two length-n strings A and B, the first step of our algorithm is to construct the graph G = (V, E), which is done in O(n2) time. In the second step (Lines 2 -- 7 in Figure 3.1), it iteratively applies the vertex contracting process presented in Section 2 at the existence of a maximal series of consecutive squares, and at the end it achieves the final graph G1 = (V1, E1) which does not contain any square. This second step can be done in O(n2) time too since each iteration of vertex contracting process is done in O(n) time and there are O(n) iterations. In the third step (Lines 8 -- 10 in Figure 3.1), let L1 denote the set of singletons (degree-0 vertices) Y. Xu et al. XX:11 independent (a) The = I1 {v1,7, v7,1, v10,4, v11,5, v5,13} in G1, con- sisting of all the five leaves of G1 = G0 shown in Figure 2.3d. set (b) Using I1, since v10,4 ∈ I1, the four vertices v2,8, v3,9, v8,2, v9,3 are added to form an independent set I in the original graph G shown in Figure 2.3b. (c) The parallel edges of H corresponding to the independent set I shown in Figure 3.2b, also correspond to the 9 preserved duos (a, b), (b, c), (c, d), (e, f), (g, b), (b, c), (c, d), (d, e), (e, h) for the instance shown in Figure 2.3a. Figure 3.2 Illustration of the execution of our algorithm Approx on the instance shown in Figure 2.3. The independent set I1 in the graph G1 is shown in Figure 3.2a in filled circles, for which we did not apply the state-of-the-art approximation algorithm for the MIS problem. The independent set I in the graph G is shown in Figure 3.2b in filled circles, according to Corollary 2.9 the four vertices v2,8, v3,9, v8,2, v9,3 are added due to v10,4 ∈ I1. The parallel edges of H corresponding to the vertices of I are shown in Figure 3.2c, representing a feasible solution to the 2-Max-Duo instance shown in Figure 2.3. and leaves (degree-1 vertices) in the graph G1; our algorithm removes all the vertices of L1 and their neighbors from the graph G1 to obtain the remainder graph G2 = (V2, E2). This step can be done in O(n2) time too due to V1 ≤ V ≤ 2n, and the resultant graph G2 has maximum degree ∆ ≤ 4 by Corollaries 2.5 and 2.6. (See for an example illustrated in Figure 3.2a.) In the fourth step (Lines 11 -- 12 in Figure 3.1), our algorithm calls the state-of-the-art approximation algorithm for the MIS problem [2] on the graph G2 to obtain an independent set I2 in G2; and returns I1 = L1 ∪ I2 as an independent set in the graph G1. The running time of this step is dominated by the running time of the state-of-the-art approximation algorithm for the MIS problem, which is a high polynomial in n and 1/. In the last step (Line 13 in Figure 3.1), using the independent set I1 in G1, our algorithm adds 2p vertices from each maximal series of p consecutive squares according to Corollary 2.9, to produce an independent set I in the graph G. (For an illustrated example see Figure 3.2b.) The last step can be done in O(n) time. The state-of-the-art approximation algorithm for the MIS problem on a graph with maximum degree ∆ has a performance ratio of (∆ + 3)/5 + , for any  > 0 [2]. (cid:73) Lemma 3.1. In the graph G1 = (V1, E1), let OPT1 denote the cardinality of a maximum independent set in G1, and let SOL1 denote the cardinality of the independent set I1 returned by the algorithm Approx. Then, OPT1 ≤ (1.4 + )SOL1, for any  > 0. v4,4v10,4v1,7v7,1v11,5v5,13v2,2v3,3v4,4v10,4v1,7v2,8v3,9v7,1v8,2v9,3v8,8v9,9v11,5v5,13abcdefgbgbcdehabA:B:12345678123456789c10d11e12h13y14xcdxyef91011121314 XX:12 (1.4 + )-approximation for 2-Max-Duo Proof. Let L1 denote the set of singletons (degree-0 vertices) and leaves (degree-1 vertices) in the graph G1; our algorithm Approx removes all the vertices of L1 and their neighbors from the graph G1 to obtain the remainder graph G2 = (V2, E2). The graph G2 has maximum degree ∆ ≤ 4 by Corollaries 2.5 and 2.6. Let OPT2 denote the cardinality of a maximum independent set in G2, and let SOL2 denote the cardinality of the independent set I2 returned by the state-of-the-art approximation algorithm for the MIS problem. We have OPT1 = L1 + OPT2 and OPT2 ≤ (1.4 + )SOL2, for any  > 0. Therefore, OPT1 ≤ L1 + (1.4 + )SOL2 ≤ (1.4 + )(L1 + SOL2) = (1.4 + )SOL1. (cid:74) This proves the lemma. (cid:73) Theorem 3.2. The 2-Max-Duo problem can be approximated within a ratio arbitrarily close to 1.4, by a linear reduction to the MIS problem. Proof. We prove by induction. At the presence of maximal series of p consecutive squares, we perform the vertex contracting process iteratively. In each iteration to handle one maximal series of p consecutive squares, let G and G0 denote the graph before and after the contracting step, respectively. Let OPT0 denote the cardinality of a maximum independent set in G0, and let SOL0 denote the cardinality of the independent set I0 returned by the algorithm Approx. Given any  > 0, from Lemma 3.1, we may assume that OPT0 ≤ (1.4 + )SOL0. Let OPT denote the cardinality of a maximum independent set in G, and let SOL denote the cardinality of the independent set returned by the algorithm Approx, which adds 2p vertices from the maximal series of p consecutive squares to the independent set I0 in G0, according to Corollary 2.9, to produce an independent set I in the graph G. Lemma 2.8 states that OPT = OPT0 + 2p. Therefore, OPT = OPT0 + 2p ≤ (1.4 + )SOL0 + 2p ≤ (1.4 + )(SOL0 + 2p) = (1.4 + )SOL. This proves that for the original graph G = (V, E) we also have OPT ≤ (1.4 + )SOL accordingly. That is, the worst-case performance ratio of our algorithm Approx is 1.4 + , for any  > 0. The time complexity of the algorithm Approx has been determined to be polynomial at the beginning of the section, and it is dominated by the time complexity of the state-of-the-art approximation algorithm for the MIS problem. The theorem is thus (cid:74) proved. Conclusion 4 In this paper, we examined the Max-Duo problem, the complement of the well studied minimum common string partition problem. Based on an existing linear reduction to the maximum independent set (MIS) problem [16, 5], we presented a vertex-degree reduction technique for the 2-Max-Duo to reduce the maximum degree of the constructed instance graph to 4. Along the way, we uncovered many interesting structural properties of the constructed instance graph. This degree reduction enables us to adopt the state-of-the- art approximation algorithm for the MIS problem on low degree graphs [2] to achieve a (1.4 + )-approximation for 2-Max-Duo, for any  > 0. It is worth mentioning that our vertex-degree reduction technique can be applied for k-Max-Duo with k ≥ 3. In fact, we had worked out the details for k = 3, to reduce the maximum degree of the constructed instance graph from 12 to 10, leading to a (2.6 + )- approximation for 3-Max-Duo, for any  > 0. Nevertheless, the (2.6 + )-approximation is superseded by the (2 + )-approximation for the general Max-Duo [14]. Y. Xu et al. XX:13 It would be worthwhile to investigate whether the maximum degree can be further reduced to 3, by examining the structural properties associated with the degree-4 vertices. On the other hand, it is also interesting to examine whether a better-than-1.4 approximation algorithm can be designed directly for the MIS problem on those degree-4 graphs obtained at the end of the vertex contracting process. Acknowledgements. All authors are supported by NSERC Canada. Additionally, Chen is supported by the NSFC Grants No. 11401149, 11571252 and 11571087, and the China Scholarship Council Grant No. 201508330054; Liu is supported by the NSFC Grant Nos. 61370052 and 61370156. Luo is supported by the NSFC Grant No. 71371129 and the PSF China Grant No. 2016M592680; Lin and Zhang are supported by the NSFC Grant No. 61672323. 1 2 3 References S. Beretta, M. Castelli, and R. Dondi. Parameterized tractability of the maximum-duo preservation string mapping problem. Theoretical Computer Science, 646:16 -- 25, 2016. P. Berman and T. Fujito. On approximation properties of the independent set problem for low degree graphs. Theory of Computing Systems, 32:115 -- 132, 1999. P. Berman and M. Karpinski. On some tighter inapproximability results. In Proceedings of the of 26th International Colloquium on Automata, Languages and Programming (IC- ALP'99), pages 200 -- 209, 1999. 4 N. Boria, G. Cabodi, P. Camurati, M. Palena, P. Pasini, and S. Quer. A 7/2-approximation algorithm for the maximum duo-preservation string mapping problem. In Proceedings of the 27th Annual Symposium on Combinatorial Pattern Matching (CPM 2016), volume 54 of LIPIcs, pages 11:1 -- 11:8, 2016. 5 N. Boria, A. Kurpisz, S. Leppänen, and M. Mastrolilli. Improved approximation for the maximum duo-preservation string mapping problem. In Proceedings of the 14th Interna- tional Workshop on Algorithms in Bioinformatics (WABI 2014), volume 8701 of LNBI, pages 14 -- 25, 2014. 6 B. Brubach. Further improvement in approximating the maximum duo-preservation string In Proceedings of the 16th International Workshop on Algorithms in mapping problem. Bioinformatics (WABI 2016), volume 9838 of LNBI, pages 52 -- 64, 2016. L. Bulteau, G. Fertin, C. Komusiewicz, and I. Rusu. A fixed-parameter algorithm for minimum common string partition with few duplications. In Proceedings of the 13th Inter- national Workshop on Algorithms in Bioinformatics (WABI 2013), volume 8126 of LNBI, pages 244 -- 258, 2013. L. Bulteau and C. Komusiewicz. Minimum common string partition parameterized by partition size is fixed-parameter tractable. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA'14), pages 102 -- 121, 2014. 7 8 9 W. Chen, Z. Chen, N. F. Samatova, L. Peng, J. Wang, and M. Tang. Solving the maximum duo-preservation string mapping problem with linear programming. Theoretical Computer Science, 530:1 -- 11, 2014. 10 X. Chen, J. Zheng, Z. Fu, P. Nan, Y. Zhong, S. Lonardi, and T. Jiang. Assignment of orthologous genes via genome rearrangement. IEEE/ACM Transactions on Computational Biology and Bioinformatics, 2:302 -- 315, 2005. 11 M. Chrobak, P. Kolman, and J. Sgall. The greedy algorithm for the minimum common string partition problem. In Proceedings of the 7th International Workshop on Approxim- ation Algorithms for Combinatorial Optimization Problems (APPROX 2004) and the 8th XX:14 (1.4 + )-approximation for 2-Max-Duo 13 International Workshop on Randomization and Computation (RANDOM 2004), volume 3122 of LNCS, pages 84 -- 95, 2004. 12 G. Cormode and S. Muthukrishnan. The string edit distance matching problem with moves. ACM Transactions on Algorithms, 3:2:1 -- 2:19, 2007. P. Damaschke. Minimum common string partition parameterized. In Proceedings of the 8th International Workshop on Algorithms in Bioinformatics (WABI 2008), volume 5251 of LNBI, pages 87 -- 98, 2008. 14 B. Dudek, P. Gawrychowski, and P. Ostropolski-Nalewaja. A family of approximation algorithms for the maximum duo-preservation string mapping problem. arXiv, 1702.02405, 2017. 15 M. R. Garey and D. S. Johnson. Computers and Intractability: A Guide to the Theory of NP-completeness. W. H. Freeman and Company, San Francisco, 1979. 16 A. Goldstein, P. Kolman, and J. Zheng. Minimum common string partition problem: Hardness and approximations. In Proceedings of the 15th International Symposium on Algorithms and Computation (ISAAC 2004), volume 3341 of LNCS, pages 484 -- 495, 2004. 17 H. Jiang, B. Zhu, D. Zhu, and H. Zhu. Minimum common string partition revisited. Journal 18 19 of Combinatorial Optimization, 23:519 -- 527, 2012. P. Kolman and T. Waleń. Reversal distance for strings with duplicates: Linear time ap- proximation using hitting set. In Proceedings of the 4th International Workshop on Ap- proximation and Online Algorithms (WAOA 2006), volume 4368 of LNCS, pages 279 -- 289, 2006. P. Kolman and T. Waleń. Approximating reversal distance for strings with bounded number of duplicates. Discrete Applied Mathematics, 155:327 -- 336, 2007. 20 Y. Xu, Y. Chen, T. Luo, and G. Lin. A local search 2.917-approximation algorithm for duo-preservation string mapping. arXiv, 1702.01877, 2017.
1506.06284
1
1506
2015-06-20T19:20:23
Upper bound on the number of steps for solving the subset sum problem by the Branch-and-Bound method
[ "cs.DS", "cs.CC" ]
We study the computational complexity of one of the particular cases of the knapsack problem: the subset sum problem. For solving this problem we consider one of the basic variants of the Branch-and-Bound method in which any sub-problem is decomposed along the free variable with the maximal weight. By the complexity of solving a problem by the Branch-and-Bound method we mean the number of steps required for solving the problem by this method. In the paper we obtain upper bounds on the complexity of solving the subset sum problem by the Branch-and-Bound method. These bounds can be easily computed from the input data of the problem. So these bounds can be used for the the preliminary estimation of the computational resources required for solving the subset sum problem by the Branch-and-Bound method.
cs.DS
cs
Upper bound on the number of steps for solving the subset sum problem by the Branch-and-Bound method Lomonosov Moscow State University, Leninskie Gory, Roman Kolpakov Moscow, 119992 Russia Email: [email protected] Mikhail Posypkin Institute for Information Transmission Problems, Bolshoy Karetny per., Moscow, 127994 Russia Email: [email protected] Abstract We study the computational complexity of one of the particular cases of the knapsack problem: the subset sum problem. For solving this prob- lem we consider one of the basic variants of the Branch-and-Bound method in which any sub-problem is decomposed along the free variable with the maximal weight. By the complexity of solving a problem by the Branch- and-Bound method we mean the number of steps required for solvig the problem by this method. In the paper we obtain upper bounds on the complexity of solving the subset sum problem by the Branch-and-Bound method. These bounds can be easily computed from the input data of the problem. So these bounds can be used for the the preliminary estima- tion of the computational resources required for solving the subset sum problem by the Branch-and-Bound method. 1 Introduction The Branch-and-Bound method is one of the most popular approaches to solve global continuous and discrete optimization problems. By the complexity of solving a problem by the Branch-and-Bound method we mean the number of decomposition steps (branches) required for solvig the problem by this method. In this paper we consider the Branch-and-Bound method for the subset sum problem. The subset sum problem is a particular case of the knapsack problem where for each item the price is equal to the weight of the item. The subset sum problem is stated as follows: maximize f (x) =Pi∈N xiwi, subject to g(x) =Pi∈N xiwi ≤ C, xi ∈ {0, 1}, i ∈ N, (1) 1 where N = {1, . . . , n} is a set of integers between 1 and n, a capacity C and weights wi for i ∈ N are positive integral numbers. It is well known that subset sum problem is NP-hard. It means that the worst case complexity for the Branch-and-Bound method is an exponential function of n. However the number of steps may vary significantly for the problems with the same number of variables. That is why knapsack algorithms are usually tested on a series of problems generated in a different way (see Martello and Toth [10] or Kellerer et al. [11]). Knowing the complexity bounds that depend on the problem input coefficients as well the problem dimension is very important because such bounds can help to select a proper resolution method and estimate resources needed to solve the problem. Questions of the computational comlexity of boolean programming were ac- tively studied in the literature. Jeroslow considered [6] the boolean function maximization problem with equality constraints. For the considered problem a wide class of the Branch-and-Bound algorithms was studied, and it was shown that the time complexity of solving the problem by any algorithm from this class is Ω(2n/2) where n is the number of the problem variables. A similar example of difficult knapsack problem was presented in Finkelshein [3]. It was proved that, for any Branch-and-Bound algorithm solving the considered problem, the prob- lem resolution tree contains at least 2(cid:0) n+1 ⌊n/2⌋+1(cid:1) − 1 nodes where n is the number of the problem variables. In Kolpakov and Posypkin [7] the infinite series of knapsack instances was constructed which demonstated that the for a particu- lar variant of Branch-and-Bound method proposed by Greenberg and Hegerich [4], the complexity can be asymptotically 1.5 times greater than 2(cid:0) n+1 Thus it was shown that the maximum complexity of solving a knapsack problem by the considered method is significantly greater than the lower bound for this value obtained in Finkelshtein [3]. ⌊n/2⌋+1(cid:1) − 1. The problems proposed by Jeroslow [6] or Finkelshtein [3] have actually a quite simple form: the weights of all the problem variables are equal. Such problems can be easily resolved by the modified Branch-and-Bound method enchanced with the the dominance relation. Paper Chvatal [2] dealt with recur- sive algorithms that use the dominance relation and improved linear relaxation to reduce the enumeration. The author suggested a broad series of problems unsolvable by such algorithms in a polynomial time. The Branch-and-Bound complexity for integer knapsack problems were con- sidered by Aardal [1] and by Krishnamoorthy [9]. Several papers were devoted to obtaining upper bounds on complexity of solving boolean knapsack problems by the Branch-and-Bound method. In Grishuknin [5] an upper bound on the complexity of solving a boolean knapsack problem by the majoritarian Branch- and-Bound algorithm was proposed. This bound depends only on the number of problem variables n and ignores problem coefficients. In Kolpakov and Posyp- kin [8] upper bounds for the complexity of solving a boolean knapsack problem by the Branch-and-Bound algorithms with an arbitrary choice of decomposition variable were obtained. Unlike bounds proposed in Girshukhin [5], these bounds take into account both problem size and coefficients. 2 2 Preliminaries A boolean tuple x = (x1, x2, . . . , xn) such that g(x) ≤ C is called a feasible solution of the problem (1). A feasible solution x of a problem (1) is called an optimal solution if for any other feasible solution y of the problem (1) the inequality f (y) ≤ f (x) holds. Solving the problem (1) means finding at least one of its optimal solutions. We define a map as a pair (I, θ) of a set I ⊆ N and a mapping θ : I → {0, 1}. Any map (I, θ) defines a subproblem formulated as follows: maximize f (x) =Pi∈N wixi, subject to g(x) =Pi∈N wixi ≤ C, xi = θ(i), i ∈ I, xi ∈ {0, 1}, i ∈ N \ I. (2) The set {xi The set {xi : i ∈ I} is called the set of fixed variables of the subproblem (2). : i ∈ N \ I} is called the set of free variables of this subproblem. In the sequel we will refer to the subproblem (2) as the respective or corre- sponding subproblem for the map (I, θ) and will refer to the map (I, θ) as the respective or corresponding map for subproblem (2). A boolean tuple x = (x1, x2, . . . , xn) such that g(x) ≤ C, xi = θ(i), i ∈ I, is called a feasible solution of subproblem (2). Clearly, any feasible solution of subproblem (2) is a feasible solution of problem (1) as well. A feasible solution x of subproblem (2) is called optimal if for any other feasible solution y of this subproblem the inequality f (y) ≤ f (x) holds. For any map z = (I, θ) define its 1-complement z(1) as a tuple 1 , z(1) 2 , . . . , z(1) n ) such that (z(1) z(1) i =(θ(i), i ∈ I, 1, i ∈ N \ I. The 0-complement z(0) = (z(0) n ) of the map z is defined as 1 , z(0) 2 , . . . , z(0) follows: z(0) i =(θ(i), i ∈ I, 0, i ∈ N \ I. Let W = Pi∈N wi. subproblem (2) satisfies C0-condition if Pi∈I θ(i)wi > C and satisifies C1-condition if Pi∈I (1 − θ(i))wi ≥ W − C. This following statement is an immediate consequence of the C0-condition definition. Proposition 1 A subproblem (2), satisfying C0-condition, has no feasible so- lutions. Proposition 2 If a subproblem (2) satisfies C1-condition then the 1- complement of the respective map (I, θ) is an optimal solution for this sub- problem. 3 Proof. Let a subproblem (2) satisfy C1-condition, and z(1) be the 1- complement of the map z = (I, θ). Then C ≥ W −Xi∈I ThereforePi∈N z(1) (1 − θ(i))wi =Xi∈I θ(i)wi + Xi∈N \I wi =Xi∈N z(1) i wi. i wi ≤ C, so z(1) is a feasible solution of the subproblem (2). Since in z(1) all variables from the set N \ I take the value 1, the solution z(1) is obviously optimal.(cid:3) This corollary immediately follows from Propositions 1 and 2. Corollary 1 A subproblem (2) can not satisfy both C0-condition and C1- condition at the same time. Proposition 3 If I = N then subproblem (2) satisfies either C0-condition or C1-condition. Proof. Consider subproblem (2) such that I = N . Assume that subproblem (2) does not satisfy C0-condition: Pi∈N θ(i)wi ≤ C. Since Pi∈N θ(i)wi = W −Pi∈N (1 − θ(i))wi, in this case we have W −Pi∈N (1 − θ(i))wi ≤ C, i.e. For a map z = (I, θ), where I 6= N and i ∈ N \ I, we introduce two new subproblem (2) satisfies C1-condition.(cid:3) maps z0 = (I ′, θ0), z1 = (I ′, θ1) where I ′ = I ∪ i and θk(j) =(θ(j) for j ∈ I, k for j = i, k = 0, 1. The set of the two subproblems corresponding to the maps z0 and z1 is called the decomposition of subproblem (2) along the variable xi. For this decomposition the variable xi is called the split variable and the index i is called the split index. Proposition 4 Let {P0, P1} be a decomposition of a subproblem P along some variable. Then the set of feasible (optimal) solutions of the subproblem P is the union of the sets of feasible (optimal) solutions of the subproblems P0 and P1. 3 The Branch-and-Bound Algorithm In this paper we study one of the basic variants of the Branch-and-Bound al- gorithm for solving the subset sum problem which we call the majoritarian Branch-and-Bound (MBnB) algorithm. MBnB algorithm During the execution the algorithm maintains the list S of subproblems waiting for processing and the incumbent solution xr. The incumbent solution is the best feasible solution found so far. Step 1. The list S of subproblems is initialized by the original problem (1): S = {P0}, where P0 is the original problem. All components of the incumbent solution are set to zero. Step 2. An arbitrary subproblem P in the list S is selected for processing and is removed from this list. Step 3. Three cases for processing P are possible: 4 • The subproblem P satisfies C0-condition. Then, by Proposition 1, P does not have feasible solutions and thus can be safely excluded from the further processing. • The sub-roblem P satisfies C1-condition. In that case the 1-complement z(1) of the map z corresponding to the subproblem P is compared with the incumbent solution (recall that, by Proposition 1, z(1) is an optimal solution for P ). If f (z(1)) > f (xr) then the incumbent solution is replaced by z(1). • The subproblem P satisfies neither C0-condition nor C1-condition. Then the subproblem P is decomposed along the variable xi where xi is the free variable of P with the maximal weight wi, i.e. i = argmaxj∈N \I wj. The two subproblems of the decomposition are added to the list S. Step 4. If the list S is empty the algorithm terminates. Otherwise the algorithm continues from the step 2. Since the number of variables of the original problem is finite the MBnB algorithm terminates in a finite number of steps. It follows from Propositions 1-4 that the resulting incumbent solution is an optimal solution of the original problem. Note that in the MBnB algorithm any subproblem is decomposed along the free variable with the maximal weight. So without loss of generality we will assume that all variables x1, x2, . . . , xn of the original problem (1) are ordered in the non-increasing order of their weights, i.e. w1 ≥ w2 ≥ . . . ≥ wn. In this case any subproblem is decomposed along the free variable with the minimal index, i.e. for any decomposed subproblem (1) we have I = {1, 2, . . . , s} where 0 ≤ s < n, and xs+1 is the split variable for the subproblem decomposition. The problem resolution process can be represented as a directed MBnB-tree. The subproblems processed by the MBnB algorithm form the set of tree nodes. Each subproblem decomposed by the MBnB algorithm is connected by directed arcs with the two subproblems constituting its decomposition. The root of the MBnB-tree corresponds to the original problem (1). Obviously the number of iterations of the main loop of the MBnB algorithm equals to the number of nodes in the respective MBnB tree. The MBnB complexity of the problem (1) is defined as the number of iterations of the main loop of the MBnB algorithm required to resolve the problem (the total number of nodes in the MBnB tree). Notice that the total number of nodes in the MBnB tree can be computed as 2L − 1, where L is a number of leaf nodes in the MBnB tree. Leaf nodes of the MBnB-tree correspond to subproblems satisfying either C0-condition or C1-condition. The leaf nodes are marked by tuples as follows: • a leaf node corresponding to a subproblem satisfying C0-condition is marked by the 0-complement of the map corresponding to the subproblem, such tuples are called leaf 0-tuples; • a leaf node corresponding to a subproblem satisfying C1-condition is marked by the 1-complement of the map corresponding to the subproblem, such tuples are called leaf 1-tuples As an example, the MBnB-tree for the subset sum problem f (x) = 2x1 + 2x2 + 2x3 → max, 2x2 + 2x2 + 2x3 ≤ 5, 5 Figure 1: Sample MBnB tree is depicted at Figure 1. Each leaf node is marked with the respective C0- or C1-condition and the assigned 0- or 1-tuple. The MBnB complexity of this problem is seven. Consider the set Bn of binary tuples of a length n over the set {0, 1}. Define the partial order in Bn as follows: α ≤ β if αi ≤ βi for all i ∈ N . If α ≤ β does not hold we write α 6≤ β. Proposition 5 All leaf 0-tuples are pairwise incomparable. Proof. Let α = (α1, . . . , αn) and β = (β1, . . . , βn) be two different 0-tuples such that α ≤ β, and Pα (Pβ) be the subproblem respective for α ( β). There exists j ∈ N such that αj = 0 and βj = 1. According to the leaf 0-tuple definition, Pi∈N αiwi > C. Thus Xi∈N βiwi ≥Xi∈N αiwi + wj > C + wj. (3) Note that xj is a fixed variable of Pβ because all free variables of Pβ have zero values in β. Let Pβ be resulted from the decomposition of some subproblem P along a variable xk. Since the decomposition is always performed along the free variable with the maximal weight, we have that wk = minxi∈Fβ wi, where Fβ is the set of fixed variables of the subproblem Pβ. Thus wk ≤ wj because xj ∈ Fβ. The subproblem P does not correspond to a leaf node and thus it does not satisfy C0-condition, i.e. Pxi∈Fβ \{xk} βiwi ≤ C. Therefore Xi∈N βiwi = Xxi∈Fβ βiwi ≤ C + wk ≤ C + wj . (4) 6 Inequalities (3) and (4) contradict each other. Thus the proposition is proved.(cid:3) In the same way we can prove the following statement. Proposition 6 All leaf 1-tuples are pairwise incomparable. Following to Propositions 5 and 6, the set of all leaf 0-tuples is called the 0-antichain and the set of all leaf 1-tuples is called the 1-antichain. Proposition 7 If α is a leaf 0-tuple and β is a leaf 1-tuple then α 6≤ β. Proof. Since, by Proposition 2, β is a feasible solution for the subproblem marked by β, the inequality f ( β) ≤ C holds. By the definition of leaf 0-tuple, the subproblem marked by α satisfies C0-condition. Hence, by Proposition 1, α is not a feasible solution for this subproblem, i.e. f (α) > C. Thus f ( β) < f (α). Therefore α 6≤ β because the function f is obviously non-decreasing w.r.t. the introduced order in Bn.(cid:3) 4 Basic properties of binary tuples This section entirely focuses on the binary tuples and their properties. The obtained results will be used at the end of the paper for finding the upper bound for the MBnB complexity of the subset sum problem. 4.1 Connected components Let α = (α1, . . . , αn) be a binary tuple from Bn. We call a component αi of α 1-component (0-component) if αi = 1 (αi = 0). The number of 1-components in α is called the weight of α and is denoted by k αk. We denote by Bn of 1-components is greater than the number of 0-components, i.e. Bn Bn : k αk > n/2}. + the set of all binary tuples from Bn in which the number + = { α ∈ For 1 ≤ i, j ≤ n we denote by α[i : j] the tuple (αi, . . . , αj) if i ≤ j and the tuple (α1, . . . , αj, αi, . . . , αn) if i > j. Such tuples are called segments. The segment α[i : j] precedes the component αj+1 (α1) if j < n (j = n). The segment α[i : j] succeeds the component αi−1 (αn) if i > 0 (i = 0). If i < j, a prefix (suffix) of the segment α[i : j] is any segment α[i : j′] (α[i′ : j]) where i ≤ j′ < j (i < i′ ≤ j). If i > j a prefix (suffix) of the segment α[i : j] is any segment α[i : j′] (α[i′ : j]) where i ≤ j′ ≤ n (i < i′ ≤ n) or 1 ≤ j′ < j (1 ≤ i′ ≤ j). A segment is called balanced if in this segment the number of 0-components is equal to the number of 1-components. A segment is called 0-dominated (1- dominated) if in this segment the number of 0-components is greater (is less) than the number of 1-components. A balanced segment is called a minimal balanced segment if any prefix of this segment is 0-dominated. There is obviously the equivalent definition: a balanced segment is called minimal balanced segment if any suffix of this segment is 1-dominated. A 0-component αi is called connected to a 1-component αj and a 1- component αj is called connected to a 0-component αi if the segment α[i, j] is a minimal balanced segment. 7 Figure 2: Bound components of a tuple All components of a tuple connected to some other components are called bound. All other components are called unbound. At Figure 2 bound components are shadowed and the connection between components is visualized by arcs. The following statement is almost obvious: Proposition 8 1. Any bound 0-component is connected to exactly one 1- component and similarly, any bound 1-component is connected to exactly one 0-component. 2. The set of all bound components is a union of pairs consisting of one 0-component and one 1-component connected to each other. Proposition 9 If a 0-component αi is connected to a 1-component αj then any component in the segment α[i : j] is connected to another component in the same segment. Proof. Let αk be a 1-component from α[i : j], k 6= j. By the definition of connected components the segment α[i : j] is a minimal balanced segment and hence the segment α[i : k] is 0-dominated. But α[k : k] is a 1-dominated segment and thus there should exist at least one balanced suffix of the segment α[i : k]. Choose in α[i : k] the balanced suffix α[l : k] of the minimal length. Clearly, any suffix of the segment α[l : k] is 1-dominated. So α[l : k] is a minimal balanced segment. Thus αl is a 0-component connected to the 1-component αk. In a similar way it can be proved that any 0-component from the segment α[i : j] is connected to some 1-component in the same segment.(cid:3) A segment α[i : j] is called a connected segment if αi and αj are connected to each other. A connected segment α[i : j] is called maximal if there is no other connected segment containing α[i : j]. The following result is then obvious. Proposition 10 Any connected segment is balanced. Two components of a tuple are neighbouring if their indexes differ by one. Moreover, the first and the last components of a tuple are also assumed to be neighbouring. Two segments of a tuple are separated if one of these segments has no components neighbouring with components of the other segment. As any other subset of components in a tuple, the set of all bound components in α is a union of pairwise separated segments. We call these segments bound segments of α. The tuple depicted at Figure 2 has two bound segments. From Proposition 9 we conclude Proposition 11 Any bound segment is a union of one or more non-overlapping maximal connected segments. 8 Using this statement and Proposition 10, it is not difficult to prove the following fact. Proposition 12 Any bound segment is balanced, and any prefix (suffix) of any bound segment is 0-dominated (1-dominated) or balanced. The following criterion takes place. Lemma 1 A 1-component is bound in α if and only if there exists a 0-dominated segment preceding this component in α. Proof. Let αi be a bound 1-component in α. Then there should exist a minimal balanced segment α[i′ : i] such that i′ < i and α′ i = 0. Clearly, the segment α[i′, i−1] precedes αi and is 0-dominated. Thus the necessity is proved. To prove the sufficiency, assume that there exists some 0-dominated segment α[i′ : i − 1] preceeding αi. Then the number of 0-components in the segment α[i′ : i] is not less than the number of 1-components in this segment. Let the segment α[i′ : i] be also 0-dominated. Then, since the segment α[i : i] is 1-dominated, there should exist at least one balanced suffix in the segment α[i′ : i]. Thus, in any case there exists at least one balanced segment α[l : i] such that i′ ≤ l < i. Let α[i′′, i] be the such segment of the minimal length. Obviously, α[i′′, i] is a minimal balanced segment. So αi is a bound component connected to α′′ i .(cid:3) The following corollary is a direct consequence of the Lemma 1. Corollary 2 Let α = (α1, . . . , αn), α′ = (α′ such that α ≤ α′, and αi be a 1-component unbound in α. Then α′ component unbound in α′. n) be two tuples from Bn + i is a 1- 1, . . . , α′ Similarly to Lemma 1 one can prove the following lemma: Lemma 2 A 0-component is bound in α if and only if in α there exists a 1- dominated segment succeeding this component. From this lemma we easily obtain the following corollary. Corollary 3 All 0-components in any tuple from Bn + are bound. 4.2 Projection mapping D Define the projection mapping D : Bn +. Among all unbound 1-components in α choose the component with the maximal index. We denote by D(α) the binary tuple obtained from α by replacing this component with 0. + → Bn as follows. Let α ∈ Bn We have immediately from Corollary 2 Corollary 4 Let α = (α1, . . . , αn), α′ = (α′ such that α = D(α′), and αi be an unbound 1-component in α. Then α′ unbound 1-component in α′. n) be two tuples from Bn + i is an 1, . . . , α′ The following lemma states that the operation D is injective. Lemma 3 For any two different tuples α′, α′′ from Bn are also different. + the tuples D(α′), D(α′′) 9 1, . . . , α′ Proof. Let α′ = (α′ tuples from Bn 1-component α′ 1-component α′′ n) be two arbitrary different +. Let D(α′) be obtained from α′ by substitution of zero for a i′ , and D(α′′) be obtained from α′′ by substitution of zero for a i′′ . If i′ = i′′ then D(α′) 6= D(α′′) and so the lemma is valid. n), α′′ = (α′′ 1 , . . . , α′′ i′′ , i.e. α′ i′′+1, . . . , α′′ Consider the case i′ 6= i′′. Without loss of generality assume that i′′ < i′. To i′′ = 0. Therefore, if i′ is bound in α′. Thus prove this case, assume also that D(α′) = D(α′′). Then α′ i′ = i′′ + 1 then α′ i′ > i′′ + 1. Since α′′ i′ is obviously connected to α′ i′′ has the maximal index among all components unbound in α′′, the i′−1 are bound in α′′, i.e. the segment α′′[i′′ + 1 : i′ − 1] components α′′ is a prefix of some bound segment of α′′. Therefore, by Proposition 12, in α′′[i′′+1 : i′−1] the number of 1-components is not greater than the number of 0- components. Since D(α′) = D(α′′) all components of the tuple α′ except α′ i′ and α′ i′′ have to coincide with the respective components of the tuple α′′. Hence the segment α′[i′′ +1 : i′ −1] has to coincide with the segment α′′[i′′ +1 : i′ −1]. So in α′[i′′ +1 : i′ −1] the number of 1-components is not also greater than the number of 0-components. Moreover, it follows from D(α′) = D(α′′) that α′ i′′ = 0. Thus, in the segment α′[i′′ : i′ − 1] of α′ the number of 0-components is greater than the number of 1-components. Therefore, by Lemma 1 the component α′ i′ is bound in α′. That contradicts our assumption that α′ , 1, . . . , 1 i′ is unbound in α′. ). For s > n/2 define the tuple γs = (0, . . . , 0 n−s {z } s {z } Lemma 4 If for a tuple α ∈ Bn valid, then D(α) 6≤ γs. +, where k αk ≥ n/2 + 1, the relation α 6≤ γs is Proof. Let α = (α1, . . . , αn). Consider separately two cases: α1 = 0 and α1 = 1. Let α1 = 0. Let αi be the 1-component with the minimal index in α. Note that i > 1 and αi−1 = 0. It is obvious that the 0-component αi−1 is connected to the 1-component αi. Thus αi is bound in α. According to the definition of D, αi coincides with the respective component of D(α), i.e. the i-th component of D(α) is an 1-component. Note that i ≤ n − s, since otherwise α ≤ γs. Thus, we obtain that D(α) 6≤ γs. Now let α1 = 1. From α 6≤ γs we have s < n. If α1 is bound in α then αi coincides with the respective first component of D(α), so the first component of D(α) is an 1-component. Therefore D(α) 6≤ γs in this case. Let α1 be unbound in α. Note that the condition k αk > n/2 + 1 implies that in α at least two components are unbound. So α1 cannot be the component with the maximal index among all components unbound in α. Hence, by the definition of the tuple D(α), its first component has to coincide with α1. Thus, this component has to be an 1-component which implies D(α) 6≤ γs. (cid:3) Lemma 5 Let for a tuple α ∈ Bn Then there is no such tuple α′ ∈ Bn that α = D(α′). + the relations α 6≤ γs and D(α) ≤ γs be valid. Proof. Assume that α = (α1, . . . , αn), and the relations α 6≤ γs and D(α) ≤ γs are valid. Then it follows from Lemma 4 that n is odd and k αk = (n + 1)/2. Thus there is only one unbound 1-component in α. Let αi be this component. Since D(α) ≤ γs and α 6≤ γs, the component αi has to be the only 1-component in α satisfying the condition i ≤ n − s. Therefore, if i > 1 then αi is obviously 10 connected to the 0-component αi−1, which contradicts our assumption that αi is unbound. Consider the only possible case i = 1. 1, . . . , α′ Assume that there exists a tuple α′ = (α′ n) such that α = D(α′). Since α1 is unbound in α, by Corollary 4 the component α′ 1 is unbound in j be the 1-component of α′ replaced by zero in α. Clearly, j 6= 1. α′. Let α′ According to the definition of the mapping D, α′ j is the unbound component 1 is unbound in α′, we have two possible with the maximal index in α′. Since α′ cases: j = n or α′[j + 1 : n] is a bound segment of α′. In the first case α1 should be obviously connected to the 0-component α0, i.e. α1 is bound in α. This contradicts our assumption. In the second case by Proposition 12 the segment α′[j + 1 : n] is balanced. Therefore, since the segments α′[j + 1 : n] and α[j + 1 : n] are identical and αj = 0, the segment α[j : n] is 0-dominated. Hence, by Lemma 1, the component α1 has to be bound in α which contradicts again our assumption. (cid:3) 4.3 Properties of antichains in B n Let T ′, T ′′ be two antichains in Bn such that α′ 6≥ α′′ for any tuples α′ ∈ T ′, α′′ ∈ T ′′. We will denote this case by T ′ < T ′′ (note that T ′ < T ′′ implies T ′ ∩ T ′′ = ∅). For s > n/2 denote by As the set of all pairs (T ′, T ′′) of antichains in Bn such that T ′ < T ′′ and γs ∈ T ′. The cardinality of a pair of non-overlapping antichains is the total number of tuples in these antichains. Recall that the number of 1-components in a binary tuple α from Bn is called the weight of this tuple and is denoted by k αk. By Bn k we denote the set of all tuples from Bn whose weights are equal to k. A pair of antichains (T ′, T ′′) from As is called regular from below if in the set (T ′ ∪ T ′′) \ {γs} all tuples of minimum weight are contained in T ′ and is called regular from above if in the set (T ′ ∪ T ′′) \ {γs} all tuples of maximum weight are contained in T ′′. Note that from any pair of antichains (T ′, T ′′) ∈ As containing tuples with weight less than s we can obtain a regular from below pair of antichains by placing in the antichain T ′ all tuples from (T ′ ∪ T ′′) \ {γs} which have the minimum weight. We call the pair of antichains obtained by this way from the initial pair (T ′, T ′′) the correction from below of (T ′, T ′′). In an analogous way, from any pair of antichains (T ′, T ′′) ∈ As we can obtain a regular from above pair of antichains by placing to the antichain T ′′ all tuples from (T ′ ∪ T ′′) \ {γs} which have the maximum weight. We call the pair of antichains obtained by this way the correction from above of the initial pair (T ′, T ′′). Note that both the correction from below and the correction from above consist of the same tuples as the initial pair of antichains. Lemma 6 For any s > n/2 in As there exists a pair of antichains which has the maximum cardinality and consists of tuples with weight greater than or equal to ⌊n/2⌋. Proof. Consider an arbitrary pair of antichains (T ′, T ′′) from As which has the maximum cardinality. Assume that the minimum weight of tuples from T ′ ∪ T ′′ is equal to r < ⌊n/2⌋. Let (T ′ 0 ) be the correction from below of the pair (T ′, T ′′). Since T ′ 0 ) has also the maximum cardinality in As, and the minimum weight of tuples from (T ′ 0 ) is regular from below and 0 ) is also equal to r. Moreover, since (T ′ 0 = T ′ ∪ T ′′, the pair of antichains (T ′ 0, T ′′ 0, T ′′ 0, T ′′ 0 ∪ T ′′ 0, T ′′ 11 0 ∪ T ′′ r+1 V . 0 = ∅ because T ′ 0 and T ′′ r+1 and each tuple from Bn r+1 V > V and U ′ ≥ n−r−1 r is comparable with n − r tuples from Bn r+1. Furthermore, denote by V ′ the set of all tuples from Bn In the analogous way we obtain that U ′ ≥ n−r−1 0 = ∅ and U ′ ∩ T ′′ r 6= s, all tuples from T ′ 0 whose weights are equal to r are contained in T ′ 0. Denote the set of all such tuples by V . Denote also by U the set of all tuples from T ′′ 0 ∩ Bn r+1 which are comparable with at least one tuple from V , and by U ′ the set of all tuples from Bn r+2 which are comparable with at least one tuple from U . Note that each tuple from Bn r+1 is comparable with r + 1 tuples from Bn r . From these observations we conlude that V ′ ≥ n−r r+2 U . Note also that V ′ ∩ T ′ 0 are antichains. First consider the case r < n/2 − 1, i.e. r ≤ n/2 − 3/2. In this case we have V ′ ≥ n−r 0 \ V ) ∪ V ′ 1, T ′′ and T ′′ 1 ) ∈ As. Moreover, 0 + V ′ − V > T ′ 0 + U ′ − U ≥ T ′′ we have T ′ 0 . Therefore, T ′ 1 > T ′ 1 = T ′ 0 , which contradicts the fact that the pair of antichains (T ′ 0 ) has the maximum cardinality in As. Thus the case r < n/2 − 1 is impossible. Now consider the remaining case r = n/2 − 1. Note that in this case n has to be even, i.e. n = 2k, and r = ⌊n/2⌋ − 1 = k − 1. Denote by V ′′ the set V ′ ∪ U . Note that V ′′ ∩ T ′ 0 = ∅ because both the sets V ′ and U are not overlapped with T ′ 0 \ V ) ∪ V ′′ 2, T ′′ and T ′′ 2 ) ∈ As. Moreover, we have V ′′ ≥ V ′ ≥ n−r k+1 V ′′. We have also U ′ ≥ n−r−1 k+1 U . Thus, taking into account that U ≤ V ′′, we obtain 0 and T ′′ 0 + T ′′ 0, T ′′ r+2 U ≥ U . Define T ′ It is easy to note that (T ′ It is easy to note that (T ′ 1 = (T ′′ 0 \ U ) ∪ U ′. 2 = (T ′′ 0 \ U ) ∪ U ′. r+1 V = k+1 k V , i.e. 1 = T ′ 1 ∪ T ′′ 0. Define T ′ 2 = (T ′ r+2 U = k V ≤ k 1 = T ′′ 0 = T ′ 0 ∪ T ′′ 1 + T ′′ 1 = (T ′ (V ′′ − V ) + (U ′ − U ) ≥ Therefore, 1 k + 1 V ′′ − 1 k + 1 U ≥ 0. T ′ 2 ∪ T ′′ 2 = T ′ ≥ T ′ 2 + T ′′ 0 + T ′′ 2 = T ′ 0 = T ′ 0 + T ′′ 0 + (V ′′ − V ) + (U ′ − U ) 0 ∪ T ′′ 0 , i.e. the cardinality of (T ′ the pair of antichains (T ′ over, it is obvious that the antichains T ′ not less than ⌊n/2⌋. So the lemma is proved. (cid:3) 2 ) is not less than the cardinality of (T ′ 0 ). Thus 2 ) has also the maximum cardinality in As. More- 2 consist of tuples whose weights are 2, T ′′ 2, T ′′ 2, T ′′ 0, T ′′ Lemma 7 For any s > n/2 in As there exists a pair of antichains such that this pair has the maximum cardinality and the weights of all tuples from these antichains except the tuple γs are not greater than (n + 3)/2 and not less than ⌊n/2⌋. Proof. By Lemma 6 there exists a pair of antichains (T ′, T ′′) in As which has the maximum cardinality and consists of tuples with weight greater than or equal to ⌊n/2⌋. Assume that the maximum weight of tuples from these antichains except the tuple γs is equal to r > (n+3)/2. Note that the inequality r > (n + 3)/2 obviously implies r ≥ n/2 + 2. For proving Lemma 7 it is enough to show that in this case we can construct a pair of antichains from As such that this pair has the maximum cardinality in As and the weights of all tuples from these antichains except the tuple γs are not less than ⌊n/2⌋ and not greater than r − 1. To this end, consider the correction from above 0 = T ′ ∪ T ′′, the of (T ′, T ′′). Denote this correction by (T ′ 0 ). Since T ′ 0 ∪ T ′′ 0, T ′′ 12 0, T ′′ 0 ∪ T ′′ 0 ∪ T ′′ 0 ) ∩ Bn pair of antichains (T ′ 0 ) has also the maximum cardinality in As, and the weights of all tuples from T ′ 0 except the tuple γs are not less than ⌊n/2⌋ and not greater than r. Moreover, all tuples from (T ′ r except the tuple γs are contained in T ′′ 0 . Denote the set of all such tuples by U . Denote also by V the set (T ′ 0 ∩ Bn r−1) \ {γs}. Furthermore, denote by D(U ) (D(V )) the set {D(α) : α ∈ U } ({D(α) : α ∈ V }). It follows from Lemma 3 that D(U ) = U and D(V ) = V . Moreover, since T ′ 0 are antichains, we have D(V ) ∩ T ′ 0 \ V ) ∪ D(V ) and T ′′ 1 = (T ′′ 1 is an antichain containing the tuple γs. Moreover, it is obvious that T ′′ 1 is also an antichain. By Lemma 4 any tuple α from T ′′ 1 does not satisfy the relation α ≤ γs. Taking this observation into account, it is easy to see that T ′ 1 < T ′′ 1 ) ∈ As. It follows from D(U ) = U and D(V ) = V that T ′ 1 = T ′′ 0 , so the pair of antichains (T ′ 1 ) has also the maximum cardinality in As. To complete the proof, we note that the weight of any tuple from T ′ 1 except the tuple γs are not less than ⌊n/2⌋ and not greater than r − 1. (cid:3) 0 \U )∪D(U ). Using Lemma 4, it is easy to check that T ′ 2 . Thus (T ′ 1 = T ′ 0 = ∅ and D(U ) ∩ T ′′ 1, T ′′ 0 and T ′′ 0 and T ′′ 1 = (T ′ 0 = ∅. Define T ′ 1 ∪ T ′′ 1, T ′′ Theorem 1 For s > n/2 the cardinality of any pair of antichains from As is not greater than 1 +(cid:0) n+1 ⌊n/2⌋+1(cid:1) −(cid:0) s+1 ⌊n/2⌋+1(cid:1). Proof. First consider the case when n is even, i.e. n = 2k. In this case, according to Lemma 7, there exists a pair of antichains (T ′, T ′′) in As such that this pair has the maximum cardinality in As and the weights of all tuples from (T ′ ∪ T ′′) \ {γs} are either k or k + 1. Therefore, for any tuple α from T ′′ the relation α ≥ γs can not be valid because the weight of γs is equal to s ≥ k+1. So all tuples from T ′′ are incomparable with γs. Since T ′ is a antichain containing γs, all tuples from T ′′ are also incomparable with γs. Thus, all tuples from T ′ ∪ T ′′ \ {γs} are incomparable with γs. It is obvious that Bn k+1) contains k(cid:1) ((cid:0) n (cid:0)n k(cid:1) −(cid:0)s k+1(cid:1) −(cid:0) s k+1(cid:1)) tuples incomparable with γs. Hence T ′∪T ′′\{γs} ≤(cid:18)(cid:18) n k + 1(cid:19) −(cid:18) s Therefore, T ′ ∪ T ′′ ≤ 1 + (cid:0)n+1 k + 1(cid:19) −(cid:18)s + 1 k + 1(cid:19)−(cid:18)s + 1 k + 1(cid:19). k+1(cid:1). Since the pair (T ′, T ′′) has the ⌊n/2⌋ + 1(cid:19) −(cid:18) s + 1 maximum cardinality in As, we obtain that in this case the cardinality of any pair of antichains from As is not greater than k + 1(cid:19)(cid:19)+(cid:18)(cid:18)n k+1(cid:1) − (cid:0)s+1 k + 1(cid:19) = 1 +(cid:18) n + 1 k(cid:19)(cid:19) =(cid:18)n + 1 ⌊n/2⌋ + 1(cid:19). 1 +(cid:18)n + 1 k(cid:19) −(cid:18)s k (Bn Now consider the case when n is odd, i.e. n = 2k + 1. By Lemma 7, in this case there exists a pair of antichains (T ′, T ′′) in As such that this pair has the maximum cardinality in As and the weights of all tuples from (T ′ ∪ T ′′) \ {γs} can be equal to three posssible values: k, k + 1, or k + 2. Let (T ′ 0 ) be the correction from above of (T ′, T ′′). Since T ′ 0 = T ′ ∪ T ′′, the pair (T ′ 0 ) has also the maximum cardinality in As and the weights of all tuples from (T ′ 0 ) \ {γs} can be equal to k, k + 1, or k + 2. Moreover, all tuples from ((T ′ 0 ) \ {γs}) ∩ Bn 0 . Denote the set of all such tuples by U . Define D(U ) = {D(α) 0, and D(V ) = {D(α) : α ∈ V }. Since T ′ 0 = ∅ and D(V ) ∩ T ′ 0 = ∅. Denote by T ′ 1 the set : α ∈ U }, V = D(U ) ∩ T ′ 0 are antichains, we have D(U ) ∩ T ′′ k+2 are contained in T ′′ 0 \ V ) ∪ D(V ) and by T ′′ 0, T ′′ 1 the set (T ′ 0 ∪ T ′′ 0 ∪ T ′′ 0 ∪ T ′′ 0, T ′′ 0, T ′′ 13 1 ∩ T ′′ 1 ∪ T ′′ 0 \ U ) ∪ D(U ). It is easy to note that T ′ (T ′′ 1 = ∅ and the weight of any tuple from T ′ 1 \ {γs} is either k or k + 1. Taking into account that the weight of γs is equal to s ≥ k + 1, we obtain that for any tuple α from T ′ 1 \ {γs} the relation α ≥ γs can not be valid. Moreover, the relation α ≤ γs can not be valid for any tuple α from T ′′ 1 by Lemma 4 and can not be also valid for any tuple α from T ′ 1 \ {γs} are incomparable with γs. Hence, by the same way as in the previous case of even n, we obtain that 1 \ {γs} by Lemma 5. Thus, all tuples from T ′ 1 ∪ T ′′ 1 ∪ T ′′ T ′ 1 ∪ T ′′ 1 \ {γs} ≤(cid:18)n + 1 k + 1(cid:19) −(cid:18)s + 1 k + 1(cid:19). Therefore T ′ 1 ∪ T ′′ 1 ≤ 1 +(cid:18)n + 1 k + 1(cid:19) −(cid:18)s + 1 k + 1(cid:19) = 1 +(cid:18) n + 1 ⌊n/2⌋ + 1(cid:19) −(cid:18) s + 1 ⌊n/2⌋ + 1(cid:19). Lemma 3 implies D(U ) = U and D(V ) = V . Hence T ′ T ′′ 1 . Therefore 0 , so T ′ 1 = T ′′ 0 ∪ T ′′ 0 = T ′ 1 ∪ T ′′ 1 = T ′ 0 and T ′ 0 ∪ T ′′ 0 ≤ 1 +(cid:18) n + 1 ⌊n/2⌋ + 1(cid:19) −(cid:18) s + 1 ⌊n/2⌋ + 1(cid:19). Thus, since the pair of antichains (T ′ we obtain that in this case also the theorem is valid. (cid:3) 0, T ′′ 0 ) has the maximum cardinality in As, Corollary 5 Let s > n/2 and (T ′, T ′′) be the pair of antichains such that T ′ consists of the tuple γs and all tuples from Bn ⌊n/2⌋ which are incomparable with γs and T ′′ consists of all tuples from Bn ⌊n/2⌋+1 which are incomparable with γs. Then (T ′, T ′′) has the maximum cardinality in As. Denote by A′ t the set of all pairs (T ′, T ′′) of antichains in Bn such that T ′ < T ′′ and the weights of all tuples from T ′ and T ′′ are no more than t. Theorem 2 For t ≤ ⌊n/2⌋ + 1 the cardinality of any pair of antichains from A′ t is not greater than (cid:0)n+1 t (cid:1). Proof. Let (T ′, T ′′) be an arbitrary pair of antichains from A′ t and q be the cardinality of (T ′, T ′′). A chain of tuples in Bn is called maximal if it consists of n + 1 tuples. For any tuple in Bn we consider the number of different maximal chains containing this tuple. We will call this number the rank of the tuple. It is easy to check that the rank of a tuple is equal to k!(n − k)! where k is the weight of the tuple. Note that in Bn there exist n! different maximal chains and each of these chains contains no more than one tuple from T ′ and no more than one tuple from T ′′. So the total sum of ranks of all tuples from T ′ ∪ T ′′ is no more than 2(n!). Consider the sequence of all tuples in Bn whose weights are no more than t such that in this sequence tuples are sorted in the non-decreasing order of their ranks. Denote this sequence by H. It is obvious that the sum of ranks of all tuples from T ′ ∪ T ′′ is not less than the sum of ranks of the first q tuples in H. Thus the sum of ranks of the first q tuples in H is also not greater than 2(n!). 14 First consider the case t ≤ n+1 2 . Note that the value k!(n − k)! is not increasing for 0 ≤ k ≤ (n + 1)/2, so in this case we can assume that in H the first (cid:0)n from Bn is equal to t(cid:1) tuples are tuples from Bn t−1. Thus in H the sum of ranks of the first (cid:0)n (cid:18)n t(cid:19) · t!(n − t)! +(cid:18) n t and the following (cid:0) n t−1(cid:1) tuples are tuples t(cid:1) +(cid:0) n t−1(cid:1) =(cid:0)n+1 t (cid:1) tuples t − 1(cid:19) · (t − 1)!(n − t + 1)! = 2(n!). n/2 have the minimal rank (n/2)!(n/2)! in H while all the other tuples in H have ranks not less than (n/2 − 1)!(n/2 + 1)!. So we can assume that in H the first Therefore, q can not be greater than(cid:0)n+1 which is possible only for even n. Note that in this case(cid:0) n (cid:0) n n/2 and the following (cid:0) n n/2(cid:1) tuples are tuples from Bn n/2+1. Thus in H the sum of ranks of first (cid:0) n (cid:18) n n/2(cid:19) · (n/2)!(n/2)! +(cid:18) n t (cid:1). Now consider the case t = n/2 + 1 n/2(cid:1) tuples from Bn n/2+1(cid:1) tuples are tuples n/2(cid:1) +(cid:0) n n/2+1(cid:1) = (cid:0) n+1 n/2+1(cid:1) from Bn tuples is equal to n/2 + 1(cid:19) · (n/2 − 1)!(n/2 + 1)! = 2(n!). t (cid:1). (cid:3) n/2+1(cid:1) =(cid:0)n+1 Therefore, in this case also q can not be greater than(cid:0) n+1 Corollary 6 Let s ≤ ⌊n/2⌋ + 1 and (T ′, T ′′) be the pair of antichains such that T ′ consists of all tuples from Bn t . Then (T ′, T ′′) has the maximum cardinality in A′ t. t−1 and T ′′ consists of all tuples from Bn 5 The MBnB complexity bounds Now we obtain upper bounds for the MBnB complexity of the problem (1) from the statements, proved in Section 2, and Theorems 1 and 2. Denote by T0 (T1) the 0-antichain (1-antichain) for the problem (1). Define the values t and s in the following way: t = min(k ∈ N : n Xi=n−k+1 wi > C) , s = t − 1. (5) We prove the following Proposition 13 The weight of any tuple from T0 and T1 is no greater than t, and γs ∈ T1. i=1 αiwi ≤ C. Since w1 ≥ · · · ≥ wn, the inequality Pn Proof. Consider a 1-tuple α = (α1, . . . , αn) from T1. By Proposition 2 we i=n−k αk+1 wi ≤ i=n−k αk+1 wi ≤ C. Therefore k αk < t. Now consider a 0-tuple β = (β1, . . . , βn) from T0. Let j = max{i ∈ N : βi = 1}. By the i=1 βiwi ≤ C. The inequalities w1 ≥ i=n−k βk+2 wi ≤ C. have Pn Pn i=1 αiwi is valid, so Pn definition of a leaf 0-tuple we have Pj−1 · · · ≥ wn imply that Pn i=n−k βk+2 wi ≤Pj−1 i=1 βiwi. Hence Pn Therefore, k βk − 1 < t, so k βk ≤ t. 15 Now we prove that γs ∈ T1. Consider the subproblem P corresponding to the map (I, θ) such that I = {1, . . . , n − s − 1} and θ(i) = 0, i ∈ I. For this subproblem we have (1 − θi)wi = Xi∈I n−s−1 Xi=1 wi = W − n Xi=n−t+1 wi < W − C. Thus the subproblem P does not satisfy the C1-condition. It is obvious that P does not satisfy also the C0-condition. We conclude from these observations that P is contained in the MBnB-tree but is not a leaf of this tree. Now consider the subproblem P ′ corresponding to the map (I ′, θ′) such that I ′ = {1, . . . , n−s} and θ′(i) = 0, i ∈ I ′. For this subproblem we have (1 − θ′ i)wi = Xi∈I ′ n−s Xi=1 wi = W − n Xi=n−s+1 wi ≥ W − C. Thus the subproblem P ′ satisfies the C1-condition. Moreover, P ′ is obviously contained in the decomposition of the subproblem P . Therefore, P ′ is a leaf of the MBnB-tree satisfying the C1-condition. Note that γs is the 1-complement for the map (I ′, θ′) corresponding for P ′, so γs is a leaf 1-tuple.(cid:3) From Propositions 13 and 7 we obtain that the pair of antichains (T1, T0) is contained in the set As if t > ⌊n/2⌋ + 1 or in the set A′ t if t ≤ ⌊n/2⌋ + 1. So Theorems 1, 2 imply the following bounds for the MBnB complexity of the subset sum problem. Theorem 3 The MBnB complexity S of the problem (1) satisfies the following upper bounds: S ≤ 2(cid:0)n+1 S ≤ 2(cid:16)(cid:0) n+1 t (cid:1) − 1, if t ≤ ⌊n/2⌋ + 1, ⌊n/2⌋+1(cid:1) −(cid:0) where t is defined in (5). t ⌊n/2⌋+1(cid:1)(cid:17) + 1, if t > ⌊n/2⌋ + 1, 6 Comparison of bounds In this section we compare the known complexity bounds with the complexity bound proposed in this paper: 16 Designation Formula Source B1 B2 B3 t 2(cid:0) n+1 ⌊n/2⌋+1(cid:1) − 1 2(cid:0)n+1−t′+t (cid:1) − 1 2(cid:0)n+1 t (cid:1) − 1 if t ≤ ⌊n/2⌋ + 1; 2(cid:16)(cid:0) n+1 ⌊n/2⌋+1(cid:1)(cid:17) + 1 ⌊n/2⌋+1(cid:1) −(cid:0) if t > ⌊n/2⌋ + 1 t Girshukhin [5] Kolpakov and Posypkin [8] this paper Parameters t and t′ are computed as follows: t = min(k ∈ N : n Xi=n−k+1 wi > C) , t′ = min(k ∈ N : wi > C) . k Xi=1 It is obvious that bound B3 is better than B1. As for comparison of B2 and B3, in the case of t ≤ ⌊n/2⌋ + 1 bound B3 coinsides with B2 for t = t′ and is better than B2 for t > t′ (note that t ≥ t′). In the case of t > ⌊n/2⌋ + 1 bound B2 may be better under some conditions. However, in this case bound B3 is better than B2 for t′ ≤ ⌊n/2⌋ + 1 since this condition implies that t t (cid:18)n + 1 + t − t′ (cid:19) ≥(cid:18)⌈n/2⌉ + t (cid:18)n + 1 ⌈n/2⌉(cid:19) =(cid:18) n + 1 (cid:19) =(cid:18)⌈n/2⌉ + t ⌊n/2⌋ + 1(cid:19) >(cid:18) n + 1 ⌈n/2⌉ (cid:19) >(cid:18)⌈n/2⌉ + ⌊n/2⌋ + 1 ⌊n/2⌋ + 1(cid:19) −(cid:18) ⌊n/2⌋ + 1(cid:19) ⌈n/2⌉ t (cid:19) = We also performed experimental comparison of bounds B1, B2 and B3. For our experiments 1000 subset sum instances were generated. Each instance had 15 variables. Coefficients wi were uniformly distributed pseudo-random numbers i=1 wi]. All instances were solved with MBnB algorithm. The average complexity of MBnB was 2114.02. Table 1 compares various bounds using the following indicators: in [1, 100], C was choosen randomly in [1,Pn Average value: the value of the bound averaged over all instances; Min (Max) ratio: the minimum (maximum) value of the scaled accuracy of the bound with respect to the actual number of steps performed by MBnB, computed as follows: r = S ′−S S , where S and S′ are the actual complexity and the bound respectively; Best bound: the number of times when the bound gives the least value from all 3 bounds; Precise bound: the number of times when the bound was precise, i.e. equal to the actual complexity. The performed comparison shows that B3 bound outperforms bounds B1 and B2 in terms of average value and maximal relative accuracy. Bound B1 is data independent and thus the probability that it equals to the actual complexity is very low. Bound B2 gives the precise bound more often than B3. We should also 17 Table 1: Comparison of various bounds Indicator Average value Min ratio Max ratio Best bound Precise bound B1 25739 0.908 B2 B3 859985.552 20257.82 0 0 1224.667 7578.711 761.619 64 0 72 15 931 3 take into account that B2 is a generic bound, suitable for a broad class of Branch- and-Bound methods, while B1 and B3 only work for MBnB. Experiments show that all three bounds make sense and can be applied in combination. 7 Conclusion In this paper we obtained upper bounds on the complexity of solving the sub- set sum problem by the Branch-and-Bound method where all subproblems are partitioned along the free variable with the maximum weight. These bounds can be easily computed from the input data of the problem. So these bounds allow preliminarily estimates of the number of operations required for solving the problem. Such bounds can be used in planning of distributed computations, for which one needs to estimate computational resources required for solving the problem. For the obtained bounds a natural question arises: whether these bounds are tight? We can show that the obtained bounds are tight for t ≤ ⌊n/2⌋ + 2. For t ≤ ⌊n/2⌋ + 1 these bounds are reached for the subset sum problem with the parameters w1 = w2 = . . . = wn = 2 and C = 2t − 1 (see Kolpakov and Posypkin [7]). For t = ⌊n/2⌋ + 2 these bounds are reached for the subset sum problem with the parameters w1 = w2 = . . . = wn−k−1 = 3k, wn−k = wn−k+1 = . . . = wn = 3k − 2, and C = 3k2 + k − 1 where k = ⌊n/2⌋. On the other hand, we can show that for n = 7 and t = 6 the MBnB complexity of the subset sum problem is not greater than 53 while the complexity upper bound derived in this case from Theorem 3 is 56. Thus, just for t = ⌊n/2⌋ + 3 the obtained upper bounds are not exact, so one of the directions for further research is to improve the obtained bounds for the case t > ⌊n/2⌋ + 2. We also intend to improve these bounds for the boolean knapsack problem and obtain lower bounds for the considered problem. References [1] K. Aardal and A. Lenstra, Hard equality constrained integer knapsacks, Mathematics of Operations Research 29(3) (2004) 724 -- 738. [2] V. Chvatal, Hard knapsack problems, Operations Research 28(6) (1980) 1402 -- 1411. 18 [3] Y. Finkelshtein, Approximate methods and applied problems in discrete pro- gramming (in Russian) (Nauka, 1976). [4] H. Greenberg and R. Hegerich, A branch and bound algorithm for the knapsack problem, Management Science 16(5) (1970) 327 -- 332. [5] V. Grishuhin, The efficiency of branch-and-bound method in boolean pro- gramming (in russian), Research on discrete optimization, ed. A. Fridman (Nauka, 1976), pp. 203 -- 230. [6] R. Jeroslow, Trivial integer programs unsolvable by branch-and-bound, Mathematical Programming 6 (1974) 105 -- 109. [7] R. Kolpakov and M. Posypkin, An asymptotic bound on the complexity of the branch-and-bound method with branching by the fractional variable in the knapsack problem, Diskret. Anal. Issled. Oper. 15(1) (2008) 58 -- 81. [8] R. Kolpakov and M. Posypkin, Upper and lower bounds for the complex- ity of the branch and bound method for the knapsack problem, Discrete Mathematics and Applications 20(1) (2010) 1569 -- 3929. [9] B. Krishnamoorthy, Bounds on the size of branch-and-bound proofs for integer knapsacks, OR Letters 36(1) (2008) 19 -- 25. [10] S. Martello and P. Toth, Knapsack Problems: Algorithms and Computer Implementation (John Wiley and Sons, 1990). [11] H. K. U. Pfershy and D. Pisinger, Knapsack Problems (Springer, 2004). 19
1706.07851
3
1706
2017-08-30T16:06:16
A practical fpt algorithm for Flow Decomposition and transcript assembly
[ "cs.DS", "q-bio.GN" ]
The Flow Decomposition problem, which asks for the smallest set of weighted paths that "covers" a flow on a DAG, has recently been used as an important computational step in transcript assembly. We prove the problem is in FPT when parameterized by the number of paths by giving a practical linear fpt algorithm. Further, we implement and engineer a Flow Decomposition solver based on this algorithm, and evaluate its performance on RNA-sequence data. Crucially, our solver finds exact solutions while achieving runtimes competitive with a state-of-the-art heuristic. Finally, we contextualize our design choices with two hardness results related to preprocessing and weight recovery. Specifically, $k$-Flow Decomposition does not admit polynomial kernels under standard complexity assumptions, and the related problem of assigning (known) weights to a given set of paths is NP-hard.
cs.DS
cs
A practical fpt algorithm for Flow Decomposition and transcript assembly Kyle Kloster1, Philipp Kuinke2, Michael P. O'Brien1, Felix Reidl1, Fernando Sánchez Villaamil2, Blair D. Sullivan1, and Andrew van der Poel1 1 North Carolina State University, USA (kaklostempobrie3blair_sullivanajvande4)@ncsu.edu, [email protected] 2 RWTH Aachen University, Germany (kuinkefernando.sanchez)@cs.rwth-aachen.de 7 1 0 2 g u A 0 3 ] S D . s c [ 3 v 1 5 8 7 0 . 6 0 7 1 : v i X r a Abstract The Flow Decomposition problem, which asks for the smallest set of weighted paths that "covers" a flow on a DAG, has recently been used as an important computational step in tran- script assembly. We prove the problem is in FPT when parameterized by the number of paths by giving a practical linear fpt algorithm. Further, we implement and engineer a Flow De- composition solver based on this algorithm, and evaluate its performance on RNA-sequence data. Crucially, our solver finds exact solutions while achieving runtimes competitive with a state-of-the-art heuristic. Finally, we contextualize our design choices with two hardness results related to preprocessing and weight recovery. Specifically, k-Flow Decomposition does not admit polynomial kernels under standard complexity assumptions, and the related problem of assigning (known) weights to a given set of paths is NP-hard. Introduction 1 We study the problem Flow Decomposition [6, 10, 16, 19] under the paradigm of param- eterized complexity [4]. Motivated by the principles of algorithm engineering, we design and implement an fpt algorithm that not only solves the problem exactly but also has a run- time that is competitive with heuristics [16, 19]. Furthermore, we characterize several key aspects of the problem's complexity. Decomposing flows is the central algorithmic problem in a recent method for analyzing high-throughput transcriptomic sequencing data, and we benchmark our implementation on data from this use case [16]. Flow Decomposition asks for the minimum number of weighted paths necessary to exactly cover a flow on a directed acyclic graph with a unique source s and sink t (an s-t -- DAG). More precisely, we say a set of s-t -- paths P = p1, . . . , pk and corresponding weights w = (w1, . . . , wk) are a flow decomposition of an s-t -- DAG G with flow f if kX i=1 f(a) = wi · 1pi(a) for every arc a in G, where 1pi(a) is the indicator function whose output is 1 if a ∈ pi, and 0 otherwise. Specifically, in this paper, we are concerned with k-Flow Decomposition, which uses the natural parameter of the number of paths. k-Flow Decomposition (k-FD) Input: Problem: (G, f, k) with G an s-t -- DAG, f a flow on G, and k a positive integer. Is there an integral flow decomposition of (G, f) using at most k paths? © Kyle Kloster, Philipp Kuinke, Michael O'Brien, Felix Reidl, Fernando Sánchez Villaamil, Blair D. Sullivan, Andrew van der Poel; licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl -- Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 2 A practical fpt algorithm for Flow Decomposition and transcript assembly Shao and Kingsford recently used flow decompositions to assemble unknown transcripts from observed subsequences of RNA called exons [16]. In this context, the input graph is a splice graph, which is constructed in one of two ways: either by contracting induced paths in a de Bruijn graph (de novo assembly) or by connecting exons inferred from an alignment process that co-occur in reads (reference-based). In both constructions, every vertex in the graph corresponds to a (partial) exon being transcribed and every arc indicates that two exons appear in sequence in one of the reads; the arcs are weighted based on abundance (frequency) in the data. If we affix a dummy source s and a dummy sink t to the vertices of in- and out-degree zero, respectively, the resulting labeling forms a flow1 from s to t. As such, a transcript corresponds to a weighted s-t -- path and we aim to recover the collection of transcripts by decomposing the flow into a minimal number of paths in the above sense. A precursory investigation of the data used by Shao and Kingsford [16] to evaluate the performance of Flow Decomposition heuristics in RNA transcript assembly left us with three guiding observations: 1. 97% of instances admit decompositions into fewer than 8 paths. Our algorithm should thus exploit the small natural parameter. 2. The data set contains over 17 million mostly small instances. Our implementation should therefore be able to handle a large throughput. 3. The flow decompositions computed by our implementation should reliably recover the domain-specific solution i.e. the true transcripts. The first point corroborates the parameterized approach. Using dynamic programming over a suitable graph decomposition, a common algorithm design technique from parameterized complexity, we show the problem can be solved in linear-fpt time (Section 3): (cid:73) Theorem 1. There is an 2O(k2)(n + λ) algorithm for solving k-Flow Decomposition, where λ is the logarithm of the largest flow value. To address the second point, we implement a Flow Decomposition solver, Toboggan [7], based on this algorithm and compare it with the state-of-the-art heuristic Catfish (Section 5). Our results show that Toboggan's running time is comparable to Catfish and thus suitable for high-throughput applications. With respect to the third point, using Flow Decompo- sition for assembly implicitly assumes that the true transcripts correspond to paths in a minimum-size flow decomposition. Prior work focuses on heuristics which cannot be used to evaluate the validity of this assumption. With Toboggan, we validate that minimum-size flow decompositions accurately recover transcripts in most instances (Section 5.3). Toboggan incorporates several heuristic improvements (discussed in Section 4) to keep the running time and memory consumption of the core dynamic programming routine as small as possible. In particular, the simple preprocessing we employ is highly successful in solving many instances directly. A provable guarantee for this preprocessing in the form of a small kernel, however, is unlikely: we show that unless NP is contained in coNP/poly, k-FD does not admit a polynomial kernel (Section 6). Further, our experimental evaluation hints at the following conjecture: for a given decomposition of an s-t -- DAG into a minimum number of paths, there is a unique assignment of weights to those paths to achieve a flow- decomposition. If the conjecture holds, it implies a tighter bound on the running time of the algorithm in Theorem 1. Despite this, we prove the more general 'weight recovery' problem is NP-hard given a decomposition into an arbitrary number of paths (Section 7). 1 This assumes an idealized scenario with constant read coverage, but methods exist to rectify noisy data [18]. K. Kloster, P. Kuinke, M.P. O'Brien, F. Reidl, F. Sánchez Villaamil,B. D. Sullivan, A. van der Poel 3 Preliminaries 2 Related work. Flow Decomposition is known to be NP-complete, even when all flow values are in {1, 2, 4}, and does not admit a PTAS [6, 19]. The best known approximation algorithm for the problem is based on parity-balancing path flows [10], and guarantees an approximation ratio of λLλ with a running-time of O(λV · E2), where L is the length of the longest s-t -- path, and λ is the logarithm of the maximum flow value. The variant in which the decomposition approximates the original flow values to minimize a specified penalty function was studied in [17], and the authors give an fpt algorithm and FPTAS parameterized by k, the largest s-t-cut, and the maximum flow value. Due to its practical use for sequencing data, much of the prior work on Flow Decom- position has focused on fast heuristics, including two greedy algorithms which iteratively add the remaining path which is shortest (greedy-length) or of maximum possible weight (greedy-width) [19]. Both heuristics produce solutions with at most k = E − V + 2 paths and have variants [6] which decompose all but an ε-fraction of the flow using at most O(1/ε2) times the minimum number of paths, for any ε > 0. Historically, greedy-width has provided the best performance [6, 10, 19], but the recent heuristic Catfish [16] showed significant improvements over greedy-width in accuracy and runtime. Notation. Given a directed acylic graph (DAG), G = (V, A), we say G is an s-t -- DAG if G has a single source, s, and a single sink, t. We denote by A+(v) the set of out-arcs of a node v, and by A−(v) the in-arcs. For a set of nodes, S, we define A+(S) = {vu v ∈ S, u /∈ S, vu ∈ A+(v)}. If f is a flow on G, we write f(a) for the flow value on an arc a and F for the total flow (the sum of flow values on the arcs in A+(s)). Terminology. Given a DAG, a topological ordering on the nodes is a labeling such that every arc is directed from a node with a smaller label to one with a larger label. We label the nodes of an s-t -- DAG G as v1, . . . , vn corresponding to an arbitrary, fixed topological ordering of G; this implies that s = v1 and t = vn. We further define the sets Si = {vj j ≤ i} based on the ordering. We refer to the s-t -- cuts A+(Si) as topological ordering cuts (top-cuts). Our algorithm for computing a flow decomposition will ultimately depend on tracking how the paths cross top-cuts, a notion we refer to as a routing. (cid:73) Definition 2 (Routings and extensions). A surjective function g : [k] → A+(Si) is a routing out of Si. A routing g0 : [k] → A+(Si) is an extension of g : [k] → A+(Si−1) if for each j ∈ [k], g0(j) = xy implies g(j) = xy if x 6= vi, and g(j) = zx for some z ∈ Si−1 if x = vi. In other words, an extension of a routing takes all the integers that map to in-arcs of vi and maps them instead to the out-arcs of vi (because it is surjective) while leaving the rest of the mapping unchanged. It will be important in our analysis to differentiate arcs that occur in multiple paths from arcs that appear on only a single path: we say paths p and p0 coincide on arc a if a ∈ p and a ∈ p0. An arc a is saturated by a path p if p is the only path for which a ∈ p. Parameterized complexity. A parameterized decision problem Π ∈ Σ∗ × N is fixed parameter tractable if there exists an algorithm that decides it in time g(k) · nc for some computable function g and a constant c. When c = 1, we call such an algorithm linear fpt. A polynomial kernel is an algorithm that transforms, in polynomial time, an instance (I, k) ∈ Σ∗ × N of Π into an equivalent instance (I0, k0) with I0, k0 ≤ kO(1), meaning that (I, k) ∈ Π if and only if (I0, k0) ∈ Π. Some more advanced machinery pertaining to kernelization lower bounds will be defined in Section 6. 4 A practical fpt algorithm for Flow Decomposition and transcript assembly Figure 1 An entry of the table T3. The routing g out of S3 (dashed lines) is an extension of the previous routings (solid paths). Each row in the constraint system L on the right corresponds to an arc; those shaded in gray are from arcs inside S3, and those in white come from g. A linear fpt algorithm for k-FD 3 We solve k-FD via dynamic programming over the topological ordering: we enumerate all ways of routing k s-t -- paths over each top-cut A+(Si). Each such routing determines a set of constraints for the path weights, which we encode in linear systems. For example, if paths p1 and p2 are routed over an arc a, we add the constraint w1 + w2 = f(a) to our system. Concretely, we keep a table Ti for 0 ≤ i ≤ n whose entries are sets of pairs (g, L), where g : [k] → A+(Si) is a routing of the paths out of Si and L is a system of linear equations that encodes the known path weight constraints. In particular, for every arc a ∈ A+(Si), we write g−1(a) for the set of s-t -- paths that are routed over a. Each system of linear equations, L, is of the form Aw = b, where A is a binary matrix with k columns, w is the solution weight vector, and b is a vector containing values of f. Each row r of A corresponds to an arc ar and encodes the constraint that the weights of paths routed over ar sum up to f(ar). The jth entry of row r is 1 if and only if path pj was routed over ar, and then f(ar) equals the rth entry of b. Figure 1 illustrates an example of an entry (g, L). We now describe how the dynamic programming tables are constructed. For ease of description, we augment G to have two additional dummy arcs as and at, where as is an in-arc of s and at is an out-arc of t and f(as) = f(at) = F. We begin with table T0 that has a single entry. The routing of this entry routes all paths over as and the linear system has a single row that constrains all path weights to sum to the total flow value. For i > 0, we construct the table Ti from Ti−1. Conceptually, we "visit" node vi and "push" all paths routed over its in-arcs to be routed over its out-arcs. Formally, we require the routing out of Si to be an extension (Definition 2) of a routing out of Si−1. For each entry (g, L) ∈ Ti−1 we compute an entry (g0, L0) of Ti for each extension g0 of g. For a given g0, we create L0 by adding a row to L for each arc a ∈ A+(vi), encoding the constraint X i∈g0−1(a) wi = f(a). At the conclusion of the dynamic programming, all entries of the final table Tn will have the same routing, since vn = t has one (dummy) out-arc at. This table allows us to decide whether there is a solution; (G, f) is a yes-instance of k-FD if and only if some L ∈ Tn has a solution w whose entries are positive integers. Pseudocode for our algorithm can be found in Algorithm 1 in Appendix A. (cid:73) Lemma 3. An integer vector w is a solution to L ∈ Tn if and only if there is a set of s-t -- paths P such that (P, w) is a flow decomposition of (G, f). K. Kloster, P. Kuinke, M.P. O'Brien, F. Reidl, F. Sánchez Villaamil,B. D. Sullivan, A. van der Poel 5 Proof. We first prove the forward direction. If we keep backpointers in our DP tables i.e. pointers from entry (gi, Li) to the entry in the previous table (gi−1, Li−1) for which gi was the extension of gi−1, we can obtain a sequence of routings gn−1, . . . , g1 that correspond to backwards traversal of the backpointers. Let h(j) = g1(j), . . . , gn−1(j). By Definition 2, removing the duplicate elements that appear in consecutive order from h(j) yields a series of arcs that form an s-t -- path pj. Because each routing requires every arc to have a path routed over it, the system L contains constraints corresponding to each arc. Thus an integer solution w to L corresponds to a weighting of P = p1, . . . , pk such (P, w) is a flow decomposition. In the reverse direction, we first observe that the incidence of paths in P on a top-cut A+(Si) corresponds to a routing out of Si. Let gi be the corresponding routing out of Si. For each node vi, the paths routed over A−(vi) must immediately be routed over an arc in A+(vi), meaning gi is an extension of gi−1. Because (P, w) is a flow decomposition, the paths routed over each arc will have weights summing to the flow value on that arc. Thus, any constraint in a linear system associated with the routings gi will have w as a solution. (cid:74) To analyze the running time we now derive bounds on the dynamic programming table sizes. First, we bound the number of possible routings in Lemma 4, then we give an upper bound on the number of linear systems in Lemma 5. (cid:73) Lemma 4. There are at most Proof. A routing of k paths over a top-cut C can be thought of as a partition of the paths into ' = C many non-empty sets along with a mapping of these sets to the arcs of C. We can assume that ' ≤ k, since a routing of k paths requires every top-cut to have at k (0.649k)k routings of k paths over any top-cut. Stirling number of the second kind, and there are '! ways to assign each of these partitions most k arcs. The number of ways to partition k objects into ' non-empty sets is (cid:8)k to a specific arc. Thus, the number of routings is (cid:8)k bound (cid:8)k (cid:9), the (cid:9)'!. To proceed, we use the upper (cid:1)'k−' due to Rennie and Dobson [12]. We also make use of the tighter (cid:18) k version of Stirling's approximation due to Robbins [13], which states that (cid:9) ≤ 1 (cid:18) k (cid:19)k (cid:19)k (cid:0)k ' √ √ √ 2 ' ' ' e1/(12k+1) ≤ k! ≤ 2πk e1/12k. e 2πk e Hence, we have the upper bound (cid:26)k (cid:27) ' '! ≤ 1 2 (cid:18)k (cid:19) k! 'k−''! = 1 (cid:19)k(cid:18) e (cid:18) k 2 (k − ')! 'k '' (cid:19)k−' ' √ √ k k − ' 2 √ e kk'k−l ≤ ≤ k (k − ')k−'e' . k − ' 12k − 1 e 1 12(k−')+1 'k '' Letting ' = αk for α ∈ (0, 1), the above expression becomes √ k (αk)k−αk (k − αk)k−αkeαk kk ≤ √ k where the constant 0.649 can be derived numerically by maximizing g(α) =(cid:16) α (cid:17)(1−α) 1−α (cid:19)(1−α) (cid:18) α 1 − α !k e−α kk ≤ k (0.649k)k, √ on the interval [0, 1]. (cid:73) Lemma 5. Each table has at most 4k2 k! kk distinct linear systems. e−α (cid:74) 6 A practical fpt algorithm for Flow Decomposition and transcript assembly Proof. Without loss of generality, we can ensure each linear system L has at most k rows by removing linearly dependent rows. We note that because there are only 2k subsets of weights, if f maps the arcs to more than 2k unique flow values, there cannot be a flow decomposition of size k. Since the elements of b can thus take on at most 2k many values, and A contains binary rows of length k, it follows that there are at most 4k rows for L. Accordingly, we can bound the number of possible linear systems by(cid:0)4k bound (cid:0)n (cid:1) ≤ (n/k)k which holds [8] for k ≤ √ order on the rows we can remove a factor of 1/k!. Because k ≤ (cid:1). By imposing an 4k, we can apply the n; thus, the number of linear systems is at (cid:74) k most 4k2 /(k! kk). √ k Now that we have bounded the size of the dynamic programming tables, we analyze the com- plexity of solving the linear systems in the final table Tn. It has been shown that treating linear systems as integer linear programs (ILPs) produces integer solutions in fpt-time. (cid:73) Proposition 6 ([9]). Finding an integer solution to a given system L takes time at most O(k2.5k+o(k)L), where L is the encoding size of the linear system. These results give the following upper bound on the runtime of our algorithm, proving Theorem 1. (cid:73) Theorem 7. Algorithm 1 solves k-FD in time 4k2 logarithm of the largest flow value of the input. k1.5kko(k)1.765k · (n + λ) where λ is the Proof. The correctness of the algorithm was already proven in Lemma 3, so all that remains is to bound the running time. By Lemmas 4 and 5, the total number of elements in DP table Ti is bounded by √ 4k2 k! kk · k (0.649k)k = √ k 4k20.649k . k! Reducing the linear systems and checking for consistency is polynomial in the size of the matrix (which is k × k). Finally, we need to find a feasible solution among all the linear systems left after the last DP step. We apply Proposition 6 to these systems, whose encoding size is bounded by kO(1)λ. We arrive at the desired running time of 4k2 k2.5k0.649k k! ko(k) · (n + λ) ≤ 4k2 k1.5k1.765kko(k) · (n + λ) where we use the well-known bound kk k! ≤ ek. (cid:74) Implementation 4 To establish that our exact algorithm for k-FD is a viable alternative to the heuristics cur- rently in use by the computational biology community, we implemented Algorithm 1 as the core of a Flow Decomposition solver Toboggan [7]. The solver iterates over values of k in increasing order until reaching a yes-instance of k-FD. Toboggan also implements back- tracking to recover the s-t -- paths. Making Toboggan's runtime competitive with existing im- plementations of state-of-the-art heuristics required non-trivial algorithm engineering. Our improvements broadly fall into three categories: preprocessing, pruning, and low-memory strategies for exploring the search space. The remainder of this section describes the most noteworthy techniques implemented in Toboggan that are not captured by Algorithm 1. K. Kloster, P. Kuinke, M.P. O'Brien, F. Reidl, F. Sánchez Villaamil,B. D. Sullivan, A. van der Poel 7 4.1 Preprocessing Toboggan implements two key preprocessing routines. The first generates an equivalent instance on a simplified graph using a series of arc contractions. The second calculates lower bounds on feasible values of k to reduce the number of calls to the k-FD solver. Graph reduction. We first reduce the graph by contracting all arcs into/out of nodes of in-/out-degree 1. We prove in Lemma 8 that given a flow decomposition of the contracted graph, we can efficiently recover a decomposition of the same size for the original graph. (cid:73) Lemma 8. Let uv be an arc for which A+(u) = 1 or A−(v) = 1 and G0 the graph created by contracting uv. Then (G0, f) has a flow decomposition (P 0, w) of size k iff (G, f) has a flow decomposition (P, w) of size k. Moreover, we can construct (P, w) from (P 0, w) in polynomial time. Proof. We first note that if GR is the graph formed by reversing the directions of the arcs in G, any solution to G can be transformed into a solution to GR by reversing the order of the paths and maintaining the same weights. Since this reversal is involutive, the correspondence between solutions to G and GR is bijective, so it suffices to consider the case A+(u) = 1. Given G with a node u that has A+(u) = 1, let G0 be the graph G with arc uv contracted. Given a flow decomposition (P, w) of (G, f), we construct a corresponding decomposition (P 0, w) for (G0, f) as follows. Every path p ∈ P containing u must have v as the vertex succeeding u. Removing u from each such p will create a valid path in G0, since A−(u) becomes part of A−(v) in G0. Moreover, the incidence of paths on each other arc remains unchanged, so the solution covers the flows in G0. In the reverse direction, consider a labeling of the arcs of G0 such that we can distinguish among the in-arcs of v those which exist in G from those that result from contracting uv. Let Anew be the set of latter arcs. We construct P from P 0 as follows. For each path p ∈ P 0, if p is routed over xv ∈ Anew we modify p to include the arcs xu and uv, rather than the arc xv, and add the modified path to P. If no such arc lies in p, we simply add p to P. As in the forward direction, it is clear that any arcs in G without u as an endpoint have their flow values covered by P, and that every path in P is an s-t -- path in G. Since xv ∈ Anew is derived from an arc xu ∈ G, if Q0 ⊂ P 0 are the paths routed over xv and Q is the set of paths corresponding to Q0 in P, then Q exactly covers xu. Since every path in P routed through A−(u) subsequently is routed over uv and the flow values on the in-arcs of (cid:74) u sum to f(uv), uv is also covered by P. Thus (P, w) is a valid solution to (G, f). Lower bounds on k. To reduce the number of values of k that Toboggan considers before reaching a yes-instance, we compute a lower bound on the optimal value of k. One immediate lower bound is the size of the largest top-cut; we implement this in conjunction with the additional bound established in Lemma 9. Intuitively, if two top-cuts share few common flow values, many of the arcs must have multiple paths routed over them. (cid:73) Lemma 9. Given a flow (G, f), let C1 and C2 be any two top-cuts with C1 ≥ C2. Letting F(S) be the multiset of flow values occurring in S, set F1 = F(C1) \ F(C2) and F2 = F(C2) \ F(C1). If (G, f) has a flow decomposition of size k, then k ≥ F(C1) ∩ F(C2) + 2 3(F1 + F2), (1) and this lower bound is tighter than the cutset size C1 iff F1 < 2F2. Proof. Suppose k paths cross cutsets C1 and C2. For every flow value in I = F(C1)∩F(C2), it is possible a single path saturates the arc with that flow value in both cuts. Consider the 8 A practical fpt algorithm for Flow Decomposition and transcript assembly remaining h = k − I paths. To maximize the number of distinct flow values these h paths produce, let each path saturate an arc in C1, yielding h values in F1, and then route those h paths in pairs across distinct arcs in C2. This produces at most h/2 new flow values in F2. This yields (3/2)h ≥ F1 + F2, and substituting for h proves Inequality (1). To prove the relationship between this lower bound and C1 there are two cases. If F1 ≥ 2F2, then by substituting we can upper bound (2/3)(F1+F2) ≤ F1 = C1−I ≤ C1. If instead F1 < 2F2, substituting yields I + (2/3)(F1 + F2) > I + F1 = C1. (cid:74) 4.2 Search Space Strategies To reduce the memory required by dynamic programming, our implementation diverges from the pseudocode of Algorithm 1 in two ways. Specifically, we solve a restricted weight variant of k-FD and use a separate phase to recover the s-t -- paths. Weight restriction. Rather than making one pass through the dynamic programming that infers the solution weights from the linear systems, we employ a multi-pass strategy. Each pass restricts the potential weight vector by fixing a subset of its entries to weights chosen from flow values in the input instance while leaving the remaining values as variables to be determined by the DP routine. Since we observe that most instances in the data set (see Section 5.1) admit decompositions whose paths saturate at least one arc, we begin by enumerating potential weight-vectors whose values are all taken from flow values. If the DP routine finds no solution for any of these vectors, we enumerate vectors in which exactly one value is undetermined and all other entries are again taken from flow values, etc. If all these attempts should fail, the final pass in our strategy will leave all weights to be determined by the DP and hence is guaranteed to find a solution, should one exist. For most instances, however, a solution vector is quickly guessed, vastly reducing the number of candidate linear systems in the DP and thus saving both time and memory. Path recovery. Computing the path weights requires storing only the current and previous dynamic programming tables in memory. In contrast, recovering the paths requires storing all dynamic programming tables. For this reason, we first determine the weights w and then recover the paths by running the dynamic programming again with weights restricted to w. This is equivalent to solving the k-Flow Routing problem in Section 6. 4.3 Pruning Within the dynamic programming we employ a number of heuristics that help recognize algorithmic states that cannot lead to a solution. Weight bounds. We augment the weight constraints imposed by the linear systems with a set of routing-independent constraints. These take the form of upper and lower bounds (Bi and bi, respectively) on the ith smallest weight wi. First, we compute bk by noting that for any top-cut C and any arc a ∈ C, only k−C+1 paths can be routed over a, i.e. bk ≥ f(a)/(k − C + 1). Then, we compute Bk by finding the largest weight of any s-t -- path. This can be done via a simple dynamic programming algorithm: for any node v, an s-v -- path with weight w requires a path of equal weight to an in-neighbor u such that w ≤ f(uv). To compute the bounds on the other weights, i < k, we let B1 be the smallest flow value and Bi be the smallest2 flow value greater thanPi−1 wi ≥ (F − W)/i, where F is the total flow. Thus, wi ≥ (F −Pk j=1 wj, then a must be part of a path of weight at least wi. Finally, we use these upper bounds to derive the bis. If the weights greater than wi sum to W, then by the pigeonhole principle j=1 Bj. In other words, if f(a) >Pi−1 j=i+1 Bj)/(i + 1). K. Kloster, P. Kuinke, M.P. O'Brien, F. Reidl, F. Sánchez Villaamil,B. D. Sullivan, A. van der Poel 9 For simplicity of implementation, we force the values of our weight vector to appear in non-decreasing order. In each dynamic programming table, for each linear system L we run a linear program to see if there are any (rational) weights within the bounds that satisfy L. If not, we remove the entry of the dynamic programming table containing L. We also use these bounds before dynamic programming to catch partially determined weight vectors that will not be able to yield a solution. For example, the predetermined vector3 w = (1, 3,∗,∗, 5, 11) is incompatible with a lower bound on the third entry greater than 5. Storing linear systems. Within the dynamic programming we store linear systems in row-reduced echelon form (RREF). When a new row r is introduced to the system, we perform Gaussian elimination to convert the new row to RREF, checking for linear dependence and inconsistency in O(k2) time. The iterative row reduction also has the advantage of revealing determined path weights even if the system is not fully determined, and thus we can check whether any such values are not positive integers. Furthermore, once the system is full rank, no additional computation needs to be done to recover the weights. Experimental Results 5 In this section we empirically evaluate the efficiency and solution quality of Toboggan by comparing with the current state-of-the-art, Catfish, on a corpus of simulated RNA sequenc- ing data. Additionally, we use Toboggan to theoretically validate the k-FD problem as a model for the transcript assembly task. 5.1 Experimental setup Our experiments were run on a corpus of data used in previous experiments by Shao and Kingsford [15, 16]. The full data set contains over 17 million instances, each generated by simulating RNA-seq reads from a transcriptome and building the s-t -- DAG and flow using the procedure described in Section 1. Two software packages were used to simulate reads: Flux Simulator [5], which used transcriptomes from humans, mice, and zebrafish, and Salmon [11], which only used human transcriptomes. We will refer to these four subsets as human, mouse, zebrafish, and human-salmon, respectively. The simulated reads allow us to know the true transcripts and thus the corresponding flow decomposition a priori; we will refer to this particular decomposition as the "ground truth". In our three experimental analyses (model validation, algorithm timing, and solution- quality) we report results on just the three smaller datasets (human, mouse, zebrafish). We terminated Toboggan on any run whose weight computation took longer than 800 seconds on zebrafish, and 50s on human and mouse4. After performing more exhaustive computations on these smaller data sets, we then used the larger human-salmon data set (13.3M) to add one more data point for the model validation experiment. Because of the size of human-salmon, we terminated Toboggan after only 1 second. This smaller time limit resulted in Toboggan 2 If no such flow value exists, set Bi = Bk. 3 A ∗ indicates an undetermined value. 4 Under these constraints, Toboggan timed out on 5 136 of the 4M instances in these smaller data sets. 10 A practical fpt algorithm for Flow Decomposition and transcript assembly Figure 2 Runtimes of Toboggan and Catfish on all non-human-salmon, non-trivial instances. The y-axes indicate the number of instances on which the algorithms terminate in the given time window. timing out on a significantly larger portion of human-salmon than the other three (3% on human-salmon compared to 0.1% on the other data sets), which would bias the results on human-salmon toward its simpler instances. Because of this, we omit the human-salmon results from the timing and solution-quality experiments. For a small number of the 17M instances, the ground truth decomposition contains at least one path that appeared multiple times, corresponding to a subsequence repeated in different locations of the transcriptome. The data provides no means for mathematically or biologically distinguishing these; thus, we aggregated the duplicated paths into a single path, summing their weights. Additionally, we removed "trivial" instances in which the graph consisted of a single s-t -- path; on such graphs Toboggan terminates during preprocessing without executing the k-FD algorithm described in this paper. We remark that this is a departure from the experimental setup of Catfish, which included such graphs, explaining some slight differences in our statistics. About 50% of the 17M graphs in the corpus are trivial in this manner. The number of non-trivial graphs for each species is summarized in Table 1. All experiments were run on a dedicated system with an Intel i7-3770 (3.40GHz, 8 cores), an 8192 KB cache, and 32 GB of RAM. 5.2 Benchmarking We start by analyzing the efficiency of Toboggan and Catfish, noting that this compares a Python implementation [7] with C++ code [15]. Their runtimes on the 1.4M non-trivial instances in the smaller data sets are shown side-by-side in Figure 2. We observe that the two implementations are both quite fast on the vast majority of instances: their median runtimes are 1.24 milliseconds (ms) (Toboggan) and 3.47ms (Catfish). However, the implementations have different runtime distributions -- whereas Catfish is consistent, terminating between 2.3 -- 4.6ms on 90% of instances and never running longer than 1.3 seconds, Toboggan trades off faster termination, e.g. less than 2ms on 80% of instances, with a higher variance and a small chance of a much longer runtime, e.g. over 50 seconds on 0.48% of instances. 5.3 Model Validation Previous papers that use flow decompositions to recover RNA sequences [16, 18] implicitly assume that the true RNA sequences correspond to a minimum size flow decomposition, as K. Kloster, P. Kuinke, M.P. O'Brien, F. Reidl, F. Sánchez Villaamil,B. D. Sullivan, A. van der Poel 11 opposed to one with an arbitrary number of paths. Because Toboggan provably finds the minimum size of a flow decomposition, our implementation enables us to investigate exactly how often this assumption holds in practice. Table 1 gives the percentage of all non-trivial instances whose ground truth decom- positions are in fact minimum decompositions, as well as the percentage of ground truth decompositions we proved have non-optimal size. We conclude from this table that the Flow Decomposition problem is in fact a useful model for transcript assembly, which underscores the need for efficient algorithms to compute minimum decompositions. dataset zebrafish mouse human human-salmon all instances 1,549,373 1,316,058 1,169,083 13,300,893 17,335,407 non-trivial 445,880 473,185 529,523 7,153,472 8,602,060 nodes 18.49 18.67 18.79 20.54 20.22 deg 2.27 2.37 2.41 2.55 2.52 k 2.32 2.75 2.83 3.74 3.55 optimal 99.91% 99.40% 99.49% 94.39% 95.27% non-optimal 0.053% 0.074% 0.043% 0.035% 0.039% Table 1 Summary of the RNA sequencing dataset [15]. Statistics are for non-trivial instances. Columns 4 through 6 give averages; column 7 (8) reports the percent of non-trivial ground truth decompositions that are optimal (non-optimal) size. Because Toboggan timed out on some instances, these percentages do not sum to 100. The high percentage of instances with ground truth of minimum size supports the use of Flow Decomposition as a model for transcript assembly. 5.4 Ground Truth Recovery Though the ground truth flow decompositions are almost always of minimum size, it is bio- logically desirable to find a particular minimum size decomposition rather than an arbitrary one. In this section we investigate how often the decompositions output by Toboggan and Catfish are identical to the ground truth decomposition, restricting our attention to non- trivial instances in which the ground truth decomposition is of minimum size. Additionally, for those instances where each algorithm does not exactly recover the ground truth, we ana- lyze the similarity of the (imperfect) path set to the ground truth, using the Jaccard index. The table in Figure 3 summarizes the performance of the Toboggan and Catfish imple- mentations in exactly computing the ground truth decompositions. Their behavior was quite similar, with slight differences at each decomposition size, and a 0.2% advantage for Toboggan overall. For instances where an algorithm's output is not identical to the ground truth, an output can still recover some useful information if it is highly similar to the ground truth decompo- sition. With this in mind, we evaluate how similar each algorithm's output is to the ground truth when they do not exactly match5. The plot in Figure 3 shows the distribution of the Jaccard index of each algorithm's output compared to the ground truth paths. 6 Kernelization lower bounds As described in Section 4.1, our implementation employs a graph reduction algorithm that rapidly identifies any trivial graph and immediately solves Flow Decomposition. Out of the 17M total instances, this preprocessing solves all of the roughly 8.7M trivial instances. 5 There are 43,817 such instances for Catfish and 41,783 for Toboggan. 12 A practical fpt algorithm for Flow Decomposition and transcript assembly k 2 3 4 5 6 7 8 9 10 11 all instances 63.2791% 22.0775% 8.5237% 3.4920% 1.5375% 0.6698% 0.2889% 0.1241% 0.0070% 0.0004% 100% Catfish Toboggan 0.995 0.992 0.969 0.967 0.931 0.930 0.886 0.886 0.830 0.828 0.788 0.780 0.767 0.766 0.743 0.740 0.802 0.752 0.500 0.500 0.975 0.973 Figure 3 (Left) Proportion of ground truth path sets that Catfish and Toboggan recover exactly, organized by path set size (k). Bold numbers indicate the algorithm with better performance. (Right) Distributions of the Jaccard index between the algorithms' solutions and the ground truth on instances where the paths are not exactly recovered. On non-trivial instances, Toboggan then tries to identify the correct number k of paths in an optimal solution. The naïve lower bound from the largest edge cut is equal to the correct value of k in 96.5% of the 8.6M non-trivial instances; incorporating the bound from Lemma 9 brings this up to 98.4%. In the framework of parameterized complexity, it is therefore natural to ask whether k- FD admits a polynomial kernel. Below we answer the question in the negative, despite the real-world success of our preprocessing. Our proof strategy requires hardness reductions involving the following restricted variants of Flow Decomposition. U-k-Flow Decomposition (U-kFD) Input: Problem: Does (G, f) have a flow decomposition into k paths whose weights are all An s-t -- DAG, G with an integral flow f, an integer k, and a set U ⊂ Z. members of U? U-k-Flow Routing (U-kFR) Input: Problem: An s-t -- DAG, G, integral flow f, and k integers w = (w1, . . . , wk) taken from U ⊂ Z. Is there a flow decomposition of (G, f) into k paths with respective weights w? (cid:73) Lemma 10. {1, 2, 4}-k-Flow Routing is NP-complete. Proof. Consider an instance (G, f, k) of {1, 2, 4}-kFD, which is NP- complete [6]. Note that every s-t -- path in a potential solution to such an instance can only take weights in {1, 2, 4}. This enables us to Turing-reduce (G, f, k) to at most k3 instances of {1, 2, 4}-kFR: we simply guess how many of the k s-t -- paths use each of the three possible values. It follows that {1, 2, 4}-kFR is NP-complete. (cid:74) In order to show that k-FD does not admit polynomial kernels, we will provide a cross- composition from {1, 2, 4}-kFR. We first need the following technical definition to set up the necessary machinery: K. Kloster, P. Kuinke, M.P. O'Brien, F. Reidl, F. Sánchez Villaamil,B. D. Sullivan, A. van der Poel 13 under R in time polynomial in x + y, and of L belonging to the same equivalence class of R, takes time polynomial inP' (cid:73) Definition 11 (Polynomial equivalence relation [2]). An equivalence relation R over Σ∗ is called a polynomial equivalence relation if the following hold: 1. there exists an algorithm that decides for x, y ∈ Σ∗ whether x and y are equivalent 2. for any finite set S ⊆ Σ∗ the index S/R is bounded by a polynomial in maxx∈S x. The benefit of a polynomial equivalence relation is that we can focus on collection of instances which share certain characteristics, as long as these characteristics do not distinguish too many instances. A simple example is that we can ask for input instances (Gi, fi, ki) in which all graphs Gi have the same number of vertices and the values ki are the same. (cid:73) Definition 12 (AND-cross-composition [2]). Let L ⊂ Σ∗ be a language, R a polynomial equivalence relation over Σ∗, and let Π ⊆ Σ∗×N be a parameterized problem. An AND-cross composition of L into Π (under R) is an algorithm that, given ' instances x1, . . . xt ∈ Σ∗ i=1 xi and outputs an instance (y, k) ∈ Σ∗ × N such that a) the parameter k is polynomially bounded in max1≤i≤' xi + log ', and b) we have that (y, k) ∈ Π if and only if all instances xi ∈ L. We will now use the following theorem (abridged to our needs here) and the subsequent AND-cross-composition to prove that k-FD does not admit small kernels. (cid:73) Proposition 13 (Bodlaender, Jansen, Kratsch [2]). If an NP-hard language L AND-cross- composes into a parameterized problem Π, then Π does not admit a polynomial kernelization unless NP ⊆ coNP/poly and the polynomial hierarchy collapses. (cid:73) Theorem 14. k-Flow Decomposition does not admit a polynomial kernel unless NP ⊆ coNP/poly and the polynomial hierarchy collapses. Proof. Let Rw be the equivalence relation on instances of {1, 2, 4}-kFR where (G1, f1, w1) ≡ (G2, f2, w2) if and only if w1 = w2. Since each entry of wi is in {1, 2, 4}, Rw has at most k3 equivalence classes, and is a polynomial equivalence relation. Let x1, . . . , x' be instances of {1, 2, 4}-kFR all contained in the same equivalence class of Rw, with xi = (Gi, fi, w) and w = (w1, . . . , wk) the common prescribed path weights. We denote the source and sink of Gi by si and ti, respectively. We construct an additional instance x'+1 as follows: G'+1 consists of two vertices s'+1, t'+1, and k arcs a1, . . . , ak from s'+1 to t'+1. The flow f'+1 has value wi on arc ai. By construc- tion x'+1 = (G'+1, f'+1, w) is a positive instance of {1, 2, 4}-kFR; moreover, it has a unique decomposition into k s-t -- paths (up to isomorphism). any fi is different from Pk Before we describe the composition, we treat a technicality. If the total flow Fi for j=1 wj, then xi is a negative instance. In this case, instead of a composition we output a trivial negative instance y for k-FD. Otherwise, we compose the instances x1, . . . , x'+1 into a single composite instance y = (G, f, k) of k-FD. To form G, we chain the Gis together by identifying the vertex ti with the vertex si+1 for 1 ≤ i ≤ '. The resulting G is an s-t -- DAG with source s = s1 and sink t = t'+1. We define f to label each arc in G with the flow value from its original instance. Since each xi has the same total flow, f is a flow on G. We point out that property a) of Definition 12 is trivially satisfied. To see that property b) holds, first assume that all instances xi are positive. Since all these solutions consist of k s-t -- paths with the same prescribed values w1, . . . , wk, we can chain the individual flow 14 A practical fpt algorithm for Flow Decomposition and transcript assembly Finally, our construction clearly takes time polynomial inP' decompositions together into k s-t -- paths in G. Accordingly, y is then a positive instance. In the other direction, assume that y has a solution, i.e. f can be split into exactly k s-t -- paths. Due to our inclusion of the instance x'+1 in the construction of y, the respective values of the s-t -- paths must be exactly w1, . . . , wk. But then restricting this global solution to each individual instance xi (since all s-t -- paths meet at the identified source/sink cut vertices) produces a solution. We conclude that therefore all xi must have been positive instances, as required i=1 xi making it an AND- cross-composition of {1, 2, 4}-kFR into k-FD. Invoking Theorem 13, this proves that k-FD does not admit a polynomial kernel unless NP ⊆ coNP/poly. (cid:74) We note that our construction in the proof of Theorem 14 produces an instance of U-kFD, which can easily be Turing reduced into an instance of U-kFR. (cid:73) Corollary 15. Unless NP ⊆ coNP/poly, the problems U-k-Flow Decomposition and U-k-Flow Routing do not admit polynomial kernels. 7 Hardness of assigning weights Every solution computed by Toboggan in our experiments corresponded to a fully determined linear system in the final dynamic programming table. This means that we never had to run the expensive ILP solver to determine the weights; instead, they were computed in polynomial time with respect to k using row reduction. This raises the question: is the linear system obtained from a decomposition into paths always fully determined? In the following we show that the answer must be 'no' in case of non-optimal decompositions. Not only can there be multiple weight-assignments for the same set of paths, recovering these weights is actually NP-hard. Formally, we consider the problem k-Flow Weight Assignment. k-Flow Weight Assignment (kFWA) Input: Problem: An s-t -- DAG G with an integral flow f, and a prescribed set of s-t -- paths, P = p1,··· , pk. Identify integral weights w = (w1, . . . wk) such that (P, w) is a flow decompo- sition of G. Our proof that kFWA is NP-complete relies on a reduction from Exact 3-Hitting Set, which is equivalent to monotone 1-in-3-SAT and known to be NP-hard [14]. Exact 3-Hitting Set (X3HS) Input: A finite universe U = {u1,··· , un}, and a collection S ⊆(cid:0)U (cid:1) of subsets of U 3 Problem: Find a subset X ⊆ U such that each element of S intersects ("hits") X exactly of size 3. once, i.e. ∀S ∈ S,S ∩ X = 1. (cid:73) Theorem 16. k-Flow Weight Assignment is NP-complete. Proof. Given an instance (U,S) of X3HS, we will construct an equivalent instance of kFWA. Our approach is to encode each element of U using two "partner" s-t -- paths in an s-t -- DAG, G, whose weights sum to 3, and each triad in S as a different top-cut in G. We K. Kloster, P. Kuinke, M.P. O'Brien, F. Reidl, F. Sánchez Villaamil,B. D. Sullivan, A. van der Poel 15 Figure 4 (Left) Instance of X3HS with unique solution {A, E}. (Right) The s-t -- DAG from our reduction, and a flow decomposition corresponding to the solution {A, E}. Light arcs have weight 3, medium 4, and heavy 5; dashed paths have weight 1 and solid paths 2. will route the partner paths and assign flow values so that the set of s-t -- paths with weight 2 exactly correspond to elements in a solution to the hitting set problem. We first construct G. Let V (G) = {s, v1, . . . , vS, t = vS+1}, where vi is associated with the ith triad in S for 1 ≤ i ≤ S, and s/t are source/sink vertices. Our construction will be such that each vertex other than t has exactly one out-neighbor: s has out-neighbor v1 and vi has out-neighbor vi+1. Create one sv1 arc with flow value 3 for each element of U, and (U − 1) vivi+1 arcs -- one each of flow values 4 and 5, and U − 3 with flow value 3. We now define a set of prescribed paths P = {pY , ¯pY }Y ∈U. For each element Y ∈ U, the corresponding partner s-t -- paths pY and ¯pY are routed over the same arc out of s. This guarantees that each pair of partner paths must receive weights summing to 3. At vi, we route these paths to encode the corresponding triad Si = {u1, u2, u3} as follows. The paths pu1, pu2, and pu3 are routed over the arc with flow 4 and ¯pu1, ¯pu2, and ¯pu3 go over the arc of flow 5. Now assign each element u0 ∈ U \ Si to a unique vivi+1 arc au0 of flow value 3 and route pu0 and ¯pu0 together over au0. This construction is illustrated in Figure 4. To complete the proof, we describe how a solution to this instance of kFWA yields a solution to the original instance of X3HS. Consider the possible values of the weights of the paths in P. By design, the out-arcs of s force each pair of partner paths to have one of weight 1 and one of weight 2. Each triad Si is represented by two arcs out of vi: one with flow value 4 (ai), and the other with 5 ( ¯ai). Because exactly three prescribed s-t -- paths are routed over a, and all our paths must have weight 1 or 2, this guarantees that exactly one s-t -- path routed over a has weight 2 (and the other two must have weight 1). Thus, finding a set of weights that solve this instance of kFWA is equivalent to choosing a set of paths to have weight 2 such that exactly one selected path is routed over each arc with flow value 4. But this is equivalent to choosing a set of elements (paths) such that each triad (arc) is (cid:74) hit by (incident to) exactly one of the chosen elements (s-t -- paths of weight 2). In the above reduction, we looked for a decomposition with 2·U prescribed paths. However, if we do not prescribe paths, there is a flow decomposition with U + 1 paths (U − 1 of weight three, one of weight two, and one of weight one) and a corresponding linear system 16 A practical fpt algorithm for Flow Decomposition and transcript assembly of full rank6. As such, it is possible that kFWA is not difficult when the prescribed paths on a yes-instance are part of an optimal decomposition. (cid:73) Conjecture 17. If k is the minimum value for which (G, f) has a flow decomposition of size k, then every integer-weighted solution has a corresponding linear system L of rank k. A direct consequence of this conjecture would be that the running time in Theorem 7 k! ·4k20.649kkO(1) · n since the ILP-solving step would never occur. immediately improves to 1 In this context, we note that Vatinlen et al. [19] proved that when k is minimum, every solution with real-valued weights has a corresponding linear system of full rank. However, their proof does not hold when the path weights are restricted to the integers. Conclusion 8 We presented a holistic treatment of Flow Decomposition from the perspectives of param- eterized complexity and algorithm engineering, resulting in a competitive solver, Toboggan. Our approach verifies that parameterized algorithms can (with sufficient engineering) be applied to real-world problems even in high-throughput situations. Our work also naturally leads to several practical and theoretical questions for further investigation. On the practical side, we would like to understand the cases in which a minimal flow decomposition does not match the assembly problem's ground truth, and how we might improve the recovery rate. The similarity in performance of Toboggan and Catfish in our experiments suggests that we need to refine either the problem formulation or our notion of minimality; in either case, more domain-specific knowledge is needed. On the theory side, we ask whether there exists an fpt algorithm for Flow Decomposi- tion with running time kO(k)n or better. In particular, it will be interesting to see whether the established techniques used to improve dynamic programming algorithms [1, 3] are appli- cable to our algorithm. Furthermore, if Conjecture 17 holds, it immediately implies a tighter upper bound on the running time of our algorithm, and might lead to further optimizations. Acknowledgements. This work supported in part by the Gordon & Betty Moore Foundation's Data-Driven Discovery Initiative through Grant GBMF4560 to Blair D. Sullivan. References 1 H. L. Bodlaender, M. Cygan, S. Kratsch, and J. Nederlof. Deterministic single exponential time algorithms for connectivity problems parameterized by treewidth. In International Colloquium on Automata, Languages, and Programming, pages 196 -- 207. Springer, 2013. 2 H. L. Bodlaender, B. M. Jansen, and S. Kratsch. Kernelization lower bounds by cross- composition. SIAM Journal on Discrete Mathematics, 28(1):277 -- 305, 2014. 3 M. Cygan, J. Nederlof, M. Pilipczuk, M. Pilipczuk, J. M. van Rooij, and J. O. Wojtaszczyk. Solving connectivity problems parameterized by treewidth in single exponential time. In FOCS 2011, pages 150 -- 159. IEEE, 2011. 4 R. G. Downey and M. R. Fellows. Parameterized complexity. Springer, 2012. 5 T. Griebel, B. Zacher, P. Ribeca, E. Raineri, V. Lacroix, R. Guigó, and M. Sammeth. Modelling and simulating generic rna-seq experiments with the flux simulator. Nucleic Acids Research, 40(20):10073 -- 10083, 2012. 6 This is true regardless of whether (U,S) is a a yes-instance. K. Kloster, P. Kuinke, M.P. O'Brien, F. Reidl, F. Sánchez Villaamil,B. D. Sullivan, A. van der Poel 17 6 T. Hartman, A. Hassidim, H. Kaplan, D. Raz, and M. Segalov. How to split a flow? In INFOCOM 2012, pages 828 -- 836. IEEE, 2012. 7 K. Kloster, P. Kuinke, M. P. O'Brien, F. Reidl, F. Sánchez Villaamil, B. D. Sullivan, and A. van der Poel. Toboggan: Version 1.0. http://dx.doi.org/10.5281/zenodo.821634, June 2017. 8 R. J. Lipton. Bounds on binomial coefficents. https://rjlipton.wordpress.com/2014/01/15/bounds-on-binomial-coefficents/. 9 D. Lokshtanov. New Methods in Parameterized Algorithms and Complexity. PhD thesis, University of Bergen, 2009. 10 B. Mumey, S. Shahmohammadi, K. McManus, and S. Yaw. Parity balancing path flow decomposition and routing. In Globecom Workshops 2015, pages 1 -- 6. IEEE, 2015. 11 R. Patro, G. Duggal, M. I. Love, R. A. Irizarry, and C. Kingsford. Salmon provides fast and bias-aware quantification of transcript expression. Nature Methods, 14(4):417 -- 419, 2017. 12 B. C. Rennie and A. J. Dobson. On Stirling numbers of the second kind. Journal of Combinatorial Theory, 7(2):116 -- 121, 1969. 13 H. Robbins. A remark on Stirling's formula. American Mathematical Monthly, 62(1):26 -- 29, 1955. 216 -- 226. ACM, 1978. 14 T. J. Schaefer. The complexity of satisfiability problems. In 10th Annual STOC, pages 15 M. Shao and C. Kingsford. Catfish. https://github.com/Kingsford-Group/catfish. 16 M. Shao and C. Kingsford. Efficient heuristic for decomposing a flow with minimum number of paths. Presented at RECOMB-seq, 2017. doi: http://dx.doi.org//10.1101/087759. 17 A. I. Tomescu, T. Gagie, A. Popa, R. Rizzi, A. Kuosmanen, and V. Makinen. Explaining IEEE/ACM a weighted dag with few paths for solving genome-guided multi-assembly. Transactions on Computational Biology and Bioinformatics, 12(6):1345 -- 1354, 2015. 18 A. I. Tomescu, A. Kuosmanen, R. Rizzi, and V. Mäkinen. A novel min-cost flow method for estimating transcript expression with RNA-Seq. BMC bioinformatics, 14(5):S15, 2013. 19 B. Vatinlen, F. Chauvet, P. Chrétienne, and P. Mahey. Simple bounds and greedy algo- rithms for decomposing a flow into a minimal set of paths. European Journal of Operational Research, 185(3):1390 -- 1401, 2008. 18 A practical fpt algorithm for Flow Decomposition and transcript assembly A Pseudocode for k-Flow Decomposition input : An s-t -- DAG G, a flow f, and an integer k. output: A vector w that contains the weights of the s-t -- paths for a flow decomposition into k integral-weighted s-t -- paths. Or ∅ if none exist. // Order vertices via topological ordering 1 order(G) ; // Build T0 2 for i ∈ [k] do g0(i) := as; 3 4 L0 :=hPk 5 T0 := (g0, L0); i; i=1 wi = F // Do iterative steps Ti = ∅; for (g, L) ∈ Ti−1 do 6 for i=1 to n do 7 8 9 10 11 forall extensions g0 of g do L0 := L; for a ∈ A+(vi) do add equationhP i∈g0−1(a) wi = f(a)i to L0; 12 13 14 15 16 17 reduce(L0) ; if L0 is consistent then Ti = Ti ∪ {(g0, L0)}; if Ti = ∅ then return ∅; // Remove linearly dependent rows // Find L in final table that has an integer solution 18 for (g, L) ∈ Tn do 19 20 return w; if L has an integer solution w then // No solution was found 21 return ∅; Algorithm 1: Linear-fpt algorithm for deciding k-Flow Decomposition. K. Kloster, P. Kuinke, M.P. O'Brien, F. Reidl, F. Sánchez Villaamil,B. D. Sullivan, A. van der Poel 19 Experimental results organized by species B Following the experimental setup of [16], in this section we report our results on each of the species data sets individually. Figures 5 and 6 give this breakdown for the aggregated results shown in Figure 3. k 2 3 4 5 6 7 8 9 10 11 All Catfish Toboggan instances 0.995 0.992 76.6132% 0.963 17.3138% 0.962 4.3831% 0.913 0.911 0.858 1.1359% 0.855 0.3731% 0.765 0.761 0.1174% 0.700 0.696 0.727 0.0411% 0.710 0.0157% 0.700 0.643 0.0054% 0.833 0.792 0.500 0.0013% 0.500 0.983 100% 0.980 (a) zebrafish k 2 3 4 5 6 7 8 9 10 All Catfish Toboggan instances 0.995 0.992 59.4943% 0.968 23.4974% 0.966 9.6369% 0.930 0.928 0.883 4.1312% 0.880 1.8605% 0.821 0.814 0.769 0.8402% 0.776 0.3755% 0.773 0.770 0.1573% 0.751 0.746 0.742 0.0066% 0.677 k 2 3 4 5 6 7 8 9 10 Catfish Toboggan instances 0.996 0.992 55.3832% 0.973 0.970 24.8378% 0.939 11.0312% 0.937 4.9135% 0.897 0.894 0.847 2.2336% 0.846 0.9848% 0.805 0.798 0.767 0.4212% 0.766 0.748 0.734 0.1860% 0.848 0.0087% 0.761 0.969 100% (b) mouse 0.971 All 100% 0.969 (c) human 0.972 Figure 5 Proportion of ground truth pathsets of a given size that Catfish and Toboggan recover exactly, organized by species. Bolded numbers indicate the algorithm with better performance. These results are reported in aggregate in Figure 3. (a) zebrafish (b) mouse (c) human Figure 6 Distribution of Jaccard indices between the algorithms' solutions and the ground truth. The bars in the middle indicate the median value; those at the top and bottom demarcate the extreme values. Instances for which the Jaccard index is 1 are omitted because those statistics are summarized in the tables in Figure 5. These results are reported in aggregate in Figure 3.
1610.02336
5
1610
2019-03-30T12:36:40
Approximation Algorithms for Multi-Multiway Cut and Multicut Problems on Directed Graphs
[ "cs.DS", "cs.CC" ]
In this paper, we present two approximation algorithms for the directed multi-multiway cut and directed multicut problems. The so called region growing paradigm \cite{1} is modified and used for these two cut problems on directed graphs. By using this paradigm, we give for each problem an approximation algorithm such that both algorithms have the approximate factor $O(k)$ the same as the previous works done on these problems. However, the previous works need to solve $k$ linear programming, whereas our algorithms require only one linear programming. Therefore, our algorithms improve the running time of the previous algorithms.
cs.DS
cs
Approximation Algorithms for Multi-Multiway Cut and Multicut Problems on Directed Graphs Ramin Yarinezhad1, Seyed Naser Hashemi1 2∗ 1Department of Mathematics and Computer Science, Amirkabir University of Technology, Tehran, Iran Abstract In this paper, we present two approximation algorithms for the directed multi-multiway cut and directed multicut problems. The so called region growing paradigm [1] is modified and used for these two cut problems on directed graphs. By using this paradigm, we give for each problem an approximation algorithm such that both algorithms have the approximate factor O(k) the same as the previous works done on these problems. However, the previous works need to solve k linear programming, whereas our algorithms require only one linear programming. Therefore, our algorithms improve the running time of the previous algorithms. Keywords Approximation algorithm, Computational complexity, NP-hard problems, Directed multi- multiway cut, Directed multicut cut 2010 MSC: Primary: XXXXX; Secondary: XXXXX, XXXXX 2 *Corresponding Author 9 1 0 2 r a M 0 3 ] S D . s c [ 5 v 6 3 3 2 0 . 0 1 6 1 : v i X r a 1 1 Introduction In the following, we first review some of the important cut problems which serve as a back- ground for the problems considered in this paper. The undirected multiway cut problem is defined on an undirected graph G = (V, E) with a given set S = {s1, ...sk} ⊆ V of vertices called terminals and a weight function ce, e ∈ E. Here, the goal is to find the minimum weight subset of edges so that by deleting them, all terminals in S are disconnected. In other words, there is not any path between any two considered terminals. It is proved that this problem, for k ≥ 3, is NP-hard and MAX SNP-hard, for which a 2 − 2/k factor approximation algorithm is given [5]. In [6], using a geometric relaxation, an algorithm with an approximate factor of 1.5 − 1/k is introduced and it is improved to 1.3438 − ǫk in [7]. For directed graphs, the version of the directed multiway cut problem is defined. Likewise, given a set of terminals S = {s1, ...s2} ⊆ V and a weight function ce, e ∈ E, we look for a minimum weight subset of edges whose deletions disconnect all directed paths between each pair of terminals. Vazirani and Yannakakis [3] showed that a directed multiway cut problem is also NP-hard and MAX SNP-hard. They introduced an algorithm with a 2 log k approximate factor. The best known approximation algorithm, presented by Noar and Zosin [4], used a novel relaxation multiway flow to have an approximation algorithm within a factor of 2. The problem of undirected multicut is another well-known problem defined on undirected graphs with a non-negative cost ce, e ∈ E, and a set of ordered pairs of vertices, namely; (s1, t1), ..., (sk, tk), which are called source-terminal vertices. In this case, the seek is to achieve a minimum cost subset of edges so that removing them all sources become inaccessible from their corresponding terminals. For k ≥ 3 , it is shown that the problem is NP-hard and MAX SNP-hard [5]. Garg, Vazirani, and Yannakakis [1] give, by the region growing technique, an approximation algorithm with the O(log k) approximate factor. In [18] for this problem with more constraints, an approximation algorithm has been proposed with approximation factor O(rlog3/2k), where r is a part of the input instance. The directed multicut problem is defined as follows: given a directed graph G = (V, E),V = n with a non-negative function ce > 0, e ∈ E, and a set of ordered pairs of vertices (s1, t1), ..., (sk, tk), we find a subset F ⊆ E with minimum cost function so that their removal from the graph makes each pair disconnected. That is, for any i, 1 ≤ i ≤ k, there is not any directed path from si to ti in the graph G(V, E − F ). 2 Furthermore, if the desire is also to disconnect the paths from ti to si, for any i, 1 ≤ i ≤ k, we have an alternative version of the multicut problem called directed symmetric multicut problem. As shown in [3], for k ≥ 2, the directed multicut problem is NP-hard and MAX SNP-hard. In some papers it was shown that another version of this problem is NP-hard [13]. In literature, most of the works on directed multicut have been focused on the directed symmetric multicut problem [9, 10, 11, 12]. Even, Noar, Schieber and Sudan [11] presented an approximation algorithm with a factor O((log)loglogk). In general, for a non-symmetric version, using the technique of region growing, an algorithm with the approximate factor O(√nlogk) is given [14]. For the general case, Gupta [15] introduced a simpler algorithm and improved the approximate factor to O(√n). Both problems above, studied by [14, 15], use a linear programming relaxation to approximate the solution. In the work of Saks, Samorodnitsky, Zosin [17], it is shown that the integrality gap for the linear programming relaxation is O(k). A more general problem on undirected graphs is the multi-multiway cut problem in which the weight function w : E → ℜ+ and k sets S1, S2, ..., Sk are given. Here, our aim is to obtain a minimum weight subset of edges whose removal from the graph will disconnect all connections between the vertices in each set Si, for 1 ≤ i ≤ k. For K = 1, this problem is an undirected multiway cut problem, and if Si = 2, (1 ≤ i ≤ k), an undirected multicut problem is obtained. Avidor and Langberg [2] showed that the undirected multi-multiway cut problem is NP-hard and MAX SNP-hard, and by using the region growing technique they could present an approximation algorithm within the factor of O(logk). When the input graph is a tree, in [16] has been shown that this problem is solvable in polynomial time, if the number of terminal sets is fixed and in [8] has been presented an approximation algorithm with a factor O(√k). A directed version of the above problem is also defined namely as a directed multi-multiway cut problem. Similarly, for this problem a weight function w : E → ℜ+ on edges and k sets S1, S2, ..., Sk are given. We seek to find a minimum weight subset of edges whose removal from the graph will disconnect all paths between the vertices in each set Si, for 1 ≤ i ≤ k. This problem generalizes the problems of directed multiway cut and directed symmetric multicut (when k = 1 and Si = 2, respectively). Since every instance of the directed multiway cut is defined as an instance of the directed multi-multiway cut problem when k = 1, so the hardness proof for the multiway cut problem implies that the directed multi-multiway cut problem is also NP-hard and MAX SNP-hard. 3 Note that the problem of directed multi-multiway cut cannot be viewed as a generalization of the undirected multi-multiway cut problem only by replacing each undirected edge by two unparalleled directed edges. For example, consider a tree with a root r, containing three leaves a, b, c, and assuming the weight of each edge is equal to one. In this case, we get the optimal value, OP T = 2, whereas substituting each edge by two directed edges gives OP T = 3, and this proves that two problems above are not equivalent. As described above, it is clear that the problems of directed multicut and directed multi- multiway cut can be approximated by a factor O(k). But for each of these problems, we require k linear programming to be solved in order to obtain the desired approximation solution. In this paper, we show that we can achieve the same result, i.e. an approximation with the factor O(k), by solving only one linear programming. To achieve this goal, the so called paradigm of region growing, introduced in [1] for undirected cut problems, is modified so that it can be useful to produce an approximate solution of the multicut and multi-multiway cut problems on directed graphs. 1.1 Organization The rest of this paper is organized as follows: In section 2 we present a linear programming relaxation for the Directed Multi-Multiway Cut problem which is used in [2] and [3]. Section ?? contains necessary definitions and lemmas for the algorithm Directed Multi-Multiway cut which proposed in section 3. Directed Multicut Algorithm presented in section 4 and Conclusion is brought in section 5. 2 Linear Programming Relaxation for the Directed Multi-Multiway Cut We define a decision variable x(e) for each edge e which is as follows: if e belongs to directed multi-multiway cut, x(e) = 1, otherwise x(e) = 0. The purpose is to find a directed multi- multiway cut with the minimum cost which disconnects every directed path between two vertices in a group. We call that the set of all directed paths between any two vertices belongs to a group, with P . An integer program for the problem is given by: 4 minimize Xe∈E subject to Xe∈p w(e)x(e) x(e) ≥ 1, ∀p ∈ P x(e) ∈ {0, 1}, ∀e ∈ E By relaxing this IP we obtain the following linear programming relaxation: minimize Xe∈E subject to Xe∈p w(e)x(e) x(e) ≥ 1, ∀p ∈ P x(e) ≥ 0, ∀e ∈ E In this LP, there is a constraint for each path. On the other hand, we may have an exponential number of paths with respect to the input size and as a result, exponential number of constraints. Nevertheless, we can solve this LP in polynomial time, using the ellipsoid algorithm. For this LP, the separation oracle operates as follows: we get a solution x and assume that the length of each edge e is equal to x(e). Then, we find the shortest directed path between two vertices which are needed to be disconnected from each other. For example (u, v), if the shortest path between u and v (either v → u or u → v) is more than 1, then this constraint Pe∈p x(e) ≥ 1 is true for all paths between these two vertices. Therefore, this LP can be solved in polynomial time. To express the approximation algorithm for directed multi-multiway cut, we need several definitions and lemmas which are presented in the next section. To round the solution of the mentioned LP and obtain a directed multi-multiway cut, we use the region growing technique [1, 2]. Note that definitions in [1, 2] are related to undirected graphs while definitions presented here, are related to directed graphs. We define a distance on edges and assume x is an optimal solution for the LP. Let x(e) be the length of edge e. The distance between two vertices u and v (either v → u or u → v), which is defined based on x(e), is the length of the shortest path between them. We represent this shortest path with dist(u, v). If there is no directed path between two vertices u and v, the value of dist(u, v) is equal to the length of the shortest path in the graph, regardless of the direction of edges. We define: 5 Bx(sij, r) = {v ∈ V : dist(sij, v) ≤ r}, where 1 ≤ i ≤ k, 1 ≤ j ≤ Si and r ∈ R. Bx(sij, r) is an area like a ball with center sij and radius r. Assume that δ(s) is the set of all edges which only one of their endpoints is in the set s. For a given radius r, let wt(δ(Bx(sij, r))) be the sum of weights of all edges which one of their endpoints is in Bx(sij, r). wt(δ(Bx(sij, r))) is defined as follows: wt(δ(Bx(sij, r))) = Xe∈δ(Bx(sij ,r)) w(e), where w(e) is the weight of edge e. The same as [2], let ci(r) be the sum of weights of directed edges whose one head only is inside these balls, where 1 ≤ i ≤ k. ci(r) is defined as follows: ci(r) = Si Xj=1 wt(δ(Bx(sij, r))). Assume that each edge e in the graph as being a pipe with cross-sectional area w(e) and length x(e). Then, the product w(e)x(e) is equal to the volume of edge e. Thus, the solution of LP is the minimum volume of edges such that dist(u, v) ≥ 1, where u and v are in the same group, and there is a path between them (either v → u or u → v). Let x be an optimal solution for the LP, and V ∗ = Pe∈E w(e)x(e) be the volume of all edges. We know that V ∗ ≤ OP T such that OP T is the optimal value for the IP. vi(r) is defined as follows: Si vi(r) = βV ∗+ Xj=1 ( Xe=(u,v)∈E w(e)x(e) + Xe=(u,v)∈E w(e)(r − dist(sij, u))), u,v∈Bx(sij ,r) u∈Bx(sij ,r) v /∈Bx(sij ,r) where β > 0 and is independent from r. We notice that an edge may appear in ci(r) more ≤ Si. than once. That means we may have δ(Bx(sij, r)) ∩ δ(Bx(sij ′ , r)) 6= ∅, for 1 ≤ j 6= j Thus, ci(r) is an upper bound on the cut. According to these definitions, we can express the ′ 6 Lemma 1, which is used in the proof of Lemma 2. Lemma 1: The function vi(r) is differentiable in (0,∞) except some finite number of points. The derivative of this function is ci(r). Proof: The function vi(r) is not differentiable in points which the value of function Bx(sij, r) changes. The function Bx(sij, r), changes for the values of r in which there is a vertex v such that dist(sij, r) = r. Thus the number of points in which the function vi(r) is not differentiable, is finite. Beside this, according to the definition done for the function vi(r), the derivative of this function is ci(r). (cid:4) Lemma 2 says in directed graphs, we can always find a radius r < 1 2 , such that the cost vi(r) is an upper bound for ci(r). Lemma 2: Let x be a feasible solution for the LP, for every sij there is a r < 1 2 and at least an α (α > 0) such that the following inequality is true: ci(r) ≤ αvi(r). The proof of this lemma is given in the Section 4.1. We first present the algorithm using this lemma. 3 Approximation Algorithm for Directed Multi-Multiway Cut Our polynomial time approximation algorithm for directed multi-multiway cut is described in Algorithm 1. The algorithm solves the LP first and finds the optimal solution x. Then, the algorithm enters to a repetition loop and till there exists a path between two vertices in a group, the algorithm works as follows: assume that the set Si is chosen in this iteration. In the beginning, it finds an r which satisfies the inequality of Lemma 2, and then it finds the set of balls with the center of vertices inside the Si with the radius of r. Then it puts the edges, which have been cut by these balls, in the answer set F . Now the algorithm checks whether there are two vertices from another group which are connected by a path and are in the same ball. If there are such vertices, only the vertex in the center of each ball and its incident edges will be deleted from the graph. Otherwise, all of the vertices in balls and incident edges with them will be deleted from the graph. 7 Algorithm 1 Approximation Algorithm for Directed Multi-Multiway Cut Result: A Directed Multi-Multiway Cut F ← ∅ Solve the LP and get the optimal solution x while there is a path between sij ∈ Si and sij ′ ∈ Si, where 1 ≤ i ≤ k and 1 ≤ j 6= j do ′ ≤ Si j=1 δ(Bx(sij, ri)) to F Find ri such that ci(ri) ≤ αvi(ri) Add SSi if SSi j=1 Bx(sij, ri) contains two vertices u, v such that u, v ∈ Bx(sij, ri), where 1 ≤ j ≤ Si AND u, v ∈ Sm, where 1 ≤ m ≤ k and m 6= i AND there is a path between u and v then Remove sij, where 1 ≤ j ≤ Si, and incident edges with it form the graph else Remove SSi j=1 Bx(sij, ri) and incident edges with it form the graph end ∀l ∈ {1, ..., k}, Sl ← Sl ∩ V end Return F Lemma 3: Algorithm 1 returns a Directed Multi-Multiway Cut. Proof: For each ball like Bx(sij, r), where 1 ≤ i ≤ k, 1 ≤ j ≤ Si, there is no vertex with 2 . The the same group with sij in Bx(sij, r) because the radius of each ball is smaller than 1 only case may lead to problems is that there are two vertices u and v in one ball, which are the members of another group and there is a path between them. In this case, only the central vertices and their incident edges will be deleted from the graph. Therefore, the path between the two vertices u and v will not be deleted from the graph. In the next iterations, at least one of the edges of the path between u and v will be put in the answer set. (cid:4) Theorem 1: Algorithm 1 is a (α(1 + β)k)-approximation algorithm for Directed Multi- Multiway Cut. 8 Proof: According to Lemma 2, we have ci(r) ≤ αvi(r), for every 1 ≤ i ≤ k. Thus, Pk i=1 ci(r) ≤ αPk i=1 vi(r). Besides, according to the definition of vi(r) and algorithm, we have Pk i=1 vi(r) ≤ (kV ∗ + kβV ∗) .Thus: F ≤ Xe∈F w(e) = k Xi=1 ci(r) ≤ α k Xi=1 vi(r) ≤ α(1 + β)kV ∗ ≤ α(1 + β)kOP T. (cid:4) The proof of Lemma 2: We use the contradiction method. Assume that for every value of r < 1 2 and every α (α > 0) we have ci(r) > αvi(r). Thus we have: ci(r) > αvi(r) 1 2 Z 0 ci(r) vi(r) dr > αZ 0 1 2 dr According to Lemma 1, the function vi(r) is not differentiable at only a finite number of point. We call these points r0 = 0 ≤ r1 ≤ ... ≤ rl ≤ rl+1 = 1 2 . Thus we have: 1 2 Z 0 1 vi(r) ( dvi(r) dr )dr = Z rj+1 1 vi(r) ( dvi(r) dr )dr 1 Xj=0 ≤ lnvi( rj 1− 2 ) − lnvi(0). Since vi(r) is an increasing function, we have ≤ lnvi( 1 2 ) − lnvi(0), as well vi(0) = βV ∗ as vi( 1 2 ) ≤ βV ∗ + V ∗. Thus, we have: 9 ln( βV ∗ + V ∗ βV ∗ ln( β + 1 β ) ≥ ln( α 2 ) > . vi( 1 2 ) vi(0) ) > α 2 (*) In order to reach a contradiction, we have to choose values for α and β such that the inequality (*) will not be true. On the other hand, the approximation factor of the algorithm is dependent on these two parameters directly. So we have to choose the appropriate value for α and β. Indeed, to find the best value for α and β, we should solve the following nonlinear program: minimize α(1 + β) subject to ln( β + 1 β α 2 ) ≤ α, β > 0. We have solved this nonlinear program using Matlab software and found the optimal value of α and β. These values are as follows α = 0.1 and β = 20.504. If we put these values in the inequality (*), the contradiction is reached and Lemma 2 is proved. Using these values for α and β, the algorithm is an approximation algorithm with factor (2.1504)k for the Directed Multi-Multiway cut problem. (cid:4) 4 Approximation Algorithm for Directed Multicut Similar to the LP presented in the previous section can be provided an LP for the Directed Multicut problem. We define a decision variable x(e) for each edge e which is as follows. If e belongs to the directed multicut, x(e) = 1, Otherwise x(e) = 0. The purpose is to find a directed multicut with the minimum weight which cuts each directed path from si to ti for 1 ≤ i ≤ k. We represent the set of all directed paths from si to ti for 1 ≤ i ≤ k with P . An linear programming for the problem is as follows: 10 minimize Xe∈E subject to Xe∈p w(e)x(e) x(e) ≥ 1, ∀p ∈ P x(e) ≥ 0, ∀e ∈ E. In this LP, there is a constraint for each path. On the other hand, we may have an exponential number of paths with respect to the input size and as a result, an exponential number of constraints. Nevertheless, we can solve this LP in polynomial time, using the ellipsoid algorithm. For this LP, the separation oracle operates as follows: we get a solution x and assume that the length of each edge e is equal to x(e). Then, we find the shortest directed path from si to ti, for 1 ≤ i ≤ k. If the shortest path from si to ti, is more than 1, then the constraint Pe∈p x(e) ≥ 1 is true for all paths from si to ti. So this LP can be solved in polynomial time. We provide a direct version of definitions like those used in region growth technique in [1]. We define a distance on edges, assume that x is an optimal solution for LP, let x(e) be the length of edge e. We show the shortest path from u to v, which is based on x(e), with dist(u, v). If there is not any directed path from u to v, the value of dist(u, v) is the shortest path between u and v in the graph, without noticing the direction of edges. Now we define: Bx(si, r) = {v ∈ V : dist(si, v) ≤ r}. Bx(si, r) is an area like a ball with center si, where 1 ≤ i ≤ k, and radius r ∈ R. Assume that the product of w(e)x(e) is equal to the volume of edge e. Thus, the solution of the LP is the minimum volume of edges such that dist(si, ti) ≥ 1, for 1 ≤ i ≤ k. Assume that x is an optimal solution for the LP. Let V ∗ = Pe∈E w(e)x(e) be the volume of all edges, indeed V ∗ is the optimal value of LP. We know that V ∗ ≤ OP T such that OP T is the optimal value for the IP. vx(si, r) is defined as follows: vx(si, r) = βV ∗+ Xe=(u,v)∈E w(e)x(e) + Xe=(u,v)∈E w(e)(r − dist(si, u)). u,v∈Bx(si,r) u∈Bx(si,r) v /∈Bx(si,r) 11 Let δ(s) be the set of all edges which only one of their endpoints is in the set s. For a given radius r, we define: wt(δ(Bx(si, r))) = Xe∈δ(Bx(si,r)) w(e). According to these definitions, we can express Lemma 4, which is used in the proof of Lemma 5. Lemma 4: The function vx(si, r) is differentiable in (0,∞) except some finite numbers of points. The derivative of this function is wt(δ(Bx(si, r))). Lemma 5 demonstrates that in directed graphs, we can always find a radius r < 1 2 , such that the cost vx(si, r) is an upper bound for wt(δ(Bx(si, r))). Lemma 5: Assume that x is a feasible solution for LP. For every si there is a r < 1 2 and at least an α (α > 0) such that the following inequality is true: wt(δ(Bx(si, r))) ≤ αvx(si, r). The proof of Lemma 4 and Lemma 5 is similar to the proof of Lemma 1 and Lemma 2, respectively. In the rest of the paper, for simplicity we assume that wt(r) = wt(δ(Bx(si, r))) and v(r) = vx(si, r). Our polynomial time approximation algorithm for directed multicut is described in Algo- rithm 2. The algorithm first solves the LP and finds the optimal solution x. In every iteration, the algorithm finds a pair which there is a path between and finds an area with a radius that satisfies the condition in Lemma 5. Then, the algorithm puts the edges, which have been cut by the area, in set F . If the area includes another pair (sj, tj), and there is a path from sj to tj, then the algorithm removes only the central vertex of the area. Therefore, we can cut the path between sj and tj in the next iterations. 12 Algorithm 2 Approximation Algorithm for Directed Multicut Result: A Directed Multicut F ← ∅ Solve the LP and get an optimal solution x while there is a path between si to ti, where 1 ≤ i ≤ k do Grow a region S = Bx(si, r) until wt(r) ≤ αv(r) Add δ(S) to F if S contains a pair (sj, tj), where 1 ≤ j ≤ k and i 6= j AND there is a path form sj to tj then Remove si and incident edges with si form the graph else Remove S and δ(S) form the graph end end Return F Lemma 6: Algorithm 2 returns a directed multicut. Proof: Consider the ball Bx(si, r). The center of this ball is si. Vertex ti cannot be in this ball because the radius of the ball is less than 1 2 ). Beside this, according to the LP constraint, we know that the distance between every pair (si, ti), where 1 ≤ i ≤ k, should be more than 1. The only case may lead to problems is that there is a pair (sj, tj), where 2 (r < 1 1 ≤ j ≤ k and i 6= j, in Bx(si, r) such that there is a path from sj to tj. In this case, the algorithm only removes the central vertex si from the graph, thus the pair (sj, tj) and also the path between these vertices are still in the graph. In the rest of iterations, the algorithm will make them disconnected. (cid:4) Theorem 2: Algorithm 2 is an O(k)-approximation algorithm for the Directed Multicut problem. Proof: We demonstrate the set of vertices in the ball Bx(si, r) with Bi. We assume that Bi = ∅ when no ball is selected for vertex si. We also demonstrate the set of cut edges for Bi 13 with Fi. It means Fi is equal to δ(Bi). Thus, we have F = Sk i=1 Fi. Assume that Vi is equal to the volume of all edges which are in the ball Bi and also the volume of edges which have one head in Bi. According to this definition, we have Vi ≥ vx(si, r) − βV ∗ because Vi includes the volume of all edges in Fi. But vx(si, r) is contained only some part of these edges and an addition value βV ∗. According to Lemma 5 and the value chosen for r in the algorithm, we have wt(Fi) ≤ αvx(si, r) ≤ α(Vi + βV ∗). We know that the algorithm may not remove the edges which are incident with vertices in Bi in this iteration. Thus, an edge may belong to i=1 Vi ≤ kV ∗. more than one area, on the other hand, there are at most k areas. Therefore, Pk So we have the following inequalities: w(e) = Xe∈F k Xi=1 wt(Fi) ≤ α k Xi=1 (Vi + βV ∗) ≤ α(1 + β)kV ∗ ≤ α(1 + β)kOP T. (cid:4) Similar to section 3, the optimal value for α is 0.1 and β is 20.504. So Algorithm 2 is an (2.1504)k-approximation algorithm for the Directed Multicut problem. 5 Conclusions In this paper, we design approximation algorithms for the directed multi-multiway cut and directed multicut problems using the region growing technique [1, 2]. By this paradigm, we give for each problem an O(k)-approximation algorithm. The works previously done on these problems need to solve k linear programs, whereas our algorithms require only one linear programming. Both algorithms use the same linear programming relaxation. A question of interest is to find the integrality gap of the linear programming relaxation for these problems. References [1] Garg, N., Vazirani, V. V., Yannakakis, M. (1996). Approximate max-flow min-(multi) cut theorems and their applications. SIAM Journal on Computing, 25(2), 235-251. [2] Avidor, A., Langberg, M. (2007). The multi-multiway cut problem. Theoretical Computer Science, 377(1-3), 35-42. 14 [3] Garg, N., Vazirani, V. V., Yannakakis, M. (1994, July). Multiway cuts in directed and node weighted graphs. In International Colloquium on Automata, Languages, and Programming (pp. 487-498). Springer, Berlin, Heidelberg. [4] Naor, J., Zosin, L. (2001). A 2-approximation algorithm for the directed multiway cut problem. SIAM Journal on Computing, 31(2), 477-482. [5] Dahlhaus, E., Johnson, D. S., Papadimitriou, C. H., Seymour, P. D., Yannakakis, M. (1992, July). The complexity of multiway cuts. In Proceedings of the twenty-fourth annual ACM symposium on Theory of computing (pp. 241-251). ACM. [6] Clinescu, G., Karloff, H., Rabani, Y. (1998, May). An improved approximation algorithm for multiway cut. In Proceedings of the thirtieth annual ACM symposium on Theory of computing (pp. 48-52). ACM. [7] Karger, D. R., Klein, P., Stein, C., Thorup, M., Young, N. E. (2004). Rounding algorithms for a geometric embedding of minimum multiway cut. Mathematics of Operations Research, 29(3), 436-461. [8] Zhang, P., Zhu, D., Luan, J. (2012). An approximation algorithm for the Generalized k-Multicut problem. Discrete Applied Mathematics, 160(7-8), 1240-1247. [9] Even, G., Naor, J. S., Rao, S., Schieber, B. (2000). Divide-and-conquer approximation algorithms via spreading metrics. Journal of the ACM (JACM), 47(4), 585-616. [10] Leighton, T., Rao, S. (1988, October). An approximate max-flow min-cut theorem for uniform multicommodity flow problems with applications to approximation algorithms. In Foundations of Computer Science, 1988., 29th Annual Symposium on (pp. 422-431). IEEE. [11] Even, G., Naor, J. S., Schieber, B., Sudan, M. (1998). Approximating minimum feedback sets and multicuts in directed graphs. Algorithmica, 20(2), 151-174. [12] Klein, P. N., Plotkin, S. A., Rao, S., Tardos, E. (1997). Approximation algorithms for Steiner and directed multicuts. Journal of Algorithms, 22(2), 241-269. [13] Bang-Jensen, J., Yeo, A. (2014). The complexity of multicut and mixed multicut problems in (di) graphs. Theoretical Computer Science, 520, 87-96. 15 [14] Cheriyan, J., Karloff, H., Rabani, Y. (2005). Approximating directed multicuts. Combi- natorica, 25(3), 251-269. [15] Gupta, A. (2003). Improved approximation algorithm for directed multicut. In Proceed- ings of the Fourteenth Annual ACMSIAM Symposium on Discrete Algorithms (SODA) (pp. 12-14). [16] Kanj, I., Lin, G., Liu, T., Tong, W., Xia, G., Xu, J., ... Zhu, B. (2015). Improved param- eterized and exact algorithms for cut problems on trees. Theoretical Computer Science, 607, 455-470. [17] Saks, M., Samorodnitsky, A., Zosin, L. (2004). A lower bound on the integrality gap for minimum multicut in directed networks. Combinatorica, 24(3), 525-530. [18] Chuzhoy, J., Makarychev, Y., Vijayaraghavan, A., Zhou, Y. (2016). Approximation algo- rithms and hardness of the k-route cut problem. ACM Transactions on Algorithms (TALG), 12(1), 2. 16
1204.5229
2
1204
2012-08-28T20:17:11
Selection in the Presence of Memory Faults, with Applications to In-place Resilient Sorting
[ "cs.DS" ]
The selection problem, where one wishes to locate the $k^{th}$ smallest element in an unsorted array of size $n$, is one of the basic problems studied in computer science. The main focus of this work is designing algorithms for solving the selection problem in the presence of memory faults. These can happen as the result of cosmic rays, alpha particles, or hardware failures. Specifically, the computational model assumed here is a faulty variant of the RAM model (abbreviated as FRAM), which was introduced by Finocchi and Italiano. In this model, the content of memory cells might get corrupted adversarially during the execution, and the algorithm is given an upper bound $\delta$ on the number of corruptions that may occur. The main contribution of this work is a deterministic resilient selection algorithm with optimal O(n) worst-case running time. Interestingly, the running time does not depend on the number of faults, and the algorithm does not need to know $\delta$. The aforementioned resilient selection algorithm can be used to improve the complexity bounds for resilient $k$-d trees developed by Gieseke, Moruz and Vahrenhold. Specifically, the time complexity for constructing a $k$-d tree is improved from $O(n\log^2 n + \delta^2)$ to $O(n \log n)$. Besides the deterministic algorithm, a randomized resilient selection algorithm is developed, which is simpler than the deterministic one, and has $O(n + \alpha)$ expected time complexity and O(1) space complexity (i.e., is in-place). This algorithm is used to develop the first resilient sorting algorithm that is in-place and achieves optimal $O(n\log n + \alpha\delta)$ expected running time.
cs.DS
cs
Selection in the Presence of Memory Faults, with Applications to In-place Resilient Sorting Tsvi Kopelowitz and Nimrod Talmon Weizmann Institute of Science, Rehovot, Israel. {kopelot,nimrodtalmon77}@gmail.com Abstract. The selection problem, where one wishes to locate the kth smallest element in an unsorted array of size n, is one of the basic prob- lems studied in computer science. The main focus of this work is de- signing algorithms for solving the selection problem in the presence of memory faults. These can happen as the result of cosmic rays, alpha particles, or hardware failures. Specifically, the computational model assumed here is a faulty variant of the RAM model (abbreviated as FRAM ), which was introduced by Finocchi and Italiano [FI04]. In this model, the content of memory cells might get corrupted adversarially during the execution, and the algo- rithm cannot distinguish between corrupted cells and uncorrupted cells. The model assumes a constant number of reliable memory cells that never become corrupted, and an upper bound δ on the number of corruptions that may occur, which is given as an auxiliary input to the algorithm. An output element is correct if it has rank between k − α and k + α in the input array, where α is the number of corruptions that occurred during the execution of the algorithm. An algorithm is called resilient if it always outputs a correct answer. The main contribution of this work is a deterministic resilient selection algorithm with optimal O(n) worst-case running time. Interestingly, the running time does not depend on the number of faults, and the algorithm does not need to know δ. As part of the solution, several techniques that allow to sometimes use non-tail recursion algorithms in the FRAM model are developed. Notice that using recursive algorithms in this model is problematic, as the stack might be too large to fit in reliable memory. The aforementioned resilient selection algorithm can be used to im- prove the complexity bounds for resilient k-d trees developed by Gieseke, Moruz and Vahrenhold [GMV10]. Specifically, the time complexity for constructing a k-d tree is improved from O(n log2 n + δ2) to O(n log n). Besides the deterministic algorithm, a randomized resilient selection al- gorithm is developed, which is simpler than the deterministic one, and has O(n + α) expected time complexity and O(1) space complexity (i.e., is in-place). This algorithm is used to develop the first resilient sorting algorithm that is in-place and achieves optimal O(n log n + αδ) expected running time. 1 Introduction Computing devices are becoming smaller and faster. As a result, the likelihood of soft memory errors (which are not caused by permanent failures) is increased. In fact, a recent practical survey [Sem04] concludes that a few thousands of soft errors per billion hours per megabit is fairly typical, which would imply roughly one soft error every five hours on a modern PC with 24 gigabytes of memory [CDK11]. The causes of these soft errors vary and include cosmic rays [Bau05], alpha particles [MW79], or hardware failures [LHSC10]. 1.1 The Faulty RAM Model and [FI04], and has some Italiano received To deal with these faults, the faulty RAM (FRAM) model has been proposed by Finocchi attention [BFF+07,BJM09,BJMM09,CFFS11,FGI09a,FGI09b,GMV10,JMM07]. In this model, an upper bound on the number of corruptions is given to the algorithm, and is denoted by δ, while the actual number of faults is denoted by α (α ≤ δ). Memory cells may become corrupted at any time during an algo- rithm's execution and the algorithm cannot distinguish between corrupted cells and uncorrupted cells. The same memory cell may become corrupted multiple times during a single execution of an algorithm. In addition, the model assumes the existence of O(1) reliable memory cells, which are needed, for example, to reliably store the code itself. A cell is assumed to contain Θ(log n) bits, where n is the size of the input, as is usual in the RAM model. One of the interesting aspects of developing algorithms in the FRAM model is that the notion of correctness is not always clear. Usually, correctness is defined with respect to the subset of uncorrupted memory cells and in a worst-case sense, implying that for an algorithm to be correct, it must be correct in the presence of any faulty environment, including an adversarial environment. For example, in the sorting problem the goal is to order the input elements such that the uncorrupted subset of the array is guaranteed to be sorted [FI04]. In the FRAM model, an algorithm that is always correct (which is problem dependent) is called resilient. A naive way of implementing a resilient algorithm is by storing 2δ + 1 copies of every piece of data. Writing is done by writing the same value to all copies, and reading is done by computing the majority of the copies. Using this tech- nique, most if not all1 non-resilient algorithms can be made resilient with O(δ) multiplicative overhead in time and space complexity. 1.2 Previous Work A summary of the algorithms and data structures that have been developed in the FRAM model is given next. 1 The reason this might not be true is because it could depend on the correctness of the problem under the FRAM model. For example, the goal of finding the exact k-order statistics is not achievable in this model, as is explained in Section 2. 2 Resilient Searching: Finocchi and Italiano [FI04] and Finocchi, Grandoni and Italiano [FGI09a], developed an almost optimal resilient searching algorithm, which finds an element in a sorted array of size n in O(log n + δ1+ǫ), where uncorrupted elements are guaranteed to be found. The main idea is to perform a slow reliable verification step once in every O(δ) fast but unreliable binary search steps. A somewhat natural lower bound of O(log n + δ) was proven there as well. A matching upper bound was developed by Brodal, Fagerberg, Finocchi, Grandoni, Italiano, Jørgensen, Moruz and Mølhave [BFF+07], using a different method. Resilient Dictionaries: The dynamic counterpart of searching is the dictionary data structure. An optimal resilient dictionary, supporting updates (insertions and deletions) and queries (searches) in O(log n + δ) amortized time per oper- ation, was developed by Brodal et al. [BFF+07]. Again, uncorrupted elements are guaranteed to be found. Resilient Sorting: Finocchi et al. [FI04,FGI09a], developed a resilient sorting algorithm, sorting an array of size n in O(n log n + αδ) time. The uncorrupted subset of the array is guaranteed to be sorted. The algorithm is an iterative version of Mergesort, with a resilient merging step. A matching (and somewhat surprising) lower bound was proven there as well. Resilient Priority Queues: Another basic data structure, a resilient priority queue, was developed by Jørgensen, Moruz and Mølhave [JMM07]. The data structure supports insert and deletemin in O(log n + δ) amortized time, where the deletemin operation returns either the minimum element among the uncor- rupted elements, or a corrupted element. A matching lower bound was given there as well. Brodal, Grønlund, Counters: Resilient and Mølhave [BJMM09], developed several resilient counters, supporting increments and queries, where the result of a query is an α-additive approximation to the number of increments performed until the query. While the proven lower bound of Ω(δ) space and time is not achieved, several interesting tradeoffs are presented there. Jørgensen, Moruz Dynamic Programming: Caminiti, Finocchi and Fusco [CFF11] and Caminiti, Finocchi, Fusco and Silvestri [CFFS11], developed a resilient and cache-oblivious dynamic programming meta algorithm, computing the correct answer with high probability, using O(nd + δd+1) and O(nd + nδ) space, where d is the dimension of the table of the dynamic programming. Resilient External Memory Algorithms: The problem of designing algorithms that are simultaneously cache efficient and resilient was addressed by Brodal, Jørgensen, Grønlund and Mølhave [BJM09]. They showed matching upper bounds and lower bounds for a deterministic and randomized dictionary, a de- terministic priority queue, and a deterministic sorting algorithm. 3 k-d Trees: The problem of k-means clustering in the presence of memory faults was addressed by Gieseke et al. [GMV10]. They developed a resilient k-d tree, supporting orthogonal range queries in O(√nδ + t) where t is the is the size of the output. 1.3 Results Deterministic Resilient Selection Algorithm: The main focus of this work is on the selection problem (sometimes called the k-order statistic problem) in the FRAM model, where one wishes to locate the kth smallest element in an unsorted array of size n, in the presence of memory faults. The following main theorem is proved in Section 4. Theorem 1. There exists a deterministic resilient selection algorithm with time complexity O(n). Interestingly, the running time does not depend on the number of faults. Moreover, the algorithm does not need to know δ explicitly. The selection prob- lem is a classic problem in computer science. Along with searching and sorting, it is one of the basic problems studied in the field, taught already at undergrad- uate level (e.g., [CLRS09]). The k-order statistic of a set of samples is a basic concept in statistics as well (e.g., [ABN93]). There are numerous applications for the selection problem, thus devising efficient algorithms is of practical interest. The textbook algorithm by Blum, Floyd, Pratt, Rivest and Tarjan [BFP+73] achieves linear time complexity in the (non-faulty) RAM model. When considering the selection problem in the FRAM model, the first diffi- culty is to define correctness2. To this end, the correctness definition used here allows to return an element, which may even be corrupted, whose rank is be- tween k − α to k + α in the input array. Notice that when α = 0 this definition coincides with the non-faulty definition (for a formal definition see Section 2). Randomized Resilient Selection Algorithm: Besides the deterministic algorithm, a randomized and in-place counterpart is developed as well. A randomized al- gorithm in the FRAM model is an algorithm that can use random coins. The faults are still adversarial, but the adversary cannot see the random coins of the algorithm, and the algorithm must be correct with probability 1, regardless of the coin tosses. The randomized selection algorithm is simpler than to the deterministic one, and is likely to beat the deterministic algorithm in practice. The following theorem is proven in Section 3. Theorem 2. There exists a randomized in-place resilient selection algorithm with expected time complexity O(n + α). 2 The common notion of considering only the non-corrupted elements is somewhat misleading in the selection problem. This is because of the difficulty of not being able to distinguish between corrupted and uncorrupted data. 4 Resilient k-d Trees: The selection algorithm presented here can be used to im- prove the complexity bounds for resilient k-d trees developed by Gieseke et al. [GMV10]. There, a deterministic resilient algorithm for constructing a k-d tree with O(n log2 n + δ2) time complexity is shown. This can be improved to O(n log n) by using the deterministic resilient selection algorithm developed here. Theorem 3. There exists a resilient k-d tree which can be constructed in de- terministic O(n log n) time. It supports resilient orthogonal range queries in O(√nδ + t) time for reporting t points. Resilient Quicksort Algorithms: The problem of sorting in the FRAM model is also revisited, as an application of the resilient selection algorithm. Finocchi et al. [FGI09a], already developed a resilient Mergesort algorithm, sorting an array of size n in O(n log n + αδ) time, where the uncorrupted subset of the array is guaranteed to be sorted. They also proved that this bound is tight. In Section 7, a new in-place randomized sorting algorithm which resembles Quicksort and runs in O(n log n + αδ) expected time is presented. This sorting algorithm uses the randomized selection algorithm as a black box. The following theorem is proven in Section 7. Theorem 4. There exists a resilient deterministic sorting algorithm with worst- case running time of O(n log n + αδ), and a resilient randomized in-place sorting algorithm with expected running time of O(n log n + αδ). 1.4 Recursion In the (non-faulty) RAM model the recursion stack needs to reliably store the lo- cal variables, as well as the frame pointer and the program counter. Corruptions of this data can cause the algorithm to behave unexpectedly, and in general the recursion stack cannot fit in reliable memory. Some new techniques for imple- menting a specific recursion stack which suffices for solving the selection problem are developed in Section 5. These techniques are used to develop the resilient deterministic selection algorithm presented in Section 4. It is likely that these techniques can be used to help implement recursive algorithms for other prob- lems in the FRAM model. The main technique developed here which allows to use non-tail recursion in the FRAM model is somewhat general, and can be used due to the following four points: 1. Easily Inverted Size Function: When performing a recursive call, the function which determines the size of the input to the recursive call can be easily in- verted, while needing only O(1) bits to maintain the data needed to perform the inversion. 2. Small Depth: The depth of the recursion is bounded by O(log n) and so using O(1) bits per level can fit in reliable memory. 3. Verification: A linear verification procedure is used such that once a recursive call finishes, if the procedure accepts, then the algorithm may proceed even if some errors did occur in the recursive call. The main point here is that even though errors occurred, continuing onwards does not hurt the correctness. 5 4. Amortization: If the verification procedure fails, then the number of errors which caused the failure is linear in the amount of time spent on the recursive call (not counting other verification procedures that failed within it). This means that the amortized cost of each corruption is O(1). The only previous work done in the FRAM model for non-tail recursion was done by Caminiti et al. [CFFS11] where they developed a recursive algorithm for solving dynamic programming. However, the recursion inherited in the problem of dynamic programming is simpler compared to the recursion treated in the selection problem, due to the structural behavior of the dynamic programming table (the recursions depend on positioning within the table, and not on the actual data). Moreover, their solution only works with high probability (due to using fingerprints for the verification procedure). 1.5 Related Work Other models and techniques to deal with memory corruptions do exist. Some of them are given here, with an emphasis on their relation to the FRAM model. Error Correcting Codes: The field of error correcting codes and error detecting codes deals with the problem of reliably transmitting a message over a faulty communication channel. This is achieved by adding redundancy to the message (e.g., checksums). For a survey, see, e.g., [PW72]. The solutions developed in this field do not treat the implications of corruptions to the computation performed on the data. Therefore, applying these methods to the FRAM model in a non- naive way is not trivial. Error Correcting Memory: Error detecting and correcting codes can be imple- mented in the hardware itself (e.g., [CH84]). While this solution has its advan- tages, it imposes some costs in performance and money. Pointer-Based Data Structures: Aumann and Bender [AB96] addressed the prob- lem of losing data in a pointer-based data structures due to pointer corruptions. The data structures suggested by them incur only a small overhead in space and time, and guarantee an upper bound on the amount of uncorrupted data that can be lost due to pointer corruptions. This is in contrast to the FRAM model, where no uncorrupted data is allowed to be lost. Fault-Tolerant Parallel and Distributed Computation: Extensive research on fault tolerance have been done in the field of parallel and distributed computa- tion. For a survey, see [G99]. The work done in this field deals with resiliency with respect to faulty processors or communication links, in contrast to the faulty memory which is assumed in the FRAM model. Some of the work assume the ex- istence of fault detection hardware, therefore allowing the system to distinguish between faulty and non-faulty data, differently from the FRAM model. 6 Checkers: Blum, Evans, Gemmell, Kannan and Naor [BEG+94] addressed the problem of checking memory correctness in the presence of faults. In this model, the data structure is viewed as being controlled by an adversary. The goal of the checker, which is allowed to use a small amount of reliable memory, is to detect every deviation from the expected data, with high probability. In the FRAM model, the goal is not to detect the memory corruptions, but instead, to always behave correctly on the uncorrupted subset of the data. Fault-Tolerant Sorting Networks: Fault tolerance have been investigated in the context of sorting networks. Assaf and Upfal [AU91] developed a resilient sorting network, with an O(log n) multiplicative overhead in the size of the network. The computational model is a sorting network and not a general purpose machine, as in the FRAM model. The Liar Model: In this model, the algorithm can access the data only through a noisy oracle. The algorithm queries the oracle and can possibly get a faulty answer (i.e., a lie). An upper bound on the number of these lies or a probability of a lie is assumed. See, e.g., [FRPU94] and [DGW92]. The data itself cannot get corrupted, therefore, in this model, query replication strategies can be exploited, in contrast to the FRAM model. Other Noisy Computational Model: Several other noisy computational models have been investigated. Sherstov [She12], showed an optimal (in terms of degree) approximation polynomial that is robust to noise. Gacs and Gal [G´al91], proved a lower bound on the number of gates in a noise resistant circuit. These works, as well as others, have more computational complexity theory flavour than the FRAM model, and treat different computational models from the FRAM model. 1.6 Organization The paper is organized as follows. In Section 2 some definitions and preliminaries are given. In Section 3 the randomized selection algorithm is discussed, followed by a discussion of the deterministic selection algorithm, in Section 4. The dis- cussion of the stack and recursion implementation is treated independently and deferred to Section 5. A discussion on the application of the resilient selection algorithm to resilient k-d trees is in Section 6. Finally, the in-place quicksort sorting algorithm is shown in Section 7. 2 Preliminaries 2.1 Definitions Let X be an array of size n of elements taken from a totally ordered set. Let X 0 denote the state of X at the beginning of the execution of an algorithm A executed on X. Let α ≤ δ be the number of corruptions that occurred during such execution. 7 Definition 1. Let X be an array and let e be an element. The rank of e in X is defined as rankX (e) = {i : X[i] ≤ e}. The α-rank of k in X is defined as α-rankX (k) = {e : rankX (e) ∈ [k − α, k + α]}. Notice that the α-rank of k in X is an interval containing the elements whose rank in X is not smaller than k − α and not larger than k + α. In particular, if α ≥ n, this interval is equal to [−∞,∞]. Moreover, if α = 0, then this interval is equal to the k-order statistic, thus coincides with the non-faulty definition. Definition 2. A resilient k-selection algorithm is an algorithm that is given an array X of size n and an integer k, and returns an element e ∈ α-rankX 0(k), where α ≤ δ is the number of faults that occurred during the execution of the algorithm. Notice that if α = 0, then this definition coincides with the common non- faulty definition. That is, if no faults occur during an execution of a resilient selection algorithm, it should locate the exact k-order statistic. Moreover, if α > 0, no algorithm can return the exact k-order statistics, due to corruptions that can happen at the beginning of the execution. Notice also that because the algorithm cannot distinguish between corrupted and uncorrupted memory cells, it may return an element which was not present in the array at the beginning of the execution. 2.2 Basic Procedures Lemma 1. There exists a resilient ranking procedure with time complexity O(n), that is given an array X of size n and an element e, and returns an integer k such that e ∈ α-rankX 0(k). Proof. A resilient ranking procedure can be implemented by scanning X while counting the number of elements smaller or equal to e, denoted by k. If α = 0, then k = rankX (e). If α > 0, then e ∈ α-rankX 0 (k), because each corrup- tion can change at most one memory cell, changing the rank of e in X by at most 1. Lemma 2. There exists a resilient partition procedure with time complexity O(n) and space complexity O(1), that is given an array X of size n and an ele- ment e, and reorders X such that the uncorrupted elements smaller (larger) than e are placed before (after) e, and returns an element k such that e ∈ α-rankX 0(k). Proof. A resilient partition procedure can be implemented by scanning X while counting the number of elements smaller or equal to e, denoted by k, such that whenever an element smaller than e is encountered it is swapped with the element at position k + 1. Notice that both procedures compute an integer k such that e ∈ α-rankX 0(k). X (e) denote the value k computed by either procedure, such that when- X (e) will be used, it will be understood from the context Let rankc ever the notation rankc which procedure is used. Notice that if α = 0, then rankc X (e) = rankX (e). 8 3 Randomized Resilient Selection Algorithm As a starter, consider the following randomized resilient selection algorithm, de- noted by Randomized-Select. The algorithm is an adaptation of the randomized non-resilient selection algorithm by Hoare [Hoa61], with the following modifica- tion. The algorithm maintains an interval [lb, ub], where lb (ub) is a lower (upper) bound. When the algorithm queries the array X at index i, the value x is chosen to be x = min(max(X[i], lb), ub). This guarantees that even a faulty value is within the bounds. All variables (i.e., l, r, lb, ub, xp, p, k) are stored using reliable memory cells. Algorithm 1: Randomized-Select(X, k) 1 l ← 1, r ← n, lb ← −∞, ub ← ∞ 2 repeat 3 4 5 6 7 8 9 10 11 12 xp ← random element from X[l, r] xp ← min(max(xp, lb), ub) partition X around xp # using the algorithm from Lemma 2 # Let p denote rankc X (xp) if p = k then return xp else if p > k then else if p < k then r ← p − 1, ub ← xp k ← k − p, l ← p + 1, lb ← xp Theorem 5. There exists a randomized in-place resilient selection algorithm with expected time complexity O(n + α). Proof. Correctness is proven by induction on the size of the array. The base case of size 1 is obvious. For the induction step, assume that for arrays of size smaller than n the algorithm returns an element e ∈ α-rankX 0 (k). Consider an execution of the algorithm on an array of size n. Let α1 denote the number of corruptions that occurred during the first iteration, and let α′ denote the number of corruptions that occurred during the rest of the execution (α = α1 + α′). During the first iteration of the algorithm, if p = k, then e = xp is returned and correctness follows from the definition of the resilient partition procedure, and from the fact that xp is maintained in reliable memory. Otherwise, assume without loss of generality, that p < k. The case where p > k is symmetric. The second iteration considers a sub-array X ′ = X[p + 1, r] of size n′ < n. Therefore, by the induction hypothesis, e ∈ α′-rankX ′ (k). It is guaranteed that e ≥ xp, because e is taken to be min(max(e, lb), ub). Therefore, e is larger than all the uncorrupted elements in X[1 : p]. Each corruption that occurred during the first iteration can change the rank of e by at most 1, therefore 9 e ∈ (α′ + α1)-rankX (k) = α-rankX (k). Notice that the above proves that the algorithm is correct with probability 1. With regard to the expected time complexity, let t denote the number of iterations the algorithm does. If there are no faults (i.e., α = 0), then the proba- bility of choosing a pivot xp such that rankX (xp) ∈ [ n 2 . However, there are two types of possible corruptions. The first type is corruptions of elements that are used as pivot elements. The second type is corruptions of elements that are not used as pivot elements. Let α′ (α′′) denote the number of corruptions of the first (second) type. 4 ] is 1 4 , 3n Consider corruptions of the first type. Let i0, . . . , it be indices of iterations such that i0 is the first iteration, it is the last iteration, and for every j > 0, ij+1 is the first iteration after ij such that nij+1 ≤ 3 4 nij + αij , where nij denotes the size of the sub-array at the beginning of the ith iteration and αij denotes the j iteration and the (ij+1−1)th number of corruptions that occurred between the ith j 4(cid:1)j iteration. It follows that Pt−1 n +Pj−1 j=0 αij = α′ and nij ≤(cid:0) 3 k=0(cid:0) 3 αik . Let Yj denote the number of iterations between the ith iteration and the (ij+1 − j 1)th iteration (i.e., Yj = ij+1 − ij). Yj is a random variable with a geometric distribution, and E(Yj ) ≤ 2, by a similar reasoning as in the non-faulty case. Notice that E(Yj ) ≤ 2 even when conditioned on earlier iterations. It follows that if there are only corruptions of the second type, then the running time is bounded by Pt Consider corruptions of the second type. For a sub-array of size n′, the prob- ability that the adversary corrupts the pivot element using 1 corruption is 1/n′, because the adversary cannot see the random coins used by the algorithm. A corrupted pivot can result in up to O(n′) extra work. Therefore, the expected cost of a corrupted pivot is O(1). To conclude, the expected time complexity is as follows3: 4(cid:1)j−k−1 j=0 O(nij )Yj . t−1 ≤ ∞ ∞ nij Yj  E [T (n)] ≤ E  Xj=0 Xj=0 ≤ E [Yj ] n + O(α′′) ≤ E Xj=0  Xj=0 E(cid:2)nij Yj(cid:3) + O(α′′) E""(cid:18) 3 4(cid:19)j 4(cid:19)j−k−1 Xk=0(cid:18) 3 E"(cid:18) 3 4(cid:19)j Xj=0(cid:18) 3 Xk=0 Xj=0 n + ≤ ∞ j−1 j−1 ∞ + ∞ nij Yj  + O(α′′) αik# Yj# + O(α′′) 4(cid:19)j−k−1 αik Yj# + O(α′′) 3 For simplicity, for j > t, Yj and nij are defined to be 0. 10 Notice that the expectation of Yj is at most 2, even when conditioned on αik , for k < j (i.e., E [Yj αik ] ≤ 2, for k < j). Therefore, using total expectation, it follows that, for k < j: =z E [αik Yj] = Xαik = Xαik ≤ 2 Xαik =z =z = 2E [αik ] E [Yjαikαik = z] P [αik = z] zE [Yjαik = z] P [αik = z] zP [αik = z] Therefore, E [T (n)] ≤ 2n ≤ 8n + 2 ∞ ∞ j−1 4(cid:19)j Xj=0(cid:18) 3 Xk=0 Xj=0 Xj=0 ∞ αik# + O(α′′) + j−1 ∞ 2E"(cid:18) 3 Xk=0 Xj=0 E"(cid:18) 3 4(cid:19)j−k−1 4(cid:19)j−k−1 αik# + O(α′′) = O(n) + O(αij ) + O(α′′) = O(n) + O(α′) + O(α′′) = O(n + α) 4 Deterministic Resilient Selection Algorithm The following deterministic resilient selection algorithm is similar in nature to the non-resilient algorithm by Blum, Floyd, Pratt, Rivest, and Tarjan [BFP+73], but several major modifications are introduced in order to make it resilient. The algorithm is presented in a recursive form, but the recursion is implemented in a very specific way, as explained in Section 5. In the non-faulty RAM model, the recursion stack needs to reliably store the local variables, as well as the frame pointer and the program counter. Corruptions of this data can cause the algorithm to behave unexpectedly, and in general the recursion stack cannot fit in reliable memory. Therefore, a special recursion implementation is needed. Generally, a recursive computation can be thought of as a traversal on a recursion tree T , where the computation begins at the root. Each internal node u ∈ T performs several recursive calls, which can be partitioned into two types: the first type and the second type. Each node performs at least one call of each type, and the calls may be interleaved. The idea is for each node u, to locate the kth u smallest element in the array Xu of size nu. However, due to corruptions, this cannot be guaranteed, therefore a weaker guarantee is used, as explained later. 11 4.1 Algorithm Description The root of the recursion tree is a call to Determinstic-Select(X, k, −∞, ∞). The computation of an inner node u has two phases. First phase The goal of the first phase is to find a good pivot, specifically, a pivot whose rank is in the range [fu, nu − fu], where fu = ⌊ 3nu 11 ⌋ − 6.4 Finding a pivot is done by computing the median of each group of five consecutive elements in X, followed by a recursive call of the first type, to compute the median of these medians. The process is repeated until a good pivot is found. 10 ⌋ − ⌊ nu Second phase The goal of the second phase is to find a good element. Specifi- cally, an element whose rank is in [ku ± nv] where v is a second type child of u. This will be shown to be sufficient5. This is done by making a recursive call of the second type, which considers only the relevant sub-array with the updated order statistic. Notice that, unlike the non-faulty selection algorithm, here the appropriate sub-array might be padded with more elements, so that the size of the sub-array is nu − fu. This is important for the recursion implementation, as explained in Section 5. If the returned value from the recursive call is not in the accepted range, the entire computation of the node repeats, starting from the first phase. Once a good element is found, it is returned to the caller. 4 The exact choice of fu (which is a function of nu, the size of the node u) relates to the recursion implementation as explained in Section 5. The idea is to always partition the array at a predetermined ratio, in order to provide more structure to the recursion, and this is what allows for the recursion size function to be easily invertible, as mentioned in Section 1. Notice that the ⌊ nu 11 ⌋ could be picked to be ⌊ǫ · nu⌋ for any constant ǫ < 1 10 , because this is needed for the running time of the algorithm, as explained in the proof of Theorem 6. 5 The exact choice of [ku ± nv] relates to the proof by induction for the correctness of the algorithm. The idea is that as long as less then nv corruptions occurred during the computation of v, the rank of the element located by v is guaranteed, by induction, to be in these bounds. See the proof of Lemma 4 and the proof of Lemma 7. 12 Algorithm 2: Deterministic-Select(X, n, k, lb, ub) 1 # The algorithm uses the recursion implementation from Lemma 3 2 repeat # Let f denote ⌊ 3n begin First Phase 10⌋ − ⌊ n 11⌋ − 6 repeat Xm ← [] for i ∈ [1..⌈n/5⌉] do Xm[i] ← median of X[5i, 5i + min(4, n − 5i)] xp ← Deterministic-Select(Xm, ⌈Xm/2⌉, lb, ub) partition X around xp # using the algorithm from Lemma 2 # Let p denote rankc X (xp) until p ∈ [f, n − f ] begin Second Phase if p = k then return e = min(max(xp, lb), ub) else if p > k then 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 else if p < k then e ← Deterministic-Select(X[1, n − f ], k, lb, xp) e ← Deterministic-Select(X[f, n], k − f , xp, ub) X (e) ∈ [k ± nv] # v is a second type child of the node 20 until rankc 21 return e = min(max(e, lb), ub) Let αu be the number of corruptions that occurred in u's sub-tree. Each node uses two boundary values lbu and ubu which are used similarly to the bounds used in the randomized resilient algorithm. The recursive calls are made with the parameters Xu, nu, ku, lbu, ubu, and each recursive call returns an element x. In Section 5, a recursion implementation with the following properties is described. Lemma 3. There exists a recursion implementation for the resilient determin- istic selection algorithm with the following properties: 1. The position of Xu, nu, the return value, and program counter are reliable.6 2. If αu ≤ nu, then lbu, ubu, ku are reliable.7 3. The time overhead induced by the implementation is O(nu) per call. The proof of the Lemma is given in Section 5. 6 This means that these variables are correct, as long as no more than δ faults occurred. 7 This means that these variables are correct, as long as no more than nu faults occurred. 13 4.2 Analysis Let u be a node. Let V = (v1, . . . , vV ) be u's children. v1 is always a first type node, and vV is always a second type node. Every second type child, except vV , is followed by a first type child, therefore there cannot be two adjacent second type children (see Fig. 1). Let αu denote the number of corruptions that occur in u's sub-tree and let αlocal denote the number of corruptions that occur only in u's data. Let αvi u denote the number of corruptions that occur in u's data between the execution of vi and the execution of vi+1 (or until u finishes its computation, if vi is the last child of u) and let α0 v denote the number of corruptions that occur in u's data before the execution of v1. It follows that, αu = αlocal u denote the state of Xu at the beginning of u's computation. Let X vi u denote the state of Xu at the moment of the call to vi. v=0 αvi = PV u +PV u v=1(αvi u + αvi ). Let X 0 u v3 v3 v1 v2 v2 v4 v5 Fig. 1. A node u with five children: v1, . . . , v5 is depicted. The nodes v1,v3,v4 are first type children of u, while the nodes v2,v5 are second type children of u. The braces show the corruptions amortization, specifically, v2 pays for v1 and for itself and v3 pays for itself. The following Lemmas are used to prove the correctness and the running time of Deterministic-Select in Thm. 6. (ku). Lemma 4. If αu ≤ nu, then eu ∈ αu-rankX 0 Proof. The proof is by induction on nu. The base case is defined to be where nu is 1. In this case, p = k, and the claim is correct. For the induction step, note that each corruption of an element in Xu can result in at most one rank error. In contrast, corruptions in auxiliary information can result in more than one rank error per corruption, but this is taken care of, as shown next. u 14 u v Xu u u -rankX 0 u (ku), as needed. u (ku), as needed. u u + nv)-rankX 0 u + nv)-rankX 0 (ku) ⊆ αu-rankX 0 u + αv)-rankX 0 Otherwise (i.e., if αv ≤ nv), then by induction, eu ∈ αv-rankX 0 By Lemma 3, the recursion implementation guarantees that if αu ≤ nu, then ku is correct. If the return statement in line 13 is used, then the pivot xp is returned as eu. The test at line 12 guarantees that rankc Xu (eu) = ku. From the definition of the resilient partition procedure, eu ∈ αlocal (ku) ⊆ u αu-rankX 0 If the return statement in line 13 is not used, then the return statement in line 19 is used. Let the last child of u be denoted by v = vV . The test at line 18 guarantees that rankc (eu) ∈ [ku±nv]. Notice that the element eu is the element located by v. Therefore, from the definition of the resilient ranking procedure, eu ∈ (αlocal (ku). If αv > nv, then eu ∈ (αlocal (ku) ⊆ (αlocal (kv). Also, the recursion implementation guarantees that lbv, ubv, and kv, are resilient in this case. If rankc (xp) > kv, then kv = ku, because both are resilient. Also, being that ubv is resilient, eu is smaller than all the uncorrupted elements in Xu, which are larger than ubv. Therefore, eu ∈ (αlocal (ku), as needed. If rankc (xp) < kv, then kv = ku − fu, because both are resilient. Also, being that lbv is resilient, eu is larger than all the uncorrupted elements in Xu, which are smaller than lbv. Therefore, eu ∈ (αlocal Lemma 5. Let vi = w be a first type child of u. If αw ≤ nw, then 3nu/10 − 3(αw + αw u ) + 6, where xp = ew is the element returned from w to u. Proof. αw ≤ nw, therefore from Lemma 4, it follows that ew ∈ αw-rankX 0 (kw). Also, the recursion implementation guarantees that kw is resilient in this case, therefore, kw = ⌈nu/10⌉. There exists at least 3(kw − αw − 2) − αw u elements in X w u which are smaller than xp. This is because each non corrupted median of five consecutive elements corresponds to at least 3 elements in X w u which are smaller than xp, and each corrupted element either in Xw or in Xu which is not a median of five consecutive elements can change the rank of xp by at most 1. A similar argument establishes the second inequality. u (xp) ≤ 7nu/10 + 3(αw + αw u ) − 6 ≤ rankX w u + αv)-rankX 0 u + αv)-rankX 0 (ku), as needed. u u Xv Xv w Lemma 6. Let w = vi be a first type child of u. If vi+1 is not a second type node, then αw u + αw ≥ Ω(nu). Proof. Being that w is not followed by a second type node, xp did not pass the test at line 10 (i.e., p /∈ [fu, nu − fu]). There are two cases to consider. If αw > nw = ⌈nu/5⌉, then, in particular, αw = Ω(nu). Otherwise, assume that αw < nw. It will be shown that (αw (ku) ∈ [3nu/10 − 3(αw u +αw) ≥ nu/33 = Ω(nu). Assume, in contradiction, that this is not the case. It follows, from Lemma 5, that rankc u + αw) + 6] ⊆ [3nu/10 − nu/11 − 6, 7nu/10 + nu/11 + 6]. This contradicts the assumption that xp did not pass the test at line 10 (i.e., that rankc (ku) /∈ [3nu/10 − nu/11 − 6, 7nu + nu/11 + 6]). Lemma 7. Let w = vi be a second type child of u. If w is not the last child of u, then αw u + αw) − 6, 7nu/10 + 3(αw X w u Xu u + αw ≥ Ω(nu). 15 Proof. Being that w is not the last child of u, ew did not pass the test at line 18 (i.e., rankXu (ew) /∈ [k ± nw]). Again, there are two cases to consider. If αw > nw = nu − fu, then, in particular, αw = Ω(nu). Otherwise, if αw ≤ nw, then, by Lemma 4, ew ∈ αw-rankX 0 (kw). Moreover, kw = ku, and each corruption in Xu can cause the rank of ew to change by at most 1. Therefore, rankXu (ew) ∈ [ku ± (αw u + αw)]. However, ew did not pass the test at line 18, therefore αw w u + αu > nw = Ω(nu). Theorem 6. Deterministic-Select is a deterministic resilient selection algorithm with time complexity O(n + α). Proof. First, Deterministic-Select is shown to be resilient. Let u be the root of the recursion tree, T . If δ ≤ n = nu, then by Lemma 4, e ∈ α-rankX 0 (k), as needed. Otherwise, if δ ≥ n, then there are two cases to consider. If α ≤ n, then by Lemma 4, e ∈ α-rankX 0 (k), as before. Otherwise, if α ≥ n, then by definition, [−∞,∞] = n-rankX 0 (k) = α-rankX 0 (k). Therefore, for any element e, e ∈ α-rankX 0 (k). In particular, the element returned is correct. With regard to the time complexity, consider a non-faulty execution (i.e., α = 0). The time complexity T (n) = T (⌈n/5⌉)+T (⌈7n/10⌉+⌈n/11⌉+6)+O(n) = O(n) follows, because ⌈n/5⌉ + ⌈7n/10⌉ + ⌈n/11⌉ < n. If α > 0, then there might be some repetitions. Lemma 6 and Lemma 7 show that enough corruptions can be charged for the time spent in those repetitions. In particular, the Ω(nu) corruptions that cause a first type child repetition pay for the O(nu) computation time of the child, and the Ω(nu) corruptions that cause a second type child repetition pay for the O(nu) computation time of the child, and for the O(nu) computation time of the first type child that precedes it. Figure 1 shows a visualization of this amortization. In both cases there is O(1) amortized cost per corruption. Therefore, the overall time complexity is O(n + α). Theorem 7. There exists a deterministic resilient selection algorithm with time complexity O(n). Proof. The algorithm Deterministic-Select can be modified to achieve worst- case time complexity O(n). The algorithm maintains a counter c, initialized to 0, which is a lower bound on the number of corruptions that occurred. Notice that c can be maintained in a reliable memory cell. The proof of Lemma 6 shows that if a first phase repetition occurred, it must be due to at least ⌊nu/33⌋ corruptions, where u is the current node. Therefore, in this case, the counter is incremented by ⌊nu/33⌋. The proof of Lemma 7 shows that if a second phase repetition occurred, it must be due to at least nv corruptions, where v is the second type child of the current node that caused the repetition. Therefore, in this case, the counter is incremented by nv. If the counter is equal to or larger than n, the algorithm halts with an arbitrary ele- ment. 16 The modified algorithm is correct, because the counter is a lower bound of the number of corruptions. If c > n, then α > n. Therefore, any element is in the α-rank of X 0. With regard to the time complexity, notice that the counter is also an upper bound, up to a multiplicative constant, for the amount of extra work performed due to corruptions. Therefore, as long as c < 2n, which is always the case, the total work is O(n). 5 Recursion Implementation In this section, an abstract recursion stack for Deterministic-Select is developed. The data structures used by this abstract stack are described, followed by the implementation of the operations on it. This leads to the proof of Lemma 3 at the end of this section. 5.1 Data Structures Two stacks, one reliable and the other one faulty, together with a constant number of reliable memory cells, are used to implement the recursion for the al- gorithm Deterministic-Select. An execution path in the recursion tree, T , starts from the root and ends at the current node. In each stack, the entire execution path is stored in a contiguous region in memory, where the root is at the begin- ning, and the current node is at the end. The stacks are depicted schematically in Fig. 2. Reliable Stack The reliable stack stores only 9 bits of information per node. The height of T is O(log n), therefore it can be stored in a constant number of reliable memory cells. For each inner node u ∈ T , the reliable stack stores 1 bit to distinguish between a first type child and a second type child. Let ρy x denote the remainder of the division of x by y. For a node of the first type, ρ5 nu is stored. For a node of the second type, ρ10/3 nu are stored. Notice that the O(1) reliable memory cells are used down to the bit level. and ρ11 nu Faulty Stack The faulty stack stores O(nu) words of information per node. For each node u ∈ T , the faulty stack stores the elements of Xu, as well as ku, lbu, and ubu. The elements of Xu are stored using 1 copy per element, while ku, lbu, and ubu are stored using 2nu + 1 copies per variable. Global Variables Each one of the following global variables is stored using a reliable memory cell: -- The current array size -- The reliable stack's frame pointer -- The faulty stack's frame pointer -- The program counter 17 -- The return value Notice that at a given moment in an execution only one value per each global variable needs to be stored. w v u ւ ρ5 nw ց ρ10/3 nv ρ31 nv w Frame pointer Frame pointer v u Xw k w l b w u b w Xv k v l b v u b v Xu k u l b u u b u Fig. 2. The stacks used by the recursion implementation are depicted. The reliable stack is at the top and the faulty stack is at the bottom. The execution path is composed of the root, w, it's first type child, v, and v's second type child, u. The figure shows the situation when u begins its computation. For each node, the reliable stack stores the traversal direction to its child (drawn as a pointed arrow), as well as the remainders, ρ5 or ρ10/3 and ρ31, while the faulty stack stores the sub-array X, as well as 2g + 1 copies of lb, ub, and k. The frame pointers are also shown. 5.2 Operations Two operations are implemented by the recursion implementation. A push opera- tion corresponds to a recursive call, and a pop operation corresponds to returning from a recursive call. Push When a node u calls its child v, the following is done. The information of whether v is a first type child or a second type child of u is written to the reliable stack, as well as the relevant remainders (i.e., ρ5 nu), and the reliable stack's frame pointer is incremented by 9 bits. Then, the relevant sub-array is pushed to the faulty stack, followed by the values lbv, ubv, and kv. If v is a first type child, then nv is updated to ⌈nu/5⌉. If v is a second type child, then nv is updated to nu − fu. The faulty stack's frame pointer is updated accordingly, and the program counter is set to line 1. Then, the computation continues to v. nu or ρ10/3 and ρ11 nu 18 Pop When v finishes its computation, the following is done. First, the reliable stack's frame pointer is decremented by 9 bits, and the information of whether v is a first type or a second type child of u is read, as well as the remainder (i.e., nu or ρ10/3 ρ5 and ρ11 nu ). nu If v is a first type child, then nu is updated to 5(nv − 1) + ρ5 nu. If v is a second type child, then nu is updated to (110/87) · (nv − ρ10/3 nu /11 − 6). Notice that this function is the inverse function of nu − fu, which is the function used to update n when calling a second type child, as explained before. The faulty stack's frame pointer is decremented by nu + 3(2nu + 1) words. nu /(10/3) + ρ11 The 2nu + 1 copies of lbu, ubu, and ku are read, and the computed majority of their copies are stored in reliable memory and used as the values for lbu, ubu, and ku. Then, the computation returns to u, either to line 8 or to line 18, depending on the type of u. 5.3 Proof of Lemma 3 Proof. The frame pointers, the return value, and the program counter were shown to be reliable, as well as the location of the array Xu and its size nu. lbu, ubu, and ku are stored using 2nu + 1 copies each, therefore, if αu ≤ nu, then these parameters are reliable. The time overhead induced by the frame pointers, return value, program counter, location of the array Xu and its size nu is a constant. The time overhead induced by lbu, ubu, and ku is O(nu). Therefore, the time overhead of the recursive implementation is O(nu). 6 Resilient k-d Trees Gieseke et al. [GMV10], developed a resilient k-d tree, where k denotes the dimension (this k is not related to the k in the selection algorithm). As is the case with non-resilient k-d trees, the construction involves multiple partitioning of the points by the median. For example, if k = 2, then at even-depth nodes, the points are partitioned by the x-coordinate median, and at odd-depth nodes, the points are partitioned by the y-coordinate median. In a resilient k-d tree, the partitioning ends at the leaves, which contain bδ = O(δ) points each, where b is a parameter. Gieseke et al. developed a randomized resilient selection algorithm, which is somewhat different from the randomized resilient selection algorithm developed in this work. Both algorithms achieve the same expected time complexity, O(n + α). Using these algorithms to build a resilient k-d tree results in O(n log n + δ) expected time complexity. However, the selection algorithm developed here guarantees that the element returned has rank between k − α and k + α in the input array, while the algorithm developed in [GMV10] only guarantees a rank between k − O(δ) and k + O(δ). This difference does not have asymptotical consequences on the height of the resulting k-d tree. For a deterministic k-d tree construction algorithm, Gieseke et al. used the resilient sorting algorithm developed by Finocchi et al. [FGI09a] in order to 19 partition the points around the median. This results in O(n log2 n + αδ) time complexity. By using the deterministic resilient selection algorithm developed here, the time complexity is reduced to O(n log n) and implies the following theorem. Theorem 8. There exists a resilient k-d tree which can be constructed in de- terministic O(n log n) time. It supports resilient orthogonal range queries in O(√nδ + t) time for reporting t points. 7 Resilient Quicksort Algorithms The famous quicksort algorithm is based on the idea of selecting a pivot, parti- tioning the input by it, and recursively sorting each side of the partition. In the FRAM model the difficulty is in having to maintain the ω(1) partitioning loca- tions. This is true for both a recursive and iterative implementation. One natural idea for dealing with this difficulty is to partition the array at the median. For sake of simplicity assume that the size of the input is a power of two8. However, using a resilient selection algorithm for locating the median in the FRAM model and partitioning around the element returned does not guarantee that the array is split into two parts of equal size, due to corruptions that may occur during the execution of the selection algorithm, returning an element which is only roughly the median. Thus, there is a need to develop a resilient splitting algorithm, which is defined as follows. Definition 3. A resilient splitting algorithm is an algorithm that is given an array X of size n and an integer k, and reorders the array such that any uncor- rupted element in X[1, k] is smaller than any uncorrupted element in X[k, n]. In section 7.1, two non-efficient resilient splitting algorithms are shown: one is deterministic and runs in O(αn) worst-case time, and the second is randomized and in-place and runs in O(αn) expected time. In section 7.2, two efficient resilient splitting algorithms are shown: one is de- terministic and runs in O(n + αδ) worst-case time, and the second is randomized and in-place and runs in O(n + αδ) expected time. These efficient algorithms use the non-efficient algorithms from Section 7.1. 7.1 Sandboxed Splitting Algorithms The basic idea behind the resilient splitting algorithms is to test the rank of the element returned by the selection algorithm, and fix it, as needed. In order to achieve this goal, the notion of Sandboxing an algorithm is introduced. The idea is to convert a non-resilient algorithm A, with a known bound on its running 8 If this is not the case then careful padding can take place. Being that the interest here is in an in-place algorithm, the padding can be done abstractly by knowing that each access to an array location which does not exist can be considered as ∞. 20 time and space usage into a resilient algorithm A′. However, in order to be able to do this, there must exist a verification procedure which can verify that the output of A is correct, and the algorithm A needs to be non-destructive, a notion which is defined later. Finocchi, Grandoni and Italiano ([FGI09b], Lemma 4) already considered a similar reduction. However, there is an unfortunate flaw in their proof given there, because it does not take into consideration the following two cases: A corrupted variable that can cause the non-resilient procedure to require a much larger time complexity (maybe even getting stuck in an infinite loop), and mem- ory corruptions that can cause the non-resilient procedure to alter memory cells used by other parts of the system. These problems can be overcome by confining the execution to a predetermined area in memory and having an upper bound on the running time of A. The area in memory is referred to as the sandbox. For a problem P and an input X, let P (X) denote the set of correct solutions of P on X. Definition 4. Let A be an algorithm for a problem P . Assume that an execution of A on an input X can be interrupted at any point in time, and let X ′ denote the state of the input after such an interruption. A is non-destructive if for any execution of A on any input X and on any set of random coins, and for any interruption with any possible sequence of faults, P (X) = P (X ′). Lemma 8. Let A be a non-resilient and a non-destructive algorithm solving problem P with time complexity TA (either worst-case or expected) and space complexity SA. Let C be a resilient verification procedure for A with worst-case time complexity TC and space complexity SC which decides the correctness of an execution of A. Then there exists a resilient algorithm A′ which solves P , and has time complexity O((1 + α)(TA + TC)) which is either worst-case or expected, depending on TA, and space complexity O(SA + SC ). Proof. A sandboxed version of A, denoted by A′, is defined as follows. The al- gorithm works in rounds. In each round, A′ runs a modified version of A, as defined next. If the running time of A is worst-case, then, to guarantee that A will not run for too long, A′ runs A for no more than TA steps. If the running time of A is in expectation, then, to guarantee that A will not run for too long, A′ runs A for no more than 2TA steps. This is done by counting the number of computational steps that A performs. To guarantee that A will not alter mem- ory cells other than its own, A′ runs A confined to a memory region of size SA. The counter which counts the computational steps as well as the two boundaries for the memory region are stored in reliable memory cells. After running the modified A algorithm, A′ calls C to check the correctness of A's computation. If C returned a positive answer, A′ halts. Otherwise, a new round begins, but only after the memory sandbox is flushed. That is, immediately after a non-successful round ends, all of the working memory is erased, but the input is left as it is, for the next round. The memory sandbox guarantee that the (non-resilient) computation of A would not alter memory cells outside of A's computation. A′ halts only after 21 the resilient verification procedure C returned a positive answer. Therefore, A′ is correct, even in the presence of memory faults. If the running time of A is worst-case, then each round takes TA +TC time. In a non-faulty round, A is correct. By the pigeon hole principle, if there are more than α rounds, at least one of them is non-faulty. Denote the state of the input at the beginning of this non-faulty round by X ′. A is a (non-resilient) algorithm for P , therefore, in this non-faulty round, it computes a correct output y ∈ P (X ′). A is non-destructive, therefore P (X) = P (X ′). It follows that y ∈ P (X), i.e., y is correct9. Therefore, there are at most α + 1 rounds. If the running time of A is expected, then each round takes 2TA + TC time. In a non-faulty round, the probability that A would halt within 2TA computational steps is at least 1 2 , by Markov's inequality. Therefore, the expected number of rounds is at most 2α + 1. The space used by the calls to A and C can be reused, therefore, the space complexity is O(SA + SC ). This general notion of sandboxed algorithms can be used for designing re- silient splitting algorithms. For the deterministic resilient splitting algorithm, algorithm A is executed by using the non-resilient deterministic selection al- gorithm to locate the median, and partitioning the array around the element returned. The verification procedure C is implemented by testing that each side of the partition has the same size. For the randomized resilient splitting algo- rithm, algorithm A is executed by using the non-resilient randomized selection algorithm to locate the median. Notice that in the randomized case, SA = O(1). Notice that both the non-resilient deterministic selection algorithm and the non-resilient randomized selection algorithm needs to slightly be altered in order to be non-destructive. The only operation that these algorithms perform which might alter the input is swapping. The idea is to make these swaps atomic, i.e., only stopping the algorithm after such a swap is fully completed. Notice that the k-order statistic of an input array does not depend on the specific permutation of the input array10. Corollary 1. There exists a deterministic resilient splitting algorithm with worst- case time complexity O(αn), and a randomized in-place resilient splitting algo- rithm with expected time complexity O(αn). Proof. The proof follows from Lemma 8 and from the discussion above. Denote the algorithm from Lemma 1 by Sandboxed-Split. The running time of such an algorithm is rather costly, but it is still useful when considering small 9 If A is a Monte Carlo algorithm then P [y ∈ P (X ′)] ≥ 2 3 , and because of the non- destructiveness of A, it follows that P [y ∈ P (X)] ≥ 2 3 , as needed. 10 Another way of altering these algorithms to make them non-destructive is by copying the input array to a second and temporary array. Then, performing all of the swaps only on the temporary array, and making sure that the input array is not altered at all, by putting it outside the memory sandbox. This solution, however, has a cost in time and space. 22 arrays. For the resilient splitting algorithm, the idea is to reduce the size of the array, and then execute Sandboxed-Split. 7.2 Efficient Splitting Algorithms Consider the following generic algorithm, denoted by Generic-Resilient-Split. The algorithm uses either Deterministic-Select or Randomized-Select, denoted here by Generic-Resilient-Select, to locate both the (k − δ)th and the (k + δ)th order statistics. Then, it uses Sandboxed-Split to split the remaining O(δ) ele- ments. Algorithm 3: Generic-Resilient-Split(X, k) 1 l ← Generic-Resilient-Select(X[1, n], k − δ) 2 partition X around l 3 if rankc X (l) = k then 4 return 5 r ← Generic-Resilient-Select(X[l, n], k − l + δ + 1) 6 partition X[l, n] around r 7 if rankc X (r) = k then 8 return 9 Sandboxed-Split(X[l, r], k − l) Lemma 9. Generic-Resilient-Split is a resilient splitting algorithm. Proof. After the array is partitioned around l, the uncorrupted elements in X[1, l] are smaller than the uncorrupted elements in X[l, n]. After the array is partitioned around r, the uncorrupted elements in X[l, r] are smaller than the uncorrupted elements in X[r, n]. After the call to Sandboxed-Split, the un- corrupted elements in X[l, k − l] are smaller than the uncorrupted elements in X[k − l, r]. It follows that the uncorrupted elements in X[1, k] are smaller than the uncorrupted elements in X[k, n], as needed. The following corollaries follow by substituting Generic-Resilient-Select by either the deterministic or randomized versions. Notice that in both cases, the call to Generic-Resilient-Select takes O(n + α) (either in expectation or worst- case as needed). The size of the sub-array X[l, r] is O(δ), therefore the call to Sandboxed-Select takes O(αδ) time. Corollary 2. There exists a deterministic resilient splitting algorithm with worst- case running time O(n + αδ), and a randomized in-place resilient splitting algo- rithm with expected running time O(n + αδ). 23 7.3 Resilient Quicksort Algorithms Using the generic resilient splitting algorithm as a black box, one can sort re- siliently using Generic-Resilient-Quicksort. Notice that this algorithm does not use more than O(1) space, except for the space used by the splitting algorithm. Algorithm 4: Generic-Resilient-Quicksort(X) 1 for d ∈ [1.. log n] do for c ∈ [0..2d − 1] do 2 3 4 5 6 n′ ← n/2d X ′ ← X[n′ · c + 1, n′ · (c + 1)] # The array is split in-place. Generic-Resilient-Split(X ′, n′/2) Lemma 10. Generic-Resilient-Quicksort is a resilient sorting algorithm. Proof. Consider two uncorrupted elements a and b from the input, where a < b. There exists some element p which partitions them, at which point a will be put before b in the array, and from then onwards their order will remain the same. The following theorem follows. Theorem 9. There exists a deterministic sorting algorithm with worst-case run- ning time of O(n log n + αδ), and a resilient randomized in-place sorting algo- rithm with expected running time of O(n log n + αδ). Proof. Using Corollary 2 and Lemma 10, the theorem follows. 24 References AB96. Yonatan Aumann and Michael A. Bender. Fault tolerant data structures. In Proceedings of the 37th Annual Symposium on Foundations of Computer Science (FOCS), pages 580 -- 589, October 1996. ABN93. Barry C. Arnold, N Balakrishnan, and H. N. Nagaraja. A first course in AU91. Bau05. order statistics. SIAM Review, 35(3), September 1993. Shay Assaf and Eli Upfal. Fault tolerant sorting networks. SIAM J. Discrete Math., 4(4):472 -- 480, 1991. R. C. Baumann. Radiation-induced soft errors in advanced semiconduc- tor technologies. IEEE Transactions on Device and Materials Reliability, 5(3):305 -- 316, 2005. BEG+94. Manuel Blum, William S. Evans, Peter Gemmell, Sampath Kannan, and Moni Naor. Checking the correctness of memories. Algorithmica, 12(2/3):225 -- 244, 1994. BFF+07. Gerth Stølting Brodal, Rolf Fagerberg, Irene Finocchi, Fabrizio Grandoni, Giuseppe F. Italiano, Allan Grønlund Jørgensen, Gabriel Moruz, and Thomas Mølhave. Optimal resilient dynamic dictionaries. In Proceedings of ESA, pages 347 -- 358, 2007. BFP+73. Manuel Blum, Robert W. Floyd, Vaughan R. Pratt, Ronald L. Rivest, and Robert Endre Tarjan. Time bounds for selection. J. Comput. Syst. Sci., 7(4):448 -- 461, 1973. BJM09. Gerth Stølting Brodal, Allan Grønlund Jørgensen, and Thomas Mølhave. Fault tolerant external memory algorithms. In Proceedings of WADS, pages 411 -- 422, 2009. BJMM09. Gerth Stølting Brodal, Allan Grønlund Jørgensen, Gabriel Moruz, and In Pro- Thomas Mølhave. Counting in the presence of memory faults. ceedings of ISAAC, pages 842 -- 851, 2009. CDK11. Paul Christiano, Erik D. Demaine, and Shaunak Kishore. Lossless fault- tolerant data structures with additive overhead. In Proceedings of WADS, pages 243 -- 254, 2011. Saverio Caminiti, Irene Finocchi, and Emanuele G. Fusco. Local dependency dynamic programming in the presence of memory faults. In Proceedings of STACS, pages 445 -- 56, 2011. CFF11. CFFS11. Saverio Caminiti, Irene Finocchi, Emanuele G. Fusco, and Francesco Silvestri. Dynamic programming in faulty memory hierarchies (cache- obliviously). In Proceedings of FSTTCS, pages 433 -- 444, 2011. Chin-Long Chen and M. Y. (Ben) Hsiao. Error-correcting codes for semi- conductor memory applications: A state-of-the-art review. IBM Journal of Research and Development, 28(2):124 -- 134, 1984. CH84. CLRS09. T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. The MIT Press, 3rd edition, 2009. DGW92. Aditi Dhagat, P´eter G´acs, and Peter Winkler. On playing "twenty ques- FGI09a. FGI09b. tions" with a liar. In SODA, pages 16 -- 22, 1992. Irene Finocchi, Fabrizio Grandoni, and Giuseppe F. Italiano. Optimal re- silient sorting and searching in the presence of memory faults. Theor. Com- put. Sci, 410(44):4457 -- 4470, 2009. Irene Finocchi, Fabrizio Grandoni, and Giuseppe F. Italiano. Resilient dic- tionaries. ACM Transactions on Algorithms, 6(1), 2009. 25 FI04. Irene Finocchi and Giuseppe F. Italiano. Sorting and searching in the pres- ence of memory faults (without redundancy). In Proceedings of STOC, pages 101 -- 110, 2004. FRPU94. Uriel Feige, Prabhakar Raghavan, David Peleg, and Eli Upfal. Computing G99. G´al91. with noisy information. SIAM J. Comput., 23(5):1001 -- 1018, 1994. Felix C. Gartner. Fundamentals of fault-tolerant distributed computing in asynchronous environments. ACM Computing Surveys, 31, 1999. Anna G´al. Lower bounds for the complexity of reliable boolean circuits with noisy gates. In FOCS, pages 594 -- 601, 1991. GMV10. Fabian Gieseke, Gabriel Moruz, and Jan Vahrenhold. Resilient k-d trees: K-means in space revisited. In Proceedings of ICDM, pages 815 -- 820, 2010. C. A. R. Hoare. Algorithm 63: partition. Commun. ACM, 4:319 -- 322, July 1961. Hoa61. JMM07. Allan Grnlund Jørgensen, Gabriel Moruz, and Thomas Mølhave. Priority queues resilient to memory faults. In Proceedings of WADS, pages 127 -- 138, 2007. LHSC10. Xin Li, Michael C. Huang, Kai Shen, and Lingkun Chu. A realistic eval- uation of memory hardware errors and software system susceptibility. In Proceedings of USENIX, pages 6 -- 6, 2010. T. C. May and M. H. Woods. Alpha-particle-induced soft errors in dynamic memories. IEEE Transactions on Electron Devices, 26(1):2 -- 9, 1979. MW79. PW72. W.W. Peterson and E.J. Weldon. Error-Correcting Codes. MIT Press, 1972. Tezzaron Semiconductor. Soft errors in electronic memory - a white paper. Sem04. http://www.tezzaron.com/about/papers/soft_errors_1_1_secure.pdf, 2004. Alexander A. Sherstov. Making polynomials robust to noise. pages 747 -- 758, 2012. In STOC, She12. 26
1007.0372
1
1007
2010-07-02T14:22:26
Randomized Rounding for Routing and Covering Problems: Experiments and Improvements
[ "cs.DS" ]
Following previous theoretical work by Srinivasan (FOCS 2001) and the first author (STACS 2006) and a first experimental evaluation on random instances (ALENEX 2009), we investigate how the recently developed different approaches to generate randomized roundings satisfying disjoint cardinality constraints behave when used in two classical algorithmic problems, namely low-congestion routing in networks and max-coverage problems in hypergraphs. We generally find that all randomized rounding algorithms work well, much better than what is guaranteed by existing theoretical work. The derandomized versions produce again significantly better rounding errors, with running times still negligible compared to the one for solving the corresponding LP. It thus seems worth preferring them over the randomized variants. The data created in these experiments lets us propose and investigate the following new ideas. For the low-congestion routing problems, we suggest to solve a second LP, which yields the same congestion, but aims at producing a solution that is easier to round. Experiments show that this reduces the rounding errors considerably, both in combination with randomized and derandomized rounding. For the max-coverage instances, we generally observe that the greedy heuristics also performs very good. We develop a strengthened method of derandomized rounding, and a simple greedy/rounding hybrid approach using greedy and LP-based rounding elements, and observe that both these improvements yield again better solutions than both earlier approaches on their own. For unit disk max-domination, we also develop a PTAS. Contrary to all other algorithms investigated, it performs not much better in experiments than in theory; thus, unless extremely good solutions are to be obtained with huge computational resources, greedy, LP-based rounding or hybrid approaches are preferable.
cs.DS
cs
Randomized Rounding for Routing and Covering Problems: Experiments and Improvements(cid:63) Benjamin Doerr1, Marvin Kunnemann2, and Magnus Wahlstrom1 1 Max-Planck-Institut fur Informatik, Saarbrucken, Germany 2 Universitat des Saarlandes, Saarbrucken, Germany Abstract Following previous theoretical work by Srinivasan (FOCS 2001) and the first author (STACS 2006) and a first experimental evaluation on random instances (ALENEX 2009), we investigate how the recently developed different approaches to generate random- ized roundings satisfying disjoint cardinality constraints behave when used in two classical algorithmic problems, namely low-congestion routing in networks and max-coverage prob- lems in hypergraphs. We generally find that all randomized rounding algorithms work well, much better than what is guaranteed by existing theoretical work. The derandomized versions produce again significantly better rounding errors, with running times still negligible compared to the one for solving the corresponding LP. It thus seems worth preferring them over the randomized variants. The data created in these experiments lets us propose and investigate the following new ideas. For the low-congestion routing problems, we suggest to solve a second LP, which yields the same congestion, but aims at producing a solution that is easier to round. Experiments show that this reduces the rounding errors considerably, both in combination with randomized and derandomized rounding. For the max-coverage instances, we generally observe that the greedy heuristics also per- forms very good. We develop a strengthened method of derandomized rounding, and a sim- ple greedy/rounding hybrid approach using greedy and LP-based rounding elements, and ob- serve that both these improvements yield again better solutions than both earlier approaches on their own. For an important special case of max-coverage, namely unit disk max-domination, we also develop a PTAS. Contrary to all other algorithms investigated, it performs not much better in experiments than in theory. In consequence, unless extremely good solutions are to be ob- tained with huge computational resources, greedy, LP-based rounding or hybrid approaches are preferable. 1 Introduction Randomized rounding is one of the core primitives in randomized algorithmics. In contrast to many deep theoretical results, only very little experimental knowledge exists, and almost no fine- tuning and other implementation advice exists. Such results became even more interesting, since in the last ten years two substantially different methods [4, 7, 8, 21] extending the classical ap- proach of Raghavan and Thompson [19, 20] were developed. The only experimental work on either classical randomized rounding or the new approaches seems to be [5]. It compares the different methods on randomly generated rounding problems. The purpose of this work is to extend these results to two less artificial problem classes, namely routing and covering problems. These problems are among the first ones for which randomized rounding has been proven (by theoretical means) to lead to good algorithms. Randomized Rounding: Given an arbitrary real number x, we say that (the random variable) y is a randomized rounding of x, if y equals (cid:98)x(cid:99) + 1 with probability {x} := x − (cid:98)x(cid:99) and (cid:98)x(cid:99) (cid:63) Supported by the German Science Foundation (DFG) via its priority program (SPP) 1307 "Algorithm Engineering", grant DO 749/4-2. 2 otherwise. In simple words, the closer x is to the next larger integer, the higher the chance of being rounded up. Randomized rounding builds on the simple observation that this keeps the expectation un- changed, that is, E(y) = x. This naturally extends to linear expressions. If y1, . . . , yn are ran- domized roundings of x1, . . . , xn and f : Rn → R is a linear function, then E(f (y1, . . . , yn)) = f (x1, . . . , xn). If, in addition, the yi are independent, then Chernoff bounds allow strong quanti- tative statements showing that with high probability, f (y1, . . . , yn) is not far from its expectation. These two key facts allow to use randomized rounding in connection with integer linear program- ming. Two examples of this are given in the following sections. prescribe that(cid:80) The new aspect of the works [4, 7, 8, 21] is that they allow to generate randomized roundings that satisfy certain cardinality constraints with probability one. That is, for certain sets I, we can i∈I xi, provided the right-hand side is integral. This can be done without giving in with the other properties-both methods generate randomized roundings that admit the same Chernoff bounds as independent randomized rounding. i∈I yi = (cid:80) For reasons of space, we cannot describe these rounding algorithms here. However, since in this paper we are mainly comparing them experimentally, the reader may treat them as black-box, keeping in mind only that they generate randomized roundings that look independent, but satisfy cardinality constraints. We shall concentrate on disjoint cardinality constraints. This is the most common form of cardinality constraints. Also, the comparison of the methods is more interesting here, since all have the same time complexity. Our Results: The aim of this work is to find out how well the different rounding approaches are suited to solve classical problems that are often attacked with LP-based methods, but also to try to find fine-tunings and alternative approaches. As underlying problems we chose the classical low-congestion routing problem and the max- coverage problem. They are different in flavor since in the first, randomized rounding is used with a focus of exploiting Chernoff bounds in linear constraints and objective function. In the second, since the right-hand side of the inequalities is one, we cannot do so, but resort to accepting that a certain fraction of the vertices covered in the relaxation are not covered after rounding. All our results indicate that generally the derandomized algorithms yield superior results. The increase in running time over the randomized versions usually is still negligible compared to the complexity of solving the LPs involved. For the low-congestion routing problem, we regard routing requests placed randomly on a two-dimensional grid. We regard instances small enough to compute the optimum solutions via solving an integer linear program. We observe that randomized rounding with cardinality con- straints obtains reasonably good solutions. Surprisingly, unlike in previous experiments [5], we observe that the bit-wise randomized approach of [4] produces better results than the tree-based one of [21]. The gap to the optimum is roughly halved if we use a derandomization of randomized round- ing. Here, the derandomization of [21] obtained in [5] proved to be superior. In an attempt to fine-tune randomized rounding, we propose solving a second LP which gives the same congestion in the relaxation, but aims at making the solution easier to round. While this naturally does not give improved theoretical guarantees, it yields a good reduction of the rounding errors, in particular, in combination with the derandomization. This seems to be a fruitful approach whenever the additional cost of solving a second LP is admissible. Our analysis of maximum coverage shows that both randomized rounding and the greedy algorithm produce good results in general. However, for both there are instances showing the other behave much better. Analyzing the data produced in our experiments, we consider two paths to a hybrid approach. One way is to strengthen the derandomization to include a greedy component in variable selection, as a gradient-based rounding; the other, complementary, is to spend part of the budget greedily, and solve the remaining instance via an LP- and randomized rounding-approach. Both hybrids perform better than either of the two plain approaches alone; the gradient-based rounding performs particularly well. For a natural planar Euclidian version of the problem, we also give a PTAS. However, unlike for all other approaches used in this paper, the experimental results are not much better than the theoretical guarantees. In consequence, this is an alternative useful only if very good approxima- tions are needed and if computation power is available plentiful. 3 2 Randomized Rounding for Low-Congestion Routing 2.1 The Low-Congestion Routing Problem in Networks The low-congestion routing problem is one of the classical applications of randomized round- ing [20]. In its simplest version, the objective is to route a number of requests through a given network, minimizing the maximum usage of an edge ("congestion"). Problems of this type found all kinds of applications, an early one being routing wires in gate arrays [10]. We shall regard the following basic variant, previously regarded also in [8, 12, 19–21]. Given is a (directed) network G = (V, E), together with k routing requests. Each consists of a source vertex si, a target vertex ti and a demand ri. The objective is to find, for each i ∈ [k] := {1, . . . , k}, a flow from si to ti having flow value ri ∈ N, such that the congestion, that is, the maximum total flow over an edge, is minimized. This problem is easily formulated as integer linear program (ILP): We minimize the congestion C subject to the constraints k(cid:88) i=1 ∀e ∈ E : ∀i ∈ [k] : xie ≤ C (cid:88) xie − (cid:88) (cid:88) e=(v,si)∈E e=(si,v)∈E ∀i ∈ [k]∀v ∈ V \ {si, ti} : ∀i ∈ [k]∀e ∈ E : xie ∈ {0, 1}. xie = ri xie = (cid:88) e=(w,v)∈E e=(v,w)∈E (1) (2) (3) (4) xie We should add that [20] only regard the special case of all demands ri being one, since ran- domized rounding respecting cardinality constraints with right-hand side greater than one was not available at that time. For an application with particular need for larger ri, see the failure restoration problem in optical networks described in [8]. Also, we should add that other authors in addition have edge capacities ce and then minimize the relative congestion, but it is easily seen that this just replaces the C in the first type of constraints by ceC. · into a weighted sum fi =(cid:80) this implies(cid:80) such a way that the cardinality constraints(cid:80) (cid:80)k Since already the case of unit demands is NP-complete, optimal solutions seem difficult to obtain. The common solution concept is to (i) solve the linear relaxation of the ILP and obtain a fractionally optimal solution (x∗, C∗); (ii) use path stripping to decompose each flow fi encoded iP fP , where Pi is a finite set of si–ti paths, for each y∗ in x∗ P ∈ Pi, fP is the flow that has exactly one unit on each edge of P , and y∗ iP ∈ [0, 1]-note that all iP to yiP ∈ {0, 1} in yiP fP is a flow from si to ti with flow value ri. These flows form a solution having a congestion of P∈Pi,e∈P yiP . Large deviation bounds show that this congestion is not far C = maxe∈E from the value C∗ given by the relaxation [12, 20]: yiP = ri are maintained. Now(cid:80) (cid:19) y∗ iP = ri; (iii) use randomized rounding to round all y∗ (cid:80) (cid:18) P∈Pi P∈Pi P∈Pi P∈Pi i=1 log m C = O C = C∗ + O((cid:112)C∗ log m), if C∗ > log m. log(2 log m/C∗) , if C∗ ≤ log m; 4 Recall that C∗ is a lower bound for the optimal solution. Hence if C∗ is not too small compared to m, then this approach gives very good approximation factors. 2.2 Algorithms Used To approximately or exactly solve our test instances, we used the following algorithms. Whenever running times permitted, we used the exact ILP-Solver ILOG CPLEX 11.0 to directly solve the ILP given by (1) to (4). All other approaches involve solving the linear relaxation of the ILP (for which again we used CPLEX) and then different rounding methods. Since the ILP contains hard cardinality constraints, we cannot use the classical independent approach of Raghavan and Thompson (we did so, though, ignoring the cardinality constraints, to see if the cardinality constraints make rounding more difficult). There are two approaches to generate randomized roundings respecting cardinality constraints due to Srinivasan [21] and the first author [4]. Both can be derandomized [4, 5], so that in total we have four rounding methods available. See the original papers or [5] for a more detailed discussion of these methods. All algorithms different from CPLEX were implemented in C/C++. 2.3 Experimental Set-up To analyze the questions discussed in the introduction, we regarded the following type of in- stances. Motivated by the fact that many routing problems have a two-dimensional flavor (e.g., the wire routing problem of [10]), we chose a finite two-dimensional bi-directed grid. Note that this simple graph is far from trivial for routing, see, e.g., the thrilling one-turn routing conjecture in [10], which is, to the best of our knowledge still open. We choose routing requests randomly as follows. Both si and ti are chosen uniformly at random from V . To reduce otherwise the influence of randomness, we choose all demands in our main set of experiments as ri = 3; in a second set of experiments we pick each ri uniformly at random from {1, . . . , 5}. We also tried placing the si, ti uniformly at random on the outer border of the grid, but saw no significant differences. The size n of the grid and the number of demands k was varied to create different instance sizes and densities. All numerical values reported are the averages over at least 100 runs. The times were measured on AMD dual processor 2.4 GHz Opteron machines. 2.4 Analysis A summary of our results is presented in Tables 1 and 2. For the grid sizes 5×5, 10×10 and 15×15 together with demands ranging from 10 to 75, we state the average values of the congestion of an optimal solution (line 1 of each table) and the amounts by which a solution computed by one of the four randomized rounding approaches (lines 2, 3, 5, and 6) is worse (in percent). Lines 4 and 7 of the tables refer to an improvement discussed in the subsequent subsection. Particularly for instances that do show some congestion, we see that randomized rounding yields quite good solutions, much better than what the theoretical bounds would predict. Deran- domization is clearly worth the small extra effort (cf. the running times in Table 3), reducing the gap to the optimum by roughly a half. The results with randomly chosen demands in Table 2 are qualitatively similar to those with uniform demands in Table 1, with perhaps a generally some- what larger advantage for the derandomized algorithms. Comparing the different methods, surprisingly, our experiments generally show that the bit- wise randomized rounding approach of [4] (line 3) produced slightly better rounding errors than the tree-based one of [21] (line 2). We do not understand this phenomenon currently. Among the derandomizations, as expected and similarly as for random instances [5], the derandomization of the tree-based approach of [21] given in [5] is superior to the derandomization of the bit-wise one in [4]. This is due to the iterative nature of the latter, see again [5]. 25 6.21 10 3.37 50 10.98 5 × 5 75 14.76 Optimum RR [21] +9.23% +8.70% +7.29% +5.96% +7.13% +5.96% +5.01% +4.13% RR [4] RR+ +6.35% +4.99% +4.28% +2.64% DeRR [4] +3.77% +3.54% +2.37% +1.90% DeRR [5] +2.76% +1.93% +0.82% +0.88% DeRR+ +1.19% +1.13% +0.64% +0.47% 25 3.41 10 2.19 50 5.59 10 × 10 75 7.76 Optimum RR [21] +32.17% +39.88% +31.13% +24.48% +30.43% +36.07% +27.01% +19.07% RR [4] RR+ +31.85% +24.63% +18.60% +12.50% DeRR [4] +22.33% +25.81% +15.56% +10.95% DeRR [5] +16.38% +22.58% +11.63% +8.38% DeRR+ +11.81% +10.85% +7.87% +4.25% 5 25 2.73 50 4.11 10 1.98 15 × 15 75 Optimum 5.31 RR [21] +42.29% +58.97% +52.07% +45.70% RR [4] +40.31% +59.34% +46.94% +41.40% RR+ +40.26% +45.79% +36.98% +28.49% DeRR [4] +23.42% +38.10% +31.63% +25.81% DeRR [5] +13.76% +27.84% +21.90% +18.28% DeRR+ +16.59% +17.22% +18.49% +12.90% Table 1: Congestions achieved by the 7 different approaches for grid sizes 5 × 5, 10 × 10 and 15 × 15. All demands are chosen as ri = 3. The optimum was computed by solving the IP via CPLEX (not feasible for larger instances). For the other algorithms we state the relative increase of the congestion over the optimum. We also used classical independent randomized rounding. Clearly, this does not produce feasi- ble solutions in most cases. However, even ignoring this issue, we also observed that we typically have slightly larger congestions (e.g. in the sparse instance of 10 demands in a 15 × 15 grid, independent rounding lead to a congestion of 3.19 compared to congestions of 2.80 and 2.85 for the randomized approaches of [4] and [21]). Running times consumed by the different stages are mainly given in Table 3. All randomized rounding stages for each instance took less than 0.02 seconds. Less than a tenth of this is the time needed for the path-stripping in each instance. Hence these numbers are not given in the table. From the table, we see that the bit-wise derandomization takes about 20 times longer than the tree-based one, but both numbers are greatly dominated by the times for solving the LP (ignore the "Heur." line for the moment). 2.5 A Heuristic Making Life Easier for Randomized Rounding As can be seen from the results presented so far, the different randomized rounding approaches usually find solutions that are not far from the optimum. We now propose and analyze a heuristic way to improve the performance. The rough idea is simple. Having solved the linear relaxation of the ILP, we know the optimal (relaxed) congestion C∗ that can be achieved. The congestion we end up with stems from this C∗ plus possible rounding errors inflicted in the congestion constraints (1). It is clear that randomized rounding has a higher change to increase the congestion if there are many congestion constraints satisfied with equality in the relaxation. Therefore, the heuristic we suggest is to resolve the LP with the following modifications. Let δ ∈ [0, C∗] be a parameter open for fine-tuning. We replace the congestion constraints (1) by i=1 xie ≤ C∗ − δ + ze, where C∗ is the (fixed) optimal congestion obtained from the e∈E ze. Since the ze are at most δ, the flow given by a solution of this new LP also yields a congestion of at most C∗. However, the new objective punishes edges with total flow exceeding C∗ − δ. In consequence, the solution we obtain is also a solution for the original LP, but one that in addition tries to keep some room in the congestion constraints. ∀e ∈ E :(cid:80)k first LP and ze ∈ [0, δ] are new variables. The new objective is to minimize(cid:80) 6 25 6.65 10 3.79 50 11.08 5 × 5 75 Optimum 15.08 RR [21] +12.66% +9.47% +8.03% +6.03% RR [4] +8.71% +6.92% +5.23% +4.51% RR+ +6.60% +4.36% +3.34% +2.98% DeRR [4] +2.64% +2.86% +2.53% +1.92% DeRR [5] +1.58% +1.05% +0.99% +0.93% DeRR+ +0.79% +0.45% +0.63% +0.27% 25 3.70 10 2.60 50 5.86 10 × 10 75 Optimum 7.94 RR [21] +31.15% +39.73% +28.16% +23.93% RR [4] +27.69% +32.70% +22.70% +18.64% RR+ +18.08% +24.05% +15.19% +14.11% DeRR [4] +16.92% +21.62% +14.51% +11.34% DeRR [5] +8.85% +16.22% +10.58% +8.56% DeRR+ +6.15% +9.46% +6.14% +4.16% 50 4.29 25 2.99 10 2.19 15 × 15 75 Optimum 5.71 RR [21] +47.49% +55.52% +48.72% +40.28% RR [4] +43.38% +47.49% +41.26% +36.43% RR+ +39.73% +36.12% +36.13% +26.09% DeRR [4] +26.48% +31.22% +27.27% +20.49% DeRR [5] +19.18% +22.41% +22.14% +16.64% DeRR+ +17.81% +15.05% +16.78% +11.03% Table 2: Congestions achieved as in Table 1, but with demands chosen independantly and uniformly at random from ri ∈ {1, . . . , 5}. 50 25 10 5 × 5 75 IP (CPLEX) 0.0270 0.1076 0.343 0.776 LP (CPLEX) 0.0227 0.1078 0.301 0.697 0.0129 0.0380 0.065 0.096 Heur. DeRR [5] 0.0009 0.0006 0.0015 0.0028 DeRR [4] 0.0126 0.0270 0.0538 0.0589 50 25 10 10 × 10 75 IP (CPLEX) 0.3678 6.78 43.70 61.52 LP (CPLEX) 0.2349 4.71 32.03 34.02 0.6123 5.74 28.88 51.31 Heur. DeRR [5] 0.0061 0.012 0.018 0.018 DeRR [4] 0.1062 0.257 0.420 0.459 50 25 10 15 × 15 75 5.72 277.7 2057 7606 IP (CPLEX) 567 1135 LP (CPLEX) 1.61 48.7 9.42 131.6 Heur. 819 2755 0.026 0.044 0.063 0.07 DeRR [5] 0.375 0.973 1.371 1.67 DeRR [4] Table 3: Running times of the 5 algorithms in seconds. Given is the time for this particular step. For example, the running time of what is called "DeRR+" in Table 1 is the sum of the values in lines "LP", "DeRR" and "Heur.". 7 The experimental results are again presented in Table 1. Line 4 contains the results obtained by using randomized rounding as in [4] after applying the heuristic and line 7 does so with the derandomization of [5, 21]. We did the same experiments with the other two rounding algorithms. Since the results were mainly inferior (to a similar extent as without the improvement), we omitted these numbers in the table. In all experiments, we chose δ = 1. The results clearly show that using this heuristic can be worth the extra effort of solving a second LP. Apart from two instances with very small objective values 1.98 and 2.19, the heuristic always gains us a significant improvement. Surprisingly, these gains tend to be higher when using the derandomized rounding algorithm. It should be noted, though, that solving the second LP can be costly, as the numbers in Table 3 indicate. 3 Maximum Coverage: From Greedy and Rounding to Hybrid Approaches Another problem where dependent rounding has found application is the Maximum Coverage problem. In this problem, the input is a set {S1, . . . , Sn} of sets and a budget bound L. The task is to select a set of L sets to maximize the size of their union. Additionally, there can be costs ci associated with the sets, and weights or profits wi associated with the elements. In this case the task is to maximize the weighted sum of the covered elements, subject to the constraint that the total cost of the sets is at most L. For the unit-cost case (when all set costs are equal to one), a (1 − 1/e)-approximation can be produced easily, either through a greedy algorithm [3] or via randomized rounding [1, 21]; see below for details. This is also the best polynomial-time approximation ratio possible unless P=NP [6]. For the general case (with weighted budgets), essentially the same ratio is possible using both approaches, but some care has to be taken to handle sets of high cost [11, 21]. In this section, we report on experiments performed on max-coverage instances of various types and from different sources, comparing the behavior of the greedy and rounding-based al- gorithms. In addition, based on experiences from these experiments, we describe two forms of greedy/LP-rounding hybrid algorithms, and observe significantly improved solution qualities. We also consider a budget-preserving rounding, improving on that used in [21] (a similar improve- ment can be found in the so-called weighted dependent rounding of [7]). The algorithms, and our improvements to them, are described in Section 3.1. One important special case we consider is max-domination in unit disk graphs, correspond- ing to covering points in the plane under Euclidean distance. For this problem, we develop a PTAS (polynomial-time approximation scheme) as a further point of comparison. The PTAS and more information on the problem setting are given in Section 3.2. Some of our instances for this setting come from a real-world facility location problem [15], referenced by the OR Library web page [17]; as a source of more benchmark instances, we also convert facility location benchmarks, gathered at [22], to a max-coverage setting. See Section 3.3 for more information on our experi- mental setup. Thereafter, the rest of the section contains experimental outcomes and conclusions. 3.1 The Algorithms The greedy algorithm repeatedly selects a set fitting in the budget that maximizes the ratio of the profit of the newly covered elements to the cost of the set. In the unit-cost case, this is a (1− 1/e)- approximation [3]; with general costs, further modifications are needed, but for the case that the budget is large compared to the cost of the most expensive set, as will be the case in our experiments, it is still a good approximation [11]. 8 For the rounding-based approach, we phrase the problem as an ILP as follows (let n be the number of sets, and m the number of elements in the instance). m(cid:88) s.t. i=1 max wixi n(cid:88) ∀i ∈ [m] : xi ≤ (cid:88) ciyi ≤ L i=1 j:i∈Sj ∀i ∈ [m] : xi ∈ [0, 1] ∀i ∈ [n] : yi ∈ {0, 1} yj (5) (6) (7) (8) (9) ing the sum(cid:80) Let us first focus exclusively on the unit-cost case. Getting a randomized approximation for this case is simple. Solve the linear relaxation of the above formulation, and let (x∗, y∗) be an optimal solution, of value W ∗. Applying randomized rounding to y∗ with a cardinality constraint preserv- i now on expectation produces a (1 − 1/e)-approximation, due to the negative The derandomization works via the method of conditional expectation. Consider the expected correlation properties of the rounding [21]. outcome of independently rounding the variables y∗ above: i y∗ m(cid:88) i=1 wi(1 − (cid:89) j:i∈Sj F (y∗) = (1 − y∗ j )). (10) As shown by Ageev and Sviridenko [1], we can use F (y) directly as a guide for the derandom- ization, and produce a rounding y ∈ {0, 1}n of y∗, such that F (y) ≥ F (y∗). As F (y∗) ≥ (1 − 1/e)W ∗, the rounding y will be a (1 − 1/e)-approximation. As an additional alternative, we introduce gradient-based rounding. Recall that cardinality- preserving randomized rounding works by repeatedly considering pairs of non-integral variables and readjusting their values, maintaining the sum, such that one of them becomes integral (see e.g. [5]). By gradient-based rounding, we attempt to identify the best pair of variables to select for adjustment in each step. To truly find this pair would require O(n2) comparisons, each with cost O(m), but we can approximate the selection by considering the gradient of F (y). It is easy to show that if yi and yj are non-integral, and if ∂F (y) , then moving mass from yj to yi ∂yi will keep the value of F (y) non-decreasing. Thus we only need to compute and update the partial derivatives ∂F (y) , which can be done analytically at a cost of O(nm) per step, and we can in ∂yi every step pair off the variables with largest and smallest values of partial derivative. While the total complexity of the rounding process becomes O(n2m), as opposed to O(nm) for standard derandomized rounding, the time requirement is small in practice (see Section 3.4). ≥ ∂F (y) Returning to the issue of weighted (knapsack) budget constraints, Srinivasan gives a rounding procedure (Lemma 3.1 in [21]) that approximately preserves the value of a weighted sum of the rounded variables, while guaranteeing negative correlation properties as in the unit-cost case. However, the way in this is achieved for many settings causes infeasible running times. To solve the problem, we consider a budget-preserving rounding procedure, as follows. A similar rounding is found in the weighted dependent rounding used in [7]. ∂yj Theorem 1. Let y ∈ [0, 1]n such that(cid:80) rounding y ∈ {0, 1}n such that(cid:80) i ciyi = L. In polynomial time, one can compute a i ci yi ≤ L + maxi ci and F (y) ≥ F (y). Proof. We refer to e.g. [5] or [1] for a description of the non-weighted, cardinality-preserving rounding procedure. The only modification to this procedure is to replace the pair-rounding step, where variables yi and yj are adjusted so that one of them becomes integral. Here, instead of keeping yi+yj constant, we instead maintain ciyi+cjyj, that is, we change yi and yj to yi−(δ/ci) and yj + (δ/cj) for some appropriate δ. We will show that among any pair of adjustments in different directions, at least one keeps F (y) non-decreasing. Let F (y) be defined as (10), and let two non-integral variables yi and yj be selected, i < j, and define ga(δ) = F (y1, . . . , yi−1, yi + δ, . . . , yj − aδ, . . . , yn). 9 We show that for any a > 0, g(δ) is a convex function. Indeed, the only terms of g(δ) that are not constant or linear in δ correspond to elements x ∈ Si ∩ Sj: wx(1 − (1 − yi − δ)(1 − yj + aδ) (1 − yk) (cid:89) k:x∈Sk,k /∈{i,j} where the only non-linear term is c · δ2, for some constant c > 0. Thus one of the values g(−δ0) and g(δ1), for δi ≥ 0 are at least as large as g(0) = F (y), and the rounding search as in [1] can be performed. Finally, the maxi ci term occurs because we may end up with one single non-integral variable at the end of the process. As the first paragraph of this proof shows, to combine the gradient-based rounding with this rounding process we only have to divide each component i of the gradient by the corresponding cost ci before variable selection. 3.2 A Unit Disk Maximum Domination PTAS As a source of real-world instances, we consider a type of max-coverage instances derived from planar point set data. Given a set of points P = {p1, . . . , pn} in the plane and a diameter d, we define a graph (the unit disk intersection graph) by letting two points pi, pj be connected if and only if the Euclidean distance between them is at most d. In this graph, we consider the problem of max-domination, where selecting a vertex v covers v and all its neighbors. Interpreted as max- coverage, we thus get an instance where every vertex corresponds to one set and one element. All sets will have unit cost; the elements may have weights, interpreted as the profit of covering them. This problem is NP-hard, as follows from the hardness of Minimum Dominating Set in unit disk graphs [16]. However, it has good approximation properties-using tools known from the literature (e.g. [9]), we are able to provide a polynomial-time approximation scheme (PTAS). The PTAS follows the grid-based shifting strategy of Arora [2], as also applied to a related problem on the placement of wireless base stations by Glasser et al. [9]. We show the result for instances with unit costs and arbitrary profits, as this is closest to our instances, and having both costs and profits arbitrary makes the problem as hard as max-coverage. Theorem 2. For any (cid:96) > 1, the Max Domination problem on unit disk graphs with weighted vertices and unit costs admits a (1 − 2/(cid:96))-approximation in time nO((cid:96)2). Proof. Assume w.l.o.g. that the diameters of the disks is one, and divide the space into a regular grid with unit sides, so that every point resides in one grid box. Repeat the following for all values (cid:96)h, (cid:96)v ∈ {0, . . . , (cid:96) − 1}. Mark every (cid:96):th column, starting from number (cid:96)h, and every (cid:96):th row, starting from number (cid:96)v. Any point which is a member of a marked row or column gets payoff value 0. Now for every subgrid of side l + 1, framed by marked rows and columns, enumerate all optimal solutions as functions from the budget used to the payoff achieved. Since our concern is the unit-cost case, the number of such payoffs is bounded by the cardinal- ity of the solution which dominates all points, i.e., by the size of a minimum dominating set. This 10 in turn is bounded by the independence number, since a maximal independent set is dominating, which is O(l2), since each disk covers an area of O(1) and the subgrid has total area O(l2). Thus, we can in polynomial time create a vector of the O(l2) different payoff values that are received by investing a certain number t of sets in the current subgrid; for each such value t, the optimal solution can be found in nt+O(1) time by enumeration. Thus in nO(l2) time we can get the budget:payoff vectors for every framed subgrid. Thereafter, we can collect these vectors into a kind of knapsack problem, which can be solved by dynamic programming over subgrids and budget, i.e., f (i, t) being the best possible payoff for using t of the budget to cover vertices in the first i subgrids. Note that unmarked points in different framed subgrids must be covered by different points, and vice versa, an unmarked point can only be covered by a point in its framed subgrid. Thus a solution to the instance, after the marking step has been performed, decomposes into one solution per framed subgrid, and we are able to compute this optimally in polynomial time. Finally, every point is marked at exactly one value of (cid:96)h, thus for some shift value (cid:96)h at most a fraction 1/(cid:96) of the points are marked; by the same argument, for some value of (cid:96)v, at most a fraction 1/(cid:96) of the remaining points are marked. This means that there is a pair of shift values (cid:96)h, (cid:96)v for which the computed solution represents at least a fraction (1− 1/(cid:96))2 ≥ (1− 2/(cid:96)) of the optimal solution. In our implementation, we replace certain steps by an MIP solver, specifically the exhaustive enumeration phase for the subproblems, and the dynamic programming knapsack step. With these modifications, execution of the algorithm for non-trivial approximation ratios becomes possible. Unfortunately, we will see that even with these modifications, the PTAS approach is inferior to the greedy and rounding algorithms for realistic approximation settings. 3.3 Experimental Setup We perform experiments using the greedy algorithm and different combinations of LP-relaxation and rounding procedure. For the rounding, we use three variants. Recall that the expected value of a single randomized rounding equals F (y∗), and can thus (unlike in Section 2) be computed exactly. We consider three ways of boosting this value. The first is to simply apply randomized rounding 1000 times and pick the best result; the second is derandomization, using Srinivasan-type rounding directly on F (y), with arbitrary order of variable comparison. The third is the gradient-based rounding of Section 3.1. For problems with a weighted budget, we use the same three rounding methods, where the best-of-1000 and the derandomized roundings use Lemma 3.1 of [21], and the gradient-based rounding uses Theorem 1. Should a rounding exceed the budget constraint, we will greedily dis- card sets until the budget bound is reached. We use CPLEX for both LP- and ILP-solving; all other algorithms were implemented by the authors in C. Our instances are of two types. For the unit disk max-domination problem, we use bench- mark instances stemming from a real-world facility location problem, previously used in [18] and available at [15]. For these instances, a demand is provided with every point; we use these demands as profit values. To complement this, we use instances converted from facility location problems, in most cases downloaded from UflLib [22]. In both cases, we convert the instances to max-coverage by selecting an appropriate distance threshold for membership. In the case of the M* instances [14], the distances were pre-scaled by demand values, making the distances inappropriate for our use; we remove this scaling, and use the demands as profit values instead. 11 3.4 Experiments We now report the results of our experiments. To begin with, we show the running times of the different methods on various instances in Table 4. Note that the LP solver once again uses a significant fraction of our running time, and that performing many random roundings becomes more costly than derandomization, due to the need to evaluate the objective value for each solution. The low numbers for the gradient-based rounding, as compared to the derandomization, can partly be explained by the gradient-based rounding being problem-specific, while the derandomization uses general-purpose code. Table 5 shows results for some individual instances (described below). The first we want to highlight are the Chessboard and Finite Projective Plane (FPP) instances. These classes, proposed in [13], downloaded from [22], are not intended as examples of realistic real-world problems, but rather serve to reveal the differences between the different approximation approaches. The Chessboard instances are instances on a chessboard with side 3k, where the elements are the squares, and the sets are 3 × 3 subgrids (the set of squares reachable by a king within one step). For us, these instances serve as a test for whether an algorithm discovers an optimal tiling. The FPP instances are graphs of a regular degree but more complicated structure. Since all instances of these classes have equivalent combinatorial structure, we use only one instance per class in our experiments. In both cases, the budget is set at the most difficult setting, which turns out to be just where the LP-relaxation can cover all or almost all elements. The results immediately show the reason to pursue hybrid greedy/rounding algorithms. For the Chessboard instance, the LP-optimum is already integral, and thus every LP-rounding-based algorithm discovers an optimal solution. On the other hand, these instances are difficult for the greedy algorithm, as a few early mistakes, when all sets seem equivalent, will hurt the end tiling. In the FPP instances, however, we see the opposite effect. Here, upon inspection, we find that the LP-optimum is a useless mix of taking an equal, small amount of almost every variable, leaving all the work of finding a good integral solution up to the rounding. On the other hand, the greedy algorithm performs very well here; runs with an ILP-solver show that it is at most one step away from the optimum. We find that our proposed hybrid, the gradient-based rounding, produces consistent top-quality results in both test cases. We now focus on the unit disk max-domination problem, with instances as described in Sec- tion 3.2. We select the largest instance, with 818 points inscribed in a box of sides 6395 by 3975, and use a distance threshold of 400. This was chosen as a good balance, as too small or too large values (e.g., 100 resp. 800) creates too simple instances. Figure 1 shows the behavior of the main algorithms (excluding the PTAS) for this instance, as depending on the budget. Observe that the LP-rounding approach is very powerful for small budgets (up to 20), while further guidance is needed for larger budgets. The gradient-based LP-rounding, providing just such guidance, pro- duces top values throughout, frequently better than either the greedy or the standard rounding algorithms. This instance also appears in Tables 5 and 4 under the name br818-400 or br818- 400-L, where L is the budget bound. Another instance class of the same type is the k-median instances [22]. Here we use the one named 1000-10, with a threshold of 1000, occurring in Ta- bles 5 and 4 as kmed1-1k or kmed1-1k-L, with Figure 2 displaying the same data as Figure 1. Instance n br818-400-30 818 0.36s kmed1-1k-37 1000 0.97s MR1-060-16.5 500 0.36s 0.80s 1.46s 0.74s Table 4: Running times for various instances and algorithms; the times for the rounding methods exclude the time for solving the relaxation. LP Random-1000 Derand. Grad. rounding Greedy 0.33s 0.90s > 3600s 0.14s > 3600s 0.11s 0.22s 0.05s 0.09s 0.25s 0.04s IP 25s 12 Size Budget Greedy LP: once 1000 derand gradient Optimum Name 16 144 Chessboard 130 144 144 17 FPP (k = 17) 307 290 290 290 30 28054 28709 br818-400 818 28448 1000 993–95 37 kmed1-1k 962 948 500 16500 MR1-060 1445 1462–94 1444 144 230 22157 26199 27397 923 1402 709 817 1179 1254 144 210 144 200 Table 5: Experiments on single instances. The data is averaged over 100 runs where the input data is ran- domly permuted. The column "LP: once" shows the expected outcome of a single randomized rounding; the following three columns show our three rounding methods. The optimum gives the best upper and lower bound achieved by an IP solver after one hour of running time. In addition, Figure 2 contains a plot of the fraction of the solution weight covered by integrally chosen sets (the line "fixed" in the figure). The figure confirms that the LP-rounding approach is powerful for small budgets. For concerns of clutter, the PTAS is not included in the figures, but its data is given separately in Table 6. Note that for every feasible setting, the PTAS is both of lower quality and significantly slower than the alternatives. The k-median-instance is omitted, since we lack point data for it. Finally, we also consider an instance class with weighted budgets, namely the M* instances proposed in [14], again downloaded from [22]. These are instances with uniformly random dis- tances (i.e., random membership after conversion to max-coverage), but with facility costs (i.e., set costs) chosen so that facilities close to many customers are more expensive. The authors of [14] propose that such cost structures would arise in some real-world situations. Table 5 and Figure 3 give the results for instance MR1 with distance threshold 0.6, under the name MR1-060. In gen- eral for this class, we found that the greedy algorithm and the gradient-based rounding method produce practically identical results, while the other methods are inferior to this. 3.5 A Greedy/LP Hybrid. Motivated by our results, we consider a different, more general form of greedy/LP hybrid than the gradient rounding. Before we commence with the LP-rounding, we allocate some portion of the budget to greedy pre-selection, and apply the LP-relaxation and rounding using the remain- ing budget to the thus reduced problem. In Tables 7–9 we examine the performance of such a hybrid on the br818-400-30, kmed-1k-37, resp. MR1-060-16.5 instances. We see that such a hy- brid algorithm with a carefully chosen threshold can produce results superior to either the greedy or the rounding algorithm on their own. The benefits for the gradient-rounding approach seem less consistent, although improvement is visible for the kmed1-1k instance. We further report that with a pre-selection fraction of 0.3, both the Chessboard and the FPP instances of Table 5 receive optimal solutions. Instance br818-400-20 20742 br818-400-25 23008 br818-400-30 23951 PTAS ((cid:96) = 3) PTAS ((cid:96) = 5) PTAS ((cid:96) = 7) Greedy Value Time Value Time Value Time Value Value Time 69s 25247 26192 0.5s 71s 26907 27670 9s 74s 28054 28709 25s 1.3s 22857 1.2s 24683 1.3s 24909 9s 24129 9s 25308 10s 27270 IP Table 6: PTAS performance compared to the greedy algorithm and IP solver. 13 Rounding Algorithm Relaxation Integral part Expectation Random-1000 Derand Gradient LP 28447 Hybrid 0.1 28328 Hybrid 0.2 28476 Hybrid 0.3 28339 Hybrid 0.4 28215 Hybrid 0.5 28082 Hybrid 0.6 28058 Hybrid 0.7 28058 Hybrid 0.8 28054 Hybrid 0.9 28054 26251 27352 27500 27865 28365 28141 28339 28338 28215 28215 28050 28019 28048 28048 28058 28058 28054 28054 28054 28054 4646 12635 22921 28188 28215 27817 27970 28058 28054 28054 21871 24936 27189 28304 28215 26837 27530 28058 28054 28054 Table 7: Results for combining greedy pre-selection with randomized rounding, averaged over 100 runs, complete results. The data is for the instance br818-400-30, where the greedy algorithm alone produces value 28054. Rounding Algorithm Relaxation Integral part Expectation Random-1000 Derand Gradient LP 961 Hybrid 0.1 970 Hybrid 0.2 974 Hybrid 0.3 972 Hybrid 0.4 964 Hybrid 0.5 955 Hybrid 0.6 953 Hybrid 0.7 950 Hybrid 0.8 949 Hybrid 0.9 948 0.17 137 312 757 797 915 929 931 947 948 923 940 957 966 959 954 952 951 948 948 816 857 904 962 960 954 952 950 948 948 700 755 817 925 934 947 948 947 948 948 Table 8: Results for combining greedy pre-selection with randomized rounding, averaged over 100 runs, complete results. The data is for the instance kmed1-1k-37, where the greedy algorithm alone produces value 948. 14 Figure 1: Results for unit disk max-coverage instance br818-400. The plot shows the value of the LP- relaxation, the outcome of the three rounding methods, and the expected value of a single rounding against the greedy algorithm. The approximation bound shows (1 − 1/e) times the LP optimum. Bibliography [1] A. A. Ageev and M. Sviridenko. Pipage rounding: A new method of constructing algorithms with proven performance guarantee. J. Comb. Optim., 8:307–328, 2004. [2] S. Arora. Polynomial time approximation schemes for Euclidean traveling salesman and other geometric problems. J. ACM, 45:753–782, 1998. [3] G. Cornuejols, M. L. Fisher, and G. L. Nemhauser. Location of Bank Accounts to Optimize Float: An Analytic Study of Exact and Approximate Algorithms. Management Science, 23: 789–810, 1977. [4] B. Doerr. Generating randomized roundings with cardinality constraints and derandomiza- tions. In STACS 2006, Vol. 3884 of Lecture Notes in Computer Science, pp. 571–583, 2006. Springer-Verlag. [5] B. Doerr and M. Wahlstrom. Randomized rounding in the presence of a cardinality con- straint. In ALENEX 2009, pp. 162–174, 2009. [6] U. Feige. A threshold of ln n for approximating set cover. J. ACM, 45:634–652, 1998. [7] R. Gandhi, S. Khuller, S. Parthasarathy, and A. Srinivasan. Dependent rounding in bipartite graphs. In FOCS 2002, pp. 323–332, 2002. [8] R. Gandhi, S. Khuller, S. Parthasarathy, and A. Srinivasan. Dependent rounding and its applications to approximation algorithms. J. ACM, 53:324–360, 2006. [9] C. Glasser, S. Reith, and H. Vollmer. The complexity of base station positioning in cellular networks. Discrete Applied Mathematics, 148:1–12, 2005. [10] R. M. Karp, F. T. Leighton, R. L. Rivest, C. D. Thompson, U. V. Vazirani, and V. V. Vazirani. Global wire routing in two-dimensional arrays. Algorithmica, 2:113–129, 1987. 10000 12000 14000 16000 18000 20000 22000 24000 26000 28000 30000 15 20 25 30 35 40 45 50Solution valueBudgetbr818-400LP-relaxationLP+gradientLP+derandomizationLP+random (1000)LP-expectedGreedy algorithmApproximation bound 15 Figure 2: Experimental outcome for instance kmed1 with distance threshold 1000. The plot shows the value of the LP-relaxation, the outcome of the three rounding methods, and the expected value of a single rounding against the greedy algorithm. The approximation bound shows (1 − 1/e) times the LP optimum. Relaxation Integral part Expectation Random-1000 Derand Gradient LP 1446 Hybrid 0.1 1450 Hybrid 0.2 1443 Hybrid 0.3 1447 Hybrid 0.4 1448 Hybrid 0.5 1450 Hybrid 0.6 1441 Hybrid 0.7 1440 Hybrid 0.8 1440 Hybrid 0.9 1443 0 369 624 821 974 1109 1226 1355 1440 1443 1179 1232 1285 1316 1349 1381 1408 1431 1446 1443 Table 9: Average value and standard deviation for all ways to relax-and-round one instance (MR1, distance 0.6, budget 16500). The pure greedy algorithm gives 1444. LP bound is 1503, optimum between 1462 and 1494. Rounding Algorithm 1257 1301 1344 1371 1391 1413 1432 1443 1440 1443 1381 1402 1421 1413 1432 1436 1438 1440 1445 1442 0 200 400 600 800 1000 0 5 10 15 20 25 30 35 40 45Solution valueBudgetkmed1-1kLP-relaxationLP+gradientLP+dsriLP+random (1000)LP-expectedLP-fixedGreedyApproximation bound 16 Figure 3: Experimental outcome for instance MR1 with distance threshold 0.6. The plot shows the value of the LP-relaxation, the outcome of the three rounding methods, and the expected value of a single rounding against the greedy algorithm. The approximation bound shows (1 − 1/e) times the LP optimum. 600 800 1000 1200 1400 1600 6000 8000 10000 12000 14000 16000 18000 20000Solution valueBudgetMR1-0.60LP-relaxationLP+gradientLP+dsriLP+random (1000)LP-expectedGreedyApproximation bound [11] S. Khuller, A. Moss, and J. S. Naor. The budgeted maximum coverage problem. Information Processing Letters, 70:39–45, 1999. [12] J. Kleinberg. Approximation Algorithms for Disjoint Paths Problems. PhD thesis, MIT, 17 1996. html. [13] Y. Kochetov and D. Ivanenko. Computationally difficult instances for the uncapacitated facility location problem. In Proceedings of the 5th Metaheuristic Conference (MIC 2003), 2003. [14] J. Kratica, D. Toic, V. Filipovi, and I. Ljubi. Solving the simple plant location problem by genetic algorithm. RAIRO Oper. Res., 35:127–142, 2001. URL http://www.lac.inpe.br/lorena/ [15] L.A.N.Lorena-instancias. instancias.html. [16] S. Masuyama, T. Ibaraki, and T. Hasegawa. Computational complexity of the m-center problems on the plane. Transactions of the Institute of Electronics and Communication Engineers of Japan. Section E, E64:57–64, 1981. [17] OR-Library. URL http://people.brunel.ac.uk/mastjjb/jeb/info. [18] M. A. Pereira, L. A. N. Lorena, and E. L. F. Senne. A column generation approach for the maximal covering location problem. International Transactions in Operational Research, 14:349–364, 2007. [19] P. Raghavan. Probabilistic construction of deterministic algorithms: Approximating packing integer programs. J. Comput. Syst. Sci., 37:130–143, 1988. [20] P. Raghavan and C. D. Thompson. Randomized rounding: A technique for provably good algorithms and algorithmic proofs. Combinatorica, 7:365–374, 1987. [21] A. Srinivasan. Distributions on level-sets with applications to approximations algorithms. [22] UflLib. URL http://www.mpi-inf.mpg.de/departments/d1/projects/ In FOCS 2001, pp. 588–597, 2001. benchmarks/UflLib/.
1504.02420
1
1504
2015-04-09T18:54:57
Algorithms for the workflow satisfiability problem engineered for counting constraints
[ "cs.DS", "cs.CR" ]
The workflow satisfiability problem (WSP) asks whether there exists an assignment of authorized users to the steps in a workflow specification that satisfies the constraints in the specification. The problem is NP-hard in general, but several subclasses of the problem are known to be fixed-parameter tractable (FPT) when parameterized by the number of steps in the specification. In this paper, we consider the WSP with user-independent counting constraints, a large class of constraints for which the WSP is known to be FPT. We describe an efficient implementation of an FPT algorithm for solving this subclass of the WSP and an experimental evaluation of this algorithm. The algorithm iteratively generates all equivalence classes of possible partial solutions until, whenever possible, it finds a complete solution to the problem. We also provide a reduction from a WSP instance to a pseudo-Boolean SAT instance. We apply this reduction to the instances used in our experiments and solve the resulting PB SAT problems using SAT4J, a PB SAT solver. We compare the performance of our algorithm with that of SAT4J and discuss which of the two approaches would be more effective in practice.
cs.DS
cs
Algorithms for the workflow satisfiability problem engineered for counting constraints D. Cohen∗, J. Crampton†, A. Gagarin‡, G. Gutin§, M. Jones¶ Royal Holloway, University of London, Egham, Surrey, TW20 0EX, UK November 5, 2018 Abstract The workflow satisfiability problem (WSP) asks whether there exists an assign- ment of authorized users to the steps in a workflow specification that satisfies the constraints in the specification. The problem is NP-hard in general, but several subclasses of the problem are known to be fixed-parameter tractable (FPT) when parameterized by the number of steps in the specification. In this paper, we consider the WSP with user-independent counting constraints, a large class of constraints for which the WSP is known to be FPT. We describe an efficient implementation of an FPT algorithm for solving this subclass of the WSP and an experimental evaluation of this algorithm. The algorithm iteratively generates all equivalence classes of pos- sible partial solutions until, whenever possible, it finds a complete solution to the problem. We also provide a reduction from a WSP instance to a pseudo-Boolean SAT instance. We apply this reduction to the instances used in our experiments and solve the resulting PB SAT problems using SAT4J, a PB SAT solver. We compare the performance of our algorithm with that of SAT4J and discuss which of the two approaches would be more effective in practice. Keywords: Workflow satisfiability problem (WSP); fixed-parameter tractability (FPT); algorithm engineering; reduction to the pseudo-Boolean SAT problem; user-independent constraints 1 Introduction It is increasingly common for organizations to computerize their business and management processes. The co-ordination of the steps that comprise a computerized business process is managed by a workflow management system. Typically, the execution of these steps will be triggered by a human user, or a software agent acting under the control of a human ∗e-mail: [email protected] †e-mail: [email protected] ‡e-mail: [email protected] §e-mail: [email protected] ¶e-mail: [email protected] 1 user, and the execution of each step will be restricted to some set of authorized users or agents. In addition, one may wish to constrain the users who execute certain sets of steps, even if authorized. We may, for example, require that two particular steps are executed by two different users, in order to enforce some separation-of-duty requirement; or by the same user, to respect a binding-of-duty requirement. We model a workflow as follows. We have a set of steps S, each of which must be performed by some user in a set U of users. We restrict the users that can perform each step with a set of authorization lists, A = {A(u) : u ∈ U}, where A(u) ⊆ S denotes the set of steps that user u is authorized to perform. Furthermore we must also satisfy a set C of (business) constraints. In general, a constraint can be described as a pair c = (T, Θ), where T ⊆ S and Θ is a set of functions from T to U : T is the scope of the constraint and Θ specifies those assignments of steps in T to users in U that satisfy the constraint. Given a workflow W = (S, U,A, C), W is said to be satisfiable if there exists a function π : S → U such that 1. for all s ∈ S, s ∈ A(π(s)) (each step is allocated to an authorized user); 2. for all (T, Θ) ∈ C, πT ∈ Θ (every constraint is satisfied). Such a function π : S → U is called a valid complete plan. Evidently, it is possible to specify a workflow that is not satisfiable. Hence, it is important to be able to determine whether a workflow is satisfiable or not. This is called the workflow satisfiability problem (WSP). This problem has been studied extensively in the security research community [4, 8, 22] and more recently as an interesting algorithmic problem [7, 10]. As an example, consider the following instance of the WSP introoduced in [7]. Instance 1. The task set S = {s1, . . . , s4} and the user set U = {u1, . . . , u6}. The autho- rization lists are as follows (where a tick indicates that the given user is authorized for the given task): u1 u2 u3 u4 u5 u6 s1   s2 s3 s4           The constraints are (s1, s2, =), (s2, s3,(cid:54)=), (s3, s4,(cid:54)=), and (s1, s4,(cid:54)=), where (si, sj, =) means that si and sj must be assigned to the same user and (si, sj,(cid:54)=) means that si and sj must be assigned to different users. A function π : T → Y , where T ⊆ S and Y ⊆ U , is called a partial plan. A partial plan π is authorized if s ∈ A(π(s)) for every s ∈ T . A partial plan π is eligible if it does not violate any constraint in C, and π is valid if it is both authorized and eligible. In other words, a valid partial plan could, in principle, be extended to a valid complete plan. Example 1 illustrates the meanings of eligible, complete and authorised plans in the context of Instance 1. Example 1. The following table gives assignments for four plans, π1, π2, π3, π4: 2 s1 s2 s3 s4 Authorized Eligible Complete π1 u1 u2 u4 u5  π2 u1 u1 u4 u5 u4 u5  π3 u1 π4 u2 u2 u4 u5  -       • π1 is a complete plan which is authorized but not eligible, as s1 and s2 are assigned to different users. • π2 is a complete plan which is eligible but not authorized, as u1 is not authorized for s2. • π3 is a plan which is authorized and eligible, and therefore valid. However, π3 is not a complete plan as there is no assignment for s2. • π4 is a complete plan which is eligible and authorized. Thus π4 is a valid complete plan, and is therefore a solution. The WSP is known to be NP-hard [22] in general: it is easily shown to be NP-hard even if restricted to simple separation-of-duty constraints. Wang and Li [22] observed that, in practice, the number k of steps is usually significantly smaller than the number n of users and, thus, suggested parameterizing the WSP by the number of steps k. Also, they showed that, in general, the WSP is W[1]-hard, but is fixed-parameter tractable (FPT) for certain classes of constraints. In other words, for some classes of constraints, the WSP can be solved in time O∗(f (k)), where f is an arbitrary function of k only, and O∗ suppresses not only constants, but also polynomial factors. Such algorithms are called FPT. For further terminology on parameterized algorithms and complexity, see monographs [11, 14, 18]. Since the problem is intractable in its generality and covers a vast number of different types of constraints, it is natural to restrict attention to some WSP subclasses defined by the types and properties of constraints. Many business rules are not concerned with the identities of the users that complete a set of steps. Accordingly, we say a constraint c = (T, Θ) is user-independent if, whenever θ ∈ Θ and φ : U → U is a permutation, then φθ ∈ Θ. In other words, given a plan π that satisfies c and any permutation φ : U → U , the plan π(cid:48) : S → U , where π(cid:48)(s) = φ(π(s)), also satisfies c. The most obvious example of a user-independent constraint is the requirement that two steps are performed by different users or, in other words, by exactly two users (separation- of-duty). A more complex example might require that at least/at most/exactly r users are required to complete some sensitive set of steps (cardinality or counting constraints), where r is usually small, normally less than 5. A constraint that a particular user u has to perform at least three steps, is not user-independent. There is a substantial literature on constraints as a method for specifying and enforcing business rules (see [15], for example), including work by researchers at SAP and IBM (see [2, 23], for example). The most widely studied constraints are counting and separation- of-duty constraints, which form part of the ANSI standard on role-based access control (RBAC) [1], developed by the US National Institute of Standards and Technology (NIST). In short, the literature and relevant standards suggest that user-independent constraints are the constraints of most interest in business processing and workflow management systems. In particular, all the constraints defined in the ANSI RBAC standard are user-independent. 3 1.1 FPT results and analysis One of the motivations for this research was to show that the generic FPT algorithm of Cohen et al. [7] is not merely of theoretical interest. The gap between traditional "pen- and-paper" algorithmics and actually implemented computer-feasible algorithms can be enormous [5, 17]. In this paper, we demonstrate that the generic FPT algorithm of [7] has practical value and its implementations are able to outperform the well-known PB SAT solver SAT4J [16]. Crampton et al. [10] extended the FPT classes of [22] and obtained more efficient algorithms than in [22]. Recently, Cohen et al. [7] described a new generic algorithm to solve some classes of the WSP. In particular, they proved that their generic algorithm is FPT for the WSP restricted to the class of user-independent constraints. Almost all constraints studied in [10, 22] and other papers are user-independent. Since separation-of- duty constraints are user-independent, the WSP restricted to the class of user-independent constraints remains NP-hard [22]. In this paper we present two different approaches to solve the WSP with user-independent counting constraints, describe their implementations, and compare their experimental out- comes. First, we describe an adaptation of the general FPT algorithm of [7] to the case of the WSP with user-independent constraints and develop its implementation in the case of counting constraints. We then describe a reduction of WSP instances with user-independent counting constraints to a pseudo-Boolean (PB) SAT problem and prove its correctness. This solution approach is similar to the one presented in [22]. In this approach, a PB SAT solver is used as a black box solver for our WSP instances. We compare the performance of the two approaches in a set of computational exper- iments. While Wang and Li [22] provided experimental evaluation for their reduction to PB SAT, they did not provide any experimental evaluation for their FPT algorithm for the WSP. Our paper therefore represents the first experimental evaluation of an FPT algorithm designed specifically for the WSP. Our results show that for more challenging well-constrained WSP instances, the FPT algorithm of [7] is more effective and efficient than the reduction to a PB SAT problem. In fact, the PB SAT solver (SAT4J) was unable to solve several WSP instances, usually because of excessive memory requirements. On the other hand, for lightly-constrained WSP instances, the PB SAT solver usually outperforms our implementations of the FPT algorithm. 1.2 Paper organization The paper is organized as follows. In Section 2, we describe our generic FPT algorithm and, in Section 3, we describe and discuss its implementation. In Section 4, we describe how the family of WSP instances we consider can be formulated as a pseudo-Boolean SAT problem. Section 5 describes test experiments which we have conducted with synthetic data to compare our implementations of the FPT algorithm to SAT4J. Finally, Section 6 provides conclusions and discusses plans for future work. The main differences between this paper and the preliminary version [6] are as follows. In Sections 2, the generic algorithm for solving user-independent constraints is described. In Section 3, its implementation for counting constraints is explained, with a formal proof in Theorem 1 that some users can be skipped during the iteration of the algorithm. A new heuristic speed-up for the FPT algorithm using pairs of intersecting constraints is 4 described in Subsection 3.3. We have also conducted a new set of experimental tests, using a new implementation of the FPT algorithm (Section 5). 2 Generic FPT algorithm for the WSP In this section we describe how the FPT algorithm of [7] works in the WSP case with user-independent constraints. As mentioned above, one of the distinctive features of the WSP is that the number k = S of steps is significantly smaller than the number n = U of users, which allows us to design efficient FPT algorithms using k as a parameter. The algorithm presented here iteratively considers users one-by-one and gradually generates all possible partial solutions, where two solutions are treated as identical if they satisfy a certain equivalence relation, defined below. The algorithm continues until it finds a valid complete plan, or all the users have been considered. Before we give an overview of the algorithm, we introduce some definitions. For user-independent constraints, two partial plans π : T → Y and π(cid:48) : T (cid:48) → Y (cid:48) are equivalent, denoted by π ≈ π(cid:48), if and only if T = T (cid:48), and for all s, t ∈ T , π(s) = π(t) if and only if π(cid:48)(s) = π(cid:48)(t). In other words, equivalent partial plans π and π(cid:48) both assign the same steps T and a set of steps is assigned to a single user by π if and only if π(cid:48) also assigns those steps to a single (possibly different) user. Without loss of generality, we may assume the set of steps S is ordered as s1, . . . , sk. Each equivalence class L of partial plans corresponds to a unique pattern p, which is a unique encoding of that class. More precisely, the encoding p = Enc(L) of an equivalence class L of partial plans for ≈ is given by p = (T, (x1, . . . , xk)), where for any plan π ∈ L, we have that π : T → Y for some Y ⊆ U , and for each i ∈ [k]: 0 1 xj max{x1, . . . , xi−1} + 1 otherwise. if si (cid:54)∈ T , if i = 1 and s1 ∈ T , if π(si) = π(sj) and j < i,  xi = The vector (x1, . . . , xk) is called a min-vector, representing a partition of the steps in T such that each block in the partition is assigned to a single user and each block is assigned to a different user. We will also write p = Enc(π) to represent the fact that p is the pattern of π, i.e. p = Enc(L), where L is the equivalence class containing the plan π. A pattern p is authorized (eligible, valid, respectively) if there is a plan π which is authorized (eligible, valid, respectively) for which p = Enc(π). For our FPT algorithm, we require efficient algorithms for searching and inserting elements into a set of patterns. Cohen et al. [7] have shown that such algorithms exist for user-independent constraints, essentially because this set of patterns admits a natural lexicographic ordering. 2.1 Algorithm for the WSP with user-independent constraints The pseudo-code in Algorithm 1 presents an adaptation of the generic FPT algorithm of [7] to the WSP case with user-independent constraints. The pseudo-code omits some 5 details concerning heuristics we use to speed up the running time. We give details of these heuristics in Section 3. The algorithm considers users one at a time, in some order u1, . . . , un. The order of users may be changed dynamically -- that is, after processing user i, we may change the ordering of users ui+1, . . . , un. We do this in order to move to a possible solution more efficiently by restricting the search space of currently valid patterns. The details of the dynamic ordering are given in Section 3.5. As well as prioritising some users by moving them to earlier in the order, we identify some users (called the useless users) which we may assume perform no steps at all, and therefore do not need to be processed. The details about useless users are given in Section 3.4. As we process the users, we produce a set Π of potential partial solutions and a set P of encodings of these solutions. More precisely: after processing user ui, the set Π is a set of valid partial plans which only assign steps to users from {u1, . . . , ui}. The set P is the set of encodings of plans in Π, and for each p ∈ P there is exactly one plan πp ∈ Π such that p = Enc(πp). For any valid partial plan π that assigns steps only to users from {u1, . . . , ui}, there exists p ∈ P such that p = Enc(π). Thus, P is a set of encodings of all valid partial plans with user set contained in {u1, . . . , ui}. At each iteration, having processed users u1, . . . ui, we try to assign to the next user ui+1 a set T (cid:48) of steps unassigned by an existing valid plan in Π, in order to obtain a new valid partial plan. The new user ui+1 must be authorized for each step in T (cid:48). At the same time as we construct the new plan, we calculate its pattern. If the resulting plan is eligible (and therefore, valid at this stage), and if its pattern is not already in P , we add the plan to Π and its pattern to P . If the resulting plan covers all steps in S, we have a solution to the WSP instance. The overall complexity of the algorithm is determined by k, n, and the number wi of patterns (equivalence classes of ≈) considered by the algorithm for a pair (Ui, T ), where Ui = {u1, . . . , ui} is the set of the first i users in iteration, i = 1, . . . , n, T ⊆ S. We define the diversity of the equivalence relation ≈ with respect to an order of users u1, . . . , un to be w = max1≤i≤n wi. Theorem 1 in [7] asserts that our algorithm has run-time O∗(3kw log w). Thus, when w is a function of k only, we have an FPT algorithm. For user-independent constraints, w (cid:54) Bk [7], where Bk is the kth Bell number, and Bk = 2k log k(1−o(1)) [3]. 3 Implementing the FPT algorithm We provide more details of our implementation of Algorithm 1 below. For our experiments, we use not-equals, at-most-r, and at-least-r constraints. A not-equals constraint (s, t,(cid:54)=) is specified by a pair of steps s and t; a plan π satisfies the constraint (s, t,(cid:54)=) if π(s) (cid:54)= π(t). An at-most-r constraint may be represented as a tuple (r, Q, (cid:54)), where Q ⊆ S and 1 (cid:54) r (cid:54) Q, and is satisfied by any plan that allocates no more than r users in total to the steps in Q. An at-least-r constraint may be represented as (r, Q, (cid:62)) and is satisfied by any plan that allocates at least r users to the steps in Q. Note that these at-most and at-least constraints impose "confidentiality" and "diversity" requirements on the workflow, which can be important in a business environment. Our implementation therefore includes some heuristics specifically designed for these constraints. In this section we describe the main ideas used for implementing the FPT algorithm, and heuristic speed-ups that have been introduced to make implementations competitive with and more efficient than SAT4J on the reduction to the PB SAT problem 6 Algorithm 1: FPT algorithm for the WSP with user-independent counting con- straints Input: Instance of WSP Output: SATISFIABLE and a valid plan, or UNSATISFIABLE. 1 begin 2 Initialize the set Π of plans with the trivial plan π : ∅ → ∅; Initialize the set P of patterns with the zero-pattern (∅, (0, . . . , 0)); If possible, derive new constraints from given constraints (e.g., see Section 3.3); foreach u ∈ U do Initialize Πu = ∅; Initialize Pu = ∅; Preprocess constraints (see Section 3.1); foreach pattern p = (T, (x1, . . . , xk)) in P do Tu ← A(u) \ T ; foreach ∅ (cid:54)= T (cid:48) ⊆ Tu do Let πp be a plan with pattern p in Π; π(cid:48) ← πp ∪ (T (cid:48) → u); Preprocess constraints (see Section 3.1); Check whether π(cid:48) is eligible and propagate constraints (see Sections 3.2 and 3.3); if π(cid:48) is eligible then 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 if T ∪ T (cid:48) = S then return SATISFIABLE and π(cid:48); else Compute the pattern p(cid:48) for π(cid:48); if p(cid:48) (cid:54)∈ P ∪ Pu then Add π(cid:48) to Πu; Add p(cid:48) to Pu; end end end end end if Πu = ∅ then foreach u(cid:48) such that A(u(cid:48)) ⊆ A(u) do U ← U \ {u(cid:48)} (Remove useless users, see Section 3.4); else end Π ← Π ∪ Πu; P ← P ∪ Pu; end Choose a user for the next iteration (see Section 3.5); end return UNSATISFIABLE; 39 40 end 7 of Theorem 2. Note that only the heuristics referred to in lines 8, 14 and 15 are specific to not-equals, at-most-r, and at-least-r constraints. Without these heuristics, Algorithm 1 becomes a generic algorithm for any user-independent constraints. 3.1 Preprocessing and eligibility checking Not-equals and at-least-r constraints are preprocessed in the outer loop on a per-user basis in line 8: only at-least-r constraints containing some steps authorized to the current user and not-equals constraints with both steps authorized to the current user are passed into the inner loops for eligibility checking and propagation. At-least-r constraints are also preprocessed per-pattern to guarantee their efficient checking in the inner loop (line 14): only at-least-r constraints containing steps from T (cid:48) are chosen to be used for eligibility checking. At-most-r constraints are not preprocessed, but checked directly for violation and propagated in combination with not-equals constraints as explained later (line 15). Much of the work of the implementation of the algorithm is done in line 16: we consider a plan πp with a given valid pattern p and test whether its authorized extension (by the assignment of steps in T (cid:48) to user u) is eligible. Line 10 guarantees that we deal only with authorized plans. In computational experiments, at-most-r and not-equals constraints reject a much larger proportion of candidates for a valid plan than at-least-r constraints. In other words, they are much easier to violate than at-least-r constraints. Since not-equals constraints are preprocessed per-user for efficient checking, and at-most-r constraints are not preprocessed but used for propagation and more efficient dynamic iteration by users, the constraints are checked in the following order: (1) not-equals constraints; (2) at-most-r constraints; (3) at-least-r constraints. At the same time as we check at-most-r constraints, we also propagate at-most-r constraints and pairs of intersecting at-most-r constraints; see the next two sections. The pattern for the extended valid plan is computed and added to the set Pu of extended patterns in line 20. Results by Cohen et al. [7] assert that these subroutines can be performed efficiently. 3.2 Constraint propagation After checking that a partial plan π ∪ (T (cid:48) → u) does not violate at-most-r constraints directly, we propagate information (line 15) about the current state of any at-most-r con- straint as follows. Suppose (cid:96) steps in a constraint c = (r, Q, (cid:54)) have been assigned to r − 1 distinct users in π ∪ (T (cid:48) → u), and (cid:96) ≤ c − 2. Then the remaining q = c − (cid:96) ≥ 2 steps in Q must be assigned to a single user. If there is no remaining user u(cid:48)(cid:48) authorized for all q unassigned steps in Q, we discard the partial plan π ∪ (T (cid:48) → u) and its pattern. Similarly, if any pair of the q unassigned steps in Q is the scope of some not-equals constraint, we discard the partial plan and its pattern. On the other hand, if such a user u(cid:48)(cid:48) authorized for all the unassigned steps in an at-most-r constraint c is found, it is called useful and may be given priority to be used in the next iteration. Pairs of intersecting at-most-r constraints are also propagated at this time; see the next section. 3.3 Propagating pairs of intersecting at-most-r constraints The latest implementations of the algorithm propagate information about pairs of inter- secting at-most-r constraints -- that is, pairs of constraints with overlapping sets of steps 8 (earlier implementations considered only pairs of at-most-r constraints intersecting in at least two steps). In line 4, before starting the iteration, pairs of intersecting at-most-r constraints are recorded separately, with one of the common steps marked. The pairs are propagated during line 15 when the marked common step is unassigned. In this case, we need to find at least one user u(cid:48)(cid:48) authorized for all unassigned steps in both constraints compising the pair as follows. Suppose c1 = (r1, Q1, (cid:54)) and c2 = (r2, Q2, (cid:54)) are the two constraints comprising a pair, Q1 ∩ Q2 (cid:54)= ∅, and the marked intersection step is s ∈ Q1 ∩ Q2. As above, suppose (cid:96)i steps in a constraint ci = (ri, Qi, (cid:54)) are assigned to ri − 1 distinct users in π ∪ (T (cid:48) → u), (cid:96)i ≤ ci − 2, and the remaining qi = ci − (cid:96)i ≥ 2 steps in Qi must be assigned to a single user, i = 1, 2. Moreover, suppose the step s ∈ Q1 ∩ Q2 is unassigned in π ∪ (T (cid:48) → u). Then the q1 unassigned steps in c1 and the q2 unassigned steps in c2 must be assigned to the same single user u(cid:48)(cid:48) in a later iteration. Furthermore, u(cid:48)(cid:48) must be authorized for all the unassigned steps in c1 and c2. If such a user u(cid:48)(cid:48) is not available among the remaining users, or if any pair of the unassigned steps in Q1 ∪ Q2 is the scope of some not-equals constraint, we discard the partial plan π ∪ (T (cid:48) → u) and its pattern. On the other hand, a user u(cid:48)(cid:48) authorized for all the unassigned steps in a pair of intersecting at-most-r constraints is called super-useful and may be given priority to be used for the next iteration. 3.4 Useless users Each iteration of the algorithm considers assigning some steps to a particular user u and constructs a set Pu of extended valid patterns and, respectively, a set Πu of partial plans that include this user u. The construction of Pu and Πu is based on patterns in the set P generated after the previous iterations, constraints in C, and the list of authorizations A(u) of u. Suppose Πu(cid:48) is a set of plans in Algorithm 1 used for a later iteration, when another user u(cid:48) is considered, and A(u(cid:48)) ⊆ A(u). Then, Πu = ∅ implies Πu(cid:48) = ∅, i.e. such a user u(cid:48) can be disregarded later in the iteration. The reason for this is that any steps assigned to u(cid:48) could instead be assigned to u. We justify this claim formally with the following result. Theorem 1. Suppose Algorithm 1 considers users in the order u1, u2, . . . , un to solve a WSP instance (S, U,A, C) with user-independent constraints C. Suppose also that Πui = ∅ for some user ui (line 29), i ≥ 1, and a user uj ∈ {ui+1, . . . , un} has A(uj) ⊆ A(ui). Then Πuj = ∅. Proof: Suppose for a contradiction that Πuj (cid:54)= ∅. Then Πuj contains a valid partial plan π : T → {u1, . . . , uj} for some T ⊆ S. By definition of Πuj , π−1(uj) (cid:54)= ∅, and π (cid:54)≈ π(cid:48) for any valid partial plan π(cid:48) : T → {u1, . . . , uj−1} (as otherwise π would not have been added to Πuj ). : T (cid:48) → {u1, . . . , ui}, where T (cid:48) = π−1({u1, . . . , ui}). Clearly, πi is a valid partial plan that corresponds to a pattern p encoding the equivalence class L of πi. Since Πui = ∅ in line 29 of Algorithm 1, there is an authorized and eligible partial plan πi−1 ∈ Π having the same pattern p as πi that does not use the user ui, i.e. πi−1 : T (cid:48) → {u1, . . . , ui−1}, and πi−1 ≈ πi. Now let πi+1 be π restricted to {ui+1, . . . , uj}, i.e. πi+1 : T\T (cid:48) → {ui+1, . . . , uj}, where the set of steps T (cid:48) is the same as covered by πi and πi−1. Consider π(cid:48) = πi−1 ∪ πi+1. Since π = πi ∪ πi+1 and πi−1 ≈ πi, we have that π ≈ π(cid:48). It follows that π(cid:48) is eligible and, by construction, π(cid:48) is authorized. Therefore we have a valid partial plan π(cid:48) : T → {u1, . . . , uj} such that π(cid:48) ≈ π and π(cid:48)−1(ui) = ∅. Let πi be the plan π restricted to {u1, . . . , ui}, i.e. πi 9 Finally, let π(cid:48)(cid:48) be a plan obtained from π(cid:48) by reassigning all the steps assigned to uj in π(cid:48) to the user ui. Clearly, this is possible because A(uj) ⊆ A(ui). In other words, we respect authorizations in π(cid:48)(cid:48) and have π(cid:48)(cid:48)−1(ui) = π(cid:48)−1(uj), π(cid:48)(cid:48)−1(uj) = ∅. Since π(cid:48)(cid:48) can be obtained from π(cid:48) by a permutation of two users, ui and uj, and all the constraints are user-independent, π(cid:48)(cid:48) is eligible and π(cid:48)(cid:48) ≈ π(cid:48) ≈ π. Thus, we have a valid partial plan π(cid:48)(cid:48) : T → {u1, . . . , uj−1} such that π(cid:48)(cid:48) ≈ π, a contra- diction. We say a user u(cid:48) is useless for the current iteration if there exists a user u such that A(u(cid:48)) ⊆ A(u), u has been considered in iteration earlier, and Πu = ∅ in line 29 of Algo- rithm 1. Theorem 1 implies that, if we discover a useless user u(cid:48) in Algorithm 1, without loss of generality, we may assume that there are no steps assigned to this user u(cid:48) in a final solution (a complete valid plan). One of the heuristic speed-ups we employ is to identify and ignore useless users (line 31). This is the only heuristic speed-up used in implementations of Algorithm 1 that has a deterministic nature and requires a proof of its correctness. 3.5 Dynamic choice of users in iteration (useful users) In an effort to satisfy some of the at-most-r constraints and to reduce the number of unas- signed steps in partial plans as quickly as possible, useful or super-useful users identified during the propagation in line 15 are used to perform the next iteration. The priority can be given, for example, to a useful user satisfying at least two at-most-r constraints independently, or the first detected super-useful user, or a super-useful user covering the largest number of steps in the corresponding at-most-r constraints, etc. The chosen useful user is moved to the beginning of the list of remaining users, and the list of remaining users is adjusted accordingly (line 37). This determines a dynamic ordering on the set of users through which the algorithm iterates. Depending on the choice of useful users, implementations of the FPT algorithm can behave very differently and competitively with respect to each other, making it difficult to select the best implementation among several possible choices. The implementation chosen for the experiments in Section 5 uses the first super-useful user detected during propagation, if such a user exists, and otherwise uses the first useful user detected. 4 The WSP as a pseudo-Boolean SAT problem In this section we describe how the WSP with user-independent counting constraints can be encoded as a pseudo-Boolean SAT problem and prove correctness of the encoding. Wang and Li [22] encoded their WSP instances as a pseudo-Boolean SAT problem and used a PB SAT solver (SAT4J) to solve them. Pseudo-Boolean SAT solvers are recognized as an efficient way to solve general constraint networks [16]. In their experiments, Wang and Li [22] considered not-equals constraints. They also considered a number of other constraints, which we do not use in our experimental work since they add little complexity to a WSP instance. In the experiments of Wang and Li, SAT4J solved all generated instances quite efficiently. We test SAT4J on a set of WSP instances of a different type, where SAT4J's effec- tiveness and efficiency vary a lot. We show that our reduction to the PB SAT problem 10 and SAT4J can be still successfully applied to lightly-constrained instances, which are not likely to be unsatisfiable. We use not-equals constraints as well as at-most-r and at-least-r constraints. For convenience and by an abuse of notation, given a constraint c of the form (r, Q, (cid:62)) or (r, Q, (cid:54)), we will write s ∈ c to denote that s ∈ Q, and define c to be Q. An authorization list for a step s is a set of users authorized to perform s and is denoted by A(s) = {u ∈ U : s ∈ A(u)}. We encode such constraints in the same way as Wang and Li [22], by defining a binary variable xu,s for every pair (u, s) such that u is authorized for s. That is, a variable xu,s is defined if and only if s ∈ A(u). In addition, for each at- least-r constraint c and user u, we introduce a (0,1)-variable zu,c, and, for each at-most-r constraint c and user u, we introduce a (0,1)-variable yu,c. These variables are subject to the following constraints: (PB1) for each step s: (cid:80) u∈A(s) xu,s = 1; (PB2) for each not-equals constraint (s, t,(cid:54)=) and user u ∈ A(s) ∩ A(t): xu,s + xu,t (cid:54) 1; zu,c (cid:54)(cid:80) s∈A(u)∩c xu,s; (PB3) for each at-least-r constraint c and user u: (PB4) for each at-least-r constraint c: (cid:80) (PB6) for each at-most-r constraint c: (cid:80) u∈U zu,c (cid:62) r; u∈U yu,c (cid:54) r. (PB5) for each at-most-r constraint c, s ∈ c, and u ∈ A(s): xu,s (cid:54) yu,c; The goal of a PB SAT solver is to find an assignment of values to these variables, representing a plan, where xu,s = 1 if and only if user u is assigned to step s. Informally, (PB1) ensures that each step is assigned to a single user; (PB2) ensures that all not- equals constraints are satisfied; (PB3) and (PB4) ensure that all at-least-r constraints are satisfied; and (PB5) and (PB6) ensure that all at-most-r constraints are satisfied. Theorem 2. A WSP instance with not-equals, at-most-r and at-least-r constraints has a solution if and only if the corresponding pseudo-Boolean SAT problem (PB1)-(PB6) has a solution. Proof: Suppose first that our WSP instance with not-equals, at-most-r, and at-least-r constraints has a solution. Then set xu,s = 1 if u is assigned to s in the WSP solution (noting that xu,s is defined, as u must be authorized for s), and set xu,s = 0 otherwise. For each at-least-r conststraint c, let zu,c = 1 if and only if u is assigned to a step in c. Similarly, for each at-most-r constraint c, let yu,c = 1 if and only if u is assigned to a step in c. It is easy to see that this assignment of (0, 1)-values to variables xu,s, zu,c, and yu,c satisfies all of the pseudo-Boolean constraints in (PB1)-(PB6). Conversely, suppose our pseudo-Boolean SAT problem (PB1)-(PB6) has a solution. By the first set of PB constraints, for each step s there exists a unique user u such that xu,s = 1. Consider the solution to the WSP in which each step s is assigned to the unique u such that xu,s = 1. As xu,s is only defined for authorized pairs (u, s), this solution only assigns users to steps for which they are authorized. We now show that this solution satisfies all the constraints in the WSP instance. For an inequality constraint (s, t,(cid:54)=), we have that, for each user u, either u is not authorized for at least one of s and t, or xu,s + xu,t (cid:54) 1. It follows that no user performs more than one of s and t, so the corresponding not-equals constraint is satisfied. 11 a step in c: since zu,c (cid:54)(cid:80) s ∈ A(u) ∩ c. Thus, as we have (cid:80) For an at-least-r constraint c, the satisfied inequality in (PB4) guarantees that at least r of variables zu,c, u ∈ U , are set equal to 1. Observe that zu,c = 1 implies that u performs s∈A(u)∩c xu,s in (PB3), it must be the case that xu,s = 1 for some u∈U zu,c (cid:62) r, it follows that there are at least r users that perform a step in c, and so c is satisfied. For each at-most-r constraint c, the equalities in (PB1) imply that for each s ∈ c, there exists u ∈ A(s) such that xu,s = 1, i.e. s is performed by a certain authorized user u. Since the inequalities in (PB5) are satisfied, xu,s (cid:54) yu,c implies yu,c = 1 for that particular user u. Thus, yu,c = 1 for every user u that performs at least one step in c. Since the inequality in (PB6) is satisfied, at most r users perform a step in c, and so c is satisfied. 5 Experiments Due to the difficulty of acquiring real-world workflow instances, Wang and Li [22] used syn- thetic data in their experimental study. We follow a similar approach to test experimentally the FPT algorithm and the reduction to the PB SAT problem. We use C++ to implement the FPT algorithm and to encode the reduction for the WSP with user-independent count- ing constraints.1 We generate a number of random WSP instances with not-equals and counting constraints and compare the performance of one of our implementations of the FPT algorithm with that of SAT4J on the reduction when solving the same instances. All our experiments use a MacBook Pro computer having a 2.6 GHz Intel Core i5 processor, 8 GB 1600 MHz DDR3 RAM2 and running Mac OS X 10.9.5. More experimental test results of earlier versions and implementations of this FPT algorithm and the reduction to the PB SAT problem using SAT4J can be found in [6]. 5.1 Testbed Design An authorization list for a step s ∈ S is a set of users A(s) ∈ U , authorized to perform s. The set of authorization lists {A(s) : s ∈ S} can be thought of as {A(u) : u ∈ U}, where A(u) = {s ∈ S : u ∈ A(s)}. We assumed that every user was authorized for at least one step but no more than (cid:100) k 2(cid:101) steps; that is, 1 (cid:54) A(u) (cid:54) (cid:100) k 2(cid:101). All constraints are of the form not-equals, at-most-r, or at-least r, where r is some small number. The not-equals constraints have domain of size 2, while the at-most-r and at-least r constraints have domain of size t, where t is some number bigger than r. We vary the number of not-equals constraints as a percentage d of(cid:0)k (cid:1), the maximum 2 possible number of these constraints. For these experiments, we use the same number of at-most-r constraints as the number of at-least-r constraints, denoted by b. All not- equals, at-most-r, at-least-r constraints and authorizations are generated for each instance separately, uniformly at random.3 Counting at-most-r and at-least-r constraints are generated by first enumerating all pos- sible t-element subsets of S using an algorithm from Reingold et al. [19]. Then Durstenfeld's 1 We would like to emphasize that even though the constraints considered in the theoretical part of Wang and Li's paper are purely user-independent, the authors consider randomly generated relations between users for their experiments. Therefore the experimental tests in [22] are done not in a user-independent environment. 2Our computer is more powerful than the one used by Wang and Li [22]. 3This experimental setup is different from the one used in our earlier work [6]. 12 version of the Fisher-Yates random shuffle algorithm [12, 13] is used to select separately and independently at random t-element subsets of S for the scopes of at-most-r and at-least-r constraints, b subsets for each. The random shuffle algorithm is also used to select steps in A(u) for which each user u is authorized, and the list of authorization sets {A(u) : u ∈ U} 2(cid:101). is generated uniformly at random, subject to the cardinality constraints 1 (cid:54) A(u) (cid:54) (cid:100) k Finally, the random shuffle is used to randomly select not-equals constraints, taking d% of the set of all possible not-equals constraints. 5.2 Testbed Choice For the experiments, we wanted to use WSP instances that were both simple and chal- lenging to solve, and close to what might be actually expected in practice. Therefore, we restricted our attention to counting constraints with r = 3 and t = 5, calling them at-most-3 and at-least-3 constraints, respectively. The rationale behind this is as follows. From our ad hoc experiments, at-most-r and at-least-r constraints with r = 1 or 2 make the problem instances easily solvable by both SAT4J and the FPT algorithm. On the other hand, at-most-r or at-least-r constraints with r (cid:62) 4 are not likely to appear in practice. Similarly, at-most-r and at-least-r constraints with t (cid:54) 4 appeared to provide relatively easy solvable WSP instances, and t (cid:62) 6 seems to be less likely to appear in practice. Therefore, for simplicity and to keep the things challenging and realistic enough at the same time, the choice of r = 3 and c = 5 seems to be well justified. Increasing r and t and keeping them close to each other seem to provide more challenging instances, which are left out of the scope of this paper. On the other hand, smaller values of r and t, or a larger difference between them, seem to create WSP instances instances whose satisfiability is easier to decide. Based on what might be expected in practice, we used values of k = 15, 20, 25 for the number of steps, and set n = 10k for the number of users.4 For the percentage d of (cid:1) possible not-equals constraints), we used values of not-equals constraints (out of the (cid:0)k 2 d = 10, 20, 30 (%). For convenience, we adopt the following convention to label our test instances: b.d denotes an instance with b at-most-3 constraints, b at-least-3 constraints, and not-equals constraint density d (e.g., see Tables 2 and 3). Considering b and d as parameters, we try to explore an area where both satisfiable (sat) and unsatisfiable (unsat) instances of the WSP are relatively likely to occur. Starting with instances having not too many not-equals constraints, informally, we expect that the difficulty of solving instances b.d for fixed k and b would increase as d increases (as the problem becomes "more constrained"). Similarly, for fixed k and d, we expect instances b.d would become harder to solve as b increases. We also expect that the time taken to solve an instance would depend on whether the instance is satisfiable or not, with unsatisfiable instances requiring a solver to examine all possible plans (or to provide a certificate of their unsatisfiability). We generate a set of instances of different degrees of hardness by varying the not- equals constraint density and the number of counting constraints. The resulting set of test instances includes some that are satisfiable with a relatively high diversity w of their 4Schaad et al. investigated several case studies in which authorization constraints were relevant, includ- ing a loan origination process in a bank [21] and the creation of electronic signatures in a law practice [20]. These two business processes used 13 and 12 steps, respectively. 13 search space ("lightly-constrained"), and some that are either satisfiable with a relatively low diversity w or are unsatisfiable ("well-constrained"). For each number of steps, k = 15, 20, 25, and three different constraint densities, d = 10, 20, 30 (%), to determine the range of values for b (which is dependent on k), we start with instances that seem to be lightly-constrained and normally can be efficiently solved by SAT4J. We then gradually increment b in steps by 2 and generate more instances. We stop generating instances when we find two consecutive values of b for which no instances are satisfiable. The minimum and maximum values of b used in the experiments to generate Tables 1 -- 3 correspond to instances that we view as borderline. In other words, we start with instances that are likely to be lightly-constrained and stop at instances which are likely to be well-constrained as the corresponding three instances for the same values of k and b are unsatisfiable. For the test instances in this paper, b ranges from 2 to 32 for k = 15, from 10 to 38 for k = 20, and from 22 to 36 for k = 25, respectively. The interested reader is referred to [6] for further details about possible selection of parameters for test instances. 5.3 Results In the experiments we compare the run-times and performance of an implementation of our FPT algorithm, called Solver FPT, and of SAT4J on the reduction to the PB SAT problem (described in Section 4), referred to as Solver SAT4J. Overall, Solver FPT was able to solve all the 117 test instances, while Solver SAT4J solved only 100 of them (85.5%). See Table 1 for overall statistics: the corresponding numbers of unsolved instances are in parenthesis. For average time values, we assume that the running time on the unsolved instances can be considered as a lower bound on the time required to solve them. Therefore average time values in Table 1 take into consideration unsolved instances for Solver SAT4J: they are estimated lower bounds on its average time performance. Table 1: Summary statistics for k ∈ {15, 20, 25} Solver SAT4J Solver FPT 2 ≤ b ≤ 32 15 #Steps Interval for b Instance Type #Instances Mean Time (s) #Instances Mean Time (s) 0.74 0.32 0.55 1.25 327.84 150.94 sat unsat all 20 10 ≤ b ≤ 38 25 22 ≤ b ≤ 36 26 22 48 26 22 48 sat unsat all sat unsat all 18 21 (6) 39 (6) 5 (2) 8 (9) 13 (11) 38.04 1,096.21 672.94 913.02 1,724.44 1,487.78 18 27 45 7 17 24 20.77 20.43 20.56 3,173.99 845.41 1,524.58 For the number k of steps equal to 15, in general, although SAT4J was able to solve all the instances, Solver FPT was several hundred times more efficient than SAT4J, with a much lower standard deviation in time performance (0.98 sec versus 293.1 sec, respectively). However, for lightly-constrained instances (b = 2 and 4), Solver SAT4J was usually about one order of magnitude more efficient than Solver FPT. Nevertheless, both solvers solved the WSP instances in seconds or tenth of seconds, and so Solver FPT could be successfully used for these kind of lightly-constrained instances as well. Overall, average performance 14 and time variance of both solvers on satisfiable instances was similar, with Solver FPT having a small advantage. For unsatisfiable instances, Solver FPT appeared to be about three orders of magnitude more efficient than SAT4J. Since we do not know in advance whether a given instance is satisfiable or not, Solver FPT can be considered as clearly superior, and should be applied to instances with b ≥ 6, while Solver SAT4J seems to be a better choice when b ≤ 5. Also, for small values of b (b ≤ 10), SAT4J seems to be slightly more efficient for lower densities of not-equals constraints, d ≤ 10%. For the number k of steps equal to 20 and 25, we provide Tables 2 and 3, respectively, which give detailed results of our experiments, and Figures 1 and 2, respectively, depicting the results graphically. Notice that Solver FPT reaches a conclusive decision (sat or unsat) in all cases, whereas SAT4J fails to reach such a decision for some instances, typically because the machine runs out of memory. In Figures 1 and 2, the shaded circles represent the instances unsolved by SAT4J. In Tables 2 and 3, we record the outcomes and CPU time taken by the two solvers to run on each instance. The best running time for each instance is in bold. Auxiliary information for Solver FPT includes the number of users considered and the number of patterns in the search space (a measure of the diversity w of the instance) generated before a valid plan was obtained or the instance was recognized as unsatisfiable. Also, for unsat instances, we show the number of users nw that could not extend the set of patterns in line 34 of Algorithm 1 (i.e., for such users u, Pu = ∅ in line 29) and, respectively, the number of useless users nu, whose authorization lists are dominated by those nw users. We use notation n : nw → nu, where n is the total number of users. Figure 1: Test results for k = 20 steps For k = 20 steps, Solver FPT successfully solved all 45 test instances, but Solver SAT4J failed to reach a conclusive decision for 6 of the instances (13.3%), all 6 being unsatisfiable (as determined by Solver FPT). For small values of b or d, corresponding to lightly-constrained instances, SAT4J usually performs better than Solver FPT. This is unsurprising, because the diversity w of such instances is much higher, thereby increasing the running time of Algorithm 1. However, for larger values of b or d (where the diversity is 15 0.5 1.0 2.0 4.0 8.0 16.0 32.0 64.0 128.0 256.0 512.0 1,024.0 2,048.0 4,096.0 10.10 .20 .30 12.10 .20 .30 14.10 .20 .30 16.10 .20 .30 18.10 .20 .30 20.10 .20 .30 22.10 .20 .30 24.10 .20 .30 26.10 .20 .30 28.10 .20 .30 30.10 .20 .30 32.10 .20 .30 34.10 .20 .30 36.10 .20 .30 38.10 .20 .30 Running 'me (sec) Instance ID FPT algorithm vs SAT4J Performance SAT4J FPT algorithm Table 2: Experimental test results for k = 20 Solver SAT4J Solver FPT Instance ID Output CPU Time (s) Output CPU Time (s) 28.18 16.46 15.07 11.15 26.21 0.58 1.29 1.55 0.53 1.73 sat sat sat sat sat unsat sat unsat unsat sat unsat sat unsat unsat sat sat sat sat sat sat sat sat sat sat 10.10 10.20 10.30 12.10 12.20 12.30 14.10 14.20 14.30 16.10 16.20 16.30 unknown 18.10 18.20 18.30 20.10 20.20 unknown 20.30 22.10 22.20 22.30 24.10 24.20 unknown 24.30 26.10 26.20 26.30 28.10 28.20 28.30 30.10 unknown 30.20 30.30 32.10 32.20 32.30 34.10 34.20 34.30 36.10 unknown 36.20 36.30 38.10 unknown 38.20 38.30 unsat unsat unsat unsat unsat unsat unsat unsat unsat sat unsat unsat sat unsat unsat unsat unsat sat sat sat #Users #Patterns 6 2,286,676 7 497,634 177,426 17 5 816,017 8 1,081,988 124.97 200: 71→68 358,731 21.85 711,168 8 21.07 155,345 23 3.36 21 33,427 12.06 6 435,640 125,409 12.97 17 28.76 200: 72→64 45,918 21 74.10 460,550 22.38 200: 67→56 30,431 37.89 200: 71→60 64,990 118,920 14 26.58 28.26 200: 58→51 36,710 7.48 200: 80→51 10,049 45,011 12 6.61 31.36 200: 61→57 22,140 9.67 200: 75→64 13,925 8.71 35,563 18 16.12 200: 65→48 15,497 8.01 200: 69→58 7,033 25.49 54,792 32 10.80 200: 66→52 10,848 5.04 200: 75→61 4,289 48 38.68 49,115 23.96 200: 71→43 17,371 4.65 200: 76→60 3,799 91.84 200: 50→45 57,585 10.73 200: 63→56 10,095 3.27 200: 83→56 2,568 19,008 43 17.29 11.26 200: 59→69 11,292 2.57 200: 71→72 2,202 22,756 22 7.97 4.74 200: 60→53 3,982 2.88 200: 75→55 2,294 30.17 200: 54→54 18,460 6.98 200: 53→62 5,249 2.08 200: 83→59 1,740 18.69 200: 59→42 14,255 4.57 200: 73→55 3,821 2.44 200: 79→51 1,785 334.11 unsat 0.77 3.25 26.33 0.50 3.41 sat sat sat sat sat 2,732.93 unsat 0.86 sat 677.83 unsat 419.98 unsat 1.39 sat 2,955.35 unsat 58.99 unsat 12.42 sat 1,720.84 unsat 93.60 unsat 18.43 sat 2,957.03 unsat 103.70 unsat 22.63 sat sat 1,931.69 unsat 494.26 unsat 113.78 974.26 unsat 457.82 unsat 2,834.44 unsat 1,007.06 unsat 470.43 unsat 413.85 361.16 unsat 148.69 unsat sat 61.41 sat 192.02 unsat 1,416.92 unsat 3,316.51 unsat 634.06 unsat 107.73 unsat 2,307.16 unsat 235.11 unsat 654.09 unsat 16 Table 3: Experimental test results for k = 25 Solver SAT4J Solver FPT unsat sat sat unsat sat unsat sat 29.38 sat 2,902.77 sat 2,366.72 unsat 734.43 unsat 39.38 107.45 380.64 unsat sat sat Instance ID Output CPU Time (s) Output CPU Time (s) 2,989.47 2,985.02 697.76 250: 84→68 1,317.98 1,041.61 250: 89→41 530.52 250: 87→68 9,624.71 1,892.92 250: 78→47 343.73 250: 86→56 3,200.61 1,190.27 250: 86→54 259.69 250: 88→61 1,628.47 1,367.66 250: 74→49 147.00 250: 91→65 14 471.68 391.75 250: 75→55 142.21 250: 89→65 3,489.42 250: 64→40 400.66 250: 83→55 94.54 250: 90→67 1,960.90 250: 65→53 353.27 250: 73→50 68.07 250: 97→59 22.10 22.20 22.30 24.10 24.20 unknown 24.30 26.10 unknown 26.20 unknown 26.30 28.10 28.20 unknown 28.30 30.10 unknown 30.20 unknown 30.30 32.10 32.20 unknown 32.30 34.10 unknown 34.20 unknown 34.30 36.10 unknown 36.20 unknown 36.30 2,629.04 unsat 606.36 unsat 359.67 2,900.17 unsat 157.78 unsat 2,787.75 3,193.69 unsat 753.05 unsat 164.75 2,294.51 unsat 351.33 unsat 3,510.65 unsat 2,155.26 unsat 576.72 unsat 3,482.64 unsat 2,935.06 unsat 287.47 unsat #Users #Patterns 23 5,892,335 75 1,413,105 243,780 14 4,547,403 306,664 166,905 95 3,651,747 447,506 85,438 44 1,914,685 294,422 62,806 29 1,354,688 330,524 37,563 811,118 101,370 34,466 800,535 109,214 19,242 489,635 89,912 13,848 unsat sat sat sat sat unsat unsat unsat unsat much lower), the FPT algorithm clearly outperforms SAT4J. Also, Figure 1 clearly shows that the running time of Solver SAT4J varies much more than that of Solver FPT, with the unsolved instances having running times larger than those of any solved instances. In contrast, Solver FPT shows a very stable time performance. Solver SAT4J seems to be better to use when b ≤ 10, or b ≤ 16 and d ≤ 20%, or b ≤ 20 and d ≤ 10%. For k = 25 steps, Solver FPT reached a conclusive decision (satisfiable or unsatisfiable) for all the 24 test instances. In contrast, SAT4J failed to solve 11 of the instances (45.8%), two of which were reported to be satisfiable and nine of which were reported to be unsatisfi- able by Solver FPT. Again, for smaller values of b or d, corresponding to lightly constrained instances, SAT4J generally performs better than Solver FPT. However, for larger values of b or d, SAT4J starts to fail quite often and is not able to provide a solution. At the same time, our FPT algorithm clearly starts to outperform SAT4J because the diversity w of such instances is much lower. Figure 2 shows that, for 25 steps, the running time of Solver SAT4J varies similarly to the running time of Solver FPT, with an outlier instance at b = 26 and d = 10% (satisfiable). However, SAT4J is unable to solve almost half of the instances, with the unsolved instances again having running times higher than any solved instances. Solver SAT4J seems to be better to use when b ≤ 22, or b ≤ 24 and d ≤ 10%, or when an instance is highly suspected to be satisfiable. 17 Figure 2: Test results for k = 25 steps 5.3.1 Summary Table 1 above presents summary statistics for the experiments overall. From Tables 2 and 3 and the low running time variance for k = 15, it can be observed that the average running times of Solver FPT are of a similar order of magnitude, whether the instances are satisfiable or unsatisfiable. The set of running times for Solver FPT in Table 2, whether the instance is satisfiable or unsatisfiable, also has relatively low variance. In contrast, the mean running times of SAT4J vary significantly depending on whether the instance is satisfiable or not. As the number k of steps increases, SAT4J fails more frequently, and is unable to reach a conclusive decision for almost half of the instances when k = 25. This is unsurprising, given that the number of PB SAT variables will grow quadratically as k and n = 10k increase. However, in time performance for satisfiable instances, the picture is often more favourable to SAT4J: this may be explained by some heuristics deployed to solve relatively easy satisfiable instances. Overall, for larger values of k, the average run-time advantage of the FPT algorithm over SAT4J decreases, but the relative number of instances solved by SAT4J decreases as well. The tables also exhibit the expected correlation between the running time of our FPT algorithm and two numbers: the number of patterns generated by the algorithm and the number of users considered, which, in turn, is related to the number of constraints and constraint density. For well-constrained instances, the FPT algorithm has to consider far fewer patterns, and this more than offsets the fact that we may have to consider every user (for those cases that are unsatisfiable). It is interesting to note the way in which the mean running time t varies with the number of steps. In particular, t for our algorithm grows exponentially with k (with strong correlation between k and log t), which is consistent with the theoretical running time of our algorithm (O∗(2k log k)). The running time of SAT4J is also dependent on k, with a strong correlation between k and log t, which is consistent with the fact that there are O(nk) possible plans to consider. However, it is clear that the running time of SAT4J is also more dependent on the number of variables (determined by the number of users, 18 0 1,000 2,000 3,000 4,000 5,000 6,000 7,000 8,000 9,000 10,000 22.10 .20 .30 24.10 .20 .30 26.10 .20 .30 28.10 .20 .30 30.10 .20 .30 32.10 .20 .30 34.10 .20 .30 36.10 .20 .30 Running 'me (sec) Instance ID FPT algorithm vs SAT4J Performance SAT4J FPT algorithm authorizations, and constraints), than it is on k, unlike the running time of our algorithm. 6 Concluding Remarks In this paper, we described our implementation of an FPT algorithm designed to solve a specific NP-hard problem known as the workflow satisfiability problem (WSP) for user- independent counting constraints. In theory, there exists an algorithm that can solve the WSP for user-independent constraints in time O∗(2k log k) in the worst case. However, the WSP is a practical problem with applications in the design of workflows and the design of access control mechanisms for workflow systems [9]. Thus, it is essential to demonstrate that theoretical advantages can be realised in practice. Accordingly, we have developed several implementations using the generic FPT algo- rithm as a starting point. In developing the implementations, it became apparent that several application-specific heuristic improvements could be made. In particular, we de- veloped specific types of propagation and pruning techniques for counting at-most-r and at-least-r constraints. Following general techniques described in Section 2 and in [7], it should be possible to generalize and implement efficiently most of the ideas used in Algo- rithm 1 to solve the WSP with other types of user-independent constraints. We compared the performance of our algorithm with that of SAT4J -- an "off-the-shelf" PB SAT solver. In order to perform this comparison, we extended Wang and Li's encoding of the WSP as a pseudo-Boolean satisfiability problem [22]. The results of our experiments suggest that our algorithm does, indeed, have an advantage over SAT4J when solving the WSP, although this advantage does not extend to lightly constrained instances of the problem. The results also suggest that those advantages could be attributed to the structure of our algorithm, with its focus on the small parameter (in this case, the number of workflow steps). The encodings of plans presented in this paper grouped plans together based on which steps they assigned to the same user. For counting constraints, it would also be possible to group plans together based on how many users are assigned to the steps in each constraint. It may be worth investigating algorithms based on this encoding of plans in future. We plan to continue working on algorithm engineering for the WSP. In particular, we plan to continue developing ideas presented in this paper and in [7] to develop efficient implementations and modified versions of this FPT algorithm. We hope to obtain a more efficient implementation than the one presented in this paper. We also plan to try different experimental setups. For example, in this paper, we have used a uniform random distri- bution of authorizations to users with an upper bound at 50% of the number of steps for which any one user can be authorized. In some practical situations, a few users are au- thorized for many more steps than others. We have only considered counting constraints, rather than a range of user-independent constraints. In some ways, imposing these con- straints enables us to make meaningful comparisons between the two different algorithmic approaches. However, we would like to undertake more extensive study and testing to confirm that the initial results obtained for this particular family of WSP instances can be extended to other types of WSP. Results and ideas presented in this paper can serve as a benchmark for further devel- opments in algorithm engineering to solve the workflow satisfiability problem with user- independent constraints and to design their experimental testing. 19 Acknowledgments This research was supported by EPSRC grant EP/K005162/1. We are very grateful to the referees for several useful comments and suggestions and to Daniel Karapetyan for several helpful discussions. References [1] American National Standards Institute. ANSI INCITS 359-2004 for Role Based Access Control, 2004. [2] Basin, D.A., Burri, S.J., Karjoth, G.: Obstruction-free authorization enforcement: Aligning security and business objectives. Journal of Computer Security 22(5), 661- 698 (2014). [3] Berend, D., Tassa, T.: Improved bounds on Bell numbers and on moments of sums of random variables. Probability and Mathematical Statistics 30(2), 185 -- 205 (2010) [4] Bertino, E., Ferrari, E., Atluri, V.: The specification and enforcement of authorization constraints in workflow management systems. ACM Trans. Inf. Syst. Secur. 2(1), 65 -- 104 (1999) [5] Chimani, M., Klein, K.: Algorithm engineering: Concepts and practice. In: Bartz- Beielstein, T., Chiarandini, M., Paquete, L., Preuss, M. (eds.) Experimental methods for the analysis of optimization algorithms, pp. 131 -- 158 (2010) [6] Cohen, D., Crampton, J., Gagarin, A., Gutin, G., Jones, M.: Engineering algorithms for workflow satisfiability problem with user-independent constraints. Proc. 8th In- ternational Frontiers of Algorithmics Workshop (FAW 2014), J. Chen, J.E. Hopcroft, and J. Wang (Eds.), 2014, LNCS 8497, Springer, pp. 48-59. [7] Cohen, D., Crampton, J., Gagarin, A., Gutin, G., Jones, M.: Iterative plan construc- tion for the workflow satisfiability problem. Journal of Artificial Intelligence Research 51, 555 -- 577 (2014) [8] Crampton, J.: A reference monitor for workflow systems with constrained task exe- cution. In: Ferrari, E., Ahn, G.J. (eds.) SACMAT. pp. 38 -- 47. ACM (2005) [9] Crampton, J., Gutin, G.: Constraint expressions and workflow satisfiability. In: Conti, M., Vaidya, J., Schaad, A. (eds.) SACMAT. pp. 73 -- 84. ACM (2013) [10] Crampton, J., Gutin, G., Yeo, A.: On the parameterized complexity and kernelization of the workflow satisfiability problem. ACM Trans. Inf. Syst. Secur. 16(1), 4 (2013) [11] Downey, R.G., Fellows, M.R.: Fundamentals of Parameterized Complexity. Springer Verlag (2013) [12] Durstenfeld, R.: Algorithm 235: Random permutation. Communications of the ACM 7(7), 420 (1964) [13] Fisher, R.A., Yates, F.: Statistical tables for biological, agricultural and medical research. Oliver and Boyd, third edn. (1948) 20 [14] Flum, J., Grohe, M.: Parameterized Complexity Theory. Springer Verlag (2006) [15] Gligor, V.D., Gavrila, S.I., Ferraiolo, D.F: On the formal definition of separation-of- duty policies and their composition. In IEEE Symposium on Security and Privacy, pp. 172 -- 183. IEEE Computer Society, 1998. [16] Le Berre, D., Parrain, A.: The SAT4J library, release 2.2. J. Satisf. Bool. Model. Comput. 7, 59 -- 64 (2010) [17] Myrvold, W., Kocay, W.: Errors in graph embedding algorithms. J. Comput. Syst. Sci. 77(2), 430 -- 438 (2011) [18] Niedermeier, R.: Invitation to Fixed-Parameter Algorithms. Oxford U. Press (2006) [19] Reingold, E.M., Nievergelt, J., Deo, N.: Combinatorial algorithms: Theory and prac- tice. Prentice Hall (1977) [20] Schaad, A., Spadone, P., Weichsel, H.: A case study of separation of duty properties in the context of the Austrian "eLaw" process. Proc. the 2005 ACM Symposium on Applied Computing (SAC 2005), 1328 -- 1332 (2005) [21] Schaad, A., Lotz, V., Sohr, K.: A model-checking approach to analysing organisational controls in a loan origination process. In: Ferraiolo, D.F., Ray, I. (eds) SACMAT. pp. 139 -- 149. ACM (2006) [22] Wang, Q., Li, N.: Satisfiability and resiliency in workflow authorization systems. ACM Trans. Inf. Syst. Secur. 13(4), 40 (2010) [23] Wolter, C., Schaad, A.: Modeling of task-based authorization constraints in BPMN. In G. Alonso, P. Dadam, and M. Rosemann (eds), BPM, LNCS 4714, pp. 64-79. Springer, 2007. 21
1509.04344
1
1509
2015-09-14T22:11:40
Stable Nash Equilibria in the Gale-Shapley Matching Game
[ "cs.DS", "cs.GT" ]
In this article we study the stable marriage game induced by the men-proposing Gale-Shapley algorithm. Our setting is standard: all the lists are complete and the matching mechanism is the men-proposing Gale-Shapley algorithm. It is well known that in this setting, men cannot cheat, but women can. In fact, Teo, Sethuraman and Tan \cite{TST01}, show that there is a polynomial time algorithm to obtain, for a given strategy (the set of all lists) $Q$ and a woman $w$, the best partner attainable by changing her list. However, what if the resulting matching is not stable with respect to $Q$? Obviously, such a matching would be vulnerable to further manipulation, but is not mentioned in \cite{TST01}. In this paper, we consider (safe) manipulation that implies a stable matching in a most general setting. Specifically, our goal is to decide for a given $Q$, if w can manipulate her list to obtain a strictly better partner with respect to the true strategy $P$ (which may be different from $Q$), and also the outcome is a stable matching for $P$.
cs.DS
cs
Stable Nash Equilibria in the Gale-Shapley Matching Game Sushmita Gupta∗ Kazuo Iwama∗ Shuichi Miyazaki∗ Abstract In this article we study the stable marriage game induced by the men-proposing Gale- Shapley algorithm. Our setting is standard: all the lists are complete and the matching mechanism is the men-proposing Gale-Shapley algorithm. It is well known that in this setting, men cannot cheat, but women can. In fact, Teo, Sethuraman and Tan [TST01], show that there is a polynomial time algorithm to obtain, for a given strategy (the set of all lists) Q and a woman w, the best partner attainable by changing her list. However, what if the resulting matching is not stable with respect to Q? Obviously, such a matching would be vulnerable to further manipulation, but is not mentioned in [TST01]. In this paper, we consider (safe) manipulation that implies a stable matching in a most general setting. Specifically, our goal is to decide for a given Q, if w can manipulate her list to obtain a strictly better partner with respect to the true strategy P (which may be different from Q), and also the outcome is a stable matching for P . 1 Introduction Matchings under preferences is an extensively studied area of theoretical and empirical research that has a wide range of applications in economics and social sciences. The most popular and standard problem in this field is the stable marriage problem (SMP), introduced by Gale and Shapley [GS62], where we have two parties; a set of men and a set of women. Each man has a preference list that orders women according to his preference, and similarly each woman also has a preference ordering for the men. The goal is to find a stable matching, a matching without any blocking pair, where a blocking pair is a pair of a man and a woman who prefer each other to their current partners. The goal of each player is of course to obtain a good partner (to steal a good partner from colleagues). Thus, the stable marriage is a typical game played by selfish players and its game- theoretic aspects have been studied for a long time (see Roth and Sotomayor [RS90]). For instance, it is well known that if we use the men-proposing Gale-Shapley algorithm (GS-M, in short) as the matching mechanism, then men do not benefit by cheating, i.e. ., any change of a single list on the men's side does not give him a strictly better partner. Also, if we allow individuals to truncate their lists (i.e. delete one or more persons from the list), then there are several (relatively easy) ways to manipulate to obtain a better outcome. For the special case, when all lists are complete, we have known about instances of SMP (see page 65 of [GI89], for example), where a woman can improve her outcome by permuting her true preference list, while all others use their true lists. But little else was known about the property of permutation strategies, such as the time complexity of finding such a list. It is due to the work of Teo et al. [TST01] that this question was resolved. They proved that there is a poly-time algorithm to obtain, for a given set of complete preference lists for all men and women, and a particular woman w, the best partner that w can attain by using one of ∗Kyoto University, Japan. Emails: [email protected], [email protected], [email protected] 1 the n! permutations of her true preference list. As a corollary, it is also possible to decide in polynomial time if the set of true preference lists is a Nash equilibrium. Thus, [TST01] was a nice start towards progress in this topic and their proof is also nontrivial. However, their setting that there is no distinction between the "true" preference list of a player and the actual preference list submitted by him/her, is not standard in game theory. This is supported by theory, by the result that there is no mechanism in which the best strategy for all the agents is to tell the truth [RS90, Thm 4.4]. For GS-M it is in the best interest for the men to tell the truth, but that is not the case for the women. Hence, we have to consider the possibility that true preference is different from stated preference. Recall that in the general setting of game theory, we have a set of players and their strategies. The outcome of each player i for his/her strategy si, is determined by a function of si and all the other players' strategies. In the case of stable marriage, the strategy of each player is his/her preference list, and that can be one of n! different ones and the player's outcome is determined by final matched partner at the end of the matching algorithm, (GS-M in our case). The true preference list is necessary for assessing an agent's profit or loss; the actual stated strategy (submitted list) may of course be very different from the true list. In other words, a stated list of a woman w and her true lists are effectively independent; the latter is necessary for computing the quality (i.e. benefit, if any) of the outcome for w, and as it turns out, has another important role. Consider the strategies depicted in Figure 1: We have five men {1, . . . , 5}, five women {a, . . . , e}, and their current preference lists, given by Q1. Recall that each person has his/her true preference list, and that is depicted by P in the table. We want to see how vulnerable Q1 is against manipulation. GS-M applied to Q1 yields µQ1 = {(1, a), (2, b), (3, c), (4, d), (5, e)}, which is stable with respect to P (called P -stable), since µP = µQ1. However, it is not stable in the Nash equilibrium sense, since d can improve her outcome by changing her list to Q2(d), resulting in µQ2 = {(1, a), (2, b), (3, c), (4, e), (5, d)}. Her new partner 5 is better than 4 in terms of P (d) and the matching is again P -stable. It is noteworthy that µQ2 is the women-optimal P -stable matching, hence it admits no P -stable manipulation strategies. But then again, another woman a gets into the game, against Q2, and using Q3(a). Her new partner is 2, who is ranked first in her true list.Unfortunately, though, µQ3 is not P -stable, with blocking pairs (2, b) and (3, b). This leaves open the possibility of manipulation by b, given by Q4(b), whereby b is matched to 2, and a to 3. Thus, a actually has a lower payoff in Q4 than Q2, thus rendering her manipulating of Q3 counter-productive. This is why we posit that manipulation strategies that are P -stable add a layer of security for the manipulation, since unstable manipulation will always leave open the possibility of others to manipulate, specifically those women who are in a P -blocking pair. Our Contributions: Motivated by these strategic considerations, we introduce a stable Nash equilibrium, which is a relaxation of a Nash equilibrium, but nonetheless sufficiently limits an agent's incentive to manipulate the market. Suppose that the stable matching game is induced by the men-optimal stable matching mechanism. For a given strategy Q and a true strategy P , Q is said to be a P-stable Nash equilibrium (in this game) if and only if there is no woman w such that (i) w can manipulate her list, (while all others retain their Q-lists) and obtain a better partner with respect to P (w), and (ii) the resulting matching is P -stable. Note that there are several cases that people may try to improve their outcome but actually fail under (i) and (ii). For instance, (a) w manipulates her list, and indeed gets matched to x, who is better with respect to Q, but not with respect to P , and (b) w manipulates her list, gets indeed a better partner x with respect to P , but the resulting matching is not P -stable, for instance Q3, in our example. Our main result in this paper is the existence of a polynomial time algorithm that determines 2 Men 1 : 2 : 3 : 4 : 5 : P (M ) Women P (W ) Q1(W ) a b d e c b a d e c a b d e c d e a b c c e d a b a : b : c : d : e : 2 1 4 5 3 2 1 4 5 3 2 3 1 4 5 1 2 4 5 3 1 2 4 5 3 1 2 4 5 3 5 4 1 2 3 5 4 1 2 3 4 5 1 2 3 4 5 1 2 3 True strategy P = (P (M ), P (W )) and stated strategy Q1 = (P (M ), Q1(W ). The M -optimal matching µP = µQ1 = {(1, a), (2, b), (3, c), (4, d), (5, e)}, thus, µQ1 is P -stable. Men 1 : 2 : 3 : 4 : 5 : P (M ) a b d e b a d e a b d e d e a b e d a b c c c c c Women a : b : c : d : e : Q2(W ) 4 5 1 2 4 5 4 5 2 4 1 3 5 1 2 2 1 1 5 4 3 3 3 2 3 2 1 1 5 4 Q3(W ) 1 4 3 2 4 5 4 5 2 4 1 3 5 1 2 5 3 3 2 3 2 2 1 5 4 Q4(W ) 1 4 3 3 1 4 4 5 2 4 1 3 5 1 2 5 5 3 2 3 The P -blocking pairs in µQ3 are (2, b) and (3, b). Manipulation by b gives Q4 = (Q3(−b), P (b)), resulting in µQ4 = {(1, c), (2, b), (3, a), (4, d), (5, e)}. Figure 1: Manipulation by d, followed by a, and then b. if Q is a P -stable Nash equilibrium. Our algorithm has two stages. In the first stage we obtain triples (w, x, Q(x; w)), where w is a woman, x(6= µQ[w]) is a man, and Q(x; w) is a list of w such that µ(Q(−w),Q(x;w)) matches x to w. Here, the preference lists (Q(−w), Q(w, x)), is such that only w's list is changed to Q(x; w), while each a ∈ M ∪ W \ {w} uses Q(a) (formal definitions in Section 2). It should be noted that there may be many different lists of w that if used instead, would also match w to x, but this algorithm outputs just one of them. The algorithm itself is basically the same as [TST01], but the analysis is completely new. Recall that [TST01] only guarantees that it outputs a similar triple (w, x, Q(x; w)), where x is the best possible partner of w (with respect to Q(w)). Our arguments are completely new, proving the more general statement, that all partners attainable by GS-M can be found using the algorithm. The second stage is to decide, for each triple (w, x, Q(x; w)) obtained in the first stage, whether or not there exists a list for w, say Q′(x; w), which if used instead of Q(w) would result in w to x, with the condition that µ(Q(−w),Q′(x;w)) is P -stable. List Q(x; w) is an obvious candidate for such a Q′(x; w), but there may be (exponentially) many others, and it is possible that Q′(x; w) results in a P -stable matching but Q(x; w) does not. For this, we prove a key lemma that is interesting in its own right. Specifically, we show that µ(Q(−w),Q′(x;w)) is unique regardless of the list Q′(x; w). Therefore, to detect if Q is P -stable Nash equilibrium, it suffices to check if µ(Q(−w),Q(x;w)) is P -stable for all the (at most n2) triples obtained in the first stage. Related Work: We denote the true preferences of (M, W ) by P , and for an individual agent a ∈ M ∪ W , the preference list of a by P (a). The M -optimal and W -optimal matching w.r.t a given strategy Q is denoted by µQ. For a stated strategy Q, Dubins and Freedman [DF81], proved that there is no coalition C of men, who have a manipulation strategy P ′ = (P (−C), P ′(C)) so that the outcome P ′-stable, and is strictly better than µP , in P (m), for each m ∈ C. Demange, et al. [DGS87] extend this result to include women in the coalition C, showing that there is no P ′-stable matching µ′ such that every agent a ∈ C, prefers µ′[a], (in P (a)) to his/her partner in every P -stable matching. For truncation strategies it was shown by Gale and Sotomayor [GS85] that if there are at least two P -stable matchings, then there is a woman w who has a unilateral manipulation strategy Q′ ∈ Qw that gives a strictly better outcome than µP , in P (w). If C = W , then there 3 is a truncation strategy P ′ = (P (M ), P ′(W )), such that µP ′, is the women-optimal matching for P . Considerable work on truncation strategies have been undertaken, see [Ehl08, RR99] for motivations and applications. In fact, up until the late 1980s, analyses of manipulation strategies of women centred almost exclusively around truncation strategies. As stated earlier, (to the best of our knowledge) Teo et al. [TST01] was the first to consider permutations of a agent's true lists as a type of manipulation strategy. They gave a polynomial time algorithm that for a given w ∈ W , computes the best manipulated partner (in P (w)) that w can attain using GS-M on any strategy (P (−w), P ′(w)) ∈ Pw. Immorlica and Mahidian [IM05], allowing the men's preference lists to have ties but bounded by a constant, and drawn from an arbitrary probability distribution, while the women's lists are arbitrary and complete; show that with high probability, truthfulness is the best strategy for an any agent, assuming everybody is being truthful as well. Kobayashi and Matsui [KM10] consider the possibility that a coalition C of women have a manipulation strategy P ′ = (P (M ), P ′(W )), containing complete lists, such that µP ′ yields specific partnerships for the members of C. The situation manifests in two specific forms, depending on the nature of the input. In the first case, the input consists of the complete lists of all men, a partial matching (some agents may be unmatched) µ′, and complete lists of the subset of women who are unmatched in µ′, denoted by W \ C. The problem is to test whether there exists a permutation strategy for each woman in C, such that for the combined strategy P ′ = (P (−C), P ′(C)), µP ′ is a perfect matching that extends µ′. In the second case, the input consists of the lists of all men, a perfect matching µ, and lists for women in W \ C. The problem is to test if there are permutation strategies for the women in C, such that for P ′ = (P (−C), P ′(C)), matching µ′ P = µ. Pini et al. [PRVW11] show that for an arbitrary instance of the stable marriage problem, there is a stable matching mechanism for which it is NP-hard to find a manipulation strategy. More recently, Deng, et al. [DST15], drawing on [KM10] have discussed the possibility of a coalition of women permuting their true lists, while others state theirs truthufully, so as to produce a matching that is Pareto optimal for the members of the coalition. They also give an O(n6) algorithm to compute a strong Nash equilibrium that is strongly Pareto optimal for all the coalition partners. Our work deals with manipulation by women, in the game induced by GS-M, where truth- telling is the best strategy for men. For a background on manipulation strategies for men, we point the reader to [Hua06, III+13] and [Man13]. 2 Preliminaries We always use M to denote the set of n men {m1, m2, . . . , mn} and W the set of n women {w1, w2, . . . , wn}. Our matching mechanism is always the men-proposing Gale-Shapley algo- rithm: On the man's side, a man who is single, proposes to the woman who is at the top of his current list. At the woman's side, when a woman w receives a proposal from a man m, she accepts that proposal if she is single. Otherwise, if she prefers m to her current partner m′ (m′ to m, resp.), then w accepts m (m′, resp.) and rejects m′ (m, resp.). If m is rejected by w, then m becomes single again and w is removed from the m's list. The algorithm terminates when there is no single man (for more details, see [GI89]). We assume that if there are two or more single men, the man with the smallest index does a proposal, thus making the procedure deterministic. A strategy Q is a set of preference lists (or simply lists) of all the men in M and all the women in W . For a person x in M ∪ W , Q(x) denotes the x's list in the strategy Q. For a given strategy Q, suppose that only w changes her list from Q(w) to Q′(w). We denote the resulting strategy by Q′ = (Q(−w), Q′(w)), and use Qw to denote the family of all such strategy Q′. Note 4 that all lists considered in this article are complete,i.e. , they are permutations of n men or n women. Let µ be a (perfect) matching between M and W and Q be a strategy. Then we say that µ is Q-stable if there is no Q-blocking pair. Here Q-blocking pair is a pair (m, w) of a man and a woman such that m prefers, in (terms of the preference ordering in) Q(m), w to his partner in µ (denoted by µ[m]) and w prefers, in Q(w), m to µ[w]. If w strictly prefers m1 to m2, in Q(w), then we denote that as m1 > m2 in Q(w). We use m1 ≥ m2, if m1 > m2, or m1 = m2. For a strategy Q, µQ denotes the man-optimal stable matching, computed by the Gale- Shapley algorithm. If a man m proposes to a woman w during this procedure, then we say that m is active in Q(w) (formally speaking we should say m is active in Q(w), during the computation of µQ, but for the sake of brevity, we will omit strategy Q when it is obvious from the context.) Recall that a woman w changes her list Q(w) for the purpose of manipulation. For a subset M ′ ⊆ M , let I be an ordering of men in M ′. Then, Q(I; w) denotes a permutation of Q(w), where the men in M ′ are at the front in the order in which they appear in I. An ordered (sub)list such as I, is called a tuple, and for any given tuple I, we define Q(I; w) = [I, Q(w) \ I] For example, if Q(w) = (1, 2, 3, 4, 5, 6) and I = (5, 2), then Q(I; w) = (5, 2, 1, 3, 4, 6). Now we are ready to introduce our main concept. We are given a strategy Q and a true strategy P . Then for a woman w ∈ W , a strategy Q′ ∈ Qw is said to be a unilateral manipulation strategy of w, if µQ′[w] > µQ[w] in P (w), i.e. w strictly prefers the outcome of µQ′ to µQ, with respect to her true preference/strategy. If µQ′ is a P -stable matching, then Q′ is said to be a P -stable manipulation strategy of w. A strategy Q is said to be a P -stable Nash equilibrium if there does not exist w ∈ W having a P -stable unilateral manipulation strategy Q′ ∈ Qw. In this paper, we consider the following problem: Problem: Given a true preference P , and a stated preference Q, determine if Q is a P -stable Nash equilibrium. 3 Listing active men Now our goal is to design an algorithm that, for two given strategies, a stated strategy Q and a true strategy P , answers if Q is a P -stable Nash equilibrium. To do so, we first design an algorithm that outputs the set Nw(Q) of all possible partners m of a given fixed woman w such that there is a (manipulated) strategy Q′ = (Q(−w), Q′(w)), for which the men-optimal stable matching (i.e. men-proposing GS algorithm), will match w to m. By using this algorithm n times, we can obtain {Nw1(Q), . . . , Nwn(Q)}. The use of this set to prove our main result is explained in the next section. See Algorithm 1, which is basically the same as the one given by Teo et al. [TST01]: Suppose that Q(w) = (1, 2, 3, 4, 5, 6, 7, 8) and the first proposal comes from man 5. Then the algorithm adds 5 to N and call Explore(Q(5; w)), namely it executes men-proposing Gale-Shapley al- gorithm (GS-M, in short) after moving man 5 to the front of Q(w). In general, procedure Explore takes as a parameter, Q(x, I; w), a preference list of w. As per our notation, x is at the front of this list, followed by the sublist I and then the rest of the men, thus, defining the strategy Q′ = (Q(−w), Q(x, I; w)). Explore(Q(x, I; w)) executes GS-M for the strategy Q′ and produces the set of men A who propose to w after x. Now for each y ∈ A, we check if y is "new" (i.e. , not yet in N ). If so, we add y to N and call Explore recursively after moving y to the top of Q(x, I; w), else, we do nothing. Since Explore is called only once for each man in N , its time complexity is obviously at most n × T (GS), where T (GS) is the time complexity of one execution of GS-M, thus, overall 5 it is O(n3). The nontrivial part is the correctness of the argument, which we shall prove now. Theorem 1. For a strategy Q and a woman w ∈ W , Algorithm 1 produces N = (cid:8)m ∈ M ∃Q′ ∈ Qw, s.t. µQ′[w] = m(cid:9) and for each m ∈ N , a list Q(m, I; w) such that for some partial list I, m is active in Q(I; w). Proof. Let Q′(w) be an arbitrary permutation of n men and Q′ be the strategy (Q(−w), Q′(w)). It is enough to prove if a man x ∈ M proposes to w during the computation of µQ′ (i.e. x is active in Q′(w)), then x is added to N during the execution of Algorithm 1. Here we need two new definitions: Suppose that x1, x2, . . . , xt is a sequence of proposals received by w during the computation of µQ′. Then this sequence is called an active sequence for Q′(w), denoted by AS′(w). Also suppose that y1, y2, . . . , ys is a maximal subsequence of AS′(w) such that y1 = x1 and ys > ys−1 > · · · > y1 in Q′(w). Then, this is called the increasing active subsequence for Q′(w) and is denoted by IAS′(w). As an example, let Q′(w) = (1, 2, 3, 4, 5, 6, 7, 8, 9) and AS′(w) = 5, 6, 3, 4, 2, 8. Then IAS′(w) = 5, 3, 2. Now consider a different list Q′′(w) = (1, 2, 3, 5, 9, 8, 4, 6, 7), thus, Q′(w) 6= Q′′(w). Then, we can observe that the active sequence and the increasing active subsequence for Q′′(w) are identical to those of Q′(w). The reason being the following. The lists in Q′ and Q′′ are the same except that of w's, so the first proposal for w must come from the same man regardless of w's list. Since 5 is accepted by w (both lists are complete), the next proposal should also be from the same man, 6. Now since 5 > 6 in both Q′(w) and Q′′(w), 6 is rejected in both Q′(w) and Q′′(w) and thus, the next proposal must also be same, and so on, we continue. This observation leads us to the following lemma. Lemma 1. For strategies Q′, Q′′ ∈ Qw, let x1, x2, . . . , xp and u1, u2, . . . , uq, denote the active sequences for Q′(w) and Q′′(w) respectively and let y1, y2, . . . , ys and v1, v2, . . . , vt denote the corresponding increasing active subsequence. Then, the following conditions must hold. (a) x1 = y1 = u1 = v1. (b) For an arbitrary l (l ≤ p and l ≤ q), we consider the prefixes of the active sequences up to position l and the prefixes of the corresponding increasing active subsequences, denoted by y1, ..., yj and v1, ..., vj . Then, if xi = ui for all i ≤ l and yk = vk for all k ≤ j, then xl+1 = ul+1. Proof. By definition, x1 = y1 and u1 = v1. Recall that all the lists in Q′ and Q′′ are the same except those for w. Furthermore, we use a fixed tie-breaking protocol in the deterministic GS algorithm. Hence, x1 = u1, follows directly. To prove condition (b), let y2 = xi1+1, y3 = xi2+1, . . ., and so on. Then we can write AS′(w) as follows, where x2, . . . , xi1 , xi1+2, . . . , xi2 , . . . may be empty. AS′(w) = y1, x2, . . . , xi1 , y2, xi1+2, . . . , xi2 , . . . , yj, xij−1+2, . . . , xl, xl+1, . . . Now one can see that y1 is accepted, all of x2 . . . , xi1 are rejected since they are after y1 in the list by definition. This continues as y2 is accepted, xi1+2, . . . , xi2 rejected, and so on. Now, consider AS′′(w), depicted below. AS′′(w) = v1, u2, . . . , ui1 , v2, ui1+2, . . . , ui2 , . . . , vj , uij−1+2, . . . , ul, ul+1, . . . By the assumption, these two sequences are identical up to position l, so acceptance or rejection for each proposal follows identically, as discussed above. Therefore, the configuration (see below) of GS-M for Q′ at the moment when xl proposes to w and the configuration for Q′′ when ul proposes to w are exactly the same. A configuration consists of (i) the lists of all 6 men (recall that some entries are removed when proposals are rejected), (ii) the set of single men, and (iii) the current temporal partner of each woman. (Formally this should be shown by induction, but it is straight forward and may be omitted). Also the acceptance/rejection for xl and ul is the same. Thus in either case, the execution of the (deterministic) GS-M is exactly the same for Q′ and Q′′ until w receives proposal from xl+1 and ul+1, respectively. Hence, xl+1 and ul+1, should be equal and the lemma is proved. Now let us look at the execution sequence of Algorithm 1 while comparing it with the execution sequence of GS-M on Q′. We assume that the active sequence and increasingly active sequence for Q′ are AS′(w) = x1, x2, . . . , xp and IAS′(w) = y1, y2, . . . , ys, respectively. By 1, the first proposal to w is always y1, so the algorithm starts with Explore(Q(y1; w)) (we simply say the algorithm invokes Q(y1; w)), and N = {y1}, at the very beginning. Now we note that it is quite easy to see that the active sequence for Q(y1; w) should be y1, x2, . . . , xi1 , . . ., i.e. it should be identical to that of Q′(w) up to the position i1. The reason is as follows. We already know the first active man is always y1 and that is also the first symbol in the increasing active sequence of both. Thus we can use 1, to conclude that the second symbols should also be the same. Since, x2 is not in IAS′(w), meaning that it is rejected, which is also the same in Q(y1; w) since y1 is at the top of the sequence. Thus the third symbol is the same in both and so on up to position i1. Then the next symbol in AS′(w) is y2 and its that is also active in Q(y1; w), meaning Q(y2, y1; w) is invoked by the algorithm. (The algorithm also invokes Q(x2, y1; w), Q(x3, y1; w), . . . , Q(xi1 , y1; w) also, but these are not important for us at this moment). We again consider the active sequence for Q(y2, y1; w) and by the same argument presented earlier, we can conclude that it is identical to AS′(w) up to position i2 and so y3 is found to be an active man. Hence, Q(y3, y2, y1; w) is invoked if y3 was not already present in N . Continuing like this, we note that if Q(ys, ys−1, . . . , y1; w) is invoked, then we are done since its active sequence is identical to that of Q′(w). However, this case happens only if each yi, 2 ≤ i ≤ s, is a brand new active man found during the invocation of Q(yi−1, . . . , y1; w). If one them is not new then the subsequent lists are not invoked, and yet, we are assured due to 2 that Algorithm 1 will detect all the active men in Q′(w). 2 is rather surprising and maybe of independent interest. For two lists Q′(w) and Q′′(w), that are distinct and arbitrary orderings on men, we assume nothing about the execution of GS-M on the two lists except that a particular man x is active in either list. Yet, we are able to show that a man who proposes to w after x when Q′(x; w) is used, must also propose when Q′′(x; w) is used. This result allows us to focus solely on active men that have been discovered in the current invocation of Explore, thereby restricting the number of recursion steps to O(n). Lemma 2. For strategies Q′ and Q′′ in Qw, suppose that x is active in both Q′(w) and Q′′(w). Then a man who is active in Q′(x; w) after x, is also active in Q′′(x; w). Proof. Let y denote a man who is active in Q′(x; w) after x. Consider the following strategies, Qy = (Q′(−w), Q′(y, x; w)) and Qx = (Q′′(−w), Q′′(x; w)), and the M -optimal matchings denoted by µ1 and µ2, respectively; i.e. µ1[w] = y and µ2[w] = x. The lists are complete, and Q(y) = P (y), so either µ2[y] > w, or w > µ2[y] in P (y). If µ2[y] > w then matching µ2 is Qy-stable. Thus, both µ1 and µ2 are Qy-stable, with µ1 being the men-optimal matching. But, then w = µ1[y] ≥ µ2[y] in P (y), contradicting the initial assumption that µ2[y] > w. Therefore, we conclude that w > µ2[y] in P (y), implying that y should propose to w before µ2[y] or that y is active in Q′′(x; w). Hence, the proof is complete. 7 The next lemma will complete the proof. Note that we are still using AS′(w), as given in the proof of 1, and using that to define the following lists for w, Q1(w) = Q1(y1; w), and Qj+1(w) = [yj+1, Qj(w) \ {yj}], for 1 ≤ j ≤ s − 1. Lemma 3. For each j, 1 ≤ j ≤ s, the algorithm invokes Q(yj, I; w) for some tuple I and each man in (cid:8)xij−1+2, . . . , xij , yj+1(cid:9) is active in it. Proof. By induction. The base case is given by y1, for which it has been shown earlier that Q(y1; w) is invoked at the beginning and every man in {x2, . . . , xi1 , y2} is active in Q(y1; w) after y1. Thus, the base case has been proved. Suppose that the induction hypothesis holds for yt, where t ≤ s − 2, i.e. for some tuple I, Q(yt, I; w) is invoked, and each man in (cid:8)xit−1+2, . . . , xit, yt+1(cid:9) is active in it. We will complete the proof by showing that the hypothesis holds for yt+1. If yt+1 is "new", i.e. it is added to N during the invocation of Q(yt, I; w), then Q(yt+1, yt, I; w), is invoked subsequently. Using the fact that yt+1 is active in both Qt+1(w) and Q(yt, I; w), and all the men in {xit+2, . . . , yt+2} are active in Qt+1(w) after yt+1, 2 applied to each of them, implies that they are also active in Q(yt+1, yt, I; w). Hence, for this case, the hypothesis is proved for yt+1. If yt+1 is already in N when Q(yt, I; w) is invoked, then for some tuple I ′, yt+1 should have been added to N , during the invocation of Q(I ′; w). Thus, Q(yt+1, I ′; w) would have been invoked prior to Q(yt, I; w). Using the same argument (on Qt+1(w) and Q(yt+1, I ′; w)) that we used for the earlier case, we conclude that even for this case, the hypothesis holds for yt+1. Thus, we have shown that all the men in AS′(w) are active somewhere during the execution of the algorithm and thus, all are present in N at the end of the execution. This completes the proof of 1. Algorithm 1: A(Q, w), [TST01] Input: Strategy Q, and a woman w ∈ W Output: Sets N = {m ∈ M ∃ Q′ ∈ Qw, µQ′[w] = m}, and L = {Q(m, I; w) m ∈ N, Q′ = (Q(−w), Q(m, I; w)), µQ′[w] = m} 1 Let x1 be the first active man in Q(w); 2 Let N ←− {x1} and L ←− {Q(x1; w)}; 3 Explore(Q(x1; w)); Procedure Explore(Q(x; w)) Let A ←− {men who are active in Q(x; w) after x}; foreach y ∈ A \ N do N ←− N ∪ {y} and L ←− L ∪ {Q(y, x; w)}; Explore(Q(y, x; w)); return (N, L); 4 Algorithm for P -Stable Nash Equilibrium In this section, we consider the problem of deciding, for a given true preference P , and stated preference Q, whether Q is P -stable Nash equilibrium. We show that this problem is solvable in time O(n4). Algorithm 2 uses Algorithm 1 as a subroutine. To show the correctness of Algorithm 2, the following lemma plays a key role. 8 Algorithm 2: Algorithm for testing P -stable Nash equilibrium Input: True strategy P , stated strategy Q, and the set of women W . Output: Answers "Yes", if Q is a P -stable Nash equilibrium, else "No". foreach w ∈ W do Run Algorithm 1 to obtain Nw(Q) and Lw(Q); Let N ′ ←− {m ∈ Nw(Q) s.t. w prefers m to µQ[w] w.r.t P (w)}; foreach m ∈ N ′ do Let Q(m, I; w) ∈ Lw(Q) be the list that yields (m, w) as a matched pair; Compute µ, the men-optimal stable matching for (Q(−w), Q(m, I; w)); if µ is P -stable then return "No"; return "Yes"; Lemma 4. Suppose that Q is an arbitrary (unilateral) manipulation strategy of woman w. Then for any (fixed) man m, a Q-stable matching (if any) that matches m to w, is unique. Proof. Let Q be an arbitrary manipulation strategy by which w attains m, and let µ denote the men-optimal stable matching for Q. Algorithm 1 computes a list Q(m, I; w), such that w attains m by the strategy Q∗ = (Q(−w), Q(m, I; w)). Note that m appears at the front of the list Q∗(w) = Q(m, I; w). Let µ∗ be the men-optimal stable matching for Q∗. Our goal is to show that µ = µ∗. Claim 1. For each m, µ∗[m] ≥ µ[m], in Q(m). Proof. We begin by showing that µ is Q∗-stable. Note that µ is Q-stable, and Q and Q∗ differ only in w's list. Hence, if there is a Q∗-blocking pair in µ, then it must contain w. However, this is impossible since w is matched with m, who is at the front of the list Q∗(w). Therefore, µ must be Q∗-stable. Since µ∗ is the man-optimal stable matching for Q∗ and µ is a Q∗-stable matching, conse- quently, for each man m ∈ M : µ∗[m] ≥ µ[m], in Q∗(m). Since Q∗(m) = Q(m), for each man m, the claim is proved. Claim 2. For each m, µ[m] ≥ µ∗[m], in Q(m). Proof. We will show that µ∗ is Q-stable. Suppose that it is not. Then there is Q-blocking pair in µ∗, and it includes w for the same reason as in the proof of 1. Let (m′, w) denote a Q-blocking pair. Then w > µ∗[m′], in Q(m′), and m′ > µ∗[w], in Q(w). By 1, m′ prefers w to µ[m′], and recall that µ∗[w] = µ[w] = m. Hence, (m′, w) is a Q- blocking pair in µ, a contradiction. Again, for the same reason as in the proof of 1, we can conclude that µ[m] ≥ µ∗[m], in Q(m), for each man m. By Claims 1 and 2, µ[m] = µ∗[m] for each man m. Thus, µ = µ∗, completing the proof of 4. Theorem 2. Algorithm 2 solves our Problem in O(n4) time. 9 Proof. For each woman, Algorithm 2 runs Algorithm 1 whose time complexity is O(n3). The size of set N is at most n, and Algorithm 2 runs GS-M, whose time complexity is O(n2), on (Q(−w), Q(m; w)) for each m ∈ N . Therefore, its running time is O(n3) for each woman. Since there are n women, the total running time of Algorithm 2 is O(n4). Suppose that Algorithm 1 outputs "No". Then, it implies that a P -stable manipulation strategy was found by Algorithm 1, and therefore Q is not P -stable Nash equilibrium. For the opposite direction, suppose that Q is not a P -stable Nash equilibrium and there exists a woman w who has a P -stable manipulation strategy Q′. Then µQ′[w] is added to N when Algorithm 1 is run for w, and by 4 the matching µQ′ is uniquely defined. Since µQ′ is P -stable, Algorithm 2 must output "No." References [DF81] L. E. Dubins and D. A. Freedman. Machiavelli and the gale-shapley algorithm. The American Mathematical Monthly, 88(7):485 -- 494, 1981. [DGS87] G. Demange, D. Gale, and M. Sotomayor. A further remark on the stable matching problem. Discrete Applied Mathematics, 16:217 -- 222, 1987. [DST15] Y. Deng, W. Shen, and P. Tang. Coalition manipulations of the gale-shapley algo- rithm. arXiv:1502.07823, 2015. [Ehl08] [GI89] [GS62] [GS85] [Hua06] [III+13] [IM05] [KM10] L. Ehlers. Truncation strategies in matching markets. Mathematics of Operations Research, 33(2):327 -- 335, 2008. D. Gusfield and R. W. Irving. The Stable Marriage Problem-Structure and Algo- rithm. The MIT Press, 1989. D. Gale and L. S. Shapley. College admissions and the stability of marriage. Amer- ican Mathematical Monthly, 69:9 -- 15, 1962. D. Gale and M. Sotomayor. Ms. machiavelli and the gale-shapley algorithm. Amer- ican Mathematical Monthly, 92(4):261 -- 268, 1985. C-C. Huang. Cheating by men in the gale-shapley stable matching algorithm. In ESA'06, volume 4168 of LNCS, pages 418 -- 431, 2006. T. Inoshita, R.W. Irving, K. Iwama, S. Miyazaki, and T. Nagase. Improving man- optimal stable matchings by minimum changes to preference lists. Algorithms, 6(2):371 -- 382, 2013. N. Immorlica and M. Mahidian. Marriage, honesty and stability. In Proceedings of SODA'05, pages 53 -- 62, 2005. H. Kobayashi and T. Matsui. Cheating strategies for the gale-shapley algorithm with complete preference lists. Algorithmica, 58:151 -- 169, 2010. [Man13] D. F. Manlove. Algorithmics of matching under preferences, volume 2 of Theoretical Computer Science. World Scientific, 2013. [PRVW11] M. S. Piny, F. Rossi, K. B. Veneble, and T. Walsh. Manipulation complexity and gender neutrality in in stable marriage procedures. Auton. Agent Multi-Agent Sys- tems, 22(183 -- 199), 2011. 10 [RR99] [RS90] [TST01] A. E. Roth and U. G. Rothblum. Truncation strategies in matching markets-in search of advice for participants. Econometrica, 67(1):21 -- 43, 1999. A. E. Roth and M. Sotomayor. Two-Sided Matching: A Study in Game Theoretic Modeling and Analysis. Cambridge Univ. Press, 1990. C-P. Teo, J. Sethuraman, and W-P. Tan. Gale-shapley stable marriage problem revisited : Strategic issues and applications. Management Science, 47(9):1252 -- 1267, 2001. 11
1705.06559
1
1705
2017-05-18T12:53:56
Exemplar or Matching: Modeling DCJ Problems with Unequal Content Genome Data
[ "cs.DS", "cs.CE", "q-bio.GN" ]
The edit distance under the DCJ model can be computed in linear time for genomes with equal content or with Indels. But it becomes NP-Hard in the presence of duplications, a problem largely unsolved especially when Indels are considered. In this paper, we compare two mainstream methods to deal with duplications and associate them with Indels: one by deletion, namely DCJ-Indel-Exemplar distance; versus the other by gene matching, namely DCJ-Indel-Matching distance. We design branch-and-bound algorithms with set of optimization methods to compute exact distances for both. Furthermore, median problems are discussed in alignment with both of these distance methods, which are to find a median genome that minimizes distances between itself and three given genomes. Lin-Kernighan (LK) heuristic is leveraged and powered up by sub-graph decomposition and search space reduction technologies to handle median computation. A wide range of experiments are conducted on synthetic data sets and real data sets to show pros and cons of these two distance metrics per se, as well as putting them in the median computation scenario.
cs.DS
cs
Exemplar or Matching: Modeling DCJ Problems with Unequal Content Genome Data Zhaoming Yin2, Jijun Tang1,3∗, Stephen W. Schaeffer4 and David A. Bader2? 1 School of Computer Science and Technology, Tianjin University, China 2 School of Computational Science and Engineering, Georgia Institute of Technology, USA 3 Dept. of Computer Science and Engineering, University of South Carolina, USA 4 The Huck Institutes of Life Sciences, Pennsylvania State University, USA Abstract. The edit distance under the DCJ model can be computed in linear time for genomes with equal content or with Indels. But it becomes NP-Hard in the presence of duplications, a problem largely unsolved especially when Indels are considered. In this paper, we compare two mainstream methods to deal with duplications and associate them with Indels: one by deletion, namely DCJ-Indel-Exemplar distance; versus the other by gene matching, namely DCJ-Indel-Matching distance. We design branch-and-bound algorithms with set of optimization methods to compute exact distances for both. Furthermore, median problems are discussed in alignment with both of these distance methods, which are to find a median genome that minimizes distances between itself and three given genomes. Lin-Kernighan (LK) heuristic is leveraged and powered up by sub-graph decomposition and search space reduction technologies to handle median computation. A wide range of experiments are con- ducted on synthetic data sets and real data sets to show pros and cons of these two distance metrics per se, as well as putting them in the me- dian computation scenario. Keywords: Genome Rearrangement, Double-cut and Join (DCJ), Lin- Kernighan Heuristic. 1 Introduction Over the last years, many distance metrics have been introduced to calculate the dissimilarity between two genomes by genome rearrangement [2,3,5,30]. Among them, DCJ distance is largely studied in recent years due to its capability to model various forms of rearrangement events, with a cheap cost of linear time computation. However, when consiering duplications, the distance computation becomes NP-hard [10] and APX-hard [1,12] for various distance models. There are two approaches to treat duplications, both are targeted at removing du- plicated genes, so that existing linear algorithms can be utilized subsequently. ? Corresponding Authors 2 The first approach identifies the so called exemplar genes [23] in order to retain one copy gene in each duplicated gene family, while the other assigns one-to- one matching to every duplicated genes in each gene family [24,25]. Situated in the context of duplications, gene insertion and deletion (Indels) are also impor- tant rearrangement events that results in unequal contents [8]. Pioneer works were conducted to study the sorting and distance computation by reversals with Indels [17]. Later on, the DCJ-Indel distance metric was introduced to take ad- vantages of the DCJ model. Braga et al [7] proposed the first framework to compute the DCJ-Indel distance; Compeau later simplified the problem with a much more elegant distance formula [13]. In this paper, we adapt the previous research results to design algorithms that procure the ability to handle both duplications and Indels when computing DCJ distance. As evolutionary analysis generally involves more than two species, it is necessary to extend the above distances to deal with multiple genomes. Since three species form the smallest evoliutionary tree, it is critical to study the median problem, which is to construct a genome that minimizes the sum of distances from itself to the three input genomes [6,18]. The median problem is NP-hard under most distance metrics [4, 9, 21, 27]. Several exact algorithms have been implemented to solve the DCJ median problems on both circular [27,29] and linear chromo- somes [26,28]. Some heuristics are brought forth to improve the speed of median computation, such as linear programming (LP) [9], local search [16], evolution- ary programming [14], or simply searching on one promising direction [22]. All these algorithms are intended for solving median problems with equal content genomes, which are highly unrealistic in practice. In this paper, we implement a Lin-Kernighan heuristic leveraging the aforementioned two distance metrics to compute DCJ median when duplications and Indels are considered. 2 Background 2.1 Genome Rearrangement Events and their Graph Representations Genome Rearrangement Events The ordering of a genome can be changed through rearrangement events such as reversals and transpositions. Fig 1 shows examples of different events of a single chromosome (1 -2 3 4 -5 6 7). In the exam- ples, we use signed numbers to represent different genes and their orientations. Genome rearrangement events involve with multiple combinatorial optimization problems and graph representation is common to abstract these problems. In this part, we will address the foundations of using the breakpoint graph to abstract genome rearrangement events. Breakpoint Graph Given an alphabet A, two genomes Γ and Π are represented by two strings of signed (+ or −) numbers (representing genes) from A. Each gene a ∈ A is represented by a pair of vertices head ah and tail at; If a is positive 3 Fig. 1. Example of different rearrangement events. (a) Example of BPG (b) Example of DCJ Fig. 2. Examples of BPG; and DCJ operations. ah is putted in front of at, otherwise at is putted in front of ah. For a, b ∈ A, if a, b ∈ Γ and are adjacent to each other, their adjacent vertices will be connected by an edge. For a telomere genes, if it exists in a circular chromosome, two end vertices will be connected by an edge; if it exists in a linear chromosome, two end vertices will be connected to a special vertex called CAP vertex. If we use one type of edges to represent adjacencies of gene order Γ and another type of edges to represent adjacencies of gene order Π, the resulting graph with two types of edges is called breakpoint graph (BPG). Fig 2(a) shows the BPG for gene order Γ (1,-2,3,-6,5) (edge type: solid edges) which has one circular chromosome and Π (1,2,3,7,4) (edge type: dashed edges) which has one linear chromosome. DCJ operation Double-cut and join (DCJ) operations are able to simulate all rearrangement events. In a BPG, these operations cut two edges (within one genome) and rejoin them using two possible combinations of end vertices (shown in Fig 2(b)). 2.2 Distance computation DCJ distance DCJ distance of genomes with the same content can be easily calculated by enumerating the number of cycles/paths in the BPG [30], which is of linear complexity. DCJ-Indel distance When Indels are introduced in BPG, with two genomes Γ and Π, the vertices and edges of a closed walk form a cycle. In Fig 2(a), the 4 walk (1t, (1t; 2h), 2h, (2h; 3h), 3h, (3h; 2t), 2t, (2t; 1t), 1t) is a cycle. A vertex v is π-open (γ-open) if v 6∈ Γ (v 6∈ Π). An unclosed walk in BPG is a path. Based on different kinds of ends points of paths, we can classify paths into different types. If the two ends of a path are CAP vertices, we simply denote this path as p0. If a path is ended by one open vertex and one CAP, we denote it as pπ (pγ). If a path is ended by two open vertices, we denote it by the types of its two open vertices: for instance, pπ,γ represents a path that ends with a π-open vertex and a γ-open vertex. In Fig 2(a), the walk (5t, (5t; 1h), 1h, (1h; CAP), CAP) is a pγ path and the walk (6t, (6t; 3t), 3t, (3t; 7h), 7h) is a pγ,π path. A path is even (odd), if it contains even (odd) number of edges. In [13], if A= N the DCJ distance between two genomes with Indels but without duplications is calculated by equation (1). We call this distance DCJ-Indel distance. From this equation, we can easily get the DCJ-Indel distance between Γ and Π in Fig 2(a) as 4. dindel(Γ, Π) = N − [c+pπ,π+pγ,γ+bpπ,γc] (1) + 1 2(p0 even+min(pπ odd,pπ even) + min(pγ odd> pγ odd,pγ even,pγ even) + δ) odd> pγ even or even,pγ odd< pγ Where δ = 1 only if pπ,γ is odd and either pπ even; Otherwise, δ = 0. pπ odd< pγ DCJ-Exemplar(Matching) distance There are in general two approaches to cope with duplicated genes. One is by removing all but keeping one copy in a gene family to generate an exemplar pair [23] and the other is by relabeling duplicated genes to ensure that every duplicated gene has unique number [24, 25]. Both of these two distances can be computed with BPG using branch-and- bound methods. For both of the distance metrics, the upper bound can be easily derived by assigning an arbitrary mapping to two genomes then computing their mutual distance. In paper [23] regarding exemplar distance, it's proved that by removing all occurrences of unfixed duplicated gene families, the resulting distance is monotony decreasing, hence the resulting distance can be served as a lower bound. In paper [11] regarding matching distance, the authors proposed a way for computing lower bounds by measuring the number of breakpoints between two genomes, which might not directly imply the lower bound between genomes with Indels. However, it is still possible to use this method to find a 'relaxed' lower bound. Distance Estimation Note that mathematically optimized distance might not reflect the true number of biological events, thus several estimation methods such as EDE or IEBP are used to rescale these computed distances [19] to better fit true evolutionary history. 2.3 Median Computation If there are three given genomes, the graph constructed by pre-defined BPG rule is called a Multiple Breakpoint Graph (MBG). Figure 3(a) shows an ex- 5 (a) MBG (b) 0-matching (c) Adequate subgraph and edge shrinking Fig. 3. (top) Examples of MBG with three input genomes: (1,2,3,4) (solid edges); (1,2,-3,4) (dashed edges) and (2,3,1,-4) (dotted edges).; (middle) 0-matching operation; (bottom) edge shrinking operations. ample of MBG with three input genomes. When there are only equal content genomes, the DCJ median problem can be briefly described by finding a max- imum matching (which is called 0-matching) in MBG. Figure 3(b) shows an example of 0-matching which is represented by gray edges. In [29], it is proven that a type of sub-graph called adequate sub-graph (AS) could be used to decom- pose the graph with edge shrinking operations, which are shown in Figure 3(c). Unfortunately, there is no branch-and-bound based median algorithm that deals with unequal content genomes. In the following section, we will show that it is actually difficult to design such algorithm. 3 Approaches 3.1 Proposed Distance Metrics We have discussed DCJ, DCJ-Indel and DCJ-Exemplar(Matching) distances, here we formally define the DCJ-Indel-Exemplar(Matching) distances as follows: Definition 1. An exemplar string is constructed by deleting all but one occur- rence of each gene family. Among all possible exemplar strings, the minimum distance that one exemplar string returns is the DCJ-Indel-Exemplar distance. Definition 2. A matching string is constructed by assigning a one-to-one map- ping to each occurrence of genes in a gene family and relabel them to distinct markers. Among all possible matching strings, the minimum distance that one matching string returns is the DCJ-Indel-Matching distance. 6 Fig. 4. Examples of exemplar and matching distance in the form of BPG representa- tion. Figure 4 shows examples of BPG representation of exemplar mapping from genome Γ (1, -2, 3, 2, -6, 5) and genome Π (1, 2, 3, 7, 2, 4) to Γ (1, 3, 2, - 6, 5) and genome Π (1, 3, 7, 2, 4), and a matching that mapping from genome Γ (1, -2, 3, 2, -6, 5) and genome Π (1, 2, 3, 7, 2, 4) to Γ (1, -2, 3, 2', -6, 5) and genome Π (1, 2', 3, 7, 2, 4). We can use branch-and-bound methods which are applied in DCJ-Exemplar (Matching) distances to solve these two distances. 3.2 Optimization Methods Optimal Assignments Although branch-and-bound algorithms are based on enumerating the number of cycles/path in BPG, it is not necessary to enumerate every component in the graph, as both [11, 25] indicated that there are some specific patterns in BPG which can be fixed before the distance computation. In this paper, we will extend their result in our optimization methods for DCJ- Indel-Exemplar(Matching) distances. To begin with, we define some terms for future explanation. There are two cate- gories of vertices in a BPG: one connects exactly one edge of each edge type (in this paper edge types are expressed by such as dotted, dashed edges etc.), they are called regular vertices; the other connects fewer or more than one edges of each edge type, they are called irregular vertices. A subgraph in a BPG that only 7 contains regular vertices is defined as regular subgraph, while one that contains irregular vertices is defined as irregular subgraph. In BPG with two genomes Γ and Π, vertices and edges of a closed walk form a cycle. Theorem 1. In a BPG, an irregular subgraph which is a cycle of length 2 can be fixed before computation without losing accuracy. Proof. Without loss of generality, the proof is sound for both DCJ-Indel-Exemplar and DCJ-Indel-Matching distances. We prove the theorem under two cases: 1. for the subgraph in the component which only contains cycles, this is a case that is exactly the same as mentioned in [25], proof. 2. for the subgraph in the component which contains paths, since no type of the paths has count more than one (which is the count of a cycle), following the similar proof strategy in [25], we can get the same conclusion. (cid:3) Adopting Morph Graph Methods to Condense BPG If a gene family has multiple copies of the gene, its corresponding two vertices (head and tail) in the BPG will have degree of more than one. In contrary, vertex representations of those singleton genes always have degree of one or zero. Once an 'exemplar' or 'matching' is fixed, only edges incident to vertices that have degree of more than one have been changed. We can view the computation of exemplar or matching distance as the process of morphing (or streaming) [32] the BPG in order to find an ad hoc shape of the BPG that achieves optimality. Following this hint, we can bridge out all vertices that are stable and just investigate these dynamically changing vertices without lossing accuracy. Suppose there are V vertices in the BPG, where Vs are stable and Vd are dynamic, the asymptotic speedup for this morph BPG strategy will be O( V Vd Harness the Power of Divide-and-Conquer Approach to Reduce the Problem Space In the paper by Nguyen et al [20], the authors proposed a divide and conquer method to quickly calculate the exemplar distance. Inspired by their idea, we propose the following divide-and-conquer method to compute the above two distances based on the BPG. We have the follow observation: ). Theorem 2. The DCJ-Indel-Exemplar (Matching) distance is optimal iff the choices of exemplar edges (cycle decomposition) in each connected components of BPG are optimal. Proof. Since it's obvious that for regular connected component of BPG, there is only one choice of edges, the proof under this case is trivial. For irregular connected component of BPG, we prove by contrary: suppose there is another edge selection that can result in a better distance, based on the corresponding BPG, there must be at least one connected component that has a better edge selection, replacing it with a better edge selection will result in a better distance, which violates the assumption. (cid:3) 8 Algorithm 1: DCJIndelExem(Matc)Distance Input: G1 and G2 Output: Minimum distance d 2 ←randomly init exemplar(matching) of all duplicated genes of G1, G2; 2 ←remove all duplicated genes of G1, G2; 1 optimization methods on G1, G2; 0 0 2 G 1, G 3 G∗ 1, G∗ 4 min_ub ← DCJIndel(G 0 0 2) ; 1, G 5 min_lb ← DCJIndel(G∗ 1, G∗ 2) ; 6 Init search list L of size min_ub − min_lb and insert G1, G2; 7 while min_ub > min_lb do 8 9 10 11 2 ← pop from L[min_lb]; 1 , G+ G+ for pair ∈ all mappings of next available duplicated gene do 2 ← G+ 1 , G+ G+ 2 fix the exemplar(matching) of pair ; 2 ←randomly init exemplar(matching) of rest duplicated genes G+0 1 , G+0 G+ 1 , G+ 2 ; 2 ←remove rest duplicated genes G+ G+∗ 1 , G+∗ ub ← DCJIndel(G+0 lb ← DCJIndel(G+∗ if lb > min_ub then 1 , G+ 2 ; 1 , G+0 1 , G+∗ 2 ) ; 2 ) ; 1 , G+ if ub < min_ub then discard G+ 1 , G+ 2 min_ub = ub; 12 13 14 15 16 17 18 19 20 21 insert G+ 22 23 return d = min_lb; else else if ub = max_lb then return d = ub ; 1 , G+ 2 into L[lb] Combining three optimization methods in tandem with the branch-and-bound framework, we can summarize our algorithm to compute DCJ-Indel-Exemplar (Matching) distance as outlined in Algorithm 1. 3.3 Adapting Lin-Kernighan Heuristic to Find the Median Genome Problem Statement Not surprisingly, finding the median genome that mini- mizes the DCJ-Indel-Exemplar(Matching) distance is challenging. To begin with, given three input genomes, there are multiple choices of possible gene content selections for the median; however, since identifying gene content is simpler and there exists very accurate and fast methods to fulfil the task [15], we are more interested on a relaxed version of the median problem that assumes known gene content on the median genome. Which is formally defined as: 9 Definition: Given the gene content of a median genome, and gene orders of three input genomes. Find an adjacency of the genes of the median genome that minimize the DCJ-Indel-Exemplar(Matching) distance between the median genome and the three input genomes. The DCJ-Indel-Exemplar(Matching) median problem is not even in the class of NP because there is no polynomial time algorithm to verify the results. It is hard to design an exact branch-and-bound algorithm for the DCJ-Indel- Exemplar(Matching) median problem mainly because the DCJ-Indel distance violates the property of triangular inqueality which is required for a distance metrics [31]. Furthermore, when there are duplicated genes in a genome, it is possible that there are multiple edges of the same type connecting to the same vertex of a 0-matching, which leads to ambiguity in the edge shrinking step and makes the followed branch-and-bound search process very complicated and ex- tremely hard to implement. To overcome these problems, we provide an adaption of Lin-Kernighan (LK) heuristic to help solving this challenging problem. Design of the Lin-Kernighan Heuristic The LK heuristic can generally be divided into two steps: initialize the 0-matching for the median genome, and LK search to get the result. The initialization problem can be described as: given the gene contents of three input genomes, find the gene content of the median genome that minimizes the sum of the number of Indels and duplications operations required to transfer the median gene content to the gene contents of the other three genomes. In this paper, we design a very simple rule to initialize the median gene content: given the counts of each gene family occurred in the three genomes, if two or three counts are the same, we simply select this count as the number of occurrence of the gene family in the median genome; if all three counts are different, we select the median count as the number of occurrence of the gene family in the median genome. After fixing the gene content for the median genome, we randomly set up the 0-matching in the MBG. The followed LK heuristic selects two 0-matching edges on the MBG of a given search node and performs a DCJ operation, obtaining the MBG of a neighboring search node. We expand the search frontier by keeping all neighboring search nodes to up until the search level L1. Then we only examine and add the most promising neighbors to the search list until level L2. The search is continued when there is a neighbor solution yielding a better median score. This solution is then accepted and a new search is initialized from the scratch. The search will be terminated if there are no improvement on the result as the search level limits have been reached and all possible neighbors have been enumerated. If L1 = L2 = K, the algorithm is called K-OPT algorithm. Adopting Adequate Sub-graphs to Simplify Problem Space By using the adequate subgraphs [26, 29], we can prove that they are still applicable for decomposing the graph in the DCJ-Indel-Exemplar(Matching) median problem. 10 Algorithm 2: DCJIndelExem(Matc)Median Input: MBG G, Search Level L1 and L2 Output: 0-matching of G 1 Init search list L of size L1; 2 Init 0-matching of G; 3 currentLevel ← 0 and Improved ← true; 4 while Improved = true do 5 6 7 8 9 10 11 currentLevel ← 0 and Improved ← f alse; Insert G into L[0]; while currentLevel < L2 do G0 ← pop from list L[currentLevel]; if G0 improves the median score then G ← G0; Improved ← true and break ; if currentLevel < L1 then for x ∈ ∀ 0-matching pairs of G do G0 ← perform DCJ on G0 using x; if num_pair(x) > δ then Insert G0 into L[currentLevel + 1] ; else G0 ← perform DCJ on G0 using x = argmax if num_pair(x) > δ then Insert G0 into L[currentLevel + 1] ; num_pair(x) ; x 12 13 14 15 16 17 18 currentLevel ← currentLevel + 1 ; 19 20 return 0-matching of G; Lemma 1. As long as the irregular vertices do not involve, regular subgraphs are applicable to decompose MBG. MBG), and there are O(Q Proof. If there are d number of vertices that contain duplicated edges in MBG, we can disambiguate the MBG by generating different subgraphs that contain only one of the duplicate edge. We call these subgraphs disambiguate MBG, (d- i<d deg(i)) number of d-MBGs. If a regular adequate subgraph exists in the MBG, it must also exists in every d-MBG. Based on the 0-matching solution, we can transform every d-MBG into completed d-MBG (cd- MBG) by constructing the optimal completion [13] between 0-matching and all the other three types of edges. After this step, the adequate subgraphs in every d-MBG still exist in every cd-MBG, thus we can use these adequate subgraphs to decompose cd-MBG for each median problem without losing accuracy. (cid:3) Search Space Reduction Methods The performance bottleneck with the me- dian computation is in the exhaustive search step, because for each search level we need to consider O(E2) possible number of edge pairs, which is O(E2L1) in total. Unlike the well-studied traveling salesman problem (TSP) where it is cheap to find the best neighbor, here we need to compute the DCJ-Indel- 11 Exemplar(Matching) problem,NP-hard distance, which makes this step extremely expensive to conclude. Noticing that if we search neighbors on edges that are on the same 0-i color altered connected component (0-i-comp), the DCJ-Indel- Exemplar(Matching) distance for genome 0 and genome i is more likely to re- duce [32], thus we can sort each edge pair by how many 0-i-comp they share. Suppose the number of 0-i-comp that an edge pair x share is num_pair(x), when the algorithm is in the exhaustive search step (currentLevel < L1), we set a threshold δ and select the edge pairs that satisfy num_pair(x) > δ to add into the search list. When it comes to the recursive deepening step, we select the edge pair that satisfy argmax num_pair(x) to add into the search list. This strategy has two merits: 1) some of the non-promising neighbor solution is eliminated to reduce the search space; 2) the expensive evaluation step which make a function call to DCJ-Indel-Exemplar(Matching) distance is postponed to the time when a solution is retrieved from the search list. The LK based median computation algorithm is as Algorithm 2 shows. x 4 Experimental Results We implement our code with python and C++: the python code realized the optimization methods while the C++ code is implemented on a parallel branch- and-bound framework OPTKit. We conduct extensive experiments to evaluate the accuracy and speed of our distance and median algorithms using both sim- ulated and real biological data. Experimental tests ran on a machine with linux operating system configured with 16 Gb of memory and an Intel(R) Xeon(R) CPU E5530 16 core processor, each core has 2.4GHz of speed. All of the exper- iments ran with a single thread. We choose to use g++-4.8.1 as our compiler. 4.1 Distance Computation To the best of our knowlege, there is no software package that can handle both duplications and Indels. We compare our DCJ-Indel-Exemplar (Matching) dis- tances with GREDO [25], a software package based on linear programming that can handle duplications. Simulated Data The simulated data sets are generated with genomes contain- ing 1000 genes. The Indels rate is set (γ) as 5%, inline with the duplication rate (φ) as 10%. Considering GREDO can not process Indel data, all Indels for GREDO are removed. We compare the change of distance estimation with the variation of mutation rate (θ, which grows from 10% to 100%. The experimental results for simulated data are displayed in Figure 5. 1. For computational time, since the results of time spans over a range of thou- sands of seconds, we display the time with log scale to construe results clearly. 12 (a) Time result for simulated data. (b) Distance result for simulated data. Fig. 5. Experimental results for distance computation using simulated data. (a) γ = φ = 0% and θ varies from 10% to 100%. (b) γ = φ = 5% and θ varies from 10% to 60%. Fig. 6. Experimental results for median computation applying DCJ-Indel-Exemplar distance. When the mutation rate is less than 50%, all three methods perform simi- larly, with the fact that GREDO is faster than both of our branch-and-bound methods. However, GREDO slows down dramatically when the mutation Distance Results Time Results 13 Data brownrat_chicken brownrat_gorilla brownrat_human brownrat_mouse chicken_gorilla chicken_human chicken_mouse gorilla_human gorilla_mouse human_mouse GREDO Exem Matc GREDO Exem Matc 24546 24704 3604.28 172.73 7.45 17922 17966 5707.13 12.64 12.10 17858 17900 3725.76 12.14 12.19 15433 15445 3725.66 14.51 15.06 16379 16421 3725.62 7.57 7.47 16231 16276 3725.65 15712 15745 3726.03 8.16 17798 17798 3607.63 13.94 13.81 18914 18935 4816.31 12.60 12.13 18126 18144 12.45 12.61 1678 1274 1083 790 1491 1521 1528 486 860 749 7.54 7.74 9.82 94.64 Table 1. Experimental results for disntance computation with real data set. (a) γ = φ = 5% and θ varies from 10% to 100%.(b) γ = φ = 10% and θ varies from 10% to 100%. Fig. 7. Experimental results for median computation applying DCJ-Indel-Matching distance. rate is increased, while our branch-and-bound based method takes less in- creased time to finish. 14 2. For computational accuracy, we show the distance results corrected by EDE approach which is one of the best true distance estimator. As for simulated data, we can see that when the mutation rate is small (< 50%) GREDO un- der estimate the distance as opposed to our two branch-and-bound methods; but it will over estimate the distance with the growth of mutation rate. Real data We prepare the real data sets using genomes downloaded from En- senble and processed them following the instructions in [25]. The real data set contains 5 species: brown-rat, chicken, human, mouse and gorilla. For DCJ-Indel- Exemplar (Matching) distance, we only convert the Ensenmble format to adapt the data to our program. Meanwhile, just as the simulated data, all Indels in real data set for GREDO are removed. The results for real data are shown in Table 1. 1. For computational time, the branch-and-bound method shows orders of mag- nitudes of speed up compared with GREDO. We analyze the data, the reason can be construed as the existance of multiple connected comonent in BPG. So that our method can divide the graph into much smaller size, versus GREDO which doesn't have this mechanism. 2. For computational accuracy, the distance results of the real data gives us a taste of how frequently Indels happend in the genome evolution. We can see orders of magnitude of difference between our distance results and GREDO, which is mainly due to the large amount of Indels in the real data set. Note that we did not change the way GREDO compute its distance as in paper [25], in the real distance computation, we should consider Indels in alignment with duplications. 4.2 Median Computation Median Computation We simulate the median data of three genomes using the same strategy as in the distance simulation. In our experiments, each genome is "evolved" from a seed genome, which is identity, and they all evolve with the same evolution rate (θ, γ and φ). The sequence length in the median experiments are reduced to 50, due to performance issues. DCJ-Indel-Exemplar median We analyze the result of using LK algorithm with L1 = 2 and L2 = 3, and the K-OPT algorithm of K = 2. Search space reduction methods are used, with δ = 2 and δ = 3 respectively. 1. To begin with, we compare our result along with equal content data, since there are already benchmark programs to help us performing analysis. We run the exact DCJ median solver (we use the one in [32]) to compare our heuristic with the exact median results. In Fig 6(a), it shows the accuracy of our heuristic versus the exact result. It is shown that when θ ≤ 60%, all results of the LK and K-OPT methods are quite close to the exact solver. 15 For parameter of δ = 2, both LK and K-OPT methods can generate exactly the same results for most of the cases. 2. As for the median results for unequal contents, we set both γ and φ to 5% and increase the mutation (inversion) rate θ from 10% to 60%. We compare our results with the accumulated distance of the three genomes to their simulation seed. Although it can not show the accuracy of our method (since we do not have an exact solver), it can be used as an indicator of how close that our method is to the real evolution. Fig 6(b) shows that when δ = 3, both the LK and K-OPT algorithms get results quite close to the real evolutionary distance. DCJ-Indel-Matching median Since DCJ-Indel-Exemplar median has already given us the result of how LK performs against exact solver, and how different parameters of LK performs. With these things in mind, we choose to use LK with L1 = 2 and L2 = 3 having δ = 2 as the configuration for our DCJ-Indel- Matching median solver. We use the same data as in the previous experiments, and the experimental results are shown in Figure 7(a) and Figure 7(b). We can see that in general, the new implementation is quite close to the real result when γ = 5% and φ = 5% and slightly worse than real result when γ = 10% and φ = 10%. 5 Conclusion In this paper, we proposed a new way to compute the distance and median between genomes with unequal contents (with Indels and duplications). Our distance method can handle Indels which is ubiquitous in the real data set, and is proved to be more efficient as opposed to GREDO. We designed a Lin- Kernighan based method to compute median, which can get close to optimal results in alignment with the exact median solver, and our methods can handle duplications and Indels as well. 6 Acknowledgements This Research was sponsored in part by the NSF OCI-0904461 (Bader), OCI- 0904179, IIS-1161586 (Tang) and OCI- 0904166 (Schaeffer). References 1. Angibaud, S., Fertin, G., Rusu, I., Thévenin, A., Vialette, S.: On the approxima- bility of comparing genomes with duplicates. J. Graph Algorithms Appl. 13(1), 19–53 (2009) 16 2. Bader, D.A., Moret, B.M.E., Yan, M.: A linear-time algorithm for computing in- version distance between signed permutations with an experimental study. Journal of Computational Biology 8, 483–491 (2001) 3. Bafna, V., Pevzner, P.A.: Sorting by transpositions. SIAM J. Discrete Math. 11(2), 224–240 (1998) 4. Bergeron, A., Mixtacki, J., Stoye, J.: On sorting by translocations. In: Journal of Computational Biology. pp. 615–629. Springer (2005) 5. Blin, G., Chauve, C., Fertin, G.: The breakpoint distance for signed sequences. In: Proc. CompBioNets 2004. vol. Text in Algorithms, Volume 3, pp. 3–16. King's College London (2004) 6. Bourque, G., Pevzner, P.A.: Genome-Scale Evolution: Reconstructing Gene Orders in the Ancestral Species. Genome Res. 12(1), 26–36 (2002) 7. Braga, M.D.V., Willing, E., Stoye, J.: Genomic distance with dcj and indels. In: Proceedings of the 10th international conference on Algorithms in bioinformatics. pp. 90–101. WABI'10, Springer-Verlag, Berlin, Heidelberg (2010) 8. Brewer, C., Holloway, S., Zawalnyski, P., Schinzel, A., FitzPatrick, D.: A chromo- somal duplication map of malformations: Regions of suspected haplo and triplo- lethality and tolerance of segmental aneuploidy in humans. The American Journal of Human Genetics 64(6), 1702 – 1708 (1999) 9. Caprara, A.: The Reversal Median Problem. INFORMS Journal on Computing 15(1), 93–113 (2003) 10. Chauve, C., Fertin, G., Rizzi, R., Vialette, S.: Genomes containing duplicates are hard to compare. In: Proc Int. Workshop on Bioinformatics Research and Appli- cations (IWBRA). LNCS, vol. 3992, pp. 783–790. Springer-Verlag, Reading, UK (2006) 11. Chen, X., Zheng, J., Fu, Z., Nan, P., Zhong, Y., Lonardi, S., Jiang, T.: Assign- ment of orthologous genes via genome rearrangement. IEEE/ACM Trans. Comput. Biology Bioinform. 2(4), 302–315 (2005) 12. Chen, Z., Fu, B., Zhu, B.: Erratum: The approximability of the exemplar break- point distance problem. In: FAW-AAIM. p. 368 (2012) 13. Compeau, P.E.C.: A simplified view of dcj-indel distance. In: Proceedings of the 12th international conference on Algorithms in Bioinformatics. pp. 365–377. WABI'12, Springer-Verlag, Berlin, Heidelberg (2012) 14. Gao, N., Yang, N., Tang, J.: Ancestral genome inference using a genetic algorithm approach. PLoS ONE 8(5) (2013) 15. Hu, F., Zhou, J., Zhou, L., Tang, J.: Probabilistic reconstruction of ancestral gene orders with insertions and deletions. IEEE/ACM Trans. Comput. Biology Bioin- form. 11(4), 667–672 (2014), http://doi.ieeecomputersociety.org/10.1109/ TCBB.2014.2309602 16. Lenne, R., Solnon, C., Stutzle, T., Tannier, E., Birattari, M.: Reactive Stochastic Local Search Algorithms for the Genomic Median Problem. In: Carlos Cotta, J.v.H. (ed.) Eighth European Conference on Evolutionary Computation in Combinatorial Optimisation (EvoCOP). pp. 266–276. LNCS, Springer (Mar 2008) 17. Mabrouk, N.E.: Sorting Signed Permutations by Reversals and Inser- tions/Deletions of Contiguous Segments. Journal of Discrete Algorithms 1(1), 105– 122 (2001) 18. Moret, B.M.E., Tang, J., san Wang, L., Warnow, Y.: Steps toward accurate recon- structions of phylogenies from gene-order data. J. Comput. Syst. Sci 65, 508–525 (2002) 17 19. Moret, B.M.E., Wang, L.S., Warnow, T., Wyman, S.K.: New approaches for re- constructing phylogenies from gene order data. In: ISMB (Supplement of Bioinfor- matics). pp. 165–173 (2001) 20. Nguyen, C.T., Tay, Y.C., Zhang, L.: Divide-and-conquer approach for the exemplar breakpoint distance. Bioinformatics 21(10), 2171–2176 (May 2005) 21. Pe'er, I., Shamir, R.: The median problems for breakpoints are np-complete. Elec. Colloq. on Comput. Complexity 71 (1998) 22. Rajan, V., Xu, A.W., Lin, Y., Swenson, K.M., Moret, B.M.E.: Heuristics for the inversion median problem. BMC Bioinformatics 11(S-1), 30 (2010) 23. Sankoff, D.: Genome rearrangement with gene families. Bioinformatics 15(11), 909– 917 (1999) 24. Shao, M., Lin, Y.: Approximating the edit distance for genomes with duplicate genes under dcj, insertion and deletion. BMC Bioinformatics 13(S-19), S13 (2012) 25. Shao, M., Lin, Y., Moret, B.M.E.: An exact algorithm to compute the dcj distance for genomes with duplicate genes. In: RECOMB. pp. 280–292 (2014) 26. Xu, A.W.: Dcj median problems on linear multichromosomal genomes: Graph rep- resentation and fast exact solutions. In: RECOMB-CG. pp. 70–83 (2009) 27. Xu, A.W.: A fast and exact algorithm for the median of three problem: A graph de- composition approach. Journal of Computational Biology 16(10), 1369–1381 (2009) 28. Xu, A.W., Moret, B.M.E.: Gasts: Parsimony scoring under rearrangements. In: WABI. pp. 351–363 (2011) 29. Xu, A.W., Sankoff, D.: Decompositions of multiple breakpoint graphs and rapid exact solutions to the median problem. In: Proceedings of the 8th international workshop on Algorithms in Bioinformatics. pp. 25–37. WABI '08, Springer-Verlag, Berlin, Heidelberg (2008) 30. Yancopoulos, S., Attie, O., Friedberg, R.: Efficient sorting of genomic permutations by translocation, inversion and block interchange. Bioinformatics 21(16), 3340– 3346 (2005) 31. Yancopoulos, S., Friedberg, R.: Sorting genomes with insertions, deletions and duplications by dcj. In: Nelson, C.E., Vialette, S. (eds.) RECOMB-CG. Lecture Notes in Computer Science, vol. 5267, pp. 170–183. Springer (2008) 32. Yin, Z., Tang, J., Schaeffer, S.W., Bader, D.A.: Streaming breakpoint graph an- alytics for accelerating and parallelizing the computation of dcj median of three genomes. In: ICCS. pp. 561–570 (2013)
1811.02177
1
1811
2018-11-06T06:05:14
The entropy of lies: playing twenty questions with a liar
[ "cs.DS", "cs.DM", "math.CO" ]
`Twenty questions' is a guessing game played by two players: Bob thinks of an integer between $1$ and $n$, and Alice's goal is to recover it using a minimal number of Yes/No questions. Shannon's entropy has a natural interpretation in this context. It characterizes the average number of questions used by an optimal strategy in the distributional variant of the game: let $\mu$ be a distribution over $[n]$, then the average number of questions used by an optimal strategy that recovers $x\sim \mu$ is between $H(\mu)$ and $H(\mu)+1$. We consider an extension of this game where at most $k$ questions can be answered falsely. We extend the classical result by showing that an optimal strategy uses roughly $H(\mu) + k H_2(\mu)$ questions, where $H_2(\mu) = \sum_x \mu(x)\log\log\frac{1}{\mu(x)}$. This also generalizes a result by Rivest et al. for the uniform distribution. Moreover, we design near optimal strategies that only use comparison queries of the form `$x \leq c$?' for $c\in[n]$. The usage of comparison queries lends itself naturally to the context of sorting, where we derive sorting algorithms in the presence of adversarial noise.
cs.DS
cs
The entropy of lies: playing twenty questions with a liar Yuval Dagan∗ Yuval Filmus† Daniel Kane‡ Shay Moran§∗ November 7, 2018 Abstract "Twenty questions" is a guessing game played by two players: Bob thinks of an integer between 1 and n, and Alice's goal is to recover it using a minimal number of Yes/No questions. Shannon's entropy has a natural interpretation in this context. It characterizes the average number of questions used by an optimal strategy in the distributional variant of the game: let µ be a distribution over [n], then the average number of questions used by an optimal strategy that recovers x ∼ µ is between H(µ) and H(µ) + 1. We consider an extension of this game where at most k questions can be answered falsely. We extend the classical result by showing that an optimal strategy uses roughly H(µ) + kH2(µ) µ(x) . This also generalizes a result by Rivest et questions, where H2(µ) = Px µ(x) log log 1 Moreover, we design near optimal strategies that only use comparison queries of the form "x ≤ c?" for c ∈ [n]. The usage of comparison queries lends itself naturally to the context of sorting, where we derive sorting algorithms in the presence of adversarial noise. al. (1980) for the uniform distribution. 1 Introduction The "twenty questions" game is a cooperative game between two players: Bob thinks of an integer between 1 and n, and Alice's goal is to recover it using the minimal number of Yes/No questions. An optimal strategy for Alice is to perform binary search, using log n queries in the worst case. The game becomes more interesting when Bob chooses his number according to a distribution µ known to both players, and Alice attempts to minimize the expected number of questions. In this case, the optimal strategy is to use a Huffman code for µ, at an expected cost of roughly H(µ). What happens when Bob is allowed to lie (either out of spite, or due to difficulties in the communication channel)? R´enyi [19] and Ulam [24] suggested a variant of the (non-distributional) "twenty questions" game, in which Bob is allowed to lie k times. Rivest et al. [20], using ideas of Berlekamp [4], showed that the optimal number of questions in this setting is roughly log n + k log log n. There are many other ways of allowing Bob to lie, some of which are described by Spencer and Winkler [23] in their charming work, and many others by Pelc [18] in his comprehensive survey on the topic. ∗Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology. †Computer Science Department, Technion. Taub Fellow -- supported by the Taub Foundations. The research was funded by ISF grant 1337/16. ‡Department of Computer Science and Engineering and Department of Mathematics, University of California at San Diego. §Department of Computer Science, Princeton University. 1 Distributional "twenty questions" with lies. This work addresses the distributional "twenty questions" game in the presence of lies. In this setting, Bob draws an element x according to a distribution µ, and Alice's goal is to recover the element using as few Yes/No questions as possible on average. The twist is that Bob, who knows Alice's strategy, is allowed to lie up to k times. Both Alice and Bob are allowed to use randomized strategies, and the average is measured according to both µ and the randomness of both parties. Our main result shows that the expected number of questions in this case is H(µ) + kH2(µ), where H2(µ) =Xx µ(x) log log 1 µ(x) , up to an additive factor of O(k log k + kH3(µ)), where H3(µ) =Px µ(x) log log log(1/µ(x))) (here µ(x) is the probability of x under µ.) See Section 3 for a complete statement of this result. When µ is the uniform distribution, the expected number of queries that our algorithm makes is roughly log n + k log log n, matching the performance of the algorithm of Rivest et al. However, the approach by Rivest et al. is tailored to their setting, and the distributional setting requires new ideas. As in the work of Rivest et al., our algorithms use only comparison queries, which are queries of the form "x ≺ c?" (for some fixed value c). Moreover, our algoritms are efficient, requiring O(n) preprocessing time and O(log n) time per question. Our lower bounds, in contrast, apply to arbitrary Yes/No queries. Noisy sorting. One can apply binary search algorithms to implement insertion sort. While sorting an array typically requires Θ(n log n) sorting queries of the form "xi ≺ xj?", there are situations where one has some prior knowledge about the correct ordering. This may happen, for example, when maintaining a sorted array: one has to perform consecutive sorts, where each sort is not expected to considerably change the locations of the elements. Assuming a distribution Π over the n! possible permutations, Moran and Yehudayoff [16] showed that sorting a Π-distributed array requires H(Π) + O(n) sorting queries on average. We extend this result to the case in which the answerer is allowed to lie k times, giving an algorithm which uses the following expected number of queries:1 H(Π) + O(nk). This result is tight, and matches the optimal algorithms for the uniform distribution due to Bagchi [3] and Long [15], which use n log n + O(nk) queries. Table 1 summarizes the query complexities of resilient and non-resilient searching and sorting algorithms, in both the deterministic and the distributional settings. To the best of our knowledge, we present the first resilient algorithms in the distributional setting. On randomness. All algorithms presented in the paper are randomized. Since they only employ public randomness which is known for both players, there exists a fixing of the randomness which yields a deterministic algorithm with the same (or possibly smaller) expected number of queries. However, this comes at the cost of possibly increasing the running time of the algorithm (since we need to find a good fixing of the randomness); it would be interesting to derive an explicit efficient deterministic algorithm with a similar running time. 1Strictly speaking, this bound holds only under the mild condition that k is at most exponential in n. 2 Searching Setting No lies; deterministic log n [classical] No lies; distributional H(µ) [classical] k lies; deterministic k lies; distributional Sorting n log n [classical] H(Π) + O(n) [16] log n + k log log n [20] n log n + Θ(nk) [3, 15, 14] H(µ) + kH2(µ) [this paper] H(Π) + Θ(nk) [this paper] Table 1: Query complexities of searching and sorting in different settings, ignoring lower-order terms. All terms are exact upper and lower bounds except for those inside the O(·) and Θ(·) notations. 0 x1 xn 1 . . . µ(x1) µ(xn) Figure 1: Representing items as centers of segments partitioning the interval [0, 1]. 1.1 Main ideas Upper bound. Before presenting the ideas behind our algorithms, we explore several other ideas which give suboptimal results. The first approach that comes to mind is simulating the optimal non-resilient strategy, asking each question 2k + 1 times and taking the majority vote, which results in an algorithm using Θ(kH(µ)) queries on average. A better approach is using tree codes, suggested by Schulman [21] as an approach for making interactive communication resilient to errors [10, 21, 13]. Tree codes are designed for a different error model, in which we are bounding the fraction of lies rather than their absolute number; for an ε-fraction of lies, the best known constructions suffer a multiplicative overhead of 1 + O(√ε) [12]. In contrast, we are aiming at an additive overhead of kH2(µ). Using a packing bound, one can prove that there exists a (non-interactive) code of expected length roughly H(µ) + 2kH2(µ), coming much closer to the bound that we are able to get (but off by a factor of 2 from our target H(µ) + kH2(µ)). The idea, which is similar to the proof of the Gilbert -- Varshamov bound, is to construct a prefix code w1, . . . , wn in which the prefixes of wi, wj of length min(wi,wj) are at distance at least 2k + 1 (whence the factor 2k in the resulting bound); this can be done greedily. Apart from the inferior bound, two other disadvantages of this approach is that it is not efficient and uses arbitrary queries. In contrast to these prior techniques, which do not achieve the optimal complexity, might ask arbitrary questions, and could result in strategies which cannot be implemented efficiently, in this paper we design an efficient and nearly optimal strategy, relying on comparison queries only, and utilizing simple observations on the behavior of binary search trees under the presence of lies. Following the footsteps of Rivest et al. [20], our upper bound is based on a binary search algorithm on the unit interval [0, 1], first suggested in this context by Gilbert and Moore [11]: given x ∈ [0, 1], the algorithm locates x by first asking "x < 1/2?"; depending on the answer, asking "x < 1/4?" or "x < 3/4?"; and so on. If x ∈ [0, 1] is chosen uniformly at random then the answers behave like an infinite sequence of random and uniform coin tosses. In order to apply this kind of binary search to the problem of identifying an unknown ele- ment (assuming truthful answers), we partition the unit interval [0, 1] into segments of lengths µ(x1), . . . , µ(xn), and label the center of each segment with the corresponding item (see Figure 1). 3 < < > > lie < < ... ... Figure 2: On the left, the operation of the algorithm without any lies. On the right, answerer lied on the first question. As a result, all future truthful answers are the same. We then perform binary search until the current interval contains a single item. (In the proof, we use a slightly more sophisticated randomized placement of points which guarantees that the answers on each element behave like an infinite sequence of random and uniform coin tosses.) The main observation is that if a question "x < a?" is answered with a lie, this will be strongly reflected in subsequent answers (see Figure 2). Indeed, suppose that x < a, but Bob claimed that x > a. All subsequent questions will be of the form "x < b?" for various b > a, the truthful answer to all of which is x < b. An observer taking notes of the proceedings will thus observe the following pattern of answers: > (the lie) followed by many <'s (possibly interspersed with up to k − 1 many >'s, due to further lies). This is suspicious since it is highly unlikely to obtain many < answers in a row (the probability of getting r such answers is just 2−r). This suggests the following approach: for each question we will maintain a "confidence interval" consisting of r(d) further questions (where d is the index of the question). At the end of the interval, we will check whether the situation is suspicious (as described in the preceding paragraph), and if so, will ascertain by brute force the correct answer to the original question (by taking a majority of 2k + 1 answers), and restart the algorithm from that point. The best choice for r(d) turns out to be roughly log d. Each time Bob lies, our unrolling of the confidence interval results in a loss of r(d) questions. Since an item x requires roughly log(1/µ(x)) questions to be discovered, the algorithm has an overhead of roughly kr(log(1/µ(x))) ≈ k log log(1/µ(x)) questions on element x, resulting in an expected overhead of roughly kH2(µ). When implementing the algorithm, apart from the initial O(n) time needed to setup the parti- tion of [0, 1] into segments, the costliest step is to convert the intervals encountered in the binary search to comparison queries. This can be done in O(log n) time per query. Lower bound. The proof of our lower bound uses information theory: one can lower bound the expected number of questions by the amount of information that the questioner gains. There are two such types of information: first, the hidden object reveals H(µ) information, as in the setting where no lies are allowed. Second, when the object is revealed, the positions of the lies are revealed as well. This reveals additional H2(µ) (conditional) information, as we explain below. Let dx denote the number of questions asked for element x. Kraft's inequality shows that any good strategy of the questioner satisfies dx ' log(1/µ(x)). If the answerer chooses a randomized strategy in which the positions of the lies are chosen uniformly from the (cid:0)dx k(cid:1) possibilities, these 4 positions reveal log(cid:0)dx over x, the positions of the lies reveal at least kH2(µ) information beyond the identity of x. k(cid:1) ≈ k log dx ' k log log(1/µ(x)) information given x. Taking expectation 1.2 Related work Most of the literature on error-resilient search procedures has concentrated on the non-distributional setting, in which the goal is to give a worse case guarantee on the number of questions asked, under various error models. The most common error models are as follows:2 • Fixed number of errors. This is the error model we consider, and it is also the one suggested by Ulam [24]. This model was first studied by Berlekamp [4], who used an argument similar to the sphere-packing bound to give a lower bound on the number of questions. Rivest et al. [20] used this lower bound as a guiding principle in their almost matching upper bound using comparison queries. • At most a fixed fraction p of the answers can be lies. This model is similar to the one considered in error-correcting codes. Pelc [17] and Spencer and Winkler [23] (independently) gave a non-adaptive strategy for revealing the hidden element when p ≤ 1/4, and showed that the task is not possible (non-adaptively) when p > 1/4. Furthermore, when p < 1/4 there is an algorithm using O(log n) questions, and when p = 1/4 there is an algorithm using O(n) questions, which are both optimal (up to constant factors). Spencer and Winkler also showed that if questions are allowed to be adaptive, then the hidden element can be revealed if and only if p < 1/3, again using O(log n) questions. • At most a fixed fraction p of any prefix of the answers can be lies. Pelc [17] showed that the hidden element can be revealed if and only if p < 1/2, and gave an O(log n) strategy when p < 1/4. Aslam and Dhagat [2] and Spencer and Winkler gave an O(log n) strategy for all p < 1/2. • Every question is answered erroneously with probability p, an error model common in in- formation theory. R´enyi [19] showed that the number of questions required to discover the hidden element with constant success probability is (1 + o(1)) log n/(1 − h(p)). The distributional version of the "twenty questions" game (without lies) was first considered by Shannon [22] in his seminal paper introducing information theory, where its solution was attributed to Fano (who published it later as [8]). The Shannon -- Fano code uses at most H(µ)+ 1 questions on average, but the questions can be arbitrary. The Shannon -- Fano -- Elias code (also due to Gilbert and Moore [11]), which uses only comparison queries, asks at most H(µ)+2 questions on average. Dagan et al. [7] give a strategy, using only comparison and equality queries, which asks at most H(µ) + 1 questions on average. Sorting The non-distributional version of sorting has also been considered in some of the settings considered above: • At most k errors: Lakshmanan et al. [14] gave a lower bound of Ω(n log n+kn) on the number of questions, and an almost matching upper bound of O(n log n + kn + k2) questions. An 2This section is heavily based on Pelc's excellent and comprehensive survey [18] 5 optimal algorithm, using n log n + O(kn) questions, was given independently by Bagchi [3] and Long [15]. • At most a p fraction of errors in every prefix: Aigner [1] showed that sorting is possible if and only if p < 1/2. Borgstrom and Kosaraju [5] had showed earlier that even verifying that an array is sorted requires p < 1/2. • Every answer is correct with probability p: Feige et al. [9] showed in an influential paper that Θ(n log(n/ǫ)) queries are needed, where ǫ is the probability of error. • Braverman and Mossel [6] considered a different setting, in which an algorithm is given access to noisy answers to all possible(cid:0)n 2(cid:1) comparisons, and the goal is to find the most likely permutation. They gave a polynomial time algorithm which succeeds with high probability. The distributional version of sorting (without lies) was considered by Moran and Yehudayoff [16], who gave a strategy using at most H(µ) + 2n queries on average, based on the Gilbert -- Moore algorithm. Paper organization. After a few preliminaries in Section 2, we describe our results in full in Section 3. We prove our lower bound on the number of questions in Section 4. We present our main upper bound in Section 5, and an improved version in Section 6. We close the paper with a discussion of sorting in Section 7. 2 Definitions We use the notation (cid:0) n ≤k(cid:1) = Pk define log(x) = log(x + C) and ln(x) = ln(x + C) for a fixed sufficiently large constant C > 0 satisfying log log log C > 0. ℓ(cid:1). Unless stated otherwise, all logarithms are base 2. We ℓ=0(cid:0)n Information theory. Given a probability distribution µ with countable support, the entropy of µ is given by the formula H(µ) = Xx∈supp µ µ(x) log 1 . µ(x) Twenty questions game. We start with an intuitive definition of the game, played by a ques- tioner (Alice) and an answerer (Bob). Let U be a finite set of elements, and let µ be a distribution over U , known to both parties. The game proceeds as follows: first, an element x ∼ µ is drawn and revealed to the answerer but not to the questioner. The element x is called the hidden element. The questioner asks binary queries of the form "x ∈ Q?" for subsets Q ⊆ U . The answerer is allowed to lie a fixed number of times, and the goal of the questioner is to recover the hidden element x, asking the minimal number of questions on expectation. Decision trees. Let U be a finite set of elements. A decision tree T for U is a binary tree formalizing the question asking strategy in the twenty questions game. Each internal node of v of T is labeled by a query (or question) -- a subset of U , denoted by Q(v); and each leaf is labeled by the output of the decision tree, which is an element of U . The semantics of the tree are as 6 follows: on input x ∈ U , traverse the tree by starting at the root, and whenever at an internal node v, go to the left child if x ∈ Q(v) and to the right child if x /∈ Q(v). Comparison tree. Given an ordered set of elements x1 ≺ x2 ≺ ··· ≺ xn, comparison questions are questions of the form Q = {x1, . . . , xi−1}, for some i = 1, . . . , n+1. In other words, the questions are "x ≺ xi?" for some i = 1, . . . , n + 1. An answer to a comparison question is one of {≺,(cid:23)}. A comparison tree is a decision tree all of whose nodes are labeled by comparison questions. Adversaries. Let k ≥ 0 be a bound on the number of lies. An intuitive way to formalize the possibility of lying is via an adversary. The adversary knows the hidden element x and receives the queries from the questioner as the tree is being traversed. The adversary is allowed to lie at most k times, where each lie is a violation of the above stated rule. Formally, an adversary is a mapping that receives as input an element x ∈ X, a sequence of the previous queries and their answers, and an additional query Q ⊆ U , which represents the current query. The output of the adversary is a boolean answer to the current query; this answer is a lie if it differs from the truth value of "x ∈ Q". distribution over decision trees and a randomized adversary is a distribution over adversaries. We also allow the adversary and the tree to use randomness: a randomized decision tree is a Computation and complexity. The responses of the adversary induce a unique root-to-leaf path in the decision tree, which results in the output of the tree. A decision tree is k-valid if it outputs the correct element against any adversary that lies at most k times. Given a k-valid decision tree T and a distribution µ on U , the cost of T with respect to µ, denoted c(T, µ), is the maximum, over all possible adversaries that lie at most k times, of the expected3 length of the induced root-to-leaf path in T . Finally, the k-cost of µ, denoted ck(µ), is the minimum of c(T, µ) over all k-valid decision trees T . Basic facts. We will refer to the following well-known formula as Kraft's identity: Fact 2.1 (Kraft's identity). Fix a binary tree T , let L be its set of leaves and let d(ℓ) be the depth of leaf ℓ. The following applies: 2−d(ℓ) ≤ 1. Xℓ∈L(T ) We will use the following basic lower bound on the expected depth by the entropy: Fact 2.2. Let T be a binary tree and let µ be a distribution over its leaves. Then In other words, for any distribution µ, c0(µ) ≥ H(µ). In fact, it is also known that c0(µ) ≤ H(µ) + 1. H(µ) ≤ E ℓ∼µ(cid:2)d(ℓ)(cid:3). 3The expectation is also taken with respect to the randomness of the adversary and the tree when they are randomized. 7 3 Main results This section is organized as follows: The lower bound is presented in Section 3.1. Then, the two searching algorithms are presented in Section 3.2, and finally the application to sorting is presented in Section 3.3. 3.1 Lower bound In this section we present the following lower bound on ck(µ), namely, on the expected number of questions asked by any k-valid tree (not necessarily a comparison trees). Theorem 3.1. For every non-constant distribution µ and every k ≥ 0, The proof of this lower bound appears in Section 4. log log 1 µ(x)(cid:17) − (k log k + k + 1). ck(µ) ≥(cid:16) E x∼µ µ(x)(cid:17) + k(cid:16) E x∼µ 1 log Proof overview. Consider a k-valid tree; we wish to lower bound the expected number of ques- tions for x ∼ µ. Let dx denote the number of questions asked when the secret element is x. Then, by the entropy lower bound when the number of mistakes is k = 0, it follows that typ- ically, dx & log(1/µ(x)). Moreover, the transcript of the game (i.e. the list of questions and answers) determines both x and the positions of the k lies. This requires dx + k log(dx) & log(1/µ(x)) + k log log(1/µ(x)) bits of information. Taking expectation over x ∼ µ then yields the stated bound. Our proof formalizes this intuition using standard and basic tools from information theory. One part that requires a subtler argument is showing that indeed one may assume that dx & log(1/µ(x)) for all x. This is done by showing that any k-valid tree can be modified to satisfy this constraint without increasing the expected number of questions by too much. The crux of this argument, which relies on Kraft's identity (Fact 2.1), appears in Lemma 4.1. 3.2 Upper bounds We introduce two algorithms. The first algorithm, presented in Section 3.2.1, is simpler, however, the second algorithm has a better query complexity. The expected number of questions asked by the first algorithm is at most H(µ) + (k + 1)H2(µ) + O(k2H3(µ) + k2 log k), where H3(µ) =Xx µ(x) log log log 1 µ(x) . The second algorithm, presented in Section 3.2.2, removes the quadratic dependence on k, and has an expected complexity of: H(µ) + kH2(µ) + O(kH3(µ) + k log k). In Section 3.2.3 we robustify the guarantees of these algorithms and consider scenarios where the exact distribution µ is not known but only some prior η ≈ µ, or where the actual number of lies is less than the bound k (whence the algorithm achieves better performance). 8 3.2.1 First algorithm Suppose that we are given a probability distribution µ whose support is the linearly ordered set x1 ≺ ··· ≺ xn. In this section we overview the proof of the following theorem (the complete proof appears in Section 5): Theorem 3.2. There is a k-valid comparison tree T with c(T, µ) ≤ H(µ) + (k + 1) n Xi=1 µi log log 1 µi + O k2 n Xi=1 µi log log log 1 µi + k2 log k! , where µi = µ(xi). The question-asking strategy simulates a binary search to recover the hidden element. If, at some point, the answer to some question q is suspected as a lie then q is asked 2k + 1 times to verify its answer. When is the answer to q suspected? The binary search tree is constructed in a manner that if no lies are told then roughly half of the questions are answered ≺, and half (cid:23). However, if, for example, the lie "x (cid:23) x50" is told when in fact x = x10, then all consecutive questions will be of the form "x ≺ xi?" for i > 50, and the correct answer would always be ≺. Since no more than k lies can be told, almost all consecutive questions will be answered ≺, and the algorithm will suspect that some earlier question is a lie. We start by suggesting a question-asking strategy using comparison queries which is valid as long as there are no lies, and then show how to make it resilient to lies. Each element xi is mapped to a point pi in [0, 1], such that p1 < p2 < ··· < pn. Then, a binary search on the interval [0, 1] is performed, for finding the point pi corresponding to the hidden element. The search proceeds by maintaining a Live interval, which is initialized to [0, 1]. At any iteration, the questioner asks whether pi lies in the left half of the Live interval. The interval is updated accordingly, and its length shrinks by a factor of 2. This technique was proposed by Gilbert -- Moore [11], and is presented in AuxiliaryAlgorithm 1, as an algorithm which keeps asking questions indefinitely. AuxilliaryAlgorithm 1 Randomized Gilbert -- Moore 1: Live ← [0, 1] 2: loop 3: 4: 5: 6: 7: 8: m ← midpoint of Live X ← {i : pi ≥ m} if x ∈ X then else Live ← right half of Live Live ← left half of Live end if 9: 10: end loop The points p1, . . . , pn are defined as follows: first, a number θ ∈ [0, 1/2) is drawn uniformly at random. Now, for any element i define pi = 1 θ denote the infinite tree generated by AuxiliaryAlgorithm 1. Note that whenever Live contains just one point pi, then 4 µi +θ.4 Given θ, let T ′ j=1 µj + 1 2Pi−1 4In the original paper pi was defined similarly but without the randomization: pi = Pi−1 j=1 µj + 1 2 µi. 9 (as there are no lies) the hidden element must be xi. Denote by Tθ the finite tree corresponding to the algorithm which stops whenever that happens. We present two claims about these trees which are proved in Section 5.1. First, conditioned on any hidden element xi, the answers to all questions (except, perhaps, for the first answer) are distributed uniformly and independently, where the distribution is over the random choice of θ. This follows from the fact that all bits of pi except for the most significant bit are i.i.d. unbiased coin flips. Claim 3.3. For any element xi, let (At) be the random sequence of answers to the questions in AuxiliaryAlgorithm 1, containing all answers except for the first answer, assuming there are no lies. The distribution of the sequence (At) is the same as that of an infinite sequence of independent unbiased coin tosses, where the randomness stems from the random choice of pi. Second, since min(pi − pi−1, pi+1 − pi) ≥ µi/4, one can bound the time it takes to isolate xi as follows. Claim 3.4. For any element xi and any θ, the leaf in Tθ labeled by xi is of depth at most log(1/µi)+ 3. Hence, if x is drawn from a distribution µ, the expected depth of the leaf labeled x is at most Pi µi log(1/µi) + 3 = H(µ) + 3. We now describe the k-resilient algorithm: Algorithm 1 (the pseudocode appears as well). At the beginning, a number θ is randomly drawn. Then, two concurrent simulations over T ′ θ are performed, and two pointers to nodes in this tree are maintained (recall that T ′ θ is the infinite binary search tree). The first pointer, Current, simulates the question-asking strategy according to T ′ θ, ignoring the possibility of lies. In particular, it may point on an incorrect node in the tree (reached as a result of a lie). Since Current ignores the possibility of lies, there is a different pointer, LastVerified , which verifies the answers to the questions asked in the simulation of Current . All answers in the path from the root to LastVerified are verified as correct, and LastVerified will always be an ancestor of Current. See Figure 3 for the basic setup. The algorithm proceeds in iterations. In every iteration the question Q(Current ) is asked In some of the iterations also and Current is advanced to the corresponding child accordingly. LastVerified is advanced. Concretely, this happens when the depth of Current in T ′ θ equals d+ r(d), where d is the depth of LastVerified and r(d) ≈ log d + k log log d.5 In these iterations, the answer given to Q(LastVerified ) is being verified, as detailed next. The verification process. Next, we examine the verification process when LastVerified is ad- vanced. There are two possibilities: first, when the answer to the question Q(LastVerified ), which was given when Current traversed it, is verified to be correct. In that case, LastVerified moves to its child which lies on the path towards Current. In the complementing case, when the the answer to the question Q(LastVerified ) is detected as a lie, then LastVerified moves to the other child. In that case, Current is no longer a descendant of LastVerified , hence Current is moved up the tree and is set to LastVerified . We now explain how the answer to Q(LastVerified ) is verified. There are two verification steps: the first step uses no additional questions and the second step uses 2k + 1 additional questions. Usually, only the first step will be used and no additional questions will be spent during verification. In the first verification step one checks whether the following condition holds: 5The exact definition of r(d) is in Equation (1). 10 Algorithm 1 Resilient-Tree 1: θ ← Uniform([0, 1/2)) 2: Current ← root(T ′ θ) 3: LastVerified ← root(T ′ θ) 4: while LastVerified is not a leaf of Tθ do 5: if x ∈ Q(Current ) then else Current ← left-child(Current ) Current ← right-child(Current ) end if d ← depth(LastVerified ) + 1 if depth(Current ) = d + r(d) then else end if Current ← LastVerified LastVerified ← Candidate end if end if 24: 25: 26: end while 27: return label of LastVerified 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: Candidate ← child of LastVerified which is an ancestor of Current VerificationPath ← ancestors of Current up to and excluding Candidate if Candidate is a left (right) child and at most k − 1 vertices in VerificationPath are left (right) children then Ask 2k + 1 times the question x ∈ Q(LastVerified ) if majority answer is x ∈ Q(LastVerified ) then else LastVerified ← left-child(LastVerified ) LastVerified ← right-child(LastVerified ) 11 < Root > d LastVerified Lie! < Candidate Current > > > > r(d) Figure 3: An illustration of Algorithm 1 just before the detection of a lie. The answer at LastVerified was a lie (< instead of >), and so all answers below Candidate (except for any further lies) are >. This is noticed since Current is at depth d + r(d). The answer at Candidate will be verified and found wrong, and so LastVerified would move to the sibling of Candidate (and so will Current), and the algorithm will continue from that point. The answer to Q(LastVerified ) is identical to at least k of the answers along the path from LastVerified to Current . If this condition holds, then the answer is verified as correct. To see why this reasoning is valid, assume without loss of generality that the answer is ≺, and assume towards contradiction that it was a lie. Then, the correct answers to all following questions in the simulation of Current are (cid:23). Since there can be at most k − 1 additional lies, there can be at most k − 1 additional ≺ answers. Hence, if there are more ≺ answers among the following questions then the previous answer to Q(LastVerified ) is verified as correct. Else, if the above condition does not hold then one proceeds to the second verification step and asks 2k + 1 times the question Q(LastVerified ). Here, the majority answer must be correct, since there can be at most k lies. We add one comment: if the second verification step is taken, one sets Current ← LastVerified regardless of whether a lie had been revealed (this is performed to facilitate the proof). So, whenever the condition in the first verification step fails to hold then Current and LastVerified point to the same node in the tree. The algorithm ends when LastVerified reaches a leaf of Tθ, at which point the hidden element is recovered. Query complexity analysis. Fix an element xi. We bound the expected number of questions asked when xi is the hidden element as follows. Define d ≈ log(1/µ(xi)) as the depth of the leaf labeled xi in Tθ. We divide the questions into the following five categories: • Questions on the path P from the root to Current by the end of the algorithm, when Current reaches depth d + r(d), LastVerified reaches depth d, and the algorithm terminates. Hence, there are at most d + r(d) such questions. • Questions that were ignored due to the second verification step while Current was backtracked 12 from a node outside P . This can only happen due to a lie between Current and LastVerified so there are at most k · r(d) such questions. • Questions asked 2k + 1 times during the second verification step when Current was pointing to a node outside P . This can only happen due to a lie between Current and LastVerified so there are at most k · (2k + 1) such questions. • Questions that were ignored due to the second verification step, when Current was being backtracked from a node in P . By the choice of r(d) there are at most O(1) such questions (on expectation). • Questions asked 2k + 1 during the second verification step when Current was pointing to a node in P . By the choice of r(d) there are at most O(1) such questions (in expectation). Summing these bounds up, one obtains a bound of (cid:0)d+r(d)(cid:1)+k·r(d)+k·(2k+1)+O(1)+O(1) ≈ log(1/µi)+(k+1)(cid:16)log log(1/µi)+k log log log(1/µi)+O(k)(cid:17). 3.2.2 Second algorithm In this section we overview the proof of the following theorem (the complete proof appears in Section 6). Theorem 3.5. For any distribution µ there exists a k-valid comparison tree T with c(T, µ) ≤ H(µ) + kEx∼µ(cid:2)log log(1/µ(x))(cid:3) + O(kEx∼µ(cid:2)log log log(1/µ(x))(cid:3) + k log k). We explain the key differences with Algorithm 1. • In Algorithm 1, an answer to a question Q at depth d was suspected as a lie if at most k of the r(d) consecutive questions received the same answer as Q. In the new algorithm, we suspect a question Q if all the r′(d) consecutive answers are different than Q. This change enables setting r′(d) ≈ log d rather than the previous value of r(d) ≈ log d + k log log d. Similarly to Algorithm 1, any time a lie is deleted, r′(d) questions are being deleted. Summing over the k lies, one obtains a total of kr′(d) ≈ k log d deleted questions, which is smaller than the corresponding value of kr(d) ≈ k log d + k2 log log d in Algorithm 1. • In Algorithm 1, the lies were detected in the same order they were told (i.e. in a first-in- first-out queue-like manner). This is due to the semantic of the pointer LastVerified which verifies the questions one-by-one, along the branching of the tree. In Algorithm 2 the pointer LastVerified is removed (only Current is used), and the lies are detected in a last-in-first-out stack-like manner: only the last lie can be deleted at any point in time. Indeed, as described in the previous paragraph, a lie will be deleted only if all consecutive answers are different (which is equivalent to them being non-lies). • In Algorithm 1, when an answer is suspected as a lie, the corresponding question Q is re- peated 2k + 1 times in order to verify its correctness. This happens after each lie, hence Ω(k) redundant questions are asked per lie. In Algorithm 2, the suspected question Q will be asked again only once, and the algorithm will proceed accordingly. It may however be the case that 13 this process will repeat itself and also the second answer to this question will be suspected as a lie and Q will be asked once again and so on. In order to avoid an infinite loop we add the condition that if the same answer is told k + 1 times then it is guaranteed to be correct and will not be suspected any more. • The removal of LastVerified forces finding a different method of verifying the correctness of an element x upon arriving at a leaf of Tθ. One option is to ask the question "element = x?" 2k + 1 times and take the majority vote, where each = question is implemented using one (cid:22) and one (cid:23). This will, however, lead to asking Ω(k) redundant questions each time x is not the correct element. Instead, one asks "element = x?" multiple times, stopping either when the answer = is obtained k + 1 times, or by the first the answer 6= has obtained more than the answer =. The total redundancy imposed by these verification questions throughout the whole search is O(k). To put the algorithm together, we exploit some simple combinatorial properties of paths containing multiple lies. 3.2.3 A fine-grained analysis of the guarantees In this section, we present a stronger statement for the guarantees of our algorithms. First, the algorithms do not have to know exactly the distribution µ from which the hidden element is drawn: an approximation suffices for getting a similar bound. Recall that the algorithm gets as an input some probability distribution η. This distribution might differ from the true distribution µ. The cost of using η rather than µ is related to D(µkη), the Kullback -- Leibler divergence between the distributions. Secondly, the algorithm has stronger guarantees when the actual number of lies is less than k. This is an improvement comparing to the algorithm of Rivest et al. [20] mentioned in the intro- duction. It will be utilized in the application of sorting, where the searching algorithm is invoked multiple times with a bound on the total number of lies (rather the number of lies per iteration). We present the general statement with respect to Algorithm 2. The statement and the corresponding bound on Algorithm 1 appears in Lemma 5.1 in Section 5. Theorem 3.6. Assume that Algorithm 2 is invoked with the distribution (η1, . . . , ηn). Then, for any element xi, the expected number of questions asked when xi is the secret is at most + O(cid:18)E[K ′] log log log 1 ηi + E[K ′]logk + k(cid:19) , log (1/ηi) + E[K ′] log log 1 ηi where K ′ is the expected number of lies. (The expectation is taken over the randomness of both parties.) As a corollary, one obtains Theorem 3.5 and the following corollary, which corresponds to using a distribution different from the actual distribution. Corollary 3.7. Assume that Algorithm 2 is invoked with (η1, . . . , ηn) while (µ1, . . . , µn) is the true distribution. Then, for a random hidden element drawn from µ, the expected number of questions asked is at most H(µ) + kEx∼µ(cid:2)log log(1/µ(x))(cid:3) + O(k E + D(µkη) + O(k log D(µkη)), µ(cid:2)log log log(1/µ(x))(cid:3) + klogk) 14 where D(µkη) =Px∈supp µ µ(x) log µ(x) Corollary 3.7 follows from Theorem 3.6 by bounding K ′ ≤ k, taking expectation over xi ∼ µ, noting that Pi µi log(1/ηi) = H(µ) + D(µkη) and applying Jensen's inequality with the function x 7→ log x. η(x) is the Kullback -- Leibler divergence between µ and η. 3.3 Sorting One can apply Algorithm 2 to implement a stable version of the insertion sort using comparison queries. Let Π be a distribution over the set of permutations on n elements. Complementing with prior algorithms achieving a complexity of H(Π) + O(n) in the randomized setting with no lies [16], and n log n + O(nk + n) in the deterministic setting with k lies [3, 15], we present an algorithm with a complexity of H(Π) + O(nk + n + k log k) in the distributed setting with k lies. Note that k log k = O(nk) unless unless the unlikely case that k = ew(n), hence the k log k term can be ignored. Therefore, the guarantee of our algorithm matches the guarantees of the prior algorithms substituting either k = 0 or Π = Uniform. Theorem 3.8. Assume a distribution Π over the set of all permutations on n elements. There exists a sorting algorithm which is resistant to k lies and sorts the elements using H(Π)+O(nk+n+k log k) comparisons on expectation. (The proof appears in Section 7.) The randomized algorithms benefit from prior knowledge, namely, when one has information about the correct ordering. This is especially useful for main- taining a sorted list of elements, a procedure common in many sequential algorithms. In these settings, the values of the elements can change in time, hence, the elements have to be re-sorted regularly, however, their locations are not expected to change drastically. The suggested sorting algorithm performs n iterations of insertion sort. By the end of each iteration i, x1, . . . , xi are successfully sorted. Then, on iteration i + 1, one performs a binary search to find the location where xi+1 should be inserted, using conditional probabilities. The guarantee of the algorithm is asymptotically tight: a lower bound of H(Π) follows from information theoretic reasons, and a lower bound of Ω(nk) follows as well: the bound of Lakshmanan et al. [14] can be adjusted to the randomized setting. 4 Lower bound In this section, we prove Theorem 3.1. Let µ be a distribution over U and let T be a (possibly randomized) k-valid decision tree with respect to µ. First we assume that with probability 1, the number of questions asked on any x ∈ supp µ is at least α(x) = ⌈log(1/µ(x))/2⌉. This assumption will later be removed. at random a subset of at most k questions to lie on from the first α(x) questions. Consider a randomized adversary that, after seeing the secret element x ∼ µ, picks uniformly Let Q denote the random variable of the transcript of the game (i.e. the sequence of queries and the answers provided by the adversary), and leet Q denote its length (i.e. the number of query/answer pairs). Let X denote the random variable of the secret element, and let L denote the random variable describing the positions of the lies (so, L is a subset of size at most k of 15 {1, . . . , α(x)}). Note that Q determines both X and L (since T is k-valid). Therefore, E[Q] ≥ H(Q) ≥ H(X, L) = H(X) + H(LX) = E x∼µ log 1 µ(x) + H(LX), where the first inequality is due to Fact 2.2. Now, µ(x) log(cid:18)α(x) ≤ k(cid:19) µ(x) log(cid:0)(α(x)/k)k(cid:1) H(LX) =Xx ≥Xx ≥ k E x∈µ log log 1 µ(x) − (k log k + k), where the first inequality is due to the well-known formula(cid:0) n ≤m(cid:1) ≥ (n/m)m. This finishes the proof under the assumption that the number of questions is at least α(x) for every x ∈ supp µ. We next show that this assumption can be removed: we will show that any k-valid tree T , can be transformed to a k-valid tree T ′ that satisfies this assumption and c(T ′, µ) ≤ c(T, µ) + 1. It suffices to show this for a deterministic k-valid tree T , since a randomized k-valid tree is a distribution over deterministic k-valid trees. The lower bound on c(T , µ) then follows from the lower bound on T ′ plus the additive factor of 1 due to the transformation of T to T ′. Fix a deterministic k-valid tree T and let V be the set of elements for which there exists an x-labeled leaf with depth less than α(x). We will show that Px∈V µ(x)α(x) ≤ 1. This implies that increasing the number of questions asked on x to be at least α(x) for all x ∈ V increases the expected number of questions by at most Px∈V µ(x)α(x) ≤ 1. Lemma 4.1. µ(x)α(x) ≤ 1. Xx∈V Proof. For any x ∈ V , let dx < α(x) denote the minimum depth of an x-labeled leaf in T . By Fact 2.1: 1 ≥ Xx∈V 2−dx ≥ Xx∈V 2− log(1/µ(x))/2 = Xx∈V pµ(x). µ(x) log(1/µ(x))/2 Therefore, Xx∈V µ(x)α(x) ≤ Xx∈V = Xx∈V pµ(x) ·(cid:16)pµ(x) · log(1/pµ(x))(cid:17) ≤ Xx∈V pµ(x) ≤ 1. (√t log(cid:0)1/√t(cid:1) ≤ H(Ber(√t)) ≤ 1 for all t ∈ [0, 1]) (Px∈V pµ(x) ≤ 1) 16 Remark. We could slightly improve the lower bound in Theorem 3.1 to ck(µ) ≥ H(µ) + k E x∈µ log log 1 µ(x) −(cid:0)k log k + Θ(√k)(cid:1), by setting ǫ = 1/√k, α(x) = ⌈(1 − ǫ) log(1/µ(x))⌉, and following a similar argument. 5 First algorithm In this section, we prove Theorem 3.2. It follows immediately from the following lemma: Lemma 5.1. Fix a set of elements x1 ≺ x2 ≺ ··· ≺ xn, and fix a probability distribution vector (µ1, . . . , µn). There is a k-valid comparison tree that for any element xi asks on expectation at most log(1/µi) + E[K ′ + 1] log log 1 µi + E[K ′ + 1]O(cid:18)k log log log 1 µi + klogk(cid:19) , questions, where K ′ is the number of lies told, and the expectation is over the randomness of both the questioner and the answerer, conditioned on xi being the hidden element. We rely on the definition of the algorithm from Section 3.2.1. Since we are proving a bound on a specific algorithm, one can assume that the actions of the adversary are deterministic given the hidden element and the history of questions and answers. The proof of the theorem is in three steps. In the first step, we analyze the randomized nonresistant decision trees Tθ and T ′ θ defined in Section 3.2.1. In the second step, we analyze the k-valid tree. In the final step, we make calculations which bound the expected number of asked questions and conclude the proof. 5.1 Step 1: Analyzing the nonresistant decision tree In this section, we prove the two claims from Section 3.2.1. Proof of Claim 3.3. Note that pi is uniform in h 1 2Pi−1 p 7→ p mod 1/2 : [0, 1) → [0, 1/2) in the obvious way: j=1 µj + 1 4 µi, 1 j=1 µj + 1 2Pi−1 4 µi + 1/2(cid:17). Define p mod 1/2 =(p p − 1/2 if 0 ≤ p < 1/2, if 1/2 ≤ p < 1. Note that pi mod 1/2 is distributed uniformly in [0, 1/2) and that the binary representation of pi equals the binary representation of pi mod 1/2, except, perhaps, for the bit which corresponds to 2−1 (the bit b1 in the binary representation pi = 0.b1b2 ··· ). Hence, the bits of pi (except for the first bit) are distributed as an infinite sequence of independent unbiased coin tosses. Note that the answer to question no. t in AuxiliaryAlgorithm 1 equals bit t of the binary repre- sentation of pi. In particular, the answers (except for the first one) are distributed as independent unbiased coin tosses. Proof of Claim 3.4. Let di = min (pi − pi−1, pi+1 − pi) ≥ µi/4 be the minimal distance of pi from its neighboring points (assuming p0 = 0 and pn+1 = 1, for completeness). After t steps of the algorithm, Live is an interval of width 2−t containing xi. Therefore if 2−t ≤ di then xi is the only point contained in Live. This shows that the depth of the leaf labeled xi is at most ⌈log(1/di)⌉ ≤ ⌈log(4/µi)⌉ ≤ log(1/µi) + 3. 17 5.2 Step 2: Making a tree resilient We give the definition of r(d): r(d) =(cid:24)log(cid:0)(d + 1) ln2(d + 1)(cid:1) + 4(k + 1)(cid:18)log log((d + 1) ln2(d + 1)) + 4 log Note that r(d) = log(d + 1) + O(k log log(d + 1) + k log k + 1). k + 1 ln 2 (cid:19)(cid:25) . (1) (2) As explained in Section 3.2.1, the following holds: Claim 5.2. The decision tree corresponding to Algorithm 1 is k-valid. To sketch a proof, it suffices to show that LastVerified always resides in the path P from the root to the leaf labeled by the hidden element xi. This is done by induction on the depth of LastVerified : at the beginning, LastVerified resides on the root. For the induction step, assume in some iteration that LastVerified moves from a node v of depth d − 1 to its child v′ of depth d, and assume without loss of generality that v′ is a left child. The pointer LastVerified could only move to v′ after it is verified that xi ∈ Q(v): either after at least k matching answers were obtained after Q(v) was asked, or after Q(v) was asked 2k + 1 times. Hence, v′ is in P as required and the proof follows. We proceed to determine the expected number of iterations it takes the algorithm to determine an element xi. Let Pθ be the unique root-to-leaf path in Tθ which is consistent with xi, and let Dθ denote its depth. We define the notion of a problematic node: a node v on Pθ which may be suspected by the algorithm as not residing in Pθ. Formally, a node v ∈ Pθ which is a left (right) child is problematic for xi if among its first r(d) descendants there at most k left (right) children. Let Fθ be the number of vertices on Pθ which are problematic for xi, and let F ′ θ =Pv r(depth(v)), where the sum goes over these vertices. Lemma 5.3. Let xi be an element, and fix some 0 ≤ θ ≤ 1/2. Algorithm 1 terminates after at most this many steps: Dθ + r(Dθ) + Fθ(2k + 1) + F ′ θ + K ′(r(Dθ) + 2k + 1). Proof. We divide the questions into categories, and bound each separately: • Questions on the path Pθ from the root to Current by the end of the algorithm: when Current reaches depth Dθ+r(Dθ), LastVerified reaches depth Dθ and the algorithm terminates. Hence, there are at most Dθ + r(Dθ) such questions. • Questions that were ignored due to the second verification step while Current was backtracked from a node outside Pθ. This can only happen due to a lie between Current and LastVerified so there are at most K ′ · r(Dθ) such questions. • Questions asked 2k + 1 times during the second verification step when Current was pointing to a node outside Pθ. This can only happen due to a lie between Current and LastVerified so there are at most K ′ · (2k + 1) such questions • Questions that were ignored due to the second verification step, when Current was being backtracked from a node in Pθ. This can only happen if Candidate is problematic, so there are at most F ′ θ such questions. 18 • Questions asked 2k + 1 during the second verification step when Current was pointing to a node in P . This can only happen if Candidate is problematic, hence there are at most Fθ(2k + 1) such questions. 5.3 Step 3: Culmination of the proof In this section we perform calculations to bound the expected number of questions, using Lemma 5.3. Lemma 5.4. The expected questions asked on xi is at most ∞ log(1/µi) + 3 + E[K ′ + 1]r(log(1/µi) + 3) + ≤ k(cid:19)2−r(d)(r(d) + 2k + 1) + O(k E K ′). Proof. We will use the notation of Lemma 5.3. Claim 3.4 shows that Dθ ≤ log(1/µi) + 3. Since r(d) is monotone nondecreasing, also r(Dθ) ≤ r(log(1/µi) + 3). Let Zd be the indicator of whether the node of depth d in Pθ is problematic for xi, for 1 ≤ d ≤ log(1/µi) + 3. Claim 3.3 shows that Xd=1(cid:18)r(d) E[Zd] = Pr[Zd = 1] ≤(cid:18)r(d) ≤ k(cid:19)2−r(d). Hence, E θ E θ ⌊log(1/µi)+3⌋ [Fθ] = E ⌊log(1/µi)+3⌋ [F ′ θ] = E θ   θ   Xd=1 Xd=1 ∞ Zd Xd=1(cid:18)r(d)  ≤ Zdr(d)  ≤ ≤ k(cid:19)2−r(d), Xd=1(cid:18)r(d) ∞ ≤ k(cid:19)r(d)2−r(d). This completes the proof. d=1(cid:0)r(d) d=1(cid:0)r(d) (2) concludes the proof follows. We begin with three auxiliary lemmas. ≤k(cid:1)r(d)2−r(d) is at most some absolute constant. As ≤k(cid:1)(2k + 1)2−r(d) = O(1). Applying Lemma 5.4 and In what follows, we will show that P∞ r(d) = Ω(2k + 1), this will imply that P∞ Lemma 5.5. For any n, k ≥ 1, (cid:0) n ≤k(cid:1) ≤ enk. Proof. For ℓ ≤ k we have (cid:0)n Lemma 5.6. For any a, b ≥ 1, log(a + b) ≤ log a + log b + 1. As a consequence, ln(a + b) ≤ ln a + ln b + 1. ℓ(cid:1)/nk ≤ (nℓ/ℓ!)/nk ≤ 1/ℓ!. Hence (cid:0) n ≤k(cid:1)/nk ≤Pk ℓ=0 1/ℓ! < e. Proof. log(a + b) ≤ log(2 max(a, b)) ≤ 1 + log a + log b. Lemma 5.7. For all a, b ≥ e and all x ≥ b + 4a(ln a + ln b), it holds that x ≥ a ln x + b. 19 Proof. Denote c = 4. Note that for all x ≥ a, the function x− a ln x− b is monotone nondecreasing in x (since its derivative is 1 − a/x ≥ 0). Hence, it is sufficient to prove that x ≥ a ln x + b for x = b + ca(ln a + ln b), a value which exceeds a. Assume, indeed, that x = b + ca(ln a + ln b). Applying Lemma 5.6 twice and using the fact that c = 4, a ln x = a ln (b + ca(ln a + ln b)) ≤ a ln b + a ln(ca(ln a + ln b)) + 1 = a ln b + a ln ca + a ln(ln a + ln b) + 1 ≤ a ln b + a ln a + a ln c + a ln ln a + a ln ln b + 2 ≤ 2a ln b + 2a ln a + a ln c + 2a ≤ ca(ln a + ln b) = x − b. As stated above, we would like to show that P∞ d=1(cid:0)r(d) d=1 r(d)k+12−r(d) = O(1). Since P∞ ≤k(cid:1) ≤ er(d)k, it is sufficient to show that P∞ (cid:0)r(d) is a convergent series, it is sufficient to show that r(d)k+12−r(d) ≤ (cid:0)(d + 1) ln2(d + 1)(cid:1)−1 Applying Lemma 5.7 (for k ≥ 2 and large enough d) with a = (k+1)/ ln 2 and b = log(cid:0)(d + 1) ln2(d + 1)(cid:1), ≤k(cid:1)r(d)2−r(d) = O(1). In particular, since d=2(cid:0)d ln2 d(cid:1)−1 r(d) ≥ log((d + 1) ln2(d + 1)) + (k + 1) ln(r(d))/ ln 2. . This is (3) equivalent to implies that the current definition of r(d) satisfies (3). (We leave the case k = 1 to the reader.) 6 Second algorithm We prove Theorem 3.6, from which Theorem 3.5 follows. We start by explaining the main differences between Algorithm 1 and Algorithm 2. The pointer Current will be defined as before: it simulates a search on the tree, asking one question in every iteration. In this algorithm, Current simulates Tθ, the finite tree, rather the infinite T ′ θ. The pointer LastVerified is removed. Still, it will be possible to correct lies and Current will move up the tree whenever a lie is revealed, deleting the recent answers. We proceed by giving some definitions: Definition 6.1. Two non-root nodes in Tθ are matching children if they are either both right children or both left children. Two non-root nodes are opposing children if they are not matching children. Definition 6.2. A node v in the tree Tθ is a lie with respect to an element x, if either v is a left child and x /∈ Q(parent(v)) or v is a right child and x ∈ Q(parent(v)). In particular, v is a lie if the answer to Q(parent(v)) which causes Current to move from parent(v) to v is a lie. Differently from the first algorithm, a node v will be suspected as a lie only if all the descendants in the path to Current are opposing to v (rather than at most k of them are matching v). In any iteration, we set Suspicious to be the deepest node in the path from the root to Current which is an opposing child to Current . All descendants of Suspicious along this path are opposing children to Suspicious. An action will be taken only if there are r′(depth(Suspicious)) opposing descendants, where r′ : N → N is a monotonic nondecreasing function to be defined later. In other words, an action will be taken only if depth(Current ) = depth(Suspicious) + r′(depth(Suspicious)). If that condition holds, Suspicious is suspected as a lie, and one sets Current ← parent(Suspicious). In the next iteration, the question Q(parent(Suspicious)) will be asked again. We call this action 20 of moving Current up the tree a jump back, or, more specifically, a jump-back atop Suspicious. We add a note: at some iterations to be elaborated later, there will be no Suspicious node. The definition of r′(j) is as follows: r′(j) =(cid:6)log(cid:0)2k(j + 1) ln2(j + 1)(cid:1) + e + 4e(cid:0)1 + ln(cid:0)log(cid:0)2k(j + 1) ln2(j + 1) + e(cid:1)(cid:1)(cid:1)(cid:7) . Note that r′(j) ≤ log j + C(logk + log logj) (4) (5) for some constant C > 0. We proceed with a few more definitions. To avoid ambiguity, for any distinct nodes v 6= v′, we refer to Q(v) and Q(v′) as distinct questions, even if the sets they represent are identical. Definition 6.3. Fix a node v and assume that Q(parent(v)) is asked. We say that v is given as an answer if either v is a left child and the given answer was "x ∈ Q(parent(v))", or v is a right child and "x /∈ Q(parent(v))" was given. In particular, v is given as an answer if an answer to Q(parent(v)) makes Current move from parent(v) to v. Note that if a node is given as an answer k + 1 times, it is not a lie. Definition 6.4. Given a certain point at the execution of the algorithm, we say that a node in Tθ is verified if it was given as an answer at least k + 1 times before. The following claim is obvious. Claim 6.5. If v is verified then v is not a lie. We proceed by explaining another difference from Algorithm 1: if a node is Suspicious and triggers a jump-back, the corresponding question is asked again just once, rather than 2k + 1 times. There is no guarantee that the new answer is correct. The simulation of Current continues according to the new answer. It might happen that the same node will be suspected again and Current will jump-back again to the same location. Then, the same question will be asked the third time. Note that an answer can be incorrectly suspected, even if no lies are told. This may lead to an infinite loop, where Current jumps back atop the same node indefinitely. To avoid such a situation, one sets Suspicious ← None if the node which is supposed to be suspicious is verified. We give a full definition of how Suspicious is defined: first, if all nodes in the path to Current (ex- cept for the root) are matching children, then Suspicious ← None. Otherwise, SuspiciousCandidate is set as the deepest node in the path from the root to Current which is an opposing child to Current . If SuspiciousCandidate is verified then Suspicious ← None, otherwise Suspicious ← SuspiciousCandidate . The pseudocode for setting Suspicious appears in the function setSuspi- cious in Algorithm 2. Before proceeding, we present the following claim, which follows from the discussion on Algo- rithm 1. Claim 6.6. If v is a lie, then any descendant of v which is a matching child to v is a lie. We add the following definition: Definition 6.7. Let v be a node in Tθ. We say that a jump-back deletes v if v was in the path from the root to Current just before the jump-back, and v is not in the path to Current right after the jump-back. 21 We explain how the algorithm behaves when multiple lies are told. Assume that a lie v was given as an answer, and let d = depth(v). If no other lies are told, all descendants of v in the path to Current will be opposing children to v. The lie v will be deleted once depth(Current ) = d+r′(d). However, it may be the case that more lies are told. These are necessarily opposing to v, and after they are told, Suspicious does not equal v and v cannot be deleted. However, Suspicious will point at the last lie which will be deleted. Then, the other lies will be deleted one after the other. At some point, once all lies which are descendants of v are deleted, v will be pointed by Suspicious again, and it will finally be deleted once depth(Current ) = d + r′(d). Lastly, we explain how the algorithm is terminated and the hidden element is found. In the pre- vious algorithm, this was done once LastVerified reached a leaf of Tθ. In the absence of LastVerified , we devise a different and more efficient way to verify the correctness of an element. Once Current reaches a leaf of Tθ, one checks whether the label e of that leaf is indeed the hidden element. The verification process consists of asking multiple times whether the correct element is e. Each question of the form "element = e?" can be implemented using two comparison questions, asking "(cid:22) e?" and "(cid:23) e?". For simplicity, assume that the algorithm asksverification questions of the form "= e?" and that the answers are = and 6=. The questioner will ask this equality question multiple times until it either gets k + 1 =-answers or until it gets more 6=-answers than =-answers. If k + 1 =-answers are obtained then the hidden element is e and the search terminates. If more 6=- answers than =-answers are obtained, the element e is suspected as not being the hidden element. Then, one performs a jump back atop Suspicious if Suspicious 6= None and otherwise one jumps atop Current, setting Current ← parent(Current ). From that point, the next iteration proceeds. The pseudocode of this verification process appears in the function verifyObject, which appears in Algorithm 2. We will prove in Lemma 6.14 that the total number of verification questions asked during the whole search is O(k). In Lemma 6.9, we will show that if e is not the hidden element then a lie will be deleted upon a return from verifyObject(e). The pseudocode of the complete algorithm is presented as Algorithm 2. First, an initialization is performed, where Current ← root(Tθ). Then multiple iterations are performed until the element is found. Any iteration consists of the following structure: first, Q(Current) is asked and Current is advanced accordingly from parent to child. Then, one checks whether Current is a leaf of Tθ. If so, the verification process proceeds, and as a result either the algorithm terminates or a jump back is taken. If Current does not point to a leaf, one checks whether a jump-back atop Suspicious should be taken and proceeds accordingly. 6.1 Proof Fix a hidden element xi, and let P be the path from the root to the leaf labeled xi in Tθ. A node v ∈ P of depth d is problematic for xi if all the r′(d) closest descendants of v in P are opposing children with v (in particular, v cannot be problematic if there are less than r′(d) descendants of v in P ). Note the significance of a problematic node: if v is problematic, then even if no lies are told, v will be Suspicious and will initiate a jump-back. The following lemmas categorize the different jump-backs taken throughout the algorithm. Lemma 6.8. Fix some iteration of the algorithm where Current does not reside in P . Then, either Suspicious is a lie or Current is a lie. In particular, if Suspicious = None then Current is a lie. Proof. Assume there is a lie, and divide into different cases according to SuspiciousCandidate : 22 Algorithm 2 Resilient-Tree 1: θ ← Uniform([0, 1/2)) 2: Current ← root(Tθ) 3: while true do 4: if x ∈ Q(Current ) then else Current ← left-child(Current ) Current ← right-child(Current ) end if Suspicious ← setSuspicious(Current) if Current is a leaf of Tθ then e ← the label of Current if verifyObject(e) then return e else if Suspicious 6= None then Current ← parent(Suspicious) else Current ← parent(Current ) 6= None Current ← parent(Suspicious) end if else if Suspicious r′(depth(Suspicious)) then end if 21: 22: end while 23: return label of LastVerified 24: 25: function verifyObject(e) 26: 28: 29: end function 30: 31: function setSuspicious(Current) 32: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 27: ⊲ Q(Current ) is asked ⊲ Checking termination condition and depth(Current ) = depth(Suspicious) + ⊲ Jumping-back atop Suspicious Ask the question "= e?" repeatedly, until either: (1) k + 1 =-answers are obtained. In that case: return true (2) More 6=-answers than =-answers are obtained. In that case: return false if All nodes in the path from the root (excluding) to Current (including) are matching children then return None else an opposing child with Current SuspiciousCandidate ← the deepest node in the path from the root to Current which is if SuspiciousCandidate is verified then return None else return SuspiciousCandidate end if 33: 34: 35: 36: 37: 38: 39: 40: end if 41: 42: end function 23 • SuspiciousCandidate is undefined: in that case, all nodes in the path from the root (excluding) to Current (including) are matching children. As assumed, there exists a lie v in the path to Current . Since Current is a matching child and a descendant of v, Claim 6.6 implies that Current is a lie. • SuspiciousCandidate is not a lie. As assumed, there is a different lie v in the path to Current . We will show that v is an opposing child with SuspiciousCandidate : if v is an ancestor of SuspiciousCandidate , then these nodes are opposing children, from Claim 6.6. If v is a descen- dant of SuspiciousCandidate it is an opposing child to v by definition of SuspiciousCandidate . Hence, these two nodes are opposing children. Since SuspiciousCandidate is an opposing child to Current , the nodes v and Current are matching children, hence, Claim 6.6 implies that Current is a lie as well. • If SuspiciousCandidate is a lie, then Suspicious = SuspiciousCandidate and Suspicious is a lie. We categorize jump-backs following a return from verifyObject. Lemma 6.9. Assume that verifyObject(e) is called and returns false, resulting in a jump-back. Then, one of the following applies: 1. The hidden element is e and a lie was told in verifyObject. 2. The hidden element is not e and the jump-back deletes a lie. Proof. If e is the hidden element, a lie has to be told for the call to return false. Assume that e is not the hidden element. After the call returns, a jump-back is either taken atop Suspicious (if it is defined), or atop Current, if Suspicious = None. In both cases, Lemma 6.8 implies that a lie is deleted. We categorize jump-backs taken when depth(Current ) = depth(Suspicious)+r′(depth(Suspicious)). Lemma 6.10. Assume a jump-back was taken as a result of depth(Current ) = depth(Suspicious) + r′(depth(Suspicious)). Then one of the following applies: 1. The jump-back deletes a lie. 2. The jump-back is atop a problematic node. Proof. Divide into cases, according to whether Current resides in P : • If Current does not reside in P , Lemma 6.8 implies that either Suspicious or Current is a lie. Since both are going to be deleted, a lie is going to be deleted. • If Current resides in P , the definition of a problematic node implies that Suspicious is prob- lematic and Item 2 applies. Next, we prove that there can be at most k jump-backs atop the same Suspicious node. 24 Lemma 6.11. Assume in some point of the algorithm that k jump-backs atop v were taken before. Then, v cannot be labeled as Suspicious. Proof. Assume for contradiction that v is labeled as Suspicious. This implies that v was given as an answer at least k + 1 times: once before each jump-back and once after the last jump-back, which implies that v is verified and contradicts the fact that v is labeled as Suspicious (since Suspicious cannot be verified by definition). We finalize the categorization of jump-backs with an immediate corollary of Lemma 6.9, Lemma 6.10 and Lemma 6.11. Corollary 6.12. Each jump back can be categorizes as one the following: • A jump-back that either deletes a lie or that is taken as a result of a lie being told in veri- fyObject. There are at most K ′ such jump-backs. • A jump-back atop a problematic node v labeled Suspicious. There can be at most k such jump-backs for each node v. After categorizing the jump-backs, we categorize the different questions asked by the algorithm. Let M be the largest depth of Current throughout the algorithm. Let depth(xi) be the depth of the leaf of Tθ labeled xi. Let L be the number of nodes problematic for xi and let D1, . . . , DL be the depths of these nodes. Let V be the number of verification questions asked by the algorithm (namely, "= e?" questions asked in verifyObject). Lemma 6.13. The number of questions asked by the algorithm on element xi is at most 2V + depth(xi) + K ′(r′(M ) + 1) + k (r′(Dj) + 1). L Xj=1 Proof. We say that an answer is deleted by a jump-back if the node which corresponds to this answer is deleted (the node where Current moves right after the answer is told). Note that the same question can be asked and deleted multiple times, each counted separately. We will count the answers rather than the questions, dividing them into multiple categories: • Answers to verification questions, amounting to 2V answers, since each verification question is implemented using two ≺ questions. • Answers not deleted: these correspond to questions in the path from the root to the leaf labeled xi, amounting to depth(xi) questions. • Answers deleted as a result of a jump-back categorized as Item 6.12 in Corollary 6.12. There are at most K ′ such jump-backs, each deleting at most r′(M ) + 1 answers, to a total of K ′(r′(M ) + 1) deleted answers. • Answers deleted as a result of a jump back categorized as Item 6.12 in Corollary 6.12. There can be at most k such jump-backs for each problematic node, and a total of kPL j=1(r′(dj)+1) questions. 25 To complete the proof, we bound the different terms in Lemma 6.13. We start by bounding the first term. Lemma 6.14. V ≤ 3k + 1. Proof. Let K ′ 2 be the number of times that the function verifyObject was invoked with a request to verify an incorrect element. Divide the jump-backs into different categories: 1 be the total number of lies in the verification questions, and let K ′ • Number of questions asked over invocations of verifyObject which ended in a success: note that verifyObject ends with success only once. In that case, k + 1 =-answers are obtained and K ′ 1,1 ∈ {0, 1, . . . , k}. The total number of questions asked is k + 1 + K ′ 1,1 6=-answers are obtained, for some K ′ 1,1. • The number of questions asked over invocations of verifyObject which ended in failure, when the object tested was the correct object. In such cases, m + 1 6=-answers are obtained and m =-answers are obtained, for some m ∈ {0, 1, . . . , k − 1}. The number of lies is m + 1 and the number of questions asked is 2m + 1 ≤ 2(m + 1). The total number of questions asked over all such invocations is at most 2K ′ 1,2 is the total number of lies over such invocations. 1,2, where K ′ • The number of quesions asked when the answer should be 6=: in such cases, m + 1 6=-answers are obtained and m =-answers are obtained, for some m ∈ {0, 1, . . . , k}. Note that 2m + 1 questions are told where m is the number of lies. Summing over all such invocations, one obtains a bound of K ′ 1,3 is the number of lies told in such invocations. 1,3 where K ′ 2 + 2K ′ 1,3 = K ′ Summing the over the different categories and noting that K ′ 1, one concludes that the number of verification questions asked is at most k + 1 + 2K ′ 2. By Lemma 6.9, each time that the function was invoked in a request to verify an incorrect object was followed by a jump back which caused a lie to be deleted. Hence, K ′ 1,2 + K ′ 1 + K ′ 1,1 + K ′ 1 + K ′ 2 ≤ k. This concludes the proof. The second term in Lemma 6.13 is bounded by log(1/µi) + 3 using Claim 3.4. We proceed by bounding the third term. To bound M , we start with the following auxiliary lemma: Lemma 6.15. Let q0, a ≥ 1. Define qi = qi−1 + a log qi−1 + a, for all i > 0. Then, it holds that qi ≤ q0 + Cai(log q0 + log a + log i + 1), for the constant C = 8. Proof. We bound qi by induction on i. For i = 0 and i = 1 the statement is trivial. For the induction step, fix some i ≥ 1. Using the induction hypothesis, Lemma 5.6, and the inequality log x ≤ x, it holds that qi+1 − qi a − 1 = log qi ≤ log (q0 + Cai(log q0 + log a + log i + 1)) ≤ log q0 + log(Cai(log q0 + log a + log i + 1)) + 1 = log q0 + log C + log a + log i + log(log q0 + log a + log i + 1) + 1 ≤ log q0 + log C + log a + log i + log q0 + log a + log i + 1 + 1 = 2 log q0 + log C + 2 log a + 2 log i + 2. The result follows by substituting C = 8 and applying the induction hypothesis. 26 The next lemma bounds M : Lemma 6.16. It always holds that M ≤ log(1/µi)Cklogk(logk + log log(1/µi)). Proof. Define C ′ ≥ 1 to be a sufficiently large constant such that for all j ≥ 1: r′(j) ≥ a log j + a for a = C ′logk. It follows from Eq. (5) that such a value of C ′ exists. Define the infinite sequence q0, q1, q2, . . . as follows: q0 = log(1/µ(x)) + 3 and qj+1 = qj + a log qj + a for the value of a defined above. Claim 3.4 implies that q0 bounds form above the maximal depth of Current when there are no lies. Additionally, note that by induction, qj+1 ≥ qj + r′(qj) bounds from above the maximal depth of Current when there are at most j lies. Applying Lemma 6.15, one obtains the desired result. As a corollary, we bound r′(M ), which corresponds to the third term in Lemma 6.13. Corollary 6.17. r′(M ) ≤ log log(1/µi) + O(log log log(1/µi) + logk). Proof. This follows immediately from Lemma 6.16 and Eq. (5). Lastly, we bound the last term in Lemma 6.13. Lemma 6.18. (r′(Dj) + 1) E  k L Xj=1  ≤ C for some universal constant C > 0, where the expectation is over the random choice of 0 ≤ θ < 1/2. Proof. For m ∈ N, let Zm be the indicator of whether the node at depth m in P is problematic for xi (in particular, Zm = 0 if depth(xi) < m). From Lemma 3.3, it holds that E[Zm] = Pr[Zm = 1] ≤ 2−r′(m). In particular, L E Xj=1  = E" ∞ Xm=1 Zmk(r′(m) + 1)# ≤ k(r′(Dj) + 1)  For simplicity, we will boundP∞ m=1 2−r′(m)kr′(m) which is within a constant factor of the right hand m=2 m−1 log−2(m) is a convergent series, it is sufficient that 2−r′(m)r′(m) ≤ side of (6). Since P∞ (cid:0)2k(m + 1) ln2(m + 1)(cid:1)−1 . This is equivalent to r′(m) ≥ log r′(m) + log(cid:0)2k(m + 1) ln2(m + 1)(cid:1), hence it is sufficient to require r′(m) ≥ e ln r′(m) + log(cid:0)2k(m + 1) ln2(m + 1)(cid:1) + e. Lemma 5.7 implies that this inequality holds for r′(m) (defined in (4)) as required. ∞ Xm=1 2−r′(m)k(r′(m) + 1). (6) The proof follows from Lemma 6.13, Lemma 6.14, Claim 3.4, Corollary 6.17 and Lemma 6.17. 7 Sorting We present the proof of Theorem 3.8. 27 ℓ (1) < xΠ−1 Proof of Theorem 3.8. Let Π : [k] → [k] be random variable defining the correct ordering over the elements, namely, xΠ−1(1) < xΠ−1(2) < ··· < xΠ−1(n), and let Πℓ : [ℓ] → [ℓ] be the permutation defining the correct ordering between x1, . . . , xℓ, namely, xΠ−1 (ℓ). In other words, for all 1 ≤ i, j ≤ ℓ, xi < xj if and only if Πℓ(i) < Πℓ(j). Our sorting procedure proceeds in iterations, finding the correct ordering between x1, . . . , xℓ by the end the ℓ'th iteration, for ℓ = 1, . . . , n. In other words, it finds Πℓ on iteration ℓ. Given Πℓ−1, one only has to find Πℓ(ℓ). This can be implemented using comparison questions: the question "Πℓ(i) ≤ r?" is equivalent to "xi < Π−1 rithm 2 with the distribution Πℓ(ℓ) Πℓ−1. We will bound the expected number of questions asked by this algorithm. Fix some permutation π, set pπ = Pr[Π = π], and set pπ,ℓ as the probability that Πℓ agress with π conditioned on Πℓ−1 agreeing with π. Define k′ ℓ as the expected number of lies on round ℓ. It follows from Theorem 3.5 that the expected number of questions asked in iteration ℓ is at most The resulting algorithm is simple: in each iteration ℓ = 1, . . . , n, find Πℓ(ℓ) by invoking Algo- (2) < ··· < xΠ−1 ℓ−1(r)?". ℓ ℓ log 1 pπ,ℓ + O(cid:18)k′ ℓ log log 1 pπ,ℓ + k′ ℓ log k + k(cid:19) . Summing over ℓ = 1, . . . , n, one obtains: 1 log ℓ=1 pπ,ℓ + O n + k log k + kn(cid:19) . Taking expectation over π ∼ Π and applying Jensen's inequality with x 7→ log x, one obtains a bound of + O(cid:18)k log log ℓ log k + k(cid:19)! ≤ log Xℓ=1(cid:18)k′ Qn ℓ log log 1 pπ + k′ 1 pπ 1 pπ H(Π) + O(k log H(π) + k log k + kn) ≤ H(Π) + O(k log k + kn). References [1] Martin Aigner. Finding the maximum and minimum. Discrete Applied Mathematics, 74:1 -- 12, 1997. [2] Javed A. Aslam and Aditi Dhagat. Searching in the presence of linearly bounded errors. In Proceedings of the 23rd annual Symposium on Theory of Computing (STOC'91), pages 486 -- 493, 1991. [3] A. Bagchi. On sorting in the presence of erroneous information. Information Processing Letters, 43:213 -- 215, 1992. [4] Elwyn R. Berlekamp. Block coding for the binary symmetric channel with noiseless, delayless feedback, pages 61 -- 85. Wiley, New York, 1968. [5] R. Sean Borgstrom and S. Rao Kosaraju. Comparison based search in the presence of errors. In Proceedings of the 25th annual symposium on theory of computing (STOC'93), year = 1993, pages = 130 -- 136. 28 [6] Mark Braverman and Elchanan Mossel. Noisy sorting without resampling. In SODA, pages 268 -- 276, 2008. [7] Yuval Dagan, Yuval Filmus, Ariel Gabizon, and Shay Moran. Twenty (simple) questions. In 49th ACM Symposium on Theory of Computing (STOC 2017), 2017. [8] Robert Mario Fano. The transmission of information. Technical Report 65, Research Labora- tory of Electronics at MIT, Cambridge (Mass.), USA, 1949. [9] Uriel Feige, David Peleg, Prabhakar Raghavan, and Eli Upfal. Computing with noisy infor- mation. SIAM Journal on Computing, 23:1001 -- 1018, 1994. [10] Ran Gelles et al. Coding for interactive communication: A survey. Foundations and Trends R(cid:13) in Theoretical Computer Science, 13(1 -- 2):1 -- 157, 2017. [11] E. N. Gilbert and E. F. Moore. Variable-length binary encodings. Bell System Technical Journal, 38:933 -- 967, 1959. [12] Bernhard Haeupler. Interactive channel capacity revisited. In Foundations of Computer Sci- ence (FOCS), 2014 IEEE 55th Annual Symposium on, pages 226 -- 235. IEEE, 2014. [13] Gillat Kol and Ran Raz. Interactive channel capacity. In Proceedings of the forty-fifth annual ACM symposium on Theory of computing, pages 715 -- 724. ACM, 2013. [14] K.B. Lakshmanan, B. Ravikumar, and K. Ganesan. Coping with erroneous information while sorting. IEEE Transactions on Computers, 40:1081 -- 1084, 1991. [15] Philip M. Long. Sorting and searching with a faulty comparison oracle. Technical Report UCSC -- CRL -- 92 -- 15, University of California at Santa Cruz, November 1992. [16] Shay Moran and Amir Yehudayoff. A note on average-case sorting. Order, 33(1):23 -- 28, 2016. [17] Andrzej Pelc. Coding with bounded error fraction. Ars Combinatorica, 42:17 -- 22, 1987. [18] Andrzej Pelc. Searching games with errors -- fifty years of coping with liars. Theoretical Com- puter Science, 270:71 -- 109, 2002. [19] Alfr´ed R´enyi. On a problem of information theory. MTA Mat. Kut. Int. Kozl., 6B:505 -- 516, 1961. [20] Ronald L. Rivest, Albert R. Meyer, Daniel J. Kleitman, and Karl Winklmann. Coping with errors in binary search procedures. Journal of Computer and System Sciences, 20:396 -- 404, 1980. [21] Leonard J Schulman. Coding for interactive communication. IEEE transactions on information theory, 42(6):1745 -- 1756, 1996. [22] Claude Elwood Shannon. A mathematical theory of communication. Bell System Technical Journal, 27:379 -- 423, 1948. [23] Joel Spencer and Peter Winkler. Three thresholds for a liar. Combin. Probab. Comput., 1(1):81 -- 93, 1992. 29 [24] Stanislav M. Ulam. Adventures of a mathematician. Scribner's, New York, 1976. 30
1204.5524
3
1204
2013-05-27T02:34:42
Time and Space Efficient Lempel-Ziv Factorization based on Run Length Encoding
[ "cs.DS" ]
We propose a new approach for calculating the Lempel-Ziv factorization of a string, based on run length encoding (RLE). We present a conceptually simple off-line algorithm based on a variant of suffix arrays, as well as an on-line algorithm based on a variant of directed acyclic word graphs (DAWGs). Both algorithms run in $O(N+n\log n)$ time and O(n) extra space, where N is the size of the string, $n\leq N$ is the number of RLE factors. The time dependency on N is only in the conversion of the string to RLE, which can be computed very efficiently in O(N) time and O(1) extra space (excluding the output). When the string is compressible via RLE, i.e., $n = o(N)$, our algorithms are, to the best of our knowledge, the first algorithms which require only o(N) extra space while running in $o(N\log N)$ time.
cs.DS
cs
Time and Space Efficient Lempel-Ziv Factorization based on Run Length Encoding Jun'ichi Yamamoto, Hideo Bannai, Shunsuke Inenaga, and Masayuki Takeda Department of Informatics, Kyushu University {junichi.yamamoto,bannai,inenaga,takeda}@inf.kyushu-u.ac.jp Abstract. We propose a new approach for calculating the Lempel-Ziv factorization of a string, based on run length encoding (RLE). We present a conceptually simple off-line algorithm based on a variant of suffix arrays, as well as an on-line algorithm based on a variant of directed acyclic word graphs (DAWGs). Both algorithms run in O(N + n log n) time and O(n) extra space, where N is the size of the string, n ≤ N is the number of RLE factors. The time dependency on N is only in the conversion of the string to RLE, which can be computed very efficiently in O(N ) time and O(1) extra space (excluding the output). When the string is compressible via RLE, i.e., n = o(N ), our algorithms are, to the best of our knowledge, the first algorithms which require only o(N ) extra space while running in o(N log N ) time. 1 Introduction The run-length encoding (RLE) of a string S is a natural encoding of S, where each maximal run of character a of length p in S is encoded as ap, e.g., the RLE of string aaaabbbaa is a4b3a2. Since RLE can be regarded as a compressed representation of strings, it is possible to reduce the processing time and working space if RLE strings are not decompressed while being processed. Many efficient algorithms that deal with RLE versions of classical problems on strings have been proposed in the literature (e.g.: exact pattern matching [2, 4, 7], approximate matching [3, 26], edit distance [5, 8, 10, 24], longest common subsequence [17, 25], rank/select structures [22], palindrome detection [11]). In this paper, we consider the problem of computing the Lempel-Ziv factorization (LZ factorization) of a string via RLE. The LZ factorization (and its variants) of a string [13, 32, 35], discovered over 30 years ago, captures important properties concerning repeated occurrences of substrings in the string, and has applications in the field of data compression, as well as being the key component to various efficient algorithms on strings [16, 20]. Therefore, there exists a large amount of work devoted to its efficient computation. A naıve algorithm that computes the longest common prefix with each of the O(N ) previous positions only requires O(1) space (excluding the output), but can take O(N 2) time, where N is the length of the string. Using string indicies such as suffix trees [34] and on-line algorithms to construct them [33], the LZ factorization can be computed in an on-line manner in O(N log Σ) time and O(N ) space, where Σ is the size of the alphabet. Most recent algorithms [1, 9, 14, 15, 29] first construct the suffix array [27] of the string, consequently taking O(N ) extra space and at least O(N ) time, and are off-line. Since the most efficient algorithms run in worst-case linear time and are practical, it may seem that not much better can be achieved. However, a theoretical interest is whether or not we can achieve even faster algorithms, at least in some specific cases. In this paper, we propose a new approach for calculating the Lempel-Ziv factorization of a string, which is based on its RLE. The contributions of this paper are as follows: We first show that the size of the LZ encoding with self-references (i.e., allowing previous occurrences of a factor to overlap with itself) is at most twice as large as the size of its RLE. We then present two algorithms that compute the LZ factorizations of strings given in RLE: an off-line algorithm based on suffix arrays for RLE strings, and an on-line algorithm based on directed acyclic word graphs (DAWGs) [6] for RLE strings. Given an RLE string of size n, both algorithms work for general ordered alphabets, and run in O(n log n) time and O(n) space. Since the conversion from a string of size N to its RLE can be conducted very efficiently in O(N ) time and O(1) extra space (excluding the output), the total complexity is O(N + n log n) time and O(n) space. In the worst-case, the string is not compressible by RLE, i.e. n = N . Thus, for integer alphabets, our approach can be slightly slower than the fastest existing algorithms which run in O(N ) time (off-line) or O(N log Σ) time (on-line). However, for general ordered alphabets, the worst-case complexities of our algorithms match previous algorithms since the construction of the suffix array/suffix tree can take O(N log N ) time if Σ = O(N ). The significance of our approach is that it allows for improvements in the computational complexity of calculating the LZ factorization for a non-trivial family of strings; strings that are compressible via RLE. If n = o(N ), our algorithms are, to the best of our knowledge, the first algorithms which require only o(N ) extra space while running in o(N log N ) time. Related Work. For computing the LZ78 [36] factorization, a sub-linear time and space algorithm was presented in [18]. In this paper, we consider a variant of the more powerful LZ77 [35] factorization. Two space efficient on-line algorithms for LZ factorization based on succinct data structures have been proposed [30, 31]. The first runs in O(N log3 N ) time and N log Σ+o(N log Σ)+O(N ) bits of space [30], and the other runs in O(N log2 N ) time with O(N log Σ) bits of space [31]. Succinct data structures basically simulate accesses to their non-succinct counterparts using less space at the expense of speed. A notable distinction of our approach is that we aim to reduce the problem size via compression, in order to improve both time and space efficiency. 2 Preliminaries Let N be the set of non-negative integers. Let Σ be a finite alphabet. An element of Σ∗ is called a string. The length of a string S is denoted by S. The empty string ε is the string of length 0, namely, ε = 0. For any string S ∈ Σ, let σS denote the number of distinct characters appearing in S. Let Σ+ = Σ∗ −{ε}. For a string S = XY Z, X, Y and Z are called a prefix, substring, and suffix of S, respectively. The set of prefixes of S is denoted by Prefix (S). The longest common prefix of strings X, Y , denoted lcp(X, Y ), is the longest string in Prefix (X) ∩ Prefix (Y ). The i-th character of a string S is denoted by S[i] for 1 ≤ i ≤ S, and the substring of a string S that begins at position i and ends at position j is denoted by S[i..j] for 1 ≤ i ≤ j ≤ S. For convenience, let S[i..j] = ε if j < i. For any character a ∈ Σ and p ∈ N , let ap denote the concatenation of p a's, e.g., a1 = a, a2 = aa, and so on. p is said to be the exponent of ap. Let a0 = ε. Our model of computation is the word RAM with the computer word size at least ⌈log2 S⌉ bits, and hence, standard instructions on values representing lengths and positions of string S can be executed in constant time. Space complexities will be determined by the number of computer words (not bits). 2.1 LZ Encodings LZ encodings are dynamic dictionary based encodings with many variants. As in most recent work, we describe our algorithms with respect to a well known variant called s-factorization [13] in order to simplify the presentation. Definition 1 (s-factorization [13]). The s-factorization of a string S is the factorization S = f1 · · · fn where each s-factor fi ∈ Σ+ (i = 1, . . . , n) is defined inductively as follows: f1 = S[1]. For i ≥ 2: if S[f1 · · · fi−1 + 1] = c ∈ Σ does not occur in f1 · · · fi−1, then fi = c. Otherwise, fi is the longest prefix of fi · · · fn that occurs at least twice in f1 · · · fi. Note that each s-factor can be represented in constant size, i.e., either as a single character or a pair of integers representing the position of a previous occurrence of the factor and its length. For example the s-factorization of the string S = abaabababaaaaabbabab is a, b, a, aba, baba, aaaa, b, babab. This can be represented as a, b, (1, 1), (1, 3), (5, 4), (10, 4), (2, 1), (5, 5). In this paper, we will focus on describing algorithms that output only the length of each factor of the s-factorization, but it is not difficult to modify them to output the previous position as well, in the same time and space complexities. 2.2 Run Length Encoding Definition 2. The Run-Length (RL) factorization of a string S is the factorization f1, . . . , fn of S such that for every i = 1, . . . , n, factor fi is the longest prefix of fi · · · fn with fi ∈ {ap a ∈ Σ, p > 0}. Note that each factor fi can be written as fi = api i pi > 0 and for any consecutive factors fi = api i and fi+1 = api+1 for some character ai ∈ Σ and some integer i+1 , we have that ai 6= ai+1. The run length 2 encoding (RLE) of a string S, denoted RLE S, is a sequence of pairs consisting of a character ai and an integer pi, representing the RL factorization. The size of RLE S is the number of RL factors in RLE S and is denoted by size(RLE S), i.e., if RLE S = ap1 n , then size(RLE S) = n. RLE S can be computed in O(N ) time and O(1) extra space (excluding the O(n) space for output), where N = S, simply by scanning S from beginning to end, counting the exponent of each RL factor. Also, noticing that each RL factor must consist of the same alphabet, we have σS ≤ n. 1 · · · apn Let val be the function that "decompresses" RLE S, i.e., val (RLE S) = S. For any 1 ≤ i ≤ j ≤ n, pj j . For convenience, let RLE S[i..j] = ε if i > j. Let RLE Substr(S) = let RLE S[i..j] = api {RLE S[i..j] 1 ≤ i, j ≤ n} and RLE Suffix (S) = {RLE S[i..n] 1 ≤ i ≤ n}. i+1 · · · a i api+1 The following simple but nice observation allows us to represent the complexity of our algorithms in terms of size(RLE S). Lemma 1. For a given string S, let nRL and nLZ respectively be the number of factors in its RL factorization and s-factorization. Then, nLZ ≤ 2nRL. Proof. Consider an s-factor that starts at the jth position in some RL-factor api i where 1 < j ≤ pi. Since api−j+1 i , we have that the s-factor extends at least to the end of api i . i This implies that a single RL-factor is always covered by at most 2 s-factors, thus proving the lemma. is both a suffix and a prefix of api Note that for LZ factorization variants without self-references, the size of the output LZ encoding may come into play, when it is larger than O(size(RLE S)). 2.3 Priority Search Trees In our LZ factorization algorithms, we will make use the following data structure, which is essentially an elegant mixture of a priority heap and balanced search tree. Theorem 1 (McCreight [28]). For a dynamic set D which contains n ordered pairs of integers, the priority search tree (PST) data structure supports all the following operations and queries in O(log n) time, using O(n) space: -- Insert(x, y): Insert a pair (x, y) into D; -- Delete(x, y): Delete a pair (x, y) from D; -- MinXInRectangle(L, R, B): Given three integers L ≤ R and B, return the pair (x, y) ∈ D with minimum x satisfying L ≤ x ≤ R and y ≥ B; -- MaxXInRectangle(L, R, B): Given three integers L ≤ R and B, return the pair (x, y) ∈ D with maximum x satisfying L ≤ x ≤ R and y ≥ B; -- MaxYInRange(L, R): Given two integers L ≤ R, return the pair (x, y) ∈ D with maximum y satisfy- ing L ≤ x ≤ R. 3 Off-line LZ Factorization based on RLE In this section we present our off-line algorithm for s-factorization. The term off-line here implies that the input string S of length N is first converted to a sequence of RL factors, RLE S = ap1 2 · · · apn n . In the algorithm which follows, we introduce and utilize RLE versions of classic string data structures. 1 ap2 3.1 RLE Suffix Arrays Let ΣRLE S = {RLE S[i] i = 1, . . . , n}. For instance, if RLE S = a3b5a3b5a1b5a4, then ΣRLE S = pj {a1, a3, a4, b5}. For any api j ⇐⇒ ai < aj , or ai = aj and pi < pj . The lexicographic ordering on RLE Suffix (S) is defined over the order on ΣRLE S , and our RLE version of suffix arrays [27] is defined based on this order: j ∈ ΣRLE S , let the order ≺ on ΣRLE S be defined as api i ≺ a i , a pj Definition 3 (RLE suffix arrays). For any string S, its run length encoded suffix array, denoted RLE SAS, is an array of length n = size(RLE S) such that for any 1 ≤ i ≤ n, RLE SAS[i] = j when RLE S[j..n] is the lexicographically i-th element of RLE Suffix (S). 3 Let SparseSuffix (S) = {val (s) s ∈ RLE Suffix (S)}, namely, SparseSuffix (S) is the set of "uncom- pressed" RLE suffixes of string S. Note that the lexicographic order of RLE Suffix (S) represented by RLE SAS is not necessarily equivalent to the lexicographic order of SparseSuffix (S). In the running exam- ple, RLE SAS = [5, 3, 1, 7, 4, 2, 6]. However, the lexicographical order for the elements in SparseSuffix (S) is actually (7, 1, 3, 5, 6, 2, 4). Lemma 2. Given RLE S for any string S ∈ Σ∗, RLE SAS can be constructed in O(n log n) time, where n = size(RLE S). Proof. Any two RL factors can be compared in O(1) time, so the lemma follows from algorithms such as in [21]. Let RLE RANK S be an array of length n = size(RLE S) such that RLE RANK S[j] = i ⇐⇒ RLE SAS[i] = j. Clearly RLE RANK S can be computed in O(n) time provided that RLE SAS is already computed. To make the notations simpler, in what follows we will denote rs(h) = RLE SAS[h] and rr(h) = RLE RANK S[h] for any 1 ≤ h ≤ n. For any RLE strings RLE X and RLE Y with val (RLE X ) = X and val (RLE Y ) = Y , let lcp(RLE X , RLE Y ) = lcp(X, Y ), i.e., lcp(RLE X , RLE Y ) is the longest prefix of the "uncompressed" strings X and Y . It is easy to see that Z = lcp(RLE X , RLE Y ) can be computed in O(size(RLE Z)) time by a naive comparison from the beginning of RLE X and RLE Y , adding up the exponent pi of the RL factors while api i = RLE X [i] = RLE Y [i], and possibly the smaller exponent of the first mismatching RL factors, provided that they are exponents of the same character. The following two lemmas imply an interesting and useful property of our data structure; although RLE SAS does not necessarily correspond to the lexicographical order of the uncompressed RLE suffixes, RLE suffixes that are closer to a given entry in the RLE SAS have longer longest common prefixes with that entry. Lemma 3. Let i, j be any integers such that 1 ≤ i < j ≤ n. (1) For any j′ > j, lcp(RLE S[rs(i)..n], RLE S[rs(j)..n]) ≥ lcp(RLE S[rs(i)..n], RLE S[rs(j′)..n]). (2) For any i′ < i, lcp(RLE S[rs(i)..n], RLE S[rs(j)..n]) ≥ lcp(RLE S[rs(i′)..n], RLE S[rs(j)..n]). Proof. We only show (1). (2) can be shown by similar arguments. Let k = min{t RLE S[rs(i)..rs(i) + t − 1] 6= RLE S[rs(j)..rs(j) + t − 1]} and k′ = min{t′ RLE S[rs(i)..rs(i) + t′ − 1] 6= RLE S[rs(j′)..rs(j′) + t′ − 1]}. Namely, the first (k − 1) RL factors of RLE S[rs(i)..n] and RLE S[rs(j)..n] coincide and the kth RL factors differ. The same goes for k′, RLE S[rs(i)..n], and RLE S[rs(j′)..n]. Since j′ > j, k ≥ k′. If k > k′, then clearly the lemma holds. If k = k′, then RLE S[rs(i) + k] ≺ RLE S[rs(j) + k] (cid:22) RLE S[rs(j′) + k]. This implies that lcp(RLE S[rs(i) + k], RLE S[rs(j) + k]) ≥ lcp(RLE S[rs(i) + k], RLE S[rs(j′) + k]). The lemma holds since for these pairs of suffixes, the RL factors after the kth do not contribute to their lcps. 3.2 LZ factorization using RLE SA In what follows we describe our algorithm that computes the s-factorization using RLE SAS. Assume that we have already computed the first (j −1) s-factors f1, f2, . . . , fj−1 of string S. Let Pj−1 h=1 fh = ℓ−1, i.e., the next s-factor fj begins at position ℓ of S. Let d = min{k Pk i=1(pi) ≥ ℓ} + 1, i.e., the (d − 1)-th RL factor apd−1 i=1 (pi) − ℓ + 1, i.e., RLE S[ℓ..N ] = aq d−1 contains the occurrence of the ℓ-th character S[ℓ] = ad−1 of S. Let q = Pd−1 n . Note that 1 ≤ q ≤ pd−1. d · · · apn d−1apd d−1apd The task next, is to find the longest previously occurring prefix of aq n which will be fj. The difficulty here, compared to the non-RLE case, is that fj will not necessarily begin at positions in S corresponding to an entry in the RLE SAS. A key idea of our algorithm is that rather than looking directly for aq d · · · apn whose occurrence is immediately preceded by aq d−1, which will have corresponding entries in RLE SAS. To compute fj in this way, we use the following lemma: n , we look for the longest previously occurring prefix of RLE S[d..n] = apd d · · · apn d · · · apn d−1apd n 4 Lemma 4. Assume the situation mentioned above. Let k = max({pi ai = ad−1, 1 ≤ i ≤ d − 2} ∪ {0}). (Case 1) If q = pd−1 and q > k, then fj = max{k, 1}. (Case 2) Otherwise, fj = q + max{lcp(RLE S[rs(x1)..n], RLE S[d..n]), lcp(RLE S[d..n], RLE S[rs(x2)..n])} where x1 = max{u 1 < rs(u) < d, u < rr(d), ars(u)−1 = ad−1, prs(u)−1 ≥ q} and x2 = min{v 1 < rs(v) < d, rr(d) < v, ars(v)−1 = ad−1, prs(v)−1 ≥ q}. pd−1 d−1 , and must Proof. Case (1) is when the new s-factor begins at the beginning of the RL-factor a end somewhere inside it. Otherwise (Case (2)), fj is at least q since either q < pd−1 and aq d−1 = S[ℓ..ℓ + q − 1] = S[ℓ − 1..ℓ + q − 2] is a prefix of fj due to the self-referencing nature of s-factorization, or, there exists an RL factor api d−1X. Then X is i the longest of the longest common prefixes between RLE S[d..n] and RLE S[h..n] for all 1 ≤ h < d, that are immediately preceded by aq d−1, i.e. ah−1 = ad−1 and ph−1 ≥ q. It follows from Lemma 3 that of all these h, the one with the longest lcp with RLE S[d..n] is either of the entries that are closest to position rr(d) in the suffix array. The positions x1 and x2 of these entries can be described by the equation in the lemma statement, and thus the lemma holds. such that 1 ≤ i ≤ d − 2, ad−1 = ai and q ≤ pi. Let fj = aq Once x1 and x2 of the above Lemma are determined, our algorithm is similar to conventional non- RLE algorithms that use the suffix array. The main difficulty lies in computing these values, since, unlike the non-RLE algorithms, they depend on the value q which is determined only during the s-factorization. The main result of this section follows. Theorem 2. Given RLE S of any string S ∈ Σ∗, we can compute the s-factorization of S in O(n log n) time and O(n) space where n = size(RLE S). Proof. First, compute RLE SAS in O(n log n) time, and RLE RANK S in O(n) time. Next we show how to compute each s-factor fj using Lemma 4. a Recall that the s-factor begins somewhere in the (d − 1)-th RL factor. We shall maintain, for each character a ∈ Σ, a PST Ta of Theorem 1 for the set of pairs U d−1 = {(x, y) x = rr(i), ai−1 = a, y = pi−1, 1 < i ≤ d − 1}, i.e., the x coordinate is the position in the suffix array, and the y coordinate is the exponent of the preceding character of that suffix. Then, we can easily check whether the condition of case (1) is satisfied by computing the k of Lemma 4 as k = MaxYInRange(1, n) on Tad−1, which can be computed in O(log n) time by Theorem 11. For case (2), we obtain x1 and x2 as: x1 = MaxXInRectangle(1, rr(d) − 1, q) and x2 = MinXInRectangle(rr(d) + 1, n, q) in O(log n) time, using Tad−1. To compute the length of the lcp's, lcp(RLE S[rs(x1)..n], RLE S[d..n]) and lcp(RLE S[d..n], RLE S[rs(x2)..n]), we simply use the naive algorithm mentioned previously, that compares each RL factor from the beginning. Since the longer of the two longest common prefixes is adopted, the number of comparisons is at most twice the number of RL factors that is spanned by the determined s-factor. From Lemma 1, the total number of RL factors compared, i.e. PnLZ After computing the s-factor fj, we update the PSTs. Namely, if fj spans the RL factors apd pd+g d+g , then we insert pair (rr(i), pi−1) into Tai−1 , for all d ≤ i ≤ d+g. These insertion operations take O(g log n) time by Theorem 1, which takes a total of O(n log n) time for computing all fj. Hence the total time complexity is O(n log n). i=1 size(RLE fi ), is O(n). d · · · a We analyze the space complexity of our data structure. Notice that a collection of sets U d−1 for all characters a ∈ Σ are pairwise disjoint, and hence Pa∈Σ U d−1 = d − 1. By Theorem 1, the overall size of the PSTs is O(n) at any stage of d = 1, 2, . . . , n. Since RLE SAS and RLE RANK S occupy O(n) space each, we conclude that the overall space requirement of our data structure is O(n). a a 4 On-line LZ Factorization based on RLE Next, we present an on-line algorithm that computes s-factorization based on RLE. The term on-line here implies that for a string S of (possibly unknown) length N , the algorithm iteratively computes the 1 Actually, this is an O(1) operation on the PST, since the information for the pair with maximum y in the entire range of x, is contained in the root of the PST. 5 a10 c4 a3 b2 a5 b2 a5 c4 a10 b2 a5 a5 b2 c4 Fig. 1. Illustration for the RLE DAWG of a3b2a5b2a5c4a10. The edges in E are represented by the solid arcs, while the suffix links of some nodes are represented by dashed arcs (but their labels are omitted). For simplicity the suffix links of the other nodes are omitted in this figure. output for input string S[1..i] for each i = 1, . . . , N (the output of S[1..i] can be reused to compute the output for S[1..i + 1]). For example, RLE S of string S of length N can be computed on-line in a total of O(N ) time and O(n) space (including the output), where n = size(RLE S). In the description of our algorithms, this definition will be relaxed for simplicity, and we shall work on RLE S, where the s-factorization of val (RLE S[1..i]) is iteratively computed for i = 1, 2, . . . n. Note that the off-line algorithm described in the previous section cannot be directly transformed to an on-line algorithm, even if we simulate the suffix array using suffix trees, which can be constructed on-line [33]. This is because the elements inserted into the PST depended on the lexicographic rank of each suffix, which can change dynamically in the on-line setting. Nonetheless, we overcome this problem by taking a different approach, utilizing remarkable characteristics of a string index structure called directed acyclic word graphs (DAWGs) [6]. 4.1 RLE DAWGs The DAWG of a string S is the smallest automaton that accepts all suffixes of S. Below we introduce an RLE version of DAWGs: We regard RLE S as a string of length n over alphabet ΣRLE S = {RLE S[i] i = 1, . . . , n}. For any u ∈ RLE Substr(S), let EndPos RLE S (u) denote the set of positions where an occurrence of u ends in RLE S, i.e., EndPos RLE S (u) = {j u = RLE S[i..j], 1 ≤ i ≤ j ≤ n} for any u ∈ Σ+ and EndPos RLE S (ε) = {0, . . . , n}. Define an equivalence relation for any u, w ∈ RLE Substr(S) by u ≡RLE S w ⇐⇒ EndPos RLE S (u) = EndPos RLE S (w). The equivalence class of u ∈ RLE Substr(S) w.r.t. ≡RLE S is denoted by [u]RLE S . When clear from context, we abbreviate the above notations as EndPos, ≡ and [u], respectively. Note that for any two elements in [u], one is a suffix of the other (or vice versa). We denote by ←−u the longest member of [u]. Definition 4. The run length encoded DAWG of a string S ∈ Σ∗, denoted by RLE DAWG S, is the DAWG of RLE S over alphabet ΣRLE S = {RLE S[i] i = 1, . . . , n}. Namely, RLE DAWG S = (V, E) where V = {[u] u ∈ RLE Substr(S)} and E = {([u], ap, [uap]) u, uap ∈ RLE Substr(S), u 6≡ uap}. We also define the set F of labeled reversed edges, called suffix links, by F = {([apu], ap, [u]) u, apu ∈ RLE Substr(S), u = ←−u }. See also Fig. 1 that illustrates RLE DAWG S for RLE S = a3b2a5b2a5c4a10. Since EndPos(b2a5) = EndPos(a5) = {3, 5}, b2a5 and a5 are represented by the same node. On the other hand, EndPos(a3b2a5) = {3} and hence a3b2a5 is represented by a different node. Lemma 5. Given RLE S of any string S where n = size(RLE S), RLE DAWG S has O(n) nodes and edges, and can be constructed in O(n log n) time and O(n) extra space in an on-line manner, together with the suffix link set F . Proof. A simple adaptation of the results from [6]. (See Appendix for full proof.) 4.2 On-line LZ factorization using RLE DAWG The high-level structure of our on-line algorithm follows that of the off-line algorithm described in the beginning of Section 3.2. In order to find the longest previously occurring prefix of aq n , which d · · · apn d−1apd 6 2 · · · a is the next s-factor, we construct the RLE DAWG S on-line for the string up to RLE S[1..d − 1] = pd−1 ap1 1 ap2 d−1 and use it, instead of using the RLE SAS. The difficulty is, as in the off-line case, that only the suffixes that start at a beginning of an RL factor is represented in the RLE DAWG. Therefore, we again look for the longest previously occurring prefix of RLE S[d..n] = apd n that is immediately preceded by aq n . We augment the RLE DAWG with some more information to make this possible. d−1 in S, rather than looking directly for aq d · · · apn d · · · apn d−1apd Let E[u] denote the set of out-going edges of node [u]. For any edge e = ([u], bq, [ubq]) ∈ E[u] and each character a ∈ Σ, define mpee(a) = max({p ap←−u bq ∈ RLE Substr(S)} ∪ {0}). That is, mpee(a) represents the maximum exponent of the RL factor with character a, that precedes ←−u bq in S. Lemma 6. Given RLE S of any string S ∈ Σ∗, RLE DAWG S = (V, E), augmented so that mpee(a) can be computed in O(log σS) time for any e ∈ E and any character a ∈ Σ, can be constructed in an on-line manner in a total of O(n log n) time with O(n) space. pj′ j ′ ←−u bq ≡ ←−u bq, i.e., ←−u bq is always immediately preceded by a ←− ubq. For any j ∈ EndPos(←−u bq) let j′ = j −size(u). We have that RLE S[j′] = a Proof. When computing mpee(a), consider the following cases: (Case 1) ←−u bq is not the longest member of [←−u bq], i.e. ←−u bq 6= pj′ j ′ where pj′ in RLE S. Therefore, mpee(a) = pj ′ if a j ′ aj ′ = a and 0 otherwise. For any node [v] ∈ V , an arbitrary j ∈ EndPos(v) can be easily determined in O(1) time when the node is first constructed during the on-line construction of RLE DAWG S, and does not need to be updated. (Case 2) ←−u bq is the longest member of [←−u bq], i.e. ←−u bq = ubq], ap, [ ←− ubq. For each occurrence of ap←−u bq = ap←− ubq ∈ ←− RLE Substr(S), there must exist a suffix link ([ap←− ubq]) ∈ F . Therefore mpee(a) is the maximum of the exponent in the labels of all such incoming suffix links, or 0 if there are none. By maintaining a balanced binary search tree at every edge e, we can retrieve this value for any a ∈ Σ in O(log σS) time. It also follows from the on-line construction algorithm of RLE DAWG S that the set of labels of incoming suffix links to a node only increases, and we can update this value in O(log σS) time for each new suffix link. Since F = O(n), constructing the balanced binary search trees take a total of O(n log σS) time, and the total space requirement is O(n). In order to determine which case applies, it is easy to check whether ←−u bq is the longest element of [←−u bq] in O(1) time by maintaining the length of the longest path to any given node during the on-line construction of RLE DAWG S. This completes the proof. Lemma 7. Given RLE S of any string S ∈ Σ∗, RLE DAWG S = (V, E), augmented so that max{p mpee(a) ≥ q, e = ([u], bp, [w]) ∈ E[u]} can be computed in O(log n) time for any e ∈ E, character a ∈ Σ, and integer q ≥ 0, can be constructed in an on-line manner in a total of O(n log n) time with O(n) space. Proof. During the on-line construction of the augmented RLE DAWG S of Lemma 6, we further construct and maintain a family of PSTs at each node of RLE DAWG S with a total size of O(n), containing the information to answer the query in O(n log n) time. (See Appendix for full proof.) The next lemma shows how the augmented RLE DAWG S can be used to efficiently compute the longest prefix of a given pattern string that appears in string S. Lemma 8. For any pattern string P ∈ Σ∗, let RLE P = bq1 m . Given RLE P , we can compute the length of the longest prefix P ′ of P that occurs in string S in O(size(RLE P ′ ) log n) time, using a data structure of O(n) space, where n = size(RLE S). 2 · · · bqm 1 bq2 Proof. The outline of the procedure is shown in Algorithm 1. First, we check whether the first RL factor bq1 1 of P is a substring of S (Line 2). If so, the calculation basically proceeds by traversing RLE DAWG S with bq2 2 · · · bqi 6∈ RLE Substr(S)), or, there is no occurrence of bq2 1, where q ≥ q1, in S. If shortcut = false, bq2 is the longest element in the node, and the latter check is conduced by the condition mpee(b1) ≥ q1. If shortcut = true, the character preceding any occurrence of bq2 2 · · · bqi is uniquely determined and already checked in a previous edge traversal, so no further check is required. (i.e. bq2 that is immediately preceded by bq 3 · · · until there is no outgoing edge with bqi 2 · · · bqi 2 · · · bqi 2 bq3 i i i i By Lemmas 5, 6, and 7, the length of the longest prefix P ′ of P that occurs in S can be computed in O(size(RLE P ′ )(log n + log σS)) = O(size(RLE P ′ ) log n) time using a data structure of O(n) space. 7 i Algorithm 1: Pattern Matching on RLE DAWG S. Input: RLE DAWG S = (V, E), RLE P = bq1 1 · · · bqm m 1, [w]) ∈ E[ε]}; 1 h = max{q ([ε], bq 2 if (m = 1) or (h < q1) then Output min(h, q1) and return; 3 shortcut := false; v := [ε]; 4 for i = 2, . . . , m do 5 if e = (v, bqi i , [w]) ∈ Ev and (shortcut = true or mpee(b1) ≥ q1) then 6 7 8 9 10 11 v := [w]; // RLE P [2..i] ∈ [w] if RLE P [2..i] is not the longest element of [w] then shortcut := true ; else // k:maximum exponent of bi such that val(bq1 if shortcut = true then k := max{q (v, bq else k := max{q mpee(b1) ≥ q1, e = (v, bq Output val (bq1 1 bq2 i , [w]) ∈ Ev}; i , [w]) ∈ Ev}; ) and return; 2 · · · bmin{qi ,k} 1 bq2 i 2 · · · bk i ) ∈ Substr (S). 12 Output P and return; // P itself occurs in S Below we give an example for Lemma 8. See Fig. 1 that illustrates RLE DAWG S for RLE S = a3b2a5b2a5c4a10, and consider searching string S for pattern P with RLE P = a5b2a7. We start traversing RLE DAWG S with the second RL factor b2 of P . Since there is an out-going edge labeled b2 from the source node we reach node v = [b2]. There are two suffix links that point to node v, ([a3b2], a3, [b2]) and ([a5b2], a5, [b2]). Hence mpe([ε],b2,[b2])(a) = max{3, 5} = 5, and thus the prefix a5b2 of P occurs in S. We examine whether a longer prefix of P occurs in S by considering the third RL factor a7. There is no out-going edge from v that is labeled a7, hence the longest prefix of P that occurs in S is of the form a5b2aℓ for some ℓ ≥ 0. We consider the set Ev(a) of out-going edges of v that are labeled aq for some q, and obtain Ev(a) = {([b2], a5, [b2a5])}. We have mpe([b2],a5,[b2 a5])(a) = max{3, 5} = 5 due to the two suffix links pointing to [b2a5]. Thus, the longest prefix of P that occurs in S is a5b2amin{7,5} = a5b2a5. Theorem 3. Given RLE S for any string S ∈ Σ∗, the s-factorization of S can be computed in an on-line manner in O(n log n) time and O(n) extra space, where size(RLE S) = n. S 1 ap2 1 ap2 2 · · · apd−1 Proof. Assume the situation described in the first paragraph of Section 3.2. In addition, assume that we have constructed RLE DAWG d−1 , the RLE DAWG (with augmentations described previously) for 2 · · · apd−1 RLE S[1..d − 1] = ap1 d−1 . By definition, the longest prefix P ′ of P = S[ℓ..N ] such that P ′ ∈ Substr(val (ap1 d−1 )), is a prefix of fj. By Lemma 8, we can compute P ′ in O(size(RLE P ′ ) log d) time. A minor technicality is when the longest previous occurrence of fj is self-referencing. This problem can be solved by simply interleaving the traversal and update of RLE DAWG S for each RL factor of fj. If we suppose that fj spans the RL factors apd to RLE DAWG d+g in a total of O(g log n) time by Lemma 7. Thus, totaling for all fj, we can compute the s-factorization in O(n log n) time. O(n) space complexity follows from Lemmas 5, 6, 7, and 8. For any i > 1, the s-factorization of val (RLES[1..i − 1]) and the s-factorization of val (RLES[1..i]) differs only in the last 1 or 2 factors. It is easy to see that the s-factorization of val (RLES[1..i]) is iteratively computed for i = 1, . . . , n, and the computation is on-line. d+g , we can traverse and update RLE DAWG d−1 d · · · a pd+g S S 5 Discussion We proposed off-line and on-line algorithms that compute a well-known variant of LZ factorization, called s-factorization, of a given string S in O(N + n log n) time using only O(n) extra space, where N = S and n = size(RLE S). After converting S to RLE S in O(N ) time and O(1) extra space (excluding the output), the main part of the algorithms work only on RLE S, running in O(n log n) time and O(n) space, and therefore can be more time and space efficient compared to previous LZ factorization algorithms when the input strings are compressible by RLE. Our algorithms are theoretically significant in that they are the only algorithms which achieve o(N log N ) time using only o(N ) extra space for strings with n = o(N ), thus offering a substantial improvement to the asymptotic time complexities in calculating the 8 s-factorization, for a non-trivial family of strings. Our algorithms can be easily extended to other variants of LZ factorization. For example, let m be the size of the s-factorization without self-references of a given string. Since Lemma 1 does not hold for s-factorization without self-references, the time complexity of the algorithm is O(N + (n + m) log n). The working space remains O(n) (excluding the output). Since conventional string data such as natural language texts are not usually compressible via RLE, the algorithms in this paper, although theoretically interesting, may not be very practical. However, our approach may still have potential practical value for other types of data and objectives. For example, a piece of music can be thought of as being naturally expressed in RLE, where the pitch of the tone is a character, and the duration of the tone is its run length. Other than for the applications to string algorithms [16, 20], mentioned in the Introduction, Lempel Ziv factorization on such RLE compressible strings can be important, due to an interesting application of compression, including LZ77 (gzip), as a measure of distance between data, called Normalized Compression Distance (NCD) [23]. NCD has been shown to be effective for various clustering and classification tasks, including MIDI music data, while not requiring in-depth prior knowledge of the data [12, 19]. The NCD between two strings S and T w.r.t. a compression algorithm basically depends only on the compressed sizes of the strings S, T , and their concatenation ST . Therefore, efficiently computing their s-factorizations from RLE S, RLE T , and RLE ST would contribute to making the above clustering and classification tasks faster and more space efficient. Our algorithms are based on RLE variants of classical string data structures. However, our approach does not necessarily make the use of succinct data structures impossible. It would be interesting to explore how succinct data structures can be used in combination with our approach to further improve the space efficiency. 9 Bibliography [1] Al-Hafeedh, A., Crochemore, M., Ilie, L., Kopylov, J., Smyth, W., Tischler, G., Yusufu, M.: A comparison of index-based Lempel-Ziv LZ77 factorization algorithms. ACM Computing Surveys (in press) [2] Amir, A., Landau, G.M., Sokol, D.: Inplace run-length 2d compressed search. TCS 290(3), 1361 -- 1383 (2003) [3] Apostolico, A., Erdos, P.L., Juttner, A.: Parameterized searching with mismatches for run-length encoded strings. TCS (2012) [4] Apostolico, A., Landau, G.M., Skiena, S.: Matching for run-length encoded strings. J. Complexity 15(1), 4 -- 16 (1999) [5] Arbell, O., Landau, G.M., Mitchell, J.S.: Edit distance of run-length encoded strings. IPL 83(6), 307 -- 314 (2002) [6] Blumer, A., Blumer, J., Haussler, D., Ehrenfeucht, A., Chen, M.T., Seiferas, J.: The smallest au- tomaton recognizing the subwords of a text. TCS 40, 31 -- 55 (1985) [7] Bunke, H., Csirik, J.: An algorithm for matching run-length coded strings. Computing 50, 297 -- 314 (1993) [8] Bunke, H., Csirik, J.: An improved algorithm for computing the edit distance of run length coded strings. IPL 54, 93 -- 96 (1995) [9] Chen, G., Puglisi, S., Smyth, W.: Lempel-Ziv factorization using less time & space. Mathematics in Computer Science 1(4), 605 -- 623 (2008) [10] Chen, K.Y., Chao, K.M.: A fully compressed algorithm for computing the edit distance of run-length encoded strings. Algorithmica (2011) [11] Chen, K.Y., Hsu, P.H., Chao, K.M.: Efficient retrieval of approximate palindromes in a run-length encoded string. TCS 432, 28 -- 37 (2012) [12] Cilibrasi, R., Vit´anyi, P.M.B.: Clustering by compression. IEEE Transactions on Information Theory 51, 1523 -- 1545 (2005) [13] Crochemore, M.: Linear searching for a square in a word. Bulletin of the European Association of Theoretical Computer Science 24, 66 -- 72 (1984) [14] Crochemore, M., Ilie, L., Iliopoulos, C.S., Kubica, M., Rytter, W., Wale´n, T.: LPF computation revisited. In: Proc. IWOCA 2009. pp. 158 -- 169 (2009) [15] Crochemore, M., Ilie, L., Smyth, W.F.: A simple algorithm for computing the Lempel Ziv factoriza- tion. In: Proc. DCC 2008. pp. 482 -- 488 (2008) [16] Duval, J.P., Kolpakov, R., Kucherov, G., Lecroq, T., Lefebvre, A.: Linear-time computation of local periods. TCS 326(1-3), 229 -- 240 (2004) [17] Freschi, V., Bogliolo, A.: Longest common subsequence between run-length-encoded strings: a new algorithm with improved parallelism. IPL 90(4), 167 -- 173 (2004) [18] Jansson, J., Sadakane, K., Sung, W.K.: Compressed dynamic tries with applications to LZ- compression in sublinear time and space. In: Proc. FSTTCS 2007. pp. 424 -- 435 (2007) [19] Keogh, E., Lonardi, S., Ratanamahatana, C.A., Wei, L., Lee, S.H., Handley, J.: Compression-based data mining of sequential data. Data Mining and Knowledge Discovery 14(1), 99 -- 129 (2007) [20] Kolpakov, R., Kucherov, G.: Finding maximal repetitions in a word in linear time. In: Proc. FOCS 1999. pp. 596 -- 604 (1999) [21] Larsson, N.J., Sadakane, K.: Faster suffix sorting. Tech. Rep. LU-CS-TR:99-214 [LUNFD6/(NFCS- 3140)/1 -- 20/(1999)], Dept of Computer Science, Lund University, Sweden (1999) [22] Lee, S., Park, K.: Dynamic rank/select structures with applications to run-length encoded texts. TCS 410(43), 4402 -- 4413 (2009) [23] Li, M., Chen, X., Li, X., Ma, B., Vit´anyi, P.M.B.: The similarity metric. IEEE Transactions on Information Theory 50(12), 3250 -- 3264 (2004) [24] Liu, J., Huang, G., Wang, Y., Lee, R.: Edit distance for a run-length-encoded string and an uncom- pressed string. IPL 105(1), 12 -- 16 (2007) [25] Liu, J., Wang, Y., Lee, R.: Finding a longest common subsequence between a run-length-encoded string and an uncompressed string. J. Complexity 24(2), 173 -- 184 (2008) [26] Makinen, V., Ukkonen, E., Navarro, G.: Approximate matching of run-length compressed strings. Algorithmica 35(4), 347 -- 369 (2003) [27] Manber, U., Myers, G.: Suffix arrays: A new method for on-line string searches. SIAM J. Computing 22(5), 935 -- 948 (1993) [28] McCreight, E.M.: Priority search trees. SIAM J. Comput. 14(2), 257 -- 276 (1985) [29] Ohlebusch, E., Gog, S.: Lempel-Ziv factorization revisited. In: Proc. CPM 2011. pp. 15 -- 26 (2011) [30] Okanohara, D., Sadakane, K.: An online algorithm for finding the longest previous factors. In: Proc. ESA 2008. pp. 696 -- 707 (2008) [31] Starikovskaya, T.: Computing Lempel-Ziv factorization online. In: Proc. MFCS 2012. pp. 789 -- 799 (2012) [32] Storer, J., Szymanski, T.: Data compression via textual substitution. Journal of the ACM 29(4), 928 -- 951 (1982) [33] Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14(3), 249 -- 260 (1995) [34] Weiner, P.: Linear pattern-matching algorithms. In: Proc. of 14th IEEE Ann. Symp. on Switching and Automata Theory. pp. 1 -- 11 (1973) [35] Ziv, J., Lempel, A.: A universal algorithm for sequential data compression. IEEE Transactions on Information Theory IT-23(3), 337 -- 343 (1977) [36] Ziv, J., Lempel, A.: Compression of individual sequences via variable-length coding. IEEE Transac- tions on Information Theory 24(5), 530 -- 536 (1978) 11 Appendix This appendix provides complete proofs that were omitted due to lack of space. Lemma 5. Given RLE S of any string S where n = size(RLE S), RLE DAWG S has O(n) nodes and edges, and can be constructed in O(n log n) time and O(n) extra space in an on-line manner, together with the suffix link set F . Proof. The proof is a simple adaptation of the results from [6]. The DAWG of a string of length m has O(m) nodes and edges. Since RLE DAWG S is the DAWG of RLE S of length n, RLE DAWG S clearly has O(n) nodes and edges. If σ is the number of distinct characters appearing in S, then the DAWG of a string of length m can be constructed in O(m log σ) time and O(m) space, in an on-line manner, using suffix links. Since ΣRLE S ≤ n, RLE DAWG S with F can be constructed in O(n log n) time and extra O(n) space, on-line. Lemma 7. Given RLE S of any string S ∈ Σ∗, RLE DAWG S = (V, E), augmented so that max{p mpee(a) ≥ q, e = ([u], bp, [w]) ∈ E[u]} can be computed in O(log n) time for any e ∈ E, character a ∈ Σ, and integer q ≥ 0, can be constructed in an on-line manner in a total of O(n log n) time with O(n) space. Proof. During the on-line construction of the augmented RLE DAWG of Lemma 6, we further construct a family of PSTs at each node. Let Tu,a,b denote the PST at node u ∈ V that contains the set of pairs Uu,a,b = {(q′, mpee(a)) e = ([u], bq′, [w]) ∈ E[u], mpee(a) > 0}, where a, b ∈ Σ. By maintaining a two- level balanced binary search tree (a balanced binary search tree inside each node of the first balanced binary search tree) at each node, Tu,a,b can be accessed for any a, b ∈ Σ in O(log σS) time. Note that empty PSTs will not be inserted, and hence the total space will be proportional to the number of elements contained in all PSTs. Furthermore, the number of elements in a single PST is bounded by O(n), so max{p mpee(a) ≥ q, e = ([u], bp, [w]) ∈ E[u]} can be computed as MaxXInRectangle(1, S, q) on Tu,a,b, in O(log n) time by Theorem 1. We now bound the total number of elements in all of the PSTs. Recall that mpee(a) = max({p ap←−u bq ∈ RLE Substr(S)} ∪ {0}). When a suffix link pointing to a node [u] is created, and when an out-going edge of [u] is created, we must update the PSTs associated with [u]. An edge ([u], bp, [v]) is called primary if size(←−u )+1 = size(←−v ), and is called secondary otherwise. First, we consider the updates of the PSTs due to the suffix links. Suffix links are created in the following situations (Also refer to [6] for the on-line construction algorithm of DAWGs): 1. The suffix link of the sink node is created. 2. After a node childState is split, then a suffix link from childState to newChildState is created, where newChildState is the new node created by the node split. Case 1: Let [v] be the node that is pointed by the suffix link of the sink node. Let e = ([u], bp, [v]) be the primary edge to [v], and aq be the RL factor which corresponds to the suffix link. If q > mpee(a), then delete the pair (p, mpee(a)) from the corresponding PST stored in [u], and insert a new pair (p, q) into the PST. Case 2: There will be no updates in the PSTs. We will discuss the details in Case 3 of edge creation. Next, we consider the updates of the PSTs due to the edges. Edges are created in the following situations: 1. A primary edge from the old sink currentSink to the new sink newSink is created. 2. A secondary edge to newSink is created. 3. After a node childState is split, then the secondary edge to childState from one of its parents parentState becomes the primary edge from parentState to newChildState. 4. After a node childState is split, then all the outgoing edges of childState are copied as the outgoing edges of newChildState. 5. After a node childState is split, some secondary edges to childState are redirected and become secondary edges to newChildState. 12 Fig. 2. Illustration for node split of the RLE DAWG construction algorithm. Node childState (depicted as #2) is split into nodes childState and newChildState (depicted as #3). Note that all the outgoing edges of newChildState are secondary edges. Case 1: Although a new primary edge is created, no pairs are inserted into nor deleted from the PST since there are no suffix links to newSink. Case 2: Let [u] be the node from which a secondary edge to newSink is created. We then insert a pair corresponding to the secondary edge into the PST of [u]. Case 3: In this case, the secondary edge becomes a primary edge. So seemingly we might need to delete the pair corresponding to the existing secondary edge and insert a new pair corresponding to the incoming suffix link. However, both pairs are actually identical, and hence we need no updates in the PSTs. Case 4: Since the copied edges are all secondary edges (see Fig. 2), similar updates to Case 2 are conducted for all the copied edges. Case 5: Let e and e′ be secondary edges before and after redirection, respectively. By the property of the equivalence class, we have that mpee(a) = mpee′(a) for any character a ∈ Σ. Hence we need no explicit updates of the PSTs. By the above discussion, the number of update operations can be bounded by the number of added edges and suffix links. Since the total number of edges and suffix links is O(n), the total number of pairs in all of the PSTs P[u]∈V,a,b∈Σ Uu,a,b is also O(n). The total time complexity for the updates is O(n log n). 13
1309.6129
1
1309
2013-09-24T12:32:34
Partition-Merge: Distributed Inference and Modularity Optimization
[ "cs.DS", "cs.AI", "cs.SI" ]
This paper presents a novel meta algorithm, Partition-Merge (PM), which takes existing centralized algorithms for graph computation and makes them distributed and faster. In a nutshell, PM divides the graph into small subgraphs using our novel randomized partitioning scheme, runs the centralized algorithm on each partition separately, and then stitches the resulting solutions to produce a global solution. We demonstrate the efficiency of the PM algorithm on two popular problems: computation of Maximum A Posteriori (MAP) assignment in an arbitrary pairwise Markov Random Field (MRF), and modularity optimization for community detection. We show that the resulting distributed algorithms for these problems essentially run in time linear in the number of nodes in the graph, and perform as well -- or even better -- than the original centralized algorithm as long as the graph has geometric structures. Here we say a graph has geometric structures, or polynomial growth property, when the number of nodes within distance r of any given node grows no faster than a polynomial function of r. More precisely, if the centralized algorithm is a C-factor approximation with constant C \ge 1, the resulting distributed algorithm is a (C+\delta)-factor approximation for any small \delta>0; but if the centralized algorithm is a non-constant (e.g. logarithmic) factor approximation, then the resulting distributed algorithm becomes a constant factor approximation. For general graphs, we compute explicit bounds on the loss of performance of the resulting distributed algorithm with respect to the centralized algorithm.
cs.DS
cs
PARTITION MERGE Partition-Merge: Distributed Inference and Modularity Optimization Vincent Blondel Universite Catholique de Louvain, Belgium Kyomin Jung Seoul National University, South Korea Pushmeet Kohli Microsoft Research, Cambridge, UK Devavrat Shah MIT, Cambridge, USA Editor: Editor [email protected] [email protected] [email protected] [email protected] Abstract This paper presents a novel meta algorithm, Partition-Merge (PM), which takes existing central- ized algorithms for graph computation and makes them distributed and faster. In a nutshell, PM divides the graph into small subgraphs using our novel randomized partitioning scheme, runs the centralized algorithm on each partition separately, and then stitches the resulting solutions to pro- duce a global solution. We demonstrate the efficiency of the PM algorithm on two popular prob- lems: computation of Maximum A Posteriori (MAP) assignment in an arbitrary pairwise Markov Random Field (MRF), and modularity optimization for community detection. We show that the resulting distributed algorithms for these problems essentially run in time linear in the number of nodes in the graph, and perform as well -- or even better -- than the original centralized algorithm as long as the graph has geometric structures1. More precisely, if the centralized algorithm is a C−factor approximation with constant C ≥ 1, the resulting distributed algorithm is a (C + δ)-factor approximation for any small δ > 0; but if the centralized algorithm is a non-constant (e.g. loga- rithmic) factor approximation, then the resulting distributed algorithm becomes a constant factor approximation. For general graphs, we compute explicit bounds on the loss of performance of the resulting distributed algorithm with respect to the centralized algorithm. Keywords: Graphical model, Approximate MAP, Modularity Optimization, Partition 1. Introduction Graphical representation for data has become central to modern large-scale data processing applica- tions. For many of these applications, large-scale data computation boils down to solving problems defined over massive graphs. While the theory of centralized algorithms for graph problems is get- ting reasonably well developed, their distributed (as well as parallel) counterparts are still poorly understood and remain very active areas of current investigation. Moreover, the emerging cloud- computation architecture is making the need of distributed solutions even more pressing. Summary of results. In this paper, we take an important step towards this challenge. Specifically, we present a meta algorithm, Partition-Merge (PM), that makes existing centralized (exact or ap- 1. Roughly speaking, a graph has geometric structures, or polynomial growth property, when the number of nodes within distance r of any given node grows no faster than a polynomial function of r. 1 BLONDEL, JUNG, KOHLI AND SHAH proximate) algorithms for graph computation distributed and faster without loss of performance, and in some cases, even improving performance. The PM meta algorithm is based on our novel partitioning of the graph into small disjoint subgraphs. In a nutshell, PM partitions the graph into small subgraphs, runs the centralized algorithm on each partition separately (which can be done in distributed or parallel manner); and finally stitches the resulting solutions to produce a global solu- tion. We apply the PM algorithm to two representative class of problems: the MAP computation in a pairwise MRF and modularity optimization based graph clustering. The paper establishes that for any graph that satisfies the polynomial growth property, the re- sulting distributed PM based implementation of the original centralized algorithm is a (C + δ)- approximation algorithm whenever the centralized algorithm is a C-approximation algorithm for some constant C ≥ 1. In this expression, δ is a small number that depends on a tuneable parameter of the algorithm that affects the size of the induced subgraphs in the partition; the larger the sub- graph size, the smaller the δ. More generally, if the centralized algorithm is an α(n)-approximation (with α(n) = o(n)) for a graph of size n, the resulting distributed algorithm becomes a constant factor approximation for graphs with geometric structure! The computational complexity of the algorithm scales linearly in n. Thus, our meta algorithm can make centralized algorithms, faster, distributed and improve its performance. The algorithm applies to any graph structure, but strong guarantees on performance, as stated above, require geometric structure. However, it is indeed possible to explicitly evaluate the loss of performance induced by the distributed implementation compared to the centralized algorithm as stated in Section 4.2. A cautionary remark is in order. Indeed, by no means, this algorithm means to answer all problems in distributed computation. Specifically, for dense graph, this algorithm is likely to exhibit poor performances and definitely such graph structure would require a very different approach. Our meta algorithm requires that the underlying graph problem is decomposable or Markovian in a sense. Not all problems have this structure and these problem therefore require different way to think about them. Related Work and Our contributions The results of this paper, on one hand, are related to a long list of works on designing distributed algorithms for decomposable problems. On the other hand, the applications of our method to MAP inference in pairwise MRFs and clustering relate our work to a large number of results in these two respective problems. We will only be able to discuss very closely related work here. We start with the most closely related work on the use of graph partitioning for distributed algorithm design. Such an approach is quite old; see, e.g., Awerbuch et al. (1989); Klein et al. (1993) and Peleg (2000) for a detailed account of the approach until 2000. More recently, such decompositions have found wide variety of applications including local-property testing Hassidim et al. (2009). All such decompositions are useful for homogeneous problems, e.g. for finding maximum-size matching or independent set rather than the heterogenous maximum-weight variants of it. To overcome this limitation, a different (somewhat stronger) notion of decomposition was introduced by Jung and Shah Jung and Shah (2007) for minor-excluded graphs that built upon Klein et al. (1993). All of these results effectively partition the graph into small subgraphs and then solve the problem inside each small subgraph using exact (dynamic programming) algorithms. While this results in a (1 + )-approximation algorithm for any  > 0 with computation scaling 2 PARTITION MERGE essentially linearly in the graph size (n), the computation constant depends super-exponentially in 1/. Therefore, even with  = 0.1, the algorithms become unmanageable in practice. As the main contribution of this paper, we first propose a novel graph decomposition scheme for graphs with geometry or polynomial growth structure. Then we establish that by utilizing this decomposition scheme along with any centralized algorithm (instead of dynamic programming) for solving the problem inside the partition leads to performance comparable (or better) to that of the centralized algorithm for graph with polynomial growth. Then the resulting distributed algorithm becomes very fast in practice, unlike the dynamic programming approach, if the centralized algo- rithm inside the partition runs fast. Similar guarantees can be obtained for minor-excluded graphs as well using the scheme utilized in Jung and Shah (2007). As mentioned earlier, the result is established for both MAP in pair-wise MRF and modularity optimization based clustering. MAP Inference. Computing the exact Maximum a Posteriori (MAP) solution in a general prob- abilistic model is an NP-hard problem. A number of algorithmic approaches have been developed to obtain approximate solutions for these problems. Most of these methods work by making 'local updates' to the assignment of the variables. Starting from an initial solution, the algorithms search the space of all possible local changes that can be made to the current solution (also called move space), and choose the best amongst them. One such algorithm (which has been rediscovered multiple times) is called Iterated Conditional Modes or ICM for short. Its local update involves selecting (randomly or deterministically) a vari- able of the problem. Keeping the values of all other variables fixed, the value of the selected vari- able is chosen which results in a solution with the maximum probability. This process is repeated by selecting other variables until the probability cannot be increased further. The local step of the algorithm can be seen as performing inference in the smallest decomposed subgraph possible. Another family of methods are related to max-product belief propagation (cf. Pearl (1988) and Yedidia et al. (2000)). In recent years a sequence of results suggest that there is an intimate relation between the max-product algorithm and a natural linear programming relaxation -- for example, see Wainwright et al. (2005); Bayati et al. (2005, 2008); Huang and Jebara (2007); Sanghavi et al. (2007). Many of these methods can be seen as making local updates to partitions of the dual problem Sontag and Jaakkola (2009); Tarlow et al. (2011). We also note that Swendsen-Wang algorithm (SW)Swendsen and Wang (1987), a local flipping algorithm, has a philosophy similar to ours in that it repeats a process of randomly partitioning the graph, and computing an assignment. However, the graph partitioning of SW is fundamentally different from ours and there is no known guarantee for the error bound of SW. In summary, all the approaches thus far with provable guarantees for local update based algo- rithm are primarily for linear or more generally convex optimization setup. Modularity Optimization for Clustering. The notion of modularity optimization was introduced by Newmann Newman (2006) to identify the communities or clusters in a network structure. Since then, it has become quite popular as a metric to find communities or clusters in variety of networked data cf. Blondel et al. (2008, 2010). The major challenge has been design of approximation al- gorithm for modularity optimization (which is computationally hard in general) that can operate in distributed manner and provide performance guarantees. Such algorithms with provable perfor- mance guarantees are known only for few cases, notably logarithmic approximation of DasGupta and Desai (2011) via a centralized solution. 3 BLONDEL, JUNG, KOHLI AND SHAH Our contribution in the context of modularity optimization lies in showing that indeed it is a de- composable problem and therefore admits an distributed and fast approximation algorithm through our approach. Organization. The rest of the paper is organized as follows. Section 2 describes problem state- ment and preliminaries. Section 3 describes our main algorithms, and Section 4 presents analyses of our algorithms. Section 6 and Section 6 provides the proofs of our main theorems, and Section 7 presents the conclusion. 2. Setup Graphs. Our interest is in processing networked data represented through an undirected graph G = (V, E) with n = V vertices and E being the edge set. Let m = E be the number of edges. Graphs can be classified structurally in many different ways: trees, planar, minor-excluded, geometric, expanding, and so on. We shall establish results for graphs with geometric structure or polynomial growth which we define next. A graph G = (V, E) induces a natural 'graph metric' on vertices V , denoted by dG : V × V → R+ with dG(i, j) given by the length of the shortest path between i and j; defined as ∞ if there is no path between them. Definition 1 (Graph with Polynomial Growth). We say that a graph G (or a collection of graphs) has polynomial growth of degree (or growth rate) ρ, if for any i ∈ V and r ∈ N, BG(i, r) ≤ C · rρ, where C > 0 is a universal constant and BG(i, r) = {j ∈ V dG(i, j) < r}. Note that interesting values of C, ρ are integral between {0, 1, . . . , n}, and it is easy to verify in O(mn) time. Therefore we will assume knowledge of C, ρ for algorithm design. A large class of graph model naturally fall into the graphs with polynomial growth. To begin with, the standard d-dimensional regular grid graphs have polynomial growth rate d. More generally, in recent years in the context of computational geometry and metric embedding, the graphs with finite doubling dimensions have become popular object of study Gupta et al. (2003). It can be checked that a graph with doubling dimension ρ is also a graph with polynomial growth rate ρ. Finally, the popular geometric graph model where nodes are placed arbitrarily in some Euclidean space with some min- imum distance separation, and two nodes have an edge between them if they are within certain finite distance, has finite polynomial growth rate Gummadi et al. (2009). Pair-wise graphical model and MAP. For a pair-wise Markov Random Filed (MRF) model defined on a graph G = (V, E), each vertex i ∈ V is associated with a random variable Xi which we shall assume to be taking value from a finite alphabet Σ; the edge (i, j) ∈ E represents a form of 'dependence' between Xi and Xj. More precisely, the joint distribution is given by P(cid:0)X = x(cid:1) ∝(cid:89) φi(xi) · (cid:89) i∈V (i,j)∈E ψij(xi, xj) (1) where φi : Σ → R+ and ψij : Σ2 → R+ are called node and edge potential functions2. The question of interest is to find the maximum a posteriori (MAP) assignment x∗ ∈ Σn, i.e. x∗ ∈ arg max x∈Σn P[X = x]. 2. For simplicity of the analysis we assume strict positivity of φi's and ψij's. 4 PARTITION MERGE Equivalently, from the optimization point of view, we wish to find an optimal assignment of the problem maximize H(x) over x ∈ Σn, where H(x) = ln ψij(xi, xj). ln φi(xi) + (cid:88) (i,j)∈E (cid:88) i∈V For completeness and simplicity of exposition, we assume that the function H is finite valued over Σn. However, results of this paper extend for hard constrained problems such as the hardcore or independent set model. We call an algorithm α approximation for α ≥ 1 if it always produces assignment(cid:98)x such that H(x∗) ≤ H((cid:98)x) ≤ H(x∗). 1 α Social data and clustering/community. Alternatively, in a social setting, vertices of graph G can represents individuals and edges represent some form of interaction between them. For example, consider a cultural show organized by students at a university with various acts. Let there be n students in total who have participated in one or more acts. Place an edge between two students if they participated in at least one act together. Then the resulting graph represents interaction between students in terms of acting together. Based on this observed network, the goal is to identify the set of all acts performed and its 'core' participants. The true answer, which classifies each student/node into the acts in which s/he performed would lead to partitions of nodes in which a node may belong to multiple partitions. Our interest is in identifying disjoint partitions which would, in this example, roughly mean identifica- tion of 'core' members of acts. In general, to select a disjoint partition of V given G, it is not clear what is the appropriate criteria. Newman Newman (2006) proposed the notion of modularity as a criteria. The intuition behind it is that a cluster or community should be as distinct as possible from being 'random'. Modularity of a partition of nodes is defined as the fraction of the edges that fall within the disjoint partitions minus the expected such fraction if edges were distributed at random with the same node degree sequences. Formally, the modularity of a subset S ⊂ V is defined as M (S) = , (2) (cid:88) (cid:16) i,j∈S (cid:17) Aij − didj 2m where Aij = 1 iff (i, j) ∈ E and 0 otherwise, di = {k ∈ V : (i, k) ∈ E} is the degree of node i ∈ V , and m = E represents the total number of edges in G. More generally, the modularity of a partition of V , V = S1 ∪ ··· ∪ S(cid:96) for some 1 ≤ (cid:96) ≤ n with Si ∩ Sj = ∅ for i (cid:54)= j, is given by M(S1, . . . , S(cid:96)) = 1 2m M (Si) . (3) (cid:17) (cid:16) (cid:96)(cid:88) i=1 The modularity optimization approach Newman (2006) proposes to identify the community struc- ture as the disjoint partitions of V that maximizes the total modularity, defined as per (3), among all possible disjoint partitions of V with ties broken arbitrarily. The resulting clustering of nodes is the desired answer. We shall think of clustering as assigning colors to nodes. Specifically, given a coloring χ : V → {1, . . . , n}, two nodes i and j are part of the same cluster (partition) iff χ(i) = χ(j). With 5 BLONDEL, JUNG, KOHLI AND SHAH this notation, any clustering of V can be represented by some such coloring χ and vice versa. Therefore, modularity optimization is equivalent to finding a coloring χ such that its modularity M(χ) is maximized, where (cid:88) i,j∈V M(χ) = 1 2m 1{χ(i)=χ(j)} Aij − didj 2m (cid:16) (cid:17) . Here 1{·} is the indicator function with 1{true} = 1 and 1{false} = 0. Let χ∗ be a clustering that (cid:98)χ such that maximizes the modularity. Then, as before, an algorithm will be said α-approximate if it produces M(χ∗) ≤ M((cid:98)χ) ≤ M(χ∗). (4) 1 α 3. Partition-Merge Algorithm We describe a parametric meta-algorithm for solving the MAP inference and modularity optimiza- tion. The meta-algorithm uses two parameters; a large constant K ≥ 1 and a small real number ε ∈ (0, 1) to produce a partition of V = V1 ∪ ··· ∪ Vp so that each partition Vj, 1 ≤ j ≤ p is small. We will specify the values of K and ε in Section 4. The meta-algorithm uses an existing centralized algorithm to solve the original problem on each of these partitioned sub-graphs Gj = (Vj, Ej) in- dependently where Ej = (Vj × Vj)∩ E. The result assignment leads to a candidate solution for the problem on entire graph. As we establish in Section 4, this becomes a pretty good solution. Next, we describe the algorithm in detail. Step 1. Partition. We wish to create a partition of V = V1∪···∪Vp for some p with Vi∩Vj = ∅ for i (cid:54)= j so that the number of edges crossing partitions are small. The algorithm for such partitioning is iterative. Initially, no node is part of any partition. Order the n nodes arbitrarily, say i1, . . . , in. In iteration k ≤ n, choose node ik as the pivot. If ik belongs to ∪k−1 (cid:96)=1 V(cid:96), then set Vk = ∅, and move to the next iteration if k < n or else the algorithm concludes. If ik /∈ ∪k−1 (cid:96)=1 V(cid:96), choose a radius Rk ≤ K at random with distribution P(cid:16) (cid:40) (cid:17) Rk = (cid:96) = ε(1 − ε)(cid:96)−1 (1 − ε)K−1, for 1 ≤ (cid:96) < K for (cid:96) = K. (5) Let Vk be set of all nodes in V that are within distance Rk of ik, but that are not part of V1∪···∪Vk−1. Since we execute this step only if ik /∈ ∪k−1 (cid:96)=1 V(cid:96) and Rk ≥ 1, Vk will be non-empty. At the end of the n iterations, we have a partition of V with at most n non-empty partitions. Let the non-empty partitions of V be denoted as V = V1 ∪ ··· ∪ Vp for some p ≤ n. A caricature of an iteration is described in Figure 1. Step 2. Merge (solving the problem). Given the partition V = V1 ∪ ··· ∪ Vp, consider the graphs Gk = (Vk, Ek) with Ek = (Vk × Vk) ∩ E for 1 ≤ k ≤ p. We shall apply a centralized algorithm for each of these graph G1, . . . , Gk separately. Specifically, let A be an algorithm for MAP or for clustering: the algorithm may be exact (e.g. one solving problem by exhaustive search over all possible options, or dynamic programming) or it may be an approximation algorithm (e.g. α-approximate for any graph). We apply A for each subgraph separately. 6 PARTITION MERGE Figure 1: A pictorial description of an iteration of the graph partitioning. ◦ For MAP inference, this results in an assignment to all variables since in each partition each node is assigned some value and collectively all nodes are covered by the partition. Declare thus resulting global assignment, say(cid:98)x as the solution for MAP. ◦ For modularity optimization, nodes in each partition Vj are clustered. We declare the union of all such clusters across partitions as the global clustering. Thus two nodes in different partitions are always in different clusters; two nodes in the same partition are in different clusters if the centralized algorithm applied to that partition clusters them differently. Computation cost. The computation cost of the partitioning scheme scales linearly in the number of edges in the graph. The computation cost of solving the problem in each of the components G1, . . . , Gp depends on component sizes and on how the computation cost of algorithm A scales with the size. In particular, if the maximum degree of any node in G is bounded, say by d, then each partition has at most dK nodes. Then the overall cost is O(Q(dK)n) where Q((cid:96)) is the computation cost of A for any graph with (cid:96) vertices. 4. Main results 4.1 Graphs with polynomial growth We state sharp results for graphs with polynomial growth. We state results for MAP inference and for modularity optimization under the same theorem statement to avoid repetition. The proofs, however, will have some differences. Theorem 1. Let the graph G = (V, E) have polynomial growth with degree ρ ≥ 1 and constant C ≥ 1. Then, for a given δ ∈ (0, 1), select parameters K = K(ρ, C, δ) = ε = ε(ρ, C, δ) = + 4 ε log C + 4 ε log 1 ε + 2, for MAP for modularity optimization. (6) (cid:16) 8ρ (cid:17) ε 8ρ ε (cid:40) δ log 2C2ρ , δ 4(2C−1) , Then, the following holds for the meta algorithm described in Section 3. 7 (a) If A solves the problem (MAP or modularity optimization) exactly, then the solution produced by the algorithm(cid:98)x and(cid:98)χ for MAP and modularity optimization respectively are such that BLONDEL, JUNG, KOHLI AND SHAH (1 − δ)H(x∗) ≤ E[H((cid:98)x)] ≤ H(x∗) (1 − δ)M(χ∗) ≤ E[M((cid:98)χ)] ≤ M(χ∗). (cid:18) 1 (cid:19) H(x∗) ≤ E[H((cid:98)x)] ≤ H(x∗), M(χ∗) ≤ E[M((cid:98)χ)] ≤ M(χ∗), − δ (1 − δ) α( K) α( K) (7) (8) (b) If A is α(n) ≥ 1 approximation algorithm for graphs with n nodes, then where K = CKρ. 4.2 General graph The theorem in the previous section was for graphs with polynomial growth. We now state results for general graph. Our result tells us how to evaluate the 'error bound' on solutions produced by the algorithm for any instantiation of randomness. The result is stated below for both MAP and modularity optimization. The 'error function' depends on the problem. Theorem 2. Given an arbitrary graph G = (V, E) and our algorithm operating on it with param- eters K ≥ 1, ε ∈ (0, 1) using a known procedure A, the following holds: (a) If A solves the problem (MAP or modularity optimization) exactly, then the solution produced by the algorithm(cid:98)x and (cid:98)χ for MAP and modularity optimization respectively are such that (with B = E\ ∪p k=1 Ek), (cid:0)ψU (i,j)∈B H((cid:98)x) ≥ H(x∗) − (cid:88) M((cid:98)χ) ≥ M(χ∗) − B (cid:16)H(x∗) − (cid:88) (cid:17) (cid:16)M(χ∗) − B (i,j)∈B α( K) 2m . H((cid:98)x) ≥ 1 , 2m M( χ) ≥ 1 α( K) (cid:1), ij − ψL ij (cid:0)ψU ij − ψL ij (cid:1)(cid:17) (9) (10) (b) If A is instead a α(n)-approximation for graphs of size n, then where K is the maximum number of nodes that are within K hops of any single node in V . In the expression above, ψU ij (cid:44) maxσ,σ(cid:48)∈Σ ln ψij(σ, σ(cid:48)), and ψL ij (cid:44) minσ,σ(cid:48)∈Σ ln ψij(σ, σ(cid:48)). 8 PARTITION MERGE 4.3 Discussion of results Here we dissect implications of the above stated theorems. To start with, Theorem 1(a) suggests that when graphs have polynomial growth, there exists a Randomized Polynomial Time Approxi- mation Scheme (PTAS) for MAP computation and modularity optimization that has computation time scaling linearly with n. The dependence on ρ and δ is rather stringent and therefore, even for moderately small δ, it may not be possible to utilize existing computers to implement brute-force/dynamic programming procedure. The Theorem 1(b) suggests that, if instead of using exact procedure for each partition, when an approximation algorithm is used, the resulting solution almost retains its approximation guarantees: if α(n) is a constant, then the resulting approximation guarantee is essentially the same constant; if α(n) increases with n (e.g. log n), then the resulting algorithm provides a constant factor approximation ! In either case, even if the approximation algorithm has superlinear computation time in the number of nodes (e.g. semi-definite programming), then our algorithm provides a way to achieve similar performance but in linear time for polynomially growing graphs. The algorithm, for general graph, produces a solution for which we have approximation guar- antees. Specifically, the error scales with the fraction of edges across partitions that are induced by our partitioning procedure. This error depends on parameters K, ε utilized by our partitioning pro- cedure. For graph with polynomial growth, we provide recommendations on what the values should be for these parameters. However, for general graph we do not have precise recommendations. Instead, one may try various values of K ∈ {1, . . . , n} and ε ∈ (0, 1) and then choose the best solution. Indeed, a reasonable way to implement such procedure would be to take values of K that are 2k for k ∈ {0, . . . , log n} and ε chosen at regular interval with granularity that an implementor is comfortable with (the smaller the granularity, the better). 5. Proofs of Theorems 1, 2: MAP inference In this Section, we first prove Theorem 1, and Theorem 2 for MAP inference. k=1 Ek. We first state the following Lemma which shows the essential property Bound on E\ ∪p of the partition scheme. Lemma 1 will be used in the proofs of Theorems 1, 2 both for MAP and modularity optimization. The proof of Lemma 1 is stated at the end of this Section. Lemma 1. Given G = (V, E) with polynomial growth of rate ρ ≥ 1 and associated constant C ≥ 1, by choosing K = K(ρ, C, δ) and ε = ε(ρ, C, δ) = 4(2C−1), the partition scheme satisfies that for any edge e ∈ E, δ P(e ∈ B) ≤ 2ε. (11) Lower bound on H(x∗). Here we provide a lower bound on H∗ = H(x∗) that will be useful to obtain multiplicative approximation property. Lemma 2. Let H∗ = maxx∈Σn H(x) denote the maximum value of H for a given pair-wise MRF on a graph G. If G has maximum vertex degree d∗, then (12) (d∗ + 1)H(x∗) ≥ (cid:88) (cid:0)ψU ij − ψL ij (cid:1) . (i,j)∈E 9 BLONDEL, JUNG, KOHLI AND SHAH ij to an edge (i, j) ∈ E. Since graph G has maximum vertex degree Proof. Assign weight wij = ψU d∗, by Vizing's theorem there exists an edge-coloring of the graph using at most d∗ +1 colors. Edges with the same color form a matching of the G. A standard application of Pigeon-hole's principle (i,j)∈E wij). Let M ⊂ E denote these set implies that there is a color with weight at least of edges. Then 1 d∗+1 ((cid:80)  (cid:88)  . ij ≥ 1 ψU d∗ + 1 ψU ij (i,j)∈E (cid:88) (i,j)∈M Now, consider an assignment xM as follows: for each (i, j) ∈ M set (xM for remaining i ∈ V , set xM possible, we have used matching property of M. Therefore, we have i i to some value in Σ arbitrarily. Note that for above assignment to be , xM j ) = arg max(x,x(cid:48))∈Σ2 ψij(x, x(cid:48)); H(xM ) = φi(xM i ) + ψij(xM i , xM j ) φi(xM i ) + ψij(xM i , xM j ) + (cid:88) (i,j)∈M ψij(xM i , xM j ) (cid:88) (cid:88) (i,j)∈E (i,j)∈E\M i∈V (cid:88) (cid:88) (a)≥ (cid:88) (cid:88) i∈V = = (i,j)∈M (i,j)∈M 1 d∗ + 1 ≥ ψij(xM i , xM j ) ψU ij  (cid:88) (i,j)∈E  . ψU ij (13) Here (a) follows because ψij, φi are non-negative valued functions. Since H(x∗) ≥ H(xM ) and ij ≥ 0 for all (i, j) ∈ E, we prove Lemma 2. ψL combining the assignments, the resulting(cid:98)x has H(·) value as good as that of MAP with penalty in Decomposition of H∗. Here we show that by maximizing H(·) on a partition of V separately and Lemma 3. For a given MRF defined on G, the algorithm the partition scheme produces output(cid:98)x terms of the edges across partitions. such that H((cid:98)x) ≥ H(x∗) −  (cid:88) (i,j)∈B (cid:0)ψU ij − ψL ij (cid:1) , k=1 Ek, ψU ij (cid:44) maxσ,σ(cid:48)∈Σ ln ψij(σ, σ(cid:48)), and ψL where B = E\ ∪K Proof. Let x∗ be a MAP assignment of the MRF X defined on G. Given an assignment x ∈ ΣV defined on a graph G = (V, E) and a subgraph S = (W, E(cid:48)) of G, let an assignment x(cid:48) ∈ ΣW be called a restriction of x to S if x(cid:48)(v) = x(v) for all v ∈ W . Let S1, . . . , SK be the connected components of G(cid:48) = (V, E − B), and let x∗ k be the restriction of x∗ to the component Sk. Let Xk be the restriction of the MRF X to Gk = (Sk, Ek), where Ek = {(u, w) ∈ Eu, w ∈ Sk}. (cid:44) minσ,σ(cid:48)∈Σ ln ψij(σ, σ(cid:48)). ij 10 PARTITION MERGE For xk ∈ ΣSk, define (cid:88) (cid:88) Hk(xk) = φi(xi) + ψij(xi, xj). Let(cid:98)x be the output of the partition scheme, and let(cid:98)xk be the restriction of(cid:98)x to the component Sk. Note that since(cid:98)xk is a MAP assignment of Hk(·) by the definition of our algorithm, for all (i,j)∈Ek i∈Sk k = 1, 2, . . . K, Now, we have H((cid:98)x) − H(x∗) = Hk((cid:98)xk) ≥ Hk(x∗ [Hk((cid:98)xk) − Hk(x∗ [Hk((cid:98)xk) − Hk(x∗ ij − ψL ij). (ψU k=1 K(cid:88) (a)≥ K(cid:88) (b)≥ − (cid:88) k=1 k). k)] + (cid:88) k)] − (cid:88) (i,j)∈B (i,j)∈B (i,j)∈B ψij((cid:98)xi,(cid:98)xj) − ψij(x∗ i , x∗ j ) ij − ψL ij) (ψU (14) (15) ij and ψL Here (a) follows from the definitions of ψU proof of Lemma 3. Completing Proof of Theorem 1(a). Recall that the maximum vertex degree d∗ of G is less than 2ρC by the definition of polynomially growing graph. Remind our definition ε = δ 2C2ρ for MAP inference. Now we have that ij, and (b) follows from (14). This completes the E[H((cid:98)x)] (a)≥ H(x∗) − E (b)≥ H(x∗) − 2ε  (cid:88)  (cid:88) (i,j)∈B (cid:0)ψU (cid:0)ψU (i,j)∈E ij − ψL ij ij − ψL ij (cid:1) (cid:1) (c)≥ H(x∗) (1 − 2ε(d∗ + 1)) (d)≥ (1 − δ)H(x∗). (16) (17) (18) (19) Here (a) follows from Lemma 3, (b) follows from Lemma 1, (c) from Lemma 2, and (d) follows from the definition of ε for MAP inference. This completes the proof of Theorem 1(a) for MAP inference. Completing Proof of Theorem 1(b). Suppose that we use an approximation procedure A to pro- duce an approximate MAP assignment(cid:98)xk on each partition Sk in our algorithm. Let A be such that the assignment produced satisfies that Hk((cid:98)xk) has value at least 1/α(n) times the maximum Hk(·) 11 BLONDEL, JUNG, KOHLI AND SHAH value for any graph of size n. Now since A is applied to each partition separately, the approximation is within α( K) where K = CKρ is the bound on the number of nodes in each partition. By the same proof of Lemma 3 together with (20), we have that H((cid:98)xk) ≥ 1 α( K) M(x∗ k). ij (cid:1) . (cid:1) (cid:1) ij − ψL (cid:0)ψU (cid:0)ψU (cid:0)ψU ij − ψL (cid:19) ij − ψL ij ij H(x∗) − E H(x∗) − E (i,j)∈B  (cid:88)  (cid:88)  (cid:88) (cid:18) 1 (cid:17)H(x∗). α( K) − δ (i,j)∈B H(x∗) − 2ε (i,j)∈E − 2ε(d∗ + 1) E[H((cid:98)x)] ≥ 1 α( K) Hence we have that E[H((cid:98)x)] ≥ (a)≥ 1 α( K) 1 α( K) (b)≥ H(x∗) (c)≥ (cid:16) 1 α( K) (20) (21) (22) (23) (24) (25) Here (a) follows from Lemma 1, (b) follows from Lemma 2, and (c) from the definition of ε for MAP inference. This completes the proof of Theorem 1(b) for MAP inference. Completing Proof of Theorem 2. The same arguments as in the proof Theorem 1 together with Lemma 3 completes the proof of Theorem 2 for MAP inference. Proof of Lemma 1. Now we prove Lemma 1. First, we consider property of the partition scheme ap- plied to a generic metric space G = (V, dG), where V is the set of points over which metric dG is defined. We state the result below for any metric space (rather than restricted to a graph) as it's necessary to carry out appropriate induction based proof. Note that the algorithm the partition scheme can be applied to any metric space (not just graph as well) as it only utilizes the property of metric in it's definition. The edge set E of metric space G is precisely the set of all vertices that are within distance 1 of each other. Proposition 1. Consider a metric space G = (V, dG) defined over n point set V , i.e. V = n. Let B = E\ ∪p k=1 Ek be the boundary set of the partition scheme applied to G. Then, for any e ∈ E, P[e ∈ B] ≤ ε + PK · B(e, K), where B(e, K) = BG(e, K) is the union of the two balls of radius K in G with respect to the dG centered around the two end vertices of e, and PK = (1 − ε)K−1. 12 PARTITION MERGE Proof. The proof is by induction on the number of points n. When n = 1, the algorithm chooses only point as u0 in the initial iteration and hence no edge can be part of the output set B. That is, for any edge, say e, P[e ∈ B] = 0 ≤ ε + PKB(e, K). Thus, we have verified the base case for induction (n = 1). As induction hypothesis, suppose that the Proposition 1 is true for any graph with n nodes with n < N for some N ≥ 2. As the induction step, we wish to establish Proposition 1 for any G = (V, dG) with V = N. For this, consider any v ∈ V . Now consider the last iteration of the the partition scheme applied to G. The algorithm picks i1 ∈ V uniformly at random in the first iteration. Given e, depending on the choice of i1 we consider three different cases (or events). We will show that in these three cases, P[e ∈ B] ≤ ε + PKB(e, K) holds. Case 1. Suppose i1 is such that dG(i1, e) < K, where the distance of a point and an edge of G is defined as a minimum distance from the point to one of the two end-points of the edge. Call this event E1. Further, depending on choice of random number R1, define the following events E11 = {dG(i1, e) < R1}, E12 = {dG(i1, e) = R1}, and E13 = {dG(i1, e) > R1}. By the definition of the partition scheme, when E11 happens, e can never be a part of B. When E12 happens, e is definitely a part of B. When E13 happens, it is said to be left as an element of the set W1. This new vertex set W1 has points less than N. The original metric dG is still considered as the metric on the points3 of W1. By its definition, the partition scheme excluding the first iteration is the same as the partition scheme applied to (W1, dG). Therefore, we can invoke induction hypothesis which implies that if event E13 happens then the probability of v ∈ B is bounded above by ε + PK · B(e, K), where B(e, K) is the ball with respect to (W1, dG) which has no more than the number of points in the ball B(e, K) defined with respect to the original metric space G. Finally, let us relate the P[E11E2] with P[E12E1]. Suppose dG(i1, e) = (cid:96) < K. By the definition of probability distribution of Q, we have P[E12E1] = ε(1 − ε)(cid:96)−1, P[E11E1] = (1 − ε)K−1 + = (1 − ε)(cid:96). K−1(cid:88) j=(cid:96)+1 ε(1 − ε)j−1 (26) (27) That is, P[E12E1] = ε 1 − ε P[E11E1]. 3. Note the following subtle but crucial point. We are not changing the metric dG after we remove points from the original set of points. 13 BLONDEL, JUNG, KOHLI AND SHAH Let q (cid:52) = P[E11E1]. Then, P[e ∈ BE1] = P[e ∈ BE11 ∩ E1]P[E11E1] + P[e ∈ BE12 ∩ E1]P[E12E1] (cid:18) (cid:19) + P[e ∈ BE13 ∩ E1]P[E13E1] + (ε + PKB(e, K)) 1 − q (ε − ε − PKB(e, K)) 1 − ε ≤ 0 × q + 1 × εq 1 − ε = ε + PKB(e, K) + = ε + PKB(e, K) − qPKB(e, K) ≤ ε + PKB(e, K). q 1 − ε 1 − ε (28) Case 2. Now, suppose i1 ∈ V is such that dG(i1, e) = K. We will call this event E2. Further, define the event E21 = {R1 = K}. Due to the independence of selection of R1, P[E21E2] = PK. Under the event E21 ∩ E2, e ∈ B with probability 1. Therefore, P[e ∈ BE2] = P[e ∈ BE21 ∩ E2]P[E21E2] + P[e ∈ BEc 21 ∩ E2]P[Ec 21E2] = 1 × PK + P[e ∈ BEc 21 ∩ E2](1 − PK). (29) 21 ∩ E2, we have e ∈ W1, and the remaining metric space (W1, dG). This metric Under the event Ec space has < N points. Further, the ball of radius K around e with respect to this new metric space has at most B(e, K)−1 points (this ball is with respect to the original metric space G on N points). Now we can invoke the induction hypothesis for this new metric space to obtain P[e ∈ BEc 21 ∩ E2] ≤ ε + PK · (B(e, K) − 1). (30) From (29) and (30), we have P[e ∈ BE3] ≤ PK + (1 − PK)(ε + PK · (B(e, K) − 1)) = ε(1 − PK) + PKB(e, K) + P 2 ≤ ε + PKB(e, K). K(1 − B(e, K)) In above, we have used the fact that B(e, K) ≥ 1 (or else, the bound was trivial to begin with). Case 3. Finally, let E3 be the event that dG(i1, e) > K. Then, at the end of the first iteration of the algorithm, we again have the remaining metric space (W1, dG) such that W1 < N. Hence, as before, by induction hypothesis we have P[e ∈ BE3] ≤ ε + PKB(e, K). Now, the three cases are exhaustive and disjoint. That is, ∪3 above discussion, we obtain the following. i=1Ei is the universe. Based on the 3(cid:88) (cid:18) 3 i=1 P[e ∈ B] = P[e ∈ BEi]P[Ei] (cid:19)(cid:32) 3(cid:88) (cid:33) P[Ei] max i=1 P[e ∈ BEi] ≤ ≤ ε + PK · B(e, K). i=1 (31) This completes the proof of Proposition 1. 14 PARTITION MERGE Now, we will use Proposition 1 to complete the proof of Lemma 1. The definition of growth rate implies that, From the definition PK = (1 − ε)K−1, we have B(e, K) ≤ C · Kρ. PK B(e, K) ≤ C(1 − ε)K−1Kρ. Therefore, to show Lemma 1, it is sufficient to show that our definition of K satisfies the following Lemma. Lemma 4. We have that C(1 − ε)K−1Kρ ≤ ε. Proof. We will show the following equivalent inequality. (K − 1) log(1 − ε)−1 ≥ ρ log K + log C + log First, note that for all ε ∈ (0, 1), 1 ε . Hence to prove (32), it is sufficient to show that log(1 − ε)−1 ≥ log(1 + ε) ≥ ε 2 . (32) (33) (34) 2 ε log 1 ε + 1. + 4 ε log C + 4 ε log 1 ε + 2. ε Recall that K ≥ 2ρ ε log K + K = K(ε, ρ) = 8ρ ε log log C + 2 ε (cid:18) 8ρ (cid:19) From the definition of K, we will show that K 2 ≥ 2ρ ε log K and K 2 ≥ 2 ε log C + log 2 ε 2 ε (cid:17) ε log log C + log ≥ 2 ε (cid:16) 8ρ which will prove (33). The following is straightforward: 1 ε Now, let (cid:98)K = 8ρ (cid:19) (cid:18) 8ρ (cid:98)K ε log (cid:98)K ≥ 0. Since the function φ(x) = x ε , and from the fact that K ≥ (cid:98)K ≥ 4ρ 2 − 2ρ That is, (cid:98)K when x ≥ 4ρ K 2 . Then (cid:18) 8ρ (cid:19) ≥ 2ρ ε (cid:18) log = log 4ρ ε 2 ε ε + log log ε 2 − 2ρ ε , we have 1 ε + 1, + 1. (cid:18) 8ρ (cid:19)(cid:19) ε log (cid:98)K. = 2ρ ε ε log x is an increasing function of x From (34) and (35), we have (33), which completes the proof of Lemma 4. K 2 ≥ 2ρ ε log K. (35) 15 BLONDEL, JUNG, KOHLI AND SHAH 6. Proofs of Theorems 1, 2: Modularity optimization In this Section, we prove Theorem 1, and Theorem 2 for modularity optimization. Lower bound on M∗. Here we provide a lower bound on M∗ that will be useful to obtain multi- plicative approximation property. Lemma 5. Let M∗ = maxχ M(χ) denote the maximum value of modularity for graph G. Then, (cid:16) (cid:17) . M∗ ≥ 1 2(2C − 1) 1 − C2 2m (cid:1) since (cid:0)1 − (cid:1). This completes the proof of Lemma 5 (Similar result, with tighter constant, follows from Han Proof. Since the graph has polynomial growth with degree ρ and associated constant C, it follows that the number of nodes within one hop of any node i ∈ V (i.e. its immediate neighbors) is at most C. That is, di ≤ C for all i ∈ V . Given this bound, it follows that there exists a matching of size at least m/(2C − 1) in G. Given such a matching, consider the following clustering (coloring). Each edge in the matching represent a community of size 2, while all the nodes that are unmatched lead to community of size 1. By definition, the individual (unmatched) nodes contribute 0 to the modularity. The nodes that are part of the two node communities, each contribute at least 1 vertex degree of each node is bounded above by C. Since there are m/(2C − 1) edges in the 2m matching, it follows that the net modularity of such community assignment is at least C2 2m (2008)). Decomposition of M∗. Here we show that by maximizing modularity on a partition of V separately, the resulting clustering has modularity as good as that of optimal partitioning with penalty in terms of the edges across partitions. To that end, let V = V1 ∪···∪ Vp be a partition of V , i.e. Vi ∩ Vj = ∅ for i (cid:54)= j. Let Gk = (Vk, Ek), where Ek = (Vk × Vk)∩ E, denote the subgraph of G for 1 ≤ k ≤ p. Let χk be a coloring (clustering) of Gk with maximum modularity. Let χ∗ be a coloring of G with maximum modularity (M∗) and let χ∗,k be the restriction of χ∗ to Gk. Let(cid:98)χ denote the clustering (cid:0)1 − C2 2(2C−1) 2m 1 of G obtained by taking union of clusterings χ1, . . . , χp. Then we claim the following. Lemma 6. For any partition V = V1 ∪ ··· ∪ Vp, Proof. Consider the following: i,j∈V (cid:88) 2m M((cid:98)χ) = (b)≥ p(cid:88) (cid:88) ≥ (cid:88) k=1 i,j∈V = i,j∈V M((cid:98)χ) ≥ M(χ∗) − 1 (cid:16) (cid:17) (a) p(cid:88) 2m Aij − didj 2m (cid:16) 1{χ∗,k(i)=χ∗,k(j)} Aij − didj 2m 1{(cid:98)χ(i)=(cid:98)χ(j)} (cid:88) i,j∈Vk (cid:16) (cid:16) 1{χ∗(i)=χ∗(j)} 1{χ∗(i)=χ∗(j)} Aij − didj 2m Aij − didj 2m = k=1 i,j∈Vk E\ ∪p k=1 Ek. (cid:88) (cid:17) (cid:17) − (cid:88) (cid:17) − E\ ∪p (i,j)∈V 2\∪p k=1 Ek, k=1V 2 k 16 (cid:16) Aij − didj 2m (cid:17) 1{χk(i)=χk(j)} 1{χ∗(i)=χ∗(j)} (cid:16) Aij − didj 2m (cid:17) (36) (37) PARTITION MERGE where the last inequality follows because the term inside the summation in (36) is positive only if Aij = 1, i.e. (i, j) ∈ E or else it is negative. Therefore, for the purpose of lower bound, we k=1 Ek. The (a) follows because (cid:98)χ, by definition, assigns nodes in V i and V j for i (cid:54)= j to k=1Vk × Vk. This is precisely equal to only need to worry about (i, j) ∈ E such that (i, j) /∈ ∪p E\ ∪p different clusters. The (b) follows because χk has maximum modularity in Gk and hence it is at least as large (in terms of modularity) as that of the χ∗,k, the restriction of χ∗ to Gk. This completes the proof of Lemma 6 since the first term in (37) is precisely 2mM(χ∗) = 2mM∗. Approximation factor for M((cid:98)χ). Let β = E\ ∪p k=1 Ek/m denote the fraction of edges that are across partitions for a given partition V = V1 ∪ ··· ∪ Vp. Then, from Lemmas 5 and 6, it follows that for m ≥ C2, (cid:16) M((cid:98)χ) ≥ M(χ∗) 1 − β 2M(χ∗) (cid:17) ≥ M(χ∗) (cid:16) Therefore, if 2(2C − 1)β ≤ δ, then M((cid:98)χ) is at least M∗ · (1 − δ). Now from Lemma 1 and the linearity of expectation, we have 1 − 2(2C − 1)β . (38) (cid:17) E(cid:2)E\ ∪p k=1 Ek(cid:3) ≤ δ 2(2C − 1) m. (39) Completing Proof of Theorem 1(a). When A produces exact solution to the modularity optimiza- tion for each partition, the resulting solution of our algorithm is(cid:98)χ. Therefore, from (38) and (39), it follows that E[M((cid:98)χ)] ≥ M(χ∗)(1 − δ). (40) (41) (42) Completing Proof of Theorem 1(b). Suppose we use an approximation procedure A to produce clustering on each partition in our algorithm. Let A be such that the clustering produced has modu- larity at least 1/α(n) times the optimal modularity for any graph of size n. Now since A is applied to each partition separately, the approximation is within α( K) where K = CKρ is the bound on the number of nodes in each partition. Let χ1, . . . , χp be the clustering (coloring) produced by A on graphs G1, . . . , Gp. Then by the approximation property of A, we have M( χk) ≥ 1 α( K) M(χk). p(cid:88) p(cid:88) Therefore, for the overall clustering χ obtained as union of χ1, . . . , χp, we have M( χ) = M( χk) ≥ 1 α( K) M(χk) = 1 α( K) Since E[M((cid:98)χ)] is at least (1 − δ)M∗, it follows that E[M( χ)] ≥ (1−δ) k=1 k=1 α( K) M∗. M((cid:98)χ). Completing Proof of Theorem 2. Lemma 6 directly proves Theorem 2(a), and the same arguments as in the proof Theorem 1(b) completes the proof of Theorem 2(b). 17 BLONDEL, JUNG, KOHLI AND SHAH 7. Conclusion In recent years, it has become increasingly important to design distributed high-performance graph computation algorithms that can deal with large-scale networked data in a cloud-like distributed computation architecture. Inspired by this, in this paper, we have introduced Partition-Merge, a simple meta-algorithm, that takes an existing centralized algorithm and produces a distributed im- plementation. The resulting distributed implementation, with the underlying graph having polyno- mial growth property, runs in essentially linear time and is as good as, and sometimes even better than the centralized algorithm. The algorithm is applicable to any graph in general, and its computation time as well as per- formance guarantees depend on the underlying graph structure -- interestingly enough, we have evaluated the performance guarantees for any graph. We strongly believe that such an algorith- mic approach would be of great value for developing large-scale cloud-based graph computation facilities. Acknowledgments Part of this work appeared in the preliminary version Jung et al. (2009). This work is supported in parts by Army Research Office under MURI Award 58153-MA-MUR, and in part by Basic Science Research Program through the National Research Foundation of Korea(NRF) funded by the Ministry of Education, Science and Technology(2012032786). References B. Awerbuch, M. Luby, A.V. Goldberg, and S.A. Plotkin. Network decomposition and locality in distributed computation. In Foundations of Computer Science (FOCS). IEEE, 1989. M. Bayati, D. Shah, and M. Sharma. Maximum weight matching via max-product belief propaga- tion. In IEEE ISIT, 2005. M. Bayati, D. Shah, and M. Sharma. Max-Product for Maximum Weight Matching: Convergence, Correctness, and LP Duality. IEEE Transactions on Information Theory, 54(3):1241 -- 1251, 2008. V. Blondel, G. Krings, and I. Thomas. Regions and borders of mobile telephony in belgium and in the brussels metropolitan zone. Brussels Studies, 42(4), 2010. V.D. Blondel, J.L. Guillaume, R. Lambiotte, and E. Lefebvre. Fast unfolding of communities in large networks. Journal of Statistical Mechanics: Theory and Experiment, 2008:P10008, 2008. B. DasGupta and D. Desai. On the complexity of newman's community finding approach for bio- logical and social networks. Arxiv preprint arXiv:1102.0969, 2011. R. Gummadi, K. Jung, D. Shah, and R. Sreenivas. Computing the capacity region of a wireless network. In IEEE International Conference on Computer Communications (INFOCOM), 2009. A. Gupta, R. Krauthgamer, and J.R. Lee. Bounded geometries, fractals, and low-distortion embed- dings. In Foundations of Computer Science (FOCS), 2003. 18 PARTITION MERGE Y. Han. Matching for graphs of bounded degree. Frontiers in Algorithmics, pages 171 -- 173, 2008. A. Hassidim, J.A. Kelner, H.N. Nguyen, and K. Onak. Local graph partitions for approximation and testing. In Foundations of Computer Science (FOCS), 2009. B. Huang and T. Jebara. Loopy belief propagation for bipartite maximum weight b-matching. Arti- ficial Intelligence and Statistics (AISTATS), 2007. K. Jung and D. Shah. Local algorithms for approximate inference in minor-excluded graphs. In Annual Conference on Neural Information Processing Systems (NIPS), 2007. K. Jung, P. Kohli, and D. Shah. Local rules for global map: When do they work? Advances in Neural Information Processing Systems (NIPS), 22:871 -- 879, 2009. P. Klein, S.A. Plotkin, and S. Rao. Excluded minors, network decomposition, and multicommodity flow. In ACM symposium on Theory of computing (STOC), 1993. M.E.J. Newman. Modularity and community structure in networks. Proceedings of the National Academy of Sciences, 103(23):8577, 2006. J. Pearl. Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference. San Francisco, CA: Morgan Kaufmann, 1988. D. Peleg. Distributed computing: a locality-sensitive approach, volume 5. Society for Industrial Mathematics, 2000. S. Sanghavi, D. Shah, and A. Willsky. Message-passing for Maximum Weight Independent Set. In Advances in Neural Information Processing Systems (NIPS), 2007. D. Sontag and T. Jaakkola. Tree block coordinate descent for map in graphical models. Journal of Machine Learning Research - Proceedings Track, 5:544 -- 551, 2009. R. Swendsen and J. Wang. Nonuniversal critical dynamics in monte carlo simulations. Phys. Rev. Letter., 58:86 -- 88, 1987. D.l Tarlow, D. Batra, P. Kohli, and V. Kolmogorov. Dynamic tree block coordinate ascent. In ICML, 2011. M. J. Wainwright, T. Jaakkola, and A. S. Willsky. Map estimation via agreement on (hyper)trees: Message-passing and linear-programming approaches. IEEE Transactions on Information The- ory, 2005. J. Yedidia, W. Freeman, and Y. Weiss. Generalized belief propagation. Mitsubishi Elect. Res. Lab., TR-2000-26, 2000. 19
1308.3336
5
1308
2016-06-24T10:55:49
The Power of Dynamic Distance Oracles: Efficient Dynamic Algorithms for the Steiner Tree
[ "cs.DS" ]
In this paper we study the Steiner tree problem over a dynamic set of terminals. We consider the model where we are given an $n$-vertex graph $G=(V,E,w)$ with positive real edge weights, and our goal is to maintain a tree which is a good approximation of the minimum Steiner tree spanning a terminal set $S \subseteq V$, which changes over time. The changes applied to the terminal set are either terminal additions (incremental scenario), terminal removals (decremental scenario), or both (fully dynamic scenario). Our task here is twofold. We want to support updates in sublinear $o(n)$ time, and keep the approximation factor of the algorithm as small as possible. We show that we can maintain a $(6+\varepsilon)$-approximate Steiner tree of a general graph in $\tilde{O}(\sqrt{n} \log D)$ time per terminal addition or removal. Here, $D$ denotes the stretch of the metric induced by $G$. For planar graphs we achieve the same running time and the approximation ratio of $(2+\varepsilon)$. Moreover, we show faster algorithms for incremental and decremental scenarios. Finally, we show that if we allow higher approximation ratio, even more efficient algorithms are possible. In particular we show a polylogarithmic time $(4+\varepsilon)$-approximate algorithm for planar graphs. One of the main building blocks of our algorithms are dynamic distance oracles for vertex-labeled graphs, which are of independent interest. We also improve and use the online algorithms for the Steiner tree problem.
cs.DS
cs
The Power of Dynamic Distance Oracles: Efficient Dynamic Algorithms for the Steiner Tree Jakub Łącki∗ Jakub Oćwieja† Marcin Pilipczuk‡ Piotr Sankowski§ Anna Zych¶ Abstract In this paper we study the Steiner tree problem over a dynamic set of terminals. We consider the model where we are given an n-vertex graph G = (V, E, w) with positive real edge weights, and our goal is to maintain a tree which is a good approximation of the minimum Steiner tree spanning a terminal set S ⊆ V , which changes over time. The changes applied to the terminal set are either terminal additions (incremental scenario), terminal removals (decremental scenario), or both (fully dynamic scenario). Our task here is twofold. We want to support updates in sublinear o(n) time, and keep the approximation factor of the algorithm as small as possible. √ We show that we can maintain a (6 + ε)-approximate Steiner tree of a general graph in O( n log D) time per terminal addition or removal. Here, D denotes the stretch of the metric induced by G. For planar graphs we achieve the same running time and the approximation ratio of (2 + ε). Moreover, we show faster algorithms for incremental and decremental scenarios. Finally, we show that if we allow higher approximation ratio, even more efficient algorithms are possible. In particular we show a polylogarithmic time (4 + ε)-approximate algorithm for planar graphs. One of the main building blocks of our algorithms are dynamic distance oracles for vertex- labeled graphs, which are of independent interest. We also improve and use the online algorithms for the Steiner tree problem. ∗University of Warsaw, [email protected]. Jakub Łącki is a recipient of the Google Europe Fellowship in Graph Algorithms, and this research is supported in part by this Google Fellowship. †University of Warsaw, [email protected]. Partially supported by ERC grant PAAl no. 259515 and polish funds for years 2011-2014 for co-financed international projects. ‡University of Bergen, [email protected]. The research leading to these results has received funding from the European Research Council under the European Union's Seventh Framework Programme (FP/2007-2013) / ERC Grant Agreement n. 267959. Partially supported by ERC grant PAAl no. 259515. §University of Warsaw, [email protected]. Partially supported by ERC grant PAAl no. 259515, NCN grant N206 567940 and the Foundation for Polish Science and polish funds for years 2011-2014 for co-financed international projects.. ¶University of Warsaw, [email protected]. Partially supported by ERC grant PAAl no. 259515 and polish funds for years 2011-2014 for co-financed international projects. 1 Contents 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 Our results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Related results 1.3 Organization of the paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Preliminaries 3 4 6 7 7 3 Overview of our algorithms 3.2 Dynamic vertex-color distance oracles 3.1 Online algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 8 3.1.1 Decremental online algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1.2 Incremental online algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1.3 Fully dynamic online algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 11 . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2.1 Oracle interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2.2 Generic distance oracles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.2.3 From a generic oracle to a dynamic vertex-color distance oracle . . . . . . . . 15 Implementing the online algorithms efficiently . . . . . . . . . . . . . . . . . . . . . . 16 3.3.1 Efficient decremental algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.3.2 Efficient incremental algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.3 Efficient fully dynamic algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.3 4 Online algorithms 20 4.1 µ-near metric spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.1.1 Analysis of the greedy approach in near metric spaces . . . . . . . . . . . . . 22 4.2 Properties guaranteeing good approximation factors . . . . . . . . . . . . . . . . . . 23 4.3 Decremental online algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.4 Incremental online algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.5 Fully dynamic online algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 . . . . . . . . . . . . 33 4.5.1 Decreasing the dependence on the stretch of the metric 5 Dynamic vertex-color distance oracles 35 5.1 Generic construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3-approximate oracles for general graphs . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.2 5.3 (1 + ε)-approximate oracles for planar graphs . . . . . . . . . . . . . . . . . . . . . . 43 5.4 Additional operations and properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 6 Sublinear time dynamic algorithms 51 6.1 Decremental algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.2 Incremental algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.3 Fully dynamic algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 7 Steiner tree via bipartite emulators 65 7.1 Constructing bipartite emulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 7.1.1 General graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 7.1.2 Planar graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 8 Conclusions 71 2 1 Introduction Imagine a network and a set of users that want to maintain a cheap multicast tree in this network during a conference call [17]. The users can join and leave, but in the considered time scale the network remains static. In other words we are considering the following problem. We are given a graph G = (V, E, w) with positive edge weights w : E → R+. The goal is to maintain information about approximate Steiner tree in G for a dynamically changing set S ⊆ V of terminals. This problem was first introduced in the pioneering paper by Imase and Waxman [28] and its study was later continued in [30, 20, 21]. However, all these papers focus on minimizing the number of changes to the tree that are necessary to maintain a good approximation, and ignore the problem of efficiently finding these changes. The problem of maintaining a Steiner tree is also one of the important open problems in the network community [14], and while it has been studied for many years, the research resulted only in several heuristic approaches [6, 2, 27, 33] none of which has been formally proved to be efficient. In this paper we show the first sublinear time algorithm which maintains an approximate Steiner tree under terminal additions and deletions. Our paper deals with two variants of the problem of maintaining the Steiner tree. Throughout this paper, we assume that in the online Steiner tree problem (we also say online setting) the goal is to maintain a Steiner tree making few changes to the tree after each terminal addition or removal. On the other hand, in the dynamic Steiner tree problem (dynamic setting), the requirement is that each update is processed faster than by recomputing the tree from scratch. This aligns with the usual definition of a dynamic algorithm used in the algorithmic community (see e.g. [18]). In this paper we study both settings and use the techniques for the online setting to show new results in the dynamic setting. As our point of reference we observe that it is possible to construct O(n) time dynamic algorithm for Steiner tree using the dynamic polylogarithmic time minimum spanning forest (dynamic MSF) algorithm [26]. This solution is obtained by first computing the metric closure G of the graph G, and then maintaining the minimum spanning tree (MST) over the set of terminals S in G[S]. It is a well-known fact that this yields a 2-approximate Steiner tree. In order to update G[S] we need to insert and remove terminals together with their incident edges, which requires Θ(n) calls to the dynamic MSF structure. However, such a linear bound is far from being satisfactory as does not lead to any improvement in the running time for sparse networks where m = O(n).1 In such networks after each update we can actually compute the 2-approximate Steiner tree in O(n log n) time from scratch [31]. Hence, the main challenge is to break the linear time barrier for maintaining constant approximate tree. Only algorithms with such sublinear complexity could be of some practical importance and could potentially be used to reduce the communication cost of dynamic multicast trees. Our paper aims to be a theoretical proof of concept that from algorithmic complexity perspective this is indeed possible. As observed by [11] and [12], the dynamic problems with vertex updates are much more chal- lenging, but are actually closer to real-world network models than problems with edge updates. In computer networks, vertex updates happen more often, as they correspond to software events (server reboot, misconfiguration, or simply activation of a user), whereas edge updates are much less likely, as they correspond to physical events (cable cut/repair). Finally, we note that the Steiner tree problem is one of the most fundamental problems in combinatorial optimization. It has been studied in many different settings, starting from classical 1It is widely observed that most real-world networks are sparse [15]. 3 Setting general, fully dynamic general, incremental general, decremental planar, fully dynamic planar, incremental apx. 6 + ε 6 + ε 6 + ε 2 + ε 2 + ε n) update time √ O( n log D) √ O( √ O( √ O( n log D) O(log3 n log D) n) preprocessing time √ O( n) n(m + n log D)) √ O(m √ O(m n) O(n log D) O(n log D) Table 1: Summary of our algorithms for maintaining Steiner tree in general and planar graphs. For an input graph G, n = V (G), m = E(G), and D is the stretch of the metric induced by G. The dependence of the running times on ε−1 is polynomial. The update times are amortized, some of them are also in expectation (see the corresponding theorem statements). approximation algorithms [7, 32, 5, 34, 9, 10], through online [28, 30, 20, 21] and stochastic mod- els [22, 19], ending with game theoretic approaches [4, 8]. Taking into account the significance and the wide interest in this problem, it is somewhat surprising that no efficient dynamic algorithms for this problem have been developed so far. It might be related to the fact that this would re- quire combining ideas from the area of approximation algorithms with the tools specific to dynamic algorithms. This is the first paper that manages to do so. In this extended abstract we only present the main ideas, skipping the proofs and the formal analysis, which will be presented in the full version of this paper. 1.1 Our results The main result of this paper are sublinear time algorithms for maintaining an approximate Steiner tree. We provide different algorithms for incremental, decremental and fully dynamic scenarios. An incremental algorithm allows only to add terminals, a decremental algorithm supports removing terminals, whereas a final fully dynamic algorithm supports both these operations. Our results are summarized in Table 1. The overall approximation ratio of the algorithms we obtain is (6 + ε) for general graphs and (2 + ε) for planar graphs. In particular, we can maintain a fully dynamic (6+ε)-approximate tree in O( n log D) amortized time per update in an arbitrary weighted graph, where D is the stretch of the metric induced by the graph. This extended abstract aims to present a brief overview of this result. The result is a composition and a consequence of many ideas that are of independent interest. We believe that the strength of this paper lies not only in the algorithms we propose, but also in the byproducts of our construction. We outline these additional results below. √ Dynamic vertex-color distance oracles The algorithms for online Steiner tree assume that the entire metric (i.e., the distances between any pair of vertices) is given explicitly. This assumption is not feasible in case of a metric induced by a graph. Hence, to obtain the necessary distances efficiently, we develop a data structure called dynamic vertex-color distance oracle. This oracle is given a weighted undirected graph and maintains an assignment of colors to vertices. While the graph remains fixed, the colors may change. The oracle can answer, among other queries, what is the nearest vertex of color c to a vertex v. We develop two variants of approximate vertex-color distance oracles: incremental and fully dynamic. In the first variant, each vertex is initially given 4 a distinct color and the color sets (i.e., two sets representing vertices of the same color) can be merged. The fully dynamic oracles additionally support (restricted) operations of splitting color sets.2 Note that these update operations are much more general than the operation of changing the color of a single vertex, which was considered in earlier works [25, 13]. For planar graphs we propose two (1 + ε)-approximate oracles. The incremental oracle supports all operations in O(ε−1 log2 n log D) amortized time (in expectation), whereas the fully dynamic or- acle supports operations in worst case time O(ε−1√ √ n log2 n log D). For general graphs we introduce n log n) expected time. Our construction a 3-approximate fully dynamic oracle that works in O( of oracles is generic, that is we show how to extend oracles that may answer vertex-to-vertex queries and satisfy certain conditions into dynamic vertex-color oracles. For that we introduce the concept of a generic distance oracle, which captures the common properties of many distance oracles and allows us to use a uniform approach for different oracles for planar and general graphs. Online Steiner tree We show an online algorithm that decrementally maintains (2+ε)-approximate Steiner tree, applying after each terminal deletion O(ε−1) changes to the tree (in amortized sense). This improves over the previous 4-approximate algorithm. In addition to that, we show a fully dynamic (2 + ε)-approximate online algorithm, which makes O(ε−1 log D) changes to the tree (in amortized sense) after each operation. One of the new techniques used to obtain these results is the lazy handling of high degree Steiner nodes for arbitrary degree threshold. This improves over an algorithm by Imase and Waxman [28], which makes O(t3/2) changes to process t addition or removal operations, and maintains a 4-approximate tree. An algorithm performing a smaller number of changes was given in [21], but, as we discuss in the next section, it departs slightly from the classical Imase-Waxman model. √ √ Query Steiner tree In the query model, as defined in [16], for a fixed graph G, we are asked queries to compute an approximate Steiner tree for a set S ⊆ V as fast as possible. This models a sit- uation when many sets of users want to setup a new multicast tree. We obtain an algorithm, which 6-approximate Steiner tree in O(S√ after preprocessing in O( n log n) space and computes a n log n) expected time. In the planar case, we can compute (2 + ε)-approximate tree in O(Sε−1 log2 n log D) expected time, using O(ε−1n log2 n log D) pre- processing time and space. In other words, we show a more efficient solution for computing many multicast trees in one fixed graph than computing each tree separately. This preprocessing problem is related to the study initiated in [1] where compact multicast routing schemes were shown. In comparison with [1], our schemes are not only compact but efficient as well. n(m + n log n)) expected time uses O(n Nonrearrangeable incremental Steiner tree In the nonrearrangeable incremental Steiner tree problem one has to connect arriving terminals to the previously constructed tree without modifying it. We show how to implement the O(log n)-approximate online algorithm for this problem given by Imase and Waxman [28] so that it runs in O(r n log n) expected time for non- planar graphs and O(r log2 n log D) expected time for planar graphs. Here r denotes the final number of terminals. This gives an improvement over the naive execution of this algorithm that requires O(r2) time and resolves one of the open problems in [14]. √ 2Because of these two operations we believe that it is more natural to change slightly the previously used vocabulary and assign colors instead of labels to vertices. 5 Bipartite emulators As an interesting side result, we also show a different, simple approach to dynamic Steiner tree, which exposes a trade-off between the approximation ratio and the running It is based on bipartite emulators: low-degree bipartite graphs that approximate distances time. in the original graph. We run the dynamic MSF algorithm on top of a bipartite emulator to obtain sublinear time dynamic algorithms. In particular, we obtain a 12-approximate algorithm for general graphs that processes each update in O( n) expected amortized time and a (4 + ε)- approximate algorithm for planar graphs processing updates in O(ε−1 log6 n) amortized time. While our emulators are constructed using previously known distance oracles [37, 36], our contribution lies in introducing the concept of bipartite emulators, whose properties make it possible to solve the Steiner tree problem with a modification of the dynamic MSF algorithm [26]. √ We want to stress that the construction of our algorithms for the Steiner tree, in particular the approach that combines online Steiner tree algorithm with a distance oracle, is highly modular. Not only any improvement in the construction of the vertex-color distance oracles will result in better Steiner tree algorithms, but the vertex-color distance oracles themselves are constructed in a generic way out of distance oracles in [36, 37]. The approximation factor of (6 + ε) for Steiner tree in general graphs comes from using 3-approximate oracles combined with a 2-approximation of the Steiner tree given by the MST in the metric closure and (1 + ε)-approximate online MST algorithm. In other words we hit two challenging bounds: in order to improve our approximation factors, one would need either to improve the approximation ratio of the oracles which are believed to be optimal, or devise a framework not based on computing the MST. The second challenge would require to construct simple and fast (e.g., near-linear time) approximation algorithms for Steiner tree that would beat the MST approximation ratio of 2. Constructing such algorithms is a challenging open problem. 1.2 Related results The problems we deal with in this paper and related have received a lot of attention in the literature. We present a brief summary in this section. Vertex-color distance oracles Our vertex-color distance oracles fall into the model studied in the literature under the name of vertex-label distance oracles. Dynamic vertex-color oracles for general graphs have been introduced by Hermelin et. al [25] and improved by Chechik [13]. These oracles allow only to change a color (label) of a single vertex, as opposed to our split and merge operations. The oracle by Chechik [13] has expected size O(n1+1/k), and reports (4k − 5)-approximate distances in O(k) time. This oracle can support changes of vertices' colors in O(n1/k log n) time. Our results have much better approximation guarantee and more powerful update operations, at the cost of higher query time. A vertex-color oracle for planar graphs has been shown by Li, Ma and Ning [29], but it does not support updating colors. The incremental variant of our oracle allows merging colors, and has only slightly higher running time. Online Steiner tree There has been an increasing interest in the online Steiner tree and the related online MST problem in recent years, which started with a paper by Megow et al. [30]. They showed that in the incremental case one can maintain an approximate online MST in G[S] (and consequently an approximate Steiner tree) with only a constant number of changes to the tree per terminal insertion (in amortized sense), which resolved a long standing open problem posed in [28]. 6 The result of [30] was improved to worst-case constant by Gu, Gupta and Kumar [20]. Then, Gupta and Kumar [21] have shown that constant worst-case number of changes is sufficient in the decremental case. Their paper also shows a fully dynamic algorithm that performs constant number of changes in amortized sense, but in a slightly different model. In [21], a newly added terminal is treated as a new vertex in the graph, with new distances given only to all currently active (not yet deleted) terminals; the remaining distances are assumed implicitly by the triangle inequality. However, in the classical Imase-Waxman model, the entire algorithm runs on a fixed host graph that is given at the beginning, and terminals are only activated and deactivated. After a terminal is deleted, it may still be used in the maintained tree as a Steiner node. In particular, in our algorithms it is crucial that the newly added terminal may be connected directly to a Steiner node. This is not allowed in [21], so it seems that their analysis cannot be used in the Imase-Waxman model that is studied here. While the online algorithms for Steiner tree have been studied extensively, our paper is the first one to show that they can be turned into algorithms with low running time. Moreover, in the decremental case and fully dynamic case we are the fist to show (2 + ε)-approximate algorithms. 1.3 Organization of the paper The remainder of the paper is organized as follows. Section 2 introduces the notation and recalls some results used further in the paper. In Section 3 we describe a shortened version of our results, which is supposed to sketch the ideas without diving into technicalities and proofs of correctness. Section 4 presents online algorithms for Steiner tree. It covers our improvements in this area and analyses the algorithms in the setting where we only have access to approximate distances in the graph. Section 5 introduces dynamic approximate vertex-color distance oracles, starting with a generic oracle, through various constructions of particular oracles, ending with the summary of our results in this area. In Section 6 we show how to combine the online algorithms with distance oracles to obtain efficient algorithms for dynamic Steiner tree. In Section 7 we show alternative algorithms for dynamic Steiner tree problem based on bipartite emulators. These algorithms are slightly faster compared to the previously presented, but the approximation ratio doubles. Finally, Section 8 concludes the paper and suggests directions for future research. 2 Preliminaries Let G = (V, E, dG) be a graph. Throughout the paper, we assume that each graph is undirected and has positive edge weights. By V (G) and E(G) we denote the vertex and edge sets of G, respectively. For u, v ∈ V , we write δG(u, v) to denote the distance between u and v in G. The graph we refer to may be omitted if it is clear from the context. For v ∈ V , ΓG(v) = {u ∈ V : uv ∈ E} is the set of neighbors of v in G. is a small fixed constant. In particular, we assume ε < 1. Whenever we give some statement with accuracy parameter ε > 0, we implicitly assume that ε (cid:1), dG) to be the metric closure of G, i.e., for u, v ∈ V , dG(u, v) = δG(u, v). We define G = (V,(cid:0)V 2 The stretch of the metric induced by G is the ratio between the longest and the shortest edge of G. Moreover, let G[X] denote the subgraph of G induced by X ⊆ V and let MST (G) stand for the minimum spanning tree in G. For a given graph G and a terminal set S we define ST (G, S) to be an optimum Steiner tree in G that spans S. Our algorithms are based on the following well-known 7 fact. Lemma 2.1. Let G = (V, E, dG) be a graph and S ⊆ V . Then dG(ST (G, S)) ≤ dG(MST (G[S])) ≤ 2dG(ST (G, S)). In each of our algorithms the ultimate goal is to maintain a good approximation of MST (G[S]). Note that, as we focus on MST (G[S]), our algorithms can also maintain a solution to Subset TSP on the same (dynamic) terminal set with the same approximation guarantee. Since we work with a metric closure of G, the solution that we maintain is actually a collection of (approximately) shortest paths in G. As we precompute these paths during initialization, our algorithms can be extended to report each such path in time that is linear in its length. We distinguish three dynamic scenarios: incremental, decremental and fully dynamic. All three scenarios assume that the input graph remains the same, while the set S of terminals changes over time. In the incremental scenario we consider how to efficiently update the tree after a vertex is added to S (it is announced to be a terminal), in the decremental scenario the update operation is removing a vertex from S, and the fully dynamic scenario allows both these operations intermixed with each other. As discussed already in the introduction, we are interested in performing one update operation in sublinear (amortized) time, as a near-linear time algorithm follows easily from the works on dynamic minimum spanning forest [26]. Dynamic MSF algorithm. In a number of our algorithms we use an algorithm that may dy- namically maintain a minimum spanning forest of a graph, subject to edge insertions and removals. In the following, we call it a dynamic MSF algorithm. Theorem 2.2 ([26]). There exists a fully dynamic MSF algorithm, that for a graph on n vertices supports m edge additions and removals in O(m log4 n) total time. Whenever we use the algorithm of Theorem 2.2 on some graph, we implicitly make sure that all the edges have pairwise distinct weights. We ensure this by breaking ties between weights using the timestamp of the addition, and some arbitrary total ordering of edges present at initialization. In particular, if we compare two edges of the same weight, we prefer to use the older one (i.e., we treat it as slightly cheaper). If, after an edge e is added to the graph, the maintained forest is altered, then the new forest includes e, and either the cost of the forest strictly decreased in this operation or the insertion of e connected two connected components of the graph. 3 Overview of our algorithms In this section we present a high-level overview of our algorithm for dynamic Steiner tree. This is done in three steps. First, we describe the online algorithms that we use (section 3.1). Then, we introduce dynamic vertex-color distance oracles (section 3.2), and finally (section 3.3) we show how to combine both these tools to obtain efficient algorithms. 3.1 Online algorithms We start with presenting online algorithms for Steiner tree. In the online setting the goal is to maintain an approximate Steiner tree and make small number of changes to the tree after a 8 terminal is added or deleted. We later use these algorithms to obtain efficient algorithms with low approximation factors. By Lemma 2.1, in order to maintain an approximate Steiner tree, we may maintain a tree T that spans the current set of terminals S in the metric closure of the graph. Although in this section we assume that we work with a complete graph, it should not be thought of as a metric closure of G, but instead as its approximation. In later sections, this approximation will be given by a distance oracle. A µ-approximate oracle for a graph G = (V, E, dG) yields a complete graph (cid:1), dGD), such that δG(u, v) ≤ dGD(u, v) ≤ µδG(u, v). We view GD as a complete graph, but it should be noted that it is not metric, since it does not satisfy triangle inequality. Therefore, we call GD a µ-near metric space. GD = (V,(cid:0)V 2 We essentially follow the core ideas of Imase and Waxman [28], with more modern improvements of [30, 20, 21]: to maintain good approximation ratio, it suffices to (a) as long as we can replace an edge e(cid:48) in the tree with a another one e of significantly lower cost, proceed with the replacements; (b) defer deletions of large-degree nonterminal vertices from the tree. However, we need some technical work to formally state these properties, especially in the context of near metric spaces. Furthermore, in [28] it is only argued that deferral of deletion of non-terminal vertices of degree at least three does not influence the approximation factor much; we generalize this result to arbitrary threshold, in particular showing that larger thresholds give better approximation guarantee. Following [28], when a terminal t is added to S, we can update the current tree by connecting t with T using the cheapest connecting edge. This alone does not lead to a good approximation of MST (GD[S ∪ {t}]) because some other edges incident to t could possibly be used to replace expensive edges in T . In our algorithms, we repeatedly replace tree edges with non-tree edges (assuring that after the replacement, we obtain a tree spanning S) until we reach a point at which we can be sure that the current tree is a good approximation of MST (GD[S]). We now formalize the notion of replacement. Let T be a tree in GD. For any edge e with both endpoints in V (T ), we say that an edge eT ∈ E(T ) is a friend of e (with respect to T ) if eT lies on the unique path between the endpoints of e. For a friend eT of e with regards to T , T (cid:48) := (T \ {eT}) ∪ {e} is a tree that spans V (T ) as well, with cost dGD(T ) − (dGD(eT ) − dGD(e)). We say that T (cid:48) is created from T by replacing the edge eT with e, and (e, eT ) is a replacement pair in T . Definition 3.1 (heavy, efficient and good replacement). Let c > ε ≥ 0 be constants and let T , e and eT be defined as above. We say that the (e, eT ) pair is a 1. ε-heavy replacement if dGD(eT ) > εdGD(T )/V ; 2. ε-efficient replacement if (1 + ε)dGD(e) < dGD(eT ); 3. (ε, c)-good replacement if it is both ε-efficient and (ε/c)-heavy. Standard arguments show that if no (ε, c)-good replacement is present in the tree, then it is close to a minimum spanning tree of its vertex set. Lemma 3.2. Let c > ε ≥ 0 be constants and let T be a tree in a complete graph GD. If T does not admit any (ε, c)-good replacement, then it is a c(1 + ε)/(c − ε)-approximation of minimum spanning tree of V (T ). In particular, if T does not admit any ε-efficient replacement, then it is a (1 + ε)-approximation of minimum spanning tree on V (T ). 9 (a) (b) Figure 1: In panel (a), all dashed edges of the tree, in particular eT , are friends of the blue thick edge e. Panel (b) illustrates a tree with some nonterminal vertices that are of large degree. approximation ratio significantly. In the next lemma we observe that having nonterminals of high degree does not influence the Lemma 3.3. Let ε ≥ 0 be a constant, η ≥ 2, G = (V,(cid:0)V (cid:1), dG) be a complete weighted graph and S ⊆ V . Let TMST = MST(cid:0)G[S](cid:1) be a MST of S and let T be a tree in G that spans S ∪ N and 2 does not admit (1 + ε)-efficient replacements. Furthermore, assume that each vertex of V (T ) ∩ N is of degree larger than η in T . Then dG(T ) ≤ (1 + ε) η η−1 dG(TMST ). The special case η = 2 of Lemma 3.3 has been proven by Imase and Waxman [28]; we provide a different, simpler proof of this result that additionally extends to arbitrary η ≥ 2. 3.1.1 Decremental online algorithm In this section we describe the decremental scheme, i.e., how to handle the case when the terminals are removed from the terminal set. In the decremental scheme, the main idea is to maintain the minimum spanning tree on the terminal set, but to postpone the deletion of terminals that are of degree above some fixed threshold η ≥ 2 in this spanning tree. When a vertex v of degree s ≤ η is deleted from the tree T , the tree breaks into s components T v = {T1, T2, . . . , Ts} that need to be reconnected. The natural idea is to use for this task a set of edges of GD of minimum possible total weight. That is, we first for each 1 ≤ i < j ≤ s identify an edge eij of minimum possible cost in GD among edges between Ti and Tj. Then, we construct an auxiliary complete graph with vertex set T v and edge cost d(TiTj) := dGD(eij), find a minimum spanning tree T ◦ of this graph, and use edges of this tree to reconnect T . Take η = 1 + (cid:100)ε−1(cid:101). Lemma 3.3 implies that the decremental scheme maintains a 2(1 + ε)µ- approximation of minimum Steiner tree of G. In the course of the first r deletions, it removes a vertex from the tree at most r times and each removed vertex has degree at most η = O(ε−1) in the currently maintained tree. 3.1.2 Incremental online algorithm We now consider the case when new terminals are added to the terminal set and we are to update the currently maintained tree. Following Imase and Waxman [28] and Megow et al [30], we first connect the new terminal to the tree we already have, and then try to apply all occurring (ε/2, 1 + ε)-good replacement pairs, for some ε > 0. 10 eeT (a) (b) Figure 2: Panel (a) illustrates the addition step: when a new terminal ti is added, it is first connected to the closest terminal with an edge e0, and then a replacement (e, e(cid:48)) is applied. Panel (b) illustrates the deletion step: when a vertex v is deleted, the tree splits into subtrees Ti, and between every pair of subtrees the shortest reconnecting edge ei,j is found (depicted as blue thick edge). Then, we find the set of reconnecting edges by computing a minimum spanning tree of the auxiliary graph Gc with vertex set {T1, T2, . . . , Ts} and edges ei,j connecting Ti and Tj. At one step, given a tree T and a new terminal vertex v ∈ V \ V (T ), we: 1. add an edge to T connecting v with V (T ) of cost minu∈V (T ) dGD(uv); 2. apply a sequence of ε-efficient replacement pairs (e, e(cid:48)) that satisfy the following additional property: e(cid:48) is a friend of e in the currently maintained tree of maximum possible cost; 3. after all the replacements, we require that there does not exist a (ε/2, 1+ε)-good replacement pair (e, e(cid:48)) with e incident to v. We emphasize here the the incremental algorithm requires only to care about replacement edges incident to the newly added vertex; we show that no other efficient replacement pair can be introduced in the above procedure. Lemma 3.2 implies that the incremental algorithm for some ε > 0 maintains 2(1 + ε)µ approxi- mation of the Steiner tree. With the help of the recent analysis of [20], we show that, in the course of the first r additions, it performs O(rε−1(1 + log µ)) replacements. 3.1.3 Fully dynamic online algorithm In order to obtain a scheme for a fully dynamic algorithm, we merge the ideas of two previous sections. We fix an accuracy parameter ε > 0. We aim at maintaining a (1 + ε)2-approximation 11 tie0ee0T1T2T3e1,2e2,3e1,3v of MST (GD[S]) where S is the current set of terminals. As in the decremental step, we define η = 1 + (cid:100)ε−1(cid:101) = O(ε−1), that is, η is the minimum positive integer with η η−1 ≤ 1 + ε. In a deletion step, we behave in exactly the same manner as in the decremental scheme. If we want to delete v from the terminal set, we mark it as non-terminal and, if its degree is at most η, it is removed from the tree. In an addition step, we perform similarly as in the incremental scheme, but there are two significant differences. First, we do not have the guarantee that the cost of the tree will not decrease much in the future, so we cannot stop replacing edges at some cost threshold: although the low cost edges may contribute only a little to the weight of the tree, this may change after many terminals are removed and the weight of the tree drops. Second, we need to watch out for non-terminal vertices whose degree may drop to the threshold η as a consequence of a replacement. Formally, to add a vertex v to the terminal set S we perform the following operations on the currently maintained tree T . 1. If v ∈ V (T ), mark v as a terminal and finish. 2. Otherwise, connect v to any vertex of T using the cheapest connection in GD. 3. Apply a sequence of ε-efficient replacement pairs, where for each such pair (e, e(cid:48)) we require that e(cid:48) has the maximum possible cost among the friends of e. 4. Once all replacement pairs are applied, we require that there exists no ε-efficient replacement pair (e, e(cid:48)) with e incident to v; 5. At the end remove all non-terminal vertices whose degree dropped to at most η due to replacements. Observe that, again as in the incremental scheme, we show that it suffices to care only about replacement pairs (e, e(cid:48)) with e incident to the newly added vertex v. Lemmas 3.2 and 3.3 imply that the scheme maintains a 2(1 + ε)2µ approximation of the Steiner tree. In the course of the first r operations, where r+ of this operations are additions and r− = r−r+ are deletions, the algorithm performs O(ε−1(r+ log D + r−(1 + log µ))) replacements and removes at most r− vertices, each of which has degree at most η = O(ε−1) in the currently maintained tree. Although our problem is similar to the one considered in [21], it does not seem clear if the analysis of incremental algorithm ([20], Theorem 4.5) is applicable to our fully dynamic scheme. The usage of this analysis in [21] strongly relies on the assumption that newly added terminals are new vertices in the graph, and their distance to previously deleted terminals is inferred from the triangle inequality. However, in our model of a fixed host graph G this assumption is no longer valid, hence we need to fall back to a different analysis here. 3.2 Dynamic vertex-color distance oracles In this section we introduce dynamic vertex-color distance oracles that we later use to implement the online algorithms. The oracles' interface is tailored to the construction of the algorithms. In fact, the algorithms will access the graphs only by the oracles that we describe. We consider two variants of the oracle: an incremental and a more general fully dynamic. The former will be used for incremental algorithms, whereas the latter for decremental and fully dynamic ones. 12 Figure 3: merge and split operations in the fully dynamic oracle. 3.2.1 Oracle interface (cid:83)k Let G = (V, E) be a graph. Each oracle maintains a partition of V into sets C1, . . . , Ck, i.e., i=1 Ci = V and Ci ∩ Cj = ∅ for all i (cid:54)= j, 1 ≤ i, j ≤ k. In other words we assign colors to the vertices of G. At any given point each color might be active or not. We say that a vertex is active if the associated color is active. The oracle allows us to find the distance from a given vertex to the nearest vertex of a given color or to the nearest active vertex. The updates supported by the oracle alter only the sets Ci, while the underlying graph G is never changed. In the incremental variant of the oracle, the only operation that allows us to change colors is merging two colors. To be more precise, the incremental oracle supports the following set of operations: • distance(v, i) – compute the approximate distance from v to the nearest vertex of color i, • nearest(v, k) – compute the approximate distance from v to the k-th nearest active color (for a constant k), • activate(i) – activate set (color) Ci, • merge(i, j) – merge two different active sets Ci and Cj into one active set Cl, where l ∈ {i, j}. The fully dynamic variant also supports splitting sets Ci, but only in a restricted way. The oracle associates with every set Ci a tree Ti that spans Ci. Trees Ti may be arbitrary trees spanning vertices of Ci, and their edges are not necessarily present in G. Splitting a set is achieved by specifying an edge e in Ti. The edge e is removed from Ti and the two connected components that are created specify how the set should be split (see also Figure 3). Formally speaking, the fully dynamic oracle supports the following operations: • distance(v, i) – compute the approximate distance from v to the nearest vertex or color i, 13 uvuvSiwithtreeTiSjwithtreeTjSl=Si∪SjwithtreeTl=Ti∪Tj∪{uv}mergesplit • nearest(v, k) – compute the approximate distance from v to the k-th nearest active color (for a constant k), • activate(i) – activate set (color) Ci, • deactivate(i) – deactivate set (color) Ci, • merge(i, j, u, v) – merge active sets Ci and Cj associated with trees Ti and Tj into an active color set Cl, l ∈ {i, j}, and associate it with Tl := Ti ∪ Tj ∪ {uv}, • split(l, u, v) – if uv is an edge of a spanning tree Tl of an active color set Cl, split Cl into active color sets Ci and Cj associated with the two connected components of Tl \ {uv}. We would like to remark here that in our construction of the oracles, the nearest(v, k) query returns the distance to the k-th nearest color, but we use the distances measured by the distance query. That is, it returns the k-th smallest value of distance(v, i) over all active colors i. 3.2.2 Generic distance oracles Our oracles are based on static distance oracles that may answer vertex-to-vertex distance queries. In addition to supporting the scheme listed above, our oracles have some structural properties important for our algorithms. These properties are summarized in the following definition and we explain why we need them right below. The definition is illustrated in Fig. 4. Definition 3.4. Let G = (V, E, dG) be a weighted graph and α ≥ 1. An α-approximate generic oracle for G associates with every v ∈ V : • a set of portals, denoted by portals(v), which is a subset of V , • and a family of pieces, denoted by pieces(v), were each element (referred to as piece) is a weighted planar3 graph on a subset of V . We say that a vertex w is piece-visible from v if there is a piece r ∈ pieces(v) such that w ∈ V (r). The piece distance from v to w is defined as Rv,w = minr∈pieces(v) δr(v, w), and Rv,w = +∞ if w is not piece-visible from v. The oracle additionally stores, for each v ∈ V and p ∈ portals(v), an approximate distance Dp,v ≥ δG(p, v)4. For every pair v, w ∈ V we require that Rv,w = Rw,v, and either Rv,w = δG(v, w) or there is a portal p ∈ portals(v) ∩ portals(w), such that there is a walk from v to w of length at most α · δG(v, w) that goes through p, and Dv,p + Dw,p ≤ αδG(v, w). The portal distance between v and w is minp∈portals(v)∩portals(w) Dv,p + Dw,p. P = (cid:83) R =(cid:83) an approximation of δG(v, w). Consider a complete graph GD = (V,(cid:0)V Let us now introduce the notation related to oracles. We denote the set of all portals as v∈V portals(v), and refer to its elements as portals. We denote the family of pieces as v∈V pieces(v). The pieces in pieces(v) are supposed to represent distances from v to some vertices visible from it. For every vertex w, either one of piece of v contains a path to w of length δG(v, w), or there is a walk from v to w through a portal of both v and w, whose length gives (cid:1), dGD), where dGD(v, w) 2 3The requirement that pieces are planar is not essential for the definition, but we have it here for convenience. In our oracles, pieces are either planar graphs or simply trees. 4Ideally, we would like Dp,v to be equal to δG(p, v) and Rv,w equal to δG(v, w). However, in some cases Dp,v and Rv,w might be greater. 14 (a) (b) Figure 4: A generic distance oracle. Panel (a) contains an unweighted graph with two distinguished portals (marked with squares). We have that portals(v) = {b, j} for all vertices v. In panel (b) there are two pieces. In this example we assume that a piece ri ∈ pieces(v) if v ∈ V (ri). For every u, v ∈ V , the minimum of piece and portal distances between u and v is at most 2δ(u, v). For example, the piece distance between e and g is infinite, but the portal distance is 4, which is twice as much as the exact distance. is defined as the minimum over the piece distance and the portal distance between v and w. By Definition 3.4 it is a well defined simple graph with finite weights. This is the graph of distances seen by the oracle. Even though oracle's answers are approximate with respect to G, they are exact with respect to GD, i.e., the oracle always returns the cheapest edge in GD between a vertex and a set of vertices of interest. We need this property for our algorithms to work. In particular, distance(v, i) returns the cheapest edge in GD between v and Ci, and nearest(v, k) returns the cheapest edge in GD between v and an active vertex of V \ (Ci1 ∪···∪ Cik−1), where Ci1 ∪···∪ Cik−1 are the k − 1 active colors that are closest to v (w.r.t. GD). We define a cluster of a portal p ∈ P to be set of all vertices, for which it is a portal, i.e., cluster(p) = {v ∈ V : p ∈ portals(v)}. If p is not a portal, cluster(p) = ∅. One can view the connections between vertices V (G) and portals P as a bipartite graph on V (G)(cid:93)P, where there is an edge between p ∈ P and v ∈ V (G) iff p ∈ portals(v) or equivalently v ∈ cluster(p). The number of edges in this graph is denoted as ptot =(cid:80) p cluster(p) =(cid:80) v portals(v). 3.2.3 From a generic oracle to a dynamic vertex-color distance oracle We show that given a generic oracle, we may obtain both an incremental and fully dynamic vertex- color distance oracles. Their efficiency is expressed in terms of oracle parameters, such as the total size of all pieces of each vertex or the total number of portals of all vertices. We first show an incremental construction. For every portal p we maintain the distance to the nearest vertex of every color in cluster(p). This requires only as much space as the oracle itself. When two colors i and j are merged, we find the color assigned to a smaller number of vertices. Assume it is color i. Then, we change colors of all vertices of color i to j. This way, a vertex changes colors only O(log n) times and each time this happens, it only needs to update information in all its portals. To find the nearest vertex of color i from a vertex v, we first check distances to all vertices of color i that are piece-visible from v and then examine paths going through portals of v. For a given portal, we find the distance to the nearest vertex of color i, which immediately 15 yields a candidate path from v to a vertex of color i going through a portal. The minimum of all candidate lengths gives the desired approximate distance. A fully dynamic construction is more involved. We describe a simplified version here. The ultimate goal is also to maintain, for every portal, the distance to the nearest vertex of every color. Recall that a fully dynamic oracle associates with every color Ci ⊆ V a tree Ti spanning Ci. For every portal p we maintain a dynamic tree ET p i , which has the same topology as Ti and associates with every vertex v ∈ V (Ti) ⊆ V a key equal to δG(p, v). The dynamic trees support link and cut operations and finding minimum of all keys in a tree. To handle an update, we iterate through all portals and link/cut the corresponding tree ET p i . This allows us to maintain, for every portal, the nearest vertex of every color. Answering queries can then be done as in the incremental oracle. Next, we adapt some existing distance oracles for general and planar graphs in order to obtain generic oracles. Basing on an oracle by Thorup and Zwick [37], we construct a generic oracle of stretch 3. This requires enforcing some additional properties, that may be of independent interest. √ From the generic oracle, by applying our generic construction, we immediately obtain a fully dy- namic 3-approximate vertex-color distance oracle that handles operations in O( n) expected time. In case of planar graphs, we adapt the construction by Thorup [36], and in the end obtain an incre- mental (1 + ε)-approximate vertex-color distance oracle handling operations in O(ε−1 log2 n log D) expected amortized time, where D is the stretch of the metric induced by the input graph. We also get a fully dynamic (1 + ε)-approximate vertex-color distance oracle for planar graphs that handles operations in O(ε−1√ n log D) time. 3.3 Implementing the online algorithms efficiently We show how to use the vertex-color distance oracles to implement the online algorithms. A µ- approximate nearest neighbor oracle for a graph G = (V, E, dG) yields a µ-near metric space, which approximates G. In other words, it works as if it was an exact oracle, but the distances between vertices were given by the edge lengths in GD. However, note that the edge lengths in GD may not satisfy triangle inequality. 3.3.1 Efficient decremental algorithm In the decremental scenario we maintain an approximate Steiner tree as terminals are deleted. The algorithm is based on vertex-color distance oracles, but it uses not only the operations provided by the oracle, but also the sets of portals and pieces of each vertex. In particular, the algorithm uses the concepts of portal and piece distances. For a fixed ε > 0 we plan to maintain a (1 + ε)-approximation of MST (GD[S]). Following the decremental scheme, we set η = 1 + (cid:100)ε−1(cid:101) = O(ε−1). We start with the tree T being equal to the MST on the terminals. When a vertex v of degree more than η is removed, we mark it as a nonterminal vertex, but do nothing more. Otherwise, we need to remove v and reconnect the connected components that emerge into a new tree. The main challenge lies in finding the reconnecting edges efficiently. In order to do that, we use the dynamic MSF algorithm (see Theorem 2.2) on a graph H that we maintain. Since our goal is to maintain a tree T which is an MST of the set of terminal and some nonterminal vertices, we assure that H is a subgraph of GD that contains this MST (for simplicity, we assume here that the MST is unique). Moreover, the only nonempty (i.e., containing 16 edges) connected component of H is composed exactly of terminals and nonterminal vertices which used to be terminals. As a result, the dynamic MSF algorithm will find the tree T . The simplest approach to maintaining H would be to add, for every two u, w ∈ S, an edge uw of length dGD(u, w). This, however, would obviously be inefficient, i.e., work in linear time. Instead of that, we use the structure of the vertex-color distance oracle. For every two u, w ∈ V (T ) which are mutually piece-visible we add to H an edge uw of length being equal to the piece distance. Moreover, we will be adding some edges corresponding to portal distances, but they will be chosen in a careful way to ensure that the number of such edges is low. We initialize the edge set of H to be the set of all edges of the initial T and all edges between mutually piece-visible terminals. Our algorithm uses a single instance D of the fully dynamic vertex-color distance oracle. We update the vertex-color distance oracle D, so that it has a single active color associated with a tree equal to T . All other vertices have distinct, inactive colors. Any change in the spanning forest of H results in a constant number of modifications to D. The main challenge is what happens if a vertex of degree s ≤ η is removed. Then the tree T decomposes into trees T1, . . . , Ts that we need to reconnect with a set of edges of minimum total cost. We rely on the dynamic MSF algorithm here and make sure that H contains a superset of the desired edges. First of all, H surely contains all edges corresponding to piece distances, as this is maintained as an invariant of our algorithm. Thus, we only need to assure that H also contains the necessary edges corresponding to portal distances. It is easy to observe that it suffices to add to H the MST of edges corresponding to portal distances between trees Ti. More formally, we consider a complete graph Gc over trees Ti, in which the edge length between two trees is the portal distance between the nearest vertices in these trees. We add to H only edges corresponding to MST (Gc). This MST can be simply computed by generating the graph Gc explicitly. We go through all portals and for each portal we generate edges corresponding to all portal distances that use this portal. Note that we use the assumption that η and the total number of portals are relatively small. The main factors that influence the running time are: the number of pairs of mutually piece- visible terminals (all such edges are initially added to H), the time for computing the reconnecting edges corresponding to portal distances, and the time for updating the oracle, when a vertex of degree at most η is removed. Note that r delete operations may cause at most r vertices to be removed. In practice, the update time is dominated by the time needed by the oracles for executing η = O(ε−1) merge and split operations caused by a vertex removal. In general graphs we obtain a (6 + ε)-approximate algorithm handling updates in O(ε−1√ n log n) expected amortized time. For update amounts to O(ε−1.5√ planar graphs, the approximation ratio is 2 + ε, whereas the amortized running time of a single n log D). 3.3.2 Efficient incremental algorithm In the incremental scenario, the goal is to approximate the Steiner tree, as the terminals are added. Denote the terminals that are added by t1, t2, t3, . . .. Let Si = {t1, . . . , ti} and let Ti denote the tree maintained by the algorithm after adding i terminals. We maintain an approximate minimum spanning tree of Si in graph GD. Fix a constant ε > 0. We assume that the edge lengths in GD are powers of 1 + ε. This can be achieved by rounding up edge lengths. Assume that all edge lengths of GD belong to the interval [1, D]. We define the level of an edge uv, as lvl(uv) := log1+ε dGD(uv). The algorithm represents 17 Figure 5: Trees maintained by the oracles Dj corresponding to layers Lj of the tree Ti. The small numbers above edges denote their levels. the current tree Ti by maintaining h = (cid:98)log1+ε D(cid:99) layers L1, . . . , Lh. Layer Lj contains edges of the current tree Ti whose level is at most j. In particular, layer Lh contains all edges of Ti. For each layer Lj, we maintain an incremental vertex-color distance oracle Dj on the graph G (see Figure 5). The partition of V into colors corresponds to the connected components of a graph (V, Lj). A color is active if and only if its elements belong to Si. The process of adding a terminal ti consists of two steps. First, we find the shortest edge in GD connecting ti to any of t1, . . . , ti−1 and add this edge to Ti−1 to obtain tree Ti. Then, we apply a sequence of ε-efficient replacements (e, e(cid:48)) to Ti in order to decrease its weight. Recall that we may only consider replacements in which e is incident to the newly added terminal ti. In order to find the replacements, we use the vertex-color distance oracles. Fix a layer number j and assume that the colors of the oracle Dj reflect the layer structure, including the newly added terminal ti. We want to find a replacement pair (e, e(cid:48)) such that the lvl(e(cid:48)) > j and lvl(e) ≤ j. Denote by C the connected component of the graph (V, Lj) that contains ti (or a color of ti in Dj). By definition of C, it consists of edges of level at most j and the path in Ti from ti to every t (cid:54)∈ C contains an edge of level > j. We find the vertex t (cid:54)∈ C which is the nearest to ti by querying Dj. Since ti has color C, we issue a nearest(ti, 2) query to find the second nearest color from ti. Assume that we find a vertex t(cid:48). If lvl(tit(cid:48)) ≤ j, we have found a replacement pair. Let e(cid:48) be the heaviest edge on the path from ti to t(cid:48) in Ti and e = tit(cid:48). Clearly, (e, e(cid:48)) is a replacement pair, and since the weight of e is lower than the weight of e(cid:48) and the weights can differ at least by a factor of 1 + ε, this replacement is ε-efficient. The running time of the algorithm described above depends on log D. In order to circumvent this dependency, we observe that we do not need to replace edges whose length is at most ε/(2n) 18 1421224331321D11421224331321D21421224331321D31421224331321D4 fraction of the weight of the current tree, as their total weight is negligible. This allows us to limit the number of levels that we consider to roughly O(log n). One of the factors influencing the running time is the number of replacements, but it depends only on ε and µ. For each replacement, we issue a constant number of oracle operations on each level, so the running time is, roughly speaking, a product of the number of replacements, the end, we obtain (6 + ε)-approximate algorithm for general graphs handling insertions in O(ε−1√ In the number of layers (roughly O(log n)) and the running time of a single oracle operation. n) expected amortized time and a (2 + ε)-approximate algorithm for planar graphs, which processes updates in O(ε−2 log2 n log(n/ε) log D) expected amortized time. 3.3.3 Efficient fully dynamic algorithm The fully dynamic algorithm is obtained by appropriately merging the ideas of the decremental and incremental algorithms. In fact we maintain both the invariants of the incremental and decremental algorithms. Fix ε > 0 and set η = 1 + (cid:100)ε−1(cid:101). We assume that all edges' lengths in GD are powers of 1 + ε, which may be assured by rounding their lengths up. We maintain a tree T that spans the set of terminals and nonterminals of degree more than η. The tree T is maintained by using dynamic MSF algorithm on a graph H that we update. It is an MST of the set of terminals and high-degree nonterminal vertices, and, since the length of every edge is a power of 1 + ε, this is equivalent to the fact that it does not admit any ε-efficient replacements. Assume that the edge lengths in GD belong to [1, D]. Let h = (cid:98)log1+ε D(cid:99). We maintain a collection of fully dynamic nearest neighbor oracles D1, . . . , Dh. Recall that the level of an edge uv is lvl(uv) := log1+ε dGD(uv). The oracle Dh contains a single active color associated with a tree equal to T . All other colors are inactive and assigned to isolated vertices. In general, oracle Di reflects the forest consisting of edges of T of level at most i. Each active color of Di corresponds to one tree of this forest. In particular the trees assigned to colors are the same as the trees in the forest. The oracles Di are counterparts of the oracles from the incremental algorithm. Since Dh contains all edges of the current tree, it may be used as the oracle D used in the decremental algorithm. When a terminal v is deleted, we use exactly the same procedure as in the decremental algorithm. The only difference is that we need to update all oracles Di, so that they reflect the changes made to the tree. On the other hand, if a vertex v is added, we use a procedure similar to the incremental algorithm. Namely, we connect v to T using the shortest edge in GD and then apply all occurring ε-replacements. In order to find all replacements, we need to consider replacements at all possible O(log D) levels. When a replacement (e, e(cid:48)) is detected, we add edge e to H. Since every replacement that we find is ε-efficient, the dynamic MSF algorithm will surely update the maintained tree accordingly. Note that e(cid:48) may be left in H. The vertex-color distance oracles are updated to reflect the changes done by the algorithm. After all replacements are made, the tree T is a MST of the set of terminals and nonterminal vertices of degree more than η. The last step is to add to H all edges vx for all vertices x which are piece-visible from v, as this is an invariant of the decremental algorithm. Regarding efficiency, not that every edge that is added may be replaced by an edge that is shorter by a factor of (1 + ε). In general, an edge insertion may trigger O(log1+ε D) replacements, in amortized sense. Each replacement requires us to update oracles on each of O(log1+ε D) levels. 19 Thus, for each added edge, we perform O(ε−2 log2 D) merge and split operations. Moreover, since for every vertex we need to maintain edges to all vertices piece-visible by it, we have to add or remove all such edges when a vertex is added to or removed from the tree. each update in O(ε−2√ For general graphs, we are able to maintain (6 + ε)-approximation of the Steiner tree, handling n log2 D) expected amortized time. In case of planar graphs, the approxi- to O(ε−2√ mation ratio is (2 + ε), whereas the amortized expected running time of a single operation amounts n log2.5 D). To deal with the big dependency on log D, we show a general technique for decreasing the dependency on log D from logc D to log D, at the cost of adding some additional ε−1 and log n factors. 4 Online algorithms In this section we describe our online algorithms for Steiner tree: we show how to maintain a low- weight tree spanning the terminals, using small number of changes to the tree. In other words, this section provides all details of the results mentioned in Section 3.1. For completeness, some parts of Section 3.1 are repeated here. Let us now give a short overview of this section. First, we observe that the distance oracles, used with conjunction with our the online algorithms, give only approximate distances and, consequently, the distances seen by the online algorithm may satisfy the triangle inequality with some slackness. To cope with that, in Section 4.1 we introduce the notion of µ-near metric space and prove its few properties that allow us to handle them almost as typical metric spaces. Then, in Section 4.2 we identify which properties of the maintained tree are needed to guarantee low weight. Here we essentially follow the core ideas of Imase and Waxman [28], with a more modern improvements of [30, 20, 21]: to maintain good approximation ratio, it suffices to (a) as long as we can replace an edge e(cid:48) in the tree with a new one e of significantly lower cost, proceed with the replacement; (b) defer deletion of large-degree nonterminal vertices from the tree. However, we need some technical work to formally state these properties, especially in the context of near metric spaces. We also improve the approximation ratio in comparison to previous works. We proceed with the actual online algorithms in subsequent sections: the decremental scheme is treated in Section 4.3, the incremental in Section 4.4, and we merge the ideas of these two algorithms to obtain a fully dynamic one in Section 4.5. Finally, in Section 4.5.1 we discuss how to bootstrap our algorithm to avoid superfluous depen- dency on the stretch of the metric in the fully dynamic setting. In the previous works [28, 30, 20, 21] the main goal was to optimize the number of changes to the tree, regardless of the actual time needed to identify them. Here we take a different view: as our ultimate goal is to minimize the total running time of each operation, in amortized sense, we prefer simple and non obtrusive requirements for the online algorithms, at the cost of (slight) increase in the actual number of changes. Moreover, we put more stress on optimizing the final approximation ratio of the algorithm, and identify some tradeoffs that can be made. Consequently, in all presented online algorithms we allow some additional slackness, comparing to the algorithms of [28, 30, 20, 21]. For example, the newly added terminal is not necessarily connected to the closest present terminal, but approximately closest; a similar slackness is allowed when performing edge replacements. This relaxation, although increases the number of possible steps of the algorithm by a constant factor, allows application of approximate distance oracles, and, consequently, yields fast implementations of the considered dynamic algorithms. Together with the 20 presence of near metric spaces, the introduced relaxations add some technical difficulties to our proofs. We would like also to remark that, although the recent analysis of the incremental algorithm of Imase and Waxman [28] due to Gu, Gupta and Kumar [20] perfectly fits into our incremental scheme, we were not able to apply the same ideas to our fully dynamic scheme, as it is done in [21]. The reason is that our fully dynamic model differs in a few significant aspects from the one of [21]. In [21], a newly added terminal is treated as a new vertex in the graph, with new distances given only to all currently active (not yet deleted) terminals; the remaining distances are assumed implicitly by the triangle inequality. In this manner, the analysis of [20] is directly applicable, as the terminal closest to the newly added terminal is always an active one. However, in our case such an interpretation does not make sense, as we assume the entire algorithm runs on a fixed host graph, given at the beginning. It does not seem clear whether the analysis of [20] is applicable to our model at all. 4.1 µ-near metric spaces As already discussed, in our dynamic algorithms we do not access the underlying graph directly, but instead use approximate distance oracles that can answer distance queries. The oracles we use provide us with an approximation of the metric closure of the input graph, that itself may not be metric, but it is always close to being metric. In the following definition we formalize this notion of closeness. Definition 4.1 (µ-near metric space). We say that a complete graph GD = (V,(cid:0)V µ-near metric space if there exists a metric space G = (V,(cid:0)V (cid:1), dGD) is an (cid:1), dG) on V such that for any u, v ∈ V 2 2 we have dG(uv) ≤ dGD(uv) ≤ µdG(uv). We additionally say that G is approximated by GD. Intuitively, a µ-near metric space behaves almost like a metric space, but a factor of µ pops up (cid:1), dGD) be a µ-near metric space. For any k ≥ 1 and any sequence if we use the triangle inequality. Lemma 4.2. Let GD = (V,(cid:0)V v0, v1, v2, . . . , vk ∈ V it holds that 2 dGD(v0vk) ≤ µdG(v0vk) ≤ µ dG(vi−1vi) ≤ µ dGD(vi−1vi). i=1 i=1 is to maintain a good approximation of MST(cid:0)G[S](cid:1). The analysis of the approximation factors we obtain relies on Lemma 2.1. So the ultimate goal 21 Proof. Assume GD approximates metric space G = (V,(cid:0)V i=1 dGD(v0vk) ≤ µ dGD(vi−1vi). k(cid:88) k(cid:88) (cid:1), dG). Then k(cid:88) 2 However, as the algorithm is given access only to a graph GD, which is an approximation of G, in subsequent sections we instead present how to maintain a good approximation of MST (GD[S]) by maintaining some tree T spanning S in GD. Note that, as T is allowed to use some non-terminal vertices, it may happen that actually dGD(T ) < dGD(MST (GD[S])). In what follows, we say that T is a α-approximation of MST (GD[S]) if dGD(T ) ≤ αdGD(MST (GD[S])). Lemma 4.3. Assume GD = (V,(cid:0)V G = (V,(cid:0)V (cid:1), dGD) is a µ-near metric space approximating a metric space (cid:1), dG). Let S ⊆ V be a terminal set, and let T be a tree spanning S and being a α- Let us now formally show that approximating MST (GD[S]) is sufficient for our needs. approximation of the minimum spanning tree of GD[S] in the complete graph GD (i.e., with regards to weights dGD). Then T is a 2αµ-approximation of a minimum Steiner tree connecting S in G (i.e., with regards to weights dG). Proof. Let T MST be a minimum spanning tree of G[S] and let T be a minimum Steiner tree connecting S in G (i.e., both T MST and T are minimum with regards to weights dG). As G is a metric, by Lemma 2.1, we have dG(T MST ) ≤ 2dG(T ). Let TMST be a minimum spanning tree of GD[S] (i.e., with regards to weights dGD). Using the definition of a µ-near metric space we obtain: 2 2 dG(T ) ≤ dGD(T ) ≤ αdGD(TMST ) ≤ αdGD(T MST ) ≤ αµdG(T MST ) ≤ 2αµdG(T ). Lemma 4.3 allows us to henceforth focus on a weighted complete graph GD and approximate MST (GD[S]), in most cases forgetting about the underlying approximated metric space G. 4.1.1 Analysis of the greedy approach in near metric spaces As discussed at the beginning of this section, we would like to apply the recent analysis of [20] of the greedy approach for incremental algorithm to our case. However, the analysis of [20] is performed in the presence of a metric space, and our algorithm perceives the input graph via distance oracles, and hence operates on a near metric space. In this short section, we adapt the results of [20] to near metric spaces. (V,(cid:0)V In the metric case, the following is proven in [20]. (cid:1), dG). For any 2 ≤ k ≤ n, let gk be the minimum-cost (w.r.t. dG) edge connecting tk with Theorem 4.4 ([20]). Consider a set of terminals S = {t1, t2, . . . , tn} in a metric space G = {t1, t2, . . . , tk−1}. Then 2 dG(gk) ≤ 4n−1 dG(e). e∈E(MST(G[S])) (V,(cid:0)V As shown below, in the near-metric setting, the constant 4 increases to 4µ. (cid:1), dGD). For any 2 ≤ k ≤ n, let fk be the minimum-cost (w.r.t. dGD) edge connecting tk with Theorem 4.5. Consider a set of terminals S = {t1, t2, . . . , tn} in a µ-near metric space GD = {t1, t2, . . . , tk−1}. Then 2 dGD(fk) ≤ (4µ)n−1 e∈E(MST (GD[S])) dGD(e). n(cid:89) k=2 n(cid:89) k=2 (cid:89) (cid:89) 22 Proof. Assume GD approximates metric space G = (V,(cid:0)V (cid:1), dG). For any 2 ≤ k ≤ n, let gk be defined as in Theorem 4.4, that is, gk is the edge connecting tk with {t1, t2, . . . , tk−1} of minimum possible cost in the metric dG. By the definition of a µ-near metric space and the choice of fk we have 2 dGD(fk) ≤ dGD(gk) ≤ µdG(gk). Moreover, again by the definition of a µ-near metric space we obtain: (cid:89) (cid:89) dGD(e) ≥ dG(e) ≥ e∈E(MST (GD[S])) e∈E(MST (GD[S])) e∈E(MST(G[S])) (cid:89) (1) (2) dG(e). The theorem follows by combining (1) and (2) with Theorem 4.4. 4.2 Properties guaranteeing good approximation factors Our goal is to maintain a tree T that spans the current set of terminals S in the near-metric space GD. In this section we identify the properties of the tree T that guarantee good approximation factor. Following [28], when a terminal t is added to S, we can update the current tree by connect- ing t with T using the cheapest connecting edge. This does not lead to a good approximation of MST (GD[S ∪ {t}]) because some other edges incident to t could possibly be used to replace expensive edges in T . In our algorithms, we repeatedly replace tree edges with non-tree edges (assuring that after the replacement, we obtain a tree spanning S) until we reach a point at which we can be sure that the current tree is a good approximation of MST (GD[S]). We now formalize the notion of replacement. Let T be a tree in GD. For any edge e with both endpoints in V (T ), we say that an edge eT ∈ E(T ) is a friend of e (with respect to T ) if eT lies on the unique path in T between the endpoints of e. For a friend eT of e with regards to T , T (cid:48) := (T \ {eT}) ∪ {e} is a tree that spans V (T ) as well, with cost dGD(T )−(dGD(eT )−dGD(e)). We say that T (cid:48) is created from T by replacing the edge eT with e, and (e, eT ) is a replacement pair in T . Definition 4.6 (heavy, efficient and good replacement). Let c > τ ≥ 0 be constants and let T , e and eT be defined as above. We say that the (e, eT ) pair is a 1. τ-heavy replacement if dGD(eT ) > τ dGD(T )/V ; 2. τ-efficient replacement if (1 + τ )dGD(e) < dGD(eT ); 3. (τ, c)-good replacement if it is both τ-efficient and (τ /c)-heavy. Lemmas 4.8 and 4.9 that follow will later be used to expose the properties of the tree we need to maintain in order to obtain a constant approximation of Steiner tree. For their proof, we need the following variant of the classical Hall's theorem. Theorem 4.7 (Hall's theorem). Let H be a bipartite graph with bipartition classes A(cid:93) B = V (H). Assume that there exist two positive integers p, q such that for each X ⊆ A it holds that ΓH (X) ≥ qX. Then there exists a function π : A × {1, 2, . . . , p} → B such that (i) aπ(a, i) ∈ E(H) for every a ∈ A and 1 ≤ i ≤ p, and (ii) π−1(b) ≤ q for each b ∈ B. p 23 Lemma 4.8. Let c > τ ≥ 0 be constants and let T be a tree in a complete graph GD. If T does not admit any (τ, c)-good replacement, then it is a c(1 + τ )/(c − τ )-approximation of minimum spanning tree of V (T ). In particular, if T does not admit any τ-efficient replacement, then it is a (1 + τ )-approximation of minimum spanning tree on V (T ). Proof. Let TMST be a minimum spanning tree of V (T ). We claim that there exists a bijection π : E(T ) → E(TMST ) such that e is a friend of π(e) with regards to T , for any e ∈ E(T ). Indeed, for any X ⊆ E(T ), there are X + 1 connected components of T \ X and, as T and TMST spans the same set of vertices, at least X edges of TMST connect two distinct connected components of T \ X. As each such edge has a friend in X, the claim follows from Hall's theorem. or dGD(e) ≤ (1+τ )dGD(π(e)). The cost of the edges of the first type sum up to at most τ dGD(T )/c, whereas the cost of the edges of the second type sum up to at most (1 + τ )dGD(TMST ). We infer Since T does not admit a (τ, c)-good replacement, for any e ∈ E(T ), either dGD(e) ≤ τ dGD(T )/(cV ) dGD(T ) ≤ τ c dGD(T ) + (1 + τ )dGD(TMST ) and the lemma follows. We now move to the core arguments needed for a deletion step. Imase and Waxman [28] proved that deferring the deletion of non-terminal vertices from the tree T as long as they have degree at least three incurs only an additional factor of two in the approximation guarantee. We present here a new, simplified proof of a generalization of this fact to arbitrary degree threshold. Lemma 4.9. Let η ≥ 2 be an integer and let T be a tree spanning N ∪ S where deg T (v) > η for any v ∈ N. Let TS be any tree spanning S. Then there exists a function π : E(T ) × {1, 2, . . . , η − 1} → E(TS) such that 1. e is a friend of π(e, i) with respect to T , for any e ∈ E(T ) and 1 ≤ i ≤ η − 1; and 2. π−1(e(cid:48)) ≤ η for any edge e(cid:48) of TS. Proof. We use Hall's theorem. Let X ⊆ E(T ); we need to prove that there are at least η−1 η X edges of E(TS) that have a friend in X. Let T be the family of connected components of the forest T \ X, and T¬S ⊆ T be the family of these components of T that do not contain any vertex of S. By the properties of the set N, each component of T¬S is adjacent to at least η + 1 edges of X. Consequently, since T is a tree, we have T¬S < T /η = (X + 1)/η. Hence, at least η−1 needs to contain at least η−1 such edge has at least one friend in X. The lemma follows. η X + 1 components of T contain a vertex of S. To connect these vertices, TS η X edges with endpoints in different components of T \ X, and each With a similar strategy, we provide a proof Lemma 7.3, used later on in Section 7, but proven here for convenience. Proof of Lemma 7.3. Recall that TM ST = MST ((cid:101)G[S]). Define a tree (cid:98)T as follows: for each edge uw ∈ E(TM ST ), take its corresponding edges ux, wx ∈ E(B), dB(ux) + dB(wx) =(cid:101)δB(uw), and add 24 them to (cid:98)T . In this way we obtain a tree (cid:98)T in B of length at most(cid:101)δB(TM ST ) that spans a superset of S. Denote (cid:98)S = V ((cid:98)T ). It suffices to prove that dB(T ) ≤ 2dB((cid:98)T ). Let LN\(cid:98)S be the set of leaf vertices of T (cid:48) that are contained in N \(cid:98)S, and let T(cid:98)S = T (cid:48) \ LN\(cid:98)S. Clearly, T is a subtree of T(cid:98)S, so it suffices to prove dB(T(cid:98)S) ≤ 2dB((cid:98)T ). To this end, we show that there exists a function π : E(T(cid:98)S) → E((cid:98)T ) such that 1. e is a friend of π(e) with respect to T(cid:98)S, for any e ∈ E(T(cid:98)S); 2. π−1(e(cid:48)) ≤ 2 for every e(cid:48) ∈ E((cid:98)T ). Observe that T(cid:98)S is a minimum spanning tree of B[(cid:98)S], since T (cid:48) is a minimum spanning tree as well. Hence, for such a function π we would have dG(e) ≤ dB(π(e)) for any e ∈ E(T(cid:98)S) and, consequently, dB(T(cid:98)S) ≤ 2dB((cid:98)T ), concluding the proof of the lemma. By Hall's theorem, it suffices to prove that for any X ⊆ E(T(cid:98)S), at least X/2 edges of E((cid:98)T ) have a friend in X (with respect to T(cid:98)S). To this end, consider any X ⊆ E(T(cid:98)S) and let T be the family of connected components of the forest T(cid:98)S \ X, and T¬(cid:98)S ⊆ T be the family of these components of T that do not contain any vertex of (cid:98)S. Observe that each component Q of T¬(cid:98)S is either adjacent vertices of S ⊆ (cid:98)S. In the latter case, we contract Q together with its two neighboring components, decreasing T by 2 and T¬(cid:98)S by one. After k contractions, we have as in Lemma 4.9 Consequently, T¬(cid:98)S < T /2 = (X + 1)/2. Thus, at least X/2 edges of (cid:98)T are needed to connect the components of T \ T¬(cid:98)S, and all such edges have some friend in X. This finishes the proof of an to at least three edges of X, or consists of a single vertex of N and is adjacent in T to exactly two T¬(cid:98)S − k < (T − 2k)/2. existence of the function π, and concludes the proof of the lemma. Lemma 4.10 that follows summarizes the properties we need to maintain a good tree. With respect to terminal addition, it says that it suffices to perform good replacements. With respect to terminal removal, it allows us to postpone the deletion of a terminal from the approximate Steiner tree as long as it has degree larger that some fixed integer threshold η. Lemma 4.10. Let τ ≥ 0 be a constant, η ≥ 2 be an integer, GD = (V,(cid:0)V (cid:1), dGD) be a complete weighted graph and S ⊆ V . Let TMST = MST (GD[S]) be a minimum spanning tree of S and let T be a tree spanning S ∪ N such that for any v ∈ N we have deg T (v) > η. Then the following hold. 1. If N = ∅ and T does not admit a (τ /2, 1 + τ )-good replacement, then dGD(T ) ≤ (1 + 2 τ )dGD(TMST ). 2. If T is a minimum spanning tree of S ∪ N, then dGD(T ) ≤ η 3. If T does not admit a τ-efficient replacement then dGD(T ) ≤ η η−1 dGD(TMST ). η−1 (1 + τ )dGD(TMST ). Proof. Point 1 follows from Lemma 4.8. To prove the remaining points, invoke Lemma 4.9 on trees T and TM ST with threshold η to obtain a mapping π : E(T ) × {1, 2, . . . , η − 1} → E(TM ST ). If T is a minimum spanning tree of S ∪ N, dGD(e) ≤ dGD(π(e, i)) for any e ∈ E(T ) and 1 ≤ i ≤ η − 1; If T does not admit an τ-efficient Point 2 follows by summation over the entire domain of π. replacement, dGD(e) ≤ (1 + τ )dGD(π(e, i)) for any e ∈ E(T ) and 1 ≤ i ≤ η − 1 and Point 3 follows similarly. 25 Knowing which properties we need our tree to satisfy, we may now investigate how to maintain these properties when confronted with addition and deletion of a terminal to and from the terminal set. In the next subsections we show how to modify the tree to preserve the desired properties. 4.3 Decremental online algorithm In the decremental scheme, we study the case when terminals are removed from the terminal set. The main idea is to use Lemma 4.9 and to maintain the minimum spanning tree on the terminal set, but to postpone the deletion of terminals that are of degree above some fixed threshold η ≥ 2 in this spanning tree. When a vertex v of degree s ≤ η is deleted from the tree T , the tree breaks into s components T v = {T1, T2, . . . , Ts} that need to be reconnected. The natural idea is use for this task a set of edges of GD of minimum possible total weight. That is, we first for each 1 ≤ i < j ≤ s identify an edge eij of minimum possible cost in GD among edges between Ti and Tj. Then, we construct an auxiliary complete graph Hv with vertex set T v and edge cost d(TiTj) := dGD(eij) and find a minimum spanning tree MST (Hv) of this graph. We define F v := {eij : TiTj ∈ E(MST (Hv))} to be the set of reconnecting edges and T (cid:48) := (T \ {v}) ∪ F v to be the reconnected tree T . We now proceed with a formal argumentation that this natural idea indeed works as expected. (cid:1), dGD), let T be a family of pairwise Lemma 4.11. Let T be a tree in a complete graph GD = (V,(cid:0)V vertex-disjoint subtrees of T such that there exists a subtree T c of T with V (T c) ∩ V ((cid:98)T ) = 1 for any (cid:98)T ∈ T , and let F be a set of edges of GD such that (a) each edge of F connects two different trees of T , and (b) T (cid:48) := F ∪(cid:83)T is a tree. Let (e, e(cid:48)) be a replacement pair in T (cid:48). Then one of 2 the following holds: 1. (e, e(cid:48)) is a replacement pair in T as well; 2. e(cid:48) ∈ F ; or 3. there exists f ∈ F such that (e, f ) is a replacement pair in T (cid:48) and (f, e(cid:48)) is a replacement pair in T . Proof. Let P be the unique path between the endpoints of e in the tree T (cid:48). By the construction of T (cid:48), P consists of subpaths P1, P2, . . . , Ps, where Pi is a path in Ti ∈ T , and edges e2, e3, . . . , es ∈ F , where each ei connects the endpoint of Pi−1 with the starting point of Pi. If s = 1 then P = P1 and hence (e, e(cid:48)) is a replacement pair in T as well. If e(cid:48) = ei for some 2 ≤ i ≤ s then e(cid:48) ∈ F and the lemma is proven. Otherwise, as e(cid:48) lies on P , e(cid:48) ∈ E(Pj) for some 1 ≤ j ≤ s. Observe that for any 2 ≤ i ≤ s, the pair (e, ei) is a replacement pair in T (cid:48). To finish the proof of the lemma it suffices to show that either (e, e(cid:48)) or (ei, e(cid:48)) for some 2 ≤ i ≤ s is a replacement pair in T . Let x be the first vertex of Pj, y be the last vertex of Pj, and let z be the unique vertex of V (T c) ∩ V (Tj). Since e(cid:48) ∈ E(Pj), the edge e(cid:48) lies either on the unique path between x and z in Tj, or on the unique path between y and z. In the first case, observe that (ej, e(cid:48)) is a replacement pair in T if j > 1, and (e, e(cid:48)) is a replacement pair in T if j = 1. In the second case, symmetrically, observe that (ej+1, e(cid:48)) is a replacement pair in T if j < s and (e, e(cid:48)) is a replacement pair in T if j = s. 26 Lemma 4.12. Let T be a tree in a complete graph GD = (V,(cid:0)V (cid:1), dGD) that does not admit a 2 τ-efficient replacement and let v ∈ V (T ). Let T be the family of connected components of T \ {v} and define the reconnecting edges F v and the reconnected tree T (cid:48) = (T \{v})∪F v as at the beginning of this section. Then T (cid:48) does not admit a τ-efficient replacement as well. Proof. Let (e, e(cid:48)) be a replacement pair in T (cid:48); our goal is to prove that it is not τ-efficient. Apply Lemma 4.11 to the pair (e, e(cid:48)), the family T , tree T c = T [{v} ∪ ΓT (v)] and set F v, and consider the three possible outcomes. If (e, e(cid:48)) is a replacement pair in T as well, then clearly it is not τ-efficient. Otherwise, observe first that for every g ∈ F v such that (e, g) is a replacement pair in T (cid:48), it follows from the choice of F v that dGD(e) ≥ dGD(g). Hence, if e(cid:48) ∈ F v then dGD(e) ≥ dGD(e(cid:48)) and (e, e(cid:48)) is not τ-efficient. Consider now an edge f ∈ F v promised in the remaining case of Lemma 4.11. As (e, f ) is a replacement pair in T (cid:48), we have from the previous reasoning that dGD(e) ≥ dGD(f ). As (f, e(cid:48)) is a replacement pair in T , it is not τ-efficient. Therefore, (e, e(cid:48)) is also not τ-efficient and the lemma is proven. We are ready to describe our dynamic algorithm. Fix an accuracy parameter ε > 0 and denote η := 1 + (cid:100)ε−1(cid:101), that is, η is the smallest positive integer for which η η−1 ≤ 1 + ε. Thus, by Lemma 4.10, Point 2, to obtain a (1 + ε)-approximation of MST (GD[S]) where S is the set of currently active terminals, it is sufficient to maintain a tree T such that 1. S ⊆ V (T ); 2. T is a minimum spanning tree of V (T ) (i.e., T does not admit any 0-efficient replacement); 3. any non-terminal vertex of T is of degree larger than η in T . To achieve this goal, we describe a procedure removeη(v) that checks if a vertex v should be removed from the currently maintained tree T and, if this is the case, performs the removal. 1. If v is a terminal, v /∈ V (T ) or deg T (v) > η, do nothing. 2. Otherwise, delete v and its incident edges from T , and compute the reconnecting edges F v and the reconnected tree T (cid:48) = (T \ {v}) ∪ F v as described in the beginning of this section. Replace T with T (cid:48). Then, recursively invoke removeη on all ex-neighbors of v in T . If we delete v from the terminal set, we first mark v as non-terminal and then call removeη(v). Lemma 4.12 for τ = 0 ensures that, if we initialize T as the minimum spanning tree on the terminal set, then T satisfies all aforementioned three properties and is a (1 + ε)-approximation of MST (GD[S]), where S is the current set of terminals. By Lemma 4.3, we obtain in this manner a 2(1 + ε)µ-approximation of minimum Steiner tree on S in the metric G that is approximated by GD. Lemma 4.13. Assume that an algorithm implements the decremental scheme. Then, it maintains a 2(1 + ε)µ-approximation of minimum Steiner tree of S in G. In the course of the first r deletions, the algorithm performs at most r calls to the procedure removeη that result in a modification of the maintained tree. Moreover, each vertex removed by the procedure removeη is of degree at most η = O(ε−1) in the currently maintained tree. 27 Proof. The approximation ratio follows from the discussion above. The claim about efficiency follows from an observation that removeη modifies the maintained tree only when called upon an non-terminal vertex in the tree of degree at most η, and each deletion operation introduces only one non-terminal vertex. 4.4 Incremental online algorithm We consider here the case when new terminals are added to the terminal set and we are to update the currently maintained tree. Following Imase and Waxman [28] and Megow et al [30], we would like to first connect the new terminal to tree we already have, and then try to apply all occurring (τ /2, 1 + τ )-good replacement pairs, for some τ > 0. The main technical contribution of this section is a proof that it is sufficient to look only at replacement pairs (e, e(cid:48)) where e is incident to the newly added vertex. However, as we would like to use our scheme in conjunction with approximate distance oracles, we need to introduce some additional relaxation in terms of efficiency of conducted replacements. We would like to require that the algorithm does not leave any (τ /2, 1 + τ )-good replacement pair, but any replacement made by the algorithm is only ς-efficient for some 0 < ς ≤ τ /2. The first requirement yields the approximation guarantee, while the latter controls the number of performed replacements. We now proceed with formal description of the incremental scheme. Assume the algorithm operates on a µ-near metric space GD = (V,(cid:0)V parameters τ ≥ 2ς > 0. Define c = 2µ(1 + τ )2. 2 (cid:1), dGD) and we are additionally equipped with At one step, given a tree T and a new terminal vertex v ∈ V \ V (T ), we: 1. add an edge to T connecting v with V (T ) of cost minu∈V (T ) dGD(uv); 2. apply a sequence of ς-efficient replacement pairs (e, e(cid:48)) that satisfy the following additional property: e(cid:48) is a friend of e in the currently maintained tree of maximum possible cost; 3. after all the replacements, we require that there does not exist a (τ /2, c)-good replacement pair (e, e(cid:48)) with e incident to v. To argue about the efficiency of incremental scheme we need to use the fact that graph GD we work on is an µ-near metric space. The next lemma shows that the cost of the optimal tree cannot decrease much during the course of the algorithm. Lemma 4.14. Let T, T (cid:48) be two trees in a µ-near metric space GD = (V,(cid:0)V Proof. Let G = (V,(cid:0)V (cid:1), dGD), such that (cid:1), dG) be a metric space approximated by GD. Let T MST = MST(cid:0)G[V (T )](cid:1) V (T ) ⊆ V (T (cid:48)) and T is a α-approximation of a minimum spanning tree on V (T ), for some α ≥ 1. Then dGD(T (cid:48)) ≥ dGD(T )/(2αµ). be the minimum spanning tree of V (T ) in G (i.e., with regards to weights dG) and let T S be the minimum Steiner tree on the terminal set S = V (T ) in G. Let TMST = MST (GD[V (T )]) be the minimum spanning tree of V (T ) in GD. Note that T MST is a 2-approximation of the minimum Steiner tree on V (T ), whereas T (cid:48) is a (not necessarily optimal) Steiner tree of V (T ). Hence 2 2 dGD(T (cid:48)) ≥ dG(T (cid:48)) ≥ dG(T S) ≥ dG(T MST )/2 ≥ dGD(T MST )/(2µ) ≥ dGD(TMST )/(2µ) ≥ dGD(T )/(2αµ). 28 In what follows we prove that it is sufficient to find replacement edges adjacent to the new terminal. Lemma 4.15. If an incremental algorithm satisfies the scheme above in an µ-near metric space GD then after each step tree T does not admit a (τ /2, 1 + τ )-good replacement pair and, consequently, is a (1 + τ )-approximation of MST (GD[S]) and a 2(1 + τ )µ-approximation of minimum Steiner tree spanning S in G. Proof. Let t1, t2, t3, . . . be a sequence of terminals added to the terminal set, Sk = {t1, t2, . . . , tk} and Tk be the tree maintained by the algorithm after k-th terminal addition, i.e., V (Tk) = Sk. We inductively prove that Tk does not admit a (τ /2, 1 + τ )-good replacement pair; the second part of the lemma follows directly from Lemmas 4.10 and 4.3. The claim for k ≤ 1 is obvious; let us assume that k ≥ 2 and that the statement is true for the trees T1, T2, . . . , Tk−1. First, note that by Lemma 4.8, any tree Ti for i < k is a (1 + τ )-approximation of a minimum spanning tree of GD[Si]. By Lemma 4.14, dGD(Tk) ≥ dGD(Ti)/(2µ(1 + τ )) for any i < k. Assume that there exists a (τ /2)-efficient replacement pair (e, e(cid:48)) in Tk. Assume e = titj where 1 ≤ i < j ≤ k. Let ej be an edge of maximum cost on the unique path between ti and tj in Tj. We now prove the following. Claim 4.16. For any j ≤ j(cid:48) ≤ k, the unique path between ti and tj in Tj(cid:48) does not contain edges of cost greater or equal to dGD(ej). Proof. We use induction on j(cid:48). In the base case j(cid:48) = j the claim follows from the choice of ej. In the inductive step, consider a single replacement pair (f, f(cid:48)) applied by the algorithm. Denote by T 1 (resp. T 2) the maintained tree before (resp. after) the replacement pair was applied, and by P1 (resp. P2) the unique path connecting ti and tj in T 1 (resp. T 2). Assume that no edge on P1 is of cost greater on equal to dGD(ej); we would like to prove the same statement for P2. If P1 = P2 there is nothing to prove so assume otherwise. We have f ∈ E(P2) \ E(P1), f(cid:48) ∈ E(P1) \ E(P2) and, by the efficiency of (f, f(cid:48)), we have dGD(f ) ≤ dGD(f(cid:48)) ≤ dGD(ej). Moreover, observe that each edge f(cid:48)(cid:48) ∈ E(P2) \ ({f} ∪ E(P1)) is a friend of f in the tree T 1. By the choice of f(cid:48), we have dGD(f(cid:48)(cid:48)) ≤ dGD(f(cid:48)) ≤ dGD(ej) and the claim follows. (cid:121) By Claim 4.16, we infer that dGD(e(cid:48)) ≤ dGD(ej), as e(cid:48) lies on the unique path between ti and tj in Tk. Hence, (e, ej) is a (τ /2)-efficient replacement pair in Tj and, moreover, e is incident with tj. By the requirements we impose on the algorithm, (e, ej) is not (τ /(2c))-heavy in Tj, that is: dGD(ej) ≤ τ /2 c · dGD(Tj) V ≤ τ /2 2µ(1 + τ )2 · 2µ(1 + τ )dGD(Tk) V = τ /2 1 + τ · dGD(Tk) V . As dGD(e(cid:48)) ≤ dGD(ej), we infer that (e, e(cid:48)) is not (τ /2, 1 + τ )-good in Tk, and the lemma is proven. We now apply the analysis of [20], i.e. Theorem 4.5, to obtain a bound on the number of replacements performed by the incremental scheme. Lemma 4.17. Assume that an algorithm implements the incremental scheme for some choice of parameters τ ≥ 2ς > 0 with ς = O(1). Then, in the course of the first r additions, the algorithm performs O(rς−1(1 + log µ)) replacements. 29 Proof. Let t1, t2, t3, . . . , tr be a sequence of terminals added to the terminal set, Sk = {t1, t2, . . . , tk} and Tk be the tree maintained by the algorithm after k-th terminal addition, i.e., V (Tk) = Sk. The set of replacement pairs applied by the algorithm can be arranged into a set of r − 1 sequences of the form (e2 k is the edge added to connect tk to Tk−1 at the beginning of the k-th addition step. As each replacement is ς-efficient, we have ), 2 ≤ k ≤ r, where es(k) ∈ E(Tr) and e1 k), . . . , (es(k) , es(k)−1 k), (e3 k, e2 k, e1 k k k s(k) − 1 ≤ log1+ς dGD(e1 k)/dGD(es(k) k ) . (3) (cid:16) (cid:17) Consider now MST (GD[Sr]) and let e2, e3, . . . , er be such a permutation of E(MST (GD[Sr])) k w.r.t. MST (GD[Sr]), for every 2 ≤ k ≤ r. By the properties of a such that ek is a friend of es(k) minimum spanning tree, Altogether, we can bound the number of replacements, equal to(cid:80)r ) ≥ dGD(ek). dGD(es(k) k k=2 s(k) − 1, as follows. (4) r(cid:88) k=2 k=2 log1+ς s(k) − 1 ≤ r(cid:88) ≤ r(cid:88) ≤ O(ς−1)(cid:0)r + log(cid:0)(4µ)r−1(cid:1)(cid:1) dGD(e1 k) dGD(es(k) k dGD(e1 k) dGD(ek) ≤ O(ς−1) (cid:81)r (cid:81)r log1+ς r + log (cid:18) k=2 ) k=2 dGD(e1 k) k=2 dGD(ek) ≤ O(rς−1(1 + log µ)). (cid:19) by (3) by (4) as ς = O(1) by Theorem 4.5 4.5 Fully dynamic online algorithm We now merge the ideas of two previous sections to obtain a scheme for a fully dynamic algorithm. We fix three accuracy parameters τ, ς, ε > 0, where τ controls the efficiency of replacement pairs that are allowed to remain in the tree, ς ≤ τ controls the efficiency of the replacement pairs actually made, and hence the total number of replacements made by the algorithm, whereas ε controls the loss caused by postponing the deletion of high-degree non-terminal vertices from the tree, and hence the degree threshold at which we delete non-terminal vertices from the tree. We aim at (1 + τ )(1 + ε)-approximation of MST (GD[S]) for S being the current set of terminals. As in the decremental step, we define η = 1 +(cid:100)ε−1(cid:101) = O(ε−1), that is, η is the minimum positive integer with η−1 ≤ 1 + ε. In the algorithm, we maintain a tree T spanning a set of terminals and nonterminals. The degree of every nonterminal is greater than η and the tree does not admit any τ-efficient replacements. η In a deletion step, we behave in exactly the same manner as in the decremental scheme in Section 4.3. If we want to delete v from the terminal set, we mark it as non-terminal and call the procedure removeη(v) that tries to remove vertex v from the tree T if v is not a terminal and its degree is at most η. In an addition step, we perform similarly as in the incremental scheme, but there are two significant differences. First, we do not have the guarantee that the cost of the tree will not 30 decrease much in the future (as in Lemma 4.14), so we cannot stop replacing edges at some cost threshold. Second, we need to watch out for non-terminal vertices whose degree may drop to the threshold η as a consequence of a replacement. Formally, to add a vertex v to the terminal set S we perform the following operations on the currently maintained tree T . 1. If v ∈ V (T ), mark v as a terminal and finish. 2. Otherwise, connect v to any vertex of T , initialize an auxiliary set R as R = ∅; and 3. apply a sequence of ς-efficient replacement pairs, where for each such pair (e, e(cid:48)) we require that e(cid:48) has the maximum possible cost among the friends of e; moreover, for each such pair we insert both endpoints of e(cid:48) into the set R; 4. once all replacement pairs are applied, we require that there exists no τ-efficient replacement pair (e, e(cid:48)) with e incident to v; 5. at the end, invoke removeη on all vertices in R in an arbitrary order. We claim the following. Lemma 4.18. If a fully dynamic algorithm satisfies the scheme above, after each step the tree T does not admit a τ-efficient replacement pair and each non-terminal vertex of T has degree larger than η in T . Consequently, T is a (1 + τ )(1 + ε)-approximation of MST (GD[S]) and a 2(1 + τ )(1 + ε)µ-approximation of minimum Steiner tree spanning S in G, where S is the current set of terminals. Proof. The second claim of the lemma follows directly from the first claim and lemmas 4.10 and 4.3. The claim that each non-terminal vertex of T has degree larger than η in T is obvious, as we invoke the procedure removeη on a vertex whenever its degree drops in T . Consider now a step of adding a vertex v to the terminal set. Let T be the tree before this step, and T (cid:48) be the tree obtained after connecting v to the T and performing all replacements, but before the first call to the procedure removeη on an element of R. We claim that if T does not admit a τ-efficient replacement pair, neither does T (cid:48). Assume the contrary. By the definition of T (cid:48), if T (cid:48) admits a τ-efficient replacement pair (e, e(cid:48)), then e is not incident with v (such a pair is henceforth called forbidden replacement pair). Let T 0 be the tree T with v connected to T , and T 1, T 2, . . . , T s = T (cid:48) be the sequence of trees computed by the algorithm; T j is constructed from T j−1 by applying a ς-efficient replacement pair (ej, e(cid:48) j). Note that deg T 0(v) = 1 and it follows from Lemma 4.12 for the vertex v that T 0 does not admit a forbidden replacement pair. By our assumption, T s = T (cid:48) contains a forbidden replacement pair; let i be the smallest integer for which T i contains a forbidden replacement pair, and let (e, e(cid:48)) be any one of them. Note that i > 0. i}, the tree i, and set F = {ei}. By the choice of i, (e, e(cid:48)) is not a replacement T c consisting of a single edge e(cid:48) pair in T i−1, as no forbidden replacement pair exists in T i−1. we have that (1 + τ )dGD(e) < dGD(e(cid:48) components of T i−1 \ {e(cid:48) to v, (e, e(cid:48) i) is ς-efficient, i. As e connects the two connected i) is a τ-efficient replacement pair in T i−1. Since e is not incident We apply Lemma 4.11 to the tree T i−1, the family T being the two trees of T i−1 \{e(cid:48) i}, (e, e(cid:48) Consider now the case e(cid:48) ∈ F , that is, e(cid:48) = ei. As (e, e(cid:48)) is τ-efficient and (ei, e(cid:48) i) and, in particular, e (cid:54)= e(cid:48) i) is a forbidden replacement pair in T i−1, a contradiction to the choice of i. 31 In the remaining case, (ei, e(cid:48)) is a replacement pair in T i−1. As we require e(cid:48) maximum cost among the friends of ei in T i−1, we infer that dGD(e(cid:48) where the last inequality follows from the τ-efficiency of (e, e(cid:48)). In particular, e (cid:54)= e(cid:48) τ-efficient replacement pair in T i−1. Since e is not incident to v, (e, e(cid:48) pair, a contradiction to the choice of i. i to be an edge of i) ≥ dGD(e(cid:48)) > dGD(e)/(1 + τ ), i, and (e, e(cid:48) i) is a i) is a forbidden replacement To finish the proof of the lemma, observe that Lemma 4.12 ensures that a call to the procedure removeη cannot introduce a τ-efficient replacement pair, if it was not present prior to the call. We conclude this section with a note on the efficiency of our fully dynamic scheme. (V,(cid:0)V 2 cost of an edge in GD, and consider a potential Φ(T ) = (cid:80) (cid:1), dGD) with stretch D, and a sequence of r operations, where r+ of this operations are addi- Lemma 4.19. Assume that an algorithm implements the fully dynamic scheme for some choice of parameters τ, ς, ε > 0 with ς ≤ τ and ς = O(1), and is run on an µ-near metric space GD = tions and r− = r − r+ are deletions. Then the algorithm performs O(ς−1(r+ log D + r−(1 + log µ))) replacements, and at most r− calls to removeη procedure that result in a modification of the maintained tree. Moreover, each vertex removed by the procedure removeη is of degree at most η = O(ε−1) in the currently maintained tree. Proof. The second and third bounds follow directly from the fact that removeη modifies the tree only if it is called upon a non-terminal vertex of degree at most η in the tree, and each deletion operation introduces only one non-terminal vertex. For the first claim, let dmin be the minimum e∈E(T ) log1+ς (dGD(e)/dmin). Clearly, this potential is zero at the beginning and never becomes negative. Moreover, each ς-efficient replacement drops the potential by at least one. If we introduce a new edge, we increase the potential by at most (cid:100)log1+ς D(cid:101) = O(ς−1 log D). Consider now a call to the procedure removeη that replaces a vertex v of degree s ≤ η in T with a set F v of s− 1 edges, obtaining the reconnected tree T (cid:48). Let T v = {T1, T2, . . . , Ts} be the connected components of T \{v} and for every 1 ≤ i ≤ s, let ei be the unique edge connecting V (Ti) with v in the tree T , and let ui be the endpoint of ei that belongs to V (Ti). Without loss of generality assume dGD(e1) ≥ dGD(e2) ≥ . . . ≥ dGD(es). Observe that, by Lemma 4.2, for every 1 ≤ i < s we have dGD(uiui+1) ≤ µ(dGD(ei) + dGD(ei+1)) ≤ 2µdGD(ei). Moreover, the set F (cid:48) := {uiui+1 : 1 ≤ i < s} is a valid candidate for the set F v and hence there exists a bijective mapping π : F v → F (cid:48) such that dGD(π(e)) ≥ dGD(e) for any e ∈ F v. We infer that Φ(T (cid:48)) − Φ(T ) ≤ s−1(cid:88) log1+ς (dGD(uiui+1)/dGD(ei)) ≤ log1+ς (2µ) = O(ς−1(1 + log µ)). The lemma follows. i=1 As discussed at the beginning of this section, it does not seem clear if the analysis of incremental algorithm of [20] (i.e., Theorem 4.5) is applicable to our fully dynamic scheme. The usage of this analysis in [21] strongly relies on the assumption that newly added terminals are new vertices in the graph, with distances to terminals already deleted being implicitly defined by the triangle inequality. However, in our model of a fixed host graph G this assumption is no longer valid, hence we need to fall back to the more straightforward analysis of Lemma 4.19. 32 4.5.1 Decreasing the dependence on the stretch of the metric The fully dynamic scheme presented above yields algorithms depending on the stretch of the metric. The dependence in Lemma 4.19 is proportional to log D. However, in some implementations the dependence on log D may be bigger. In this section we present a generic method of avoiding such a dependency, at the cost of additional polylogarithmic factors in n = V . The main idea is similar as in the incremental algorithm: the edges of cost εdGD(T )/n are almost for free, and, consequently, the window of interesting edge costs is of stretch O(n/ε). However, in the fully dynamic algorithm we cannot simply ignore what happens to the tree on low-cost edges, as they may become important in the future, when the cost of the tree decreases significantly. Thus, we adapt a different strategy: for each possible window, we maintain a solution that considers only edges of levels from this window (and assumes the cheaper ones are for free). Formally, we prove the following. Theorem 4.20. Let G be a minor-closed graph class and α, ε > 0 be constants. Assume we are given a fully dynamic algorithm that, given a graph G ∈ G with nonnegative edge weights, n vertices and metric stretch D, initializes in fini(n, log D) time, handles updates (terminal additions and deletions) in fupd(n, log D) time, handles queries on the cost of minimum Steiner tree in fq(n, log D) time with approximation guarantee α, and uses fmem(n, log D) memory. Assume additionally that all fini, fupd, fq are non-decreasing with respect to their parameters and that fini and fmem are convex and at least linear in n. Then there for some ∆ = O(ε−1 log(ε−1n)) there exists a fully dynamic algorithm that initializes in O(fini(n, ∆)ε−1 log D) time, handles updates in O(fupd(n, ∆)ε−1 log D) time, handles queries in fq(n, ∆) + O(1) time with approximation guarantee (α + ε) and uses O(fmem(n, ∆)ε−1 log D) memory. Before we dive into the depths of the proof of Theorem 4.20, we would like to clarify that this theorem operates on the actual graph G and the metric space G being the closure of the edge weights of G. In other words, all distance oracles and subsequent µ-near metric spaces approximating G are hidden inside the assumed fully dynamic algorithm. (cid:1), dG) be the metric closure of G, recall that n = V . Let us introduce levels Proof. Let G = (V,(cid:0)V 2 of edge weights in G as follows. Let β = β(ε) = 1 + ε and for any u, v ∈ V , we define the level of uv, lvl(uv), as (cid:98)logβ d(uv)(cid:99), i.e., βlvl(uv) ≤ dG(uv) < βlvl(uv)+1. Let a be the smallest integer such that if for any two edges e, e(cid:48) we have lvl(e(cid:48)) − lvl(e) ≥ a then dG(e) < dG(e(cid:48))/n. Similarly we define b to be the minimum difference in levels that guarantee a ratio of costs of at least ε/n. Note that a = O(ε−1 log n) and b = O(ε−1 log(ε−1n)). We fix ∆ = a + b. For an integer i, we define a binary relation Ri on V as follows: (u, v) ∈ Ri iff there exists a path between u and v in G whose each edge is of level at most i. Note that, equivalently, we may require that this path resides in G, as the weights of edges in G are nonnegative. It is easy to see that Ri is an equivalence relation; let V i be the set of its equivalence classes and, for any v ∈ V , vi(v) is the equivalence class of v in Ri. For a fixed level i, let Gi be a graph constructed from G as follows: we contract all edges of G of level at most i − b, and we delete all edges uv, where (u, v) /∈ Ri+a. Note that V (Gi) = V i−b and each connected component of Gi corresponds to one equivalence class of Ri+a. Moreover, Gi is a minor of G and can be constructed in linear time. 33 Let di be the metric on V (Gi) = V i−b induced by the weights of the edges of Gi. Let v and v(cid:48) be two distinct vertices of the same connected component of Gi. As v and v(cid:48) can be connected with a path with edges of level at most i + a, we have di(vv(cid:48)) < (n − 1)βi+1+a and therefore lvl(vv(cid:48)) ≤ i + O(ε−1 log n) in the metric di. As we contracted all edges of level at most i − b in the process of obtaining the graph Gi, we have lvl(vv(cid:48)) > i − b. Since b = O(ε−1 log(ε−1n)), we infer that the logarithm of the stretch of the metric di is at most ∆ = O(ε−1 log(ε−1n)). Intuitively, the graph Gi contains all the information we need to construct the approximate Steiner tree for a given set of terminals, if the most expensive edge of such a tree would have level roughly i. We run several copies of the assumed fully dynamic algorithm: for each level i out of log1+ε D = O(ε−1 log D) levels and for each c ∈ V i+a we create a copy of the fully dynamic algorithm Ai c created on the connected component c of the graph Gi. At any time, if S is the current set of terminals in G, a vertex v ∈ V (Gi) is a terminal in Ai c where v ⊆ c if v ∩ S (cid:54)= ∅. Denote Si = {v ∈ V (Gi) : S ∩ v (cid:54)= ∅}. Note that the memory usage of the structures is as promised due to convexity of fmem. At initialization, note that the construction of the graph Gi takes time linear in V (G)+E(G), and, therefore is subsumed by the time taken to initialize the fully dynamic algorithms. The initialization time follows from the assumptions on the convexity of fini. To handle updates (additions and deletions from the terminal set), for each level i and for each v ∈ V (Gi) = V i−b we keep a counter how many terminals of S are contained in v. An addition or deletion of a vertex v from the terminal set results in a change of the counter at each of the O(ε−1 log D) levels; if at any level the counter changes from 0 to 1 or from 1 to 0, an operation (addition or deletion) is performed on Ai c, where v ⊆ c ∈ V i+a. The promised update time follows. To handle queries, first, for each level i, we define Fi to be an (arbitrarily chosen) spanning forest of the subgraph of G that contains exactly those edges that have level at most i. Note that Fi can be constructed in linear time for each i at the time of initialization. Let us define i(S) to be the minimum level where all terminals are contained in the same equivalence class c(S) ∈ V i(S). Assume c(S) ⊆ c(cid:48)(S) ∈ V i(S)+a, that is, let c(cid:48)(S) be the equivalence class of Ri(S)+a that contains S. Let T be the tree maintained by Ai(S) c(cid:48)(S) and let H be the edge-induced subgraph of G that contains all edges of T as well as Fi−b. Clearly, H contains a connected component that spans S in G. We claim that the total cost of all edges of H is a good approximation of the cost of the minimum spanning tree of S in G and, consequently, a good approximation of the cost of the minimum Steiner tree of S in G. Let TOP T be any such minimum Steiner tree of S in G. By the definition of i(S), any tree spanning S in G needs to contain at least one edge of level at least i. Hence, dG(TOP T ) ≥ βi. On the other hand, by the definition of b, dG(Fi−b) ≤ (n − 1) · εβi/n < εβi ≤ εdG(TOP T ). As S ⊆ c(S) ∈ V i(S), Fi contains a connected component that spans S and, consequently, dG(TOP T ) ≤ dG(Fi) < (n − 1)βi+1. By the definition of a, dG(TOP T ) < βi+a, so TOP T does not contain any edge of level i + a or higher. We infer that V (TOP T ) ⊆ c(cid:48)(S) and, by construction of Gi, the cost of a minimum Steiner tree of Si in Gi is at most dG(TOP T ). Therefore, the tree maintained by Ai(S) c(cid:48)(S) has cost at most αdG(TOP T ). We infer that dG(H) ≤ (α + ε)dG(TOP T ). We note that the value of i(S) can be updated after each addition or deletion operation by counting the number of terminals in each connected component of each graph Gi. Thus, to handle a query we need to query one algorithm Ai(S) c(cid:48)(S) and to look up the precomputed cost of the forest Fi(S)−b. The query time follows. 34 5 Dynamic vertex-color distance oracles In this section we construct dynamic vertex-color distance oracles that we later use to implement algorithms from Section 4. Their interface, as well as some basic definitions have been introduced in Section 3.2. This section covers the construction that allows us to extend any generic oracle to a vertex-color distance oracle. Moreover, we show how to build generic oracles for general and planar graphs. In the end, we obtain an incremental vertex-color distance oracle for planar graphs, and fully dynamic oracles, both for planar and general graphs. 5.1 Generic construction In the Section 3.2 we defined a list of queries and update operations that our oracles should support. In this section we present generic implementations of the two schemes introduced in the previous section. The constructions presented here are generic in a sense that no specific choice of portals or pieces is imposed. Instead, the running times and space requirements are measured in terms of a few general parameters: v∈V portals(v) is the (expected) total number of vertex-portal connections, • pnum = P is the (expected) total number of portals, • pmax = maxv∈V portals(v) is an upped bound on the (expected) number of portals assigned r∈R r is the (expected) total size of all pieces, • rnum = R is the (expected) total number of different pieces, • r# • rmax = maxv∈v pieces(v) is an upper bound on the (expected) number of pieces assigned to max = maxr∈R r is an upper bound on the (expected) size of a piece, • ptot =(cid:80) to a vertex, • rtot =(cid:80) a vertex, • atot =(cid:80) v∈A portals(v), where A is a set of vertices activated by the oracle, is the (expected) total number of vertex-portal connections over vertices that were activated by the oracle. Note that some of our constructions are randomized, and then we measure the quality of the oracle in expectation. We also assume that all these values are bounded polynomially in n, and hence the logarithm of any of it can be bounded by O(log n). The problem one deals with in our oracles is finding the vertex-set portal distances. The piece distances are easy to find: upon a query it suffices to run single source shortest paths [24] algorithm from v in every piece of pieces(v) and compare the distances. This section is mostly devoted to designing a data structure able to find portal distances. To that end, for a portal p and color i we define N p i to be the distance between p and the nearest vertex in cluster(p) that has color i. Every portal p holds a heap Hp, where it stores the values N p i that correspond to active colors in cluster(p). The main goal of this section is to describe how to update the values N p i and heaps Hp as colors of vertices are modified. 35 Lemma 5.1. Assume we are given an α-approximate generic distance oracle for G. One can main- tain expected constant-time access to the values N p i and deterministic constant-time access to heaps Hp in O(atot log n) total expected time under an arbitrary sequence of activate(i) and merge(i, j) operations. The data structure requires O(ptot) space and can be initialized in O(ptot log n) time. The data structure can be derandomized, at the cost of increase to total O(atot log n log log n) running time, and O(log log n) time to access a single value of N p i . Proof. Every update operation affects vertices of some color and all their portals. Thus, for every color i we define a set of pairs L(i) = {(v, p)v ∈ Ci, p ∈ portals(v)} and maintain it as a list. Note that the total size of all those lists is exactly ptot and at the beginning all the colors are inactive. Recall that colors have to be activated first in order to be merged. The total size of the lists of colors that will be activated during the runtime of the oracle is atot. On the remaining lists no operations will ever be executed. As mentioned before, each portal p ∈ P holds a heap Hp storing distances N p i we store on Hp the vertex that provides N p i in cluster(p). Together with N p cluster(p) of color i whose distance from p is N p store pairs N i = (N p p i in a heap, sorted according to the first coordinate only. i . We define N i to all active colors i , i.e., the vertex v in i , v) to be such a pair. We p At the beginning, all colors are inactive. Every portal p initializes Hp to be an empty heap. In addition to Hp, every portal maintains two dictionaries, where one can add/remove (key,value) pairs and look up keys in time O(tdict) per operation; we address the choice of the dictionary, and henceforth determine the value of tdict, at the end of the proof. A dictionary of inactive distances, p Ip, stores pairs (i, N i ) for every inactive color i which has a nonempty intersection with cluster(p). p Initially, every portal iterates over its cluster and computes pairs (i, N i ) based on stored distances Dp,v. Every portal also holds a dictionary of active colors Ap, which stores pairs (i, q) for every p i is stored. Initially active color i in cluster(p), where q is a pointer to a position on Hp where N Ap is empty. p i to Hp and (i, q) to Ap, where q is a pointer to N To perform activate(i) it suffices to update all relevant heaps Hp with information about color p i ) from Ip (if it is there) p i on Hp. This is done at most once i. We iterate over elements of L(i) and for each pair (v, p) we remove (i, N and add N for each of the O(atot) pairs, so the total time of this operation is O(atot(log n + tdict)). Now, consider a merge(i, j) operation, and keep in mind that both i and j are active. Without loss of generality, we may assume that L(i) ≤ L(j). We change the color of all vertices in Ci to j. To be more precise, we iterate over L(i) and for each pair (v, p) we: remove i, j from Ap, set N we remove (i, q) from Ap and add (j, q) to Ap, do nothing p j = min(N p i , N p j ) and insert N p j to Hp and Ap if i, j ∈ Ap if i ∈ Ap, j /∈ Ap if i /∈ Ap Finally, we append list L(i) to L(j) in O(L(i)) time. Note that for each appended pair, the length of the list it belongs to doubles. Since the active list length is bounded by atot, each of atot pairs will change its list at most O(log atot) = O(log n) times. Each such list change of a pair may trigger a dictionary update and a heap update. The total time for list merging, iterating and dictionary modifications is therefore O(atottdict log n). We will bound the number of operations on heaps separately. Note that only when i, j ∈ Ap the merge is effective in cluster(p) and O(log n) operation on a heap is triggered. Otherwise, if j /∈ Ap, only Ap is modified and not Hp. For every portal p we effectively merge colors in its cluster at most 36 a heap is(cid:80) time. cluster(p)∩A−1 times, where A is the set of activated vertices. So the number of times we modify v∈A portals(v) = O(atot). This gives the total running time of O(atottdict log n). Observe that each heap Hp can be accessed in constant time, and each value N p i in O(tdict) Finally, we address the choice of the dictionaries. If use hash maps to implement dictionaries, then we obtain tdict = O(1) in expectation. As an alternative, observe that every used dictionary uses color numbers as keys. Hence, one might use Y-fast-tries [38] yielding a slightly worse but deterministic tdict = O(log log n) worst case time. Lemma 5.2. Assume we are given an α-approximate generic distance oracle for a weighted graph G = (V, E, d). Let n = V . One can maintain constant-time access to the values N p i and heaps Hp, under a sequence of activate(i), deactivate(i), merge(i, j) or split(l, i, j) operations. Each operation requires O(pnum log n) worst case time. The data structure uses O(ptot log n) space and can be initialized in O(ptot log n) time with arbitrary forest T1, . . . , Tk spanning V (G) corresponding to colors C1, . . . , Ck. Proof. In the proof we use Euler tour trees introduced in [35], called further the ET-trees. An ET-tree represents an Euler tour of an arbitrary unrooted tree T , i.e., a tour that traverses each edge of the tree twice, once in each direction. More formally, each edge of T is replaced with two oppositely directed edges and a directed self loop is added in every vertex. We represent the Euler tour of the resulting graph as a balanced binary tree that allows join and split operations. The tree has a single node for every edge of the tour, and the nodes are arranged in the same order as the tour. The trees represented in this way can be linked by adding an edge or split by removing some edge (i.e., they support link and cut operations), and the corresponding ET-trees may be updated by joining and splitting the representing binary trees. Each of these operations can be implemented in O(log n) time. ET-trees can also support typical extensions of binary search trees, including associating keys with vertices and finding the minimum over all the keys in the tree. Note that the keys of vertices of T are associated with the self loops in the Euler tour representation. Thus, for every node of T , the ET-tree has a single node holding its key. On the other hand, some nodes of the ET-tree may not correspond to any node of T . In our data structure, for each color Ci we maintain the corresponding tree Ti as an ET-tree ETi. We associate a key of size O(pnum) with every node of ETi. Hence, each operation on ETi requires O(pnum log n) time. Let us now describe the keys in detail. Consider a color i, a node x of ETi and a portal p. The subtree of ETi rooted at x corresponds naturally to some set of vertices of color i. Denote this set by Ci(x). In particular, the entire ETi corresponds to Ci. We define N p i (x) to be the distance between p and the nearest vertex that belongs both to Ci(x) and cluster(p). A key associated with x is a list L(x) of pairs (p, N p i (x)). The list is sorted according to some (arbitrary) linear ordering of portals. This allows us to compute the key of any node in ETi in O(pnum) time, using the keys stored in the child nodes. In order to save space, if a subtree of ETi rooted at a node x does not contain any nodes from cluster(p), we do not store the list element for portal p in the list L(x). Let us bound the total length of all lists L(x) in all ET-trees. Consider a vertex v. It belongs to exactly one node x of some ET-tree and may cause that O(portals(v)) elements appear in every list on the path from x to the root of the corresponding ET-tree. Since the depth of each tree representing an 37 O((cid:80) spanning V (G) and representing colors C1 . . . Ck, in O(ptot log n) time. ET-tree is O(log n), the total length of all lists L(x), as well as the space usage of all ET-trees is v∈V portals(v) log n) = O(ptot log n). They can also be initialized, given any forest T1 . . . Tk Clearly, each value N p i can be extracted from the root of the tree ETi. In order to enable constant lookup of values N p i , useful for efficient distance queries, for each color i we store a deterministic dictionary of Hagerup et al. [23]. A dictionary with k entries can be initialized in O(k log k), and allows constant time access. It uses O(k) space. Since every operation affects at most two colors, we can afford to rebuild the affected dictionaries after every operation in O(pnum log n) time. A merge(i, j) or split(l, i, j) operation can be handled with a single operation on one of the ET-trees. Each such operation may affect at most two elements of each heap Hp. Thus, updating both the ET-trees and the heaps Hp requires O(pnum log n) time. The activate(i) and deactivate(i) operations do not affect the values N p i , but they may affect the heaps Hp. Again, it takes O(pnum log n) time to update them. We remark here that, contrary to the previous lemma, we have O(pnum log n) deterministic worst case time for each operation, as we can afford to use always Y-fast-tries to maintain pointers to all colors present in a heap Hp. In our data structures we also need to find vertices of a given color in a particular piece. Using the data structures from the above lemma, for a given vertex, we may determine its color in O(log n) time. This can be achieved by simply maintaining a pointer from each vertex to the corresponding node in an ET-tree. Once we find this node, we need to find the root of its ET-tree which requires O(log n) time. However, if the total number of distinct pieces is small, we may use a slightly faster approach. Lemma 5.3. Assume we are given an α-approximate generic distance oracle for a graph G = (V, E, d). Let n = V . There exists a data structure that allows to list all vertices of a given color in a given piece, and list all active vertices in a given piece. Both lists are computed in time that is linear in their size. The data structure can be initialized in O(rtot log n) time and updated after every activate(i), deactivate(i), merge(i, j) or split(l, i, j) operation in O(rnum log n) worst case time. It requires O(rtot log n) space. Proof. For each color i we maintain yet another ET-tree (cid:103)ET i corresponding to tree Ti associated with Ci. Consider a piece r ∈ R and a node x of (cid:103)ET i. We define x to be r-heavy if either x corresponds to a vertex v ∈ r, x is a root of(cid:103)ET i, or x has r-heavy nodes in both subtrees. For a node y of(cid:103)ET i (not necessarily an r-heavy one) we extend the key associated with y with a list L(y) of triples (r, lef tr(y), rightr(y)), where r is a piece. Let z and z(cid:48) be the highest r-heavy vertices in left and right subtree of y respectively. Then, lef tr(y) and rightr(y) are pointers to the position of r in L(z) and L(z(cid:48)) respectively. We do not store such a triple in L(y) if none of the subtrees contains an r-heavy node. The list L(y) is sorted according to some arbitrary linear order on pieces. Note that we are able to calculate values of lef tr(y) and rightr(y) using the keys stored in the sons of y. This allows us to compute the key of a node of (cid:103)ET i in O(rnum) time, so each ET-tree Consider r-heavy vertices of (cid:103)ET i. Together with lef tr and rightr pointers they form a binary operation requires additional O(rnum log n) time. tree, whose leaves correspond to vertices of piece r. Since the size of a binary tree is linear in the 38 number of its leaves, the pointers allow us to iterate over all vertices of color i in a piece r in linear time. a corresponding vertex x of(cid:103)ET i and a root of(cid:103)ET i using O(log n) space. Summing over all vertices We store information about an arbitrary vertex v of a color i in a piece r only on a path between of all pieces, we get a space usage bounded by O(rtot log n). To allow listing all active vertices in a piece for each piece r we maintain a set (represented as a balanced tree) containing all active colors of vertices in piece r. After each update operation we update all sets in O(rnum log n) time. To list all active vertices in r we iterate over active colors in r and list all their vertices in r. Lastly, we note that we need to access elements of lists L(y) in the roots of all ET-trees in constant time. In order to achieve that, after some ET-tree is updated, we build a deterministic dictionary [23] in O(rnum log rnum) = O(rnum log n) time. In the next two lemmas we show that our template for distance oracles is sufficient to implement the schemes of Section 4. Lemma 5.4. Assume we are given an α-approximate generic distance oracle for a weighted graph G = (V, E, d). Let n = V . One can implement the incremental scheme in O(pmax log n) expected amortized time per update and O(rmaxr# max + pmax) expected time per query operation. The data structure requires O(ptot) space and can be initialized in O(ptot log n) time. The algorithm can be derandomized at the cost of increase to O(pmax log n log log n) amortized time per update and O(rmaxr# max + pmax log log n) worst case time per query operation. Proof. According to Lemma 5.1, there is a data structure that can maintain heaps Hp with distances i for every portal p ∈ P in total expected time O(atot log n) (or O(atot log n log log n) deterministic N p time), using O(ptot) space and O(ptot log n) time for initialization. The incremental oracle starts with all vertices assigned to distinct inactive colors. Hence, the number of update operations is at least A, where A is the set of vertices active at the end. Clearly, atot log n = O(Apmax log n) and hence the amortized time per update is O(pmax log n). Now we move on to handling distance queries. Note that in the proof of Lemma 5.1 we iterated through all vertices that changed color upon every merge operation. So it is possible to maintain a flag in each vertex which allows checking the color of a vertex in constant time. Consider distance(v, i) query. In order to find a piece distance from v to the closest vertex of color i, we run the linear time single source shortest paths algorithm for planar graphs [24] in every piece in pieces(v) with a source at v. We then check the colors of all the vertices visible from v and choose a minimum distance among the vertices of color i. In order to find a portal distance we iterate through portals(v) and compute minp∈portals(v)(Dp,v + N p i ). Recall that the dynamic dictionary we use allows portals to access values N p in expected constant time (or O(log log n) i deterministic). Therefore answering distance(v, i) query takes expected O(rmaxr# max + pmax) time (or O(rmaxr# max + pmax log log n) deterministic time). Consider now nearest(v, k) query. In order to find the shortest piece distance from v to some active color, we again iterate through all vertices that are piece-visible from v, and among these choose the closest to v active vertex. To find the shortest portal distance, we compute minp∈portals(v)(Dp,v + top(Hp)), where top(Hp) is the minimum distance stored on Hp. We take the minimum over piece and portal distance, and based on the vertex associated with this distance (recall that on heaps Hp we store pairs (N p i , v)) we decide which active color is the closest to v. 39 (cid:83) max + pmax) time. Next, we repeat this procedure k − 1 times, and in l'th This takes O(rmaxr# iteration we ignore the distances to l − 1 closest colors we found already. So if at l'th iteration i1, . . . , il−1 are the first l − 1 closest colors, then we look in this iteration for an active vertex in set i Ci \ (Ci1 ∪···∪ Cil−1). To that end, we iterate through vertices that are piece-visible from v and find the closest to v vertex of a color we are interested in. Then we iterate through portals and for every p ∈ portals(v) we find l smallest elements in a heap Hp. Since l ≤ k = O(1), this can be done in constant time. From these l elements, we select the minimum element that does not correspond to one of i1, . . . , il−1. The procedure is repeated k times and, if k = O(1), every step takes as much time as finding the nearest active vertex. Hence the total time to answer nearest(v, k) is O(rmaxr# max + pmax) if k is constant. Lemma 5.5. Assume we are given an α-approximate generic distance oracle for G = (V, E, d) and let n = V . One can implement the fully dynamic scheme in O((pnum + rnum) log n) worst case time per update and O(rmaxr# max + pmax) worst case time per query operation. The data structure requires O((ptot + rtot) log n) space and can be initialized in O((ptot + rtot) log n) time. Proof. Here we employ the data structure of Lemma 5.2 to maintain heaps Hp and for a constant for each portal p ∈ P. Recall, that this data structure requires O(ptot log n) time access to N p i space and the same initialization time. It allows updates in O(pnum log n) worst case time. Hence, the only thing left to do is to handle distance queries. This is done in the same manner as in the proof of Lemma 5.4 with one difference. The update operations do not iterate through all vertices that change color, so we cannot maintain a color flag in each vertex so that it knows what color it is. We could access the color of a vertex via ET-tree ETi containing it, but that takes O(log n) time per vertex. Lemma 5.3 comes in useful here. We maintain a structure which requires O(rtot log n) space and the same initialization time, and can be updated in O(rnum log n) worst case time. This structure allows us to list all vertices active colors within a given piece. Recall that in order to answer distance queries we first find the related piece distance and compare it with a portal distance. In order to find the piece distance, for each piece r ∈ pieces(v) we list all active vertices in this piece and mark their colors in some global array. We run the linear time single source shortest paths algorithm [24] on r with the source at v in order to find the distances from v to vertices in r. Then we iterate through vertices w ∈ r, and knowing their color from the global array, we choose the closest vertex we are interested in. This takes linear time per piece by Lemma 5.3. Finding the portal distances is essentially the same as in the proof of Lemma 5.4, with one small difference: the heaps Hp can be easily modified to store triples (N p i , w, i), where w is the vertex corresponding to distance N p i and i is its color, so that when we know the colors of vertices in the heaps Hp. The Query time of O(rmaxr# max + pmax) follows. Corollary 5.6. Assume we are given an α-approximate generic distance oracle for G = (V, E, d) and let n = V . One can implement the fully dynamic scheme in O(pnum log n) worst case time per update and O(rmaxr# max log n + pmax) worst case time per query operation. The data structure requires O(ptot log n) space and can be initialized in O(ptot log n) time. Proof. Instead of using structure of Lemma 5.3, we pay an additional logarithmic factor per distance query, as while iterating through a vertex seen by the queried vertex v, we additionally check its color using the ET-trees. 40 Initialization Query Incremental O(ptot log n) Fully dynamic 1 Fully dynamic 2 linear linear O(rmaxr# O(rmaxr# O(rmaxr# O(rmaxr# max + pmax) exp. max + pmax log log n) det. max + pmax) max log n + pmax) Update O(pmax log n) O((pnum + rnum) log n) O(pnum log n) Table 2: Summary of our generic constructions of vertex-color oracles. 5.2 3-approximate oracles for general graphs In the previous section we showed how to efficiently implement the incremental and fully dynamic vertex-color distance oracle scheme. These constructions were based on generic oracles, which provide an choice and assignment of portals and pieces to vertices in the graph and store partial information about the distances in the graph. In other words, we showed how to implement both schemes given portals and pieces. Here we show how to choose portals and pieces, i.e., how to construct generic oracles. In principle we want to keep the right balance between the parameters introduced in the previous section in order to obtain the best running times. It is based on ideas by Thorup and Zwick [37]. The first generic oracle we present here is a 3-approximate generic oracle for general weighted graphs. In their construction, however, the procedure that measures distance between u and v may give different results when the two vertices are swapped. This does not comply with Definition 3.4, which requires symmetry in answering queries, that is, if the portal distance between two vertices u and w is finite, it has to be the same in pieces(u) and pieces(w). Also, our data structures measure distance between some vertex and the nearest vertex of some given color. We extend the construction, so that the oracle works on portal and piece distances, which are invariant under swapping vertices. Some additional properties that we obtain are summarized in Section 5.4. √ Lemma 5.7. Let G = (V, E, d) be a weighted graph, n = V and m = E. In O( n(m + n log n)) √ expected time we can build a 3-approximate generic distance oracle for G that uses expected O(n n) space. The set of portals P ⊆ V of size O( n) is the same for every vertex, i.e., portals(v) = P for every v ∈ V . Moreover, for each v ∈ V , pieces(v) contains a single graph that is a star on n) vertices (in expectation), whose center is v. The parameters of the oracle are as in Table 3. O( Proof. We choose P ⊆ V uniformly at random with probability 1/ n, so in expectation it is a subset √ of V of size n) in expectation and the expected number of portals assigned to a vertex is pmax = O( n). Also, n) in expectation. For each w ∈ V we define pw to the sum of sizes of all clusters is ptot = O(n be the portal which is closest to w, i.e. δ(w, pw) = minp∈P δ(w, p). By Bw we denote the set of vertices that are closer to w than any portal, i.e. Bw = {v ∈ V : δ(w, v) < δ(w, pw)}. In principle our goal is to create a single piece per vertex (i.e., rmax = 1). A star w × (Bw \ {w}) satisfies all the requirements but the symmetry, that is the piece distance between u and w may be different when measured in pieces(u) from the one given by pieces(w). In order to ensure the symmetry, w ⊆ Bw. The reduction, for every vertex w, removes from Bw vertices u ∈ Bw we reduce Bw to Bred such that w /∈ Bu. For every w ∈ V we declare pieces(w) to contain a single graph r with the n. For each v ∈ V we set portals(v) = P, so the number of portals is pnum = O( √ √ √ √ √ √ 41 parameter value √ ptot O(n n) rmax 1 r# √ max O( √ pnum n) O( √ pmax n) O( n) Table 3: Summary of parameters: all parameters but rmax are in expectation. n). w , the edge set E(r) = {uw : u ∈ Bred w \ {w}} and the weights on the edges vertex set V (r) = Bred w \ {w}. As shown in [37], the expected size of each Bw, and dr(w, u) = δG(w, u) for every u ∈ Bred √ consequently of each piece r# max = O( To build the oracle we pick P, compute shortest path distances from every vertex of P using Dijkstra's algorithm, and store the distances. To obtain distances from w to vertices of Bred w , we also run a modified version of Dijkstra's algorithm starting from each w ∈ V to find shortest distances inside Bw. We break the execution of the algorithm as soon as we visit a vertex from P,5 and store this vertex as pw. The total time of running shortest paths algorithms from all portals is P · O(m + n log n) = √ √ n(m + n log n)). Computing the distances for sets Bw requires n · O(m/ √ √ O( n) = n(m + n log n)) expected time. To store resulting distances and graphs we require O(n O( n) expected space. Let us now prove that we obtain a generic oracle. Consider two vertices u and w. If u ∈ Bred w , then, by the construction, w ∈ Bred and the shortest distance between them can be measured exactly both by inspecting pieces(u) and pieces(w). Now, assume u /∈ Bred w . This means that u /∈ Bw or w /∈ Bu. Without loss of generality, assume u /∈ Bw. This implies δ(u, w) ≥ δ(w, pw). Then, δ(w, pw) + δ(pw, u) ≤ δ(w, pw) + (δ(pw, w) + δ(w, u)) ≤ 3δ(u, w). Obviously pw ∈ portals(v)∩ portals(w). n + n log n/ √ u We now turn the oracle of Lemma 5.7 into a vertex-color distance oracle. Theorem 5.8. Let G = (V, E) be a graph, n = V . There exists a 3-approximate vertex-color distance oracle for G, which: • may answer distance(v, i) and nearest(v, k) queries in O( n log n) expected time, provided that k is a constant, √ • handles merge(i, j, u, v), split(l, u, v), activate(i) and deactivate(i) operations in O( n log n) √ expected time, • can be constructed in O( • uses expected O(n √ n log n) space. √ n(m + n log n)) expected time, √ Proof. We use Lemma 5.7 to construct a generic 3-approximate oracle in O( expected time using expected O(n We plug this parameters into Corollary 5.6 and obtain what is claimed. n(m + n log n)) n) space. The parameters of this oracle are shown in Table 3. √ We also observe that, using the ideas of [37], we can improve the running time at the cost of worse - but still constant - approximation ratio. 5This modification is described in detail in [37]. 42 Theorem 5.9. Let G = (V, E) be a graph, n = V and l be a parameter. There exists a (2l − 1)- approximate vertex-color distance oracle for G, which: • answers distance(v, i) and nearest(v, k) queries in O(ln1/l) expected time, provided that k is a constant, • handles merge(i, j) and activate(i) operations in O(ln1/l log n) amortized expected time, • can be constructed in O(lmn1/l + ln1+1/l log n) expected time, • uses expected O(ln1+1/l) space. Proof. We again follow the ideas of [37]. In particular the construction is the same as in Lemma 7.5. In O(lmn1/l) we compute for each v ∈ V a set B(v) called a bunch. The expected size of each bunch is O(ln1/l). From the query algorithm in [37] it follows that for any two u, v ∈ V there exists w ∈ B(u)∩B(v) such that δ(u, w)+δ(w, v) ≤ (2l−1)δ(u, v). For every vertex v, we set portals(v) = B(v) and pieces(v) = ∅. We obtain the expected total number of portals ptot = O(kn1+1/l) and the expected number of portals per vertex pmax = O(ln1/l). The number of pieces assigned to a vertex is rmax = 0. By Lemma 5.4 (see Table 2), we obtain an incremental oracle using total O(ln1+1/l) expected space, which is initialized in O(lmn1/l + ln1+1/l log n) expected time, handles updates in O(ln1/l log n) amortized expected time and handles queries in O(ln1/l) expected time. 5.3 (1 + ε)-approximate oracles for planar graphs In this section we show how to employ generic oracle constructions from Section 5.1 in order to obtain dynamic (1 + ε)-approximate vertex-color distance oracles for planar graphs. We are able to obtain a better approximation and, for the incremental variant, better running times, due to planar separators. The separators are used to construct small sets of portals. We follow here the construction of Thorup [36], extending it slightly in order to support vertex colors. The base building block of the construction is the following: Lemma 5.10. Let G = (V, E) be a planar graph, Q be a shortest path in G of length at most α, n = V and ε > 0. There exists a set P ⊆ V of size O(ε−1) such that the following holds. Let u, v ∈ V . Assume that the shortest path between u and v crosses Q and δG(u, v) ∈ [ α 2 , α]. Then, there exists p ∈ P such that δG(u, v) ≤ δG(u, p) + δG(p, v) ≤ (1 + ε)δG(u, v). The set P can be computed in O(n) time. Proof. The set P is constructed by putting portals on the path Q. We let the first portal be the first vertex of Q, and then put portals one by one, each at a distance ε 4 d(Q) from the previous one. If this would require us to put a portal on an edge e of Q, we put two portals in the two endpoints of e. Clearly, P = O(ε−1). It remains to show that the oracle correctly approximates distance between u and v. Let Xv,u be the shortest path connecting u to v. Assume that it crosses Q in vertex q ∈ G. Let pq ∈ P be the portal closest to q, that is, δ(q, pq) ≤ ε 4 d(Q). Then δ(u, v) ≤ δ(v, pq) + δ(pq, u) ≤ d(Xv,u) + d(Q) ≤ d(Xv,u) + ε 2 ε 2 α ≤ (1 + ε)d(Xv,u), as requested. 43 We now show how to use the above Lemma to construct an oracle that may answer queries about any two vertices in the graph. This construction was done by Thorup [36], but we need to extend it slightly in order to support vertex colors. First, we fix α and show how to build a generic oracle that finds all distances in range [ α 2 , α]. k of diameter O(α), which The construction begins by replacing G with a set of graphs Gα carry all necessary distance information, and then building a recursive subdivision for each Gα i . The division is obtained by using paths of length ≤ α as separators. Consider a recursive call for a subgraph G(cid:48) and one of the separator paths Q. We run the construction of Lemma 5.10 on G(cid:48) and Q and then add all vertices of P to the portal sets of all vertices of G(cid:48). 1 . . . Gα Finally, we repeat the construction for log D different values of α, so that the intervals [ α 2 , α] altogether cover the entire range of possible distances. Lemma 5.11 ([36]). Given a planar G and a scale α we can construct a series of graphs Gα satisfying the following properties: 1 , . . . , Gα k i is planar), i is linear in the size of G, is a minor of G (in particular, every Gα i • the total number of vertices and edges in all Gα • Gα • each Gα • each Gα • each vertex v has index τ (v) such that a vertex w is at distance d ≤ α from v in G if and τ (v); this also holds after removing the i has exactly one vertex obtained by contractions, which we call a supervertex, i has a spanning tree T α i of depth at most 3α rooted in the supervertex, only if d is the shortest distance from v to w in Gα supervertex, • each vertex v is in exactly three graphs: Gα τ (v)−1, Gα τ (v) and Gα τ (v)+1 Let L<i =(cid:83)i−1 Proof sketch. For the full proof we refer to [36]. We construct a partition of V (G) into layers Li. j=0 Lj. We arbitrarily choose vertex v0 and let L0 = {v0}. Layer Li+1 contains new vertices reachable from vertices of Li within the distance of α, i.e., all reachable vertices not in previous layers. To create Gα i we take a subgraph of G induced by L<i+2 and contract vertices of L<i−1. For a vertex v in G we let τ (v) be the index of its layer. Note that any path starting in v of length at most α is contained in Gα τ (v) and does not cross the contracted supervertex. As a consequence of the above, each distance query concerning v can be answered by accessing τ (v), provided that the corresponding distance is at most α. In our construction we also use the Gα following Lemma for finding separators. Lemma 5.12 (Lemma 2.3 in [36]). In linear time, given an undirected planar graph G with a rooted spanning tree T and nonnegative vertex weights, we can find three vertices u, v and w such that each component of G \ (V (T (u) ∪ T (v) ∪ T (w)) has at most half the weight of G, where T (x) denotes the path from x to the root in T . We are now ready to show the construction. Lemma 5.13. Let G be a planar graph, n = V , ε > 0 and D be the stretch of the metric induced by G. A (1 + ε)-approximate generic distance oracle for G can be built in O(ε−1n log n log D) time. For every v ∈ V , portals(v) = O(ε−1 log n log D) and pieces(v) = ∅. 44 Proof. Initially, we set portals(v) = ∅ for every v ∈ V . During the construction, the algorithm adds new portals. We first show the construction for a fixed value of α. It starts with computing the sequence Gα 1 , . . . , Gα k by applying Lemma 5.11. Then, we recursively decompose each Gα i . i and T α We use Lemma 5.12 on Gα i setting the weight of the supervertex to 0 and the weights i has a separator Q composed of three paths i . The first step is to represent all distances that correspond to paths crossing Q in a graph i . Observe that although is a subgraph of G, as we have removed the only vertex obtained by of other vertices to 1. Lemma 5.12 guarantees that Gα of T α obtained from Gα Gα i contractions. i by removing the supervertex. Denote this graph by Gα is a minor of G, Gα i To represent all distances in Gα We remove the supervertex from Q and obtain a separator Q of Gα i . Note that the three paths that form Q start in the supervertex, so Q also consists of three paths. Since these paths have length ≤ 3α, we may split each of them into three paths of length ≤ α, thus decomposing Q into nine paths Q1, . . . , Q9, each of length ≤ α. i crossing Q, we use the construction of Lemma 5.10 for each of the nine paths Qj, j ∈ {1 . . . 9}. In this way for a path Qj we obtain a set of vertices Pj. We add those vertices to the set portals(v) for every vertex of Gα i . For every new portal, we compute (and store) distances to every vertex of Gα i using linear time algorithm for shortest paths in planar graphs [24]. i we contract separator Q and obtain a planar graph G(cid:48). Since the separator Q i , the contracted Q in G(cid:48) becomes a supervertex r(cid:48), and tree T α contains the supervertex of Gα becomes a tree T (cid:48) rooted at r(cid:48). We note that T (cid:48) is a tree spanning G(cid:48) rooted in r(cid:48) and its depth is at most 3α. Moreover, removing r(cid:48) splits G(cid:48) into at least two components (cut out in Gα i by the separator Q), each containing at most half vertices of V (G(cid:48)). Each of these components has a spanning tree which is a subtree of T (cid:48) rooted at the supervertex r(cid:48). Hence, we can recurse on each of these components (each component is taken together with r(cid:48)). Next in Gα i The construction allows us to approximate distances in range [ α 2 , α], so we repeat it log D times i (u, v) = δG(u, v). Consider the shortest path Xu,v in Gα for different values of α, where D is the stretch of the metric induced by G. We now show that we obtain a (1 + ε)-approximate generic oracle. Consider two vertices u and v. Let α be the scale such that δG(u, v) ∈ [ α i such that i between u and v. In some recursive call δGα of the decomposition algorithm, the path crosses the separator Q. It is easy to see that in that step, we add both to portals(u) and portals(v) a vertex p such that δG(u, p) + δG(p, v) ≤ (1 + ε)δG(u, v). Moreover, if we denote by G(cid:48) the subgraph in the recursion in exactly that step, then G(cid:48) contains Q(cid:48), so δG(cid:48)(u, p) = δG(u, p) and δG(cid:48)(p, v) = δG(p, v). 2 , α] . There exists a graph Gα It remains to bound the running time and the number of portals of each vertex. Consider a i ). In vertex v of G. For each of O(log D) values of α, v belongs to three layers Gα i , v can appear once on each of the O(log ni) levels. On a single level, a recursive subdivision of Gα we add O(ε−1) vertices to portals(v). Thus, since log ni ≤ log n, portals(v) = O(ε−1 log n log D). Observe that the distances inside each cluster are computed in linear time, so the initialization time is equal to the total size of the clusters. The lemma follows. i . Let ni = V (Gα We combine the incremental oracle construction from Lemma 5.4 (see Table 2) with the above lemma to obtain the following result. 45 Theorem 5.14. Let G = (V, E) be a planar graph, n = V and D be the stretch of the metric induced by G. For every ε > 0 there exists an (1 + ε)-approximate vertex-color distance oracle for G, which: • answers distance(v, i) and nearest(v, k) queries in O(ε−1 log n log D) expected time or O(ε−1 log n log log n log D) deterministic time, provided that k is a constant, • handles merge(i, j) and activate(i) operations in O(ε−1 log2 n log D) expected amortized time or O(ε−1 log2 n log log n log D) deterministic amortized time, • can be constructed in O(ε−1n log2 n log D) time, • uses O(ε−1n log n log D) space. Proof. Lemma 5.13 gives a generic oracle with pmax = maxportals(v) = O(ε−1 log n log D), and hence the total size of all clusters ptot = O(ε−1 log n log D). In addition to that every vertex is assigned an empty set of pieces so rmax = 0. We employ Lemma 5.4 (see Table 2) to obtain what is claimed. We now describe how to build a fully dynamic vertex-color distance oracle, which also supports split and deactivate operations. Its running time depends on two main factors. By Lemma 5.2 the running time of an update operation is proportional to the number of portals, whereas the query time depends on the size of pieces. Thus, in our construction we try to keep both these values low. Lemma 5.15. Let G = (V, E) be a planar graph, n = V and D be the stretch of the metric induced by G. For every ρ such that 1 ≤ ρ ≤ n, in O(ε−1n log n log D) time we can build an (1 + ε)- approximate generic distance oracle for G. The total number of portals is O(ε−1 n ρ log D), and the total size of all of clusters is O(ε−1n log n log D). For every v ∈ V , pieces(v) is a set consisting of O(log D) planar graphs of size O(ρ). There are O( n ρ log D) distinct pieces in total. The parameters are summarized in Table 4. Proof. For the purpose of this construction a graph is called big if it contains at least ρ 3 vertices and small otherwise. Moreover, a graph with more than ρ vertices is called too big. We aim to alter the construction of a generic oracle from Lemma 5.13 in such a way that the recursive division of graphs Gα i produces subgraphs which are neither small nor too big. First, we use Lemma 5.11 to obtain a sequence Gα i . As long as the sequence contains two consecutive small layers Gα i+1, we merge them into one layer. Since the layers are minors of G, we first need to remove the supervertex from both of them. After that, they become subgraphs of G, so we can merge them in a natural way. i , Gα Note that after this process every small layer is a neighbor of a big layer, so the number of ρ ). Additionally, each too big layer is not a result of merging smaller layers and small layers is O( n satisfies conditions of Lemma 5.12. We now deal with too big layers Gα i . For each such layer, we perform a recursive subdivision similar to the one in the proof of Lemma 5.13. However, we introduce two changes. First, we assure that at each step, the graph is divided into exactly two subgraphs of roughly even size. Recall that in the construction, we contract the separator in a currently handled graph G(cid:48) into a supervertex r(cid:48), and each connected component of G(cid:48) \ r(cid:48) is of size at most 1 2 of the size of G(cid:48). By standard 46 ptot pnum O(ε−1n log n log D) O(ε−1 log n log D) O(ε−1 n ρ log D) n pmax rnum rmax r# max rtot ρ log D O(log D) Θ(ρ) O(n log D) 2 , α] alto- Table 4: Summary of parameters. arguments, we can group the components of G(cid:48) \ r(cid:48) into exactly two groups, each of total size at most 2 3 of the size of G(cid:48). We recurse on the union of the graphs in each group separately. Consider a layer Gα The second modification to the algorithm from Lemma 5.13 is that we stop the recursion as soon as we reach a graph which is not too big. As a result, leaves of the recursive subdivision correspond to big graphs, which are not too big. i to pieces(v) for every v ∈ V (Gα i ) (except for the supervertex). Otherwise, we decompose the graph recursively and for every separator that we use, we apply Lemma 5.10 and add the obtained set to portals(v). Moreover, once we reach a graph G(cid:48) which is not too big and the recursion stops, we add this graph to pieces(v) for every v ∈ V (G(cid:48)). i (after the merging step). is not too big we add Gα If Gα i The entire construction is repeated for O(log D) values of α, so that the intervals [ α i (u, v) = δG(u, v). Consider the shortest path Xu,v in Gα gether cover all possible distances. We now show that we obtain a (1 + ε)-approximate generic oracle. Consider two vertices u and v and the value of α such that δG(u, v) ∈ [ α i such that 2 , α]. There exists a graph Gα i between u and v. If layer Gα is not too δGα i big then it is added both to pieces(u) and pieces(v) and the property follows trivially. Otherwise, there are two cases to consider. One possibility is that in some recursive call of the decomposition algorithm, the path crosses the separator Q. In this case we add both to portals(u) and portals(v) a vertex p such that δG(u, p) + δG(p, v) ≤ (1 + ε)δG(u, v). Otherwise, we reach a subgraph which is not too big and contains the entire path Xu,v. This subgraph is then added to pieces(u) and pieces(v). It remains to bound the size of the oracle. From the construction it follows that the size of max ∈ Θ(ρ). For every α during the every piece is Θ(ρ) so the maximal size of a piece is clearly r# i . Thus, recursive decomposition of Gα for a fixed α, the sum of sizes of all pieces that we create is O(n). We use O(log D) values of α, so the total size of all pieces is rtot = O(n log D). i we create pieces that are nonoverlapping subgraphs of Gα Moreover, for a fixed α, because all but O( n ρ ) pieces have size Θ(ρ), there are O( n ρ ) pieces in ρ log D) as there are log D values of α. For every i and a fixed vertex v, at most one piece may be added to pieces(v). Each vertex belongs total. So the total number of pieces is rnum = O( n layer Gα to O(log D) layers pieces(v) = O(log D) for every v ∈ G and hence rmax = O(log D). Let us now bound the total number of portals. Consider the recursive subdivision algorithm. We add O(ε−1) new portals every time when we divide a graph into two subgraphs with a separator. For a fixed α, in the end all layers are divided into O( n ρ ) subgraphs (which become pieces). Thus, the number of division steps is also O( n ρ ) new portals. This gives O(ε−1 n ρ log D). The total size of clusters is bounded by the total size of all clusters in the construction of Lemma 5.13, which is ptot = O(ε−1n log n log D). Also after Lemma 5.13, the maximum number of portals assigned to a vertex is pmax = O(ε−1 log n log D). The lemma follows. ρ ), and they create O(ε−1 n ρ log D) portals for all values of α, in other words pnum = O(ε−1 n 47 Theorem 5.16. Let G = (V, E) be a planar graph, n = V and let D be the stretch of the metric induced by G. For every ρ, ε > 0, there exists an (1 + ε)-approximate vertex-color distance oracle for G, which: • may answer distance(v, i) and nearest(v, k) queries in O((ε−1 log n + ρ) log D) time, pro- vided that k is a constant, • handles merge(i, j, u, v), split(l, u, v), activate(i) and deactivate(i) operations in O(ε−1 n ρ log n log D) time, • can be constructed in O(ε−1n log2 n log D) time, • uses O(ε−1n log2 n log D) space. In addition to that, the oracles admits parameters as in Table 4. Proof. The theorem follows from combining the oracle of Lemma 5.15 (the parameters are given in Table 4) with Corollary 5.6 (see Fully Dynamic 1 oracle in Table 2). 5.4 Additional operations and properties Near-metric spaces The generic oracles we build measure distance between u and v by taking the minimum of portal and piece distance (see Definition 3.4) between u and v. Let us call this distance an oracle distance. From the construction of our vertex-color distance oracles it is easy to observe that they answer distance queries by choosing the minimum oracle distance to the vertex of respective color. A similar property holds for nearest queries. Roughly speaking, the oracles behave as if they were exact and the real distance between two vertices was the oracle distance (though the oracle distance does not satisfy triangle inequality). This property, which is used in our algorithms, is summarized in the following. Corollary 5.17. Consider one of nearest neighbor oracles from Section 3.2. Assume it provides µ-approximate distances between vertices of a graph G = (V, E, dG). Then, the oracle yields a µ-near metric space GD that approximates G. In particular: • The answer to a distance(v, i) query is equal to min{dGD(v, w) : w is active and has color i}. • The answer to a nearest(v, k) query is the k-th smallest value of distance(v, i) over all active colors i. Proof. Consider a clique GD = (V,(cid:0)V (cid:1), dGD), where dGD(u, v) is defined as the minimum over the piece distance and the portal distance between u and v (i.e., the oracle distance). By Definition 3.4 it is a well defined simple graph with finite weights. This graph certifies the claim stated in the corollary. 2 48 Reconnecting edges. In one of our algorithms, at some point we encounter the following prob- lem. We are given a set of active colors c1, . . . , ck that we need to connect together in a minimum spanning tree fashion. That is, we would like to compute the MST of a complete graph Gc over colors c1, . . . , ck, where the length of an edge connecting two colors is the distance between the nearest vertices of these colors. Solving this problem efficiently seems hard, even for the case when k = 2. However, we are able to show a solution for its simpler variant. Namely, we define the length of the edge in Gc to be the length of the shortest path that connects two vertices of respective colors and goes through a portal. Lemma 5.18. Assume we are given a vertex-color distance oracle with pnum portals and a set of active colors c1, . . . , ck. Consider a complete graph Gc on the set of colors, such that the length of an edge connecting two colors ci and cj is the length of a shortest path that connects vertices vi and vj of colors ci and cj and goes through a vertex in portals(vi) ∩ portals(vj). Then, MST (Gc) can be computed in O(kpnum + k log k) time. Proof. We first build a graph G(cid:48) c is a subgraph of the graph Gc defined above. For efficiency reasons it may not contain some edges of Gc that surely do not belong to MST (Gc). c. Consider a portal p and assume that vertices of colors c1, . . . , ck(cid:48) are at distances d1 ≤ . . . ≤ ds from p. In particular, c1 is the color that is nearest from p. The shortest path connecting colors i and j going through p has length di + dj. Observe that we may add to G(cid:48) c only edges corresponding to pairs of colors c1, ci (for i ≥ 2). Indeed, if i, j ≥ 2, then di + dj ≥ d1 + dj and di + dj ≥ di + d1. Thus, any other edge that we could add would be the heaviest on the cycle formed by colors c1, ci and cj and as such it is not necessary for computing the MST. We iterate through all portals of the oracle and add edges to G(cid:48) c, and then compute its minimum spanning tree. G(cid:48) Thus, we end up with a graph with k vertices and O(kpnum) edges. We compute its MST with Prim's algorithm in O(kpnum + k log k) time. Efficient Steiner tree computation. We also observe that a vertex-color distance oracle gives us an efficient way of computing an approximate Steiner tree for a query consisting of an entire set S of terminals. Lemma 5.19. Assume we are given a graph G = (V, E, dG), n = V and an instance D of a vertex- color distance oracle for G, which yields a near-metric space GD. Then, given a set S ⊆ V (G), one can compute MST (GD[S]) in O(S(pmax + rmaxr# max) log n) time, where pmax is the maximum number of portals per vertex, rmax is maximum number of pieces assigned to a vertex and r# max bounds the size of a piece. Proof. We compute a minimum spanning tree of S in GD using Prim's algorithm. We start with T being an isolated vertex (an arbitrarily chosen element of S) and, at each step, we choose an edge connecting S \ V (T ) and V (T ) in GD of minimum possible weight and add it to T . To choose such an edge, it suffices to choose the minimum among the portal and piece distance between S \ V (T ) and V (T ). First, consider piece distances. For each v ∈ S \ V (T ) we maintain the piece distances between v and the nearest vertex (w.r.t piece distance) of V (T ). All these piece distances are kept in a heap Hv. In addition to that, we maintain a global heap H with the minimas of the heaps Hv for all vertices v ∈ S \ V (T ). The minimum piece distance between V (T ) and S \ V (T ) is the minimum 49 value on H. If a vertex u is added to V (T ), to update this information it suffices to run Dijkstra's shortest-path algorithm from u in each of pieces(u), update information in heaps Hv for all vertices of S \ V (T ) that were found, each time updating the value on H as well. For all vertices of S this requires O(Srmaxr# max log n) time. To find the minimum portal distance, for each portal p of a vertex in S we consider cluster(p) and store the distance dp T to the nearest vertex of V (T ) and a heap of distances to vertices of S \ V (T ) (both in cluster(p)). The portal distance is the minimum over portals of the sum of dp T and the minimum on this portals heap. We again maintain a global heap which has access to minimum portal distance. Thus, for every vertex v ∈ S, we need to add distances to all portals(v) to a heap in O(S · portals(v) log n) time, each time updating the global heap as well. Whenever we connect a vertex u to the tree T , we update the heaps of all its portals and the global heap. This again takes a total O(S · portals(v) log n) time. The time for removing the elements is at most as big as the time for inserting them. The lemma follows. By Lemma 5.19, we obtain the following two corollaries, depending on which oracle we use. √ √ Corollary 5.20. Assume we are given a graph G = (V, E, dG), n = V . After O( n(m + n log n)) preprocessing, using O(n n log n) space, we can repeatedly compute a 3-approximation of O(S√ MST (G[S]), and consequently a 6-approximation of the minimum Steiner tree spanning S in G, in √ Proof. We employ as D in Lemma 5.19 the fully dynamic oracle of Theorem 5.8. By Theorem 5.8, By Lemma 5.19, we can query for MST (GD[S]) in O(S√ D can be constructed in O( n log n) space. n log n) time. By Lemma 2.1, it is a n(m + n log n)) expected time and uses expected O(n n log n) time for any subset S ⊆ V . √ 6-approximation of the Steiner tree. Corollary 5.21. Assume we are given a planar graph G = (V, E, dG), n = V . After O(ε−1n log2 n log D) preprocessing, using O(ε−1n log n log D) space, we can repeatedly compute a (1 + ε)-approximation of MST (G[S]), and consequently a 2 + ε-approximation of the minimum Steiner tree spanning S in G, in O(Sε−1 log2 n log D) time for any subset S ⊆ V . Proof. We employ as D in Lemma 5.19 the fully dynamic oracle of Theorem 5.14. By Theorem 5.14, D can be constructed in O(ε−1n log2 n log D) time and uses O(ε−1n log n log D) space. By Theo- rem 5.14, D assigns at maximum pmax = maxportals(v) = O(ε−1 log n log D) portals to a vertex and the number of pieces assigned to a vertex is rmax = 0. By Lemma 5.19, we can query for MST (GD[S]) in O(Sε−1 log2 n log D) time. By Lemma 2.1, it is 2(1 + ε)-approximation of the Steiner tree, which can be turned into (2 + ε)-approximation by using ε(cid:48) = ε/2 instead of ε. Faster implementation of the Imase-Waxman incremental algorithm. Imase and Wax- man [28] proved that the natural online algorithm for Steiner tree - the one that attaches the new terminal to the closest previous one - achieves O(log n) approximation guarantee. We remark here that our oracles give a different way to obtain this guarantee; our implementation is faster if the number of terminals is large in terms of the size of host graph. Theorem 5.22. Assume we are given a graph G = (V, E, dG), n = V . Then there exists an algorithm that maintains an online Steiner tree upon a sequence of terminal addition (i.e., the algorithm needs to maintain a Steiner tree upon each addition, and is not allowed to alter the edges that are already in the tree) with O(log n) approximation guarantee, using expected time 50 √ √ n log n) per terminal addition. The algorithm can be initialized in O( n(m + n log n)) time O( and uses O(n √ n log n) space. Proof. We use the vertex-color distance oracle of Theorem 5.8. In the oracle the current set of terminals is a single color, and only this color is active. To add a new terminal, it suffices to issue one distance and one merge operation. The new terminal is attached to not necessarily the closest previous terminal, but approximately closest. 6 Sublinear time dynamic algorithms We propose here dynamic algorithms for each of the dynamic scenarios we considered. The algo- rithms are obtained by implementing the online algorithms of Section 4 using vertex-color distance oracles from Section 3.2. 6.1 Decremental algorithm We now consider the decremental scenario, in which the goal is to maintain an approximate Steiner tree subject to terminal deletions. The graph we work with is accessed with a fully dynamic vertex- color distance oracle D (see Section 3.2), which yields a µ-near metric space GD that approximates G (see Corollary 5.17). However, our algorithm not only uses the operations provided by the oracle, but also the sets of portals and pieces of each vertex. In particular, the algorithm uses the concepts of portal and piece distances, which are defined in Section 5.1. We use the decremental scheme of Section 4.3, so for a fixed ε > 0 we plan to maintain a (1 + ε)-approximation of MST (GD[S]). Following the decremental scheme, we set η = 1 + (cid:100)ε−1(cid:101). Due to decremental scheme, when a vertex is removed from the terminal set, it is not necessary to remove it from the maintained tree T unless its degree in T is at most η. Thus an update may cause T to split into at most η trees. The main challenge of this section is to find in an efficient way the set of edges of minimum total cost that reconnects them. In order to maintain the desired tree T we use the dynamic MSF algorithm (see Theorem 2.2). In what follows we construct a graph H on the vertex set V (the vertex set of both input graph G and GD) with the property that there is a connected component H0 of H containing all current terminals. We declare T to be MST (H0) (maintained by the dynamic MSF algorithm). All other connected components of H will be isolated vertices. Our goal now is to maintain H by adding and removing edges in such a way that maintaining the MSF of H with the dynamic MSF algorithm does in fact implement the decremental scheme of Section 4.3 on GD. The simplest approach would be to add to H, for every two u, w ∈ S, an edge uw of length dGD(u, w). This approach, however, would obviously be inefficient. Instead of that, we use the structure of the vertex-color distance oracle. For every two u, w ∈ V (T ) such that u is piece-visible from w, we add to H an edge uw of length being equal to the piece distance. Moreover, we will be adding some edges corresponding to portal distances, but they will be chosen in a careful way to ensure that the number of such edges is low. Our algorithm uses a single instance D of the fully dynamic vertex-color distance oracle. Initially all vertices are inactive and have distinct colors. Denote the terminal set by S. Using Lemma 5.19 we compute the initial minimum spanning tree T = MST (GD[S]) and modify D so that D contains one active color, whose corresponding tree is equal to T . Other vertices remain inactive. 51 We initialize the edge set of H to be the set of all edges of the initial T and all edges between terminals corresponding to mutually piece-visible vertices. Note that we may break ties of weights in H in such a way that H has a unique minimum spanning forest. Consequently, the forest computed by the dynamic MSF algorithm contains the tree T . We update the vertex-color distance oracle D to maintain the following invariant: the colors of D correspond to the connected components of the graph H, and the only active color is associated with a tree equal to T . Hence, any change to the spanning forest of H results in a constant number of modifications to D. According to the decremental scheme of Section 4.3, when a vertex of degree greater than η is deleted, we simply mark it as a non-terminal. Otherwise, if the procedure removeη(v) requires us to delete a vertex of degree at most η from the currently maintained tree, we update H and the distance oracle D, as follows. 1. Split the active color V (T ) in D into s + 1 pieces being {v} and the s connected components of T \ {v}, and then deactivate {v}. 2. Compute the set of reconnecting edges that correspond to portal distances (using Lemma 5.18) and add these edges to H. 3. Remove all edges incident to v from H. 4. At this point, the dynamic MSF algorithm may update the maintained tree. Update the vertex-color distance oracle D, so that it reflects these changes of the MSF of H. We now show that our algorithm indeed implements the decremental scheme of Section 4.3. Lemma 6.1. After each removal of a vertex from T , T is a minimum spanning tree of GD[V (T )] and T implements the decremental scheme of Section 4.3. Proof. Clearly, at the initialization step for a given terminal set S, in H there is a component H0 containing T = MST (GD[S]) and all vertices of V \ S are isolated. Moreover, the minimum spanning tree of H0 computed by the dynamic MSF algorithm equals T . After initialization, for each pair of mutually piece-visible vertices of V (T ), the graph H contains the corresponding edge, as we added this edge explicitly to H. Clearly, this invariant is satisfied after every terminal deletion. Let us now analyze the case when removeη removes a vertex v of degree s ≤ η. Denote by T1, . . . , Ts the trees which T decomposes into. We use Lemma 5.18 to compute a set of edges corresponding to portal distances that have minimum weight and connect trees T1, . . . , Ts. These edges are added to H in Step 2. Assume that before the operation of removing a vertex v from T , the tree T is a minimum spanning tree of GD[V (T )]. Then, the addition of the reconnecting edges in Step 2 does not modify T , as we use a tie breaking strategy for edges' weights and assume that out of two edges of the same weight, the lighter is the one that was added earlier (see Section 2). These edges may be used when the edges incident to v are deleted in Step 3. We now prove that H contains a set of edges F v of minimum total cost that reconnects trees T1, . . . , Ts into a tree T (cid:48). If s = 1, the claim follows trivially (the set Fv is empty). Otherwise, consider an edge e of F v. Removing e from T (cid:48) yields two trees T (cid:48) 2. We show that H contains an edge connecting T (cid:48) 2 of cost equal to e. If dGD(e) is equal to the piece distance between 1 with T (cid:48) 1 and T (cid:48) 52 the endpoints of e, then the edge e is contained in H. Otherwise, the length of e corresponds to portal distance. But, since the set computed by Lemma 5.18 is a MST of a graph defined over portal distances, we have added to H the edge connecting T (cid:48) 2 of minimum portal distance. The length of this edge is at most the length of e (in fact the lengths are equal). The dynamic MSF algorithm guarantees that the new tree T (cid:48) after the operation consists of the connected components of T \ v connected with a set of edges of minimum possible cost with respect to the weights in GD. Consequently, T (cid:48) is a MST of GD[V (T (cid:48))]. 1 with T (cid:48) Lemma 6.2. Let ε > 0. Assume we are given a fully dynamic µ-approximate vertex-color distance oracle with pnum portals. For every v ∈ V , portals(v) ≤ pmax, pieces(v) ≤ rmax and an (expected) size of each piece is bounded by r# max. Then, there exists a dynamic algorithm that maintains a 2(1+ε)µ approximation of a minimum cost Steiner tree under a sequence of terminal deletions. For every terminal deletion, in amortized sense, the algorithm issues O(ε−1) merge and split operations and uses O(ε−1 log4 n + ε−1pnum + ε−1 log ε−1) additional (expected) time. Preprocessing requires O(S) merge and split operations, as well as O(S(r# maxrmax log4 n + pnum log n)) (expected) time. The algorithm uses O(S(ε−1 + r# maxrmax)) (expected) space. Proof. We use the decremental algorithm described in this section which, by Lemma 6.1, follows the decremental scheme. The approximation guarantee follows from Lemma 4.13. Let us now analyze the efficiency of the algorithm. At the initialization step, we compute the minimum spanning tree of the terminal set. By Lemma 5.19, this requires O(S(pnum + r# maxrmax) log n) (expected) time. Moreover, we add edges between mutually piece-visible terminals. For each vertex v we compute shortest paths in each element of pieces(v) and add respective edges to H. The computation of shortest paths in each piece takes O(Sr# maxrmax log n) (expected) time. Thus, during initialization, we add a total of O(Sr# maxrmax) edges to H (in expectance), which, by Theorem 2.2, requires O(Sr# When a vertex v is removed from the maintained spanning tree we need to compute the set of reconnecting edges, using Lemma 5.18 in O(ηpnum + η log η) = O(ε−1pnum + ε−1 log ε−1) (expected) time. We obtain a set of O(η) = O(ε−1) edges that we add to H in O(ε−1 log4 n) time. Moreover, with respect to the operations on the oracle D, we merge and activate vertices of S O(η) times per removal. maxrmax log4 n) (expected) time. For the space bound, we need O(S(ε−1 +r# maxrmax)) (expected) space to store the graph H and maintain the decremental MSF algorithm. In addition to that, space is used by the vertex-color distance oracle. By using the two oracles developed in Section 3.2, we obtain the following two dynamic algo- rithms. Theorem 6.3. Let G = (V, E, dG) be a graph, n = V , m = E and ε > 0. Let S ⊆ V be a dynamic n(m + n log n) + S√ n log4 n) set, subject to vertex removals. Then, after preprocessing in O( √ removal from S in O(ε−1√ expected time, we may maintain a (6 + ε)-approximate Steiner tree that spans S, handling each n log n) n log n) expected amortized time. The algorithm uses O(n √ expected space. Proof. We combine Lemma 6.2 with 3-approximate vertex-color distance oracles of Theorem 5.8 (based on Lemma 5.7). There are rnum = n pieces, each of expected size r# n). Each vertex is assigned a single piece (rmax = 1). For every vertex the number of portals is pmax = O( n) √ max = O( √ 53 √ and so is the total number of portals (pnum = O( Tmerge = O( which processes each removal in time n)). Every merge and split operation requires n log n) time. By plugging this parameters to Lemma 6.2 we obtain an algorithm √ = O(ε−1 log4 n + ε−1√ = O(ε−1√ O(ε−1 log4 n + ε−1pnum + ε−1 log ε−1 + ε−1Tmerge) n + ε−1 log ε−1 + ε−1√ √ n log n). n log n) The last equality holds under a natural assumption that log ε−1 = O( approach works in O(ε−1) time. It takes O( n(m + n log n)) expected time to initialize the oracle and √ n); otherwise a brute-force O(S(Tmerge + r# √ = O(S( = O(S√ n log n + n log4 n) maxrmax log4 n + pnum log n)) n log n) n log4 n + √ √ √ √ n)). maxrmax) + n n log4 n). √ The space usage is O(S(ε−1 + r# expected time to initialize the algorithm. Altogether, the expected initialization time is O( We obtain approximation factor of 2(1 + ε)3 = 6(1 + ε), which can be adjusted to 6 + ε by using n log n) + S√ we assume log ε−1 = O( ε(cid:48) = ε/6 instead of ε. Theorem 6.4. Let G = (V, E, dG) be a planar graph, n = V and ε > 0. Denote by D be the stretch of the metric induced by G. Let S ⊆ V be a dynamic set, subject to vertex removals. Then, after preprocessing in O(ε−1n log2 n log D +Sε−0.5√ (2 + ε)-approximate Steiner tree that spans S, handling each removal from S in O(ε−1.5√ n log2.5 n log D) time we may maintain n log D) n log n) expected space (again, n log n) = O(n n(m + √ amortized time. Proof. We combine Lemma 6.2 with (1 + ε)-approximate vertex-color distance oracles of Theo- rem 5.16. There are rnum = O(n/ρ log D) pieces, each of size r# max = O(ρ). For every vertex the number of pieces is rmax = O(log D). The total number of portals is pnum = O(ε−1n/ρ log D), whereas the number of portals assigned to a vertex is at most pmax = O(ε−1 log n log D). Every merge and split operation requires Tmerge = O(ε−1n/ρ log n log D) time. We plug this parameters to Lemma 6.2 and obtain an algorithm which processes each removal in time O(ε−1 log4 n + ε−1pnum + ε−1 log ε−1 + ε−1Tmerge) = O(ε−1 log4 n + ε−2n/ρ log D + ε−1 log ε−1 + ε−2n/ρ log n log D) = O(ε−2n/ρ log n log D). It takes O(ε−1n log2 n log D) time to initialize the oracle and O(S(Tmerge + r# maxrmax log4 n + pnum log n)) = O(S(ε−1n/ρ log n log D + ρ log D log4 n + ε−1n/ρ log n log D)) = O(S(ε−1n/ρ log n log D + ρ log D log4 n)) 54 √ time to initialize the algorithm. We balance the two terms from initialization time and get ρ = nε−0.5/ log1.5 n. Thus, the initialization time becomes O(ε−1n log2 n log D+Sε−0.5√ The amortized time for removing one terminal is O(ε−2n/ρ log n log D) = O(ε−1.5√ n log2.5 n log D). n log2.5 n log D). We obtain approximation factor of 2(1 + ε)2, which can be adjusted to 2 + ε by using a value of ε which is a constant factor smaller. 6.2 Incremental algorithm The goal is to maintain an approximate Steiner tree on a set of terminals, subject to terminal additions. Fix a constant τ > 0 and set ς = τ /2. We assume that the input graph G may only be accessed by incremental vertex-color distance oracles (see Section 3.2). In particular, improving the oracles would immediately yield a better algorithm for our problem. We denote the approximation ratio of the oracles by µ and assume µ = O(1). We also assume that all the oracles yield the (cid:1), dGD) that approximates the metric closure of G (see same µ-near metric space GD = (V,(cid:0)V Corollary 5.17). In particular, the tree that we maintain has edge lengths corresponding to the lengths in GD. Moreover, we assume that the distances returned by the oracles are discrete, meaning that every distance is a power of 1 + ς. If this is not the case, we may round up every distance returned by the oracle. As a result, the distances will correspond to a µ(1 + ς)-near metric space. However, for simplicity of presentation, let us assume that we work with a µ-near metric space. We will include the additional 1 + ς factor in the final analysis. 2 Our first goal is to maintain a good approximation of the minimum spanning tree of Si in graph GD. In order to achieve that, we use the incremental online algorithm from Section 4.4. The parameters τ and ς that we have chosen correspond to the parameters used in the description of the scheme. We denote the terminals that are added by t1, t2, t3, . . .. Let Si = {t1, . . . , ti} and let Ti denote the tree maintained by the algorithm after adding i terminals. Assume that all edge lengths of GD belong to the interval [1, D]. Note that D is at most µ times greater than the stretch of the metric induced by G. We define the level of an edge uv, as lvl(uv) := log1+ς dGD(uv). Similarly, the level of a tree T is lvl(T ) := (cid:98)log1+ς dGD(T )(cid:99). Note that since the distances are powers of 1 + ς, the levels of edges are integers. The algorithm represents the current tree Ti by maintaining h = (cid:98)log1+ς D(cid:99) layers L1, . . . , Lh. Layer Lj contains edges of the current tree Ti whose level is at most j. In particular, layer Lh contains all edges of Ti. We also define lvl⊥(T ) = (cid:98)log1+τ 8µ2(1+τ )3n(cid:99). Intuitively, edges of level at most lvl⊥(T ) are so short that they may sum up to at most τ /2 fraction of the weight of T . τ dGD(T ) For each layer Lj, we maintain an incremental vertex-color distance oracle Dj on the graph G. The partition of V into colors corresponds to the connected components of a graph (V, Lj). A color is active if and only if its elements belong to Si. We now describe the process of adding a terminal ti. The pseudocode is given in Algorithm 1. It consists of two stages. First, we find the shortest edge in GD connecting ti to any of t1, . . . , ti−1 and add this edge to Ti−1 to obtain tree Ti. Then, we apply a sequence of ς-efficient replacements (e, e(cid:48)) to Ti in order to decrease its weight. According to the incremental scheme of Section 4.4 we only need to consider replacements in which e is incident to the newly added terminal ti. In order to find the replacements, we use the vertex-color distance oracles. Fix a layer number j and assume that the colors of the oracle Dj reflect the layer structure, including the newly added terminal ti. We want to find a replacement pair (e, e(cid:48)) such that the lvl(e(cid:48)) > j and lvl(e) ≤ j. Denote by C the connected component of the graph (V, Lj) that contains ti (observe that the vertex set of C is exactly the set of vertices with the same color as ti in Dj). By definition of C, it consists 55 while true do break t(cid:48) := active vertex in Dj which is second nearest to ti if lvl(tit(cid:48)) > j then e(cid:48) := the heaviest edge in Ti on the path from ti to t(cid:48) replace e(cid:48) with tit(cid:48) in Ti for k = 1, . . . , h do if lvl(e(cid:48)) ≤ k then replace e(cid:48) with tit(cid:48) in Lk else if lvl(tit(cid:48)) ≤ k then add tit(cid:48) to layer Lk merge colors of ti and t(cid:48) in Dk Algorithm 1 Adding a new terminal ti 1: procedure FindReplacements(j) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: procedure AddTerminal(ti) 15: 16: 17: 18: 19: 20: 21: t(cid:48) := the active vertex in Dh which is nearest to ti Ti := Ti−1 ∪ {tit(cid:48)} for j = 1, . . . , h do activate color of ti in Dj if lvl(tit(cid:48)) ≤ j then add tit(cid:48) to Lj merge colors of ti and t(cid:48) in Dj 22: 23: 24: TM := maximum weight tree among T0, . . . , Ti−1 for j = lvl⊥(TM ), . . . , lvl(TM ) do FindReplacements(j) 56 of edges of level at most j and the path in Ti from ti to every t (cid:54)∈ C contains an edge of level > j. We find the vertex t (cid:54)∈ C which is the nearest to ti by querying Dj. Since ti has color C, we issue a nearest(ti, 2) query to find the second nearest color from ti. Assume that we find a vertex t(cid:48). If lvl(tit(cid:48)) ≤ j, we have found a replacement pair. Let e(cid:48) be the heaviest edge on the path from ti to t(cid:48) in Ti and e = tit(cid:48). Clearly, (e, e(cid:48)) is a replacement pair, and since the weight of e is lower than the weight of e(cid:48) and the weights can differ at least by a factor of 1 + ς, this replacement is ς-efficient. Note that we choose e(cid:48) to be the heaviest edge of the path from ti to t(cid:48) in Ti, as required by the incremental scheme. Our algorithm iterates through layers in increasing order, and for each layer it repeatedly looks for replacements using the procedure described above. As we later show, in this way we will detect all replacements that we need. In particular, applying a replacement on a higher level may not create new (τ /2, 2µ(1 + τ )2)-good replacements on lower levels. Every time we change the current tree, we update all layers accordingly. Let TM be the tree with maximum weight among T1, . . . , Ti−1. For efficiency, we only iterate through layers j = lvl⊥(TM ), . . . , lvl(TM ) to perform replacements.6 After this procedure, some ς-efficient replacements may still be possible in Ti, but they would not be (τ /2)/(2µ(1 + τ )2)-heavy. In case we add a new edge, this boils down to a single merge operation (in each layer that is supposed to contain the edge). A more difficult case is when we perform a replacement, as then we remove an edge that is replaced. Assume that we perform a replacement (e, e(cid:48)) and we need to update a layer Lj that contains the edge e(cid:48). From the algorithm we know that e(cid:48) is the heaviest edge on the path connecting the endpoints of e, so all edges of this path are contained in Lj and the endpoints of e have the same color. Right after we remove e(cid:48) from Ti, we add e. Since the level of e is lower than the level of e(cid:48), the edge e is added to layer Lj, which means that in the end the colors in Lj do not change at all. We first show that one call to FindReplacements correctly finds the replacements. Lemma 6.5. After a call to FindReplacements(j), there are no possible ς-efficient replacements (e, e(cid:48)), such that lvl(e(cid:48)) > j, lvl(e) ≤ j and e is incident to ti. Every replacement made by FindReplacements is ς-efficient. Every time a replacement (e, e(cid:48)) is made, the edge e(cid:48) is the heaviest edge on the path between the endpoints of e. Proof. The second and third claims of the lemma follow directly from the discussion above. It remains to prove the first one. Note that once we identify a replacement pair, the loop in lines 8-13 correctly updates the data structures. Assume that a desired replacement exists and e = tit(cid:48)(cid:48). The path from ti to t(cid:48)(cid:48) in the current spanning tree goes through e(cid:48). Consider the vertex-color distance oracle Dj. Since its colors correspond to connected components of the subgraph consisting of edges of level at most j and lvl(e(cid:48)) > j, the color of t(cid:48)(cid:48) is different from the color of ti. Thus, the vertex t(cid:48) found in 3rd line of the algorithm, is at distance at most d(tit(cid:48)(cid:48)) ≤ d(tit(cid:48)) from ti and lvl(tit(cid:48)) ≤ j, so the while loop does not terminate. We now show, that considering layers in the increasing order is correct. In particular, performing a replacement using one layer may not create replacements at lower levels. 6A simple solution would be to iterate through all layers, or through a range of layers defined in terms of Ti−1, but we use a slightly more sophisticated approach in preparation for more efficient algorithm that we describe later. The key property here is that the weight of TM may be only slightly larger than the weight of Ti, but at the same time the weight of TM may only increase after adding every terminal. 57 Lemma 6.6. After FindReplacements(j) is called with j = a, . . . , b, there does not exist a ς- efficient replacement (e, e(cid:48)), such that lvl(e) ≤ b, lvl(e(cid:48)) > a and e is incident to ti. Moreover, every time the algorithm identifies a replacement pair (e, e(cid:48)) in the iteration j, we either have lvl(e) = j, or j = a and lvl(e) ≤ a. Proof. The proof is by induction on b − a. The base case b = a is provided by Lemma 6.5; observe that also any replacement pair (e, e(cid:48)) identified for j = a satisfies lvl(e) ≤ a. Consider now an inductive step for b > a. Throughout the proof we only consider replacements in which the replacement edge is incident to e. By induction hypothesis, we know that in the beginning of last iteration for j = b there are no ς-efficient replacement (e, e(cid:48)), such that lvl(e) ≤ b − 1 and lvl(e(cid:48)) > a. Moreover, by Lemma 6.5, when the iteration is complete, there are no ς-efficient replacement (e, e(cid:48)), such that lvl(e) ≤ b and lvl(e(cid:48)) > b. We combine this two facts to show the induction step, but we need to prove that performing replacements may not introduce any new replacements (f, f(cid:48)) satisfying lvl(f ) < b and lvl(f(cid:48)) > a. Consider the first replacement (e, e(cid:48)) that we perform in the iteration j = b. Then, from the induction hypothesis, it follows immediately that lvl(e) = b. We show that performing the replacement may not introduce any new replacements (f, f(cid:48)), such that lvl(f ) < b and lvl(f(cid:48)) > a. Indeed, observe that such a replacement can be identified by querying Dlvl(f(cid:48)). But then the vertex- color distance oracles Db(cid:48), for b(cid:48) < b, are not modified, so no replacement pair (f, f(cid:48)) such that lvl(f ) < b and lvl(f(cid:48)) > a can be created. Consequently, the next replacement (e, e(cid:48)) performed in the iteration j = b also satisfies lvl(e) = b, and the argument from the previous paragraph applies again. Consequently, as we perform replacements, we do not introduce any replacement pair (f, f(cid:48)) such that lvl(f ) < b and lvl(f(cid:48)) > a. This concludes the proof of the lemma. Lemma 6.7. The maintained tree Tk is a 2(1 + τ )µ-approximation of a minimum Steiner tree in G that spans Sk. Proof. The proof proceeds by induction on the number of terminals i. Our goal is to use Lemma 4.15, so we have to show that the algorithm presented here implements the incremental scheme from Sec- tion 4.4. In order to show that we follow the incremental scheme from Section 4.4 we need to prove that there are no (τ /2, 2µ(1 + τ )2)-good replacements (e, e(cid:48)) with e incident to ti. By Lemma 6.6, after all calls to FindReplacements, for every such replacement, we either have lvl(e) > lvl(TM ) of lvl(e(cid:48)) ≤ lvl⊥(TM ). Since the edges that we replace either belong to Ti−1 or have been added as a replacement for an edge in Ti−1, and dGD(TM ) ≥ dGD(Ti) the first case may not hold. Let us then consider the second case. We show that the condition implies that (e, e(cid:48)) is not (τ /2)/(2µ(1 + τ )2)- heavy. We have d(e(cid:48)) ≤ τ d(TM ) 8(1 + τ )3µ2n ≤ τ 2(1 + τ )µd(Ti) 8(1 + τ )3µ2n ≤ τ d(Ti) 4(1 + τ )2µn . from lvl(e(cid:48)) ≤ lvl⊥(TM ) by Lemma 4.14, d(TM ) ≤ 2(1 + τ )µd(Ti) 58 This shows that the update procedure correctly implements the incremental scheme from Sec- tion 4.4, so, by Lemma 4.15, it computes a 2(1 + τ )µ-approximation of a minimum Steiner tree in G that spans Sk. The above algorithm can be speeded up by reducing the number of layers, so that it does not depend on the stretch of the metric induced by the input graph. Observe that although we maintain O(log1+ς D) layers, we only use layers lvl⊥(TM ), . . . , lvl(TM ) to find the replacements. Thus, we may modify our algorithm so that it only maintains the layers that are necessary. We will maintain h layers L1, . . . , Lh that correspond to levels lvl⊥(TM ), . . . , lvl⊥(TM ) + h − 1. The value h is chosen such that lvl⊥(TM ) + h − 1 is at least lvl(TM ), regardless of the weight of TM . Thus, for some tree T , h =(cid:4)log1+ς d(T )(cid:5) − (cid:22) (cid:23) log1+ς τ d(T ) 8µ2(1 + τ )3n = O(log1+ς (µ2(1 + τ )3n/τ )) = O(τ−1 log(n/τ )) Since the weight of TM may increase over time, the layers will be dynamic, that is, the level corresponding to each layer will also increase. The algorithm may be easily adapted to handle the dynamic layers. Once a new tree Ti has been computed and the weight of TM increases, the layers may correspond to higher levels and may need to be updated by adding some edges to them. However, there are at most n − 1 of these additions for every layer. Let us now analyze the efficiency of the algorithm. Note that while the layers are used for the description of the algorithm, they may be omitted in the implementation, as they are never read. We first bound the running time of one call to FindReplacements. Lemma 6.8. Assume that a call to FindReplacements performs r replacements. Then, it issues r + 1 nearest queries and at most r merge operations on every level. Moreover, it uses O(r log n) additional time. Proof. We issue a nearest query to find replacements. r of these queries identify new replacements and the last one detects that there are no more replacements to be made. After a replacement is detected, we may execute a merge operation on every level. Moreover, after a replacement is detected, we find the heaviest edge on some path in the tree (see line 6 of Algorithm 1). To do that efficiently, we maintain the the trees Ti as top trees [3]. This allows us to perform this operation in O(log n) time. Lemma 6.9. Let 0 < τ = O(1). Given h = O(τ−1 log(n/τ )) instances of an incremental µ- approximate vertex-color distance oracle (µ = O(1)), there exists a dynamic algorithm that main- tains a 2µ(1 + τ )-approximation of a minimum-cost Steiner tree under a sequence of terminal in- sertions. For every terminal addition, in amortized sense, the algorithm executes O(τ−1 log(n/τ )) activate, merge and nearest operations. The space usage is dominated by the space usage of the oracles. Proof. By Lemma 6.7, the incremental algorithm implements the incremental scheme. As a result, we may use Lemma 4.17 to bound the running time. Assume that we have added k terminals. First, we need to bound the number of replacements. Since we round the distances up to a power of (1 + ς), we operate on a µ(1 + ς)-near metric space. Our algorithm implements the incremental scheme with parameters ς = τ /2. Thus, by Lemma 4.17, 59 adding k terminals may trigger O(kτ−1 log((1 + τ )µ)) = O(kτ−1) replacements. In particular, this shows that the update procedure terminates. Let us now calculate the number of operations performed on the vertex-color distance oracles. We use one copy of the oracle for each layer. In the course of adding k terminals, in each of the h layers at most k vertices may be activated and colors may be merged k − 1 times. Note that this includes the merging of colors caused by maintaining dynamic layers. For every terminal insertion we also issue one nearest query to find the first edge connecting the new terminal with the current tree. Since a single terminal insertion triggers O(τ−1) replacements, by Lemma 6.8, we we issue O(h + τ−1) = O(τ−1 log(n/τ )) nearest queries, in amortized sense. We also spend O(τ−1 log n) additional time, but this time is dominated by the oracle operations. Apart from the oracles, the algorithm uses O(n) space to represent the trees. Thus, the space usage is dominated by the oracles. By using the two oracles developed in Section 3.2, we obtain the following two dynamic algo- rithms. Theorem 6.10. Let G = (V, E, dG) be a graph, n = V and ε > 0. Let S ⊆ V be a dynamic set, subject to vertex insertions (initially S = ∅). Then, after preprocessing in O(ε−1√ n(m + each insertion to S in O(ε−1√ n log(n/ε))) expected time we may maintain (6 + ε)-approximate Steiner tree that spans S, handling n log n log(n/ε)) n) amortized time. The algorithm uses O(ε−1n √ space. Proof. We combine the 3-approximate vertex-color distance oracle from Theorem 5.8 (based on Lemma 5.7) with Lemma 6.9. Thus µ = 3 = O(1). We set τ = ε/3. We first build O(τ−1 log(n/τ )) copies of the oracle, by first building a single one and then n(m + n log n)) expected time. Since the space n log n log(n/τ )) time, and so is the space √ copying it. Building the first oracle requires O( usage is O(n usage. n log n), the copying requires O(τ−1n √ √ √ The oracle handles activate and merge operations in O( n log n) time, whereas nearest n) time. Since we perform O(τ−1 log(n/τ )) of each of these operations, √ queries are answered in O( they require O(τ−1√ n log n log(n/τ )) = O(ε−1√ n) amortized time per terminal insertion. We obtain an approximation factor of 2(1 + ε)3 = 6(1 + ε), which may be reduced to 6 + ε by manipulating the value of ε. Theorem 6.11. Let G = (V, E, dG) be planar a graph, n = V and D be the stretch of the metric induced by G. Fix ε > 0. Let S ⊆ V be a dynamic set, subject to vertex insertions (initially S = ∅). Then, after preprocessing in O(ε−2n log n log(n/ε) log D)) time we may maintain (2 + ε)- approximate Steiner tree that spans S, handling every insertion to S in O(ε−2 log2 n log(n/ε) log D) expected amortized time or O(ε−2 log2 n log log n log(n/ε) log D) deterministic amortized time. The algorithm uses O(ε−2n log n log(n/ε) log D)) space. Proof. We combine the (1 + ε)-approximate vertex-color distance oracle of Theorem 5.14 with Lemma 6.9. We set τ = ε. We first build O(τ−1 log(n/τ )) copies of the oracle, by first building a single one and then copying it. Building the first oracle requires O(τ−1n log2 n log D) time. Since the space usage is O(τ−1n log n log D), the copying requires O(τ−2n log n log(n/τ ) log D)) = O(ε−2n log n log(n/ε) log D)) time, and so is the space usage. The copying also dominates the preprocessing time. 60 The oracle handles activate and merge operations in O(ε−1 log2 n log D) expected amortized time, whereas nearest queries are answered in O(ε−1 log n log D) time (and additional log log n factor is needed for deterministic algorithms). Since we perform O(τ−1 log(n/τ )) of each of these operations, they require O(ε−2 log2 n log(n/τ ) log D) expected amortized time (with an additional log log n factor for a deterministic algorithm). We obtain approximation ratio of 2(1 + ε)2. It is easy to see that by manipulating the value of ε, we may obtain (2 + ε)-approximation. 6.3 Fully dynamic algorithm In this section we merge the ideas of the decremental and incremental algorithms to obtain a fully dynamic algorithm, which supports both terminal additions and deletions. The algorithm simply maintains the invariants of both the incremental and decremental algorithms. Let ε > 0 and ς = τ > 0. We set η = 1 + (cid:100)ε−1(cid:101). We implement the fully dynamic scheme of Section 4.5 with the parameters ε, ς and τ. Recall that ε (and η) controls the degree threshold for nonterminals that are deleted, and ς defines the efficiency of the replacements that we make. We maintain the invariant that the tree does not contain any τ-efficient replacements. Since, ς = τ, in the following we only use τ. Similarly to the decremental algorithm, we work with a graph G = (V, E, dG) that is accessed with approximate vertex-color distance oracles, that yield a µ-near metric space GD, which ap- proximates G (see Corollary 5.17). We assume that µ = O(1) and that every edge length is GD has length being a power of (1 + τ ). This can be achieved by rounding up the distances returned by the oracle. As a result, the graph GD yielded by the oracle becomes a µ(1 + τ )-near metric approximating G, but in the description we assume the approximation factor of µ. The additional 1 + τ factor will be included in the final analysis. As in the decremental algorithm, we do not maintain the tree explicitly, but instead we use the dynamic MSF algorithm (see Theorem 2.2) on top of a carefully chosen graph H with vertex set V . Again, each connected component of H is an isolated vertex, with the exception of one component, denoted H0, that contains all terminals. We declare that the currently maintained Steiner tree, T , is the tree maintained by the dynamic MSF algorithm in the component H0. We define the level of an edge uv to be lvl(uv) := log1+τ dGD(uv). Our algorithm maintains a tree T which spans the set of terminals and nonterminals of degree more than η. The tree T will not admit τ-efficient replacements, but since the distances are powers of 1 + τ, this means that T does not admit any efficient replacements. Thus, by Lemma 4.8, it is the MST of its vertex set. Denote by D the stretch of the metric induced by G. Thus, the longest edge in GD is at most µ · D = O(D) times longer than the shortest one. In the algorithm we maintain h = (cid:98)log1+τ D(cid:99) = O(τ−1 log D) fully dynamic vertex-color distance oracles D1, . . . , Dh. Dh is the counterpart of the oracle from the decremental algorithm. The colors of Dh correspond to connected components of H. The only active color is the one corresponding to component H0. The tree associated with this color is equal to the tree T . The oracle Di is obtained from Dh by splitting along edges of level more than i. In other words, we consider the forest consisting of edges of T of level at most i and for each tree Fj in this forest, Di contains an active color associated with the tree Fj. We update the oracles in order to maintain those properties. Note that we may assume that all oracles have the same structure, i.e., the sets portals(v) and pieces(v) are the same in each oracle. This can be achieved by constructing one oracle and then 61 copying it to create all the others. Thus, referring to piece or portal distance between vertices in unambiguous. As in the decremental algorithm of Section 6.1, we maintain an invariant that for every two vertices u, w ∈ V (T ), if u is piece-visible from w, the graph H contains an edge connecting them, whose length is equal to the piece distance. With respect to the vertex-color distance oracles, note that each modification (edge addition, removal or replacement) in the tree T requires us to perform O(1) operations on each oracle Di. Vertex removal. To use the fully dynamic scheme of Section 4.5, we first need to describe how the algorithm behaves if the procedure removeη requires us to remove a vertex v of degree at most η from the tree T . We resolve this situation in exactly the same manner as in the decremental algorithm of Section 6.1. For sake of completeness, let us recall the steps. 1. Split the active color V (T ) in Dh into s + 1 pieces being {v} and the s connected components of T \ {v}, and then deactivate {v}. Update all oracles Dj accordingly. 2. Compute the set of reconnecting edges that correspond to portal distances (using Lemma 5.18) and add these edges to H. 3. Remove all edges incident to v from H. 4. At this point, the dynamic MSF algorithm may update the maintained tree. Update the vertex-color distance oracles Di, so that they reflect these changes of the MSF of H. Vertex addition. A second ingredient needed to implement the fully dynamic scheme is the behavior upon addition of a new terminal v. If v ∈ V (H0), we simply mark it as a terminal and finish. Let us now assume that we are adding a new vertex v to the tree. We use a similar method as in the incremental scheme, but here we need to assure that after adding v, the tree does not admit any τ-efficient replacements. We use the following algorithm. Note after every change to T done by the dynamic MSF algorithm we update the nearest oracles accordingly. 1. Connect v to the tree with the shortest possible edge in GD. Add this edge to H. 2. Iterate through levels in increasing order, and for each level find and apply all occurring τ- efficient replacements. This is done with the procedure FindReplacements from the (see Algorithm 1, Section 6.2). Each time a replacement (e, e(cid:48)) is found, simply add edge e to H. The edge e(cid:48) may safely remain in H. 3. For every vertex w, whose degree became at most η due to replacements, call removeη(w). 4. Add edges corresponding to piece distances between v and vertices of T . We claim that the dynamic MSF algorithm modifies the tree T exactly the way the fully dynamic scheme requires it to do. Lemma 6.12. The tree T implements the fully dynamic scheme of Section 4.5. 62 Proof. The correctness of the implementation of the procedure removeη follows from the same arguments as in the decremental algorithm. Indeed, our algorithm maintains the same invariants about graph H and before the removal the tree T is the MST of the terminals. Since we use the same procedure for handling deletions, the proof is analogous to the proof of Lemma 6.1. Let us now focus on a step when a vertex v /∈ V (H0) is added to the terminal set. By Lemma 6.5, every replacement (e, e(cid:48)) is τ-efficient and e(cid:48) is the friend of e with maximum possible cost. Since we iterate through all levels, by Lemma 6.6, we have that after handling the insertion there are no τ-efficient replacements (e, e(cid:48)) with e incident to v. Now, by Lemma 4.18, if there are no τ-efficient replacements (e, e(cid:48)) with e incident to v, there are no τ-efficient replacements at all. In particular, the addition of edges incident to v corresponding to pieces distances does not cause any changes to T . Finally, note that as the weights of the edges in the dynamic MSF algorithm equal their levels in GD, and we break ties by timestamps, if an addition of a new edge results in a replacement in T , such a replacement is τ-efficient. This concludes the proof of the lemma. We are now ready to state the main result of this section. Lemma 6.13. Let G = (V, E, dG) be a graph, ε > 0. Denote by D the stretch of the metric induced by G. Assume there exists a fully dynamic µ-approximate vertex-color distance oracles, where µ = O(1). Let pnum be the (expected) total number of portals in the oracle. Moreover, assume that every vertex is assigned at most rmax pieces (in expectation), the (expected) size of each piece is bounded by r# max, and the (expected) total number of pieces is rtot. Then, there exists a dynamic algorithm that maintains a 2(1 + ε)2µ approximation of a min- imum cost Steiner tree under a sequence of terminal additions and deletions (initially, the ter- minal set is empty). For every terminal addition, in amortized sense, the algorithm executes O(ε−2 log2 D) split and merge and issues O(ε−1 log D) nearest queries. Moreover, it uses O(ε−1pnum + ε−2 log n log D + (rmaxr# max + ε−1) log4 n) additional (expected) time. The initialization time is dominated by the time needed to initialize Θ(ε−1 log D) fully dynamic vertex-color distance oracles. Similarly, the space usage is dominated by the oracles. Proof. Set τ = ε. By Lemma 6.12, our algorithm implements the fully dynamic scheme. Thus, by Lemma 4.18, it maintains a 2(1 + ε)2µ approximation of a minimum cost Steiner tree. The algorithm starts by constructing Θ(τ−1 log D) = O(ε−1 log D) oracles Di. Initially, the graph H is empty. After each removal of a vertex in T we apply Lemma 5.18, which requires O(ε−1pnum + ε−1 log ε−1) time. Moreover, we issue O(τ−1) merge and split operations in each of the O(τ−1 log D) oracles, that is, a total of O(τ−2 log D) = O(ε−2 log D) operations. Now consider a vertex addition. By Lemma 4.19, an addition may trigger O(τ−1 log D) = O(ε−1 log D) replacements. When a new vertex is added we call FindReplacements O(τ−1 log D) times, and each call issues one nearest query, regardless of the number of replacements. More- over, for every replacement, all calls to FindReplacements issue an additional nearest query and O(τ−1 log D) merge operations. It also uses O(τ−1 log n) additional time. This gives a to- tal of O(τ−2 log2 D) = O(ε−2 log2 D) merge and split operations per insertion, O(τ−1 log D) = O(ε−1 log D) nearest queries and O(τ−2 log n log D) = O(ε−2 log n log D) additional time. Whenever we add or remove a vertex from T , we add or remove all edges corresponding to piece max) such edges for every vertex (in expectance). All these distances. There are at most O(rmaxr# edges can be computed in O(rmaxr# max log n) using Dijkstra's algorithm. 63 We are left with bounding the amortized cost of maintaining the dynamic MSF algorithm over the graph H. Each call to removeη that results in a modification of T as well as each addition of a new terminal adds to H O(rmaxr# max) edges corresponding to piece distances. By Lemma 4.19 and Theorem 2.2 this amortizes to O(rmaxr# max log4 n) per operation. Moreover, each removal adds O(ε−1) new edges to H, which accounts for O(ε−1 log4 n) amortized time. Altogether, the amortized cost of one operation is O(ε−2 log n log D + ε−1pnum + ε−1 log ε−1 + max log4 n + ε−1 log4 n) = O(ε−1pnum + ε−2 log n log D + (rmaxr# Apart from the vertex-color distance oracles, the space usage is O(n). Thus, the oracles domi- max + ε−1) log4 n). rmaxr# nate the space usage. By using the two oracles developed in Section 3.2, we obtain the following dynamic algorithms. Theorem 6.14. Let G = (V, E, dG) be a graph, n = V , m = E and ε > 0. Denote by D the stretch of the metric induced by G. Let S ⊆ V be a dynamic set, subject to vertex additions and removals (initially S = ∅). Then, after preprocessing in O( n(m + ε−1n log n log D)) expected in O(ε−2√ time, we may maintain a (6 + ε)-approximate Steiner tree that spans S, handling each change to S n log nε−1 log D) expected n log2 D) expected amortized time. The algorithm uses O(n √ √ space. √ Proof. We combine Lemma 6.13 with vertex-color distance oracles for general graphs of Theorem 5.8 (based on Lemma 5.7). We have that µ = 3 = O(1). The expected total number of portals is √ n. Every vertex is assigned a single piece rmax = 1 of expected size at most r# pnum = max = √ n). The total number of pieces is rtot = O(n). Each merge and split operation requires O( n log n) expected time, whereas a nearest query can be handled in Tquery = O( Tmerge = O( n) √ expected time. It takes O( space usage is O(n time. Thus, the expected preprocessing time is O( O( O(n √ √ n(m + n log n)) expected time to initialize one oracle, and, since the expected n log nε−1 log D) n log nε−1 log D) = √ n(m + ε−1n log n log D)). The space usage is dominated by the oracles, and amounts to √ n log nε−1 log D). Each terminal addition or deletion requires time O(ε−2 log2 DTmerge + ε−1 log DTquery + ε−1pnum + ε−2 log n log D + (rmaxr# n log n), copying the oracle Θ(ε−1 log D) times requires O(n √ max + ε−1) log4 n) n(m + n log n) + n √ √ n + ε−2 log n log D + ( n + ε−1) log4 n) √ √ n log n + ε−1 log D √ n log4 n) n log n + √ √ = O(ε−2 log2 D = O(ε−2 log2 D = O(ε−2√ n log2 D). We obtain approximation factor of 2(1 + ε)23 = 6(1 + ε)2, which can be reduced to 6 + ε by manipulating the value of ε. Using Theorem 4.20, we may decrease the dependency on the stretch of the metric at the cost of increasing the polylogarithmic factors. Theorem 6.15. Let G = (V, E, dG) be a graph, n = V , m = E and ε > 0. Denote by D the stretch of the metric induced by G. Let S ⊆ V be a dynamic set, subject to vertex additions and re- movals (initially S = ∅). Then, after preprocessing in O(ε−1√ n(m+ε−2n log n log(ε−1n) log D)) ex- pected time, we may maintain a (6+ε)-approximate Steiner tree that spans S, handling each change 64 to S in O(ε−5√ expected space. n log D) expected amortized time. The algorithm uses O(ε−2n √ n log n log(ε−1n) log D) Finally, we show a fully dynamic algorithm for planar graphs. Theorem 6.16. Let G = (V, E, dG) be a planar graph, n = V and ε > 0. Denote by D the stretch of the metric induced by G. Let S ⊆ V be a dynamic set, subject to vertex additions and removals (initially S = ∅). Then, after preprocessing in O(ε−2n log2 n log2 D) time, we may maintain a (2 + ε)-approximate Steiner tree that spans S, handling each change to S in O(ε−2 log2.5 D n) amortized time. The algorithm uses O(ε−2n log2 n log2 D) space. √ Proof. We combine Lemma 6.13 with (1 + ε)-approximate vertex-color distance oracles for general graphs of Theorem 5.8. We have that µ = 1 + ε = O(1). The total number of portals is pnum = O(ε−1n/ρ log D). Every vertex belongs to rmax = O(log D) pieces and each piece is a planar graph containing r# max = O(ρ) vertices. The total number of pieces is rtot = O(n/ρ log D). Each merge and split operation requires Tmerge = O(ε−1 n ρ log n log D) time, whereas a nearest query can be handled in Tquery = O((ε−1 log n + ρ) log D) time. It takes O(ε−1n log2 n log D) time to initialize one oracle, and, since we copy it Θ(ε−1 log D) and its space usage is O(ε−1n log2 n log D), the copying requires O(ε−2n log2 n log2 D) time. This also dominates the preprocessing time. The space usage of the oracles and the algorithm is also O(ε−2n log2 n log2 D). Each terminal addition or deletion requires time O(ε−2 log2 DTmerge + ε−1 log DTquery + ε−1pnum + ε−2 log n log D + (rmaxr# max + ε−1) log4 n) = O(ε−3 log3 D(n/ρ) log n + ε−1 log2 D(ε−1 log n + ρ) + ε−2(n/ρ) log D + ε−2 log n log D+ (ρ log D + ε−1) log4 n) = O(ε−3 log3 D(n/ρ) log n + ε−1 log2 D(ε−1 log n + ρ) + ε−2(n/ρ) log D + ε−2 log n log D+ (ρ log D + ε−1) log4 n). We set ρ = ε−1√ √ O(ε−2 log2.5 D manipulating the value of ε. n log D and obtain a running time of O(ε−2 log2.5 D n log2.5 D log4 n) = n). We obtain approximation factor of 2(1 + ε)3, which can be reduced to 2 + ε by n log n+ √ √ We may again apply Theorem 4.20 to decrease the dependency on the stretch of the metric induced by G. Theorem 6.17. Let G = (V, E, dG) be a planar graph, n = V and ε > 0. Denote by D the stretch of the metric induced by G. Let S ⊆ V be a dynamic set, subject to vertex additions and removals (initially S = ∅). Then, after preprocessing in O(ε−5n log D) time, we may maintain a (2 + ε)-approximate Steiner tree that spans S, handling each change to S in O(ε−5.5√ n log D) amortized time. 7 Steiner tree via bipartite emulators In this section we present an alternative solution for maintaining approximate Steiner tree. This solution exposes a trade-off between the running time and the approximation ratio. The algorithms 65 Figure 6: An illustration of a bipartite emulator. The blue thick dashed path corresponds to the distance(cid:101)δB(u, v) = dB(ux) + dB(xv). the metric closure of G given by the emulator. 2 presented here are faster than the algorithms from previous sections, however their approximation ratio is much higher. We introduce the notion of bipartite emulator, which will be essential for the algorithms proposed here. In essence, a bipartite emulator is a sparse bipartite graph that stores the information about the approximate distances in the input graph. In this section we show how to use a bipartite emulator to maintain a good approximation of the minimum Steiner tree. In Section 7.1 we show how to construct the emulators themselves. Definition 7.1. Let G be a graph and α ≥ 1. A bipartite emulator of G is a bipartite graph B = (V (G) (cid:93) N, EB, dB), where the vertex set is partitioned into V (G) and a set of auxiliary vertices N representing the distances in G. For every u, v ∈ V (G), it holds that δG(u, v) ≤ δB(u, v) ≤ α · δG(u, v). Moreover, for every u, v ∈ V (G), there exists in B a vertex x ∈ N, such that dB(ux) + dB(xv) ≤ α · δG(u, v). We say that α is the stretch of emulator B. We denote (cid:1),(cid:101)δB) be the approximation of (cid:101)δB(u, v) = minx∈N{dB(ux) + dB(xv)} and we let (cid:101)G = (V (G),(cid:0)V (G) emulator is required to have the same vertex set as the graph it emulates. Observe also that (cid:101)G Note that a bipartite emulator is not an emulator according to the usual definition, as an may not be a metric space itself, as it may not satisfy the triangle inequality. See also Figure 6 for an illustration. The definition shows that a bipartite emulator B contains estimates of all distances in G and that the distance estimate is given by a path of length two in B. Moreover, it easily follows that, to approximate ST (G, S), it suffices to focus on MST ((cid:101)G[S]). Lemma 7.2. Let B be a bipartite emulator of G with stretch α. Then for any set of terminals S ⊆ V (G) it holds that (cid:101)δB(MST ((cid:101)G[S])) ≤ 2αdG(ST (G, S)). Proof. Denote TMST = MST (G[S]) and observe that (cid:101)δB(MST ((cid:101)G[S])) ≤(cid:101)δB(TMST ) ≤ αdG(TMST ) ≤ 2αdG(ST (G, S)) by the definition of MST by the stretch of B by Lemma 2.1. To obtain the necessary distances (distances in (cid:101)G between vertices of S) it is enough to consider the subgraph B[S ∪ Γ(S)] of B induced by S and its neighborhood in B. We make sure that the 66 V(G)Nuvx Figure 7: A minimum spanning tree T (cid:48) of B[S ∪ Γ(S)] (blue thick solid and dashed lines) and its subtree T created by removing all leaves that lie in N (blue thick solid lines). degree of every vertex of V (G) in B is bounded. This will allow us to maintain graph B[S ∪ Γ(S)] efficiently as S is undergoing changes. If a vertex of V (G) becomes a terminal, we add it and the adjacent edges to B[S ∪ Γ(S)] in time proportional to its degree. We apply to B[S ∪ Γ(S)] the dynamic MSF algorithm (see Theorem 2.2), which maintains the minimum spanning forest in a graph under edge additions or deletions. Each edge insertion/removal is handled in polylogarithmic time, so the time we need to add a vertex to B is bounded by its degree times logarithmic factors. The only problem that remains is that the maintained spanning tree may be too heavy, as Γ(S) may contain more vertices than needed. Note that every edge in (cid:101)G[S] corresponds to a vertex in Γ(S) ⊆ N. We need vertices corresponding to the edges of MST ((cid:101)G[S]), and the rest of Γ(S) the weight of MST ((cid:101)G[S]). The quite easy proof is provided in Section 4.2, where we develop a unnecessarily increases the cost of the spanning tree. In the next lemma we show, that if we remove leaves of MST (B[S ∪ Γ(S)]) that belong to N, then the obtained tree costs at most twice convenient language for such claims (see also Figure 7 for an illustration). Lemma 7.3. Let T (cid:48) = MST (B[S ∪ Γ(S)]), and let LN be the set of leaf vertices of T (cid:48) contained in N. Let T be a tree obtained from T (cid:48) by removing leaves in N, formally T = T (cid:48)[V (T (cid:48)) \ LN ]. Denote TM ST = MST ((cid:101)G[S]). Then dB(T ) ≤ 2(cid:101)δB(TM ST ). MST ((cid:101)G[S]), which is, by Lemma 7.2, at most 4αdG(ST (G, S)). Clearly, the cost MST (B[S∪Γ(S)]) Due to Lemma 7.3, MST (B[S∪ Γ(S)]) without the leaves in N costs at most twice the weight of without the leaves in N cannot be smaller then the cost of the minimum Steiner tree in G. Thus, this approach gives us a 4α-approximation of the Steiner tree in the input graph G. Lemma 7.4. Let G be a graph and let B be its bipartite emulator of stretch α (possibly obtained by a randomized algorithm). Moreover, assume that the (expected) degree in B of any vertex of V (G) is bounded by ∆. Let S be a set subject to insertions and deletions, such that at any time S ⊆ V . Then, we can maintain a 4α-approximate Steiner tree of G that spans S, handling each update to S in (expected) amortized O(∆ log4 n) time. Let us comment on the possible randomization of the construction of a bipartite emulator. In Section 7.1.1 we construct a randomized emulator, with only a bound on the expected degree of a vertex in V (G). Then Lemma 7.4 gives us a bound on expected amortized time. That is, for any positive integer r, the expected time spent on the first r operations is bounded by O(r∆ log4 n). 67 V(G)NterminalsSΓ(S) In Section 7.1 we show two constructions of emulators. The construction for general graphs gives an emulator with ∆ = O(kn1/k) (in expectation) and stretch 2k−1, which yields an algorithm for maintaining (8k − 4)-approximate Steiner tree in O(kn1/k log4 n) expected time per terminal addition or deletion. In case of planar graphs, we have an emulator with ∆ = O(ε−1 log2 n) and stretch 1 + ε, so we obtain (4 + ε)-approximate algorithm, handling updates in O(ε−1 log6 n) time. 7.1 Constructing bipartite emulators In this section we show how to construct emulators that can be plug into Lemma 7.4 to obtain dynamic algorithms for maintaining the Steiner tree. 7.1.1 General graphs Our emulator for general graphs is based on an approximate distance oracle by Thorup and Zwick [37]. Lemma 7.5 ([37]). Let G = (V, E, d) be a graph, n = V , m = E, and k ≥ 1 be an integer. Then, we can compute an emulator of G of stretch 2k − 1 in O(kmn1/k) expected time. We now modify the construction slightly in order to obtain a bipartite emulator of G. The emulator constructed in [37] is obtained by computing for each v ∈ V a set B(v) called a bunch and, for each w ∈ B(v), adding an edge vw of length δ(v, w). The expected size of each bunch is O(kn1/k). Moreover, from the query algorithm it follows that for any two u, v ∈ V there exists w ∈ B(u) ∩ B(v) such that δ(u, w) + δ(w, v) ≤ (2k − 1)δ(u, v). Thus, the bipartite emulator G(cid:48) = (V ∪ V (cid:48), E(cid:48), d(cid:48)) can be constructed as follows. The vertex set of G(cid:48) consists of two copies of V , i.e., for each v ∈ V , there is its copy v(cid:48) ∈ V (cid:48). We connect each vertex v ∈ V to its copy with an edge of length 0. Moreover, for each v ∈ V and each w ∈ B(v) we add to G(cid:48) an edge vw(cid:48) of length δG(v, w). It follows that G(cid:48) is a bipartite graph, in which the degree of every v ∈ V is O(kn1/k) and for every two vertices u, w there exists a two-edge path of length ≤ (2k − 1)δ(u, v). Thus, using Lemma 7.4 we obtain the following result. Theorem 7.6. Let G = (V, E, d) be a graph, n = V , m = E and k ≥ 1 be an integer. Let S ⊆ V be a dynamic set, subject to vertex insertions and removals (initially S = ∅). Then, after preprocessing in O(kmn1/k) expected time, we may maintain a (8k − 4)-approximate Steiner tree that spans S, handling each update to S in O(kn1/k log4 n) expected amortized time. 7.1.2 Planar graphs In this section we show an emulator construction for planar graphs. As a result we obtain an algorithm that maintains a (4 + ε)-approximate Steiner tree in polylogarithmic time per update. In order to reach this goal, we use a construction by Thorup (section 3.8 in [36]) that we extend in order to construct an emulator (see Lemma 7.8). Let G = (V, E) be a planar graph. The overall idea uses recursive division of G using balanced separators. A balanced separator of G is a set Q ⊆ V such that each connected component of G\ Q is a constant fraction smaller than G. We find a balanced separator of G that consists of a constant number of shortest paths P1, . . . , Pk (the separator consists of vertices contained in these paths). For a shortest path Pi, we build an emulator that approximates all the shortest paths in G that 68 intersect Pi. Then, we recurse on each of the connected components of G \ (P1 ∪ . . . ∪ Pk). Hence, we now focus on the following problem. Given a planar graph G and a shortest path P , build an emulator that approximates all shortest paths intersecting P . We define a connection to be an edge that connects a vertex v ∈ V with a vertex a ∈ P and has length d(va) at least δG(v, a) (it would be convenient to assume that the length is equal to δG(v, a), but the algorithm we use may sometimes give longer connections). A connection vb ε-covers x if d(vb) + δG(b, x) ≤ (1 + ε)δG(v, x); observe that the distance δG(b, x) can be equivalently measured along the path P . A set of connections C(v, P ) is ε-covering if it ε-covers every x ∈ P . Lemma 7.7. Let G = (V, E, d) be a planar graph, n = V , and 0 < ε ≤ 1. Let P be a shortest path in G. For each v ∈ V (G) we can construct an ε-covering set C(v, P ) of size O(ε−1) in O(ε−1n log n) total time. A very similar fact is shown in [36], but the definition of ε-covering used there is slightly different, so, for the sake of completeness, we rewrite the proof. Proof. Let ε0 = ε/2. We say that a connection vb strongly-ε-covers a if d(vb) + (1 + ε)δG(b, a) ≤ (1 + ε)δG(v, a). By Lemma 3.18 in [36], for each v ∈ V (G) we can construct a strongly-(ε0/2)- covering set D(v, P ) of size O(ε−1 0 n log n) time.7 We now show that we can use it to construct an ε-covering set C(v, P ) ⊆ D(v, P ) of size O(ε−1). log n) in O(ε−1 0 Let vc be the shortest connection from D(v, P ) and s be one of the two endpoints of P . We add vc to C(v, P ). Now, iterate through connections in D(v, P ) starting from vc and going towards s. Let vb be the connection that was most recently added to C(v, P ). If for the current connection va we have d(vb) + δG(b, a) > (1 + ε0)d(va), we add va to C(v, P ). Then, we run a similar procedure using the other endpoint of P . To prove that C(v, P ) covers every vertex between c and s, consider some vertex x ∈ P . There exists a connection va ∈ D(v, P ) that strongly-(ε0/2)-covers vx, so d(va) + (1 + ε0/2)δG(a, x) ≤ (1 + ε0/2)δG(v, x). If this connection is in C(v, P ) then vx is strongly-ε0/2-covered and obviously also ε-covered. Otherwise, there exists a connection vb such that d(vb) + δG(b, a) ≤ (1 + ε0)d(va). We have d(vb) + δG(b, x) ≤ d(vb) + δG(b, a) + δG(a, x) ≤ (1 + ε0)d(va) + δG(a, x) ≤ (1 + ε0)d(va) + (1 + ε0)(1 + ε0/2)δG(a, x) = (1 + ε0)(d(va) + (1 + ε0/2)δG(a, x)) ≤ (1 + ε0)(1 + ε0/2)δG(v, x) ≤ (1 + ε)δG(v, x). The last inequality follows from ε0 = ε/2 ≤ 1. It remains to bound the size of C(v, P ). Let f (vb) = d(vb) + δG(b, s). As connections are added to C(v, P ) we trace the value of f (vb), where vb is the last connection that we have added. Every time we add a connection va we reduce the value of f by f (vb)− f (va) = d(vb) + δG(b, s)− d(va)− δG(a, s) = d(vb)− d(va) + δG(b, a) > ε0d(va) ≥ ε0δG(v, c). 7Strictly speaking, the strongly-ε-covering set according to our definition is an ε/(ε + 1)-covering set according to the definition used in the statement of Lemma 3.18 of [36]. 69 However, the total change equals f (vc) − f (vs) = d(vc) + δG(c, s) − d(vs) ≤ (1 + ε0)δG(v, c) + δG(c, s) − δG(v, s) ≤ (2 + ε0)δG(v, c). Thus, at most O(ε−1 0 ) = O(ε−1) connections are added to C(v, P ). The same procedure is then repeated for the other endpoint of P , so we get a total of O(ε−1) connections. Lemma 7.8. Let G = (V, E, d) be a planar graph, n = V , 0 < ε ≤ 1. Let P be a shortest path in G. For each v ∈ V (G) we can construct a set of connections C(cid:48)(v, P ) of size O(ε−1 log n), which satisfies the following property. For any two vertices u, w ∈ V , if the shortest path between u and w intersects P , then for some x ∈ P there exist connections ux ∈ C(cid:48)(u, P ) and wx ∈ C(cid:48)(w, P ), such that δ(u, w) ≤ d(ux)+d(wx) ≤ (1+ε)δ(u, w). The sets C(cid:48)(v, P ) can be constructed in O(ε−1n log n) time. Proof. First, using Lemma 7.7, for every v ∈ V we construct an ε-covering sets of connections C(v, P ). Assume that the shortest path Q between u and w intersects P in x ∈ P . There exists a path Q(cid:48) between u and w which consists of a connection, subpath of P , denoted henceforth P , and another connection. Moreover, d(Q(cid:48)) ≤ (1 + ε)d(Q). We call each path of this form an Q(cid:48) approximating path. Our goal is to substitute every approximating path with an approximating path that consists solely of two connections from C(cid:48)(v, P ). The construction is done recursively. The parameter of the recursion is a subpath P (cid:48) of P . Consider a single step, with a parameter P (cid:48) = p1p2 . . . pk. Let pm = p(cid:98)k/2(cid:99) be the middle vertex of P (cid:48). For any v ∈ V and pi ∈ P (cid:48), if there is an connection vpi ∈ C(v, P ), we add a connection vpm of length d(vpi) + δ(pi, pm) to C(cid:48)(v, P ). Then, we recurse on P1 = p1p2 . . . pm−1 and P2 = pm+1 . . . pk. Lastly, for each pi ∈ P we add a connection pipi of length 0. To prove the correctness of the procedure, consider now the aforementioned approximating path P = P ∩ Q(cid:48). Let p be the vertex that is taken as pm in the closest to root Q(cid:48), and recall that Q(cid:48) node in the recursion tree of the algorithm, among all vertices of Q(cid:48) P . Observe that in the single recursive step when pm = p, we add to C(cid:48)(v, P ) the connections up and wp of length exactly equal to the length of the part of Q(cid:48) between u and p, and the part of q(cid:48) between p and w, respectively. Also, the connections we add clearly do not cause any distances to be underestimated. The running time of each step is proportional to the length of the subpath we consider and the number of connections incident to this subpath. Moreover, every connection may be considered in at most O(log n) recursive calls, so we we add to C(cid:48)(v, P ) at most O(ε−1 log n) connections. It follows that the total running time of the procedure is O(ε−1n log n). Lemma 7.9. Let G = (V, E, d) be a planar graph, n = V , 0 < ε ≤ 1. We can construct a bipartite emulator B = (V ∪ N, EB, dB) of G of stretch 1 + ε. The degree of every v ∈ V in B is O(ε−1 log2 n). The graph B can be constructed in O(ε−1n log2 n). Proof. We begin with B being a graph with vertex set V and no edges. The construction is done recursively. As it is shown, e.g., in [36], each planar graph admits a balanced separator that consists of a constant number of shortest paths P1, . . . , Pk, and, moreover, such a separator can be found in O(n) time. For each path Pi we use Lemma 7.8 to construct a set of connections C(cid:48)(v, Pi) for every v ∈ V . Next, we iterate through the vertices of the paths Pi. For each vertex w ∈ Pi we add a new auxiliary vertex w(cid:48) to B and add an edge uw(cid:48) for each connection uw from G (the length of 70 the edge is the length of the connection). After that, we recurse on each connected component of G \ (P1 ∪ . . . ∪ Pk). Let us now prove the correctness of the construction. Consider any two v1, v2 ∈ V and the shortest path Q between them. At some step of the recursion, some vertex of Q belongs to the separator that we have found. From the construction, it follows that in this step we have added to B a vertex w(cid:48) and edges v1w(cid:48) and v2w(cid:48) to B of total length at most (1 + ε)δG(v1, v2). Moreover, since the length of every connection is lower bounded by the length of the corresponding shortest path, B may not underestimate the distances between vertices of V . Since every vertex v ∈ V takes part in O(log n) recursive steps and in every step we add O(ε−1 log n) edges incident to any v ∈ V , we have that the degree of any vertex of V in B is O(ε−1 log2 n). As shown in [36], finding the separators requires O(n log n) total time. The running time of every recursive step is dominated by the time from Lemma 7.8. Summing this over all recursive steps, we get that the construction can be done in O(ε−1n log2 n) time. By constructing B according to Lemma 7.9 and applying Lemma 7.4 we obtain the following. Theorem 7.10. Let G = (V, E, d) be a planar graph and 0 < ε ≤ 1. Let S ⊆ V be a dy- namic set, subject to vertex insertions and removals (initially S = ∅). Then, after preprocessing in O(ε−1n log2 n) time, we may maintain a (4 + ε)-approximate Steiner tree that spans S, handling each update to S in O(ε−1 log6 n) amortized time. 8 Conclusions In our work we have given the first sublinear dynamic algorithms for the Steiner tree problem and the subset TSP problem, where the set of terminals changes over time. We have exhibited a tight connection to vertex-color distance oracles and the replacement schemes previously developed for the online model. We believe our result would inspire further work on the dynamic Steiner tree problem, focusing not only on the number of replacements required to maintain a good Steiner tree (as in the online model), but also on the entire efficiency of updates. In particular, we would like to emphasize here the following open questions. 1. The approximation guarantee of our dynamic algorithms, even for planar graphs, contains the term 2, inherited from the fact that we approximate Steiner tree by a minimum spanning tree in the metric closure of the input graph. We have chosen this approach for its simplicity. Can any of the approximation algorithms that guarantees better approximation than 2 be adapted to our dynamic setting? In particular, there exists a PTAS for the (static) Steiner tree problem in planar graphs [9]. Can we obtain a dynamic (1 + ε)-approximation algorithm for planar graphs? The other direction to approach this question is to devise simple and almost linear time approximation algorithm for Steiner tree that would beat the factor of 2 in non-planar graphs. This could be of some practical importance in big data applications. 2. A second question concerning better approximation ratios would be whether it is possible to obtain a c-approximate vertex-color distance oracle in general graphs for some constant c < 3. 71 3. In the deletion step, we relied on a somehow weak variant of a color-to-color distance query, where the returned distance takes into account only portal distances between the colors. Is it possible to enhance our oracles to perform a general color-to-color queries efficiently? 4. Our decremental and fully dynamic algorithms for general graphs require preprocessing time n). Can it be improved to near- nm) and space of roughly order O(n √ of roughly order O( linear time and space? √ 5. The running time of our fully dynamic algorithms depends on the stretch of the metric. Can this dependency be avoided, or at least further reduced? 6. Which other combinatorial problems, e.g., facility location, allow for dynamic sublinear time approximation algorithms? References [1] I. Abraham, D. Malkhi, and D. Ratajczak. Compact multicast routing. In 23rd International Symposium on Distributed Computing (DISC 2009). Springer Verlag, September 2009. [2] E. Aharoni and R. Cohen. Restricted dynamic steiner trees for scalable multicast in datagram networks. In INFOCOM '97. Sixteenth Annual Joint Conference of the IEEE Computer and Communications Societies. Driving the Information Revolution., Proceedings IEEE, volume 2, pages 876–883 vol.2, Apr 1997. [3] S. Alstrup, J. Holm, K. de Lichtenberg, and M. Thorup. Maintaining information in fully dynamic trees with top trees. ACM Transactions on Algorithms, 1(2):243–264, 2005. [4] E. Anshelevich, A. Dasgupta, J. Kleinberg, E. Tardos, T. Wexler, and T. Roughgarden. The In In FOCS, pages 295–304, price of stability for network design with fair cost allocation. 2004. [5] S. Arora. Polynomial time approximation schemes for Euclidean traveling salesman and other geometric problems. J. ACM, 45(5):753–782, 1998. [6] F. Bauer and A. Varma. ARIES: A rearrangeable inexpensive edge-based on-line Steiner algorithm. IEEE Journal of Selected Areas in Communications, 15:382–397, 1995. [7] M. W. Bern and P. E. Plassmann. The Steiner problem with edge lengths 1 and 2. Inf. Process. Lett., 32(4):171–176, 1989. [8] V. Bil`o, M. Flammini, and L. Moscardelli. The price of stability for undirected broadcast network design with fair cost allocation is constant. In FOCS, pages 638–647. IEEE Computer Society, 2013. [9] G. Borradaile, P. N. Klein, and C. Mathieu. An O(n log n) approximation scheme for Steiner tree in planar graphs. ACM Transactions on Algorithms, 5(3), 2009. [10] J. Byrka, F. Grandoni, T. Rothvoss, and L. Sanit`a. Steiner tree approximation via iterative randomized rounding. J. ACM, 60(1):6:1–6:33, Feb. 2013. 72 [11] T. M. Chan. Dynamic subgraph connectivity with geometric applications. In Proceedings of the Thiry-fourth Annual ACM Symposium on Theory of Computing, STOC '02, pages 7–13, New York, NY, USA, 2002. ACM. [12] T. M. Chan, M. Patra¸scu, and L. Roditty. Dynamic connectivity: Connecting to net- works and geometry. SIAM Journal on Computing, 40(2):333–349, 2011. See also FOCS'08, arXiv:0808.1128. [13] S. Chechik. Improved distance oracles and spanners for vertex-labeled graphs. In L. Epstein and P. Ferragina, editors, ESA, volume 7501 of Lecture Notes in Computer Science, pages 325–336. Springer, 2012. [14] X. Cheng, Y. Li, D.-Z. Du, and H. Ngo. Steiner trees in industry. In D.-Z. Du and P. Pardalos, editors, Handbook of Combinatorial Optimization, pages 193–216. Springer US, 2005. [15] F. Chung. Graph theory in the information age. Notices of the American Mathematrical Society, 57(06):726. [16] M. Cygan, L. Kowalik, M. Mucha, M. Pilipczuk, and P. Sankowski. Fast approximation in subspaces by doubling metric decomposition. In ESA (1), pages 72–83, 2010. [17] S. E. Deering and D. R. Cheriton. Multicast routing in datagram internetworks and extended lans. ACM Trans. Comput. Syst., 8(2):85–110, May 1990. [18] C. Demetrescu, D. Eppstein, Z. Galil, and G. F. Italiano. Algorithms and theory of compu- tation handbook. chapter Dynamic Graph Algorithms, pages 9–9. Chapman & Hall/CRC, 2010. [19] N. Garg, A. Gupta, S. Leonardi, and P. Sankowski. Stochastic analyses for online combinatorial optimization problems. In SODA, pages 942–951, 2008. [20] A. Gu, A. Gupta, and A. Kumar. The power of deferral: maintaining a constant-competitive Steiner tree online. In STOC, pages 525–534, 2013. [21] A. Gupta and A. Kumar. Online Steiner tree with deletions. In C. Chekuri, editor, SODA, pages 455–467. SIAM, 2014. [22] A. Gupta, M. P´al, R. Ravi, and A. Sinha. Boosted sampling: approximation algorithms for stochastic optimization. In STOC, pages 417–426, 2004. [23] T. Hagerup, P. B. Miltersen, and R. Pagh. Deterministic dictionaries. Journal of Algorithms, 41(1):69 – 85, 2001. [24] M. R. Henzinger, P. N. Klein, S. Rao, and S. Subramanian. Faster shortest-path algorithms for planar graphs. J. Comput. Syst. Sci., 55(1):3–23, 1997. [25] D. Hermelin, A. Levy, O. Weimann, and R. Yuster. Distance oracles for vertex-labeled graphs. In ICALP, pages 490–501, 2011. [26] J. Holm, K. de Lichtenberg, and M. Thorup. Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity. J. ACM, 48(4):723–760, 2001. 73 [27] S.-P. Hong, H. Lee, and B. H. Park. An efficient multicast routing algorithm for delay-sensitive applications with dynamic membership. In INFOCOM '98. Seventeenth Annual Joint Con- ference of the IEEE Computer and Communications Societies. Proceedings. IEEE, volume 3, pages 1433–1440 vol.3, Mar 1998. [28] M. Imase and B. M. Waxman. Dynamic Steiner tree problem. SIAM J. Discrete Math., 4(3):369–384, 1991. [29] M. Li, C. Ma, and L. Ning. In Theory and Applications of Models of Computation, volume 7876 of Lecture Notes in Computer Science, pages 42–51. 2013. (1 + )-distance oracles for vertex-labeled planar graphs. [30] N. Megow, M. Skutella, J. Verschae, and A. Wiese. The power of recourse for online MST and TSP. In ICALP, pages 689–700. 2012. [31] K. Mehlhorn. A faster approximation algorithm for the Steiner problem in graphs. Inf. Process. Lett., 27(3):125–128, 1988. [32] J. S. B. Mitchell. Guillotine subdivisions approximate polygonal subdivisions: A simple polynomial-time approximation scheme for geometric TSP, k-MST, and related problems. SIAM J. Comput, 28:402–408, 1996. [33] S. Raghavan, G. Manimaran, C. Siva, and R. Murthy. A rearrangeable algorithm for the construction of delay-constrained dynamic multicast trees. IEEE/ACM Transactions on Net- working, 7:514–529, 1999. [34] G. Robins and A. Zelikovsky. Tighter bounds for graph Steiner tree approximation. SIAM J. Discret. Math., 19(1):122–134, May 2005. [35] R. E. Tarjan. Dynamic trees as search trees via euler tours, applied to the network simplex algorithm. Mathematical Programming, 78:169–177, 1997. [36] M. Thorup. Compact oracles for reachability and approximate distances in planar digraphs. J. ACM, 51:993–1024, 2004. [37] M. Thorup and U. Zwick. Approximate distance oracles. J. ACM, 52(1):1–24, 2005. [38] D. E. Willard. Log-logarithmic worst-case range queries are possible in space Θ(n). Inf. Process. Lett., 17(2):81–84, 1983. 74
1910.14387
1
1910
2019-10-31T11:37:52
Efficient Synthesis of Weighted Marked Graphs with Circular Reachability Graph, and Beyond
[ "cs.DS" ]
In previous studies, several methods have been developed to synthesise Petri nets from labelled transition systems (LTS), often with structural constraints on the net and on the LTS. In this paper, we focus on Weighted Marked Graphs (WMGs) and Choice-Free (CF) Petri nets, two weighted subclasses of nets in which each place has at most one output; WMGs have the additional constraint that each place has at most one input. We provide new conditions for checking the existence of a WMG whose reachability graph is isomorphic to a given circular LTS, i.e. forming a single cycle; we develop two new polynomial-time synthesis algorithms dedicated to these constraints: the first one is LTS-based (classical synthesis) while the second one is vector-based (weak synthesis) and more efficient in general. We show that our conditions also apply to CF synthesis in the case of three-letter alphabets, and we discuss the difficulties in extending them to CF synthesis over arbitrary alphabets.
cs.DS
cs
Efficient Synthesis of Weighted Marked Graphs with Circular Reachability Graph, and Beyond Raymond Devillers1, Evgeny Erofeev()⋆2, and Thomas Hujsa⋆⋆3 1 Département d'Informatique, Université Libre de Bruxelles, B-1050 Brussels, Belgium ([email protected]) 2 Department of Computing Science, Carl von Ossietzky Universität Oldenburg, D-26111 Oldenburg, Germany ([email protected]) 3 LAAS-CNRS, Université de Toulouse, CNRS, Toulouse, France ([email protected]) Abstract. In previous studies, several methods have been developed to synthesise Petri nets from labelled transition systems (LTS), often with structural constraints on the net and on the LTS. In this paper, we focus on Weighted Marked Graphs (WMGs) and Choice-Free (CF) Petri nets, two weighted subclasses of nets in which each place has at most one output; WMGs have the additional constraint that each place has at most one input. We provide new conditions for checking the existence of a WMG whose reachability graph is isomorphic to a given circular LTS, i.e. forming a single cycle; we develop two new polynomial-time synthesis algorithms dedicated to these constraints: the first one is LTS-based (classical syn- thesis) while the second one is vector-based (weak synthesis) and more efficient in general. We show that our conditions also apply to CF syn- thesis in the case of three-letter alphabets, and we discuss the difficulties in extending them to CF synthesis over arbitrary alphabets. Keywords: Weighted Petri net, weighted marked graph, choice-free net, syn- thesis, weak synthesis, labelled transition system, cycle, cyclic word, circular solvability, polynomial-time algorithm, P-vector, T-vector, Parikh vector. 1 Introduction Petri nets form a highly expressive and intuitive operational model of discrete event systems, capturing the mechanisms of synchronisation, conflict and concur- rency. Many of their fundamental behavioural properties are decidable, allowing to model and analyse numerous artificial and natural systems. However, most in- teresting model checking problems are worst-case intractable, and the efficiency of synthesis algorithms varies widely depending on the constraints imposed on the desired solution. In this study, we focus on the Petri net synthesis problem ⋆ Supported by DFG through grant Be 1267/16-1 ASYST. ⋆⋆ Supported by the STAE foundation/project DAEDALUS, Toulouse, France. from a labelled transition system (LTS), which consists in determining the ex- istence of a Petri net whose reachability graph is isomorphic to the given LTS, and building such a Petri net solution when it exists. In previous studies on analysis or synthesis, structural restrictions on nets encompassed plain nets (each weight equals 1; also called ordinary nets) [32], ho- mogeneous nets (for each place p, all the output weights of p are equal) [36,28], free-choice nets (the net is plain, and any two transitions sharing an input have the same set of inputs) [14,36], join-free nets (each transition has at most one input place) [36,13,27,28]. Recently, another kind of restriction has been consid- ered, limiting the number of distinct labels of the LTS [4,5,23,24]. Depending on the constraints on the solution to be constructed, the com- plexity of the synthesis problem can vary widely: the problem can be solved in polynomial-time for bounded Petri nets [2], while aiming at elementary net sys- tems, or at various other Petri net subclasses with fixed marking bound, makes the problem NP-complete [3,37]. In this paper, we study the solvability of LTS with weighted marked graphs (WMGs; each place has at most one output and one input) and choice-free nets (CF; each place has at most one output). Both classes are important for real- world applications, and are widely studied in the literature [35,26,18,11,34,10,20,9]. We focus mainly on finite circular LTS, i.e. strongly connected LTS that contain a unique cycle 4. In this context, we investigate the cyclic solvability of a word w, meaning the existence of a Petri net solution to the finite circular LTS induced by the infinite cyclic word w∞. These restrictions appear in practical situations, since various complex applications can be decomposed into subsystems satisfy- ing such constraints [25,4,23,6,10,22,16,17]. Contributions. We study further the links between simple LTS structures and the reachability graph of WMGs and CF nets, as follows. First, we show that a binary (i.e. over a two-letter alphabet) LTS is CF-solvable if and only if it is WMG-solvable. Then, we develop new conditions for WMG-solving a cyclic word over an arbitrary alphabet, with a polynomial-time synthesis algorithm. We show that a word over a three-letter alphabet is cyclically WMG-solvable iff it is cyclically CF-solvable, and that this result does not hold with four-letter alphabets. More generally, we discuss the difficulties of extending these results to CF synthesis over arbitrary alphabets. We introduce the notion of weak synthesis, which aims at synthesising a Petri net from a given transition-vector Υ instead of a sequence: the solution obtained enables some sequence whose Parikh vector equals Υ . This allows to be less restrictive on the solution design. Then, we provide a polynomial-time algorithm for the weak synthesis of WMGs with circular reachability graphs. 4 A set A of k arcs in a LTS G defines a cycle of G if the elements of A can be ordered as a sequence a1 . . . ak such that, for each i ∈ {1, . . . , k}, ai = (ni, ℓi, ni+1) and nk+1 = n1, i.e. the i-th arc ai goes from node ni to node ni+1 until the first node n1 is reached, closing the path. 2 Finally, we show that our weak synthesis algorithm performs generally much faster than the sequence-based algorithm. Comparing with [19], we provide more details, we add the equivalence result on CF nets for three-letter alphabets in Subsection 4.4 and the new Section 5 on weak synthesis, with a new synthesis algorithm and the study of its complexity. Organisation of the paper. After recalling classical definitions, notations and properties in Section 2, we present the equivalence of CF- and WMG-solvability for 2-letter words in Section 3. In Section 4, we focus on circular LTS: we give a new characterisation of WMG-solvability and a dedicated polynomial-time synthesis algorithm. We prove the equivalence between cyclic WMG and CF synthesis for three-letter alpha- bets. We also provide a number of examples showing that some of our results cannot be applied to the class of CF-nets over arbitrary alphabets. Section 5 contains our study of the weak synthesis problem for WMGs with a circular reachability graph, with a new polynomial-time synthesis algorithm. Finally, Section 6 presents our conclusions and perspectives. 2 Classical Definitions, Notations and Properties LTS, sequences and reachability. A labelled transition system with initial state, LTS for short, is a quadruple TS = (S, →, T, ι) where S is the set of states, T is the (finite) set of labels, → ⊆ (S × T × S) is the transition relation, and ι ∈ S is the initial state. A label t is enabled at s ∈ S, written s[ti, if ∃s′ ∈ S : (s, t, s′) ∈→, in which case s′ is said to be reachable from s by the firing of t, and we write s[tis′. Generalising to any (firing) sequences σ ∈ T ∗, s[εi and s[εis are always true, with ε being the empty sequence; and s[σtis′, i.e., σt is enabled from state s and leads to s′ if there is some s′′ with s[σis′′ and s′′[tis′. For clarity, in case of long formulas we write ⌊rσ⌊sτ ⌊q instead of r[σis[τ iq, thus fixing some intermediate states along a firing sequence. A state s′ is reachable from state s if ∃σ ∈ T ∗ : s[σis′. The set of states reachable from s is noted [si. Petri nets and reachability graphs. A (finite, place-transition) weighted Petri net, or weighted net, is a tuple N = (P, T, W ) where P is a finite set of places, T is a finite set of transitions, with P ∩ T = ∅ and W is a weight function W : ((P × T ) ∪ (T × P )) → N giving the weight of each arc. A Petri net system, or system, is a tuple S = (N, M0) where N is a net and M0 is the initial marking, which is a mapping M0 : P → N (hence a member of NP ) indicating the initial number of tokens in each place. The incidence matrix I of the net is the integer P × T -matrix with components I(p, t) = W (t, p) − W (p, t). A place p ∈ P is enabled by a marking M if M (p) ≥ W (p, t) for every transi- tion t ∈ T . A transition t ∈ T is enabled by a marking M , denoted by M [ti, if for all places p ∈ P , M (p) ≥ W (p, t). If t is enabled at M , then t can occur (or fire) in M , leading to the marking M ′ defined by M ′(p) = M (p) − W (p, t) + W (t, p); we note M [tiM ′. A marking M ′ is reachable from M if there is a sequence of 3 firings leading from M to M ′. The set of markings reachable from M is denoted by [M i. The reachability graph of S is the labelled transition system RG(S) with the set of vertices [M0i, the set of labels T , initial state M0 and transitions {(M, t, M ′) M, M ′ ∈ [M0i∧M [tiM ′}. A system S is bounded if RG(S) is finite. Vectors. The support of a vector is the set of the indices of its non-null compo- nents. Consider any net N = (P, T, W ) with its incidence matrix I. A T-vector (respectively P-vector) is an element of NT (respectively NP ); it is called prime if the greatest common divisor of its components is one (i.e., it is non-null and its components do not have a common non-unit factor). A T-semiflow ν of the net is a non-null T-vector such that I · ν = 0. A T-semiflow is called minimal when it is prime and its support is not a proper superset of the support of any other T-semiflow [35]. The Parikh vector P(σ) of a finite transition sequence σ is a T-vector count- ing the number of occurrences of each transition in σ, and the support of σ is the support of its Parikh vector, i.e., supp(σ) = supp(P(σ)) = {t ∈ T P(σ)(t) > 0}. Strong connectedness and cycles in LTS. The LTS is said reversible if, ∀s ∈ [ιi, we have ι ∈ [si, i.e., it is always possible to go back to the initial state; reversibility implies the strong connectedness of the LTS. A sequence s[σis′ is a cycle, or more precisely a cycle at (or around) state s, if s = s′. A non-empty cycle s[σis is called small if there is no non-empty cycle s′[σ′is′ in TS with P(σ′) (cid:8) P(σ) (the definition of Parikh vectors extends readily to sequences over the set of labels T of the LTS). A cycle s[σis is prime if P(σ) is prime. TS has the prime cycle property if each small cycle has a prime Parikh vector. A circular LTS is a finite, strongly connected LTS that contains a unique cycle; hence, it has the shape of an oriented circle. The circular LTS induced by a word w = w1 . . . wk is defined as s0[w1is1[w2is2 . . . [wkis0 with initial state s0. All notions defined for labelled transition systems apply to Petri nets through their reachability graphs. Petri net subclasses. A net N = (P, T, W ) is plain if no arc weight ex- ceeds 1; pure if ∀p ∈ P : (p•∩•p) = ∅, where p• = {t ∈ T W (p, t)>0} and •p = {t ∈ T W (t, p)>0}; choice-free (CF) [12,35] or place-output-nonbranching (ON) [6] if ∀p ∈ P : p• ≤ 1; a weighted marked graph (WMG) if p• ≤ 1 and •p ≤ 1 for all places p ∈ P . The WMGs form a subclass of the CF nets and contain the weighted T-systems (WTSs) of [34], also known as weighted event graphs (WEGs) in [31], in which ∀p ∈ P , •p = 1 and p• = 1. Plain WEGs are also known as marked graphs [11] or T-nets [14]. Isomorphism and solvability. Two LTS TS 1 = (S1, →1, T, s01) and TS 2 = (S2, →2, T, s02) are isomorphic if there is a bijection ζ : S1 → S2 with ζ(s01) = s02 and (s, t, s′) ∈→1 ⇔ (ζ(s), t, ζ(s′)) ∈→2, for all s, s′ ∈ S1. If an LTS TS is isomorphic to RG(S), where S is a system, we say that S solves TS . Solving a 4 word w = ℓ1 . . . ℓk amounts to solve the acyclic LTS defined by the single path ι[ℓ1is1 . . . [ℓkisk. A finite word w is cyclically solvable if the circular LTS induced by w is solvable. An LTS is WMG- (or CF-)solvable if a WMG (or a CF system) solves it. Separation problems. Let T S = (S, →, T, s0) be a given labelled transition system. The theory of regions [1] characterises the solvability of an LTS through the solvability of a set of separation problems. In case the LTS is finite, we have to solve 1 2 ·S·(S−1) states separation problems and up to S·T event/state separation problems, as follows: -- A region of (S, →, T, s0) is a triple (R, B, F) ∈ (S → N, T → N, T → N) such that for all s[tis′, R(s) ≥ B(t) and R(s′) = R(s)− B(t)+ F(t). A region models a place p, in the sense that B(t) models W (p, t), F(t) models W (t, p), and R(s) models the token count of p at the marking corresponding to s. -- A states separation problem (SSP for short) consists of a set of states {s, s′} with s 6= s′, and it can be solved by a place distinguishing them, i.e., has a different number of tokens in the markings corresponding to the two states. -- An event/state separation problem (ESSP for short) consists of a pair (s, t) ∈ S×T with ¬s[ti. For every such problem, one needs a place p such that M (p) < W (p, t) for the marking M corresponding to state s, where W refers to the arcs of the hoped-for net. On the other hand, for every edge (s′, t, s′′) ∈→ we must guarantee M ′(p) ≥ W (p, t), M ′ being the marking corresponding to state s′. If the LTS is infinite, also the number of separation problems (of each kind) becomes infinite. A synthesis procedure does not necessarily lead to a connected solution. How- ever, the technique of decomposition into prime factors described in [15,16] can always be applied first, so as to handle connected partial solutions and recombine them afterwards. Hence, in the sequel, we focus on connected nets, w.l.o.g. In the next section, we consider the CF synthesis problem with two distinct labels. 3 Reversible Binary CF Synthesis In this section, we relate CF- to WMG-solvability for binary reversible LTS. Lemma 1 (Pure CF-solvability). If a reversible LTS has a CF solution, it has a pure CF solution. Proof. Let TS = (S, →, T, ι) be a reversible LTS. If t ∈ T does not occur in →, TS is solvable iff TS ′ = (S, →, T \ {t}, ι) is solvable and a possible solution of TS is obtained by adding to any solution of TS ′ a transition t and a fresh place p, initially empty, with an arc from p to t (e.g. with weight 1), so that p is not a side condition5. We can thus assume that each label of T occurs in →. 5 A place p is a side condition if •p ∩ p• 6= ∅. 5 k1 k2 a1 a2 . . . am km h k+h µ0 p x Fig. 1. A general pure (h = 0) or non-pure (h > 0) choice-free place p with initial marking µ0. Place p has at most one outgoing transition named x. The set {a1, . . . , am} comprises all other transitions, i.e., T = {x, a1, . . . , am}, and kj denotes the weight of the arc from aj to p (which could be zero). The general form of a place in a CF solution is exhibited in Fig. 1. If h = 0, we are done, so that we shall assume h > 0. If −h ≤ k < 0, the marking of p cannot decrease, and since x occurs in →, the system cannot be reversible. If k = 0, for the same reason all the ki's must be null too, µ0 ≥ h, and we may drop p. Hence we assume that k > 0 and ∃i : ki > 0. Once x occurs, the marking of p is at least h, remains so, and since the system is reversible, all the reachable markings have at least h tokens in p. But then, if we replace p by a place p′ with initially µ0 − h tokens, the same ki's and h = 0, we get exactly the same reachability graph, but with h tokens less in p′ than in p. This will wipe out the side condition for p, and repeating this for each side ⊓⊔ condition, we get an equivalent pure and choice-free solution. Theorem 1 (Reversible binary CF-solvability). A binary reversible LTS is CF-solvable iff it is WMG-solvable. Proof. If we have two labels, from Lemma 1, if there is a CF solution, there will be one with places of the form exhibited in Fig. 2, hence a WMG solution. ⊓⊔ m a pa,b µ0 n b Fig. 2. A generic pure CF-place with two labels. In the next section, the number of letters is no more restricted. 4 Cyclic WMG- and CF-solvablity In this section, we recall and extend conditions for WMG-solvability of some restricted classes of LTS formed by a single circuit, which were developed in [18]. We gradually study the separation problems -- SSPs in Subsection 4.1 and ES- SPs in Subsection 4.2 -- for cyclic solvability with WMGs, leading to a language- theoretical characterisation of cyclically WMG-solvable sequences. The charac- terisation gives rise to a polynomial-time synthesis algorithm in Subsection 4.3, which is shown to be more efficient than the classical synthesis approach. 6 Finally, in Subsection 4.4, we study the extensibility of these results to the CF case: for three-letter alphabets, we show that a word is cyclically WMG-solvable iff it is cyclically CF-solvable; unfortunately, for arbitrary alphabets, we show with the help of examples that the other results cannot be directly extended. In the following, two distinct labels a and b are called (circularly) adjacent in a word w if w = (w1abw2) or w = (bw3a) for some w1, w2, w3 ∈ T ∗. We denote by pa,∗ any place pa,b where b is adjacent to a. Also, if T = {t0, t1, . . . , tm} with m > 0, at least one label is adjacent to t0, and at each point at least one label is adjacent to the ones we distinguished so far, until we get the whole set T ; we can thus start from any label ti instead of t0. Theorem 2 (Sufficient condition for cyclic WMG-solvability [18]). Consider any word w over any finite alphabet T such that P(w) is prime. Sup- pose the following: ∀u = w t1t2 (i.e., the projection6 of w on {t1, t2}) for some circularly adjacent labels t1, t2 in w, u = vℓ for some positive integer ℓ, P(v) is prime, and v is cyclically solvable by a circuit (i.e., a circular net). Then, w is cyclically solvable with a WMG. Theorem 3 (Cyclic WMG-solvability of ternary words [18]). Consider a ternary word w (with three letters in its alphabet T ) with Parikh vector (x, x, y) such that gcd(x, y) = 1. Then, w is cyclically solvable with a WMG if and only if, for any pair t1 6= t2 ∈ T such that w = (w1t1t2w2) or w = (t2w3t1), u = vℓ for some positive integer ℓ with u = w t1t2 , P(v) is prime, and v is cyclically solvable by a circuit. 3 3 a 2 c d 3 3 b 2 a 3 3 3 c d e 3 3 3 b 3 3 a 2 c d 3 3 b 2 Fig. 3. The WMG on the left solves aacbbdabd cyclically, and the WMG in the middle solves aacbbeabd cyclically. On the right, the WMG solves abcabdabd cyclically. For a circular LTS, the solvability of its binary projections by circuits is a sufficient condition, as specified by Theorem 2, but it turns out not to be a necessary one. Indeed, for the cyclically solvable sequence w1 = aacbbdabd (cf. left of Fig. 3), its binary projection on {a, b} is w1 a,b = aabbab which is not cyclically solvable with a WMG (neither generally solvable). Looking only at the Parikh vector of the sequence is also not enough to establish its cyclic (un)solvability. For instance, sequences w2 = abcabdabd and w3 = abcbadabd are 6 The projection of a word w ∈ A∗ on a set A′ ⊆ A of labels is the maximum subword of w whose labels belong to A′, noted w A′ . For example, the projection of the word w = ℓ1 ℓ2 ℓ3 ℓ2 on the set {ℓ1, ℓ2} is the word ℓ1 ℓ2 ℓ2. 7 Parikh-equivalent: P(w2) = P(w3) = (3, 3, 1, 2) (and also Parikh-equivalent to w1), but w2 is cyclically solvable with a WMG (e.g. with the WMG on the right of Fig. 3) and w3 is not WMG-cyclically solvable. All the binary projections of w1 and w3 are cyclically WMG-solvable, except wi a,b. Only the unsolvability of w3 a,b implies the unsolvability of w3. Since all the wi are Parikh-equivalent, then so are their binary projections. Thus, we have to analyse the sequences themselves, without abstracting to Parikh vectors. Since the projections w1 a,b and w3 a,b are equivalent (up to cyclic rotation and swapping a and b), it is not sufficient to check the 'problematic' binary projections. We then study the conditions for solvability of separation problems. 4.1 SSPs for Prime Cycles For any word w = t0 . . . tk, for 0 ≤ i, j ≤ k such that i 6= j, we note Pij = P(titi+1 . . . tj−1) if i < j and Pij = P(titi+1 . . . tk−1tkt0t1 . . . tj−1) if i > j. Lemma 2 (SSPs are solvable for prime cycles). For a cyclic transition system T S = (S, →, T, s0) defined by some word w = t0 . . . tk, where S = {s0, . . . , sk}, →= {(si−1, ti−1, si) 1 ≤ i ≤ k} ∪ {(sk, tk, s0)}, if P(w) is prime then all the SSPs are solvable. Proof. If T = 1, then k = 0 and S = 1, so that there is no SSP to solve. We may thus assume T > 1. For each pair of distinct labels a, b ∈ T that are adjacent in T S, construct places pa,b (and pb,a since adjacency is commutative) as in Fig. 2 with m = P(w)(b) gcd(P(w)(a), P(w)(b)) , n = P(w)(a) gcd(P(w)(a), P(w)(b)) , (1) and µ0 = n · P(w)(b). Clearly, the markings of pa,b reachable by repeatedly firing u = w ab are always non-negative, and the initial marking is reproduced after each repetition of the sequence u. Consider two distinct states si, sj ∈ S (w.l.o.g. i < j). We now demonstrate that there is at least one place of the form pa,b such that Mi(pa,b) 6= Mj(pa,b), where Ml denotes the marking corresponding to state sl for 0 ≤ l ≤ k. If j − i = 1, then any place of the form pti,∗ distinguishes states si and sj. The same is true if j − i > 1 but ∀l ∈ [i, j − 1] : tl = ti. Otherwise, choose some letter a from ti . . . tj−1 and an adjacent letter b. Then Mj(pa,b) = Mi(pa,b) + m · Pij (a) − n · Pij (b). If Mi(pa,b) 6= Mj(pa,b), place pa,b distinguishes si and sj. Otherwise we have m · Pij(a) = n · Pij(b), hence, due to the choice of m and n: Pij(a) P(w)(a) = Pij (b) P(w)(b) (so that b also belongs to ti . . . tj−1). Consider some other letter c which is adjacent to a or b. If place pa,c distinguishes si and sj, we are done. Otherwise, due to the choice of the arc weights for these places, we have Pij (a) P(w)(a) = Pij (c) P(w)(c) = Pij (b) P(w)(b) . 8 Since ti . . . tj−1 is finite, by progressing along the adjacency relation, either we find a place which has different markings at si and sj, or for all a, b ∈ supp(ti . . . tj−1) we have Pij (a) P(w)(a) = Pij (b) P(w)(b) . If supp(ti . . . tj−1) = supp(w), P(w) is proportional to P(ti . . . tj−1), but since ti . . . tj−1 is smaller than w (otherwise si = sj) this contradicts the primality of P(w). Hence, there exist adjacent c and d such that c ∈ supp(w)\supp(ti . . . tj−1) and d ∈ supp(ti . . . tj−1). For the place pc,d we have Mj(pc,d) 6= Mi(pc,d). ⊓⊔ This property has some similarities with Theorem 4.1 in [21], but the precon- ditions are different. The reachability graph of any CF net, hence of any WMG, satisfies the prime cycle property [7,8]. Thus, primeness of a sequence avoids solving SSPs when aiming at these two classes of Petri nets. 4.2 ESSPs in Cyclic WMG-Solvability Now, we develop further conditions for the cyclic WMG-solvability. Lemma 3 (Special form of WMG solutions for cycles). If w ∈ T ∗ is cyclically solvable by a WMG, there exists a WMG S = ((P, T, W ), M0), where P consists of places pa,b, for each pair of distinct circularly adjacent a and b (i.e., either w = u1abu2 or w = bu3a). Proof. Consider a sequence w = t0 . . . tk, where P(w) is prime. Let us assume that the system ((P, T, W ), M0) is a WMG solving w cyclically. Due to the definition of WMGs, all the places that we have to consider are of the form schematised in Fig. 4. The arc weights may differ due to the parameter l > 0, but the ratio W (a,pa,b) W (pa,b ,b) = m n is determined by the Parikh vector of w and its cyclic solvability; the initial marking is to be defined. Moreover, we have to consider only those places which are connected to the pairs of circularly adjacent transitions in w. Indeed, if w = u1⌊si a⌊si+1 b u2, where b 6= a, si is the state reached after performing u1 and si+1 is the state reached after performing u1a, then any place that solves the ESSP ¬Mi[bi is an input place for b. On the other hand, any place whose marking at Msi differs from its marking at Msi+1 is connected to a. Hence, a place p ∈ P solving ¬Mi[bi is of the form pa,b. Since p is only affected by a and b, it also disables b at all the states between sl and si in w when it is of the form w = u3⌊sj tj ⌊sj+1 b+ ⌊sl u4⌊si abu2 with P(u4)(b) = 0 (in the case there is no b in the prefix between s0 and abu2, sl = s0). Analogously, if tj 6= b, there must be a place q ∈ P of the form ptj ,b that solves ¬Msj [bi. Doing so, we ascertain that the places of the form schematised in Fig. 4 for the adjacent pairs of transitions are sufficient to handle all the ESSPs. In fact, for each pair of adjacent transitions a and b in w, a single place of the form pa,b is sufficient. Indeed, assume there are p1, p2 ∈ P of the form pa,b. gcd(W (a,p2),W (p2,b)) then for any M ∈ [M0i, M (p1) < If gcd(W (a,p1),W (p1,b)) ≥ M0(p1) M0(p2) 9 l · m a pa,b l · n b Fig. 4. A general place from a to b in a WMG solution of w: m = P(w)(b), n = P(w)(a), l may be any multiple of 1/ gcd(m, n). W (p1, b) implies M (p2) < W (p2, b). Hence, p1 is redundant in the system. It means we can choose l as we want (among the multiples of 1/ gcd(m, n)) and only keep the place of the form pa,b in any solution with the smallest initial ⊓⊔ marking. Note that it may happen that we need a place pa,b, but not pb,a. The existence of a WMG solution of this special form allows us to establish a necessary condition for the cyclic solvability of sequences. Lemma 4 (A necessary condition for cyclic solvability with a WMG). If w ∈ T ∗ is cyclically solvable by a WMG, then for any adjacent transitions a and b in w, and any two occurrences of ab in w = u1 ⌊sr a b . . . ⌊sq a b u2, the inequality Prj(b) − 1 Prj(a) < m n < Pjq(b) + 1 Pjq(a) (2) holds true, where m, n are as in (1), r ≤ j ≤ q, and the right inequality is omitted when Pjq(a) = 0 and the left inequality is omitted when Prj(a) = 0. Proof. Let w be cyclically solvable with a WMG S = ((P, T, W ), M0) as in Lemma 3, and place p ∈ P be of the form pa,b (as in Fig. 4, with l = 1 and a well chosen initial marking) for an adjacent pair ab. Choose two ab's in w = u1 ⌊sr a ⌊sr+1 b ⌊sr+2 . . . ⌊sq a ⌊sq+1 b u2 with possibly other letters between sr+2 and sq (if there is only one ab, apply the argumentation while wrapping around w circularly, i.e., sr[wisq). Since p solves ESSPs ¬sr[bi and ¬sq[bi, the next inequalities hold true, where µr denotes the marking of pa,b at state sr: ¬sr[bi : µr sr+1[bi : µr + m < n ≥ n ∀j : r ≤ j ≤ q : µr + Prj(a) · m − Prj(b) · n ≥ 0 ¬sq[bi : µr + Prq(a) · m − Prq(b) · n < n (3) From the first and the third line of (3) we get Prj(a) · m − Prj(b) · n > −n. This implies: Prj(b) − 1 Prj(a) < m n when r < j ≤ q. (4) From the third and the fourth line of (3) we obtain (Prq(a) − Prj(a)) · m − (Prq(b) − Prj(b)) · n < n. If Pjq(a) 6= 0, since Prq = Prj + Pjq this inequality can be written as m n < Pjq(b) + 1 Pjq(a) . 10 (5) Thus, from (4) and (5) we have a necessary condition for solvability. ⊓⊔ In particular, Lemma 4 explains the cyclic unsolvability of the word w3 = ⌊sr ab c b ⌊sj a d ⌊sq ab d. Indeed, P(w3)(b) = 3 = P(w3)(a), so that m/n = 1 and Pjq (b)+1 1 ≮ 0+1 Pjq (a) . Moreover, the necessary condition for cyclic sovability from Lemma 4 extends to a sufficient one in the following sense. 1 = Lemma 5 (A sufficient condition for cyclic solvability by a WMG). If w ∈ T ∗ has a prime Parikh vector, and for each circularly adjacent ab pair in w = . . . ⌊sq a b . . . , the inequality m n < Pjq(b) + 1 Pjq(a) (6) holds true for any sj such that Pjq(a) 6= 0, then w is cyclically WMG-solvable. Proof. We have proved in Lemma 2 that all SSPs are solvable for prime cycles. Let us consider the ESSPs at states s as in w = . . . ⌊sab . . ., i.e. ¬s[bi. Since we are looking for a WMG solution, all the sought places are of the form pa,b (see Lemma 3 and Fig. 4) with m, n as in (1). To define the initial marking of pa,b, let us put n · P(w)(b) tokens on it and fire the sequence w once completely. Choose some state s′ in w = . . . ⌊s′ a . . . such that the number k of tokens on pa,b at state s′ is minimal (it may be the case that such an s′ is not unique; we can choose any such state). Define M0(pa,b) = n · P(w)(b) − k as the initial marking of pa,b. By construction, the firing of w reproduces the markings of pa,b and M0 guarantees their non-negativity. Let us show that the constructed place pa,b solves all the ESSPs ¬s[bi, where w = . . . ⌊sab . . .. Consider such a state s in w (w.l.o.g. we assume s 6= s′, since s′ certainly disables b). From w = u1 ⌊s′ a . . . ⌊s a b u2 (circularly) and from inequality (6) for sj = s′ and sq = s, we get Ps′s(a)·m− Ps′s(b)·n < n since Ps′s(a) > 0. Since Ms′(pa,b) = 0, Ms(pa,b) = Ms′ (pa,b) + Ps′ s(a) · m − Ps′ s(b) · n < n, i.e., pa,b disables b at state s. Now, we show that places of the form pa,b also solve the other ESSPs against b, i.e., at the states where b is not the subsequent transition. Sequence w (up to rotation) can be written as w = u1 bx1 u2 bx2 . . . ul bxl, 1 ≤ l ≤ P(w)(b), and for 1 ≤ i ≤ l: xi > 0, ui ∈ (T \ {b})+. Transition b has to be disabled at all the states between successive b-blocks. Consider an arbitrary pair of such blocks bxj and bxj+1 in w = . . . bxj uj bxj+1 . . . = . . . bxj jt. Place pt,b does not allow b to fire at state r. We have to check that b is not enabled at any state between s and r, i.e., it is not enabled 'inside' u′ j is empty, then s = r, and we are done. Let u′ j)(b) = P(uj)(b) = 0, the marking of place pt,b cannot decrease from s to r, i.e., Ms(pt,b) ≤ Ms′′ (pt,b) ≤ Mr(pt,b) for any s′′ 'inside' u′ j. Since pt,b disables b at r, it then disables b at all states ⊓⊔ between s and r, inclusively. j ⌊r t bxj+1 . . ., with uj = u′ j 6= ε. Due to P(u′ ⌊s u′ j. If u′ From Lemma 4 and Lemma 5 we can deduce the following characterisation. Theorem 4 (A characterisation of cyclic WMG-solvability). A sequence w ∈ T ∗ is cyclically solvable with a WMG iff P(w) is prime and, for any pair of 11 circularly adjacent labels in w, for instance w = . . . ⌊sq ab . . ., m n < Pjq(b) + 1 Pjq(a) holds true with m, n as in (1) for any sj such that Pjq(a) 6= 0. A WMG solution can be found with the places of the form pa,b for every such pair of a and b. 4.3 A Polynomial-time Algorithm for Cyclic WMG-Solvability From the characterisation given by Theorem 4 and the considerations above, Algorithm 1 below synthesises a cyclic WMG solution for a given sequence w ∈ T ∗, if one exists. The algorithm works as follows. Initially, the Parikh vector of the input se- quence is calculated and checked for primeness in lines 2-3. If the Parikh vector is prime, we consecutively consider all the pairs of adjacent letters and examine the inequality from Theorem 4 for them. To achieve it, we take the first two letters in the sequence (lines 4-11), check if the inequality is satisfied for all the states (lines 12-18), and if so, construct a new place connecting the two letters under consideration (19-25). Then, the sequence is cyclically rotated such that the initial letter goes to the end and the second letter becomes initial (line 8). In the new sequence, we take again the first two letters (lines 9-11) and repeat the procedure for them. The algorithm stops after a complete rotation of the initial sequence, and by this moment all the pairs of adjacent letters have been checked. The ordered alphabet is stored in the array T , and the sequence is stored in v. We use variables a and b to store the letters under consideration in each step, ia and ib to store their indices in the alphabet, and na and nb are used for counting their occurrences during the check of the inequality from Theorem 4. Variables M and M min are used to compute the initial marking of the sought place. Polynomial-time complexity of Algorithm 1. For a sequence of length n over an alphabet with m labels, the Parikh vector can be computed in O(n) and its primeness can be checked using e.g. the Euclidean algorithm, with a running time in O(m · log2 2 n). The main for-cycle of Algorithm 1 involves the enumera- tion of all pairs of distinct states of the cycle. For each pair of adjacent labels, a run of the for-cycle consists of a lookup for an index in O(m), the verification of the inequality in O(n) and the construction of a place in O(n), which sums up to O(m + n). Thus, the main for-loop requires a runtime in O(n(n + m)). Taking into account that m ≤ n, and that n growths much faster than log2 2 n, the overall running time of the algorithm does not exceed O(n2). Complexity comparison: the known general approach is less efficient. For a comparison, solving a cycle of length n over m labels with a WMG amounts to solve n(n − 1) SSPs and n(m − 1) ESSPs at most. In the special case of WMG synthesis from a prime cycle, we know that all the SSPs are solvable (Lemma 2) and that solving first the other problems avoids to consider the SSPs (see [20]). 12 Algorithm 1: Synthesis of a WMG solving a cyclic word input : w ∈ T n, T = {t0, . . . , tm−1} output: A WMG system (N, M0) cyclically solving w, if it exists 1 var: T [0 .. m − 1] = (t0, . . . , tm−1), v[0 .. n − 1], a, b, na, nb, ia, ib, M , M min; 2 compute the Parikh vector P[0 .. m − 1] of w; 3 if P is not prime then return unsolvable ; 4 b ← w[0]; 5 for j = 0 to m − 1 do 6 if b = T [j] then ib ← j ; // Parikh-primeness // index of b 7 for i = 0 to n − 1 do 8 v ← w[i] . . . w[n − 1]w[0] . . . w[i − 1] ; a ← b, b ← v[1], ia ← ib ; for j = 0 to m − 1 do if b = T [j] then ib ← j ; na ← 1, nb ← 1 ; if a 6= b then for k = 2 to n − 1 do if P[ib] P[ia] ≥ P[ib]−nb+1 return unsolvable ; P[ia]−na then // rotation of w // fix first adjacent pair // check solvability condition 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 if v[k] = T [ia] then na ← na + 1 ; if v[k] = T [ib] then nb ← nb + 1 ; M ← P[ia] · P[ib], M min ← M ; for k = 0 to n − 1 do if w[k] = a then M ← M + P[ib] ; if w[k] = b then M ← M − P[ia] ; if M < M min then M min ← M ; // find initial marking add new place pT [ia],T [ib] to N with W (T [ia], p) = P[ib], W (p, T [ib]) = P[ia], M0 = P[ia] · P[ib] − M min; 26 return (N, M0) Since each of the sought places has at most one input and one output, each of the separation problems seeks for 3 unknown variables, namely the initial marking of a place, the input and the output arc weights. For an ESSP, the output transition is clearly the one which has to be disabled and the input transition is to be found. So, there are m − 1 possibilities to define a concrete ESSP, which in the worst case gives us up to n(m − 1)2 systems of inequalities to solve all the ESSPs. The general region-based synthesis typically uses ILP-solvers, and using e.g. Karmarkar's algorithm [30] (which is known to be efficient) for solving an ILP- problem with k unknowns, we expect a running time of O(k3.5·L2·log L·log log L) where L is the length of the input in bits. For the case of a cycle, the input of each separation problem is the matrix with the range of (n + 1) × m and the vector of right sides with the range of n+1, where each component of the vector and of the matrix is a natural number not greater than n. Hence, the length of the input 13 for a single separation problem can be estimated as L = (m + 1) · (n + 1) · log2 n bits, implying a runtime of O(n2 · m2 · log2 2 n · log L · log log L) for solving a single separation problem (the number of unknowns being equal to 3, i.e. constant). Thus the general synthesis approach would need a runtime of O(n3 · m4 · LF ) with the logarithmic factor LF = log2 2 n·log((m+1)·(n+1)·log2 n)·log log((m+ 1)·(n+ 1)·log2 n). Note that, with this general approach, some redundant places may be constructed, but they can be wiped out in a post-processing phase. 4.4 CF-solvability vs WMG-solvability of Cycles Let us now relate cyclic WMG-solvability to cyclic CF-solvability. Theorem 5. A sequence u ∈ {a, b, c}∗ is cyclically WMG-solvable iff u is cycli- cally CF-solvable. Proof. WMGs form a proper subclass of CF nets, hence the direct implication. Let now T S = (S, T = {a, b, c}, →, s0) be a CF-solvable circular LTS obtained from u and Υ = P(u). By contraposition, assume that T S is not solvable by a WMG. Then, due to Theorem 4, for some distinct states j, q ∈ S and distinct labels a, b ∈ T Υ (a) Υ (b) ≥ Pjq(a) + 1 Pjq(b) . (7) W.l.o.g. we can choose the leftmost j satisfying (7). Then, in T S we have r[aij for some r ∈ S preceding j. Indeed, if this is not the case and either r[bij or r[cij, then (7) holds true for r and q, contradicting the choice of j. On the other hand, since Pjq(a) + 1 = Prq(a) and Pjq(b) = Prq(b), the inequality (7) implies Υ (a) Υ (b) ≥ Prq(a) Prq(b) . (8) Consider a place p which is an input place of a in a cyclic CF solution of u. From Lemma 1, we can assume pureness, i.e., the place has the form illustrated on the right of Fig. 5 with x = a, y = b, z = c. We must have the following a q j b r a y z ky kz µ0 p x kx Fig. 5. u (left) is cyclically solvable with a CF net; a CF place over {x, y, z} (right). 14 constraints for p: cycle r[ai r[a . . .iq : kb · Υ (b) + kc · Υ (c) = ka · Υ (a) : Mr(p) ≥ ka : Mq(p) = Mr(p) + kb · Prq(b) + kc · Prq(c) − ka · Prq(a). (9) If Prq(c) ≥ Prq(a) · Υ (c) Υ (a) , then due to (8) and (9), Mq(p) = Mr(p) + kb · Prq(b) + kc · Prq(c) − ka · Prq(a) ≥ ka + (cid:0)kb · Υ (b) Υ (a) + kc · Υ (c) Υ (a) − ka(cid:1) · Prq(a) = ka, implying q[ai which contradicts q[bi. Hence, Prq(c) < Prq(a) · Υ (c) with (8), we have Υ (a) . Together Prq(b) Υ (b) ≥ Prq(a) Υ (a) > Prq(c) Υ (c) . which is equivalent to Pqr(b) Υ (b) ≤ Pqr(a) Υ (a) < Pqr(c) Υ (c) . (10) For an arbitrary input place of b, hence of the form illustrated on the right of Fig. 5 with x = b, y = a, z = c, cycle q[bi q[b . . .ir : ka · Υ (a) + kc · Υ (c) = kb · Υ (b) : Mq(p) ≥ kb : Mr(p) = Mq(p) + ka · Pqr(a) + kc · Pqr(c) − kb · Pqr(b). (11) Then, due to (10) and (11), Mr(p) = Mq(p) + ka · Pqr(a) + kc · Pqr(c) − kb · Pqr(b) ≥ kb + (cid:0)ka · Υ (a) Υ (b) + kc · Υ (c) Υ (b) − kb(cid:1) · Pqr(b) = kb which implies r[bi, a contradiction. Thus, T S is solvable by some WMG. ⊓⊔ When the alphabet has more than three elements, the inclusion of WMGs into CF nets is strict, i.e., there are cyclically CF-solvable sequences that are not cyclically WMG-solvable: the sequence w = abcbad has a cyclic CF solution (cf. Fig. 6); for a ⌊r b c ⌊q b a d we have P(w)(a) Prq(b) which, by Theorem 4, implies the cyclic unsolvability of w by a WMG. 1 = Prq (a)+1 P(w)(b) = 2 2 ≮ 0+1 By Lemma 3, using places only between adjacent transitions is sufficient for cyclic WMG-solvability. For the sequence abcbad in Fig. 6, b follows a and c, and the input place of b in the CF solution is an output place for both a and c. The situation is similar for a, which follows b and d. However, this is not always the 15 a b c bad c 2 2 a 3 2 2 3 b 2 2 d Fig. 6. Sequence abcbad is cyclically solved by the CF net on the right. case when we are looking for a solution in the class of CF nets. For instance, the sequence cabdaaab is cyclically solvable by a CF net (see Fig. 7). In this sequence, b always follows a. But in order to solve ESSPs against b, we need an output place for c (in addition to a). Indeed, if there is a place pa,b as on the right of Fig. 7 which solves ESSPs against b, then for ca ⌊s bdaa ⌊q ab we get s[bi ¬q[bi ≥ 4 : µ0 + 2 : µ0 + 3 · 2 − 4 < 4 Subtracting the first inequality from the second one, we get 4 − 4 < 0, a contra- diction. Hence, pa,b cannot solve all ESSPs against b in the cycle cabdaaab. a b c b d a a a b 2 d 2 3 3 c 2 a 2 a 4 b µ0 pa,b Fig. 7. cabdaaab is cyclically CF-solvable (middle), but is not cyclically WMG-solvable. In a WMG, a place has at most one input. This restriction is relaxed for CF nets: multiple inputs are allowed. Let us show that a single input place for each transition is not always sufficient. For instance, consider the cyclically CF- solvable sequence bcaf deaaabcdaaf dcaaa and Fig. 8. Assume we can solve all ESSPs against transition a with a single place p as on the right of the same figure; due to Lemma 1, we do not need any side-condition. Then, for p and w = ⌊s0 b c a f d ⌊s5 e ⌊s6 a a a b c ⌊s11 d ⌊s12 a a f d ⌊s16 c ⌊s17 a a a, the following system of inequalities must hold true: cycle ¬s5[ai s6[aaai ¬s11[ai s12[aai ¬s16[ai s17[aaai = 9 · k (0) : 2 · kb + 3 · kc + 3 · kd + ke + 2 · kf : µ0 + kb + kc + kd + kf − k < k (1) ≥ 3 · k (2) : µ0 + kb + kc + kd + ke + kf − k : µ0 + 2 · kb + 2 · kc + kd + ke + kf − 4 · k < k (3) ≥ 2 · k (4) : µ0 + 2 · kb + 2 · kc + 2 · kd + ke + kf − 4 · k : µ0 + 2 · kb + 2 · kc + 3 · kd + ke + 2 · kf − 6 · k < k (5) : µ0 + 2 · kb + 3 · kc + 3 · kd + ke + 2 · kf − 6 · k ≥ 3 · k (6) 16 a 2 10 9 3 b 4 3 3 7 2 9 f 9 c 2 5 9 9 e 3 3 3 5 3 3 d 2 d c e b kc kb kd ke kf f µ0 p a k Fig. 8. w = bcaf deaaabcdaaf dcaaa is cyclically solved by the CF net on the left; a (pure) place of a CF net with 6 transitions on the right. From the system above we obtain: (2) − (1) (4) − (3) (6) − (5) : ke > 2 · k : kd > k : kc > 2 · k which implies 3 · kc + 3 · kd + ke > 11 · k, contradicting the equality (0). Hence, the ESSPs against a cannot be solved by a single place. 5 Weak Synthesis of WMGs in Polynomial-time For any given word w over a set of labels T whose support equals T , each system S = ((P, T, W ), M0) that cyclically WMG-solves w, when it exists, has a unique minimal (hence prime) T-semiflow Υ with support T , since it is live (meaning that for each transition t, from each reachable marking M , a marking M ′ is reachable from M that enables t) and bounded (see [34]). In some situations, it might be sufficient to specify only the desired unique minimal T-semiflow, which leads to what we call a weak synthesis problem. Given such a prime Parikh vector Υ , the aim is thus to construct a WMG cyclically solving an arbitrary sequence whose Parikh vector equals Υ . In this section, we provide a method for constructing a solution in polynomial-time. To achieve it, we first need to recall known liveness conditions for WMGs and their circuit subclass. 5.1 Previous results on liveness In [31], a polynomial-time sufficient condition of liveness is developed for the well-formed, strongly connected weighted event graphs (WEGs), equivalent to the well-formed, strongly connected WMGs. Under these assumptions, each place has exactly one ingoing and one outgoing transitions. Variants of this liveness condition for other classes of nets are given in [27], Theorems 4.2 and 5.5. 17 Additional notions. We introduce the following notions for our purpose: − For any place p, gcdp denotes the gcd of all input and output weights of p. − A marking M0 satisfies the useful tokens condition if, for each place p, M0(p) is a multiple of gcdp. Indeed, if M0(p) = k · gcdp +r for some non-negative inte- gers k and r such that 0 < r < gcdp, then r tokens are never used by any firing (see [31,27] for more details). − A net (P, T, W ) with incidence matrix I is conservative if there is a P-vector X ≥ 1P such that X · I = 0T , where 1P denotes the vector of size P in which each component has value 1. Such a P-vector X is called a conservative- ness vector. The net is 1-conservative if 1P is a conservativeness vector, i.e. if for each transition, the sum of its input weights equals the sum of its output weights. − A net N is structurally bounded if for each marking M0, (N, M0) is bounded. − By Theorem 4.11 in [34], a live WTS (N, M0) is bounded iff N is conserva- tive. We focus on live and bounded WMG solutions (which are WTS), hence on conservative, thus structurally bounded (see [33]), solutions. − The scaling operation (Definition 3.1 in [27]): The multiplication of all input and output weights of a place p together with its marking by a positive rational number αp is a scaling of the place p if the resulting input and output weights and marking are integers. If each place p of a system is scaled by a positive rational αp, the system is said to be scaled by the vector α whose components are the scaling factors αp. Recalling Theorem 3.2 in [27], if S = ((P, T, W ), M0) is a system and α is a vector of P positive rational components, then scaling S by α preserves the feasible sequences of firings. We deduce from it, and from Theorem 3.5 in the same paper, the following result. Lemma 6. Consider a system S, whose scaling by a vector α of positive ratio- nals yields the system S′. Then, for each feasible sequence σ, denote by M the marking reached when firing σ in S and by M ′ the marking reached when firing σ in S′; the set of places enabled by M equals the set of places enabled by M ′. Thus, in conservative systems, we can reason equivalently on feasible se- quences and enabled places in the system scaled by a conservativeness vector, yielding a 1-conservative system whose tokens amount remains constant. Next result is a specialisation of Theorem 4.5 in [27] to circuit Petri nets, using the fact that the liveness of circuits is monotonic, i.e. preserved upon any addition of initial tokens (see [34,13,27] and Theorem 7.10 in [29] with its proof). Proposition 1 (Sufficient condition of liveness [31,27,29]). Consider a conservative circuit system S = (N, M0), with N = (P, T, W ). S is live if the following conditions hold: − for a place p0, with {t0} = p• − for every place p in P \ {p0}, with p• = {t}, M0(p) = W (p, t) − gcdp. Moreover, for every marking M ′ 0, M0(p0) = W (p0, t0); 0) is live. 0 such that M ′ 0 ≥ M0, (N, M ′ 18 In the particular case of a binary circuit, i.e. with two transitions, we recall the next characterisation condition of liveness, given as Theorem 5.2 in [31]. Proposition 2 (Liveness of binary 1-conservative circuits [31]). Con- sider a 1-conservative binary circuit S = ((P, T, W ), M0) that fulfills the useful tokens condition, with T = {a, b} and P = {pa,b, pb,a}, where pa,b is the output of a and pb,a is the output of b. Let m = W (a, pa,b) and n = W (pa,b, b). Then S is live iff M0(pa,b) + M0(pb,a) > m + n − 2 · gcd(m, n). Now, consider any 1-conservative binary circuit system S whose initial mark- ing M0 marks one place pa,b with its output weight W (pa,b, b) and the other place pb,a with W (pb,a, a) − gcdpb,a . Each marking reachable from M0 enables exactly one place; applying Lemma 6, this is also the case for any scaling of S, hence: Lemma 7 (One enabled place in binary circuits). Consider a conservative binary circuit system S = (N, M0), with N = (P, T, W ), T = {a, b}, such that for the place pa,b with output b, M0(pa,b) = W (pa,b, b) and for the other place pb,a with output a, M0(pb,a) = W (pb,a, a)−gcdpb,a . Then each reachable marking enables exactly one place. This lemma will help ensuring that the reachability graph of the synthesised WMG forms a circle. Fig. 9 illustrates Lemma 7 and Proposition 1. a 6 3 pa,b pb,a 4 2 b a 3 3 pa,b pb,a 2 2 b a 3 6 pa,b pc,a 2 4 b c 3 pb,c 3 Fig. 9. These circuits are conservative and fulfill the sufficient condition of liveness of = 1. The system in the middle Proposition 1. On the left, gcdpa,b is obtained from the one on the left by scaling pa,b with 1 2 . In this second system, = 1, gcdpb,c gcdpa,b = 1. On the right, gcdpa,b = 2 and gcdpb,a = 1 and gcdpb,a = 3 and gcdpc,a = 2. We recall a liveness characterisation. Since a place with an output and no input, called a source-place, prevents liveness, we assume there is no such place. Proposition 3 (Liveness of WMGs [34]). Consider a WMG S without source places. Then S is live iff each circuit P-subsystem of S is live. 5.2 Weak synthesis of WMGs in polynomial-time Algorithm 2 below constructs a WMG from a given prime T-vector Υ . We prove it terminates and computes a WMG cyclically solving some word with Parikh vector Υ , hence performing weak synthesis. We then show it lies in PTIME. Theorem 6 (Weak synthesis of a WMG). For every prime T-vector Υ , Algorithm 2 terminates and computes a WMG cyclically solving Υ , i.e. cyclically solving some word w ∈ T ∗ such that P(w) = Υ . 19 Algorithm 2: Weak synthesis of a WMG with circular RG. Data: A prime T-vector Υ with support T = {t1, . . . , tm}. Result: A WMG cyclically solving a word with Parikh vector Υ . 1 We construct first an unmarked WMG N = (P, T, W ) containing all possible binary circuits (which we call the complete WMG), as follows: 2 for each pair of distinct labels ti, tj in T do 3 Add two new places pi,j and pj,i forming a binary circuit P-subnet with set of labels {ti, tj}, such that: 4 5 W (pi,j, tj) = W (tj, pj,i) = W (pj,i, ti) = W (ti, pi,j) = Υ (ti) gcd(Υ (ti),Υ (tj )) gcd(Υ (ti),Υ (tj )) . Υ (tj ) 6 Then, we construct its initial marking M0, visiting the transitions in increasing order, as follows: 7 for i = 2..m do 8 Mark each output place pi,h of ti that is an input of a transition th of smaller index, i.e. h < i, with M0(p) = W (pi,h, th); 9 Mark each input place ph,i of ti that is an output of a transition th of smaller index, i.e. h < i, with M0(p) = W (ph,i, ti) − gcdph,i = W (ph,i, ti) − 1; 10 return (N, M0) Proof. The proof is illustrated in Fig. 10, 11 and 12. Consider any prime T- vector Υ ∈ (N \ {0})m, where m is the number of transitions. In the first loop, we consider each pair of transitions once. In the second loop, we consider each place once. Thus, the algorithm terminates. Let us prove its correction. If T = 1, there is one transition and Υ = (1): the WMG with T = {t1}, P = ∅ and the sequence w = t1 fulfill the claim. Hence, we suppose T ≥ 2. For each place pi,j, we have Υ (tj) · W (pi,j, tj) = Υ (ti) · W (ti, pi,j), so that −W (pi,j, tj) · Υ (tj) + W (ti, pi,j) · Υ (ti) = 0, hence I · Υ = 0, where I is the incidence matrix of N . Moreover, each circuit P-subnet of N is conservative (by Corollary 3.6 in [34]). Now, let us consider the second loop: we prove the next invariant Inv(ℓ) to be true at the end of each iteration ℓ, for each ℓ = 1..m − 1, by induction on ℓ: Inv(ℓ): "At the end of the ℓ-th iteration, the WMG P-subsystem Sℓ defined by the set of places Pℓ = {pu,v u, v ∈ {1, . . . , ℓ + 1}, u 6= v} is live, and each binary circuit P-subsystem of Sℓ has exactly one enabled place". Before entering the loop, i.e. before the first iteration, the WMG in unmarked. Base case: ℓ = 1. At the end of the first iteration, Pℓ = P1 = {p1,2, p2,1}, which induces a live binary circuit (by Proposition 1) with exactly one enabled place, since only one output of t2 is enabled by M0 and the other place is an output of t1 considered in the second part of the loop. Inductive case: 1 < ℓ ≤ m−1. We suppose Inv(ℓ−1) to be true, and we prove that Inv(ℓ) is true. Thus, at the end of iteration ℓ − 1, we suppose that the P- subsystem Sℓ−1 induced by Pℓ−1 is live, and that each binary circuit P-subsystem of Sℓ−1 has exactly one enabled place. The iteration ℓ marks only all the input 20 and output places of tℓ+1 that are inputs or outputs of transitions in {t1, . . . , tℓ}. None of these places has been considered in any previous iteration, since each iteration considers only places connected to transitions of smaller index. Thus, these places are newly marked at iteration ℓ, and the only places unmarked at the end of this iteration are connected to transitions of higher index. We deduce that, at the end of iteration ℓ: − each binary circuit of Sℓ has exactly one enabled place: indeed, each such binary circuit either belongs to Sℓ−1, on which the inductive hypothesis applies, or to the circuits newly marked at iteration ℓ; − each circuit P-subsystem of Sℓ with three places or more is live: indeed, con- sider any such conservative circuit C; either C is a P-subsystem of Sℓ−1, which is live by the inductive hypothesis, hence Proposition 3 applies and C is live, or C contains transition tℓ+1, in which case C contains necessarily an output pℓ+1,h of tℓ+1 with h < ℓ + 1: since each place pu,v of Sℓ is marked with at least W (pu,v, tv) − gcdpu,v and pℓ+1,h is marked with W (pℓ+1,h, th), C fulfills the suf- ficient condition of liveness of Proposition 1, hence is live; we deduce that each circuit P-subsystem is live, hence Sℓ is live by Proposition 3. We proved that Inv(ℓ) is true for every integer ℓ = 1..m − 1. We deduce that the WMG system Sm−1 = (N, M0) obtained at the end of the last iteration, which is the system returned, fulfills Inv(m − 1). Suppose that some marking M reachable in Sn−1 enables two distinct transitions ti and tj. Since Sn−1 is a complete WMG, there is a binary circuit P-subsystem Ci,j = (Ni,j, Mi,j) containing ti and tj, in which exactly one place is enabled, applying Lemma 7 (since M {pi,j ,pj,i} = Mi,j is a marking reachable in (Ni,j, M0 {pi,j ,pj,i})). We deduce that M cannot enable both ti and tj, a contradiction. Thus the WMG returned is live and each of its reachable markings enables exactly one transition. It is known that, in each live and bounded WMG, a sequence σ is feasible such that P(σ) = Υ which is the unique minimal T- semiflow of the WMG (see [34,35]). Consequently, its reachability graph is a ⊓⊔ circle, i.e. the WMG solves Υ (and σ) cyclically. We get the claim. t1 w1,2 t1 w1,2 p1,2 p2,1 w2,1 t2 w2,1 t1 2 2 p1,2 p2,1 3 3 t2 Fig. 10. Sketching Theorem 6 for 1 and 2 transitions. On the left, the circuit system S1 has no place and solves Υ = (1). In the circuit system S2 in the middle, the output of t2 is marked as black and its input as grey. On the right, an instanciation of the binary case, given Υ = (3, 2). These systems are live, RG(S1) and RG(S2) are circles. Polynomial-time complexity of Algorithm 2. Let m be the number of transitions (labels). The initial construction of the net N considers a number of transition pairs equal to m·(m−1). The computation of gcd(i, j) for any two inte- 21 w1,2 w1,2 p1,2 p2,1 w2,1 w2,1 w1,2 p1,2 w2,1 p2,1 w1,2 p4,1 p4,2 w2,1 t1 w1,3 t2 w2,3 w1,3 t1 w1,4 w1,4 w4,1 w4,1 t2 w2,3 w2,4 w4,2 w2,4 w4,2 t4 w1,3 w2,3 w1,3 p1,4 w4,3 w4,3 p2,4 p1,3 w3,1 p3,1 w3,1 w3,2 p3,2 t3 w3,2 p2,3 p3,1 p1,3 w3,1 p4,3 w3,4 w3,1 t3 p3,4 w3,4 w3,2 w2,3 p3,2 w3,2 p2,3 Fig. 11. Sketching Theorem 6 for 3 and 4 transitions (systems S3, S4). Each black place pi,j is marked with W (pi,j, tj), each grey place pi,j is marked with W (pi,j, tj) − gcdpi,j . On the left, in the circuit induced by {p1,2, p2,1}, the output of t2 is black and its input is grey. Then, each output of t3 is black, each input is grey. Each circuit of S3 is live, S3 is live and RG(S3) is a circle. In S4, we keep the marking of S3 and mark each output of t4 as black, each of its inputs as grey. Thus, S4 is live and RG(S4) is a circle. 3 3 p1,2 p2,1 p4,1 p4,2 2 2 t1 1 2 2 1 p1,4 p4,3 1 p1,3 1 1 p3,1 3 1 2 1 1 2 t4 t3 t2 2 4 4 3 p2,4 p3,4 2 p3,2 3 3 p2,3 s0 t1 s10 t2 t4 s9 s2 s1 t2 t3 s3 t4 s4 s5 t4 t2 t1 s6 t4 t3 s7 s8 Fig. 12. Illustration of the proof of Theorem 6 for the prime T-vector Υ = (2, 3, 2, 4). On the left, a complete WMG S, with all possible binary circuits. Its marking fol- lows the black and grey places of Fig. 11. Pick any circuit P-subsystem C, e.g. the one induced by {p4,3, p3,2, p2,4}: it is conservative and fulfills the condition of Propo- sition 1, hence it is live. On the right, an LTS representing RG(S). The sequence w = t1 t2 t3 t4 t4 t2 t1 t3 t4 t2 t4, with P(w) = Υ , is cyclically WMG-solvable. gers i, j can be done using the Euclidean algorithm in O(log2 2(max(i, j))), which remains polynomial in the size of the input vector binary encoding. Computing v for two integers u, v, v 6= 0, can also be done in O(log2 u 2(max(u, v))). Thus, con- structing N lies in O(m(m − 1)3log2 2(q)) where q is the highest value in Υ . Then, the algorithm marks all places in O(m(m − 1)), knowing that the gcd of each place is 1. Hence the algorithm lies in PTIME: O(3m(m − 1)log2 2(q) + m(m − 1)), 22 i.e. O(m(m − 1)(3log2 2(q) + 1)) where q is the highest value in Υ . Comparison with sequence-based synthesis. Algorithm 1 uses O(n(m+n)) steps, where m is the number of labels and n is the length of the input sequence w to be solved cyclically. Since n equals the sum of the components of Υ = P(w), we get q ≤ n. Also, m ≤ n; depending on the weights, n can be exponentially larger than m. Hence, log2 2(q) + 1) ∈ O(m2 · log2 2(n)). When n is exponential in m, Algorithm 2 operates in time polynomial in m while Algorithm 1 operates in time exponential in m. 2(n)), so that m(m − 1)(3log2 2(q) ∈ O(log2 6 Conclusions and Perspectives In this work, we specialised previous methods of analysis and synthesis to the CF nets and their WMG subclass, two useful subclasses of weighted Petri nets allowing to model various real-world applications. We highlighted the correspondance between CF- and WMG-solvability for binary alphabets. We also tackled the case of an LTS formed of a single cycle with an arbitrary number of letters, for which we developed a characterisation of WMG-solvability together with a dedicated polynomial-time synthesis algo- rithm. We showed the equivalence between cyclic WMG- and CF-solvability in the case of three-letter alphabets, and that it does not extend to four-letter alphabets. We also discussed the applicability of our conditions to cyclic CF synthesis over arbitrary alphabets. Finally, we introduced the notion of weak synthesis, allowing to be less restric- tive on the solution design, and provided a polynomial-time algorithm weakly synthesising a WMG with circular reachability graph. We showed this second algorithm to often operate much faster than the sequence-based one. As a natural continuation of the work, we expect extensions of our results in two directions: generalising the class of goal-nets and relaxing the restrictions on the LTS under consideration. References 1. Badouel, E., Bernardinello, L., Darondeau, P.: Petri Net Synthesis. Springer-Verlag (2015) 2. Badouel, E., Bernardinello, L., Darondeau, P.: Polynomial algorithms for the synthesis of bounded nets. In: Mosses, P.D., Nielsen, M., Schwartzbach, M.I. (eds.) TAPSOFT '95: Theory and Practice of Software Development. pp. 364 -- 378. Springer Berlin Heidelberg, Berlin, Heidelberg (1995) 3. Badouel, E., Bernardinello, L., Darondeau, P.: The synthesis problem for elemen- tary net systems is NP-complete. Theoretical Computer Science 186(1), 107 -- 134 (1997). https://doi.org/https://doi.org/10.1016/S0304-3975(96)00219-8 4. Barylska, K., Best, E., Erofeev, E., Mikulski, L., Piatkowski, M.: On binary words being Petri net solvable. In: Proceedings of the International Workshop on Algo- rithms & Theories for the Analysis of Event Data, Brussels, Belgium. pp. 1 -- 15 (2015) 23 5. Barylska, K., Best, E., Erofeev, E., Mikulski, L., Piatkowski, M.: Conditions for Petri net solvable binary words. T. Petri Nets and Other Models of Concurrency 11, 137 -- 159 (2016). https://doi.org/10.1007/978-3-662-53401-4_7 6. Best, E., Devillers, R.: Synthesis and reengineering of persistent systems. Acta Inf. 52(1), 35 -- 60 (2015). https://doi.org/10.1007/s00236-014-0209-7 7. Best, E., Devillers, R.: Characterisation of the state spaces of marked graph Petri nets. Information and Computation 253(3), 399 -- 410 (2017) 8. Best, E., Devillers, R., Schlachter, U.: Bounded choice-free Petri net synthesis: Algorithmic issues. Acta Informatica (2017) 9. Best, E., Devillers, R., Schlachter, U., Wimmel, H.: Simultaneous Petri net syn- thesis. Sci. Ann. Comp. Sci. 28(2), 199 -- 236 (2018) 10. Best, E., Hujsa, T., Wimmel, H.: Sufficient conditions for the marked graph real- isability of labelled transition systems. Theoretical Computer Science (2017) A.: Marked 11. Commoner, Even, A., S., F., graphs. Holt, J. rected https://doi.org/10.1016/S0022-0000(71)80013-2 Comput. Syst. Sci Pnueli, 5(5), 511 -- 523 di- (1971), 12. Crespi-Reghizzi, S., Mandrioli, D.: A decidability theorem for a class (1975), Inf. Process. Lett. vector-addition of http://dx.doi.org/10.1016/0020-0190(75)90020-4 systems. 78 -- 80 3(3), 13. Delosme, J.M., Hujsa, T., Munier-Kordon, A.: Polynomial sufficient conditions of well-behavedness for weighted join-free and choice-free systems. In: 13th Interna- tional Conference on Application of Concurrency to System Design. pp. 90 -- 99 (July 2013). https://doi.org/10.1109/ACSD.2013.12 14. Desel, J., Esparza, J.: Free Choice Petri Nets, Cambridge Tracts in Theoretical Computer Science, vol. 40. Cambridge University Press, New York, USA (1995) 15. Devillers, R.: Products of Transition Systems and Additions of Petri Nets. In: Proc. 16th International Conference on Application of Concurrency to System Design (ACSD 2016) J. Desel and A. Yakovlev (eds). pp. 65 -- 73 (2016) 16. Devillers, R.: Factorisation of transition systems. Acta Inf. 55(4), 339 -- 362 (2018). https://doi.org/10.1007/s00236-017-0300-y 17. Devillers, R.: Articulation of transition systems and its application to Petri net synthesis. In: Application and Theory of Petri Nets and Concurrency - 40th Inter- national Conference, Aachen, Germany, June 23-28, 2019, Proceedings. pp. 113 -- 126 (2019). https://doi.org/10.1007/978-3-030-21571-2_8 18. Devillers, R., Erofeev, E., Hujsa, T.: Synthesis of weighted marked graphs from con- strained labelled transition systems. In: Proceedings of the International Workshop on Algorithms & Theories for the Analysis of Event Data, Satellite event of the conferences: Petri Nets and ACSD, Bratislava, Slovakia. pp. 75 -- 90 (2018) 19. Devillers, R., Erofeev, E., Hujsa, T.: Synthesis of weighted marked graphs from circular labelled transition systems. In: Proceedings of the International Workshop on Algorithms & Theories for the Analysis of Event Data, Satellite event of the conferences: Petri Nets and ACSD, Aachen, Germany. pp. 6 -- 22 (June 2019) 20. Devillers, R., Hujsa, T.: Analysis and synthesis of weighted marked graph Petri nets. In: Khomenko, V., Roux, O.H. (eds.) Application and Theory of Petri Nets and Concurrency: 39th International Conference, PETRI NETS 2018, Bratislava, Slovakia, 2018, Proceedings. pp. 1 -- 21. Springer (2018) 21. Devillers, R., Hujsa, T.: Analysis and synthesis of weighted marked graph Petri nets: Exact and approximate methods. Fundamenta Informaticae (2019) 22. Devillers, R., Schlachter, U.: Factorisation of Petri net solvable transition systems. In: Application and Theory of Petri Nets and Concurrency - 39th International 24 Conference, Bratislava, Slovakia, June 24-29, 2018, Proceedings. pp. 82 -- 98 (2018). https://doi.org/10.1007/978-3-319-91268-4_5 23. Erofeev, E., Barylska, K., Mikulski, L., Piatkowski, M.: Generating all minimal Petri net unsolvable binary words. In: Proceedings of the Prague Stringology Con- ference 2016, Prague, Czech Republic. pp. 33 -- 46 (2016) 24. Erofeev, E., Wimmel, H.: Reachability graphs of two-transition Petri nets. In: Pro- ceedings of the International Workshop on Algorithms & Theories for the Analysis of Event Data, Zaragoza, Spain. pp. 39 -- 54 (2017) 25. Hujsa, T.: Contribution to the study of weighted Petri nets. Ph.D. thesis, Pierre and Marie Curie University, Paris, France (2014) 26. Hujsa, T., Delosme, J.M., Munier-Kordon, A.: On the reversibility of well-behaved weighted choice-free systems. In: Ciardo, G., Kindler, E. (eds.) Application and Theory of Petri Nets and Concurrency. pp. 334 -- 353. Springer (2014) 27. Hujsa, T., Delosme, J.M., Munier-Kordon, A.: Polynomial sufficient condi- tions of well-behavedness and home markings in subclasses of weighted Petri nets. ACM Trans. Embed. Comput. Syst. 13(4s), 141:1 -- 141:25 (Jul 2014). https://doi.org/10.1145/2627349 28. Hujsa, T., Devillers, R.: On liveness and deadlockability in subclasses of weighted Petri nets. In: van der Aalst, W., Best, E. (eds.) Application and Theory of Petri Nets and Concurrency: 38th International Conference, Zaragoza, Spain, Proceed- ings. pp. 267 -- 287. Springer (2017). https://doi.org/10.1007/978-3-319-57861-3_16 29. Hujsa, T., Devillers, R.: On deadlockability, liveness and reversibility in sub- Inform. 161(4), 383 -- 421 (2018), classes of weighted Petri nets. Fundam. https://doi.org/10.3233/FI-2018-1708 30. Karmarkar, N.: A new polynomial-time algorithm for linear programming. Com- binatorica 4(4), 373 -- 395 (Dec 1984). https://doi.org/10.1007/BF02579150 31. Marchetti, O., Munier-Kordon, A.: A sufficient condition for the liveness of Weighted Event Graphs. European Journal of Operational Research 197(2), 532 -- 540 (2009) 32. Murata, T.: Petri nets: properties, analysis and applications. Proceedings of the IEEE 77(4), 541 -- 580 (April 1989) 33. Silva, M., Teruel, E., Colom, J.M.: Linear algebraic and linear programming tech- niques for the analysis of place/transition net systems. In: Reisig, W., Rozenberg, G. (eds.) Lectures on Petri Nets I: Basic Models. LNCS, vol. 1491, pp. 309 -- 373 (1998) 34. Teruel, E., Chrzastowski-Wachtel, P., Colom, J.M., Silva, M.: On weighted T- systems. In: Jensen, K. (ed.) 13th International Conference on Application and Theory of Petri Nets and Concurrency (ICATPN), LNCS. vol. 616, pp. 348 -- 367. Springer, Berlin, Heidelberg (1992) 35. Teruel, E., Colom, J.M., Silva, M.: Choice-Free Petri Nets: a Model for De- terministic Concurrent Systems with Bulk Services and Arrivals. IEEE Trans- actions on Systems, Man, and Cybernetics, Part A 27(1), 73 -- 83 (1997). https://doi.org/10.1109/3468.553226 36. Teruel, E., Silva, M.: Structure theory of Equal Conflict systems. Theoretical Com- puter Science 153(1&2), 271 -- 300 (1996) 37. Tredup, R.: Synthesis of structurally restricted b-bounded Petri nets: Complexity results. In: Filiot, E., Jungers, R., Potapov, I. (eds.) Reachability Problems. pp. 202 -- 217. Springer International Publishing, Cham (2019) 25
1704.07254
1
1704
2017-04-24T14:29:28
Recognizing Union-Find trees built up using union-by-rank strategy is NP-complete
[ "cs.DS" ]
Disjoint-Set forests, consisting of Union-Find trees, are data structures having a widespread practical application due to their efficiency. Despite them being well-known, no exact structural characterization of these trees is known (such a characterization exists for Union trees which are constructed without using path compression) for the case assuming union-by-rank strategy for merging. In this paper we provide such a characterization by means of a simple push operation and show that the decision problem whether a given tree (along with the rank info of its nodes) is a Union-Find tree is NP-complete, complementing our earlier similar result for the union-by-size strategy.
cs.DS
cs
Recognizing Union-Find trees built up using union-by-rank strategy is NP-complete⋆ Kitti Gelle, Szabolcs Iv´an Department of Computer Science, University of Szeged, Hungary {kgelle,szabivan}@inf.u-szeged.hu Abstract. Disjoint-Set forests, consisting of Union-Find trees, are data structures having a widespread practical application due to their effi- ciency. Despite them being well-known, no exact structural characteri- zation of these trees is known (such a characterization exists for Union trees which are constructed without using path compression) for the case assuming union-by-rank strategy for merging. In this paper we provide such a characterization by means of a simple push operation and show that the decision problem whether a given tree (along with the rank info of its nodes) is a Union-Find tree is NP-complete, complementing our earlier similar result for the union-by-size strategy. 1 Introduction Disjoint-Set forests, introduced in [10], are fundamental data structures in many practical algorithms where one has to maintain a partition of some set, which supports three operations: creating a partition consisting of singletons, querying whether two given elements are in the same class of the partition (or equivalently: finding a representative of a class, given an element of it) and merging two classes. Practical examples include e.g. building a minimum-cost spanning tree of a weighted graph [4], unification algorithms [18] etc. To support these operations, even a linked list representation suffices but to achieve an almost-constant amortized time cost per operation, Disjoint-Set forests are used in practice. In this data structure, sets are represented as directed trees with the edges directed towards the root; the create operation creates n trees having one node each (here n stands for the number of the elements in the universe), the find operation takes a node and returns the root of the tree in which the node is present (thus the same-class(x, y) operation is implemented as find(x) == find(y)), and the merge(x, y) operation is implemented by merging the trees containing x and y, i.e. making one of the root nodes to be a child of the other root node (if the two nodes are in different classes). In order to achieve near-constant efficiency, one has to keep the (average) height of the trees small. There are two "orthogonal" methods to do that: first, during the merge operation it is advisable to attach the "smaller" tree below the "larger" one. If the "size" of a tree is the number of its nodes, we say the trees ⋆ Research was supported by the NKFI grant no. 108448. are built up according to the union-by-size strategy, if it's the depth of a tree, then we talk about the union-by-rank strategy. Second, during a find operation invoked on some node x of a tree, one can apply the path compression method, which reattaches each ancestor of x directly to the root of the tree in which they are present. If one applies both the path compression method and either one of the union-by-size or union-by-rank strategies, then any sequence of m operations on a universe of n elements has worst-case time cost O(mα(n)) where α is the inverse of the extremely fast growing (not primitive recursive) Ackermann function for which α(n) ≤ 5 for each practical value of n (say, below 265535), hence it has an amortized almost-constant time cost [23]. Since it's proven [9] that any data structure maintaining a partition has worst-case time cost Ω(mα(n)), the Disjoint-Set forests equipped with a strategy and path compression offer a theoretically optimal data structure which performs exceptionally well also in practice. For more details see standard textbooks on data structures, e.g. [4]. Due to these facts, it is certainly interesting both from the theoretical as well as the practical point of view to characterize those trees that can arise from a forest of singletons after a number of merge and find operations, which we call Union-Find trees in this paper. One could e.g. test Disjoint-Set implementations since if at any given point of execution a tree of a Disjoint-Set forest is not a valid Union-Find tree, then it is certain that there is a bug in the implementation of the data structure (though we note at this point that this data structure is sometimes regarded as one of the "primitive" data structures, in the sense that it is possible to implement a correct version of them that needs not be certifying [21]). Nevertheless, only the characterization of Union trees is known up till now [2], i.e. which correspond to the case when one uses one of the union- by- strategies but not path compression. Since in that case the data structure offers only a theoretic bound of Θ(log n) on the amortized time cost, in practice all implementations imbue path compression as well, so for a characterization to be really useful, it has to cover this case as well. In this paper we show that the recognition problem of Union-Find trees is NP-complete when the union-by-rank strategy is used, complementing our ear- lier results [13] where we proved NP-completeness for the union-by-size strategy. The proof method applied here resembles to that one, but the low-level details for the reduction (here we use the Partition problem, there we used the more restricted version 3−Partition as this is a very canonical strongly NP-complete problem) differ greatly. This result also confirms the statement from [2] that the problem "seems to be much harder" than recognizing Union trees. As (up to our knowledge) in most of the actual software libraries having this data structure implemented the union-by-rank strategy is used (apart from the cases when one quickly has to query the size of the sets as well), for software testing purposes the current result is more relevant than the one applying union-by-size strategy. Related work. There is an increasing interest in determining the complexity of the recognition problem of various data structures. The problem was consid- ered for suffix trees [17,22], (parametrized) border arrays [15,20,8,14,16], suffix 2 arrays [1,7,19], KMP tables [6,12], prefix tables [3], cover arrays [5], and directed acyclic word- and subsequence graphs [1]. 2 Notation A (ranked) tree is a tuple t = (Vt, roott, rankt, parentt) with Vt being the finite set of its nodes, roott ∈ Vt its root, rankt : Vt → N0 mapping a nonnegative integer to each node, and parentt : (Vt − {roott}) → Vt map- ping each nonroot node to its parent (so that the graph of parentt is a di- rected acyclic graph, with edges being directed towards the root). We require rankt(x) < rankt(parentt(x)) for each nonroot node x, i.e. the rank strictly decreases towards the leaves. For a tree t and a node x ∈ Vt, let children(t, x) stand for the set {y ∈ Vt : parentt(y) = x} of its children and children(t) stand as a shorthand for children(t, roott), the set of depth-one nodes of t. Also, let x (cid:22)t y denote that x is a (non-strict) ancestor of y in t, i.e. x = parentk t (y) for some k ≥ 0. For x ∈ Vt, let tx stand for the subtree (Vx = {y ∈ V : x (cid:22)t y}, x, ranktVx, parenttVx ) of t rooted at x. As shorthand, let rank(t) stand for rankt(roott), the rank of the root of t. Two operations on trees are that of merging and collapsing. Given two trees t = (Vt, roott, rankt, parentt) and s = (Vs, roots, ranks, parents) with Vt and Vs being disjoint and rank(t) ≥ rank(s), then their merge merge(t, s) (in this order) is the tree (Vt ∪ Vs, roott, rank, parent) with parent(x) = parentt(x) for x ∈ Vt, parent(roots) = roott and parent(y) = parents(y) for each nonroot node y ∈ Vs of s, and rank(roott) =(rank(t) rank(t) + 1 otherwise, if rank(s) < rank(t), and rank(x) = rankt(x), ranks(x) resp. for each x ∈ Vt − {rootr}, x ∈ Vs resp. Given a tree t = (V, root, rank, parent) and a node x ∈ V , then collapse(t, x) is the tree (V, root, rank, parent′) with parent′(y) = root if y is a nonroot ancestor of x in t and parent′(y) = parent(y) otherwise. For examples, see Figure 1. Observe that both operations indeed construct a ranked tree (e.g. the rank remains strictly decreasing towards the leaves). We say that a tree is a singleton tree if it has exactly one node, and this node has rank 0. The class of Union trees is the least class of trees satisfying the following two conditions: every singleton tree is a Union tree, and if t and s are Union trees with rank(t) ≥ rank(s), then merge(t, s) is a Union tree as well. Analogously, the class of Union-Find trees is the least class of trees satisfying the following three conditions: every singleton tree is a Union-Find tree, if t and 3 s: 1 r2 t: 2 1 x 1 1 0 y 0 0 0 0 0 z r3 1 1 x 1 1 2 0 0 0 0 z 0 y 0 (a) Trees s and t (b) t′ = merge(s, t) r3 1 1 1 2 0 y 0 1 x 0 0 0 0 z (c) t′′ = push(t′, x, y) r 3 1 1 1 2 0 y 0 1 x 0 z 0 0 0 (d) t′′′ = collapse(t′′, z) Fig. 1: Merge, collapse and push. s are Union-Find trees with rank(t) ≥ rank(s), then merge(t, s) is a Union- Find tree as well, and if t is a Union-Find tree and x ∈ Vt is a node of t, then collapse(t, x) is also a Union-Find tree. We say that a node x of a tree t satisfies the Union condition if {rankt(y) : y ∈ children(t, x)} = {0, 1, . . . , rankt(x) − 1}. Then, the characterization of Union trees from [2] can be formulated in our terms as follows: Theorem 1. A tree t is a Union tree if and only if each node of t satisfies the Union condition. Note that the rank of a Union tree always coincides by its height. (And, any subtree of a Union tree is also a Union tree.) In particular, the leaves are exactly those nodes of rank 0. 4 3 Structural characterization of Union-Find trees Suppose s and t are trees on the same set V of nodes, with the same root root and the same rank function rank. We write s (cid:22) t if x (cid:22)s y implies x (cid:22)t y for each x, y ∈ V . Clearly, (cid:22) is a partial order on any set of trees (i.e. is a reflexive, tran- sitive and antisymmetric relation). It is also clear that s (cid:22) t if and only if parents(x) (cid:22)t x holds for each x ∈ V − {root} which is further equivalent to requiring parents(x) (cid:22)t parentt(x) since parents(x) cannot be x. Another notion we define is the (partial) operation push on trees as fol- lows: when t is a tree and x 6= y ∈ Vt are siblings in t, i.e. have the same parent, and rankt(x) < rankt(y), then push(t, x, y) is defined as the tree (Vt, roott, rankt, parent′) with parent′(z) =(y if z = x, parentt(z) otherwise, that is, we "push" the node x one level deeper in the tree just below its former sibling y. (See Figure 1.) We write t ⊢ t′ when t′ = push(t, x, y) for some x and y, and as usual, ⊢∗ denotes the reflexive-transitive closure of ⊢. Proposition 1. For any pair s and t of trees, the following conditions are equiv- alent: (i) s (cid:22) t, (ii) there exists a sequence t0 = s, t1, t2, . . . , tn of trees such that for each i = 1, . . . , n we have ti = push(ti−1, x, y) for some depth-one node x ∈ children(ti−1), moreover, children(tn) = children(t) and tnx (cid:22) tx for each x ∈ children(t), (iii) s ⊢∗ t. Proof. i)⇒ii). It is clear that (cid:22) is equality on singleton trees, thus (cid:22) implies ⊢∗ for trees of rank 0. Assume s (cid:22) t for the trees s = (V, root, rank, parent) and t = (V, root, rank, parent′) and let X stand for the set children(s) of the depth-one nodes of s and Y stand for children(t). Clearly, Y ⊆ X since by s (cid:22) t, any node x of s having depth at least two has to satisfy parent(x) (cid:22)t parent′(x) and since parent(x) 6= root for such nodes, x has to have depth at least two in t as well. Now there are two cases: either root = parent(x) = parent′(x) for each x ∈ X, or parent(x) ≺t parent′(x) for some x ∈ X. If parent′(x) = root for each x ∈ X, then X = Y and we only have to show that sx (cid:22) tx for each x ∈ X. For this, let u, v ∈ V (sx) with u (cid:22)sx v. Since sx is a subtree of s, this holds if and only if x (cid:22)s u (cid:22)s v. From s (cid:22) t this implies x (cid:22)t u (cid:22)t v, that is, u (cid:22)tx v, hence sx (cid:22) tx. Now assume parent(x) ≺t parent′(x) for some x ∈ X. Then parent′(x) 6= root, thus there exists some y ∈ Y with y (cid:22)t parent′(x). By Y ⊆ X, this y is a member of X as well, and ranks(y) = rankt(y) > rankt(x) = ranks(x), thus s′ = push(s, x, y) is well-defined. Moreover, s′ (cid:22) t since parents′ (z) (cid:22)t z for 5 each z ∈ V : either z 6= x in which case parents′ (z) = parent(z) (cid:22)t z by s (cid:22) t, or z = x and then parents′ (z) = y (cid:22)t parent′(x) (cid:22)t x = z also holds. Thus, there exists a tree s′ = push(s, x, y) for some x ∈ children(s) with s′ (cid:22) t; since children(s′) = X − {x}, by repeating this construction we eventually arrive to a tree tn with children(tn) = Y , implying children(tn) = Y by Y ⊆ children(tn). ii)⇒iii). We apply induction on rank(s) = rank(t). When rank(s) = 0, then s is a singleton tree and the condition in ii) ensures that t is a singleton tree as well. Thus, s = t and clearly s ⊢∗ t. Now let assume the claim holds for each pair of trees of rank less than rank(s) and let t0, . . . , tn be trees satisfying the condition. Then, by con- struction, s ⊢∗ tn. Since rank(tnx) < rank(tn) = rank(s) for each node x ∈ children(tn), by tnx (cid:22) tx we get applying the induction hypothesis that tnx ⊢∗ tx for each depth-one node x of tn, thus tn ⊢∗ t, hence s ⊢∗ t as well. iii)⇒ i). For ⊢∗ implying (cid:22) it suffices to show that ⊢ implies (cid:22) since the latter is reflexive and transitive. So let s = (V, r, rank, parent) and x 6= y ∈ V be siblings in s with the common parent z, rank(x) < rank(y) and let t = push(s, x, y). Then, since parents(x) = z = parentt(y) = parentt(parentt(x)), we get parents(x) (cid:22)t x, and by parents(w) = parentt(w) for each node w 6= x, we have s (cid:22) t. ⊓⊔ The relations (cid:22) and ⊢∗ are introduced due to their intimate relation to Union- Find and Union trees (similarly to the case of the union-by-size strategy [13], but there the push operation itself was slightly different): Theorem 2. A tree t is a Union-Find tree if and only if t ⊢∗ s for some Union tree s. Proof. Let t be a Union-Find tree. We show the claim by structural induction. For singleton trees the claim holds since any singleton tree is a Union tree as well. Suppose t = merge(t1, t2). Then by the induction hypothesis, t1 ⊢∗ s1 and t2 ⊢∗ s2 for the Union trees s1 and s2. Then, for the tree s = merge(s1, s2) we get that t ⊢∗ s. Finally, assume t = collapse(t′, x) for some node x. Let x = x1 ≻ x2 ≻ . . . ≻ xk = roott′ be the ancestral sequence of x in t′. Then, defining t0 = t, ti = push(ti−1, xi, xi+1) we get that t ⊢∗ tk−2 = t′ and t′ ⊢∗ s for some Union tree s applying the induction hypothesis, thus t ⊢∗ s also holds. Now assume t ⊢∗ s (equivalently, t (cid:22) s) for some Union tree s. We show the claim by induction on the height of t. For singleton trees the claim holds since any singleton tree is a Union-Find tree. Now assume t = (V, root, rank, parent) is a tree and t ⊢∗ s for some Union tree s. Then by Proposition 1, there is a set X = children(s) ⊆ children(t) of depth-one nodes of t and a function f : Y → X with Y = {y1, . . . , yℓ} = children(t) − X such that for the sequence t0 = t, ti = push(ti−1, yi, f (yi)) we have that tℓx (cid:22) sx for each x ∈ X. As each sx is a Union tree (since so is s), we have by the induction hypothesis that each tℓx is a Union-Find tree. Now let X = {x1, . . . , xk} be ordered nondecreasingly by rank; then, as s is a Union tree 6 and X = children(s), we get that {rank(xi)} = {0, 1, . . . , rank(root) − 1} by Theorem 1. Hence for the sequence t′ 0 being a singleton tree with root root and for each i ∈ {1, . . . , k}, t′ i−1, tℓxi ), we get that tℓ = t′ k is a Union-Find tree. Finally, we get t from tℓ by applying successively one collapse operaton on each node in Y , thus t is a Union-Find tree as well. ⊓⊔ i defined as t′ i = merge(t′ 4 Complexity In order to show NP-completeness of the recognition problem, we first make a useful observation. Proposition 2. In any Union-Find tree t there are at least as many rank-0 nodes as nodes of positive rank. Proof. We apply induction on the structure of t. The claim holds for singleton trees (having one single node of rank 0). Let t = merge(t1, t2) and suppose the claim holds for t1 and t2. There are two cases. -- Assume rank(t1) = 0. Then, since rank(t1) ≥ rank(t2) we have that rank(t2) is 0 as well, i.e. both t1 and t2 are singleton trees (of rank 0). In this case t has one node of rank 1 and one node of rank 0. -- If rank(t1) > 0, then (since roott1 is the only node in Vt = Vt1 ∪ Vt2 whose rank can change at all, in which case it increases) neither the total number of rank-0 nodes nor the total number of nodes with positive rank changes, thus the claim holds. Let t = collapse(s, x) and assume the claim holds for s. Then, since the collapse operation does not change the rank of any of the nodes, the claim holds for t as well. ⊓⊔ In order to define a reduction from the strongly NP-complete problem Partition we introduce several notions on trees: An apple of weight a for an integer a > 0 is a tree consisting of a root node of rank 2, a depth-one node of rank 0 and a depth-one nodes of rank 1. A basket of size H for an integer H > 0 is a tree consisting of H +4 nodes: the root node having rank 3, H + 1 depth-one children of rank 0 and one depth-one child of rank 1, which in turn has a child of rank 0. A flat tree is a tree t of the following form: the root of t has rank 4. The immediate subtrees of t are: -- a node of rank 0, having no children; -- a node of rank 1, having a single child of rank 0; -- a node of rank 2, having two children: a single node of rank 0 and a node of rank 1, having a single child of rank 0; -- an arbitrary number of apples, -- and an arbitrary number of baskets for some fixed size H. 7 4 2 2 2 0 0 1 1 1 0 1 1 1 1 1 0 This is an apple This is an apple of weight 3 of weight 5 0 1 0 1 0 This part is constant in a flat tree (See Figure 2.) Fig. 2: A flat tree. 3 0 0 1 0 0 0 0 This is a basket of size 5 j ≤ k? At this point we recall that the following problem Partition is NP-complete in the strong sense [11]: given a list a1, . . . , am of positive integers and a value k > 0 such that the value B = Pm is an integer, does there exist a partition ai = B for each 1 ≤ B = {B1, . . . , Bk} of the set {1, . . . , m} satisfying Pi∈Bj i=1 ai k (Here "in the strong sense" means that the problem remains NP-complete even if the numbers are encoded in unary.) Proposition 3. Assume t is a flat tree having k basket children, each having the size H, and m apple children of weights a1, . . . , am respectively, satisfying H · k =P1≤i≤m ai. positive instance of the Partition problem. Then t is a Union-Find tree if and only if the instance (a1, . . . , am, k) is a Proof. (For an example, the reader is referred to Figure 3.) 4 0 1 2 2 2 2 2 2 3 3 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 Fig. 3: The initial flat tree t corresponding to the Partition instance (1, 2, 3, 4, 4, k = 2). The size of each basket is (1 + 2 + 3 + 4 + 4)/k = 7. Let H stand for the target sum P ai Suppose I = (a1, . . . , am, k) is a positive instance of the Partition problem. k . Let B = {B1, . . . , Bk} be a solution of I, ai = H for each j = 1, . . . , k. Let x1, . . . , xk ∈ children(t) be the i.e., Pi∈Bj 8 nodes corresponding to the baskets of t and let y1, . . . , ym ∈ children(t) be the nodes corresponding to the apples of t. We define the following sequence t0, t1, . . . , tm of trees: t0 = t and for each i = 1, . . . , m, let ti = push(ti−1, yi, xj) with 1 ≤ j ≤ k being the unique index with i ∈ Bj. Then, children(tm) consists of x1, . . . , xk and the three additional nodes having rank 0, 1 and 2. Note that the subtrees rooted at the latter three nodes are Union trees. Thus, if each of the trees tmxj is a Union-Find tree, then so is t. Consider a subtree t′ = tmxj . By construction, t′ is a tree whose root has rank 3 and has -- H + 1 children of rank 0, -- a single child of rank 1, having a child of rank 0, -- and several (say, ℓ) apple children with total weight H. We give a method to transform t′ into a Union tree. First, we push ai rank-0 nodes to each apple child of weight ai. After this stage t′ has one child of rank 0, one child of rank 1 and ℓ "filled" apple children, having a root of rank 2, thus the root of the transformed t′ satisfies the Union condition. We only have to show that each of these "filled" apples is a Union-Find tree. Such a subtree has a root node of rank 2, ai depth-one nodes of rank 1 and ai + 1 depth-one nodes of rank 0. Then, one can push into each node of rank 1 a node of rank 0 and arrive to a tree with one depth-one node of rank 0, and ai depth-one nodes of rank 1, each having a single child of rank 0, which is indeed a Union tree, showing the claim by Theorem 2. For an illustration of the construction the reader is referred to Figure 4. For the other direction, suppose t is a Union-Find tree. By Theorem 2 and Proposition 1, there is a subset X ⊆ children(t) and a mapping f : Y → X with Y = {y1, . . . , yℓ} = children(t) − X such that for the sequence t0 = t, ti = push(ti−1, yi, f (yi)) we have that each immediate subtree of tℓ is a Union- Find tree and moreover, the root of tℓ satisfies the Union condition. The root of t has rank 4, tℓ has to have at least one child having rank 0, 1, 2 and 3 respectively. Since t has exactly one child with rank 0 and rank 1, these nodes has to be in X. This implies that no node gets pushed into the apples at this stage (because the apples have rank 2). Thus, since the apples are not Union-Find trees (as they have strictly less rank-0 nodes than positive-rank nodes, cf. Proposition 2), all the apples have to be in Y . Apart from the apples, t has exactly one depth-one node of rank 2 (which happens to be a root of a Union tree), thus this node has to stay in X as well. Moreover, we cannot push the baskets as they have the maximal rank 3, hence they cannot be pushed. Thus, we have to push all the apples, and we can push apples only into baskets (as exactly the baskets have rank greater than 2). Let x ∈ X be a basket node, let t′ stand for tℓx and let {y′ j} ⊆ Y be the set of those apples that get pushed into x during the operation. Then, the total number of nodes having rank 0 in t′ is H + 2 + j (j of them coming from the apples and the other ones coming from the basket) while the total number of nodes having a positive rank is 2 + j + A where A is the total weight of the apples in {y′ j}. Applying 1, . . . , y′ 1, . . . , y′ 9 4 0 1 2 3 3 0 1 0 0 1 0 0 0 0 0 0 0 2 2 0 1 0 0 0 0 0 0 0 2 2 2 0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 (a) Apples of size 3 and 4 are pushed into the first basket, apples of size 1, 2 and 4 are pushed into the second basket. 0 1 2 3 4 0 1 0 0 1 2 2 0 1 2 3 2 2 0 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 1 1 1 0 0 0 0 (b) The apples get filled from the baskets' surplus rank-0 leaves. 4 0 1 2 3 3 0 1 0 0 1 2 2 0 1 2 2 2 0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (c) The filling of the apples is pushed a level deeper and we have a Union tree. Fig. 4: Pushing t of Figure 3 into a Union tree according to the solution 3 + 4 = 1 + 2 + 4 of the Partition instance. Proposition 2 we get that A ≤ H for each basket. Since the total weight of all apples is H · k and each apple gets pushed into exactly one basket, we get that A = H actually holds for each basket. Thus, I is a positive instance of the Partition problem. ⊓⊔ Theorem 3. The recognition problem of Union-Find trees is NP-complete. Proof. By Proposition 3 we get NP-hardness. For membership in NP, we make use of the characterization given in Theorem 2 and that the possible number of pushes is bounded above by n2: upon pushing x below y, the depth of x and its descendants increases, while the depth of the other nodes remains the same. Since the depth of any node is at most n, the sum of the depths of all the nodes is at most n2 in any tree. Hence, it suffices to guess nondeterministically a sequence t = t0 ⊢ t1 ⊢ . . . ⊢ tk for some k ≤ n2 with tk being a Union tree (which also can be checked in polynomial time). ⊓⊔ 10 5 Conclusion, future directions We have shown that unless P = NP, there is no efficient algorithm to check whether a given tree is a valid Union-Find tree, assuming union-by-rank strat- egy, since the problem is NP-complete, complementing our earlier results assum- ing union-by-size strategy. A very natural question is the following: does there exist a merging strategy under which the time complexity remains amortized almost-constant, and at the same time allows an efficient recognition algorithm? Although this data structure is called "primitive" in the sense that it does not really need an automatic run-time certifying system, but we find the question to be also interesting from the mathematical point of view as well. It would be also an interesting question whether the recognition problem of Union-Find trees built up according to the union-by-rank strategy is still NP-complete if the nodes of the tree are not tagged with the rank, that is, given a tree without rank info, does there exist a Union-Find tree with the same underlying tree? References 1. Hideo Bannai, Shunsuke Inenaga, Ayumi Shinohara, and Masayuki Takeda. Infer- ring strings from graphs and arrays. In Branislav Rovan and Peter Vojt´as, editors, Mathematical Foundations of Computer Science 2003: 28th International Sympo- sium, MFCS 2003, pages 208 -- 217. Springer Berlin Heidelberg, Berlin, Heidelberg, 2003. 2. Leizhen Cai. The recognition of Union trees. Inf. Process. Lett., 45(6):279 -- 283, 1993. 3. Julien Cl´ement, Maxime Crochemore, and Giuseppina Rindone. Reverse engineer- ing prefix tables. In Susanne Albers and Jean-Yves Marion, editors, 26th Inter- national Symposium on Theoretical Aspects of Computer Science, STACS 2009, volume 3 of LIPIcs, pages 289 -- 300. Schloss Dagstuhl - Leibniz-Zentrum fuer In- formatik, Germany, 2009. 4. Thomas H. Cormen, Clifford Stein, Ronald L. Rivest, and Charles E. Leiserson. Introduction to Algorithms. McGraw-Hill Higher Education, 2nd edition, 2001. 5. Maxime Crochemore, Costas S. Iliopoulos, Solon P. Pissis, and German Tischler. Cover array string reconstruction. In Amihood Amir and Laxmi Parida, editors, Combinatorial Pattern Matching: 21st Annual Symposium, CPM 2010, pages 251 -- 259, Berlin, Heidelberg, 2010. Springer Berlin Heidelberg. 6. J.-P. Duval, T. Lecroq, and A. Lefebvre. Efficient validation and construction of border arrays and validation of string matching automata. RAIRO - Theoretical Informatics and Applications, 43(2):281 -- 297, 2009. 7. J.-P. Duval and A. Lefebvre. Words over an ordered alphabet and suffix permuta- tions. Theoretical Informatics and Applications, 36(3):249 -- 259, 2002. 8. Jean-Pierre Duval, Thierry Lecroq, and Arnaud Lefebvre. Border array on bounded alphabet. J. Autom. Lang. Comb., 10(1):51 -- 60, 2005. 9. M. Fredman and M. Saks. The cell probe complexity of dynamic data structures. In Proceedings of the Twenty-first Annual ACM Symposium on Theory of Computing, STOC '89, pages 345 -- 354, New York, NY, USA, 1989. ACM. 10. Bernard A. Galler and Michael J. Fisher. An improved equivalence algorithm. Commun. ACM, 7(5):301 -- 303, May 1964. 11 11. Michael R. Garey and David S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York, NY, USA, 1979. 12. P. Gawrychowski, A. Jez, and L. Jez. Validating the Knuth-Morris-Pratt failure function, fast and online. Theory of Computing Systems, 54(2):337 -- 372, 2014. 13. Kitti Gelle and Szabolcs Iv´an. Recognizing Union-Find trees is NP-complete. CoRR, abs/1510.07462, 2015. 14. Tomohiro I, Shunsuke Inenaga, Hideo Bannai, and Masayuki Takeda. Counting parameterized border arrays for a binary alphabet. In Language and automata theory and applications, volume 5457 of Lecture Notes in Comput. Sci., pages 422 -- 433. Springer, Berlin, 2009. 15. Tomohiro I, Shunsuke Inenaga, Hideo Bannai, and Masayuki Takeda. Verifying and enumerating parameterized border arrays. Theoretical Computer Science, 412(50):6959 -- 6981, 2011. 16. Tomohiro I, Shunsuke Inenaga, Hideo Bannai, and Masayuki Takeda. Verifying and enumerating parameterized border arrays. Theoret. Comput. Sci., 412(50):6959 -- 6981, 2011. 17. Tomohiro I, Shunsuke Inenaga, Hideo Bannai, and Masayuki Takeda. Inferring strings from suffix trees and links on a binary alphabet. Discrete Applied Mathe- matics, 163, Part 3:316 -- 325, 2014. Stringology Algorithms. 18. Kevin Knight. Unification: A multidisciplinary survey. ACM Comput. Surv., 21(1):93 -- 124, 1989. 19. Gregory Kucherov, Lilla T´othm´er´esz, and St´ephane Vialette. On the combinatorics of suffix arrays. Information Processing Letters, 113(22 -- 24):915 -- 920, 2013. 20. Weilin Lu, P. J. Ryan, W. F. Smyth, Yu Sun, and Lu Yang. Verifying a border array in linear time. J. Comb. Math. Comb. Comput, 42:223 -- 236, 2000. 21. Ross M. McConnell, Kurt Mehlhorn, Stefan Naher, and Pascal Schweitzer. Certi- fying algorithms. Computer Science Review, 5(2):119 -- 161, 2011. 22. Tatiana Starikovskaya and Hjalte Wedel Vildhøj. A suffix tree or not a suffix tree? Journal of Discrete Algorithms, 32:14 -- 23, 2015. StringMasters 2012 2013 Special Issue (Volume 2). 23. Robert Endre Tarjan. Efficiency of a good but not linear set union algorithm. J. ACM, 22(2):215 -- 225, 1975. 12
1807.05009
1
1807
2018-07-13T11:11:34
Maintaning maximal matching with lookahead
[ "cs.DS" ]
In this paper we study the problem of fully dynamic maximal matching with lookahead. In a fully dynamic $n$-vertex graph setting, we have to handle updates (insertions and removals of edges), and answer queries regarding the current graph, preferably with a better time bound than that when running the trivial deterministic algorithm with worst-case time of $O(m)$ (where $m$ is the all-time maximum number of the edges) and recompute the matching from scratch each time a query arrives. We show that a maximal matching can be maintained in an (undirected) general graph with a deterministic amortized update cost of $O(\log m)$, provided that a lookahead of length $m$ is available, i.e. we can ``take a peek'' at the next $m$ update operations in advance.
cs.DS
cs
Maintaning maximal matching with lookahead✩ Kitti Gelle1, Szabolcs Iván1 aUniversity of Szeged, Hungary 8 1 0 2 l u J 3 1 ] S D . s c [ 1 v 9 0 0 5 0 . 7 0 8 1 : v i X r a Abstract In this paper we study the problem of fully dynamic maximal matching with lookahead. In a fully dynamic n-vertex graph setting, we have to handle updates (insertions and removals of edges), and answer queries regarding the current graph, preferably with a better time bound than that when running the trivial deter- ministic algorithm with worst-case time of O(m) (where m is the all-time maximum number of the edges) and recompute the matching from scratch each time a query arrives. We show that a maximal matching can be maintained in an (undirected) general graph with a deterministic amortized update cost of O(log m), provided that a lookahead of length m is available, i.e. we can "take a peek" at the next m update operations in advance. insertý ✩Kitti Gelle was supported by the ÚNKP-17-3-I-SZTE-18 New National Excellence Program of the Ministry of Human Capacities. Szabolcs Iván was supported by NKFI grant number K108448. 1. Introduction and notation Graph algorithms are fundamental in computer science. In most cases, graphs have been studied as static objects, however, in many real life examples (e.g. social networks, AI) they are changing in size. In the last few decades, there has been a growing interest in developing algorithms and data structures for such dynamic graphs. In this setting, graphs are subject to updates -- in our case, additions and removals of an edge at a time. The aim of a so-called fully dynamic algorithm (here "fully" means that both addition and removal are supported) is to maintain the result of the algorithm after each and every update of the graph, in a time bound significantly better than recomputing it from scratch each time. In [5], a systematic investigation of dynamic graph problems in the presence of a so-called lookahead was initiated: although the stream of update operations can be arbitrarily large and possibly builds up during the computation time, in actual real-time systems it is indeed possible to have some form of lookahead available. That is, the algorithm is provided with some prefix of the update sequence of some length (for example, in [5] an assembly planning problem is studied in which the algorithm can access the prefix of the sequence of future operations to be handled of length Θ(pm/n log n)), where m and n are the number of edges and nodes, respectively. Similarly to the results of [5] (where the authors devised dynamic algorithms using lookahead for the problems of strongly connectedness and transitive closure), we will execute the tasks in batches: by looking ahead at O(m) future update operations, we treat them as a single batch, preprocess our current graph based on the information we get from the complete batch, then we run all the updates, one at a time, on the appropriately preprocessed graph. This way, we achieve an amortized update cost of O(log m) for maintaining a maximal matching. We view a graph G as a set (or list) of edges, with G standing for its cardinality. This way notions like G ∪ H for two graphs G and H (sharing the common set V (G) = V (H) of vertices) are well-defined. In the studied problem, a matching of a(n undirected) graph G is a subset M ⊆ G of edges having pairwise disjoint sets of endpoints. A matching M is maximal if there is no matching M ′ ) M of G. Given a matching M , for each vertex v of G let mate(v) denote the unique vertex u such that (u, v) ∈ M if such a vertex exists, otherwise mate(v) = null. In the fully dynamic version of the maximal matching problem, the update operations are edge additions +(u, v), edge deletions −(u, v) and the queries have the form mate(u). Preprint submitted to Elsevier July 16, 2018 So a fully dynamic algorithm for maximal matching problem supports the following operations on an undirected graph G = (V, E): • insert(u, v): inserts an edge between u and v • delete(u, v): deletes an edge between u and v • mate(u): answers v if (u, v) ∈ M , where M is the current maximal matching of G and null otherwise Related work. There is an interest in computing a maximum (i.e. maximum cardinality) or maximal (i.e. non-expandable) matching in the fully dynamic setting. There is no "best-so-far" algorithm, since the settings differ: Baswana, Gupta and Sen [1] presented a randomized algorithm for maximal matching, having an O(log n) expected amortized time per update. Based on this algorithm Solomon [11] gave a randomized algorithm with constant amortized update time. (Note that algorithms for maximal matching automatically provide 2-approximations for maximum matching and also vertex cover.) For the deterministic variant, Ivkovi`c and Lloyd [3] defined an algorithm with an O((n + m)0.7072) amortized update time, which was im- proved to an amortized O(√m) update cost by Neiman and Solomon [7]. For maximum matching, Onak and Rubinfeld [8] developed a randomized algorithm that achieves a c-approximation for some constant c, with an O(log2 n) expected amortized update time. To maintain an exact maximum cardinality matching, Micali and Vazirani [6] gave an algorithm with a worst-case update time of O(√n · m). Allowing randomization, an update cost of O(n1.495) is achievable due to Sankowski [9]. We are not aware of any results on allowing lookahead for any of the matching problems, but the notion has been applied to several problems in this field: following the seminal work of Khanna, Motwani and Wilson [5], where lookahead was investigated for the problems of maintaining the transitive closure and the strongly connectedness of a directed graph, Sankowski and Mucha [10] also considered the transitive closure with lookahead via the dynamic matrix inverse problem, devising a randomized algorithm, and Kavitha [4] studied the dynamic matrix rank problem. 2. Maximal matching with lookahead In this section we present an algorithm that maintains a maximal matching in a dynamic graph G with constant query and O(log m) update time (note that O(log m) is also O(log n) as m = O(n2)), provided that a lookahead of length m is available in the sequence of (update and query) operations. This is an improvement over the currently best-known deterministic algorithm [7] that has an update cost of O(√m) without lookahead. The following is clear: Proposition 1. Suppose G is a graph in which M is a maximal matching. Then a maximal matching in the graph G + (u, v) is • M ∪ {(u, v)}, if mate(u) = mate(v) = null, • M , otherwise. This proposition gives the base algorithm greedy for computing a maximal matching in a graph: Note that if one initializes the mate array in the above code so that it contains some non-null entries, then the result of the algorithm represents a maximal matching within the subgraph of G spanned by the vertices having null mates initially. Also, with M represented by a linked list, the above algorithm runs in O(m) total time using no lookahead. Hence, by calling this algorithm on each update operation (after inserting or removing the edge in question), we get a dynamic graph algorithm with no lookahead (hence it uses a lookahead of at most m operations), a constant query cost (as it stores the mate array explicitly) and an O(m) update cost. Using this algorithm A1, we build up a sequence Ak of algorithms, each having a smaller update cost than the previous ones. (In a practical implementation there would be a single 2 algorithm A taking k as a parameter along with the graph G and the update sequence, but for proving the time complexity it is more convenient to denote the algorithms in question by A1, A2, and so on.) In our algorithm descriptions the input is the current graph G (which is ∅ the first time we start running the program) and a sequence (q1, . . . , qt) of operations. Of course as the sequence can be arbitrarily long, we do not require an explicit representation, just the access of the first m elements (that is, we have a lookahead of length m). To formalize our main lemma in a more concise way, we first define the invariant property, which we call h(m)-ensuring, of these algorithms: Definition 1. We say that an algorithm A is an h(m)-ensuring algorithm for maximal matching, if A is a fully dynamic algorithm maintaining a maximal matching in a graph such that if it gets as input a graph G, as an edge list, having m0 edges initially, and a (possibly infinite) stream (q1, q2, . . . , qt) of updates with t ≥ m0, then A can process these queries with an amortized update cost of h(m) using a lookahead of length m, such that between handling of these updates, queries of the form mate(u), asking for the mate of vertex u in the current maximal matching, can be answered in a constant time. In the definition above, m stands for the maximum number of edges in G during its life cycle, formally, m := max{Gq1q2 . . . qi : 0 ≤ i ≤ t}. algorithm for maximal matching, for some universal constant c: As an example, the following algorithm A0 that runs Greedy after each update, is a c · m-ensuring 1. Initialize a global array mate of vertices, set mate(u) := null for each vertex u. 2. Upon receiving an update sequence (q1, . . . , qt), the algorithm does the following: (a) Let M be an empty list of edges. (b) For processing qi, we i. first modify G accordingly, G := G · qi, ii. then we iterate through the current matching M and set mate(u) = mate(v) = null for each (u, v) ∈ M , emptying M during the process, iii. we set M := Greedy(G, mate). (c) Having processed qi, we now can answer queries of the form mate(u) in a constant time, by accessing the global array mate. Step 1 has a setup cost of O(n). When we receive the update sequence, the local initialization of M takes a constant time. Note that for processing qi we do not use any lookahead which is fine. Modifying the current graph G in Step 2.b.i. takes O(m) time, since adding/removing an entry to a list of unique entries takes a time proportional to the size of the list, which is by definition of m, at most m at any given time point i. Then, as the matching M is also a list of at most m edges, iterating through it takes O(m) iterations, setting the mate array for a constant time each, so Step 2.b.ii. also takes O(m) time. Finally, Step 2.b.iii. also takes O(m) time, and after that, we clearly have a maximal matching for Gi := Gq1 . . . qi, stored in the mate array. The total cost for handling a single update is thus c · m for some universal constant c. Note after in each step we erase our "local" matching M from the mate array for a total cost of O(m) since we do not want to rely on the number n of nodes: this is cruical since at the end, we'll apply the above algorithm for very small graphs with m = o(n) edges. So starting from the above algorithm A0, we can build up a sequence Ak of algorithms, each having a better update cost till k = log m by the following lemma: Lemma 1. There is a universal constant C such that if there exists an (f (k) + g(k)· m)-ensuring algorithm Ak for maximal matching, with a setup cost of h(k, m, n), then there also exists an (f (k) + C + g(k) · m)- 2 ensuring algorithm Ak+1 for maximal matching as well, with a setup cost of h(k, m, n) + O(n2). Before proving the above lemma, we derive the main result of the section. As A0 is an c · m-ensuring algorithm, that is, f (k) = 0 and g(k) = c·m, by induction we get the existence of an algorithm a (k·C+ c 2k ·m)- ensuring algorithm for maximal matching. Now setting k = log m we get that Alog m maintains a maximal matching with an amortized update cost of C · log m + 2 2log m · m = C · log m + 2 = O(log m), thus we get: 3 Theorem 1. There exists a fully dynamic graph algorithm for maintaining a maximal matching with an O(log m) amortized update cost and constant query cost, using a lookahead of length m, with a setup cost of O(n2 · log m). Now we prove Lemma 1 by defining the algorithm Ak+1 below. • The algorithm Ak+1 works in phases and returns a graph G (as an edge list) and a matching M (also as an edge list). • The algorithm accesses the global mate array in which the current maximal matching of the whole graph is stored. (Ak+1 might get only a subgraph of the whole actual graph as input.) • The algorithm manages a boolean array Tk+1 of size n× n, initialized to be all-zero in the start of the program (hence the plus setup cost of n2). • As input, Ak+1 gets a graph G and the update sequence (q1, . . . , qt), with a promise of t ≥ m0, where m0 is the number of edges in G. • The algorithm Ak+1 maintains a local matching M as a list of edges (similarly to A0), which is set to the empty list when calling Ak+1. • In one phase, Ak+1 either handles a block ~q = (q1, . . . , qt′) of t′ operations for some m0 4 ≤ t′ ≤ m0 2 , or a single operation. • If G is smaller than our favorite constant 42, then the phase handles only the next update by explicitly modifying G, afterwards recomputing a maximal matching from scratch, in O(42) (constant) time. That is, remove the "local part" M of the global matching); 1. We iterate through all the edges (u, v) ∈ M , and set mate[u] and mate[v] to null (in effect, we 2. We apply the next update operation on G; 3. We set M := Greedy(G, mate). • Otherwise the phase handles t′ operations as follows. First, if there are at most m0 unprocessed queries remaining (that can be checked by a lookahead of length m0 ≤ m), then we finish the processing of the sequence in exactly two phases, each having t′ = t 2 , and handle the next t′ updates in a single phase. Observe that by this method, the value of t′ is always between m0 2 updates. Otherwise, we set t′ = m0 4 and m0 2 . 1. Using lookahead (observe that t′ < m) we collect all the edges involved in ~q (either by an insert or a remove operation) into a graph G′. 2. We iterate through all the edges (u, v) ∈ M , and set mate[u] := null, mate[v] := null. 3. Iterating over all the edges (u, v) in G′, we set Tk+1(u, v) and Tk+1(u, v) to 1. 4. Using Tk+1 containing the adjacency matrix of G′ now, we split the list G into the lists G − G′ and G ∩ G′ by iterating through G and putting (u, v) to either G − G′ (if Tk+1(u, v) is zero) or to G ∩ G′ (otherwise). 5. We reset Tk+1 to be an all-zero matrix by iterating over G′ again and resetting the corresponding entries. 6. We run M := greedy(G − G′, mate). 7. We call Ak(G ∩ G′, (q1, . . . , qt′ )). Let G∗ and M ∗ be the graph and matching returned by Ak. 8. We set G := (G − G′) ∪ G∗ and M := M ∪ M ∗. In order to give the reader a better insight, we give an example before analyzing the time complexity. To make the example more manageable, we adjust the constants as follows: we shall use the constant 1 instead of 42 (that is, if G contains at most one edge, we do not make a recursive call but recompute the matching) and also, the block size A2 handles in one phase will be set to 1 while A3, which we call at the topmost level, will handle 3 operations in one phase. 4 a b f g c e d a b f g c e d (a) The original graph G. (b) G − G′ with a maximal matching. Figure 1: Executing Steps 1 − 3 of A3 on G, looking ahead the operations +(f, g), −(a, f ), +(d, c) Example 1. Let us assume that we call the algorithm A3 on the graph G = [(a, b), (b, g), (a, f ), (g, e), (c, g), (d, e)] of Figure 1 (a). As the graph contains 6 edges, which is more than our threshold 1, a block of update opera- tions of length 6 2 = 3 will be handled in a phase, using lookahead. Now assume the next three update operations are +(f, g), −(a, f ) and +(d, c). Thus G′ = [(f, g), (a, f ), (d, c)] is the list of edges involved, that's for Step 1. In Steps 2 and 3, we construct the graph G′′ = G − G′ and run the greedy matching algorithm on it, the (possible) result is shown in Figure 1 (b). (Note that the actual result depends on the order in which the edges are present in G.) In the Figure, thick circles denote those vertices having a non-null mate at this point (that is, mate[a] = b, mate[b] = a, and so on, c, d and f having a null mate). Now, A2 is called on G ∩ G′ (depicted in Figure 2 (a)), and the whole block of three updates is passed to A2 as well. a a b f g c e (a) The graph G ∩ G′ b f g c e d d (b) A2 adds (f, g) directly Figure 2: Handling the first recursive call. Now as the input graph of A2 has only one edge, A2 just handles the next update +(f, g); that is, it inserts the edge (f, g) into its input of Figure 2 (a) and runs greedy on this, resulting in the graph of Figure 2 (b). Observe that at this point mate[a] = b and mate[g] = e, so neither of these two edges is added to the maximal matching managed by A2. That is due to the fact that the mate array is a global variable. This is vital: this way one can ensure that the union of the matchings of different recursion levels is still a matching, and also ensures a constant-time query cost. Then, as the current graph has two edges (which is larger than the threshold), A2 handles a complete block of operations in a phase. (Now the length of the block happens to be 2 2 = 1 so this does not make that much of a difference.) Thus, using a lookahead of length 1, the only operation to be handled is −(a, f ). So we compute the difference graph and run greedy on it (Figure 3 (a)), compute the intersection graph and 5 call A1 on this along with the update sequence consisting of the single operation −(a, f ) (Figure 3 (b)). a b f g c e d a b f g c e d (a) The result of greedy run on the difference graph (b) The graph passed to A1 along with the single update −(a, f ) Figure 3: Handling the second update As the input of A1 is now a graph consisting of a single edge, it gets removed (as the edge in question is not involved in the matching, which can be seen e.g. from the mate array, the global matching is not changed), resulting in an empty graph on which greedy gives an empty matching as well. Then, A1 returns, as it handled the only operation it received. Now A2 takes control. Concluding the second phase, it constructs the union of its intersection graph and the empty graph returned by A1, so its current graph G becomes the graph on Figure 3 (a). As now the graph has only one edge, the next update +(d, c) is handled directly: the edge (c, d) is inserted and greedy is run (Figure 4 (a)). a b f g c e d a b f g c e d (a) The edge (c, d) is added to the matching by A2. (b) The current graph and matching after handling all the updates. Figure 4: Handling the last update Now as A2 has handled its whole input block, it returns its current graph: A3 takes control and glues together its difference graph from Figure 1 (b) and the returned graph 4 (a), resulting in the graph in Figure 4 (b) which would be the starting graph of further updates. Having completed this example, we will now show its correctness. That is, we claim that each Ak maintains a maximal matching among those vertices having a null mate when the algorithm is called. This is true for the greedy algorithm A0. Now assuming Ak satisfies our claim, let us check Ak+1. When the graph is small, the algorithm throws away its locally stored matching M , resetting the mate array to its original value in the process (in fact, this is the only reason why we store the local matching at each recursion level: the global matching state can be queried by accessing the mate array alone). Then we handle the update and run greedy, which is known to compute a maximal matching on the subgraph of G spanned by the vertices having a null mate. So this case is clear. For the second case, if a block of t′ operations involving the edges of the edge list G′ is handled, then we split the graph into two, namely into a difference graph G − G′ and an intersection graph G′′ := G ∩ G′. By construction, when handling the block, the edges belonging to G − G′ do not get touched and they are present in the graph during the whole phase. Hence, at any time point, a maximal matching of G can be computed by starting from a maximal matching of G − G′ and then extending the matching by a maximal matching in the subgraph of G′′ not covered by the matching of G′. Thus, if we compute a maximal matching M ′ in the subgraph of G − G′ spanned by the vertices having a null mate, updating the mate array accordingly (that is, calling greedy 6 on G′), and maintaining a maximal matching M ′′ over the vertices of G′′ having a null mate after that point (which is done by Ak, by the induction hypothesis), we get that at any time M ′ ∪ M ′′ is a maximal matching of G. Hence, the algorithm is correct. Now we analyze the time complexity of Ak+1. Upon calling Ak+1, we set the local matching M to be the empty list, in constant time. Then, a phase either handles a single operation (if G is bounded by a constant threshold), or a batch of t′ operations. 4 and m0 If G is below the threshold 42, then so is M, thus running Greedy also takes a constant time. Assume the phase handles t′ operations for some t′ between m0 2 . Then, collecting the first t′ updates into a list G′ of edges (containing possibly duplicates) takes O(m0) time. Now constructing the intersection and the difference graphs maintaining an O(m0) time can be done by using the global boolean matrix Tk of size n× n, which is initalized to an all-zero matrix in the very beginning of the program (hence, an initialization cost of n2 is needed to do that), then, the algorithm Ak sets those entries Tk(u, v) and Tk(v, u) for which (u, v) ∈ G′ to one. Using Tk, the list G can be split into G − G′ and G ∩ G′ using O(m0) time. Then, as G − G′ also has at most m0 edges, Greedy runs in O(m0) steps on it as well. Then, we call Ak(G∩G′, (q1, . . . , qt′)). Observe that since G′ is the graph constructed from the t′ queries, it has at most t′ edges, hence G ∩ G′ ≤ t′. Now by assumption, Ak guarantees in this case that the queries can be processed in an amortized time of f (k)+g(k)·t′, since t′ is an upper bound for the size of this dynamic graph during its whole lifecycle. As m0 · m0 per update. Finally, at the end of the phase we have to concatenate the two lists containing the graphs G − G′ and G∗ returned by Ak, and the two matchings M and M ∗, and clear the entries (u, v) of Tk for which (u, v) is present in G′ (this is needed to ensure that at the beginning of each phase, Tk is an all-zero helper matrix). This can be done in O(m0) steps as well, by simply iterating through G′. 2 , this gives an amortized cost at most f (k) + g(k) 4 ≤ t′ m0 2 Overall, to process the t′ updates, the algorithm takes an amortized cost of f (k)+ g(k) a total cost of O(m0) for some universal constant C, which makes the amortized cost to be C +f (k)+ g(k) for some universal constant C, since the number t′ of updates is at least m0 4 . 2 ·m0 per update, plus 2 ·m0 Since in each phase m0 ≤ m (as m0 is the size of the graph G in a specific time point, while m is the maximum of those values over time), we proved Lemma 1 and thus Theorem 1. (cid:3) 2.1. Implementation details and improving the setup cost The careful reader might observe the fact that the algorithms Ak never use the value m to make decisions, neither in the length of the lookahead it uses, nor for setting the length of t′. Hence the amortized update cost is guaranteed to be an actual O(log m). Also, the sequence of these algorithms can be constructed as a single algorithm A, taking as argument a graph G, the sequence ~q of updates, and the recursion depth k as an integer -- but this latter value is used only in order to determine which helper table Tk can A use when constructing the graphs G− G′ and G∩ G′. However, the construction of these graphs happens during substeps 3 − 5 in which no recursive call is made, and after which Tk is again guaranteed to be an all-zero matrix -- hence, the algorithm A can use the very same helper array T on each recursion level. This already improves the setup cost to be O(n2) instead of O(n2 · log m) as there is only one adjacency matrix n× n we have to handle globally, which we initialize by zeroes. However, we can do even better: during the construction of G − G′ and G ∩ G′, we only check those entries of T which correspond to edges already present in G. Thus, we can postpone the initialization: it suffices to set T (u, v) and T (v, u) to zero only for those entries for which (u, v) is in G, which can be handled during the processing of an insert operation for a constant increase in the amortized run-time. The mate array has to be initialized to an all-zero vector in the beginning, though, requiring an O(n) setup cost. So the final form of our main result is the following: Theorem 2. There exists a fully dynamic graph algorithm for maintaining a maximal matching with an O(log m) amortized update cost and constant query cost, using a lookahead of length m, with either an O(n) setup cost (if the memory model allows getting an uninitialized memory chunk of size n× n in constant time) or a setup cost of O(n2) (if in the memory model we have to pay n2 even when the memory is uninitialized). 7 Note that in the latter case if O(n2) is too much of a cost for either in storage space, or as a setup cost, then the set operations required for splitting the graph G can be implemented by using balanced binary trees for the set operations. That way, splitting the list G of size m0, we can make a searchable set from G′ in O(t′ · log t′) time, then doing a search operation for each element of the list G takes an additional time of O(m0 · log t′). As t′ ≤ m0, that's a total time of O(m0 log m0) which yields and additional log m0 amortized cost per update on each recursion level. This way, an amortized update cost of O(log2 m) can be gained, for a setup cost of O(n), that only uses a single global mate array of size n, and lists/sets having in total O(m) elements, with a setup cost of O(n), which might be a more memory-efficient solution for graphs which are guaranteed to be sparse at any given time. If even maintaining the array mate is too much, then one can trade it for a global tree map in which those vertices having a mate appear as key, with their mate as value. That decision makes mate accesses to have the cost of O(log m) (as there are at most 2m nodes actually having a mate at each time step: bear in mind that O(log m) is automatically O(log n) as well, but not necessarily vice versa), allowing for a constant initialization cost and a total memory needed is only that of storing O(m) nodes/edges. The query cost becomes O(log m) in that case. Managing the mate tree map in the code yields an additional total cost of O(m0 × log m) (erasing the local part of the matching) for a phase, which translates to an additional amortized cost of log m per update -- which is free if we already traded the helper array T for set-operations. So in that case we get an algorithm with an amortized update cost of O(log2 m), query cost of O(log m), a constant setup cost and a memory footprint proportional to storing O(m) nodes. This might be the correct choice if we do not know the size of the graph in advance, or if the nodes are not numbers but strings, say, whose possible domain is not known in advance. 3. Conclusion In this study we dealt with a problem arising in the context of fully dynamic graph algorithms. We showed that by using a lookahead of linear length, there is a deterministic algorithm achieving an O(log m) amortized update cost, without knowing the maximal size m of the graph in advance. (Note that once again that O(log m) is O(log n) as well, since m ≤ n2.) closure (and the SCC) properties, studied in [5]: problem using no lookahead has an update cost of O(√m). This result shows that lookahead can help in the dynamic setting for problems other than the transitive indeed, the best known deterministic algorithm for the It is an interesting question to study further the possibilities of using lookahead for different problems, and maybe factor in also randomization as well, albeit for the randomized setting, an algorithm with a (both expected and whp) constant update cost is already known without lookahead. References [1] Surender Baswana, Manoj Gupta, and Sandeep Sen. Fully dynamic maximal matching in O(log n) update time. SIAM Journal on Computing, 44(1):88 -- 113, 2015. [2] Kitti Gelle and Szabolcs Iván. DFS is unsparsable and lookahead can help in maximal matching. Acta Cybernetica, 23(3):887 -- 902, 2018. [3] Zoran Ivković and Errol L. Lloyd. Fully dynamic maintenance of vertex cover, pages 99 -- 111. Springer Berlin Heidelberg, Berlin, Heidelberg, 1994. [4] Telikepalli Kavitha. Dynamic matrix rank with partial lookahead. Theor. Comp. Sys., 55(1):229 -- 249, July 2014. [5] S. Khanna, R. Motwani, and R. H. Wilson. On certificates and lookahead in dynamic graph problems. Algorithmica, 21(4):377 -- 394, Aug 1998. [6] S. Micali and V. V. Vazirani. An o(pV · e) algorithm for finding maximum matching in general graphs. In 21st Annual Symposium on Foundations of Computer Science (sfcs 1980), pages 17 -- 27, Oct 1980. [7] Ofer Neiman and Shay Solomon. Simple deterministic algorithms for fully dynamic maximal matching. ACM Trans. Algorithms, 12(1):7:1 -- 7:15, November 2015. [8] Krzysztof Onak and Ronitt Rubinfeld. Maintaining a large matching and a small vertex cover. In Proceedings of the Forty-second ACM Symposium on Theory of Computing, STOC '10, pages 457 -- 464, New York, NY, USA, 2010. ACM. [9] Piotr Sankowski. Faster dynamic matchings and vertex connectivity. In Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA '07, pages 118 -- 126, Philadelphia, PA, USA, 2007. Society for Industrial and Applied Mathematics. 8 [10] Piotr Sankowski and Marcin Mucha. Fast dynamic transitive closure with lookahead. Algorithmica, 56(2):180 -- 197, February 2010. [11] S. Solomon. Fully dynamic maximal matching in constant update time. In 2016 IEEE 57th Annual Symposium on Foundations of Computer Science (FOCS), pages 325 -- 334, Oct 2016. 9
1602.05866
1
1602
2016-02-18T16:37:24
ABRA: Approximating Betweenness Centrality in Static and Dynamic Graphs with Rademacher Averages
[ "cs.DS" ]
We present ABRA, a suite of algorithms that compute and maintain probabilistically-guaranteed, high-quality, approximations of the betweenness centrality of all nodes (or edges) on both static and fully dynamic graphs. Our algorithms rely on random sampling and their analysis leverages on Rademacher averages and pseudodimension, fundamental concepts from statistical learning theory. To our knowledge, this is the first application of these concepts to the field of graph analysis. The results of our experimental evaluation show that our approach is much faster than exact methods, and vastly outperforms, in both speed and number of samples, current state-of-the-art algorithms with the same quality guarantees.
cs.DS
cs
ABRA: Approximating Betweenness Centrality in Static and Dynamic Graphs with Rademacher Averages∗ Matteo Riondato† Eli Upfal‡ February 19, 2016 ΑΒΡΑΞΑΣ (ABRAXAS): Gnostic word of mystic meaning Abstract We present ABRA, a suite of algorithms that compute and maintain probabilistically-guaranteed, high-quality, approximations of the betweenness centrality of all nodes (or edges) on both static and fully dynamic graphs. Our algorithms rely on random sampling and their analysis leverages on Rademacher averages and pseudodimension, fundamental concepts from statistical learning theory. To our knowledge, this is the first application of these concepts to the field of graph analysis. The results of our experimental evaluation show that our approach is much faster than exact methods, and vastly outperforms, in both speed and number of samples, current state-of-the-art algorithms with the same quality guarantees. 1 Introduction Centrality measures are fundamental concepts in graph analysis, as they assign to each node or edge in the network a score that quantifies some notion of importance of the node/edge in the network [28]. Betweenness Centrality (bc) is a very popular centrality measure that, informally, defines the importance of a node or edge z in the network as proportional to the fraction of shortest paths in the network that go through z [2, 16]. Brandes [12] presented an algorithm (denoted BA) that computes the exact bc values for all nodes or edges in a graph G = (V, E) in time O(V E) if the graph is unweighted, and time O(V E + V 2 log V ) if the graph has positive weights. The cost of BA is excessive on modern networks with millions of nodes and tens of millions of edges. Moreover, having the exact bc values may often not be needed, given the exploratory nature of the task, and a high-quality approximation of the values is usually sufficient, provided it comes with stringent guarantees. Today's networks are not only large, but also dynamic: edges are added and removed continuously. Keeping the bc values up-to-date after edge insertions and removals is a challenging task, and proposed algorithms [18, 22–24] have a worst-case complexity and memory requirements which is not better than from- scratch-recomputation using BA. Maintaining an high-quality approximation up-to-date is more feasible and more sensible: there is little added value in keeping track of exact bc values that change continuously. Contributions We focus on developing algorithms for approximating the bc of all vertices and edges in static and dynamic graphs. Our contributions are the following. • We present ABRA (for "Approximating Betweenness with Rademacher Averages"), the first family of algorithms based on progressive sampling for approximating the bc of all vertices in static and dynamic graphs, where vertex and edge insertions and deletions are allowed. The approximations computed ∗This work was supported in part by NSF grant IIS-1247581 and NIH grant R01-CA180776. †Two Sigma Investments. Part of the work done while affiliated to Brown University. [email protected] ‡Department of Computer Science, Brown University. [email protected] 1 by ABRA are probabilistically guaranteed to be within an user-specified additive error from their exact values. We also present variants with relative (i.e., multiplicative)) error for the top-k vertices with highest bc, and variants that use refined estimators to give better approximations with a slightly larger sample size. • Our analysis relies on Rademacher averages [34] and pseudodimension [30], fundamental concepts from the field of statistically learning theory [36]. Exploiting known and novel results using these concepts, ABRA computes the approximations without having to keep track of any global property of the graph, in contrast with existing algorithms [7, 9, 31]. ABRA performs only "real work" towards the computation of the approximations, without having to compute such global properties or update them after modifications of the graph. To the best of our knowledge, ours is the first application of Rademacher averages and pseudodimension to graph analysis problems, and the first to use progressive random sampling for bc computation. Using pseudodimension new analytical results on the sample complexity of the bc computation task, generalizing previous contributions [31], and formulating a conjecture on the connection between pseudodimension and the distribution of shortest path lengths. • The results of our experimental evaluation on real networks show that ABRA outperforms, in both speed and number of samples, the state-of-the-art methods offering the same guarantees [31]. Outline We discuss related works in Sect. 2. The formal definitions of the concepts we use in the work can be found in Sect. 3. Our algorithms for approximating bc on static graphs are presented in Sect. 4, while the dynamic case is discussed in Sect. 5. The results of our extensive experimental evaluation are presented in Sect. 6. We draw conclusions and outline directions for future work in Sect. 7. Additional details can be found in the Appendices. 2 Related Work The definition of Betweenness Centrality comes from the sociology literature [2, 16], but the study of efficient algorithms to compute it started only when graphs of substantial size became available to the analysts, following the emergence of the Web. The BA algorithm by Brandes [12] is currently the asymptotically fastest algorithm for computing the exact bc values for all nodes in the network. A number of works also explored heuristics to improve BA [15, 33], but retained the same worst-case time complexity. The use of random sampling to approximate the bc values in static graphs was proposed independently by Bader et al. [5] and Brandes and Pich [13], and successive works explored the tradeoff space of sampling- based algorithms [7–9, 31]. We focus here on related works that offer approximation guarantees similar to ours. For an in-depth discussion of previous contributions approximating bc on static graphs, we refer the reader to [31, Sect. 2]. Riondato and Kornaropoulos [31] present algorithms that employ the Vapnik-Chervonenkis (VC) di- mension [36] to compute what is currently the tightest upper bound to the sample size sufficient to obtain guaranteed approximations of the bc of all nodes in a static graph. Their algorithms offer the same guaran- tees as ours, but they need to compute an upper bound to a characteristic quantity of the graph (the vertex diameter, namely the maximum number of nodes on any shortest path) in order to derive the sample size. Thanks to our use of Rademacher averages in a progressive random sampling setting, we do not need to compute any characteristic quantity of the graph, and instead use an efficient-to-evaluate stopping condition to determine when the approximated bc values are close to the exact ones. This allows ABRA to use smaller samples and be much faster than the algorithm by Riondato and Kornaropoulos [31]. A number of works [18, 22–24] focused on computing the exact bc for all nodes in a dynamic graph, taking into consideration different update models. None of these algorithm is provably asymptotically faster than a complete computation from scratch using Brandes' algorithm [12] and they all require significant amount of space (more details about these works can be found in [7, Sect. 2]). In contrast, Bergamini and Meyerhenke [7, 8] built on the work by Riondato and Kornaropoulos [31] to derive an algorithm for maintaining high- quality approximations of the bc of all nodes when the graph is dynamic and both additions and deletions 2 of edges are allowed. Due to the use of the algorithm by Riondato and Kornaropoulos [31] as a building block, the algorithm must keep track of the vertex diameter after an update to the graph. Our algorithm for dynamic graphs, instead, does not need this piece of information, and therefore can spend more time in computing the approximations, rather than in keeping track of global properties of the graph. Moreover, our algorithm can handle directed graphs, which is not the case for the algorithms by Bergamini and Meyerhenke [7, 8]. Hayashi et al. [21] recently proposed a data structure called Hypergraph Sketch to maintain the shortest path DAGs between pairs of nodes following updates to the graph. Their algorithm uses random sampling and this novel data structure allows them to maintain a high-quality, probabilistically guaranteed approximation of the bc of all nodes in a dynamic graph. Their guarantees come from an application of the simple uniform deviation bounds (i.e., the union bound) to determine the sample size, as previously done by Bader et al. [5] and Brandes and Pich [13]. As a result, the resulting sample size is excessively large, as it depends on the number of nodes in the graph. Our improved analysis using the Rademacher averages allows us to develop an algorithm that uses the Hypergraph Sketch with a much smaller number of samples, and is therefore faster. 3 Preliminaries We now introduce the formal definitions and basic results that we use throughout the paper. 3.1 Graphs and Betweenness Centrality Let G = (V, E) be a graph, which can be directed or undirected, and can have non-negative weights on the edges. For any ordered pair (u, v) of different nodes u 6= v, let Suv be the set of Shortest Paths (SPs) from u to v, and let σuv = Suv. Given a path p between two nodes u, v ∈ V , a node w ∈ V is internal to p iff w 6= u, w 6= u, and p goes through w. We denote as σuv(w) the number of SPs from u to v that w is internal to. Definition 1 ([2, 16]). Given a graph G = (V, E), the Betweenness Centrality (bc) of a vertex w ∈ V is defined as b(w) = 1 V (V − 1) X σuv(w) . (u,v)∈V ×V u6=v σuv We have b(w) ∈ [0, 1], for any w ∈ V . Many variants of bc have been proposed in the literature, including one for edges [28]. All our results can be extended to these variants, following the reduction in [31, Sect. 6], but we do not include them here due to space constraints. In this work we focus on computing an (ε, δ)-approximation of the collection B = {b(w), w ∈ V }. Definition 2. Given ε, δ ∈ (0, 1), an (ε, δ)-approximation to B is a collection B = {b(w), w ∈ V } such that Pr(∀w ∈ v : b(w) − b(w) ≤ ε) ≥ 1 − δ . 3.2 Rademacher Averages Rademacher Averages are fundamental concepts to study the rate of convergence of a set of sample averages to their expectations. They are at the core of statistical learning theory [36] but their usefulness extends way beyond the learning framework [32]. We present here only the definitions and results that we use in our work and we refer the readers to, e.g., the book by Shalev-Shwartz and Ben-David [34] for in-depth presentation and discussion. While the Rademacher complexity can be defined on an arbitrary measure space, we restrict our discussion here to a sample space that consists of a finite domain D and a uniform distribution over that domain. Let F be a family of functions from D to [0, 1], and let S = {c1, . . . , c'} be a sample of ' elements from D, sampled 3 'X uniformly and independently at random. For each f ∈ F, the true sample and the sample average of f on a sample S are mD(f) 1 D f(c) and mS(f) = 1 (1) Given S, we are interested in bounding the maximum deviation of mS(f) from mD(f), i.e., in the quantity (2) For 1 ≤ i ≤ ', let σi be a Rademacher r.v., i.e., a r.v. that takes value 1 with probability 1/2 and −1 with probability 1/2. The r.v.'s σi are independent. Consider the quantity mS(f) − mD(f) . f(ci). sup f∈F c∈D i=1 ' 'X # R(F,S) = Eσ σif(ci) , (3) " 'X i=1 1 ' sup f∈F where the expectation is taken w.r.t. the Rademacher r.v.'s, i.e., conditionally on S. The quantity R(F,S) is known as the (conditional) Rademacher average of F on S. The following is a key result in statistical learning theory, connecting R(F,S) to the maximum deviation (2). Theorem 1 (Thm. 26.5 [34]). Let δ ∈ (0, 1) and let S be a collection of ' elements of D sampled independently and uniformly at random. Then, with probability at least 1 − δ, mS(f) − mD(f) ≤ 2R(F,S) + 3 sup f∈F . (4) Thm. 1 is how the result is classically presented, but better although more complex bounds than (4) are available [29]. Theorem 2 (Thm. 3.11 [29]). Let δ ∈ (0, 1) and let S be a collection of ' elements of D sampled independently and uniformly at random. Let rln(2/δ) 2' α = then, with probability at least 1 − δ, ln 2 d + q(cid:0)2'R(F,S) + ln 2 ln 2 d (cid:1) ln 2 d d mS(f) − mD(f) ≤ R(F,S) 1 − α + sup f∈F ln 2 2'α(1 − α) + d , s (5) (6) ln 2 2' d . Computing, or even estimating, the expectation in (3) w.r.t. the Rademacher r.v.'s is not straightforward, and can be computationally expensive, requiring a time-consuming Monte Carlo simulation [10]. For this reason, upper bounds to the Rademacher average are usually employed in (4) and (6) in place of R(F,S). A powerful and efficient-to-compute bound is presented in Thm. 3. Given S, consider, for each f ∈ F, the vector vf,S = (f(c1), . . . , f(c')), and let VS = {vf , f ∈ F} be the set of such vectors (VS ≤ F). Theorem 3 (Thm. 3 ). Let w : R+ → R+ be the function exp(s2kvk2/(2'2)), (7) w(s) = 1 ln X v∈VS s where k · k denotes the Euclidean norm. Then (8) The function w is convex, continuous in R+, and has first and second derivatives w.r.t. s everywhere in its domain, so it is possible to minimize it efficiently using standard convex optimization methods [11]. In future work, we plan to explore how to obtain a tighter bound than the one presented in Thm. 3 using recent results by Anguita et al. [1]. w(s) . R(F,S) ≤ min s∈R+ 4 4 Static Graph BC Approximation We now present and analyze ABRA-s, our progressive sampling algorithm for computing an (ε, δ)-approximation to the collection of exact bc values in a static graph. Many of the details and properties of ABRA-s are shared with the other ABRA algorithms we present. Progressive Sampling. Progressive sampling algorithms are intrinsically iterative. At a high level, they work as follows. At iteration i, the algorithm extracts an approximation of the values of interest (in our case, of the bc of all nodes) from a collection Si of Si random samples from a suitable domain D (in our case, the samples are pairs of different nodes). Then, the algorithm checks a specific stopping condition which uses information obtained from the sample and from the computed approximation. If the stopping condition is satisfied, then the approximation has, with the required probability, the desired quality (in our case, it is an (ε, δ)-approximation), and can be returned in output, at which point the algorithm terminates. If the stopping condition is not satisfied, the algorithm builds a collection Si+1 by adding random samples to the Si until Si+1, the algorithm iterates, computing a new approximation from the so-created collection Si+1. There are two main challenges for the algorithm designer: deriving a "good" stopping condition and determining the initial sample size S1 and the next sample sizes Si+1. Ideally, one would like a stopping condition that: 1. when satisfied, guarantees that the computed approximation has the desired quality properties (in our case, it is an (ε, δ)-approximation; and 2. can be evaluated efficiently; and 3. is tight, in the sense that is satisfied at small sample sizes. The stopping condition for our algorithm is based on Thm. 3 and Thm. 2 and has all the above desirable properties. The second challenge is determining the sample schedule (Si)i>0. Any monotonically increasing sequence of positive numbers can act as sample schedule, but the goal in designing a good sample schedule is to minimize the number of iterations that are needed before the stopping condition is satisfied, while minimizing the sample size Si at the iteration i at which this happens. The sample schedule may be fixed in advance, but an adaptive approach that ties the sample schedule to the stopping condition can give better results, as the sample size Si+1 for iteration i + 1 can be computed using information obtained in (or up-to) iteration i. ABRA uses such an adaptive approach. 4.1 Algorithm Description and Analysis ABRA-s takes as input a graph G = (V, E) and two parameters ε, δ ∈ (0, 1), and outputs a collection algorithm samples from the domain D ← {(u, v) ∈ V × V, u 6= v}. eB = {eb(w), w ∈ V } that is an (ε, δ)-approximation of the betweenness centralities B = {b(w), w ∈ V }. The For each node w ∈ V , let fw : D → R+ be the function fw(u, v) = σuv(w) , σuv (9) i.e., fw(u, v) is the fraction of shortest paths (SPs) from u to v that go through w. Let F be the set of these functions. Given this definition, we have that mD(fw) = 1 D X fw(u, v) (u,v)∈D = 1 V (V − 1) = b(v) . 5 X (u,v)∈V ×V u6=v σuv(w) σuv Let now S = {(ui, vi), 1 ≤ i ≤ '} be a collection of ' pairs (u, v) from D. For the sake of clarity, we define eb(w) = mS(fw) = 1 'X i=1 ' fw((ui, vi)) . For each w ∈ V consider the vector It is easy to see thateb(w) = kvwk1/'. Let now VS be the set of these vectors: vw = (fw(u1, v1), . . . , fw(u', v')) . VS = {vw, w ∈ V } . If we have complete knowledge of this set of vectors, then we can compute the quantity ω∗ = min s∈R+ 1 s ln X v∈VS exp(cid:0)s2kvk2/(2'2)(cid:1) , s ln 2 2' δ then use ω∗ in (5) in place of R(F,S) to obtain α, and combine (6), (7), and (8) to obtain ∆S = ω∗ 1 − α ln 2 δ , + and finally check whether ∆S ≤ ε. This is ABRA-s's stopping condition. When it holds, we can just return 2'α(1 − α) + the collection eB = {eb(w) = kvwk1/', w ∈ V } since, from the definition of ∆S and Thms. 2 and 3, we have that eB is an (ε, δ)-approximation to the exact betweenness values. (10) of exact bc values. ABRA-s works as follows. Suppose for now that we fix a priori a monotonically increasing sequence (Si)i>0 of sample sizes (we show in later paragraph how to compute the sample schedule adaptively on the fly). The algorithm builds a collection S by sampling pairs (u, v) independently and uniformly at random from D, until it reaches size S1. After each pair of nodes has been sampled, ABRA-s performs an s − t SP computation from u to v and then backtracks from v to u along the SPs just computed, to keeps track of the set VS of vectors (details given below). For clarity of presentation, let S1 denote S when it has size exactly it is at most ε. If so, then it returns eB. Otherwise, ABRA-s iterates and continues adding samples from D S1, and analogously for Si and Si, i > 1. Once S1 has been built, ABRA-s computes ∆Si and checks whether to S until it has size S2, and so on until ∆Si ≤ ε holds. The pseudocode for ABRA-s is presented in Alg. 1, including the steps to update VS and to adaptively choose the sample schedule, as described in the following Theorem 4 (correctness). The collection eB returned by ABRA-s is a (ε, δ)-approximation to the collection paragraphs. We now prove the correctness of the algorithm. Proof. The claim follows from the definitions of S, VS, F, fw for w ∈ V , eb(w), ∆Si, and from Thms. 2 the set VS of vectors, which is used to compute the value ∆S and the valueseb(w) = kvwk1/S in eB. In and 3. Computing and maintaining the set VS We now discuss in details how ABRA-s can efficiently maintain addition to VS, ABRA-s also maintains a map M from V to VS (i.e., M[w] is a vector vw ∈ VS), and a counter cv for each v ∈ VS, denoting how many nodes w ∈ V have M[w] = v. At the beginning of the execution of the algorithm, we have S = ∅ and also VS = ∅. Nevertheless, ABRA-s initializes VS to contain one special empty vector 0, with no components, and M so that M[w] = 0 for all w ∈ V , and c0 = V (lines 3 and following in Alg: 1). After having sampled a pair (u, v) from D, ABRA-s updates VS, M and the counters as follows. First, it performs (line 10) a s − t SP computation from u to v using any SP algorithms (e.g., BFS or Dijkstra) 6 Algorithm 1: ABRA-s: absolute error approximation of bc on static graphs input : Graph G = (V, E), accuracy parameter ε ∈ (0, 1), confidence parameter δ ∈ (0, 1) output: Set eB of bc approximations for all nodes in V foreach z ∈ Pu[v] do σzv ← 1 foreach node w on a SP from u to v, in reverse order by d(u, w) do else cv0 ← cv0 + 1 M[w] ← v0 if cv > 1 then cv ← cv − 1 else V ← V \{v} foreach z ∈ Pu[w] do σzv ← σzv + σwv 1+16ε) ln(2/δ) 4ε2 1 D ← {(u, v) ∈ V × V, u 6= v} √ 2 S0 ← 0, S1 ← (1+8ε+ 3 0 = (0) 4 V = {0} 5 foreach w ∈ V do M[w] = 0 c0 ← V 6 j ← 1 7 while True do 8 9 for j ← 1 to Si − Si−1 do (u, v) ← uniform_random_sample(D) //Truncated SP computation compute_SPs(u, v) if reached v then σuv(w) ← σuwσwv v ← M[w] v0 ← ((j1, g1), (j2, g2), . . . if v0 6∈ V then {z } v cv0 ← 1 V ← V ∪ {v0} , (j, σuv(w))) 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 v∈VS exp(cid:0)s2kvk2/(2S2 i )(cid:1) end s lnP δ +p(2Siω∗ end end i ← mins∈R+ 1 ω∗ αi ← ln 2 δ) ln 2 ln 2 ∆Si ← ω∗ 2Siαi(1−αi) + i1−αi if ∆Si ≤ ε then break else Si+1 ← nextSampleSize() i ← i + 1 i +ln 2 ln 2 + δ δ δ q ln 2 δ2Si 26 27 28 29 30 31 32 end end j ← j + 1 33 return eB ← {eb(w) ← kM[w]k1/Si, w ∈ V } modified, as discussed by Brandes [12, Lemma 3], to keep track, for each node w encountered during the computation, of the SP distance d(u, w) from u to w, of the number σuw of SPs from u to w, and of the set Pu(w) of (immediate) predecessors of w along the SPs from u.1 Once v has been reached (and only if it has been reached), the algorithm starts backtracking from v towards u along the SPs it just computed (line 12). During this backtracking, the algorithm visits the nodes along the SPs in inverse order of SP distance from 1Storing the set of immediate predecessors is not necessary. By not storing it, we can reduce the space complexity from O(E) to O(V ), at the expense of some additional computation at runtime. 7 u. For each visited node w different from u and v, it computes the value fw(u, v) = σuv(w) of SPs from u to v that go through w, which is obtained as σuv(w) = σuw × X σzv z : w∈Pu(z) where the value σuw is obtained during the s−t SP computation, and the values σzw are computed recursively during the backtracking (line 20) [12]. After computing σuv(w), the algorithm takes the vector v ∈ VS such that M[w] = v and creates a new vector v0 by appending σuv(w) to the end of v.2 Then it adds v0 to the set VS, updates M[w] to v0, and increments the counter cv0 by one (lines 14 to 19). Finally, the algorithm decrements the counter cv by one, and if it becomes equal to zero, ABRA-s removes v from VS (line 20). At this point, the algorithm moves to analyzing another node w0 with distance from u less or equal to the distance of w from u. It is easy to see that when the backtracking reaches u, the set VS, the map M, and the counters, have been correctly updated. store the vectors in VS (even in sparse form), but it is sufficient to maintain their '1- and Euclidean norms, which require much less space. We remark that to compute ∆Si and eB and to keep the map M up to date, we do not actually need to 4.1.1 Computing the sample schedule We now discuss how to compute the initial sample size S1 at the beginning of ABRA-s (line 2 of Alg. 1) and the sample size Si+1 at the end of iteration i of the main loop (line 28). We remark that any sample schedule (Si)i>0 can be used, and our method is an heuristic that nevertheless exploits all available information at the end of each iteration to the most possible extent, with the goal of increasing the chances that the stopping condition is satisfied at the next iteration. As initial sample size S1 we choose S1 ≥ (1 + 8ε + √ 1 + 16ε) ln(2/δ) 4ε2 . (11) To understand the intuition behind this choice, recall (6), and consider that, at the beginning of the algorithm, we obviously have no information about R(F,S1), except that it is non-negative. Consequently we also can not compute α as in (5), but we can easily see that α ∈ [0, 1/2]. From the fact that R(F,S) ≥ 0, we have that, for the r.h.s. of (6) to be at most ε (i.e., for the stopping condition to be satisfied after the first iteration of the algorithm), it is necessary that s ln 2 2S1 δ ≤ ε . ln(2/δ) 2S1 ≤ ε . ln 2 δ 2S1α(1 − α) + s 2 ln(2/δ) + S1 Then, using the fact that the above expression decreases as α increases, we use α = 1/2, i.e., its maximum attainable value, to obtain the following inequality, where S1 acts as the unknown: Solving for S1 under the constraint of S1 ≥ 1, δ ∈ (0, 1), ε ∈ (0, 1) gives the unique solution in (11). Computing the next sample size Si+1 at the end of iteration i (in the pseudocode in Alg. 1, this is done by calling nextSampleSize() on line 28) is slightly more involved. The intuition is to assume that ω∗ i , which is an upper bound to R(F,Si), is also an upper bound to R(F,Si+1), whatever Si+1 will be, and whatever 2ABRA-s uses a sparse representation for the vectors v ∈ VS, storing only the non-zero components of each v as pairs (i, g), where i is the component index and g is the value of that component. 8  Let Root 1 Root 2 Root 3 z = 48ω∗ i + (1 + 4ε)2 w = −1 − 12ε + 8(27(ω∗ √ 3 − 1 + 2ω∗ y = 12 θ = arg(−w + jy)/3 where j is the imaginary unity and arg(') is the argument of the complex number ' i + 2εp−(27(ω∗ i )2 + (21 − 8ε)ε2 + 18b(1 + f) i (1 + 18ε)) i )2 − ε2(1 + 16ε) − ω∗ δ )((1 + 4ε) − √ 1 3(ln 2 δ )(2(1 + 4ε) + δ )(2(1 + 4ε) + 1 6(ln 2 1 6(ln 2 z cos θ)(ω∗ √ √ √ z(cos θ + z(cos θ − √ i − ε)−2 3 sin θ))(ω∗ 3 sin θ))(ω∗ i − ε)−2 i − ε)−2 Table 1: Roots of the cubic equation (13) for the computation of the next sample size. size it may have. At this point, we can ask what is the minimum size Si+1 = Si+1 for which ∆Si+1 would be at most ε, under the assumption that R(F,Si+1) ≤ ω∗ i . More formally, we want to solve the inequality  1 + q ω∗ × i + δ ln 2 (2Si+1ω∗ i + ln 2 ln 2 δ + q δ δ ) ln 2 (2Si+1ω∗ 2Si+1 i + ln 2 δ ) ln 2 δ s  + ln 2 2Si+1 δ ≤ ε (12) where Si+1 acts as the unknown. The l.h.s. of this inequality is obtained by plugging (5) into (6) and using in place of R(F,S), Si+1 in place of ', and slightly reorganize the terms for readability. Finding the ω∗ solution to the above inequality requires computing the roots of the cubic equation (in x) i (cid:19)2 ln 2 −8 (cid:18) ln 2 (cid:18) δ − 4 (cid:18) (cid:19) (cid:19)3 + ln 2 δ (−16ω∗ i + (1 + 4ε)2)x δ i − ε)2(1 + 4ε)x2 + 4(b − f)4x3 = 0 . (ω∗ (13) One can verify that the roots of this equation are all reals. The roots are presented in Table 1. The solution to inequality (12) is that Si+1 should be larger than one of these roots, but which of the roots it should be larger than depends on the values of ω∗ i , δ, and ε. In practice, we compute each of the roots and then choose the smallest positive one such that, when Si+1 equals to this root, then (12) is satisfied. i , which is not guaranteed to be true, is what makes our procedure for selecting the next sample size an heuristics. Nevertheless, Using information available at the current iteration to compute the sample size for the next iteration is more sensible than having a fixed sample schedule, as it tunes the growth of the sample size to the quality of the current sample. Moreover, it removes from the user the burden of choosing a sample schedule, effectively eliminating one parameter of the algorithm. The assumption R(F,Si+1) ≤ ω∗ 4.2 Relative-error Top-k Approximation In practical applications it is usually necessary (and sufficient) to identify the vertices with highest bc, as they act, in some sense, as the "primary information gateways" of the network. In this section we present a variant ABRA-k of ABRA-s to compute a high-quality approximation of the set TOP(k, G) of the top-k vertices with highest bc in a graph G. The approximationeb(w) returned by ABRA-k for a node w is within a multiplicative factor ε from its exact value b(w), rather than an additive factor ε as in ABRA-s. This higher accuracy has a cost in terms of the number of samples needed to compute the approximations. Formally, assume to order the nodes in the graph in decreasing order by bc, ties broken arbitrarily, and let bk be the bc of the k-th node in this ordering. Then the set TOP(k, G) is defined as the set of nodes 9 with bc at least bk, and can contain more than k nodes: TOP(k, G) = {(w, b(w) : v ∈ V and b(w) ≥ bk} . In the first phase, we run ABRA-s with parameters ε and δ1. Let '0 be the k-th highest valueeb(w) returned The algorithm ABRA-k follows the same approach as the algorithm for the same task by Riondato and Kornaropoulos [31, Sect. 5.2] and works in two phases. Let δ1 and δ2 be such that (1− δ1)(1− δ2) ≥ (1− δ). by ABRA-s, ties broken arbitrarily, and let b0 = '0 − ε. In the second phase, we use a variant ABRA-r of ABRA-s with a modified stopping condition based on relative-error versions of Thms. 1 and 3 (Thms. 11 and 12 from Appendix D) , which take ε, δ2, and λ = b0 Indeed, ABRA-r is the same as as parameters. The parameter λ plays a role in the stopping condition. ABRA-s, with the only crucial difference in the definition of the quantity ∆Si, which is now: ∆Si = 2 min s∈R+ 1 s + 3 λ ln(2/δ) 2Si . (14) i v∈V exp λ2S2 (cid:19) (cid:18) s2kvk2 lnX eB = {eb(w), w ∈ V } eb(v) − b(v) s ! Pr ∃w ∈ V : max{λ, b(v)} > ε < δ . Theorem 5. Let bet the output of ABRA-r. Then eB is such that Thms. 11 and 12 from Appendix D instead of Thms. 2 and 3. The proof follows the same steps as the proof for Thm. 4, using the above definition of ∆Si and applying Let '00 be the k-th highest valueeb(w) returned by ABRA-r and let b00 = '00/(1 + ε). ABRA-k then returns (cid:93)TOP(k, G) = {(w,eb(w)) : w ∈ V andeb(w) ≥ b00} . the set We have the following result showing the properties of the collection (cid:93)TOP(k, G). Theorem 6. With probability at least 1 − δ, the set (cid:93)TOP(k, G) is such that: 1. for any pair (v, b(v)) ∈ TOP(k, G), there is one pair (v,eb(v)) ∈ (cid:93)TOP(k, G) (i.e., we return a superset of the top-k nodes with highest betweenness) and this pair is such that eb(w) − b(w) ≤ εb(w); 2. for any pair (w,eb(w)) ∈ (cid:93)TOP(k, G) such that (w, b(w)) 6∈ TOP(k, G) (i.e., any false positive) we have thateb(w) ≤ (1 + ε)bk (i.e., the false positives, if any, are among the nodes returned by ABRA-k with lower bc estimation). The proof and the pseudocode for ABRA-k can be found in Appendix A. 4.3 Special Cases In this section we consider some special restricted settings that make computing an high-quality approxima- tion of the bc of all nodes easier. One example of such restricted settings is when the graph is undirected and every pair of distinct nodes is either connected with a single SP or there is no path between the nodes. This is the case for many road networks, where the unique SP condition is often enforced [17]. Riondato and Kornaropoulos [31, Lemma 2] showed that, in this case, the number of samples needed to compute a high-quality approximation of the bc of all nodes is independent on any property of the graph, and only depends on the quality controlling parameters ε and δ. The algorithm by Riondato and Kornaropoulos [31] works differently from ABRA-s, as it samples one SP at a time and only updates the bc estimation of nodes 10 along this path, rather than sampling a pair of nodes and updating the estimation of all nodes on any SPs between the sampled nodes. Nevertheless, as shown in the following theorem, we can actually even generalize the result by Riondato and Kornaropoulos [31], as shown in Thm. 7. The statement and the proof of this theorem use pseudodimension [30], an extension of the Vapnik-Chervonenkis (VC) dimension to real-valued functions. Details about pseudodimension and the proof of Thm. 7 can be found in Appendix B. Corollary 1 shows how to modify ABRA-s to take Thm. 7 into account. Theorem 7. Let G = (V, E) be a graph such that it is possible to partition the set D = {(u, v) ∈ V ×V, u 6= v} in two classes: a class A = {(u∗, v∗)} containing a single pair of different nodes (u∗, v∗) such that σu∗v∗ ≤ 2 (i.e., connected by either at most two SPs or not connected), and a class B = D \ A of pairs (u, v) of nodes with σuv ≤ 1 (i.e., either connected by a single SP or not connected). Then the pseudodimension of the family of functions {fw : D → [0, 1], w ∈ V }, where fw is defined as in (9), is at most 3. Corollary 1. Assume to modify ABRA-s with the additional stopping condition instructing to return the set B = {eb(w), w ∈ V } after a total of (cid:18) 3 + ln 1 eb(w) − b(w) > ε) < δ . pairs of nodes have been sampled from D. The set B is s.t. Pr(∃w ∈ V : r = c ε2 (cid:19) δ The bound in Thm. 7 is strict, i.e., there exists a graph for which the pseudodimension is exactly 3 [31, Lemma 4]. Moreover, as soon as we relax the requirement in Thm. 7 and allow two pairs of nodes to be connected by two SPs, there are graphs with pseudodimension 4 (Lemma 4 in Appendix B). For the case of directed networks, it is currently an open question whether a high-quality (i.e., within ε) approximation of the bc of all nodes can be computed from a sample whose size is independent of properties of the graph, but it is known that, even if possible, the constant would not be the same as for the undirected case [31, Sect. 4.1]. We conjecture that, given some information on how many pair of nodes are connected by x shortest paths, for x ≥ 0, it should be possible to derive a strict bound to the pseudodimension associated to the graph. 4.4 Improved Estimators Geisberger et al. [17] present an improved estimator for bc using random sampling. Their experimental results show that the quality of the approximation is significantly improved, but they do not present any theoretical analysis. Their algorithm, which follows the work of Brandes and Pich [13] differs from ours as it samples vertices and performs a Single-Source-Shortest-Paths (SSSP) computation from each of the sampled vertices. We can use an adaptation of their estimator in a variant of our algorithm, and we can prove that this variant is still probabilistically guaranteed to compute an (ε, δ)-approximation of the bc of all nodes, therefore removing the main limitation of the original work, which offered no quality guarantees. We now present this variant considering, for ease of discussion, the special case of the linear scaling estimator by Geisberger et al. [17], this technique can be extended to the generic parameterized estimators they present. The intuition behind the improved estimator is to increase the estimation of the bc for a node w pro- portionally to the ratio between the SP distance d(u, w) from the first component u of the pair (u, v) to w and the SP distance d(u, v) from u to v. Rather than sampling pairs of nodes, the algorithm samples triples (u, v, d), where d is a direction, (either ← or →), and updates the betweenness estimation differently depending on d, as follows. Let D0 = D × {←,→} and for each w ∈ V , define the function gw from D0 to [0, 1] as: ( σuv(w) σuv σuv(w) σuv gw(u, v, d) = d(u,w) d(u,v) (cid:16)1 − d(u,w) d(u,v) if d =→ (cid:17) if d =← 11 Let S be a collection of ' elements of D0 sampled uniformly and independently at random with replacement. Our estimationeb(w) of the bc of a node w is X eb(w) = 2 gw(u, v, d) = 2mS(fw) . ' (u,v,d)∈S The presence of the factor 2 in the estimator calls for a single minor adjustment in the definition of ∆Si which, for this variant of ABRA-s, becomes ∆Si = ω∗ 1 − αi 2Siαi(1 − αi) + s 2 ln 2 Si δ ln 2 δ i + i.e., w.r.t. the original definition of ∆Si, there is an additional factor 4 inside the square root of the third term on the r.h.s.. The output of this variant of ABRA-s is still a high-quality approximation of the bc of all nodes, i.e., Thm. 4 still holds with this new definition of ∆Si. This is due to the fact that the results on the Rademacher averages presented in Sect. 3.2 can be extended to families of functions whose co-domain is an interval [a, b], rather than just [0, 1] [34]. 5 Dynamic Graph BC Approximation In this section we present an algorithm, named ABRA-d, that computes and keeps up to date an high-quality approximation of the bc of all nodes in a fully dynamic graph, i.e., in a graph where vertex and edges can be added or removed over time. Our algorithm leverages on the recent work by Hayashi et al. [21], who introduced two fast data structures called the Hypergraph Sketch and the Two-Ball Index: the Hypergraph Sketch stores the bc estimations for all nodes, while the Two-Ball Index is used to store the SP DAGs and to understand which parts of the Hypergraph Sketch needs to be modified after an update to the graph (i.e., an edge or vertex insertion or deletion). Hayashi et al. [21] show how to populated and update these data structures to maintain an (ε, δ)-approximation of the bc of all nodes in a fully dynamic graph. Using the novel data structures results in orders-of-magnitude speedups w.r.t. previous contributions [7, 8]. The algorithm by Hayashi et al. [21] is based on a static random sampling approach which is identical to the one described for ABRA-s, i.e., pairs of nodes are sampled and the bc estimation of the nodes along the SPs between the two nodes are updated as necessary. Their analysis on the number of samples necessary to obtain an (ε, δ)-approximation of the bc of all nodes uses the union bound, resulting in a number of samples that depends on the logarithm of the number of nodes in the graph, i.e., O(ε−2(log(V /δ))) pairs of nodes must be sampled. ABRA-d builds and improves over the algorithm presented by Hayashi et al. [21] as follows. Instead of using a static random sampling approach with a fixed sample size, we use the progressive sampling approach and the stopping condition that we use in ABRA-s to understand when we sampled enough to first populate the Hypegraph Sketch and the Two-Ball Index. Then, after each update to the graph, we perform the same operations as in the algorithm by Hayashi et al. [21], with the crucial addition, after these operation have been performed, of keeping the set VS of vectors and the map M (already used in ABRA-s) up to date, and checking whether the stopping condition is still satisfied. If it is not, additional pairs of nodes are sampled and the Hypergraph Sketch and the Two-Ball Index are updated with the estimations resulting from these additional samples. The sampling of additional pairs continues until the stopping condition is satisfied, potentially according to a sample schedule either automatic, or specified by the user. As we show in Sect. 6, the overhead of additional checks of the stopping condition is minimal. On the other hand, the use of the progressive sampling scheme based on the Rademacher averages allows us to sample much fewer pairs of nodes than in the static sampling case based on the union bound: [31] already showed that it is possible to sample much less than O(log V ) nodes, and, as we show in our experiments, our sample sizes are even smaller than the ones by [31]. The saving in the number of samples results in a huge speedup, as the running 12 time of the algorithms are, in a first approximation, linear in the number of samples, and in a reduction in the amount of space required to store the data structures, as they now store information about fewer SP DAGs. Theorem 8. The set eB = {eb(w), w ∈ V } returned by ABRA-d after each update has been processed is such that Pr(∃w ∈ V s.t. eb(w) − b(w) > ε) < δ . The proof follows from the correctness of the algorithm by Hayashi et al. [21] and of ABRA-s (Thm. 4). 6 Experimental Evaluation In this section we presents the results of our experimental evaluation. We measure and analyze the perfor- mances of ABRA-s in terms of its runtime and sample size and accuracy, and compared them with those of the exact algorithm BA [12] and the approximation algorithm RK [31], which offers the same guarantees as ABRA-s (computes an (ε, δ)-approximation the bc of all vertices). Implementation and Environment We implement ABRA-s and ABRA-d in C++, as an extension of the NetworKit library [35]. The code is available from http://matteo.rionda.to/software/ABRA-radebetw. tbz2. We performed the experiments on a machine with a AMD PhenomTM II X4 955 processor and 16GB of RAM, running FreeBSD 11. Datasets and Parameters We use graphs of various nature (communication, citations, P2P, and social networks) from the SNAP repository [25]. The characteristics of the graphs are reported in the leftmost column of Table 2. In our experiments we varied ε in the range [0.005, 0.3], and we also evaluate a number of different sampling schedules (see Sect. 6.2). In all the results we report, δ is fixed to 0.1. We experimented with different values for this parameter, and, as expected, it has a very limited impact on the nature of the results, given the logarithmic dependence of the sample size on δ. We performed five runs for each combination of parameters. The variance between the different runs was essentially insignificant, so we report, unless otherwise specified, the results for a random run. 6.1 Runtime and Speedup Our main goal was to develop an algorithm that can compute an (ε, δ)-approximation of the bc of all nodes as fast as possible. Hence we evaluate the runtime and the speedup of ABRA-s w.r.t. BA and RK. The results are reported in columns 3 to 5 of Table 2 (the values for ε = 0.005 are missing for Email-Enron and Cit-HepPh because in these case both RK and ABRA-s were slower than BA). As expected, the runtime is a perfect linear function of the sample size (column 9), which in turns grows as ε−2. The speedup w.r.t. the exact algorithm BA is significant and naturally decreases quadratically with ε. More interestingly ABRA-s is always faster than RK, sometimes by a significant factor. At first, one may think that this is due to the reduction in the sample size (column 10), but a deeper analysis shows that this is only one component of the speedup, which almost always greater than the reduction in sample size. The other component can be explained by the fact that RK must perform an expensive computation (computing the vertex-diameter [31] of the graph) to determine the sample size before it can start sampling, while ABRA-s can immediately start sampling and rely on the stopping condition (whose computation is inexpensive, as we will discuss). The different speedups for different graphs are due to different characteristics of the graphs: when the SP DAG between two nodes has many paths, ABRA-s does more work per sample than RK (which only explore a single SP on the DAG), hence the speedup is smaller. 13 Speedup w.r.t. Runtime Breakdown (%) Graph Directed Soc-Epinions1 V = 75, 879 E = 508, 837 Directed P2p-Gnutella31 V = 62, 586 E = 147, 892 Email-Enron Undirected V = 36, 682 E = 183, 831 Cit-HepPh Undirected V = 34, 546 E = 421, 578 ε 0.005 0.010 0.015 0.020 0.025 0.030 0.005 0.010 0.015 0.020 0.025 0.030 0.010 0.015 0.020 0.025 0.030 0.010 0.015 0.020 0.025 0.030 Runtime (sec.) 483.06 124.60 57.16 32.90 21.88 16.05 100.06 26.05 11.91 7.11 4.84 3.41 202.43 91.36 53.50 31.99 24.06 215.98 98.27 58.38 37.79 27.13 BA 1.36 5.28 11.50 19.98 30.05 40.95 1.78 6.85 14.98 25.09 36.85 52.38 1.18 2.63 4.48 7.50 9.97 2.36 5.19 8.74 13.50 18.80 RK 2.90 3.31 4.04 5.07 6.27 7.52 4.27 4.13 4.03 3.87 3.62 3.66 1.10 1.09 1.05 1.11 1.03 2.21 2.16 2.05 2.02 1.95 Sampling 99.983 99.956 99.927 99.895 99.862 99.827 99.949 99.861 99.772 99.688 99.607 99.495 99.984 99.970 99.955 99.932 99.918 99.966 99.938 99.914 99.891 99.869 Stop Cond. Other 0.002 0.014 0.035 0.009 0.018 0.054 0.031 0.074 0.046 0.092 0.062 0.111 0.010 0.041 0.103 0.036 0.074 0.154 0.121 0.191 0.174 0.220 0.243 0.262 0.013 0.003 0.006 0.024 0.010 0.035 0.016 0.052 0.021 0.061 0.004 0.030 0.054 0.008 0.013 0.073 0.018 0.091 0.108 0.023 Sample Size 110,705 28,601 13,114 7,614 5,034 3,668 81,507 21,315 9,975 5,840 3,905 2,810 66,882 30,236 17,676 10,589 7,923 32,469 14,747 8,760 5,672 4,076 Reduction w.r.t. RK 2.64 2.55 2.47 2.40 2.32 2.21 4.07 3.90 3.70 3.55 3.40 3.28 1.09 1.07 1.03 1.10 1.02 2.25 2.20 2.08 2.06 1.99 Absolute Error (×105) max 70.84 129.60 198.90 303.86 223.63 382.24 38.43 65.76 109.10 130.33 171.93 236.36 145.51 253.06 290.30 548.22 477.32 129.08 226.18 246.14 289.21 359.45 avg 0.35 0.69 0.97 1.22 1.41 1.58 0.58 1.15 1.63 2.15 2.52 2.86 0.48 0.71 0.93 1.21 1.38 1.72 2.49 3.17 3.89 4.45 stddev 1.14 2.22 3.17 4.31 5.24 6.37 1.60 3.13 4.51 6.12 7.43 8.70 2.46 3.62 4.83 6.48 7.34 3.40 5.00 6.39 7.97 9.53 Table 2: Runtime, speedup, breakdown of runtime, sample size, reduction, and absolute error Runtime breakdown The main challenge in designing a stopping condition for progressive sampling algorithm is striking the right balance between the strictness of the condition (i.e., it should stop early) and the efficiency in evaluating it. We now comment on the efficiency, and will report about the strictness in Sect. 6.2 and 6.3. In columns 6 to 8 of Table 2 we report the breakdown of the runtime into the main components. It is evident that evaluating the stopping condition amounts to an insignificant fraction of the runtime, and most of the time is spent in computing the samples (selection of nodes, execution of SP algorithm, update of the bc estimations). The amount in the "Other" column corresponds to time spent in logging and checking invariants. We can then say that our stopping condition is extremely efficient to evaluate, and ABRA-s is almost always doing "real" work to improve the estimation. 6.2 Sample Size and Sample Schedule We evaluate the final sample size of ABRA-s and the performances of the "automatic" sample schedule (Sect. 4.1.1). The results are reported in columns 9 and 10 of Table 2. As expected, the sample size grows with ε−2. We already commented on the fact that ABRA-s uses a sample size that is consistently (up to 4×) smaller than the one used by RK and how this is part of the reason why ABRA-s is much faster than RK. In Fig. 1 we show the behavior (on P2p-Gnutella31, figures for other graphs can be found in Appendix C) of the final sample size chosen by the automatic sample schedule in comparison with static geometric sample schedules, i.e., schedules for which the sample size at iteration i + 1 is c times the size of the sample size at iteration i. We can see that the automatic sample schedule is always better than the geometric ones, sometimes significantly depending on the value of c (e.g., more than 2× decrease w.r.t. using c = 3 for ε = 0.05). Effectively this means that the automatic sample schedule really frees the end user from having to selecting a parameter whose impact on the performances of the algorithm may be devastating (larger final sample size implies higher runtime). Moreover, we noticed that with the automatic sample schedule ABRA-s always terminated after just two iterations, while this was not the case for the geometric sample schedules (taking even 5 iterations in some cases): this means that effectively the automatic sample schedules "jumps" directly to a sample size for which the stopping condition will be verified. We can then sum up the results and say that the stopping condition of ABRA-s stops at small sample sizes, smaller than those used in RK 14 and the automatic sample schedule we designed is extremely efficient at choosing the right successive sample size, to the point that ABRA-s only needs two iterations. Figure 1: Final sample size for different sample schedules on P2p-Gnutella Figure 2: Absolute error evaluation – Soc-Epinions1 6.3 Accuracy We evaluate the accuracy of ABRA-s by measuring the absolute error eb(v) − b(v). The theoretical analysis guarantees that this quantity should be at most ε for all nodes, with probability at least 1 − δ. A first important result is that in all the thousands of runs of ABRA-s, the maximum error was always smaller than ε (not just with probability > 1 − δ). We report statistics about the absolute error in the three rightmost columns of Table 2 and in Fig. 2 (figures for the other graphs are in Appendix C. The minimum error (not reported) was always 0. The maximum error is an order of magnitude smaller than ε, and the average error is around three orders of magnitude smaller than ε, with a very small standard deviation. As expected, the error grows as ε−2. In Fig. 2 we show the behavior of the maximum, average, and average plus three standard deviations (approximately corresponding to the 95% percentile) for Soc-Epinions1 (the vertical axis has a logarithmic scale), to appreciate how most of the errors are almost two orders of magnitude smaller than ε. All these results show that ABRA-s is very accurate, more than what is guaranteed by the theoretical analysis. This can be explained by the fact that the bounds to the sampling size, the stopping condition, and the sample schedule are conservative, in the sense that we may be sampling more than necessary to obtain an (ε, δ)-approximation. Tightening any of these components would result in a less conservative algorithm that still offers the same approximation quality guarantees, and is an interesting research direction. 15 00.0050.010.0150.020.0250.030.0E+004.0E+048.0E+041.2E+051.6E+052.0E+05autoc=1.2c=1.5c=2c=3epsilonSample Size00.0050.010.0150.020.0250.031E-061E-051E-041E-031E-02maxavg+3stddevavgepsilonabsolute error 6.4 Dynamic BC Approximation We did not evaluate ABRA-d experimental, but, given its design, one can expect that, when compared to previous contributions offering the same quality guarantees [8, 21], it would exhibit similar or even larger speedups and reduction in the sample size than what ABRA-s had w.r.t. RK. Indeed, the algorithm by Bergamini and Meyerhenke [7] uses RK as a building block and it needs to constantly keep track of (an upper bound to) the vertex diameter of the graph, a very expensive operation. On the other hand, the analysis of the sample size by Hayashi et al. [21] uses very loose simultaneous deviation bounds (the union bound). As already shown by Riondato and Kornaropoulos [31], the resulting sample size is extremely large and they already showed how RK can use a smaller sample size. Since we built over the work by Hayashi et al. [21] and ABRA-s improves over RK, we can reasonably expect it to have much better performances than the algorithm by Hayashi et al. [21] 7 Conclusions We presented ABRA, a family of sampling-based algorithms for computing and maintaining high-quality approximations of (variants of) the bc of all vertices in a graph. Our algorithms can handle static and dynamic graphs with edge updates (both deletions and insertions). We discussed a number of variants of our basic algorithms, including finding the top-k nodes with higher bc, using improved estimators, and special cases when there is a single SP. ABRA greatly improves, theoretically and experimentally, the current state of the art. The analysis relies on Rademacher averages and on pseudodimension. To our knowledge this is the first application of these concepts to graph mining. In the future we plan to investigate stronger bounds to the Rademacher averages, give stricter bounds to the sample complexity of bc by studying the pseudodimension of the class of functions associated to it, and extend our study to other network measures. Acknowledgements. The authors are thankful to Elisabetta Bergamini and Christian Staudt for their help with the NetworKit code. This work was supported in part by NSF grant IIS-1247581 and NIH grant R01-CA180776. References [1] D. Anguita, A. Ghio, L. Oneto, and S. Ridella. A deep connection between the Vapnik-Chervonenkis entropy and the Rademacher complexity. IEEE Transactions on Neural Networks and Learning Systems, 25(12):2202–2211, 2014. [2] J. M. Anthonisse. The rush in a directed graph. Technical Report BN 9/71, Stichting Mathematisch Centrum, Amsterdam, Netherlands, 1971. [3] M. Anthony and P. L. Bartlett. Neural Network Learning - Theoretical Foundations. Cambridge Uni- versity Press, New York, NY, USA, 1999. ISBN 978-0-521-57353-5. [4] M. Anthony and J. Shawe-Taylor. A result of Vapnik with applications. Discrete Applied Mathematics, 47(3):207–217, 1993. [5] D. A. Bader, S. Kintali, K. Madduri, and M. Mihail. Approximating betweenness centrality. In A. Bonato and F. Chung, editors, Algorithms and Models for the Web-Graph, volume 4863 of Lecture Notes in Computer Science, pages 124–137. Springer Berlin Heidelberg, 2007. ISBN 978-3-540-77003-9. doi: 10.1007/978-3-540-77004-6_10. [6] P. L. Bartlett and G. Lugosi. An inequality for uniform deviations of sample averages from their means. Statistics & Probability Letters, 44(1):55–62, 1999. 16 [7] E. Bergamini and H. Meyerhenke. Fully-dynamic approximation of betweenness centrality. CoRR, abs/1504.0709 (to appear in ESA'15), Apr. 2015. [8] E. Bergamini and H. Meyerhenke. Approximating betweenness centrality in fully-dynamic networks. CoRR, abs/1510.07971, Oct 2015. URL http://arxiv.org/abs/1510.07971. [9] E. Bergamini, H. Meyerhenke, and C. L. Staudt. Approximating betweenness centrality in large evolving networks. In 17th Workshop on Algorithm Engineering and Experiments, ALENEX 2015, pages 133–146. SIAM, 2015. [10] S. Boucheron, O. Bousquet, and G. Lugosi. Theory of classification : A survey of some recent advances. ESAIM: Probability and Statistics, 9:323–375, 2005. [11] S. Boyd and L. Vandenberghe. Convex optimization. Cambridge university press, 2004. [12] U. Brandes. A faster algorithm for betweenness centrality. J. Math. Sociol., 25(2):163–177, 2001. doi: 10.1080/0022250X.2001.9990249. [13] U. Brandes and C. Pich. Centrality estimation in large networks. Int. J. Bifurcation and Chaos, 17(7): 2303–2318, 2007. doi: 10.1142/S0218127407018403. [14] C. Cortes, S. Greenberg, and M. Mohri. Relative deviation learning bounds and generalization with unbounded loss functions. CoRR, abs/1310.5796, Oct 2013. URL http://arxiv.org/abs/1310.5796. [15] D. Erdős, V. Ishakian, A. Bestavros, and E. Terzi. A divide-and-conquer algorithm for betweenness centrality. In SIAM Data Mining Conf., 2015. [16] L. C. Freeman. A set of measures of centrality based on betweenness. Sociometry, 40:35–41, 1977. [17] R. Geisberger, P. Sanders, and D. Schultes. Better approximation of betweenness centrality. In J. I. Munro and D. Wagner, editors, Algorithm Eng. & Experiments (ALENEX'08), pages 90–100. SIAM, 2008. [18] O. Green, R. McColl, and D. Bader. A fast algorithm for streaming betweenness centrality. In Privacy, Security, Risk and Trust (PASSAT), 2012 International Conference on and 2012 International Confer- nece on Social Computing (SocialCom), pages 11–20, sep 2012. doi: 10.1109/SocialCom-PASSAT.2012. 37. [19] S. Har-Peled and M. Sharir. Relative (p, ε)-approximations in geometry. Discrete & Computational Geometry, 45(3):462–496, 2011. ISSN 0179-5376. doi: 10.1007/s00454-010-9248-1. [20] D. Haussler. Decision theoretic generalizations of the PAC model for neural net and other learning applications. Information and Computation, 100(1):78–150, 1992. ISSN 0890-5401. [21] T. Hayashi, T. Akiba, and Y. Yoshida. Fully dynamic betweenness centrality maintenance on massive networks. Proceedings of the VLDB Endowment, 9(2), 2015. [22] M. Kas, M. Wachs, K. M. Carley, and L. R. Carley. Incremental algorithm for updating between- ness centrality in dynamically growing networks. In Proceedings of the 2013 IEEE/ACM Interna- tional Conference on Advances in Social Networks Analysis and Mining, ASONAM '13, pages 33–40, New York, NY, USA, 2013. ACM. ISBN 978-1-4503-2240-9. doi: 10.1145/2492517.2492533. URL http://doi.acm.org/10.1145/2492517.2492533. [23] N. Kourtellis, G. D. F. Morales, and F. Bonchi. Scalable online betweenness centrality in evolving graphs. IEEE Trans. Knowl. Data Eng., 27(9):2494–2506, 2015. doi: 10.1109/TKDE.2015.2419666. 17 [24] M.-J. Lee, J. Lee, J. Y. Park, R. H. Choi, and C.-W. Chung. QUBE: A quick algorithm for updating betweenness centrality. In Proceedings of the 21st International Conference on World Wide Web, WWW '12, pages 351–360, New York, NY, USA, 2012. ACM. ISBN 978-1-4503-1229-5. doi: 10.1145/2187836. 2187884. [25] J. Leskovec and A. Krevl. SNAP Datasets: Stanford large network dataset collection. http://snap. stanford.edu/data, June 2014. [26] Y. Li, P. M. Long, and A. Srinivasan. Improved bounds on the sample complexity of learning. J. Comp. Sys. Sci., 62(3):516–527, 2001. ISSN 0022-0000. doi: 10.1006/jcss.2000.1741. [27] M. Löffler and J. M. Phillips. Shape fitting on point sets with probability distributions. In A. Fiat and P. Sanders, editors, Algorithms - ESA 2009, volume 5757 of Lecture Notes in Computer Science, pages 313–324. Springer Berlin Heidelberg, 2009. doi: 10.1007/978-3-642-04128-0_29. [28] M. E. J. Newman. Networks – An Introduction. Oxford University Press, 2010. [29] L. Oneto, A. Ghio, D. Anguita, and S. Ridella. An improved analysis of the Rademacher data-dependent bound using its self bounding property. Neural Networks, 44:107–111, 2013. [30] D. Pollard. Convergence of stochastic processes. Springer-Verlag, 1984. [31] M. Riondato and E. M. Kornaropoulos. Fast approximation of betweenness centrality through doi: sampling. Data Mining and Knowledge Discovery, 30(2):438–475, 2015. 10.1007/s10618-015-0423-0. URL http://dx.doi.org/10.1007/s10618-015-0423-0. ISSN 1573-756X. [32] M. Riondato and E. Upfal. Mining frequent itemsets through progressive sampling with Rademacher averages. In Proc. 21st ACM SIGKDD Int. Conf. Knowl. Disc. and Data Mining, 2015. URL http:// matteo.rionda.to/papers/RiondatoUpfal-FrequentItemsetsSamplingRademacher-KDD.pdf. Ex- tended Version. [33] A. E. Sarıyüce, E. Saule, K. Kaya, and U. V. Çatalyürek. Shattering and compressing networks for betweenness centrality. In SIAM Data Mining Conf., 2013. [34] S. Shalev-Shwartz and S. Ben-David. Understanding Machine Learning: From Theory to Algorithms. Cambridge University Press, 2014. [35] C. Staudt, A. Sazonovs, and H. Meyerhenke. NetworKit: An interactive tool suite for high-performance network analysis. CoRR, abs/1403.3005, March 2014. [36] V. N. Vapnik. The Nature of Statistical Learning Theory. Statistics for engineering and information science. Springer-Verlag, New York, NY, USA, 1999. ISBN 9780387987804. A Relative-error Top-k Approximation In this section we prove the correctness of the algorithm ABRA-k (Thm. 6). The pseudocode can be found in Algorithm 2. of Thm. 6. With probability at least 1− δ0, the set B0 computed during the first phase (execution of ABRA- s) has the properties . . . . With probability at least 1 − δ00, the set B00 computed during the second phase (execution of ABRA-s) has the properties from Thm. 5. Suppose both these events occur, which happens with probability at least 1 − δ. Consider the value '0. It is straightforward to check that '0 is a lower bound to bk: indeed there must be at least k nodes with exact bc at least '0. For the same reasons, and considering the fact that we run ABRA-r with parameters ε, δ00, and λ = '0, we have that '00 ≤ bk. From this and the definition of (cid:93)TOP(k, G), it follows that the elements of (cid:93)TOP(k, G) are such that their exact may be greater 18 than '00, and therefore of bk. This means that TOP(k, G) ⊆ (cid:93)T OP(k, G). The other properties of (cid:93)T OP(k, G) follow from the properties of the output of ABRA-r. 1 δ0, δ00 ← reals such that (1 − δ1)(1 − δ2) ≥ 1 − δ Algorithm 2: ABRA-k: relative-error approximation of top-k bc nodes on static graph input : Graph G = (V, E), accuracy parameter ε ∈ (0, 1), confidence parameter δ ∈ (0, 1), value k ≥ 1 output: Set eB of approximations of the bc of the top-k vertices in V with highest bc 2 eB0 ← output of ABRA-s run with input G, ε, δ0 3 '0 ← k-th highest value in eB0 5 eB ← output of a variant of ABRA-s using the definition of ∆i from (14), and input G, ε, δ00,b0 6 return eB 4 b0 = '0 − ε B Special Cases In this section we expand on our discussion from Sect. 4.3. Since our results rely on pseudodimension [30], we start with a presentation of the fundamental definitions and results about pseudodimension. B.1 Pseudodimension Before introducing the pseudodimension, we must recall some notions and results about the Vapnik-Chervonenkis (VC) dimension. We refer the reader to the books by Shalev-Shwartz and Ben-David [34] and by Anthony and Bartlett [3] for an in-depth exposition of VC-dimension and pseudodimension. Let D be a domain and let R be a collection of subsets of D (R ⊆ 2D). We call R a rangeset on D. Given A ⊆ D, the projection of R on A is PR(A) = {R ∩ A : R ∈ R}. When PR(A) = 2A, we say that A is shattered by R. Given B ⊆ D, the empirical VC-dimension of R, denoted as EVC(R, B) is the size of the largest subset of B that can be shattered. The VC-dimension of R, denoted as VC(R) is defined as VC(R) = EVC(R, D). Let F be a class of functions from some domain D to [0, 1]. Consider, for each f ∈ F, the subset Rf of D × [0, 1] defined as Rf = {(x, t) : t ≤ f(x)} . We define a rangeset F + on D × [0, 1] as F + = {Rf , f ∈ F}. The empirical pseudodimension [30] of F on a subset B ⊆ D, denoted as EPD(F, B), is the empirical VC-dimension of F +: EPD(F, B) = EVC(F +, B). The pseudodimension of F, denoted as PD(F) is the VC-dimension of F +, PD(F) = VC(F +) [3, Sect. 11.2]. Having an upper bound to the pseudodimension of F allows to bound the supremum of the deviations from (2), as stated in the following result. Theorem 9 ([26], see also [19]). Let D be a domain and F be a family of functions from D to [0, 1]. Let PD(F) ≤ d. Given ε, δ ∈ (0, 1), let S be a collection of elements sampled independently and uniformly at random from D, with size (cid:18) (cid:19) S = c ε2 d + log 1 δ . (15) Then Pr (∃f ∈ F s.t. mD(f) − mS(f) > ε) < δ . The constant c is universal and it is less than 0.5 [27]. The following two technical lemmas are, to the best of our knowledge, new. We use them later to bound the pseudodimension of a family of functions related to betweenness centrality. 19 Lemma 1. Let B ⊆ D × [0, 1] be a set that is shattered by F +. Then B can contain at most one element (d, x) ∈ D × [0, 1] for each d ∈ D. Proof. Let d ∈ D and consider any two distinct values x1, x2 ∈ [0, 1]. Let, w.l.o.g., x1 < x2 and let B = {(τ, x1), (τ, x2)}. From the definitions of the ranges, there is no R ∈ F + such that R ∩ B = {(d, x1)}, therefore B can not be shattered, and so neither can any of its supersets, hence the thesis. Lemma 2. Let B ⊆ D × [0, 1] be a set that is shattered by F +. Then B does not contain any element in the form (d, 0), for any d ∈ D. Proof. For any d ∈ D, (d, 0) is contained in every R ∈ F+, hence given a set B = {(d, 0)} it is impossible to find a range R∅ such that B ∩ R∅ = ∅, therefore B can not be shattered, nor can any of its supersets, hence the thesis. B.2 Pseudodimension for BC We now move to proving the results in Sect. 4.3. Let G = (V, E) be a graph, and consider the family F = {fw, w ∈ V } where fw goes from D = {(u, v) ∈ V × V, u 6= v} to [0, 1] and is defined in (9). The rangeset F + contains one range Rw for each node w ∈ V . The set Rw ⊆ D×[0, 1] contains pairs in the form ((u, v), x), with (u, v) ∈ D and x ∈ [0, 1]. The pairs ((u, v), x) ∈ Rw with x > 0 are all and only the pairs with this form such that 1. w is on a SP from u to v; and 2. x ≤ σuv(w)/σuv. We now prove a result showing that some subsets of D × [0, 1] can not be shattered by F +, on any graph G. Thm. 7 follows immediately from this result, and Corollary 1 then follows from Thms. 7 and 9. Lemma 3. There exists no undirected graph G = (V, E) such that it is possible to shatter a set if there are at least three distinct values j0, j00, j000 ∈ [1, 4] for which B = {((ui, vi), xi), 1 ≤ i ≤ 4} ⊆ D × [0, 1] σuj0 vj0 = σuj00 vj00 = σuj000 vj000 = 1 . Proof. First of all, according to Lemmas 1 and 2, for B to be shattered it must be (ui, vi) 6= (uj, vj) for i 6= j and xi ∈ (0, 1], 1 ≤ i ≤ 4. such that it is possible to shatter B if Riondato and Kornaropoulos [31, Lemma 2] showed that there exists no undirected graph G = (V, E) σu1v1 = σu2v2 = σu3v3 = σu4v4 = 1 . Hence, what we need to show to prove the thesis is that it is impossible to build an undirected graph G = (V, E) such that F + can shatter B when the elements of B are such that and σu4v4 = 2. Assume now that such a graph G exists and therefore B is shattered by F +. σu1v1 = σu2v2 = σu3v3 = 1 20 For 1 ≤ i ≤ 3, let pi be the unique SP from ui to vi, and let p0 First of all, notice that if any two of p1, p2, p3 meet at a node a and separate at a node b, then they can not meet again at any node before a or after b, as otherwise there would be multiple SPs between their extreme nodes, contradicting the hypothesis. Let this fact be denoted as F1. 4 be the two SPs from u4 to v4. 4 and p00 Since B is shattered, its subset A = {((ui, vi), xi1 ≤ i ≤ 3} ⊂ B is also shattered, and in particular it can be shattered by a collection of ranges that is a subset of a collection of ranges that shatters B. We now show some facts about the properties of this shattering which we will use later in the proof. Define i+ = (cid:26) i + 1 (cid:26) 3 1 i − 1 if i = 1, 2 if i = 3 if i = 1 if i = 2, 3 . and i− = Let vA be a node such that RvA ∩ A = A. For any i, 1 ≤ i ≤ 3, let vi,i+ be the node such that Rvi,i+ ∩ A = {(ui, vi), (ui+, vi+} . Analogously, let vi,i− be the node such that Rvi,i− ∩ A = {(ui, vi), (ui− , vi−} . We want to show that vA is on the SP connecting vi,i+ to vi,i−. Assume it was not. Then we would have that either vi,i+ is between vA and vi,i− or vi,i− is between vA and vi,i+. Assume it was the former (the latter follows by symmetry). Then 1. there must be a SP p0 from ui− to vi+ that goes through vi,i−; 2. there must be a SP p00 from ui− to vi+ that goes through vA; 3. there is no SP from ui− to vi+ that goes through vi,i+. Since there is only one SP from ui− to vi−, it must be that p0 = p00. But then p0 is a SP that goes through vi,i− and through vA but not through vi,i+, and pi is a SP that goes through vi,i−, through vi,i+ and through vA (either in this order or in the opposite). This means that there are at least two SPs between vi,i− and vA, and therefore there would be two SPs between ui and vi, contradicting the hypothesis that there is only one SP between these nodes. Hence it must be that vA is between vi,i− and vi,i+. This is true for all i, 1 ≤ i ≤ 3. Denote this fact as F2. and v4. Consider now the nodes vi,4 and vj,4. We now show that they can not belong to the same SP from u4 • Assume that vi,4 and vj,4 are on the same SP p from u4 to v4 and assume that vi,j,4 is also on p. Consider the possible orderings of vi,4, vj,4 and vi,j,4 along p. – If the ordering is vi,4, then vj,4, then vi,j,4 or vj,4, then vj,4, then vi,j,4, or the reverses of these orderings (for a total of four orderings), then it is easy to see that fact F1 would be contradicted, as there are two different SPs from the first of these nodes to the last, one that goes through the middle one, and one that does not, but then there would be two SPs between the pair of nodes (uk, vk) where k is the index in {1, 2, 3} different than 4 that is in common between the first and the last nodes in this ordering, and this would contradict the hypothesis, so these orderings are not possible. 21 – Assume instead the ordering is such that vi,j,4 is between vi,4 and vj,4 (two such ordering exist). Consider the paths pi and pj. They must meet at some node vfi,j and separate at some node vli,j. From the ordering, and fact F1, vi,j,4 must be between these two nodes. From fact F2 we have that also vA must be between these two nodes. Moreover, neither vi,4 nor vj,4 can be between these two nodes. But then consider the SP p. This path must go together with pi (resp. pj) from at least pi,4 (resp. pj,4) to the farthest between vfi,j and vli,j from pi,4 (resp. pj,4). Then in particular p goes through all nodes between vfi,j and vli,j that pi and pj go through. But since vA is among these nodes,and vA can not belong to p, this is impossible, so these orderings of the nodes vi,4, vj,4, and vi,j,4 are not possible. Hence we showed that vi,4, vj,4, and vi,j,4 can not be on the same SP from u4 to v4. • Assume now that vi,4 and vj,4 are on the same SP from u4 to v4 but vi,j,4 is on the other SP from u4 to v4 (by hypothesis there are only two SPs from u4 to v4). Since what we prove in the previous point must be true for all choices of i and j, we have that all nodes vh,4, 1 ≤ h ≤ 3, must be on the same SP from u4 to v4, and all nodes in the form vi,j,4, 1 ≤ i < j ≤ 3 must be on the other SP from u4 to v4. Consider now these three nodes, v1,2,4, v1,3,4, and v2,3,4 and consider their ordering along the SP from u4 to v4 that they lay on. No matter what the ordering is, there is an index h ∈ {1, 2, 3} such that the shortest path ph must go through the extreme two nodes in the ordering but not through the middle one. But this would contradict fact F1, so it is impossible that we have vi,4 and vj,4 on the same SP from u4 to v4 but vi,j,4 is on the other SP, for any choice of i and j. We showed that the nodes vi,4 and vj,4 can not be on the same SP from u4 to v4. But this is true for any choice of the unordered pair (i, j) and there are three such choices, but only two SPs from u4 to v4, so it is impossible to accommodate all the constraints requiring vi,4 and vj,4 to be on different SPs from u4 to v4. Hence we reach a contradiction and B can not be shattered. The following lemma shows that the bound in Lemma 3 is tight. Lemma 4. There is an undirected graph G = (V, E) such that there is a set {(ui, vi), ui, vi ∈ V, ui 6= vi, 1 ≤ i ≤ 4} with Su1,v1 = Su2,v2 = 2 and Su3,v3 = Su4,v4 = 1 that is shattered. Proof. Consider the undirected graph G = (V, E) in Fig. 3. There is a single SP from 0 to 16: There is a single SP from 23 to 17: 0, 1, 2, 22, 21, 35, 20, 19, 18, 15, 16 . 23, 24, 25, 26, 27, 36, 20, 19, 18, 15, 17 . There are exactly two SPs from 5 to 33: 5, 4, 3, 2, 22, 26, 25, 28, 39, 33 and 5, 6, 7, 18, 18, 29, 30, 32, 40, 33 . There are exactly two SPs from 11 to 34: 11, 10, 9, 8, 21, 22, 26, 27, 37, 34 and 11, 12, 13, 14, 15, 18, 29, 31, 38, 34 . Let a = ((0, 16), 1), b = ((23, 17), 1), c = ((5, 33), 1/2), and d = ((11, 34), 1/2). We can shatter the set Q = {a, b, c, d}, as shown in Table 3. We pose the following conjecture, which would allow us to generalize Lemma 3, and develop an additional stopping rule for ABRA-s based on the empirical pseudodimension. 22 23 24 25 28 39 33 26 27 36 20 35 21 22 37 34 19 38 31 18 7 6 40 32 30 29 8 9 0 1 2 3 4 5 10 Figure 3: Graph for Lemma 4 17 16 15 14 13 12 11 Conjecture 1. Given n > 0, there exists no undirected graph G = (V, E) such that it is possible to shatter a set B = {((ui, vi), xi), 1 ≤ i ≤ n} ⊆ D × [0, 1] if (cid:18) n (cid:19) σuivi < bn/2c . nX i=1 C Additional Experimental Results In this section we show additional experimental results, mostly limited to additional figures like Figs. 1 and 2 but for other graphs. The figures we present here exhibits the exact same behavior as those in Sect. 6, and that is why we did not include include them in the main text. Figures corresponding to Fig. 1 are shown in Fig. 4 and those corresponding to Fig. 2 are shown in Fig. 5. (a) Email-Enron (b) Soc-Epinions1 (c) Cit-HepPh Figure 4: Final sample size for different sample schedules 23 00.0050.010.0150.020.0250.030E+001E+052E+053E+054E+055E+056E+05autoc=1.2c=1.5c=2c=3epsilonSample Size00.0050.010.0150.020.0250.030.0E+004.0E+048.0E+041.2E+051.6E+052.0E+05autoc=1.2c=1.5c=2c=3epsilonSample Size00.0050.010.0150.020.0250.030.0E+004.0E+048.0E+041.2E+051.6E+052.0E+05autoc=1.2c=1.5c=2c=3epsilonSample Size P ⊆ Q ∅ {a} {b} {c} {d} {a, b} {a, c} {a, d} {b, c} {b, d} {c, d} {a, b, c} {a, b, d} {a, c, d} {b, c, d} {a, b, c, d} Vertex v such that P = Q ∩ Rv 0 1 24 40 38 20 2 21 25 27 29 19 15 22 26 18 Table 3: How to shatter Q = {a, b, c, d} from Lemma 4. (a) Email-Enron (b) Soc-Epinions1 (c) Cit-HepPh Figure 5: Absolute error evaluation D Relative-error Rademacher Averages In this note we show how to obtain relative (p, ε)-approximations as defined by Har-Peled and Sharir [19] (see Def. 3) using a relative-error variant of the Rademacher averages. D.1 Definitions Let D be some domain, and F be a family of functions from D to [a, b], an interval of the non-negative reals.3 Assume that π is a probability distribution on D. For any f ∈ F, let Eπ[f] be the expected value of f w.r.t. π. Let A = {a1, . . . , an} be a collection of n elements of D. For any f ∈ F, let nX i=1 f(A) = 1 n f(ai) . Definition 3 ([19]). Given p ∈ (0, 1) and ε ∈ (0, 1), a relative (p, ε)-approximation for F is a collection A 3We conjecture that the restriction to the non-negative reals can be easily removed. 24 0.0000.0050.0100.0150.0200.0250.0301E-061E-051E-041E-031E-02maxavg+3stddevavgepsilonabsolute error00.0050.010.0150.020.0250.031E-061E-051E-041E-031E-02maxavg+3stddevavgepsilonabsolute error0.0000.0050.0100.0150.0200.0250.0301E-061E-051E-041E-031E-02maxavg+stddevavgepsilonabsolute error of elements of Z such that Eπ[f] − f(A) max{p, Eπ[f]} ≤ ε . sup f∈F (16) Fixed-sample bound Har-Peled and Sharir [19] showed that, when the functions of F only take values in {0, 1} and F has finite VC-dimension, then a sufficiently large collection S of n elements of D sampled independently according to π is a relative (p, ε)-approximation for F with probability at least 1 − δ, for δ ∈ (0, 1). Theorem 10 (Thm. 2.11 [19]). Let F be a family of functions from D to {0, 1}, and let d be the VC- dimension of F. Given p, ε, δ ∈ (0, 1), let and let S be a collection of n elements of D sampled independently according to π. Then, , (17) (cid:18) 1 ε2p (cid:18) d log 1 p (cid:19)(cid:19) + ln 1 ! δ n = O Pr Eπ[f] − f(A) max{p, Eπ[f]} > ε sup f∈F < δ, or, in other words, S is a relative (p, ε)-approximation for F with probability at least 1 − δ. Related works The bound in (17) is an extension of a result by Li et al. [26] obtained for families of real-valued functions taking values in [0, 1], and using the pseudodimension of the family instead of the VC-dimension. The original result by Li et al. [26] shows how large should S be in order for the quantity Eπ[f] − f(S) Eπ[f] + f(S) + p sup f∈F (18) to be at most ε with probability at least 1−δ. Some constant factors are lost in the adaptation of the measure from (18) to the one on the l.h.s. of (16). The quantity in (18) has been studied often in the literature of statistical learning theory, see for example [3, Sect. 5.5], [10, Sect. 5.1], and [20], while other works (e.g., [10, Sect. 5.1], [14], [4], and [6]) focused on the quantity Eπ[f] − f(S) pEπ[f] . sup f∈F D.2 Obtaining a relative (p, ε)-approximation In this note we study how to bound the quantity on the l.h.s. of (16) directly, without going through the quantity in (18). By following the same steps as [19, Thm. 2.9(ii)], we can extend our results to the quantity in (18). The advantage of tackling the problem directly is that we can derive sample-dependent bounds with explicit constants. Moreover, the use of (a variant of) Rademacher averages allows us to obtain stricter bounds to the sample size. Let S = {X1, . . . , Xn} be a collection of n elements from D sampled independently according to π. Let σ1, . . . , σn be independent Rademacher random variables σ1, . . . , σn, independent from the samples. Consider now the random variable " rR(F,S, p) = Eσ 1 n max{p, Eπ[f]} sup f∈F # σif(Xi) , nX i=1 which we call the conditional p-relative Rademacher average of F on S. We have the following result connecting this quantity to the (p, ε) approximation condition. 25 Theorem 11. Let S be a collection of n elements of D sampled independently according to π. With probability at least 1 − δ, Eπ[f] − f(S) max{p, Eπ[f]} ≤ 2rR(S,F, p) + 3b − a p sup f∈F rln(2/δ) . n The proof of Thm. 11 follows step by step the proof of Thm. 1 ([34, Thm. 26.4]), with the only important difference that we need to show that the quantities Eπ[f] − f(S) max{p, Eπ[f]} sup f∈F and rR(F,S, p), seen as functions of S = {X1, . . . , Xn}, satisfy the bounded difference inequality. Definition 4 (Bounded difference inequality). Let g : X n → R be a function of n variables. The function g is said to satisfy the bounded difference inequality iff for each i, 1 ≤ i ≤ n there is a nonnegative constant ci such that: g(x1, . . . , xn) − g(x1, . . . , xi−1, x0 i, xi+1, . . . , xn) ≤ ci . (19) sup x1,...,xn i∈X x0 We have the following results, showing that indeed the quantities above satisfy the bounded difference inequality. Lemma 5. The function g(X1, . . . , Xn) = sup f∈F Eπ[f] − f(S) max{p, Eπ[f]} satisfies the bounded difference inequality (19) with constants ci = b − a . np of Lemma 5. Let S = {X1, . . . , Xn} and, for any i, 1 ≤ i ≤ n, let i, Xi+1, . . . , Xn}, i.e., we replaced the random variable Xi with another random variable X0 to the same distribution. For any function f ∈ F let S0 i = {X1, . . . , Xi−1, X0 i, sampled independently according It is easy to see that We have φf(S) = Eπ[f] − f(S) max{p, Eπ[f]} . i) ≤ b − a np φf(S) − φf(S0 g(X1, . . . , Xn) − g(X1, . . . , Xi−1, X0 g(S0 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)sup f∈F i) − g(S) = φf(S0 i) − sup f∈F φf(S) . (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i, Xi+1, . . . , Xn) = (20) (21) To simplify the notation, let now ' ∈ F denote one of the functions for which the supremum is attained on S0 i, and let h ∈ F be on of the functions for which the supremum is attained on S. Then we can rewrite (21) as φ'(S0 i) − φh(S) . 26 Assume w.l.o.g. that φh(S) ≤ φ'(S0 i), (22) (the other case follows by symmetry). We have (23) because h attains the supremum over all possible f ∈ F on X1, . . . , Xn. This and our assumption (22) imply that it must be φ'(S) ≤ φh(S) From this and (20) we have Then from this and from (23) we have φ'(S0 i) − φh(S) ≤ (cid:18) φ'(S0 φ'(S) ≤ φ'(S0 i) . i) ≤ φ'(S) + b − a (cid:19) φ'(S) + b − a np np . − φ'(S) ≤ b − a . np Using the same steps as the above proof, we can prove the following result about the conditional p-relative Rademacher average. Lemma 6. The function g(X1, . . . , Xn) = rR({X1, . . . , Xn},F, p) satisfies the bounded difference inequality (19) with constants ci = b − a . np The following result is the analogous of Thm. 3 ([32, Thm. 3]) for the conditional p-relative Rademacher averages. Theorem 12. Let wr : R+ → R+ be the function s where k · k denotes the Euclidean norm. Then wr(s) = 1 exp(s2kvk2/p(2'2)), ln X v∈VS rR(F,S, p) ≤ min s∈R+ wr(s) . (24) (25) The proof follows the same steps as the one for [32, Thm. 3], with the additional initial observation that rR(S,F, p) ≤ 1 p R(S,F) . 27
1906.12298
2
1906
2019-10-31T19:35:22
Detecting Feedback Vertex Sets of Size $k$ in $O^\star(2.7^k)$ Time
[ "cs.DS" ]
In the Feedback Vertex Set problem, one is given an undirected graph $G$ and an integer $k$, and one needs to determine whether there exists a set of $k$ vertices that intersects all cycles of $G$ (a so-called feedback vertex set). Feedback Vertex Set is one of the most central problems in parameterized complexity: It served as an excellent test bed for many important algorithmic techniques in the field such as Iterative Compression~[Guo et al. (JCSS'06)], Randomized Branching~[Becker et al. (J. Artif. Intell. Res'00)] and Cut\&Count~[Cygan et al. (FOCS'11)]. In particular, there has been a long race for the smallest dependence $f(k)$ in run times of the type $O^\star(f(k))$, where the $O^\star$ notation omits factors polynomial in $n$. This race seemed to be run in 2011, when a randomized algorithm $O^\star(3^k)$ time algorithm based on Cut\&Count was introduced. In this work, we show the contrary and give a $O^\star(2.7^k)$ time randomized algorithm. Our algorithm combines all mentioned techniques with substantial new ideas: First, we show that, given a feedback vertex set of size $k$ of bounded average degree, a tree decomposition of width $(1-\Omega(1))k$ can be found in polynomial time. Second, we give a randomized branching strategy inspired by the one from~[Becker et al. (J. Artif. Intell. Res'00)] to reduce to the aforementioned bounded average degree setting. Third, we obtain significant run time improvements by employing fast matrix multiplication.
cs.DS
cs
Detecting Feedback Vertex Sets of Size k in O⋆(2.7k) Time Jason Li∗ Jesper Nederlof† November 4, 2019 Abstract In the Feedback Vertex Set problem, one is given an undirected graph G and an integer k, and one needs to determine whether there exists a set of k vertices that intersects all cycles of G (a so- called feedback vertex set). Feedback Vertex Set is one of the most central problems in parameterized complexity: It served as an excellent test bed for many important algorithmic techniques in the field such as Iterative Compression [Guo et al. (JCSS'06)], Randomized Branching [Becker et al. (J. Artif. Intell. Res'00)] and Cut&Count [Cygan et al. (FOCS'11)]. In particular, there has been a long race for the smallest dependence f (k) in run times of the type O⋆(f (k)), where the O⋆ notation omits factors polynomial in n. This race seemed to be run in 2011, when a randomized O⋆(3k) time algorithm based on Cut&Count was introduced. In this work, we show the contrary and give a O⋆(2.7k) time randomized algorithm. Our algorithm combines all mentioned techniques with substantial new ideas: First, we show that, given a feedback vertex set of size k of bounded average degree, a tree decomposition of width (1 − Ω(1))k can be found in polynomial time. Second, we give a randomized branching strategy inspired by the one from [Becker et al. (J. Artif. Intell. Res'00)] to reduce to the aforementioned bounded average degree setting. Third, we obtain significant run time improvements by employing fast matrix multiplication. 9 1 0 2 t c O 1 3 ] S D . s c [ 2 v 8 9 2 2 1 . 6 0 9 1 : v i X r a ∗Carnegie Mellon University, [email protected]. †Eindhoven University of Technology, [email protected]. Supported by the Netherlands Organization for Scientific Re- search (NWO) under project no. 639.021.438 and 024.002.003. and the European Research Council under project no. 617951. 1 1 Introduction Feedback Vertex Set (FVS) is one of the most fundamental NP-complete problems; for example, it was among Karp's original 21 problems [Kar72]. In FVS we are given an undirected graph G and integer k, and are asked whether there exists a set F such that G[V \ F ] is a forest (i.e. F intersects all cycles of G). In the realm of parameterized complexity, where we aim for algorithms with running times of the type O⋆(f (k))1 with f (k) as small as possible (albeit exponential), FVS is clearly one of the most central problems: To quote [Cao18], to date the number of parameterized algorithms for FVS published in the literature exceeds the number of parameterized algorithms for any other single problem. There are several reasons why FVS is the one of the most central problem in parameterized complexity: First and foremost, the main point of parameterized complexity, being that in many instance the parame- ter k is small, is very applicable for FVS: In the instances arising from e.g. resolving deadlocks in systems of processors [BGNR98], or from Bayesian inference or constraint satisfaction, one is only interested in whether small FVS's exist [BBG00, Dec90, WLS85]. Second, FVS is a very natural graph modification problems (remove/add few vertices/edges to make the graph satisfy a certain property) that serves as excel- lent starting point for many other graph modification problems such a planarization or treewidth-deletion (see e.g. [GLL+18] for a recent overview). Third, FVS and many of its variants (see e.g. [KK18]) admit elegant duality theorems such as the Erdos-P´osa property; understanding their use in designing algorithms can be instrumental to solve many problems different from FVS faster. The popularity of FVS also led to work on a broad spectrum of its variations such as Subset, Group, Connected, Simultaneous, or Independent FVS (see for example [AGSS16] and the references therein). In this paper we study the most basic setting concerning the parameterized complexity of FVS, and aim to design an algorithm with runtime O⋆(f (k)) with f (k) as small as possible. One motivation for this study is that we want to get a better insight into the fine-grained complexity of computational problems: How hard is FVS really to solve in the worst-case setting? Can the current algorithms still be improved significantly or are they close to some computational barrier implied by some hypothesis or conjecture such as, for example, the Strong Exponential Time Hypothesis? A second motivation is that, lowering the exponential factor f (k) of the running time is a logical first step towards more practical algorithms. For example, the vertex cover problem2 can be solved in O(1.28k + kn) time [CKX10], and a similar running time for FVS would be entirely consistent with our current knowl- edge. Algorithms with such run times likely outperform other algorithms for a wide variety of instances from practice. Note there already has been considerable interest in practical algorithms for FVS as it was the subject of the first Parameterized Algorithms and Computational Experiments Challenge (PACE, see e.g. [DHJ+16]). For a third motivation of such a study, experience shows an improvement of the running time algorithms for well-studied benchmark problems as FVS naturally goes hand in hand with important new algorithmic tools: The 'race' for the fastest algorithm for FVS and its variants gave rise to important techniques in parameterized complexity such as Iterative Compression [DFL+07, GGH+06, RSV04], Randomized Branch- ing [BBG00] and Cut&Count [CNP+11]. The race for the fastest FVS algorithm. The aforementioned 'race' (see Figure 1) started in the early days of parameterized complexity (see e.g [AEFM89]) with an O⋆((2k + 1)k) time deterministic algorithm by Downey and Fellows [DF92]. We briefly discuss four relevant results from this race. A substantial improvement of the algorithm from [DF92] to an O⋆(4k) time randomized algorithm was obtained by Becker et al. [BBG00]. Their simple but powerful idea is to argue that, if some simple reduction rules do not apply, a random 'probabilistic branching' procedure works well. A few years later, in [DFL+07, GGH+06] it was shown how to obtain O⋆(10.6k) time in the deterministic regime using Iterative Compression. This technique allows the algorithm to assume a feedback vertex set of size k + 1 is given, which turns out to be useful for detecting feedback vertex sets of size k. The race however stagnated with the paper that introduced the Cut&Count 1The O⋆() notation omits factors polynomial in n. 2Given a graph G and integer k, find k vertices of G that intersect every edge of G. 2 Reference Downey and Fellows [DF92] Bodlaender [Bod94] Becker et al. [BBG00] Raman et al. [RSS02] Kanj et al. [KPS04] Raman et al. [RSS06] Guo et al. [GGH+06] Dehne et al. [DFL+07] Chen et al. [CFL+08] Cao et al. [CCL15] Cygan et al. [CNP+11] Kociumaka and Pilipczuk [KP14] O⋆(3.62k) this paper Running Time O⋆((2k + 1)k) O⋆(17(k4)!) O⋆(4k) O⋆(12k + (4 log k)k) O⋆((2 log k + 2 log log k + 18)k) O⋆((12 log k/ log log k + 6)k) O⋆(37.7k) O⋆(10.6k) O⋆(5k) O⋆(3.83k) O⋆(3k) O⋆(2.7k), or O⋆(2.6252k) if ω = 2 Deterministic? Year 1992 YES 1994 YES NO 2000 2002 2004 2006 2006 2007 2008 2010 NO 2011 2014 NO 2020 YES YES YES YES YES YES YES YES Figure 1: The 'race' for the fastest parameterized algorithm for Feedback Vertex Set. technique [CNP+11] and gave a O⋆(3k) time randomized algorithm. In particular, the Cut&Count technique gave a O⋆(3tw) time algorithm for FVS if a tree decomposition (see Section 2 for definitions) of width tw is given, and this assumption can be made due to the iterative compression technique. After this result, no progress on randomized algorithms for FVS was made as it seemed that improvements over the O⋆(3tw) running time were not within reach: In [CNP+11] it was also proven that any O⋆((3 − ǫ)tw) time algorithm, for some ǫ > 0, would violate the SETH. It was therefore natural to expect the base 3 is also optimal for the parameterization by the solution size k. Moreover, the very similar O⋆(2k) time algorithm from [CNP+11] for the Connected Vertex Cover problem was shown to be optimal under the Set Cover Conjecture [CDL+16]. Our contributions. We show that, somewhat surprisingly, the O⋆(3k) time Cut&Count algorithm for FVS can be improved: Theorem 1. There is a randomized algorithm that solves FVS in time O⋆(2.69998k). If ω = 2, then the algorithm takes time O⋆(2.6252k). Here 2 ≤ ω ≤ 2.373 is the smallest number such that two n by n matrices can be multiplied in O(nω) time [Gal14]. Theorem 1 solves a natural open problem stated explicitly in previous literature [CFJ+14]. Using the method from [FGLS16] that transforms O⋆(ck) time algorithms for FVS into O⋆((2 − 1/c)n) we directly obtain the following improvement over the previously fastest O⋆(1.67n) time algorithm: Corollary 1. There is a randomized algorithm that solves FVS on an n-vertex graph in time O⋆(1.6297n). The above algorithms require space exponential in k, but we also provide an algorithm using polynomial space at the cost of the running time: Theorem 2. There is a randomized algorithm that solves FVS in time O⋆(2.8446k) and polynomial space. Our Techniques. We build upon the O⋆(3tw) time algorithm from [CNP+11]. The starting standard observation is that a feedback vertex set of size k (which we can assume to be known to us by the iterative compression technique) gives a tree decomposition of treewidth k + 1 with very special properties. We show how to leverage these properties using the additional assumption that the average degree of all vertices in the feedback vertex set is constant: Lemma 1. Let G be a graph and F be a feedback vertex set of G of size at most k, and define d := deg(F )/k = Pv∈F deg(v)/k. There is an algorithm that, given G and F , computes a tree decomposition of G of width at most (1 − 2−d + o(1))k, and runs in polynomial time in expectation. 3 To the best of our knowledge, Lemma 1 is new even for the special case where F is a vertex cover of G. We expect this result to be useful for other problems parameterized by the feedback vertex set or vertex cover size (such parameterizations are studied in for example [JJ17]). Lemma 1 is proven via an application of the probabilistic method analyzed via proper colorings in a dependency graph of low average degree. It is presented in more detail in Section 3. Lemma 1, combined with the O⋆(3tw) time algorithm from [CNP+11], implies that we only need to ensure the feedback vertex set has constant average degree in order to get a O⋆((3 − ǫ)k) time algorithm for some ǫ > 0. To ensure this property, we extend the randomized O⋆(4k) time algorithm of Becker et al. [BBG00]. The algorithm from [BBG00] first applies a set of reduction rules exhaustively, and then selects a vertex with probability proportional to its degree.3 They show that this chosen vertex appears in an optimal feedback vertex set with probability at least 1/4. To modify this algorithm, we observe that after applying the reduction rules in [BBG00], every vertex has degree at least 3, so one idea is to select vertices with probability proportional to deg(v) − 3 instead.4 It turns out that if n ≫ k, then this biases us more towards selecting a vertex in an optimal feedback vertex set F . Indeed, we will show that if n ≥ 4k, then we succeed to select a vertex of F with probability at least 1/2. This is much better than even success probability 1/3, which is what we need to beat to improve the O⋆(3k) running time. Closer analysis of this process shows that even if n < 4k, as long as the graph itself has large enough average degree, then we also get success probability ≫ 1/3. It follows that if the deg(v) − 3 sampling does not give success probability ≫ 1/3, then the graph has n ≤ 4k and constant average degree. Therefore, the graph has only O(k) edges, and even if all of them are incident to the feedback vertex set of size k, the feedback vertex set still has constant average degree. Therefore, we can apply Lemma 1, which gives us a modest improvement of the O⋆(3k) running time to O⋆(3(1−2−56)k) time. To obtain improvements to a O⋆(2.8446k) time and polynomial space algorithm, we introduce the new case n ≪ 3k, where we simply add a random vertex to the FVS F , which clearly succeeds with probability ≫ 1/3. We then refine our analysis and apply the Cut&Count method from the O⋆(3tw) algorithm in a way similar to [CNP+11, Theorem B.1]. To obtain Theorem 1 and further improve the above running times, we extend the proof behind Lemma 1 to decompose the graph using a "three-way separation" (see Definition 3) and leverage such a decomposition by combining the Cut&Count method with fast matrix multiplication. This idea to improve the running time is loosely inspired by previous approaches for MAX-SAT [CS15] and connectivity problems parameterized by branch-width [PBvR16]. Paper Organization. This paper is organized as follows: We first define notation and list preliminaries in Section 2. We present the proof of Lemma 1 in Section 3. In Section 4, we introduce a probabilistic reduction rule and its analysis. Subsequently we focus on improving the O⋆(3k) time algorithm for FVS in Section 5. The algorithm presented there only obtains a modest improvement, but illustrates our main ideas and uses previous results as a black box. In the second half of the paper we show how to further improve our algorithms and prove our main theorems: Section 6 proves Theorem 2, and in Section 7 we prove Theorem 1. Both these sections rely on rather technical extensions of the Cut&Count method that we postpone to Section 8 to improve readability. 2 Preliminaries Let G be an undirected graph. For a vertex v in G, deg(v) is the degree of v in G, and for a set S of vertices, we define deg(S) :=Pv∈S deg(v). If S, T ⊆ V (G) we denote E[S, T ] for all edges intersecting both S, T , and 3The sampling is usually described as choosing a random edge and then a random vertex of this chosen edge, which has the same sampling distribution. 4Let us assume that the graph is not 3-regular, since if it were, then the feedback vertex set has constant average degree and we could proceed as before. 4 denote E[S] = E[T, T ]. For a set (cid:0) A tree-decompositions we refer to [CFK+15, Chapter 7] for its definitions and standard terminology. ·,·,·(cid:1) denotes all partitions of A into three subsets. As we only briefly use Randomized Algorithms. All algorithms in this paper will be randomized algorithms for search problems with one-sided error-probability. The (success) probability of such an algorithm is the probability it will output the asked solution, if it exists. In this paper we define with high probability to be probability at least 1−2−cx for some large c where x is the input, instead of the usual 1−1/xc. This is because FPT algorithms take more than simply poly(x) = O⋆(1) time, so a probability bound of 1 − 2−cx is more convenient when using an union bound to bound the probability any execution of the algorithm will fail. Note that if the algorithm has constant success probability, we can always boost it to high probability using O⋆(1) independent trials. For convenience, we record the folklore observation that this even works for algorithms with expected running time: Lemma 2 (Folklore). If a problem can be solved with success probability 1/S and in expected time T , and its solutions can be verified for correctness in polynomial time, then it can be also solved in O⋆(S · T ) time with high probability. Proof. Consider cSx independent runs of the algorithm for some large constant c, and if a run outputs a solution, we then verify that solution and output YES if this is successful. Given that a solution exists, it is not found and verified in any of cSx rounds with probability at most (1 − 1/S)c·Sx ≤ exp(−cn). The expected running time of the cSx independent runs is cxST , and by Markov's inequality these jointly run in at most 2cxST time with probability at least 3/4. Therefore we can terminate our algorithm after 2cxST time and by a union bound this gives and algorithm that solves the problem with constant success probability. To boost this success probability to high probability, simply use x independent runs of the algorithm that reaches constant success probability. Using this lemma, we assume that all randomized algorithms with constant positive success probability actually solve their respective problems with high probability. Separations. The following notion will be instrumental in our algorithms. Definition 1 (Separation). Given a graph G = (V, E), a partition (A, B, S) ∈(cid:0)V (G) if there are no edges between A and B. ·,·,· (cid:1) of V is a separation In the context of parameterized complexity, a reduction rule (for FVS) is a polynomial- Reduction Rules. time transformation of an input instance (G, k) into a different instance (G′, k′) such that G has a FVS of size k iff G′ has a FVS of size k′. We state below the standard reduction rules for FVS, as described in [CFK+15], Section 3.3. For simplicity, we group all four of their reduction rules FVS.1 to FVS.4 into a single one. Reduction 1 ([CFK+15], folklore). Apply the following rules exhaustively, until the remaining graph has no loops, only edges of multiplicity at most 2, and minimum vertex degree at least 3: 1. If there is a loop at a vertex v, delete v from the graph and decrease k by 1; add v to the output FVS. 2. If there is an edge of multiplicity larger than 2, reduce its multiplicity to 2. 3. If there is a vertex v of degree at most 1, delete v. 4. If there is a vertex v of degree 2, delete v and connect its two neighbors by a new edge. 5 3 Treewidth and Separators In this section, we show how to convert an FVS with small average degree into a good tree decomposition. In particular, suppose graph G has a FVS F of size k with deg(F ) ≤ dk, where d = O(1). We show how to construct a tree decomposition of width (1 − Ω(1))k. Note that a tree decomposition of width k + 1 is trivial: since G − F is a forest, we can take a tree decomposition of G − F of width 1 and add F to each bag. To achieve treewidth (1 − Ω(1))k, we will crucially use the fact that d = O(1). We make the assumption that the algorithm already knows the small average degree FVS F . This rea- soning may seem circular at first glance: after all, the whole task is finding the FVS in the first place. Nevertheless, we later show how to remove this assumption using the standard technique of Iterative Com- pression. We now present a high level outline of our approach. Our goal is to compute a small set S of vertices -- one of size at most (1 − Ω(1))k -- whose deletion leaves a graph of small enough treewidth. Then, taking the tree decomposition of G − S and adding S to each bag gives the desired tree decomposition. Of course, settling for S = (1 + o(1))k and treewidth 1 is easy: simply set S = F so that the remaining graph is a forest, which has treewidth 1. Therefore, it is important that S = (1 − Ω(1))k. We now proceed with our method of constructing S. First, temporarily remove the FVS F from the graph, leaving a forest T . We first select a set Sǫ of β vertices to remove from the forest, for some β = o(k), to break it into connected components such that the edges between F and T are evenly split among the components. More precisely, we want every connected component of T − Sǫ to share at most a 1/β fraction of all edges between F and T ; we show in Lemma 3 below that this is always possible. The β vertices in Sǫ will eventually go into every bag in the decomposition; this only increases the treewidth by o(k), which is negligible. Hence, we can safely ignore the set Sǫ. Next, we perform a random coloring procedure as follows: randomly color every connected component of T − Sǫ red or blue, uniformly and independently. Let A be the union of all components colored red, and B be the union of all components colored blue. For simplicity of exposition, we will assume here (with loss of generality) that F is an independent set: that is, there are no edges between vertices in the FVS. Then, if a vertex v ∈ F has all its neighbors in T − Sǫ belonging to red components, then v only has neighbors in A, so let us add v to A. Similarly, if all neighbors belong to blue components, then v only has neighbors in B, so let us add v to B. Observe that the new graphs G[A] and G[B] still have no edges between them, so every vertex addition so far has been "safe". What is the probability that a vertex in F joins A or B? Recall that d(F ) = dk, and since F is an independent set, E[F, T − Sǫ] ≤ E[F, T ] = d(F ) = dk. If a vertex in F has exactly d edges to T − Sǫ, then it has probability at least 2−d of joining A, with equality when all of these edges go to different connected components in T − Sǫ. Of course, we only have that vertices in F have at most d neighbors on average, but a convexity argument shows that in expectation, at least a (2−d − o(1))k fraction of vertices in F join A. That is, E[A ∩ F ] ≥ (2−d − o(1))k. We can make a symmetric argument for vertices joining B. Of course, we need both events -- enough vertices joining each of A and B -- to hold simultaneously, which we handle with a concentration argument. From here, it is straightforward to finish the treewidth construction. We now present the formal proofs. We begin with the following standard fact on balanced separators of forests: Lemma 3. Given a forest T on n vertices with vertex weights w(v), for any β > 0, we can delete a set S of β vertices so that every connected component of T − S has total weight at most w(V )/β. Proof. Root every component of the forest T at an arbitrary vertex. Iteratively select a vertex v of maximal depth whose subtree has total weight more than w(V )/β, and then remove v and its subtree. The subtrees rooted at the children of v have total weight at most w(V )/β, since otherwise, v would not satisfy the maximal depth condition. Moreover, by removing the subtree rooted at v, we remove at least w(V )/β total weight, and this can only happen β times. 6 Lemma 4 (Small Separator). Given an instance (G, k) and a FVS F of G of size at most k, define d := deg(F )/k, and suppose that d = O(1). There is a randomized algorithm running in expected polynomial time that computes a separation (A, B, S) of G such that: 1. A ∩ F , B ∩ F ≥ (2−d − o(1))k 2. S ≤ (1 + o(1))k − A ∩ F − B ∩ F Proof. Fix a parameter ǫ := k−0.01 throughout the proof. Apply Lemma 3 to the forest G−F with parameter ǫk, with vertex v weighted by E[v, F ], and let Sǫ be the output. Observe that and every connected component C of G − F − Sǫ satisfies Sǫ ≤ ǫk = o(k), E[C, F ] ≤ E[F , F ] ǫk ≤ deg(F ) ǫk = dk ǫk = d/ǫ. Now form a bipartite graph H on vertex bipartition F ⊎ R, where F is the FVS, and there are two types of vertices in R, the component vertices and the subdivision vertices. For every connected component C in G − F − Sǫ, there is a component vertex vC in R that represents that component, and it is connected to all vertices in F adjacent to at least one vertex in C. For every edge e = (u, v) in E[F ], there is a vertex ve in R with u and v as its neighbors. Observe that (1) R ≤ E[F , F ] + 2E[F ] = deg(F ), (2) every vertex in R has degree at most d/ǫ, and (3) the degree of a vertex v ∈ F in H is at most deg(v). The algorithm that finds a separator works as follows. For each vertex in R, color it red or blue uniformly and independently at random. Every component C in G − F − Sǫ whose vertex vC is colored red is added to A in the separation (A, B, S), and every component whose vertex vC is colored blue is added to B. Every vertex in F whose neighbors are all colored red joins A, and every vertex in F whose neighbors are all colored blue joins B. The remaining vertices in F , along with the vertices in Sǫ, comprise S. Subclaim 1. (A, B, S) is a separation. Proof. Suppose for contradiction that there is an edge connecting A and B. The edge cannot connect two distinct components of G − F − Sǫ, so it must have an endpoint in F . The edge cannot connect a vertex in F to a vertex in G − F − Sǫ, since a vertex in F only joins A or B if all of its neighbors in R are colored the corresponding color. Therefore, the edge e must connect two vertices in F . But then, ve connects to both endpoints and is colored either red or blue, so it is impossible for one endpoint of e to have all neighbors ⋄ colored red, and the other endpoint to have all neighbors colored blue, contradiction. We now show that with good probability both Conditions (1) and (2) hold. The algorithm can then repeat the process until both conditions hold. Subclaim 2. With probability at least 1 − 1/poly(k), Condition (1) holds for (A, B, S). Proof. There are at most ǫF vertices in F with degree at least d/ǫ. Since they cannot affect condition (1) by an additive ǫF ≤ ǫk = o(k) factor, we can simply ignore them; let F ′ be the vertices with degree at most d/ǫ. Consider the intersection graph I on the vertices of F ′, formed by connecting two vertices in F ′ iff they share a common neighbor (in R). Since every vertex in F ′ and C has degree at most d/ǫ, the maximum degree of I is (d/ǫ)2. Using the standard greedy algorithm, we color F ′ with (d/ǫ)2 + 1 colors so that every color class forms an independent set in I. In particular, within each color class, the outcome of each vertex -- namely, whether it joins A or B or S -- is independent across vertices. Let F ′ all such F ′ Henceforth, assume that F ′ i < k0.9, then ignore it; since d ≤ O(1) and ǫ = k−0.01, the sum of i be the vertices colored i. If F ′ i is at most ((d/ǫ)2 + 1)k0.9 = o(k), so they only affect condition (1) by an additive o(k) factor. i has at most deg(v) neighbors in H, so it has i ≥ k0.9. Each vertex v ∈ F ′ 7 independent probability at least 2− deg(v) of joining A. Let Xi := F ′ that join A; by Hoeffding's inequality5, i ∩ A be the number of vertices in F ′ i Pr[Xi ≤ E[X] − k0.8] ≤ 2 exp(−2 · (k0.8)2/F ′ i ) ≤ 2 exp(−2 · k0.6) ≤ 1/poly(k) for large enough k. By a union bound over all ≤ k0.1 color classes F ′ i ∩ A] − k0.8 for each F ′ i is 1 − 1/poly(k). In this case, E[F ′ i with F ′ i ≥ k0.9, the probability that F ′ i ∩ A ≥ i ∩ A] − k0.8(cid:1) 2− deg(v) − k0.1 · k0.8 i ≥k0.9(cid:0)E[F ′ i ≥k0.9 Xv∈F ′ i F ∩ A ≥ Xi:F ′ ≥ Xi:F ′ = Xv∈F ′ 2− deg(v) − o(k) ≥ F ′ · 2− deg(F ′)/F ′ − o(k), where the last inequality follows from convexity of the function 2−x. Recall that F ′ ≥ (1 − o(1))k, and observe that deg(F ′)/F ′ ≤ deg(F )/F = d since the vertices in F \F ′ are precisely those with degree exceeding some threshold. It F ∩ A ≥ (1 − o(1))k · 2−d, proving condition (1) for A ∩ F . Of course, the argument for B ∩ F is symmetric. ⋄ Subclaim 3. With probability at least 1 − 1/poly(k), Condition (2) holds for (A, B, S). Proof. At most ǫk = o(k) vertices in S can come from Sǫ, and the other vertices in S must be precisely F \((A ∩ F ) ∪ (B ∩ F )), which has size k − A ∩ F − B ∩ F . ⋄ Hence, with at least constant probability, both Conditions (1) and (2) hold. Furthermore, whether or not they hold can be checked in polynomial time, so the algorithm can repeatedly run the algorithm until the separation satisfies both conditions. Lemma 1. Let G be a graph and F be a feedback vertex set of G of size at most k, and define d := deg(F )/k = Pv∈F deg(v)/k. There is an algorithm that, given G and F , computes a tree decomposition of G of width at most (1 − 2−d + o(1))k, and runs in polynomial time in expectation. Proof. Compute a separation (A, B, S) following Lemma 4. Since (A ∩ F ) ∪ S is a FVS of A ∪ S of size (1 − 2−d + o(1))k, we can compute a tree decomposition of G[(A ∩ F ) ∪ S] of width (1 − 2−d + o(1))k as follows: start with a tree decomposition of width 1 of the forest G[(A ∩ F ) ∪ S] − (F ∪ S), and then add all vertices in (A ∩ F ) ∪ S to each bag. Similarly, compute a tree decomposition of G[(B ∩ F ) ∪ S] in the same way. Finally, merge the two tree decompositions by adding an edge between an arbitrary node from each decomposition; since there is no edge connecting A to B, the result is a valid tree decomposition. 4 Probabilistic Reduction Whenever a reduction fails with a certain probability, we call it a probabilistic reduction. Our probabilistic reduction is inspired by the randomized O⋆(4k) FVS algorithm of [BBG00]. Whenever we introduce a probabilistic reduction, we include (P) in the header, such as in the reduction below. 5If a1, . . . , an are independent and Bernoulli and X = a1 + a2 + . . . + an, then Pr[X − E[x] ≥ t] ≤ 2 exp(−2t2/n). 8 Reduction 2 (P). Assume that Reduction 1 does not apply and G has a vertex of degree at least 4. Sample a vertex v ∈ V proportional to w(v) := (deg(v)− 3). That is, select each vertex v with probability w(v)/w(V ). Delete v, decrease k by 1. We say a probabilistic reduction succeeds if it selects a vertex in an optimal feedback vertex set. Observation 1. Let G be a graph F a FVS of G. Denoting F := V \ F we have that deg(F ) ≤ deg(F ) + 2(F − 1). (1) Proof. Since G − F is a forest, there can be at most F − 1 edges in G − F , each of which contributes 2 to the summation deg(F ) =Pv∈F deg(v). The only other edges contributing to deg(F ) are in E[F, F ], which contribute 1 to both deg(F ) and deg(F ). Therefore, deg(F ) ≤ 2(F − 1) + E[F, F ] ≤ 2(F − 1) + deg(F ). Lemma 5. If n ≥ 4k and the instance is feasible, then Reduction 2 succeeds with probability at least 1/2. Proof. Let F ⊆ V be a FVS of size k.6 We show that the probability of selecting a vertex in F is at least 1/2. Define F := V \F , so that our goal is equivalent to showing that w(F ) ≥ w(F ). The value of w(F ) can be rewritten as w(F ) = Xv∈F (deg(v) − 3) = deg(F ) − 3F . (deg(v) − 3) = deg(F ) − 3F (1) ≤ deg(F ) + 2(F − 1) − 3F ≤ deg(F ) − F . By Observation 1, w(F ) = Xv∈F Therefore, w(F ) ≥ w(F ) ⇐= deg(F ) − 3F ≥ deg(F ) − F ⇐⇒ F ≥ 3F ⇐⇒ n ≥ 4k. (2) (3) (4) Therefore, as long as n ≥ 4k, we can repeatedly apply Reductions 1 and 2 until either k = 0, which means we have succeeded with probability at least 1/2k, or we have an instance (G, k) with n ≤ 4k. Later on, we will need the following bound based on the number of edges m. Informally, it says that as long as the average degree is large enough, Reduction 2 will still succeed with probability close to 1/2 (even if n < 4k). Lemma 6. Assume that 2m > 3n. If the instance is feasible, then Reduction 2 succeeds with probability at least min{ 1 2 , m−n−2k 2m−3n }. Proof. There are at most F − 1 edges not contributing to deg(F ), so m ≤ (F − 1) + deg(F ) ≤ (n − k) + deg(F ) =⇒ deg(F ) ≥ m − n + k. (5) 6From any FVS of size less than k, we can arbitrarily add vertices until it has size k. 9 If w(F )/w(F ) ≥ 1, then the success probability is at least 1/2, so assume otherwise that w(F ) < w(F ). Following the proof of Lemma 5, the contrapositive of (4) gives w(F ) < w(F ) =⇒ F < 3F , (6) so we have w(F ) w(F ) (2) = deg(F ) − 3F w(F ) (3) ≥ deg(F ) − 3F deg(F ) − F (5, 6) ≥ (m − n + k) − 3F (m − n + k) − F = m − n − 2k m − 2n + 2k . Finally, as the Lemma statement is vacuous when 2k > m − n, the Lemma follows. 5 O⋆((3 − ǫ)k) Time Algorithm In this section we present our simplest algorithm that achieves a running time of O⋆((3 − ǫ)k), for some ǫ > 0. The improvement ǫ is very small, but we found this to be the simplest exposition that achieves the bound for any ǫ > 0. We build on the following result: Lemma 7 (Cygan et al. [CNP+11]). There is an algorithm treewidthDP that, given a tree decomposition of the input graph of width tw, and parameter k outputs a FVS of size at most k with high probability if it exists. Moreover, the algorithm runs in O⋆(3tw) time. First, we combine the tree decomposition from the previous section with the standard technique of Iterative Compression to build an algorithm that runs in time O⋆((3 − ǫ)k) time, assuming that m = O(k) (recall m denotes the number of edges of the input graph). Then, we argue that by applying Reduction 2 whenever m ≫ k, we can essentially "reduce" to the case m = O(k). Combining these two ideas gives us the O⋆((3 − ǫ)k) algorithm. The algorithm is introduced below in pseudocode. The iterative compression framework proceeds as follows. We start with the empty graph, and add the vertices of G one by one, while always maintaining a FVS of size at most k in the current graph. Maintaining a FVS of the current graph allows us to use the small tree decomposition procedure of Section 3. Then, we add the next vertex in the ordering to each bag in the tree decomposition, and then solve for a new FVS in O⋆(3tw) time using Lemma 7. Of course, if there is no FVS of size k in the new graph, then there is no such FVS in G either, so the algorithm can terminate early. Algorithm 1 IC1(G, k) Input: Graph G = (V, E) and parameter k, with m = O(k). Output: FVS F of size at most k, or Infeasible if none exists. 1: Order the vertices V arbitrarily as (v1, . . . , vn) 2: F ← ∅ 3: for i = 1, . . . , n do 4: 5: 6: 7: 8: 9: return F return Infeasible Compute a tree decomposition of G[{v1, . . . , vi−1}] by applying Lemma 1 on input F Add vi to each bag in the tree decomposition F ← a FVS of G[{v1, . . . , vi}] with parameter k, computed using treewidthDP from Lemma 7 if F is Infeasible then ⊲ Invariant: F is a FVS of G[{v1, . . . , vi−1}] Lemma 8. On input instance (G, k) with m = O(k), IC1(G, k) runs in time O⋆(3(1−2−2m/k+o(1))k). More- over, if there exists a FVS F of size at most k, then IC1 will return a FVS of size at most k with high probability. 10 Proof. Suppose that there exists a FVS F ∗ of size at most k. Let (v1, . . . , vn) be the ordering from Line 1, and define Vi := {v1, . . . , vi}. Observe that F ∗ ∩ Vi is a FVS of G[Vi], so the FVS problem on Line 6 is feasible. By Lemma 7, Line 6 correctly computes a FVS with high probability on any given iteration. Therefore, after using O∗(1) independent trials, with high probability a FVS is returned successfully. We now bound the running time. On Line 4, the current set F is a FVS of G[Vi−1]. To bound the value of d used in Lemma 1, we use the (rather crude) bound deg(F ) ≤ deg(V ) = 2m =⇒ d = deg(F ) k ≤ 2m k , and moreover, d = O(1) since m = O(k) by assumption. Therefore, Lemma 1 guarantees a tree decomposition of width at most (1 − 2−2m/k + o(1))k, and adding vi to each bag on Line 5 increases the width by at most 1. By Lemma 7, Line 6 runs in time O⋆(3(1−2−2m/k+o(1))k) time, as desired. We now claim below that if m ≥ Ω(k) for a sufficiently large k, then Reduction 2 succeeds with good probability (in particular, with probability greater than 1/3). Lemma 9. If G has a FVS of size k and m ≥ 28k, then Reduction 2 succeeds with probability at least 4/11. Proof. We consider two cases. If n ≥ 4k, then the success probability is at least 1/2 by Lemma 5. Otherwise, if n ≤ 4k, then m ≥ 28k ≥ 7n, and Lemma 6 and the trivial bound k ≤ n give a success probability of at least m − n − 2k 2m − 3n ≥ m − 3n 2m − 3n ≥ 7n − 3n 14n − 3n = 4 11 . Hence, regardless of whether or not n ≥ 4k, Reduction 2 succeeds with probability at least 4/11. Below is the full randomized algorithm in pseudocode, which combines Reductions 1 and 2 with the iterative compression routine IC1. After a trivial check and reduction rule, Line 3 flips a coin that needs to be flipped Heads in order to proceed to the iterative compression step. The motivation for this is that we want each iteration of FVS1 to run quickly in expectation -- in par- ticular, in O⋆(3o(k)) time -- for simplicity of analysis. This way, if the algorithm has success probability c−k for some constant c, then we can repeat it O⋆(ck) times, succeeding with high probability and taking O⋆(c(1+o(1))k) time in expectation. Since IC1 takes O⋆(3(1−2−56+o(1))k) time by Lemma 8, we should call IC1 with probability at most 3−(1−2−56)k, which is exactly the probability of the coin flipping Heads. Algorithm 2 FVS1(G, k) Input: Graph G = (V, E) and parameter k ≤ n. Output: A FVS of size k with probability 3−(1−2−56) if one exists; Infeasible otherwise. 1: if k = 0 then return ∅ if G is acyclic, and return Infeasible otherwise 2: Exhaustively apply Reduction 1 to (G, k) to get vertex set F and instance (G′, k′) with m′ edges 3: Flip a coin with Heads probability 3−(1−2−56 )k′ 4: if m′ ≤ 28k′ and coin flipped Heads then 5: 6: else 7: 8: 9: return F ∪ F ′ Apply Reduction 2 to (G′, k′) to get vertex v ∈ V and instance (G′′, k′ − 1) F ′ ← FVS1(G′′, k′ − 1) ∪ {v} F ′ ← IC1(G′, k′) ⊲ Infeasible ∪ S = Infeasible for any set S Lemma 10. FVS1(G, k) runs in expected O⋆(3o(k)) time and has Ω(3−(1−2−56)k) success probability. Proof. For the running time, the computation outside of Line 5 clearly takes poly(n) time. For each k′ ∈ (k0, k], Line 5 is executed with probability 3−(1−2−56)k′ ) time, so in expectation, the total computation cost of Line 5 is O⋆(2o(k)) per value of k′, and also O⋆(2o(k)) overall. and takes O⋆(3(1−2−56+o(1))k′ 11 It remains to lower bound the success probability. Define c := 31−2−56 . We will prove by induction on k that FVS1(G, k) succeeds with probability at least c−k/2. This statement is trivial for k = 0, since no probabilistic reductions are used and FVS1(G, k) succeeds with probability 1. For the inductive step, consider an instance FVS1(G, k + 1). First, suppose that m ≤ 28k. In this case, if IC1 in Line 5 is executed, then it will run in time O⋆(3(1−2−2m/k+o(1))k) by Lemma 8, and correctly output a FVS F of size at most k, with high probability. This happens with probability at least 3−(1−2−56)k ·(cid:18)1 − 1 poly(n)(cid:19) ≥ c−k · 1 2 , as desired. If IC1 is not executed, then FVS1 can still succeed, but this only increases our overall success probability, so we disregard it. Otherwise, suppose that m > 28k. Then, by Lemma 9, applying Reduction 2 succeeds with probability at least 4/11. By induction, the recursive call on Line 8 succeeds with probability at least c−(k−1)/2, so the overall probability of success is at least 4 11 · c−(k−1) 2 ≥ c−1 · c−(k−1) 2 = c−k 2 , as desired. The claimed O⋆((3 − ǫ)k) time algorithm follows from Lemma 10 by boosting the success probability of Algorithm FVS1 according to Lemma 2. 6 Improved Algorithm and Polynomial Space In this section, we present the O⋆(2.8446k) time algorithm promised by Theorem 2. At a high level, our goal is to obtain a tighter bound on d = deg(F )/k, which we only bounded loosely by 2m/k in Section 5. Recall that the treewidth bound of (1 − 2−d + o(1))k from Lemma 1 has exponentially dependence on d, so every constant factor savings in d is crucial. First, we introduce another simple reduction step, which works well when n ≪ 3k. Reduction 3 (P). Sample a uniformly random vertex v. Delete v and decrease k by 1. For the entire section, we will fix a constant ǫ > 0 and obtain a running time that depends on ǫ. At the very end, we will optimize for ǫ and achieve the running time O⋆(2.8446k). For formality, we define the following assumption (A1) and state the corresponding direct claim. Claim 1. If (A1) is true, then Reduction 3 succeeds with probability at least 1/(3 − ǫ). Now suppose that (A1) is false. Observe that Reduction 2 succeeds with probability at least 1/(3 − ǫ) n ≤ (3 − ǫ)k (A1) precisely when By Observation 1, we have w(F ) w(F ) (2) = deg(F ) − 3F deg(F ) − 3F ≥ 1 2 − ǫ . deg(F ) − 3F deg(F ) − 3F (1) ≥ deg(F ) − 3F (deg(F ) + 2F ) − 3F = deg(F ) − 3k deg(F ) − (n − k) , and since (A1) is false, deg(F ) − 3k deg(F ) − (n − k) ≥ deg(F ) − 3k deg(F ) − ((3 − ǫ)k − k) = deg(F ) − 3k deg(F ) − (2 − ǫ)k . 12 We are interested in whether or not deg(F ) − 3k deg(F ) − (2 − ǫ)k ? ≥ 1 2 − ǫ ⇐⇒ (2 − ǫ)(deg(F ) − 3k) ? ≥ deg(F ) − (2 − ǫ)k ⇐⇒ deg(F ) ? ≥ 4 − 2ǫ 1 − ǫ k, which, if true, would imply that Reduction 2 succeeds with probability at least 1/(3 − ǫ). Again, we present the assumption and corresponding claim: deg(F ) ≥ 4 − 2ǫ 1 − ǫ k for some FVS F of size k (A2) Claim 2. If (A1) is false and (A2) is true, then Reduction 2 succeeds with probability at least 1/(3 − ǫ). An immediate issue in this assumption is that the algorithm does not know deg(F ), so it cannot determine whether (A2) is true or not. This can be accomplished by designing an algorithm to find Feedback Vertex Sets with additional properties defined as follows: Definition 2 (Bounded Total Degree FVS). In the bounded total degree FVS (BFVS) problem, the input is an unweighted, undirected graph G on n vertices, and parameters k ≤ n and d ≤ O(1). The goal is to either output a FVS F of size at most k satisfying deg(F ) ≤ dk, or correctly conclude none exists. Algorithm 3 IC2(G, k, d) Input: Graph G = (V, E) and parameters k ≤ n and d = O(1). Output: A FVS F of size at most k satisfying deg(F ) ≤ dk, or Infeasible if none exists. 1: Order the vertices V arbitrarily as (v1, . . . , vn) 2: F ← ∅ 3: for i = 1, . . . , n do 4: 5: 6: 7: 8: 9: return F Compute a separation (A, B, S′) of G[{v1, . . . , vi−1}] by Lemma 4 on input F S ← S′ ∪ {vi}, so that (A, B, S) is a separation of G[{v1, . . . , vi}] F ← BFVS1(G[{v1, . . . , vi}], k + 1, A, B, S) if F is Infeasible then ⊲ Invariant: deg(F ) ≤ dk return Infeasible We remark that Lines 5 and 6 replace the tree decomposition and treewidthDP of IC1. Indeed. we need to solve the BFVS problem instead of FVS, and treewidthDP could be easily extended to solve this problem as well. However, it treewidthDP crucially relies on exponential working space. In the new algorithm we circumvent this by exploiting special properties of the separation directly. The function of the new algorithm is described by the following lemma: Lemma 11. There is an Algorithm BFVS1 that, given G, a FVS F of G of size k, parameter d, and a separation (A, B, S) as given by Lemma 4, outputs a FVS of size at most k − 1 satisfying deg(F ) ≤ d(k − 1), or Infeasible if none exists. The algorithm uses O⋆(3(1−2−d+o(1))k) time and polynomial space. Because of its technical nature, we postpone the proof of this Lemma to Subsection 8.1. Lemma 12. Algorithm IC2 solves the BFVS problem in O⋆(3(1−2−d+o(1))k) time and polynomial space. Proof. Suppose that there exists a FVS F ∗ of size at most k satisfying deg(F ∗) ≤ dk. Let (v1, . . . , vn) be the ordering from Line 1, and define Vi := {v1, . . . , vi}. Observe that F ∗ ∩ Vi is a FVS of G[Vi] satisfying deg(F ∗ ∩ Vi) ≤ dk, so the FVS problem on Line 6 is feasible. By Lemma 11, Line 6 correctly computes a FVS with high probability on any given iteration. Therefore, with high probability, a FVS is returned successfully by a union bound. 13 We now bound the running time. On Line 4, the current set F is a FVS of G[Vi−1] satisfying deg(F ) ≤ dk, so Lemma 1 guarantees a tree decomposition of width at most (1 − 2−d + o(1))k, and adding vi to each bag on Line 5 increases the width by at most 1. By Lemma 11, Line 6 runs in time O⋆(3(1−2−d+o(1))k) time, as desired. Lastly, the space bound follows clearly from the descriptions of IC2 and Lemma 11. Algorithm 4 FVS2(G, k) Input: Graph G = (V, E) and parameter k ≤ n. Output: Either output a FVS F of size k, or (possibly incorrectly) conclude that one does not exist (Infeasible). 1: if k = 0 then return ∅ if G is acyclic, and return Infeasible otherwise 2: Exhaustively apply Reduction 1 to (G, k) to get vertex set F and instance (G′, k′) 3: d ← (4 − 2ǫ)/(1 − ǫ) 4: Flip a coin with Heads probability 3−(1−2−d )k′ 5: if coin flipped Heads then 6: 7: else 8: 9: 10: 11: Apply Reduction 3 to (G′, k′) to get vertex v ∈ V and instance (G′′, k′ − 1) Apply Reduction 2 to (G′, k′) to get vertex v ∈ V and instance (G′′, k′ − 1) ⊲ (A1) is true ⊲ (A1) is false F ′ ← IC2(G′, k′, d) if n′ ≤ (3 − ǫ)k′ then else F ′ ← FVS2(G′′, k′ − 1) ∪ {v} 12: 13: return F ∪ F ′ ⊲ Denoting Infeasible ∪ S = Infeasible for any set S Lemma 13. Fix the parameter ǫ ∈ (0, 1), and let cǫ := max{3 − ǫ, 31−2−(4−2ǫ)/(1−ǫ) FVS2(G, k) succeeds with probability at least c−k running time. If cǫ ≥ 2, then ǫ /k. Moreover, Algorithm FVS2(G, k) has O⋆(3o(k)) expected }. Proof. For the running time, the computation outside of Line 6 clearly takes poly(n) time. For each k′ ∈ (k0, k], Line 6 is executed with probability 3−(1−2−d)k′ ) time by Lemma 12. Therefore, in expectation, the total computation cost of Line 6 is polynomial per value of k′, and also polynomial overall. , and takes O⋆(3(1−2−d+o(1))k′ We continue with proving by induction on k that FVS2(G, k) succeeds with probability at least c−k/k (we denote c := cǫ). This statement is trivial for k = 0, since no probabilistic reductions are used and FVS2(G, k) succeeds with probability 1. For the inductive step, consider an instance FVS2(G, k + 1). Let (G′, k′) be the reduced instance after Line 2. First, suppose that (A2) is false on instance (G′, k′). That is, every FVS F of size at most k satisfies deg(F ) ≤ 4−2ǫ 1−ǫ k′; here, we will only need the existence of one such F . In this case, if IC2 in Line 6 is executed, then it will correctly output a FVS F of size at most k, with high probability by Lemma 12. This happens with probability at least 3−(1−2−d)k′ ·(cid:18)1 − 1 poly(n)(cid:19) ≥ c−k′ · 1 k ≥ c−k k , as desired. Otherwise, suppose that (A2) is true on instance (G′, k′). Then, by Claims 1 and 2, regardless of whether (A1) is true, the reduction applied succeeds with probability at least 1/(3 − ǫ). This is assuming, of course, that Line 6 is not executed, which happens with probability 1 − c−k′ ≥ 1 − 1/k′ since c ≥ 2. By induction, the recursive call on Line 12 succeeds with probability at least c−(k′−1)/(k′ − 1), so the overall probability of success is at least ≥ 1 − 2−k′ (cid:18)1 − 1 k′(cid:19) · 1 3 − ǫ · c−(k′−1) k′ − 1 ≥(cid:18)1 − 1 k′(cid:19) · 1 c · c−(k′−1) k′ − 1 = c−k′ k′ ≥ c−k k , as desired. 14 To optimize for cǫ, we set ǫ ≈ 0.155433, giving cǫ ≤ 2.8446. Theorem 2 now follows by combining Lemma 13 with Lemma 2. 7 Further Improvement Using Matrix Multiplication In this section, we further speed up the algorithm IC2 that solves the BFVS problem. First, we open the Cut&Count black box, which essentially transforms the FVS (or BFVS) problem to counting the number of partitions of the graph that satisfy a particular constraint, modulo some integer. The transformation are similar to the presentation in [CNP+11], so we defer the details to Section 8. In [CNP+11], this counting problem is solved using dynamic programming on a tree decomposition in O⋆(3tw) time, which can be translated to an O⋆(3k) time algorithm for BFVS. As with most problems efficiently solvable on tree decompositions, the Cut&Count problem performs Indeed, we show in Subsection 8.1 that instead of calling the well when given small vertex separators. O⋆(3tw) algorithm on the tree decomposition from Lemma 1, we can solve the problem by applying dynamic programming on the (A, B, S) separation from Lemma 4 directly in the same running time, and also in polynomial space. The resulting algorithm is the algorithm BFVS1 promised by Lemma 11. How do we obtain an even faster running time, then? The main insight in this section is that the counting problem has a special arithmetic nature that also makes it amenable to matrix multiplication as well. Combining these two observations, we construct a three-way vertex separation of the graph G, defined as follows: Definition 3 (Three-Way Separation). Given a graph G = (V, E), a partition (S1, S2, S3, S1,2, S1,3, S2,3, S1,2,3) of V is a separation if there are no edges between any two sets SI , SJ whose sets I and J are disjoint. The construction of a good three-way separation is very similar to the "two-way separation" in Lemma 1: it also features a randomized coloring procedure and is proven using concentration arguments. We then apply a combination of dynamic programming and matrix multiplication on the three-way separator, which is presented as Algorithm BFVS2 in Subsection 8.2. 7.1 Three-Way Separator Lemma 14 (Three-Way Separator). Given an instance (G, k) and a FVS F of size at most k, define d := deg(F )/k, and suppose that d = O(1). There is a polynomial time algorithm that computes a three-way separation (S1, S2, S3, S1,2, S1,3, S2,3, S1,2,3) of G such that there exists values f1, f2 satisfying: 1a. f1 ≥ 3−d 1b. (f1 − o(1))k ≤ Si ∩ F ≤ (f1 + o(1))k for all i ∈ [3] 2a. f2 ≥ (2/3)d − 2f1 2b. (f2 − o(1))k ≤ Si,j ∩ F ≤ (f2 + o(1))k for all 1 ≤ i < j ≤ 3 Proof. Our proof follows the outline of the proof of Lemma 4. Initially, we start out the same: fix ǫ := k−0.01, apply Lemma 3 on the same input (that is, G − F ), and construct the bipartite graph H on the bipartition F ⊎ R in the same manner as in Lemma 4. We recall that (1) R ≤ E[F , F ] + 2E[F ] = deg(F ), (2) every vertex in R has degree at most d/ǫ, and (3) the degree of a vertex v ∈ F in H is at most deg(v). Now, instead of randomly two-coloring the vertex set R, the algorithm three-colors it. That is, for each vertex in R, color it with a color in {1, 2, 3} chosen uniformly and independently at random. For each subset I ⊆ 2[3]\{∅}, create a vertex set SI consisting of all vertices v ∈ F whose neighborhood in H sees the color set I precisely. More formally, let c(v) and N (v) be the color of v ∈ R and the neighbors of v in H, and define SI = {v ∈ R :Su∈N (v) c(u) = I}. Furthermore, if I is a singleton set {i}, then add (to SI ) all vertices in the connected components C whose component vertex in R is colored i. From now on, we abuse notation, sometimes referring to sets S{1}, S{1,2}, etc. as S1, S1,2, etc. 15 The proof of the following easy Subclaim is essentially the same as the proof of Subclaim 1 (but with more cases), and therefore omitted. Subclaim 4. (S1, S2, S3, S1,2, S1,3, S2,3, S1,2,3) is a three-way separation. We start by proving Conditions (1a) and (1b) with the following strategy. First, we first present a value f1 such that Condition (1b) holds with probability 1 − 1/poly(k). Then, we argue that actually, this value of f1 satisfies Condition (1a) (with probability 1). Subclaim 5. For f1 := (Pd pd · F ′ d) /F ′, Condition (1b) holds with probability 1 − 1/poly(k). Proof. The proof uses similar concentration arguments as the proof of Subclaim 2. Again, fix a parameter ǫ := k−0.01 throughout the proof. Let F ′ be the vertices with degree at most d/ǫ, so that again, F ′ ≥ (1−o(1))F . Form the intersection graph I on the vertex set F ′ as in Subclaim 2, and color it with (d/ǫ)2 +1 colors with a standard greedy algorithm. Let F ′ d be the vertices in F ′ with degree d ≤ d/ǫ in H, and let F ′ i,d be the vertices colored i with degree d in H. If F ′ i,d is at most ((d/ǫ)2 + 1) · (d/ǫ) · k0.9 = o(k), so they only affect condition (1b) by an additive o(k) factor. Henceforth, assume that F ′ i,d < k0.9, then ignore it; since d ≤ O(1) and ǫ = k−0.01, the sum of all such F ′ i ≥ k0.9. We only focus our attention on S1; the claim for S2 and S3 are identical. The probability that a vertex i,d ∩ A be the number of vertices i,d joins S1 is a fixed number pd that only depends on d. Let X := F ′ i,d that join S1; we have E[X] = pd · F ′ i,d, and by Hoeffding's inequality, v ∈ F ′ in F ′ Pr[X − E[X] ≥ k0.8] ≤ 2 exp(−2 · (k0.8)2/F ′ i,d) ≤ 2 exp(−2 · k1.6/k) ≤ 1/poly(k) for large enough k. Taking a union bound over all colors i and degrees d, we conclude that with probability 1 − 1/poly(k), F ′ ∩ S1 − E [F ′ ∩ S1] ≤ ((d/ǫ)2 + 1) · (d/ǫ) · k0.8 + o(k) = o(k). Moreover, and we see that E[F ′ ∩ S1] =Xd pd · F ′ d, S1 ∩ F − f1k = S1 ∩ F ′ − f1 · F ′ + o(k) = o(k), which fulfills condition (1b). ⋄ Subclaim 6. For f1 := (Pd pd · F ′ Proof. The number pd equals 3−d, so f1 = (Pd F ′ since the vertices in F \F ′ are precisely those with degree exceeding some threshold. Therefore, d·3−d)/F ′. Observe that deg(F ′)/F ′ ≤ deg(F )/F = d, d) /F ′, Condition (1a) holds with probability 1 − 1/poly(k). f1 = = 1 F ′Xd F ′ Xv∈F ′ 1 F ′ d · 3−d 3− deg(v) ≥ 3− deg(F ′)/F ′, where the last inequality follows from convexity of the function 3−x. ⋄ Subclaim 7. For f2 := (Pd pd · F ′ d) /k, Condition (2b) holds with probability 1 − 1/poly(k). Proof. The proof is identical to that of Subclaim 5, except that pd is now the probability that a vertex v ∈ F ′ ⋄ i,d joins S2. 16 Subclaim 8. The f1 := (Pd pd · F ′ d) /F ′ and f2 := (Pd pd · F ′ Proof. Here, our strategy is slightly different. Let qd be the probability that a vertex v of degree d in H joins one of S1, S2, and S1,2. Since this is also the probability that no neighbor of v is colored 3, we have qd = (2/3)d. Let p1,d and p2,d be the value of pd in the proofs of Subclaim 5 and Subclaim 7, respectively, so that qd = 2p1,d + p2,d. Therefore, d) /k, condition (2a) holds. 1 F ′Xd p2,d · F ′ d 2f1 + f2 = 2 · 1 p1,d · F ′ d + 1 1 1 qd · F ′ d = = F ′ F ′Xd F ′Xd F ′Xd F ′ Xv∈F ′(cid:18) 2 3(cid:19)deg(F ′)/F ′ ≥(cid:18) 2 = 3(cid:19)d d ·(cid:18) 2 3(cid:19)deg(v) , where the last inequality follows from convexity of the function (2/3)x. Again, we have deg(F ′)/F ′ ≤ deg(F )/F = d, so which fulfills condition (2a). ⋄ f2 ≥(cid:18) 2 3(cid:19)deg(F ′)/F ′ 3(cid:19)d − 2f1 ≥(cid:18) 2 − 2f1, 7.2 Matrix Multiplication Algorithm In this section, we present the improved iterative compression algorithm IC3. It is mostly unchanged from IC2, except that the algorithm now computes a three-way separator and calls the faster BFVS al- gorithm BFVS2 on it. Because of its technical nature, the algorithm BFVS2 and its analysis are deferred to Subsection 8.2. Instead, we simply state its running time guarantee in Lemma 15 below. Algorithm 5 IC3(G, k, d) Input: Graph G = (V, E) and parameters k ≤ n and d = O(1). Output: A FVS F of size at most k satisfying deg(F ) ≤ dk, or Infeasible if none exists. 1: Order the vertices V arbitrarily as (v1, . . . , vn) 2: F ← ∅ 3: for i = 1, . . . , n do 4: 5: 6: 7: 8: 9: return F Compute a separation (S1, S2, S3, S1,2, S1,3, S2,3, S1,2,3) of G[{v1, . . . , vi−1}] by Lemma 14 on input F S1,2,3 ← S1,2,3 ∪ {vi}, so that (S1, S2, S3, S1,2, S1,3, S2,3, S1,2,3) is a three-way separation of G[{v1, . . . , vi}] F ← BFVS2(G[{v1, . . . , vi}], k + 1, S1, S2, S3, S1,2, S1,3, S2,3, S1,2,3) if F is Infeasible then return Infeasible ⊲ Invariant: deg(F ) ≤ dk Lemma 15. There is an Algorithm BFVS2 that, given G, a FVS F of G of size k, parameter d, and a sepa- ration (S1, S2, S3, S1,2, S1,3, S2,3, S1,2,3) as given by Lemma 14, outputs a FVS of size at most k − 1 satisfying deg(F ) ≤ d(k−1), or Infeasible if none exists. The algorithm runs in time O⋆(3(1−min{(2/3)d,(3−ω)(2/3)d+(2ω−3)3−d}+o(1))k). 17 Assuming Lemma 15, we prove our main result, Theorem 1, restated below. Theorem 1. There is a randomized algorithm that solves FVS in time O⋆(2.69998k). If ω = 2, then the algorithm takes time O⋆(2.6252k). Proof. We run FVS2, replacing every occurrence of IC2 with IC3. Following FVS2, we define d := (4−2ǫ)/(1− ǫ) for some ǫ > 0 to be determined later; note that d ≥ 4 for any ǫ > 0. Since ω < 2.3728639 [Gal14], by Lemma 20, IC3 runs in time O⋆(3(1−((3−ω)(2/3)d+(2ω−3)·3−d)+o(1))k), so FVS2 runs in time O⋆(ck ǫ ) for cǫ := max{3 − ǫ, 31−((3−ω)(2/3)(4−2ǫ)/(1−ǫ)+(2ω−3)·3−(4−2ǫ)/(1−ǫ) )+o(1)}. To optimize for cǫ, we set ǫ ≈ 0.3000237, giving cǫ ≤ 2.699977. If ω = 2, then by Lemma 20, IC3 runs in time O⋆(3(1−(2/3)d+o(1))k), so FVS2 runs in time O⋆(ck cǫ := max{3 − ǫ, 31−(2/3)(4−2ǫ)/(1−ǫ)+o(1)}. To optimize for cǫ, we set ǫ ≈ 0.3748068, giving cǫ ≤ 2.6252. ǫ ) for 8 Cut and Count In this section we open the black box formed by the Cut&Count approach [CNP+11]. It should be noted that most of this section, except Subsection 8.2, is very similar to the methods from [CNP+11]. We need the following definition: Definition 4 ([CNP+11]). Let G be a graph with weight function ω : V (G) → N. Let s, m′, W be integers. Define Cω,s,m′ to be the set W n(F, L, R) ∈(cid:18)V (G) ·, ·, · (cid:19)(cid:12)(cid:12)(cid:12) ω(F ) = W ∧ E[L, R] = ∅ ∧ F = s ∧ E[L ∪ R] = m′o. In the above,(cid:0)V (G) ·,·,· (cid:1) denotes the set of all partitions of V (G) into three sets (denoted by F for 'Feedback Vertex Set', L for 'left side of the cut', and R for 'right side of the cut'). In words, a partition (F, L, R) of the vertex set is an element of Cω,s,m′ if the total weight of all vertices in F equals W , there are no edges between L and R, exactly m′ edges with both endpoints either in L or in R, and F = s. The use of Definition 4 becomes clear in the following lemma. Intuitively, the crux is that F is a FVS of G if and only if for some s, m′, W the number of partitions (L, R) of V \ F such that Cω,s,m′ is odd; in this case deg(F ) can be read off from W . W W Lemma 16. Let G be a graph and d be an integer. Pick ω(v) ∈R {1, . . . , 2V } uniformly and independent at random for every v ∈ V (G), and define ω′(v) := V 2ω(v) + d(v). The following statements hold: 1. If for some integers m′, W = iV 2 + d we have that Cω′,k,m′ 6≡ 0 (mod 2n−k−m′ ), then G has a W feedback vertex set F satisfying deg(F ) = d. 2. If G has a feedback vertex set F satisfying deg(F ) = d, then with probability at least 1/2 for some m′, W = iV 2 + d we have that Cω′,k,m′ W 6≡ 0 (mod 2n−k−m′ ). Lemma 16 states that in order to solve the Feedback Vertex Set problem it is sufficient to compute for all setting of the parameters. Before proving the Lemma we need to recall some standard Cω,n−k,m′ building blocks: W Lemma 17 (Lemma A.7 in [CNP+11]). A graph with n vertices and m edges is a forest iff it has at most n − m connected components. Definition 5. A function ω : U → Z isolates a set family F ⊆ 2U if there is a unique S′ ∈ F with ω(S′) = minS∈F ω(S), where ω(S′) :=Pv∈S ′ ω(v). 18 Lemma 18 (Isolation Lemma, [MVV87]). Let F ⊆ 2U be a non-empty set family over a universe U . For each u ∈ U , choose a weight ω(u) ∈ {1, 2, . . . , W } uniformly and independently at random. Then Pr[ω isolates F ] ≥ 1 − U /W . Proof of Lemma 16. We first prove 1. Note that if Cω′,k,m′ ), there must be some vertex subset F such that the number of choices L, R with (F, L, R) ∈ Cω,s,m′ . As we can independently decide for each component of G[V \ F ] whether to include it in L, R G[V \ F ] thus must have at most n − k − m′ connected components. By Lemma 17 it therefore must be a FVS. The condition on the degree follows by the weighting. is not a multiple of 2n−k−m′ 6≡ 0 (mod 2n−k−m′ W W For item 2. First apply Lemma 18 with U = V and the set family F being the set of all feedback vertex sets F of G satisfying deg(F ) = d. With probability 1/2, there will be some weight i such that there is a unique FVS F with deg(F ) = d of weight i. By Lemma 17 this is the only F that has a contribution to Cω′,k,m′ is exactly 2cc(G[V \F ]),7 assuming ω(F ) = W , F = k and E[V \ F ] = m′. as the number of extension of F to an object of Cω′,k,m′ that is not a multiple of 2n−k−m′ W W We now continue with a lemma that is useful towards computing Cω,s,m′ W . Definition 6. If F 0 ⊆ V (G) is a FVS of G and (F, L, R) ∈(cid:0) F 0 (F, L, R) = {(F ′, L′, R′) ∈ Cω,s,m′ ·,·,·(cid:1), we denote cω,s,m′ W W : F ′ ∩ F 0 = F ∧ L′ ∩ F 0 = L ∧ R′ ∩ F 0 = R}. Lemma 19. There is a polynomial time algorithm forestDP(G, ω, F, L, R, s, m′, W ) that, given a graph G, weight function ω : V (G) → N, vertex sets F, L, R and integers s, k, m′, W computes cω,s,m′ (F, L, R) in poly(n, W ) time, assuming that F ∪ L ∪ R is an FVS of G. W Proof. We denote F0 = F ∪ L ∪ R for the given FVS. We will use dynamic programming over the forest induced by V \ (F ∪ L ∪ R), in a way very similar to the proof of [CNP+11, Theorem B.1]. We assign roots to each tree in the forest V (G) \ F0 arbitrarily, so the standard relations parents, children, ancestors and descendants are well-defined. For a vertex v, we denote T [v] for the tree induced by v and all its descendants. If v has d children (which we order in arbitrary fashion) and i ≤ d, we also denote T [v, i] for the tree induced by v and all descendants of its first i children. For x ∈ {L′, R′, F ′}, the table entries for the dynamic programming are defined as follows: A(x) W,s,m′ [v, i] := {(F ′, L′, R′) ∈(cid:18)V (T [v, i]) ∪ F0 ·, ·, · (cid:19) : F ′ ∩ F0 = F ∧ L′ ∩ F0 = L ∧ R′ ∩ F0 = R ∧ ω(F ′) = W ∧ E[L′, R′] = ∅ ∧ F ′ = s ∧ E[L′ ∪ R′] = m′ ∧ v ∈ x}. For convenience we also denote A(x) W,s,m′ [v] for A(x) W,s,m′ [v, d], where d is number of children of v. If v is a leaf of a tree in the forest V \ F0, then it is easy to see that we have A(x) W,s,m′ [v, 0] =(1, 0, otherwise, if ω(v) = W − ω(F ) ∧ F = s ∧ E[L∗ ∪ R∗] = m′ ∧ E[L∗, R∗] = ∅ where L∗ denotes L′ ∪ {v} if x = L′ and L′ otherwise, and similarly R∗ denotes R′ ∪ {v} if x = R′ and R′ otherwise. If v has children v1, . . . , vd in the forest V \ F0, we have that W −ω(F ′),s−1,m′[v1] A(x′) A(F ′) W,s,m′ [v, 1] = Xx′∈{L′,R′,F ′} A(L′) W,s,m′ [v, 1] = [N (v) ∩ R = ∅](A(L′) W,s,m′ [v, 1] = [N (v) ∩ L = ∅](A(R′) A(R′) W,s,m′−N (v)∩L−1[v1] + A(F ′) W,s,m′−N (v)∩R−1[v1] + A(F ′) W,s,m′−N (v)∩L[v1]) W,s,m′−N (v)∩R[v1]) 7Here we let cc denote the number of connected components 19 Here we use Iverson's bracket notation [b] for a Boolean predicate b which denotes 1 if b is true and 0 otherwise. To see that this holds, note we need to account for the possible contributions of v to ω(F ′), F ′ and need to check whether E[L′, R′] = ∅ is not violated and account for an increase of E[L′ ∪ R′] which may include the edge {v, v1}. Moreover, for i > 1 we have that A(F ′) W,s,m′ [v, i] = A(L′) W,s,m′ [v, i] = A(R′) W,s,m′ [v, i] = A(x) W1,s1,m′ 1 [v, i − 1] ∗ A(x′) W2,s2,m′ 2 [vi]. Xx′∈{L′,R′,F ′} W1+W2=W −F s1+s2=m′−F m′ 1+m2=m′−E[L∪R] Xx′∈{L′,F ′} W1+W2=W −F s1+s2=m′−F m′ 1+m2=m′−E[L∪R]−[x′=L′] Xx′∈{R′,F ′} W1+W2=W −F s1+s2=m′−F m′ 1+m2=m′−E[L∪R]−[x′=R′] A(x) W1,s1,m′ 1 [v, i − 1] ∗ A(x′) W2,s2,m′ 2 [vi]. A(x) W1,s1,m′ 1 [v, i − 1] ∗ A(x′) W2,s2,m′ 2 [vi]. Similarly as before we need account for the possible contributions of v to ω(F ′), F ′ and need to check whether E[L′, R′] = ∅ is not violated and account for an increase of E[L′ ∪ R′] which may include the edge {v, v1}. Note we compensate for double counting due to F, L, R. Finally we can merge the counts stored at the roots of each tree of the forest to get the desired value. Specifically, if the the roots are r1, . . . , rc then cω,s,m′ W (F, L, R) = Xx1,...,xc∈{L′,R′,F } W1+...+Wd=W −(d−1)F s1+...+sd=m′−(d−1)F A(xi) Wi,si,m′ i [ri]. d Yi=1 m′ 1+...+m′ d=m′−(d−1)E[L∪R] (7) [ri], we can com- Here we again compensate for double counting due to F, L, R. Given all entries A(xi) bine (7) with standard dynamic programming to compute cω,s,m′ (F, L, R) is polynomial time. Wi,si,m′ i W 8.1 Cut and Count Using Simple Separation: Proof of Lemma 11 The algorithm promised by the lemma is listed in Algorithm BFVS1. For the claimed time bound, note all steps are polynomial time except Lines 5, 8 and 11, and these jointly give rise to 3(S+A∩F ) + 3(S+B∩F ) iterations. As the separation (A, B, S) was assumed to satisfy the properties A ∩ F , B ∩ F ≥ (2−d − o(1))k and S ≤ (1 − 2 · 2−d + o(1))k from Lemma 4, the time bound follows. For the correctness, we claim that at Line 14 count = Cω′,k,m′ for some m′, W = iV 2 + d. The lemma follows from this by Lemma 16. To see the claim, observe that the algorithm iterates over all partitions (F, L, R) of the separator S in Line 5. For each partition, and every way to split W, k, m (Line 6), the algorithm computes the number countA (resp. countB) of "extensions" of the partition in G[A ∪ S] (resp. G[B ∪ S]) that "respect" the split, and then multiples countA and countB. To see why the two counts are multiplied, observe that there are no edges between A and B in the separation (A, B, S), so extending into G[A ∪ S] is independent to extending into G[B ∪ S]. W 20 Algorithm 6 BFVS1(G, F, k, A, B, S) Input: Graph G = (V, E), FVS F of size k, parameters k, d ≤ n, and separation (A, B, S) from Lemma 4 Output: A FVS of size at most k satisfying deg(F ) ≤ dk, or Infeasible if none exists. 1: Pick ω ∈R {1, . . . , 2V } uniformly and independently at random for every v ∈ V (G) 2: Set ω′(v) := V 2ω(v) + d(v) 3: count ← 0 4: for m′, W such that 0 ≤ m′ ≤ m, W = V 2i + d ≤ ω(V ) for some d ≤ dk do 5: for (FS, LS, RS) ∈ (cid:0) S ·,·,·(cid:1) do 6: 7: 8: 9: 10: 11: 12: 1 such that 0 ≤ W1 ≤ W, 0 ≤ k1 ≤ k, 0 ≤ m′ 1 ≤ m′ do for W1, k1, m′ countA ← 0 for (FA, LA, RA) ∈ (cid:0)A∩F ·,·,· (cid:1) do countA ← countA + forestDP(G[A ∪ S], ω, FA ∪ FS, LA ∪ LS, RA ∪ RS, k1, m′ 1, W1) countB ← 0 for (FB, LB, RB) ∈ (cid:0)B∩F ·,·,· (cid:1) do countB ← countB + forestDP(G[B ∪ S], ω, FB ∪ FS, LB ∪ LS, RB ∪ RS, k + FS − k1, m′ + E[LS ∪ RS] − m′ 1, W + ω(FS) − W1) count ← count + countA · countB 13: 14: if count 6≡ 0 (mod 2n−k−m′ 15: ) then return a FVS of G[{v1, . . . , vi}] of size ≤ k satisfying deg(F ) ≤ dk, constructed by self-reduction 16: return Infeasible 8.2 Cut and Count Using 3-way Separation: Proof of Lemma 15 W We now present the improved BFVS algorithm below. First, we argue its correctness, that at Line 18, count = Cω′,k,m′ . First, the algorithm iterates over partitions of S1,2,3 in Line 6 the same way Algo- rithm BFVS1 iterates over partitions of S. The rest of the algorithm, which includes the matrix multiplication routine, seeks to compute the number of extensions in S1 ∪ S2 ∪ S3 given each partition of S1,2 ∪ S1,3 ∪ S2,3 (and given the current partition of S1,2,3, as well as a three-way split of W, k, m′). Like in the case of sepa- rator (A, B, S) in BFVS1, it is true that the extensions of S1, S2, and S3 are independent given the partition of S1,2 ∪ S1,3 ∪ S2,3, but in this case, the size of S1,2 ∪ S1,3 ∪ S2,3 can be prohibitively large. Instead, to compute this quantity efficiently, first observe that since there are no edges between S1 and S2,3, the number of extensions of S1 only depends on the partition of S1,2 ∪ S1,3, and not S2,3. For each partition of S1,2 ∪ S1,3, take the graph H defined in Line 8, and imagine adding an edge between the respective partitions of S1,2 and S1,3, weighted by the number of extensions in S1. We proceed analogously for extensions of S2 and S3. Finally, the total number of extensions (given the partition of S1,2,3) amounts to computing, for all triangles in H, the product of the weights of the three edges (Line 16), which can be solved by a standard matrix multiplication routine. Finally, the desired running time bound is more complicated for BFVS2. We prove Lemma 20 below which, together with Lemma 14, implies the running time bound of Lemma 15. 21 Algorithm 7 BFVS2(G, k, S1, S2, S3, S1,2, S1,3, S2,3, S1,2,3) Input: Graph G = (V, E), FVS F , parameters k, d ≤ n, and separation (S1, S2, S3, S1,2, S1,3, S2,3, S1,2,3) from Lemma 14 Output: A FVS of size at most k satisfying deg(F ) ≤ dk, or Infeasible if none exists. 1: for poly(n) iterations do 2: 3: 4: 5: 6: Pick ω ∈R {1, . . . , 2V } uniformly and independently at random for every v ∈ V (G) Set ω′(v) := V 2ω(v) + d(v) count ← 0 for m′, W such that 0 ≤ m′ ≤ m, W = V 2i + d ≤ ω(V ) for some d ≤ dk do for (F0, L0, R0) ∈ (cid:0)S1,2,3 ·,·,· (cid:1) do for nonnegative Wi, ki, m′ i, i ∈ [3] such that Pi Wi = W, Pi ki = k, Pi m′ i = m′ do 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: H ← an empty graph with vertices indexed by (cid:0) S1 for (i, j, k) in {(1, 2, 3), (2, 3, 1), (3, 1, 2)} do ·,·,·(cid:1) ∪ (cid:0) S2 ·,·,·(cid:1) ∪ (cid:0) S3 ·,·,·(cid:1) for (F1, L1, R1) ∈ (cid:0)Si,j ·,·,·(cid:1), (F2, L2, R2) ∈ (cid:0)Si,k ·,·,· (cid:1) do count3 ← 0 for (F3, L3, R3) ∈ (cid:0)Si∩F ·,·,· (cid:1) do count3 ← count3 + forestDP(G[Si], ω, F3, L3, R3, ki, m′ i, Wi) Add an edge e between vertices (F1, L1, R1) and (F2, L2, R2) of H Assign weight count3 (mod 2n−k−m′ ) to the edge e count0 ← sum over the product of the three edges of all triangles in H count ← count + count0 ) then if count 6≡ 0 (mod 2n−k−m′ return a FVS of G[{v1, . . . , vi}] of size ≤ k satisfying deg(F ) ≤ dk, constructed by self-reduction 20: return Infeasible Lemma 20. For any constant ǫ > 0, the BFVS problem with parameters k and d can be solved in time O⋆(3(1−min{(2/3)d,(3−ω)(2/3)d+(2ω−3)3−d}+o(1))k). Proof. Let f1, f2 be the values from Lemma 14, and let f3 := 1 − 3f1 − 3f2, so that (f3 − o(1))k ≤ S1,2,3 ≤ (f3 + o(1))k. For each of the O⋆(3f3+o(1)) iterations on Line 6, building the graph H (Lines 8 to 15) takes time O⋆(32f2+f1+o(k)), and running matrix multiplication (Line 16) on a graph with O⋆(3f2+o(k)) vertices to compute the sum over the product of the three edges of all triangles takes time O⋆(3ωf2+o(k)). Therefore, the total running time is O⋆(3f3+o(k)(32f2+f1+o(k) + 3ωf2+o(k))) = O⋆(3f3+2f2+f1+o(k) + 3f3+ωf2+o(k)) = O⋆(31−f2−2f1+o(k) + 31−(3−ω)f2−3f1+o(k)) = O⋆(31−(f2+2f1)+o(k) + 31−(3−ω)(f2+2f1)−(2ω−3)f1+o(k)) ≤ O⋆(31−(2/3)d+o(k) + 31−(3−ω)(2/3)d−(2ω−3)·3−d+o(k)), where the last inequality uses Conditions (1a) and (1b) of Lemma 14, and the fact that 2ω − 3 ≥ 0. References [AEFM89] Karl R. Abrahamson, John A. Ellis, Michael R. Fellows, and Manuel E. Mata. On the complexity of fixed parameter problems (extended abstract). In 30th Annual Symposium on Foundations of Computer Science, Research Triangle Park, North Carolina, USA, 30 October - 1 November 1989, pages 210 -- 215, 1989. [AGSS16] Akanksha Agrawal, Sushmita Gupta, Saket Saurabh, and Roohani Sharma. Improved algorithms and combinatorial bounds for independent feedback vertex set. In 11th International Symposium on Parameterized and Exact Computation, IPEC 2016, August 24-26, 2016, Aarhus, Denmark, pages 2:1 -- 2:14, 2016. 22 [BBG00] Ann Becker, Reuven Bar-Yehuda, and Dan Geiger. Randomized algorithms for the loop cutset problem. J. Artif. Intell. Res., 12:219 -- 234, 2000. [BGNR98] Reuven Bar-Yehuda, Dan Geiger, Joseph Naor, and Ron M. Roth. Approximation algorithms for the feedback vertex set problem with applications to constraint satisfaction and bayesian inference. SIAM J. Comput., 27(4):942 -- 959, 1998. [Bod94] Hans L. Bodlaender. On disjoint cycles. Int. J. Found. Comput. Sci., 5(1):59 -- 68, 1994. [Cao18] Yixin Cao. A naive algorithm for feedback vertex set. Algorithms, SOSA 2018, January 7-10, 2018, New Orleans, LA, USA, pages 1:1 -- 1:9, 2018. In 1st Symposium on Simplicity in [CCL15] Yixin Cao, Jianer Chen, and Yang Liu. On feedback vertex set: New measure and new structures. Algorithmica, 73(1):63 -- 86, 2015. [CDL+16] Marek Cygan, Holger Dell, Daniel Lokshtanov, D´aniel Marx, Jesper Nederlof, Yoshio Okamoto, Ramamohan Paturi, Saket Saurabh, and Magnus Wahlstrom. On problems as hard as CNF-SAT. ACM Trans. Algorithms, 12(3):41:1 -- 41:24, 2016. [CFJ+14] Marek Cygan, Fedor Fomin, Bart M.P. Jansen, Lukasz Kowalik, Daniel Lokshtanov, Daniel Marx, Marcin Pilipczuk, Michal Pilipczuk, and Saket Saurabh. Open problems for fpt school 2014, 2014. http://fptschool.mimuw.edu.pl/opl.pdf. [CFK+15] Marek Cygan, Fedor V. Fomin, Lukasz Kowalik, Daniel Lokshtanov, D´aniel Marx, Marcin Pilipczuk, Michal Pilipczuk, and Saket Saurabh. Parameterized Algorithms. Springer, 2015. [CFL+08] Jianer Chen, Fedor V. Fomin, Yang Liu, Songjian Lu, and Yngve Villanger. Improved algorithms for feedback vertex set problems. J. Comput. Syst. Sci., 74(7):1188 -- 1198, 2008. [CKX10] Jianer Chen, Iyad A. Kanj, and Ge Xia. Improved upper bounds for vertex cover. Theor. Comput. Sci., 411(40-42):3736 -- 3756, 2010. [CNP+11] Marek Cygan, Jesper Nederlof, Marcin Pilipczuk, Michal Pilipczuk, Johan M. M. van Rooij, and Jakub Onufry Wojtaszczyk. Solving connectivity problems parameterized by treewidth in single exponential time. CoRR, abs/1103.0534, 2011. Extended abstract appeared at FOCS 2011. [CS15] [Dec90] [DF92] Ruiwen Chen and Rahul Santhanam. Improved algorithms for sparse MAX-SAT and max-k-csp. In Theory and Applications of Satisfiability Testing - SAT 2015 - 18th International Conference, Austin, TX, USA, September 24-27, 2015, Proceedings, pages 33 -- 45, 2015. Rina Dechter. Enhancement schemes for constraint processing: Backjumping, learning, and cutset decomposition. Artif. Intell., 41(3):273 -- 312, 1990. Rodney G. Downey and Michael R. Fellows. Fixed parameter tractability and completeness. In Complexity Theory: Current Research, Dagstuhl Workshop, February 2-8, 1992, pages 191 -- 225, 1992. [DFL+07] Frank K. H. A. Dehne, Michael R. Fellows, Michael A. Langston, Frances A. Rosamond, and Kim Stevens. An o(2o(k)n3) FPT algorithm for the undirected feedback vertex set problem. Theory Comput. Syst., 41(3):479 -- 492, 2007. [DHJ+16] Holger Dell, Thore Husfeldt, Bart M. P. Jansen, Petteri Kaski, Christian Komusiewicz, and Frances A. Rosamond. The first parameterized algorithms and computational experiments chal- lenge. In 11th International Symposium on Parameterized and Exact Computation, IPEC 2016, August 24-26, 2016, Aarhus, Denmark, pages 30:1 -- 30:9, 2016. 23 [FGLS16] Fedor V. Fomin, Serge Gaspers, Daniel Lokshtanov, and Saket Saurabh. Exact algorithms via monotone local search. In Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 764 -- 775, 2016. [Gal14] Fran¸cois Le Gall. Powers of tensors and fast matrix multiplication. In International Symposium on Symbolic and Algebraic Computation, ISSAC '14, Kobe, Japan, July 23-25, 2014, pages 296 -- 303, 2014. [GGH+06] Jiong Guo, Jens Gramm, Falk Huffner, Rolf Niedermeier, and Sebastian Wernicke. Compression- based fixed-parameter algorithms for feedback vertex set and edge bipartization. J. Comput. Syst. Sci., 72(8):1386 -- 1396, 2006. [GLL+18] Anupam Gupta, Euiwoong Lee, Jason Li, Pasin Manurangsi, and Michal Wlodarczyk. Losing treewidth by separating subsets. CoRR, abs/1804.01366, 2018. To appear at SODA 2019. [JJ17] [Kar72] [KK18] Lars Jaffke and Bart M. P. Jansen. Fine-grained parameterized complexity analysis of graph coloring problems. In Algorithms and Complexity - 10th International Conference, CIAC 2017, Athens, Greece, May 24-26, 2017, Proceedings, pages 345 -- 356, 2017. Richard M. Karp. Reducibility among combinatorial problems. In Proceedings of a symposium on the Complexity of Computer Computations, held March 20-22, 1972, at the IBM Thomas J. Watson Research Center, Yorktown Heights, New York, USA, pages 85 -- 103, 1972. Eun Jung Kim and O-joung Kwon. Erdos-p´osa property of chordless cycles and its applications. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, January 7-10, 2018, pages 1665 -- 1684, 2018. [KP14] Tomasz Kociumaka and Marcin Pilipczuk. Faster deterministic feedback vertex set. Inf. Process. Lett., 114(10):556 -- 560, 2014. [KPS04] Iyad A. Kanj, Michael J. Pelsmajer, and Marcus Schaefer. Parameterized algorithms for feedback vertex set. In Parameterized and Exact Computation, First International Workshop, IWPEC 2004, Bergen, Norway, September 14-17, 2004, Proceedings, pages 235 -- 247, 2004. [MVV87] Ketan Mulmuley, Umesh V. Vazirani, and Vijay V. Vazirani. Matching is as easy as matrix inversion. Combinatorica, 7(1):105 -- 113, 1987. [PBvR16] Willem J. A. Pino, Hans L. Bodlaender, and Johan M. M. van Rooij. Cut and count and representative sets on branch decompositions. In 11th International Symposium on Parameterized and Exact Computation, IPEC 2016, August 24-26, 2016, Aarhus, Denmark, pages 27:1 -- 27:12, 2016. [RSS02] Venkatesh Raman, Saket Saurabh, and C. R. Subramanian. Faster fixed parameter tractable algorithms for undirected feedback vertex set. In Algorithms and Computation, 13th International Symposium, ISAAC 2002 Vancouver, BC, Canada, November 21-23, 2002, Proceedings, pages 241 -- 248, 2002. [RSS06] Venkatesh Raman, Saket Saurabh, and C. R. Subramanian. Faster fixed parameter tractable algorithms for finding feedback vertex sets. ACM Trans. Algorithms, 2(3):403 -- 415, 2006. [RSV04] Bruce A. Reed, Kaleigh Smith, and Adrian Vetta. Finding odd cycle transversals. Oper. Res. Lett., 32(4):299 -- 301, 2004. [WLS85] Ching-Chy Wang, Errol L. Lloyd, and Mary Lou Soffa. Feedback vertex sets and cyclically reducible graphs. J. ACM, 32(2):296 -- 313, 1985. 24
1210.3833
1
1210
2012-10-14T20:18:36
Improved upper and lower bounds for the point placement problem
[ "cs.DS" ]
The point placement problem is to determine the positions of a set of $n$ distinct points, P = {p1, p2, p3, ..., pn}, on a line uniquely, up to translation and reflection, from the fewest possible distance queries between pairs of points. Each distance query corresponds to an edge in a graph, called point placement graph ppg, whose vertex set is P. The uniqueness requirement of the placement translates to line rigidity of the ppg. In this paper we show how to construct in 2 rounds a line rigid point placement graph of size 9n/7 + O(1). This improves the existing best result of 4n/3 + O(1). We also improve the lower bound on 2-round algorithms from 17n/16 to 9n/8.
cs.DS
cs
Improved upper and lower bounds for the point placement problem Md. Shafiul Alam and Asish Mukhopadhyay (cid:63) School of Computer Science, University of Windsor, 401 Sunset Avenue, Windsor, ON, N9B 3P4, Canada Abstract. The point placement problem is to determine the positions of a set of n distinct points, P = {p1, p2, p3, . . . , pn}, on a line uniquely, up to translation and reflection, from the fewest possible distance queries between pairs of points. Each distance query corresponds to an edge in a graph, called point placement graph (ppg), whose vertex set is P . The uniqueness requirement of the placement translates to line rigidity of the ppg. In this paper we show how to construct in 2 rounds a line rigid point placement graph of size 9n/7+O(1). This improves the result reported in [2] for 5-cycles. We also improve the lower bound on 2-round algorithms from 17n/16 [2] to 9n/8. Introduction 1 Let P = {p1, p2, ..., pn} be a set of n distinct points on a line L. In this paper, we address the problem of determining a unique placement (up to translation and reflection) of the pi's on L, by querying distances between some pairs of points pi and pj, 1 ≤ i, j ≤ n. The resulting queries can be represented by a point placement graph (ppg, for short), G = (P, E), where each edge e in E joins a pair of points pi and pj in P if the distance between these two points on L is known and the length of e, e, is the distance between the corresponding pair of points. (Note the dual use of pi to denote a point on L as well as a vertex of G.) We will say that G is line rigid or just rigid when there is a unique placement for P . Thus, the original problem reduces to the construction of a line rigid ppg, G. Early research on this problem was reported in [6,5]. In this paper, our first principal reference is [3], where it was shown that jewel and K2,3 are both line rigid, as also how to build large rigid graphs of density 8/5 (this is an asymptotic measure of the number of edges per point as the number of points go to infinity) out of the jewel. In a subsequent paper, Damaschke [4] proposed a randomized 2-round strategy that needs (1 + o(1))n distance queries with high probability and also showed that this is not possible with 2-round deterministic strategies. He also reported the following result: Observation 1 At most two equal length edges that are collinear with a line L can be incident to a point p on L. (cid:63) Research supported by an NSERC discovery grant awarded to this author. 2 1 0 2 t c O 4 1 ] S D . s c [ 1 v 3 3 8 3 . 0 1 2 1 : v i X r a 2 Md. Shafiul Alam and Asish Mukhopadhyay Our second principal reference is the work of [2] who improved many of the results of [3]. Their principal contributions are the 3-round construction of rigid graphs of density 5/4 from 6-cycles and a lower bound on the number of queries necessary in any 2-round algorithm. They also introduced the idea of a layer graph which is useful in finding the conditions for rigidity of a ppg and proved the following result about it: Theorem 1. A ppg G is line rigid iff it cannot be drawn as a layer graph. In [1] we proposed a 2-round algorithm that query 4n/3 + O(1) edges to construct line rigid ppg on n points using 6:6 jewels as the basic components. In this paper, we propose a 2-round algorithm that queries 9n/7 + O(1) edges to construct a line rigid ppg on n points, using 3 paths of degree two nodes of length 2 each with a common vertex as the basic component, bettering a result of [2] that uses 5-cycles. More significantly, we improve their lower bound on any 2-round algorithm from 17n/16 to 9n/8. 2 A Two Round Algorithm We shall use 3 paths p1q1r1s, p2q2r2s and p3q3r3s of degree 2 nodes of length 2 attached to a node s of degree 3 as the basic component for the point placement (Fig. 1). Other ends p1, p2 and p3 of the 3 paths are made line rigid in the first round. We shall make the remaining 7 points line rigid in the second round. We find a set of sufficient conditions that make the component line rigid by preventing its drawing as a layer graph (Theorem 1). We shall call the component as 3-path and the corresponding ppg as 3-path ppg. To find the rigidity conditions we consider (p1, q1, r1, s, r2, q2, p2) as a 7-cycle. We shall find conditions that will make the 7-cycle line rigid. Then s will be unambiguous. Also p1, p2 and p3 are fixed in the first round. Consequently, the distance between p3 and s will be fixed. So, we can consider (p3, q3, r3, s) as a 4-cycle. We shall find the condition for rigidity of this 4-cycle. Then the union of these two sets of conditions will comprise the set of rigidity conditions for the whole 3-path ppg. Fig. 1. The 3-path basic component. We shall attach all the basic components to triplets of points among some constant number of line rigid (in the first round) points pi. Then for each compo- nent there will be extra 7 points and 9 edges. Thus, the density will be O(9/7). p1p1p2p3q1q2q3r1r2r3s Point placement problem 3 We shall not query the lengths of the edges q1r1, q2r2 and q3r3 in the first round. We shall query them in the second round. So, we shall find a set of sufficient conditions for rigidity for the basic component that does not involve these edges. Then we can satisfy all the rigidity conditions irrespective of the lengths of these edges which will be reported in the second round. The layer graphs of the 7-cycle (p1, q1, r1, s, r2, q2, p2) can be grouped into 6 groups based on the number of edges on each side (Fig. 2). When different configurations of the chain p3q3r3s are attached to them, the total number of layer graphs for the 3-path component becomes 42. From them, by Theorem 1, we get the following 42 conditions for rigidity of the 3-path component: Fig. 2. Groups of layer graphs for 7-cycle. 1. p1p2 (cid:54)= q2r2, p1p2 (cid:54)= q1r1, p2q2 (cid:54)= r2s, p1q1 (cid:54)= r1s, q2r2 (cid:54)= r1s, q1r1 (cid:54)= r2s, p1q1 (cid:54)= p2q2. 2. p1p2±p2q2 (cid:54)= r2s, p2q2±q2r2 (cid:54)= r1s, p1p2±p1q1±p2q2 (cid:54)= r1s, p1q1 (cid:54)= r1s ± r2s, p1p2 (cid:54)= q1r1 ± r1s, p1q1 ± q1r1 (cid:54)= p2q2, p1q1 ± p1p2 (cid:54)= q2r2. 3. p1p2±p1q1 (cid:54)= r1s, p1q1±q1r1 (cid:54)= r2s, p1p2±p1q1±p2q2 (cid:54)= r2s, p2q2 (cid:54)= r1s ± r2s, p1p2 (cid:54)= q2r2 ± r2s, p2q2 ± q2r2 (cid:54)= p2q2, p2q2 ± p1p2 (cid:54)= q1r1. 4. p1p2 (cid:54)= r2s, p1p2 (cid:54)= r1s, p2q2 (cid:54)= r1s, p1q1 (cid:54)= r2s, p1q1 ± p2q2 ± p1p2 (cid:54)= r1s ± r2s, p2q2 (cid:54)= q1r1, p1q1 (cid:54)= q2r2. 5. p2q2 (cid:54)= p1p2±r1s, p1q1 (cid:54)= p1p2±r2s, p1q1 (cid:54)= p1p2±r1s±r2s, p2q2 (cid:54)= p1p2±r1s±r2s, p1q1 (cid:54)= q2r2±r2s, p2q2 (cid:54)= q1r1±r1s, p1p2 (cid:54)= r1s ± r2s. 6. p1q1 ± q1r1 (cid:54)= p2q2 ± r2s, p2q2 ± q2r2 (cid:54)= p1q1 ± r1s, q1r1 (cid:54)= p2q2 ± r2s, q2r2 (cid:54)= p1q1 ± r1s, p2q2 (cid:54)= p1q1 ± r1s, p1q1 (cid:54)= p2q2 ± r2s, p2q2 (cid:54)= p1q1 ± r1s ± r2s. Among them 20 conditions involve the edges q1r1 and q2r2 of the 7-cycle that we want to avoid in the conditions. We shall replace each of these conditions by a set of conditions that prevents the 7-cycle from being drawn as the layer graph representation that corresponds to that condition. Collection of all these new conditions and the ones that are not replaced will constitute the rigidity conditions for the 7-cycle. As stated before if the 7-cycle is line rigid then the (p3, q3, r3, s) will be a 4-cycle which can be made line rigid by imposing the aefgbcdadfgbcaefgbedadegbfacegbfdecacgbfde 4 Md. Shafiul Alam and Asish Mukhopadhyay condition p3q3 (cid:54)= r3s [2]. This condition together with the rigidity conditions for the 7-cycle will constitute the rigidity conditions for the whole component. As an example of replacing conditions we shall replace the first condition, viz., p1p2 (cid:54)= q2r2, which corresponds to the layer graph representation of the 7-cycle in Fig. 3. To replace the condition we find a set of conditions that prevent the drawing of layer graph of the 7-cycle (p1, q1, r1, s, r2, q2, p2) in the configuration of Fig. 3. For this we draw all the possible configurations of the layer graph of the whole component with the layer graph of the 7-cycle being in the configuration of Fig. 3. This new set of conditions acts as a replacement for the condition p1p2 (cid:54)= q2r2 since that set will prevent the drawing of the layer graph of the 7-cycle (p1, q1, r1, s, r2, q2, p2) in the corresponding configuration in Fig. 3. Fig. 3. The layer graph representation of the 7-cycle (p1, q1, r1, s, r2, q2, p2) correspond- ing to the condition p1p2 (cid:54)= q2r2. Since p1, p2 and p3 are made line rigid in the first round they must lie on a line and their positions must be unique (upto translation and reflection) after first round. Since in the present configuration of the 7-cycle (Fig. 3) p1 and s are on the same side of the layer graph the edges p3q3, q3r3 and r3s can have 4 distinct configurations giving rise to 4 distinct layer graph representations (Fig. 4) of the whole component with the layer graph of the 7-cycle being in the configuration of Fig. 3. Thus, in order to be able to draw the layer graph of the 7-cycle (p1, q1, r1, s, r2, q2, p2) in the configuration of Fig. 3 the layer graph of the whole component must have one of the four distinct configurations as shown in Fig. 4. First, we consider the configuration where p3q3 and r3s are horizontal, and q3r3 is vertical (Fig. 4a). The condition p1p2 (cid:54)= q2r2 prevents the 7-cycle from being drawn as a layer graph of present configuration. However, it involves the edge q2r2 which we need to avoid. In the present configuration of the layer graph of the component p1, q1, r1, s and r2 are on a line which is parallel to p2q2 and q3r3. So, we must have q2r2 = p2p3 ± p3q3 ± r3s. Using this the condition becomes p1p2 (cid:54)= p2p3 ± p3q3 ± r3s. Since p1p2 ± p2p3 = p1p3 the condition reduces to p1p3 (cid:54)= p3q3 ± r3s. If we ensure this condition then we must have p1p2 (cid:54)= q2r2 in the present configuration of the component. Thus, the component in general and the 7-cycle in particular cannot be drawn as a layer graph in the present configurations of the 7-cycle and the component. p1p2q1r1sq2r2 Point placement problem 5 Fig. 4. Layer graphs of the basic component when the layer graph of the 7-cycle (p1, q1, r1, s, r2, q2, p2) has 4 edges p1q1, q1r1, r1s and sr2 on one side. Now we consider the case when p3q3 and q3r3 are vertical, and r3s is hori- zontal (Fig. 4b). In the present configuration of the layer graph of the compo- nent p1, q1, r1, s and r2 are on a line, and p3q3 and q3r3 are on a line. Those lines are parallel and they are parallel to p2q2. So, we must have q2r2 = p2p3 ± r3s. Using this the condition becomes p1p2 (cid:54)= p2p3 ± r3s. We have p1p2 ± p2p3 = p1p3. Using this the rigidity condition p1p2 (cid:54)= q2r2 becomes p1p3 (cid:54)= r3s. Next, we consider the case when p3q3 is vertical, and q3r3 and r3s are hori- zontal (Fig. 4c). The condition p1q1 ± q1r1 ± r1s ± sr2 (cid:54)= p2q2 prevents the 7-cycle from being drawn as a layer graph of present configuration. However, it involves the edge q1r1 which we need to avoid. In the present configuration of the layer graph of the component p1, p2 and p3 are on a line, and q3, r3 and s are on a line. The lines are parallel. So, we must have p1q1±q1r1±r1s = p3q3. Using this the condition becomes p3q3 ± sr2 (cid:54)= p2q2. Finally, we consider the case when p3q3 is vertical, q3r3 is horizontal and r3s is vertical (Fig. 4d). In the present configuration of the layer graph of the component p1, p2 and p3 are on a line. The line is parallel to q3r3. So, we must have p1q1 ± q1r1 ± r1s ± sr3 = p3q3. Using this the rigidity condition p1q1 ± q1r1 ± r1s ± sr2 (cid:54)= p2q2 becomes p3q3 ± sr3 ± sr2 (cid:54)= p2q2. The following lemma justifies the replacement (the proof is omitted). Lemma 1. The 7-cycle (p1, q1, r1, s, r2, q2, p2) of the 3-path basic component of Fig. 1 cannot be drawn as the layer graph of Fig. 3 if the edges of the component satisfy the following conditions: p1p2p3p3p3p1p1p1p2p2p2p3q3q3q3q3q1q1q1q1r1r1r1ssssq2q2q2q2r2r2r2r3r3r3r3(a)p3q3andr3sarehorizontalandq3r3isvertical.(b)p3q3andq3r3areverticalandr3sishorizontal.(c)p3q3isvertical,andq3r3andr3sarehorizontal.(d)p3q3andr3sarevertical,andq3r3ishorizontal.r1r2 6 Md. Shafiul Alam and Asish Mukhopadhyay p1p3 (cid:54)= p3q3 ± r3s,p1p3 (cid:54)= r3s,p3q3 ± sr2 (cid:54)= p2q2, p3q3 ± sr2 ± sr3 (cid:54)= p2q2 Similarly, we can replace the other conditions for rigidity that involve the edges q1r1 and q2r2. Collecting all the conditions we have the following lemma: Lemma 2. The structure consisting of 3 paths of degree 2 nodes p1q1r1s, p2q2r2s and p3q3r3s of length 2 attached to the common node s of degree 3 and having the nodes p1, p2 and p3 fixed in the first round is line rigid if its edges satisfy the following conditions: 1. p1p2 /∈ {r1s, r2s, r1s ± r2s}, 2. p2p3 /∈ {r2s, r3s, r2s ± r3s}, 3. p3p1 /∈ {r3s, r1s, r3s ± r1s}, 4. p1q1 /∈ {r1s, r2s, r1s ± r2s, p1p2 ± r1s, p1p2 ± r2s, p1p3 ± r1s, p1p3 ± r3s, p1p2 ± r1s ± r2s, p1p3 ± r1s ± r3s}, 5. p2q2 /∈ {r1s, r2s, p1q1, r1s ± r2s, p1p2 ± r1s, p1p2 ± r2s, p2p3±r2s, p2p3±r3s, p1q1±r1s, p1q1±r2s, p1p2±r1s± r2s, p2p3 ± r2s ± r3s, p1q1 ± r1s ± r2s, p1q1 ± p1p2 ± r1s, p1q1 ± p1p2 ± r2s, p1q1 ± p1p2 ± r1s ± r2s}, 6. p3q3 /∈ {r1s, r2s, r3s, p1q1, p2q2, r2s±r3s, r3s±r1s, p1p3± r3s, p2p3±r3s, p1q1±r1s, p1q1±r3s, p2q2±r2s, p2q2± r3s, p1p3 ± r1s ± r3s, p2p3 ± r2s ± r3s, p1q1 ± r1s ± r3s, p2q2±r2s±r3s, p1q1±p1p3±r3s, p2q2±p2p3±r3s, p1q1± p1p3 ± r1s ± r2s, p2q2 ± p2p3 ± r2s ± r3s}. As mentioned before, we make triplet of points (p1, p2, p3) of each 3-path component line rigid in the first round. Let S be the set of points for such triplets. We make the points in S line rigid in the first round. We make the remaining 7 points of each 3-path component line rigid in the second round. To select triplet of points in S as (p1, p2, p3) of a component, let us select any point of S as p1. Then let us find another point of S, we denote it as p2, satisfying the conditions on the length p1p2 mentioned in serial number 1 of Lemma 2. By Observation 1, at most 8 edges will not satisfy the conditions on p1p2. We need at least 8 extra points, i.e., we need to have a total of at least 9 more points, other than p1, in S as candidate for p2. After p2 is selected, let us find another point of S, we denote it as p3, from the remaining pints of S such that the conditions on p2p3 in serial numbers 2 of Lemma 2 are satisfied. By Observation 1, at most 8 edges will not satisfy the conditions on p2p3. This warrants the set S to have at least 8 extra points other than p1, p2 and p3. The point p3 selected this way by satisfying the conditions on p2p3 must also have to satisfy the conditions on p3p1 mentioned in serial number 3 of Lemma 2. By Observation 1, at most 8 edges will not satisfy the conditions on p3p1. This warrants the set S to have at least 8 more extra points, i.e., 16 extra points, other than p1, p2 and p3. But if S has only 19 points for the selection of pis it may happen that all the basic components are attached to the same triplets. This hinders our goal Point placement problem 7 of obtaining a better value for α than previously known. We need to attach the basic components evenly to all the points of S so that the same number of edges can be attached to each of them in the first round and all of those edges, except for a constant number, are used to attach the basic components. In other words, we need to attach the 3-path components to the points in S in such a way that the numbers of components attached to any two points differ by at most a constant number. Now we describe our algorithm to select triplets of points in S to attach components. To attach a basic component we always select a point in S with the lowest valence as the first point (say p1). Of the remaining points of S, at most 8 points may not be acceptable for the second point (say p2), because of the conditions on p1p2. From among the rest S − 1 points that satisfy the conditions on p1p2 we select the one that has the lowest valence, as p2. Of the rest S− 2 points of S, at most 16 may not be acceptable for the last point, say p3, because of the conditions on p2p3 and p3p1. From among the rest points that satisfy the conditions on p2p3 and p3p1 we choose the one that has the lowest valence, as p3. This method will be follwed to attach each basic component to the points in S. While, we shall attach the basic components sequentially. To specify the number of basic components attached to a point in S we shall use the term valence. We denote the set of points with valence d as Sd. The following lemma tells us how big S must be (the proof is omitted): Lemma 3. A set S of 35 points is sufficient to ensure that the valences of any two points in S differ by at most 2. We make the above set S of 35 points line rigid in the first round by using jewel of Damaschke [3] as the ppg. We create 6 jewels hanging from a common strut that is incident on 2 points of S. This will make 32 points line rigid. For this we need to query the lengths of 49 edge. We make the remaining 3 points line rigid by using triangle as the ppg. For each of these 3 points we query its distance from each of the pair of points that are incident on the strut. There will be 6 more queries for edge lengths. Thus, we shall query a total of 55 edges in the first round to make the 35 points of S line rigid in that round. The conditions on p1q1, p2q2 and p3q3 in serial numbers respectively 3, 4 and 5 of Lemma 2 will not be satisfied by at most 40, 90 and 122 edges respectively (by Observation 1). In addition to the 122 extra edges needed at each of pi's to satisfy the conditions on p1q1, p2q2 and p3q3 we need 2 more extra edges incident on each of pi to accommodate the difference of 2 between the number of basic components that can be attached to the pi's. Thus, we need a total of 124 extra edges incident on each of the points pi, i = 1, ..., 35 of S. We shall attach 3b, 3b + 1 or 3b + 2 (where b is a positive integer) number of 3-path components to each point in S. This requires us to have 3b + 124 edges incident on each of pi's in S. In the worst case there will be at most 18 points in S with valence 3b, no points in S with valence b + 1 and the remaining points with valence 3b + 2. Thus, we shall be able to construct a total of at least 3b + 11 number of 3-path components from the edges provided for piqi at all the pi's in S. Now we describe 8 Md. Shafiul Alam and Asish Mukhopadhyay the algorithm to construct a composite ppg made up of 3-path components such that all the rigidity conditions listed in Lemma 2 are satisfied for each of them. Algorithm 1. Let the total number of points be n = 245b + 4, 419, where b is a positive integer. We attach at least 3b and at most 3b + 2 numbers of 3-path components (Fig. 1) to each of 35 rigid points in S subject to the condition that the total number of such components being 35b + 11. In the first round, we make distance queries represented by the edges of the graph in Fig. 5. All the nodes pi (i = 1, ..., 35) in the subgraph enclosed by the rectangle are elements of S and are made line rigid in the first round by using the jewel of [3] as the ppg. There are 6 jewels attached to a common strut in the subgraph. Residual 3 points are made line rigid by using triangle as the ppg. They are attached to the common strut. There are a total of 55 edges in the subgraph. Each of the vertices pi, pj, or pk (i, j, k = 1, ..., 35) of S has b + 124 leaves to attach 3b, 3b + 1 or 3b + 2 3-path components (Fig. 1). Since there will be 35b + 11 3-path components we make 35b + 11 groups of 4 nodes (ril, rjl, rkl, sl), (l = 1, ..., 35b + 11). We query the distances rilsl, rjlsl and rkjsl, (l = 1, ..., 35b+11) in the first round. We will make a total of 210b+4, 428 pairwise distance queries in the first round for the placement of n = 245b+4, 419 points. Fig. 5. Queries in the first round. In the second round, for each 3-link (ril, rjl, rkl, sl), l = 1, ..., 35b + 11, we construct a 3-path component (Fig. 1), satisfying all its rigidity conditions as in Lemma 2. For each such 3-link we select a point pi, from the subgraph of 35 points of S that has the lowest valency of 3-path component of Fig. 1. Since all the 35 points pi, i = 1, ..., 35, are rigid in the first round, for any pair of such fixed points (pi, pj)(i, j = 1, ...35; i (cid:54)= j) we can find the distance pipj. So, for each pair of points (pi, pj)(i, j = 1, ..., 35; i (cid:54)= j), we shall use (pi, pj) as an edge in the construction of the 3-path component of Fig. 1. Now from the subgraph of 35 points of S we select another point pj(j (cid:54)= i) such that the length pipj satisfies all the 4 conditions of rigidity on it as stated in serial number 1 of Lemma 2 and that it has the lowest valency of 3-path Linerigidsubgraphof35pointsofS............slqilrilrjlrklpi35b+113-links3b+124leavespjpkqjlqkl3b+124leaves3b+124leaves...... Point placement problem 9 component of Fig. 1 among all such qualifying points. We note that we can always find such point pj, because there will be at most 8 edges (pipj) whose lengths do not satisfy the rigidity conditions on it (Lemma 2) whereas we have 34 more points for choosing the point pj. Similarly, from the subgraph of 35 points of S we select another point pk(k (cid:54)= i, k (cid:54)= j) such that the length pjpk satisfies all the 4 conditions of rigidity on it as stated in serial number 2 of Lemma 2 and the length pkpi satisfies all the 4 conditions of rigidity on it as stated in serial number 3 of Lemma 2, and that it has the lowest valency of 3-path component of Fig. 1 among all such qualifying points. We note that we can always find such point pk, because there will be at most 16 nodes pk such that the lengths of the edges pjpk and pkpi do not satisfy the rigidity conditions on them (Lemma 2) whereas we have 33 more points for choosing the point pk. Then we find an edge piqil rooted at pi satisfying the 20 conditions of rigidity on it as stated in serial no. 4 of Lemma 2, then we find another edge pjqjl rooted at pj satisfying the 45 conditions on it as stated in serial no. 5 of Lemma 2 and finally, we find another edge pkqkl rooted at pk satisfying the 61 conditions on it as stated in serial no. 6 of Lemma 2. Then for each l, (l = 1, ..., 35b + 11), we query the distances qilril, qjlrjl and qklrkl to form a 3-path component pipjpkqilqjlqklrilrjlrklsl. Its edges will satisfy all the rigidity conditions of Lemma 2. Thus, all the 35b + 11 3-links will be consumed to construct 35b + 11 3-path components. For this 105b + 33 edges will be queried in the second round. There will be unused leaves qil/qjl/qkl) numbering 4,307 in total for the 35 points of S. We use a 4-cycle ppg [3] to fix 4,306 of them and a triangle ppg to fix the rest 1 point in the second round. As before, for each pair of points (pi, pj)(i, j = 1, ..., 35; i (cid:54)= j), we shall use (pi, pj) as an edge in the construction of the 4-cycle. For each unused point qil rooted at pi we find another point qjl rooted at pj such that pipil (cid:54)= pjpjl. Then the 4-cycle piqilqjlpj will be line rigid (Observation 2). Then we query the distance qilqjl in the second round to complete the 4-cycle. Note that we can always find a point like qjl. For, after repeated selection of such matching pairs of edges there may remain at most 2 edges piqil rooted at pi of length equal to that of the same number of edges rooted at pj (Observation 1). In such a situation we switch the matching to match such edges rooted at pi with edges other than those same length edge/s rooted at pj - this is always possible because there are at most 2 edges rooted at pj that have the same length (Observation 1). To make the remaining 1 leave node line rigid we query in the second round its distance from any point of S other than its parent node. For 4,307 unused points (after the construction of the 3-path components) 2,153 4-cycles and 1 triangle will be constructed. 2,153 edges will be queried to complete the 4-cycles and 1 edge will be queried to construct the triangle. The total number of queries in the second round will be (105b + 33) + 2, 153 + 1, i.e., (cid:117)(cid:116) 105b + 2, 187. Theorem 2. The ppg constructed by Algorithm 1 is line rigid. Proof. Omitted. 10 Md. Shafiul Alam and Asish Mukhopadhyay The number of queries in the first and second rounds are 210b + 4, 428 and 105b + 2, 187 respectively. Thus, in 2 rounds a total of 315b + 6, 615 pairwise distances are to be queried for the placement of 245b+4, 419 points. Now, 315b+ 6, 615 = (315/245) ∗ (245b + 4419) − (9/7) ∗ 4419 + 6615 = 9n/7 + (46305 − 39771)/7 = 9n/7 + 6534/7. Thus, we have the following theorem: Theorem 3. 9n/7 + 6534/7 queries are sufficient to place n distinct points on a line in two rounds. 3 Lower Bound for Two Rounds The argument here closely follows the adversarial argument given in the lower bound proof of [2]. Let the set of edges queried in the first and second round be E1 and E2 respectively; G1 = (V, E1) is the query graph for the first round, while G2 = (V, E1 ∪ E2) is the final query graph after the second round. The length of a maximal path of degree 2 nodes in a graph is the number of degree 2 nodes in the path. We shall call nodes of degree at least 3 as heavy nodes. In the first round, the adversary returns edge-lengths according to the follow- ing strategy, with the intention of keeping the linear layout of the ppg ambiguous: S1: The adversary fixes the layout of all nodes of degree 3 or more and returns the lengths of the edges incident on these nodes. S2: For all degree 2 nodes, if one of the incident edges is also incident on a degree 1 node, the adversary sets the length of one of the incident edges to be the same, say c, over all these degree 2 nodes. S3: For maximal paths formed by 2 or more degree 2 nodes, say p1, p2, ..., pk(k ≥ 2), let p0 and pk+1 be non-degree 2 nodes adjacent to p1 and pk respectively. The adversary sets pi−1pi = pi+1pi+2 for i = 1 (mod 3). In addition, if both p0 and pk+1 are of degree 3 or more the adversary sets pipi+1 = pi−1pi+2 for i = 1 (mod 3), and if at least one of them, say pk+1, is of degree one the adversary sets the lengths of alternate edges equal. S4: If a node, say p0, of degree 3 has 2 maximal paths of degree 2 or 1 nodes the other ends of which are not attached to any heavy node, and if the node p0 is incident on only one maximal path of degree 2 node of length 1 of which the other end is incident on a heavy node, then set the length of one of the edges of this third path as c. For a maximal path of degree 2 nodes in G2, as a consequence of S3 there are limits on the maximum number of edges from E1 if the path consists of edges from E1 only (Fig. 6 shows a degree 2 maximal path p1p2p3p4p5p6 in G1 with both the end nodes p0 and p7 being heavy), and on the maximum number of consecutive edges from E1 if it contains at least one edge from E2 (Fig. 7 shows some degree 2 maximal paths in G1 with none of the end nodes being heavy). If both of p0 and pk+1 are of degree at least three in the first round the adversary sets the above layout in such a way that if, for any i with i = 1 (mod 3) and i < k, no edge is attached to either pi or pi+1 in the second round their positions Point placement problem 11 will be ambiguous. Thus, for this case the length of a maximal path of degree 2 nodes in G2 containing only the edges in E1 can be at most 3. If at least one of p0 and pk+1, say pk+1, is of degree one in the first round the adversary sets the above layout in such a way that if, for any i with i = 1 (mod 2) and i < k, no edge is attached to either pi or pi+1 in the second round, they can be made ambiguous by setting pipi+1 = pi−1pi+2 in the second round. Thus, for this case the length of a maximal path of degree 2 nodes in G2 containing only the edges in E1 can be at most 2. If pk+1 is of degree 1 and no edge is attached to either pk−1 or pk in the second round the positions of pk−1 and pk can be made ambiguous by setting pk−1pk = pk−2pk+1 in that round. The algorithm must attach an edge in G2 to pk−1 or pk. Still then there will be at most 2 free nodes at an end of a path of degree 2 nodes if the end node is of degree 1. The algorithm will fix them in the second round. Thus, in a maximal path of degree 2 nodes in G2 that contains at least one edge from E2 there can be at most 2 consecutive edges from E1. Fig. 6. p1p2p3p4p5p6 is a maximal path of degree 2 nodes in G1 with both the end nodes being heavy. In the second round, the algorithm has to introduce edges at p1 or p2 to make them unambiguous, and at p4 or p5 to make them unambiguous. This will reduce the length of the degree 2 maximal path in G2. The above results together with S2 and S3 imply that the following property holds for the ppg [1]. Lemma 4. The number of nodes in any maximal path of degree 2 nodes in G2 is at most 3. Theorem 4. The minimum density of any line rigid ppg for any two round algorithm is at least 9 8 . Proof. We determine the minimum of the average numbers of edges for all types of nodes. For this the nodes are categorized into two broad types: A. Nodes in the maximal paths of length at least 2 formed by degree 2 nodes in the first round where both the end nodes are attached by edges from E1 to nodes of degree at least 3 in the first round: For edges whose one end is incident on a node of this type and the other end is incident on a node of the other type the edge is split into 2 equal halves. p7p0p2p4p5p6p1p3 12 Md. Shafiul Alam and Asish Mukhopadhyay Fig. 7. Some maximal paths of degree 2 nodes in G1 with none of the end nodes being heavy. In the second round, the algorithm has to introduce an edge at p1 or p2 in all the figures (a)-(f) to make them unambiguous, and at p4 or p5 in figures (d)-(f) to make them unambiguous.This will reduce the lengths of the degree 2 maximal paths in G2. One half is counted towards the density of the nodes of this path and the other half is counted towards the other type of nodes. For maximal path of length k = 2 the average density is 1 4 > 9 2 ) = 7 5 the average is 1 k [2 × 1 1 2 + 1 + 1 2 ) = 3 (2 × 1 8 . For k = 4 8 . For higher values of k the average is 8 . Their minimum is 9 8 . 2 (2 × 1 6 > 9 8 . For k = 3 the average is 1 4 (2 × 1 2 ) = 9 2 + k − 1 + (cid:98) k+1 2 + 3 + 1 3 (cid:99) × 1 2 ] > 9 2 + 2 + 1 B. All the remaining Nodes: To compute the minimum density of this type of nodes we group these nodes and their adjacent edges into neighbourhoods of heavy nodes in G2 of this type and evaluate the average densities of these groups. Their minimum will be the minimum density for this type of nodes. There are 2 types of groups around the heavy nodes based on whether the heavy node is connected to a node of type A or a heavy node of type B by a maximal path of degree 2 nodes in G2. Here, the path may have 0 number of degree 2 nodes for which the path will contain only one edge and no degree 2 p0p1p2p3p0p1p2p3p4p0p1p2p3p4p5p0p1p2p3p4p5p6(a)Length2.(b)Length3.(c)Length4.(d)Length5.(e)Length6.(f)Length7.p0p1p2p3p4p5p6p7p0p1p2p3p4p5p6p7p8ccccccccccc Point placement problem 13 nodes. If a path of degree 2 nodes or an edge is attached to two heavy nodes of type B the path or the edge is divided equally and each half is counted towards the density of one group. If the two ends of a path are attached to two types of nodes then by the accounting described for type A nodes all the nodes and edges of the path except for the half of the end edge attached to the node of type A are counted towards the density of the group of nodes of type B. We consider the two kinds of nodes of type B separately. (a) Heavy nodes in G2 that are connected to heavy nodes of type 2 )/ 3 2 = 4 3 > 9 B only, by paths of degree 2 nodes in G2: Clearly, for a group of nodes around a heavy node the contribution of average density for the group from an attached path of degree 2 nodes decreases as the length of the path increases. By Lemma 7 the maximum length of a path of degree two nodes is 3. The minimum contribution from a path is ( 3+1 8 . Thus, the path will not contribute to reduce the average density of a group around a heavy node to lower than 9 8 . So, we only consider the heavy nodes of this group each of which has the least number of degree two paths attached to the heavy node, i.e., which has exactly 3 paths of degree 2 nodes attached. Let the total number of nodes in the 3 paths is m. Then average density for the group around the heavy node is d = 8 for m ≤ 6. Thus, for the groups with paths having total number of degree 2 nodes at most 6 the minumum average density will be 9 8 . It remains to consider the groups with total number of degree 2 nodes 7, 8 and 9, since there can be at most 3 degree 2 nodes in a path by Lemma 7. For the group with 2 paths of length 3 and 1 path of length 1 placement will not be unique due to S2 and S4 (Fig. 8). For path p0p1p2 either p0p1 = c or p1p2 = c by S4. For path p0p(cid:48)1p(cid:48)2p(cid:48)3p(cid:48)4, among the edges p(cid:48)1p(cid:48)2 and p(cid:48)2p(cid:48)3 the one in E1 will have length c by S2. Similarly, for the path p0p(cid:48)(cid:48)1 p(cid:48)(cid:48)2 p(cid:48)(cid:48)3 p(cid:48)(cid:48)4 either p(cid:48)(cid:48)1 p(cid:48)(cid:48)2 = c or p(cid:48)(cid:48)2 p(cid:48)(cid:48)3 = c. One more edge must be attached to make the points unique. Then total number of nodes for the paths at the heavy node p0 will be at most 5 and the average density for the group will be at least 9 8 . 2 m+ 3 2 m+1 = 1 + 1 m+2 ≥ 9 1 2 1 Fig. 8. Heavy node of group B(a) with 2 paths of degree 2 nodes of length 3 and 1 path of degree 2 node of length 1. Now we consider the group with all the 3 paths of length 3. For this case the placement will not be unique (Fig. 9). For Fig. 9a there must be an edge at p1 or p2 of the path p0p1p2p3p4 to make p1 and p2 unambiguous. p0p1p2p01p02p03p04p001p002p003p004ccc 14 Md. Shafiul Alam and Asish Mukhopadhyay For Fig. 9b there must be an edge at p2 or p3 to make p2 and p3 unam- biguous. Similarly, there must be an extra edge for each of the other 2 paths p0p(cid:48)1p(cid:48)2p(cid:48)3p(cid:48)4 and p0p(cid:48)(cid:48)1 p(cid:48)(cid:48)2 p(cid:48)(cid:48)3 p(cid:48)(cid:48)4 . Thus, the reduced group consists of 3 degree 2 paths of maximum length 2. There will be at most 6 degree 2 nodes in the degree 2 maximal paths at the heavy node p0 and the average density for the group will be at least 9 8 . Similarly, for the group with 2 paths of length 3 and 1 path of length 2 we can show that there must be edges at the nodes of the paths that will make the total number of nodes in the degree 2 paths around the heavy node at most 6. So, the minimum average density for it will be 9 8 . Fig. 9. Heavy node of group B(a) with 3 paths of degree 2 nodes of length 3. It can be easily seen that for groups with other degree 2 paths attached the minimum average density will be 9 8 . Thus, the minimum of the av- erages for this type of groups is 9 8 . (b) Heavy nodes in G2 that are connected to at least one node of type A by at least one path of degree 2 nodes in G2: It is shown above that a maximal path of degree 2 nodes attached to 2 heavy nodes of type B does not contribute to reduce the average density of a group to lower than 9 8 . A heavy node of type B in G2 can be connected to a node of type A by a maximal path of degree 2 nodes in G2 in two ways based on whether the edge of the path incident on the type A node is in E1 or E2. If the edge is in E1 the length of the degree 2 path is 0, because type A nodes are found only in the maximal paths of degree 2 nodes in G1 where each end of a path is connected to a heavy node of type B in G1 by an edge from E1. For this case one half of each end edge is counted towards the density of its adjacent node of type B. This path will not contribute to reduce the density of the corresponding neighbourhood of type B nodes. p0p1p2p3p4p01p02p03p04p001p002p004p003p04p4p003p002p03p3p2p0p01p02p001(a)Apathp0p1p2p3p4ofdegree2nodesattachedtoaheavynodep0ofgroupahastwoconsecutiveedgesp0p1andp1p2fromE1atp0.(b)Apathp0p1p2p3p4ofdegree2nodesattachedtoaheavynodep0ofgroupadoesnothavetwoconsecutiveedgesfromE1atp0.p1p004 Point placement problem 15 2 ) = 5 4 > 9 2 (2 + 1 For the second case the maximum length of the maximal path of degree 2 nodes in G2 is 2 since one end of the maximal path is connected to a heavy node in G2 by an edge from E2 and since there can be at most 1 edge from E2 and at most 2 consecutive edges from E1 in a maximal path of degree 2 nodes in G2 containing edges from E1 and E2. The minimum average density of the nodes of this path is 1 8 . Also this path will not contribute to reduce the density of its corresponding neighbourhood of type B nodes to lower than 9 8 . So, we consider the heavy nodes of this group each of which has exactly 3 paths of degree 2 nodes in G2. If the group of nodes around a heavy node of type b has 2 degree 2 paths of length 3 attached to heavy nodes of type B and 1 path of degree 2 nodes attached to a heavy node of type A by an edge from E2 then each of the 3 paths will have an edge from E2. In a way similar to the case of group a nodes consisting of 3 paths of degree 2 nodes (Fig. 9) it can be shown that the reduced group will have density of at least 9 8 . For the group with 2 paths of length 3 being attached to heavy node of type B and the third path of length 0 being attached to node of type A by an edge from E1 the average density is 4 (4 + 1 1 8 . It can be easily checked that for all other combinations of the maximal paths the minimum average density for the groups of nodes will be at least 9 8 . 2 ) = 9 Thus, the minimum average density for all nodes in G2 will be 9 8 . (cid:117)(cid:116) References 1. M. S. Alam and A. Mukhopadhyay. A new algorithm and improved lower bound for point placement on a line in two rounds. In CCCG '10: Proceedings of the 22nd Canadian Conference on Computational Geometry, pages 229 -- 232, 2010. 2. F. Y. L. Chin, H. C. M. Leung, W.-K. Sung, and S.-M. Yiu. The point placement problem on a line - improved bounds for pairwise distance queries. In Proceedings of the Workshop on Algorithms in Bioinformatics, volume 4645 of LNCS, pages 372 -- 382, 2007. 3. P. Damaschke. Point placement on the line by distance data. Discrete Applied Mathematics, 127(1):53 -- 62, 2003. 4. P. Damaschke. Randomized vs. deterministic distance query strategies for point location on the line. Discrete Applied Mathematics, 154(3):478 -- 484, 2006. 5. B. Mumey. Probe location in the presence of errors: a problem from DNA mapping. Discrete Applied Mathematics, 104(1-3):187 -- 201, 2000. 6. J. Redstone and W. L. Ruzzo. Algorithms for a simple point placement problem. In CIAC'00: Proceedings of the 4th Italian Conference on Algorithms and Complexity, volume 1767 of LNCS, pages 32 -- 43, London, UK, 2000. Springer-Verlag. Md. Shafiul Alam and Asish Mukhopadhyay 16 A Lemma 5. The 7-cycle (p1, q1, r1, s, r2, q2, p2) of the 3-path basic component of Fig. 1 cannot be drawn as the layer graph of Fig. 3 if the edges of the component satisfy the following conditions: {p1p3 (cid:54)= p3q3 ± r3s,p1p3 (cid:54)= r3s,p3q3 ± sr2 (cid:54)= p2q2, p3q3 ± sr2 ± sr3 (cid:54)= p2q2} (1) Proof. We prove by contradiction. Assume that the edges of the component (Fig. 1) satisfy (1) but the 7-cycle (p1, q1, r1, s, r2, q2, p2) can be drawn as a layer graph as in Fig. 3. Then by Theorem 1 it is not line rigid. Clearly, a set of points cannot be line rigid if any non-empty subset is not line rigid and again by Theorem 1 must have a layer graph representation. Thus, the whole component must have a layer graph drawing. All possible layer graph drawings of the component in which the layer graph of Fig. 3 is embedded are as in Fig. 4. This implies that if the 7-cycle (p1, q1, r1, s, r2, q2, p2) of the component of Fig. 1 has a layer graph representation as in Fig. 3 then the whole component must have at least one of the 4 layer graph representations as shown in Fig. 4. Without loss of generality we assume that the component has a layer graph representation of Fig. 4(a). In the present configuration of the layer graph of the component p1, q1, r1 and s are on a line which is parallel to p2q2 and q3r3. So, we must have p1p3 = p3q3 ± r3s. This contradicts the first inequality of (1) which corresponds to the layer graph of the component in the present configuration. Hence, the whole compo- nent cannot be drawn as a layer graph when its 7-cycle (p1, q1, r1, s, r2, q2, p2) has a layer graph representation in the configuration of Fig. 3. In other words, in any layer graph representation (if any one is possible) of the whole component its 7-cycle (p1, q1, r1, s, r2, q2, p2) cannot have a layer graph representation in the configuration of Fig. 3. Consequently, the 7-cycle (p1, q1, r1, s, r2, q2, p2) of the component cannot be drawn as a layer graph in the configuration of Fig. 3. (cid:117)(cid:116) Point placement problem 17 B Lemma 6. A set S of 35 points is sufficient to ensure that the valences of any two points in S differ by at most 2. Proof. Initially, we have S0 = 35 and all other Si's are of size 0. After attaching the first 6 basic components we have S0 = 17 and S1 = 18. Now we attach components until S0 ≤ 9. This will attach at most 4 components. We have S0 ≤ 9 and S2 ≤ 4. The rest points are of valence 1, i.e., S1 ≥ 22. Next we attach components until S0 ≤ 2. This will attach at most 7 compo- nents. Then we have S0 ≤ 2 and S2 ≤ 18, and consequently, S1 ≥ 15. Again, we attach components until S0 = 0. This will attach at most 2 components. Then we have S0 = 0 and S3 ≤ 2, and consequently, S1 ∪ S2 ≥ 33. Thus, all the points in S have at most 3 consecutive valences, viz., 1, 2 and 3. At any point of time they may have at most 4 consecutive valences, viz., 0-3. We shall show that at any point of time the points in S will have at most 4 consecutive valences, and that at some point of time they will have at most 3 consecutive valences only. For this we use induction to show that if we start with points in S in 3 consecutiv valences d, d + 1 and d + 2, and attach the basic components according to our algorithm, then at some point of time they will have the next 3 valences d + 1, d + 2 and d + 3 only. We assume that Sd ∪ Sd+1 ≤ 18. Otherwise, we attach components until Sd ∪ Sd+1 ≤ 18. First, we consider the cases for which Sd ≤ 9. Then Sd+1 ∪ Sd+2 ≥ 26 with Sd ∪ Sd+1 ∪ Sd+2 = 35. We attach components until Sd = 0. For each new component, at least 1 point of Sd will be moved to Sd+1, and at most 2 points of Sd+2 will be moved to Sd+3. It is clear that at most 9 components will be attached, and that there will always be at least 19 points in Sd∪Sd+1∪Sd+2 until there is no point in Sd. We have Sd = 0, Sd+1 ∪ Sd+2 ≥ 17 and Sd+3 ≤ 18. Thus, the valences of all the points will become d + 1, d + 2 and d + 3. Now we consider the worst case for which Sd = 18 and Sd+1 = 0. They imply that Sd+2 = 17. We attach components until Sd ≤ 10. At most 4 components will be attached. We group all the possible situations into 2 subcases. First, we consider the subcase when 2 points are used from Sd for each new component. Exactly 4 components will be attached using 8 points from Sd. We have Sd = 10 and Sd+1 ≥ 5 with Sd ∪ Sd+1 ≥ 15, and Sd+3 ≤ 4. After attachment of 1 more component we have Sd ≤ 8 and Sd+1 ≥ 6 with Sd ∪ Sd+1 ≥ 14, and Sd+3 ≤ 5. Now we attach components until Sd ≤ 5. Clearly, at most 3 components will be attached, and we have Sd ≤ 5 and Sd+1 ≥ 3 with Sd ∪ Sd+1 ≥ 8 (because at most 6 valence d + 1 points will be raised to valence d + 2 points), and Sd+3 ≤ 8 (because at most 3 valence d + 2 points will be raised to valence d + 3 points). As long as there are at least 19 points in Sd ∪ Sd+1 ∪ Sd+2, all the 3 points of a new component will be chosen from that union. No points will be used from Sd+3, and hence no point's valence will be raised to d + 4. We attach components until Sd = 0. It is evident that at most 5 components will be attached, and we have Sd = 0, Sd+1 ∪ Sd+2 ≥ 17 and Sd+3 ≤ 18. 18 Md. Shafiul Alam and Asish Mukhopadhyay Now we consider the other subcase which consists of the remaining possible situations. For this case, 3 or 4 components will be attached. It can be easily seen that Sd ≤ 9 and Sd+1 ≥ 6 with Sd ∪ Sd+1 ≥ 15, and Sd+3 ≤ 3. We attach compnents until Sd ≤ 6. It can be easily checked that at most 3 components will be attached, and we have Sd ≤ 6 and Sd+1 ≥ 3 with Sd ∪ Sd+1 ≥ 9, and Sd+3 ≤ 6. We attach components until Sd = 0.It is evident that at most 6 components will be attached, and we have Sd = 0, Sd+1 ∪ Sd+2 ≥ 17 and Sd+3 ≤ 18. It can be easily shown that for all the other combinations of number of points in valences d and d+1 subject to a maximum of 18, all the points will be elevated to at most 3 consecutive valences d + 1, d + 2 and d + 3. The calculations will (cid:117)(cid:116) be similar to the above. Point placement problem 19 C Lemma 7. The number of nodes in any maximal path of degree 2 nodes in G2 is at most 3. Proof. If a maximal path of degree 2 nodes of G2 consists of edges from E1 only then by Step 3 of adversary its lenght is at most 3. Now we consider maximal path of degree 2 nodes of G2 that contains at least one edge from E2. In such a path there cananot be three consecutive edges from E1 because of S3. Suppose the number of degree 2 nodes in a maximal path is 4. Let the nodes be p1, p2, p3 and p4. Let p0 and p5 be heavy nodes adjacent to p1 and p4 respectively. Since any maximal path of degree 2 in G2 can have at most 2 consecutive edges from E1 we can have the following 5 combinations of the E1 and E2 type edges for the edges p0p1, p1p2, p2p3, p3p4 and p4p5: 1. E2, E1, E2, E1, E1 2. E2, E1, E1, E2, E1 3. E1, E2, E1, E2, E1 4. E1, E1, E2, E2, E1 5. E1, E1, E2, E1, E1 For combination 1, since there are two edges in E2 lengths of those edges can be set in such a way that p0p5 = p1p2 + p2p3 and p0p1 = p4p5 − p3p4, and the graph G2 becomes non-rigid (Fig. 10). Fig. 10. Maximal path of degree in G2 E2, E1, E2, E1, E1. combination of 2 edges for the Fig. 11. Maximal path of degree 2 in G2 for the combination of edges E1, E1, E2, E1, E1. Similarly, for combinations 2-4 the adversary can make the graph ambiguous. As for combination 5, the adversary can set p1p2 = p3p4 = c in the first round by S2 and can set the length of p2p3 in round 2 in such a way that p2p3 = p4p5 + p5p0 + p0p1 (Fig. 11). Then the cycle (p0, p1, p2, p3, p4, p5) (cid:117)(cid:116) will not be line rigid . p5p0p1p2p3p4E2E1E1E1E2p5p0p1p2p3p4E1E1E1E1E2
1310.4843
1
1310
2013-10-17T20:09:48
Scalable Boolean Tensor Factorizations using Random Walks
[ "cs.DS" ]
Tensors are becoming increasingly common in data mining, and consequently, tensor factorizations are becoming more and more important tools for data miners. When the data is binary, it is natural to ask if we can factorize it into binary factors while simultaneously making sure that the reconstructed tensor is still binary. Such factorizations, called Boolean tensor factorizations, can provide improved interpretability and find Boolean structure that is hard to express using normal factorizations. Unfortunately the algorithms for computing Boolean tensor factorizations do not usually scale well. In this paper we present a novel algorithm for finding Boolean CP and Tucker decompositions of large and sparse binary tensors. In our experimental evaluation we show that our algorithm can handle large tensors and accurately reconstructs the latent Boolean structure.
cs.DS
cs
Scalable Boolean Tensor Factorizations using Random Walks D´ora Erdos∗ Pauli Miettinen† June 10, 2021 Abstract Tensors are becoming increasingly common in data mining, and con- sequently, tensor factorizations are becoming more and more important tools for data miners. When the data is binary, it is natural to ask if we can factorize it into binary factors while simultaneously making sure that the reconstructed tensor is still binary. Such factorizations, called Boolean tensor factorizations, can provide improved interpretability and find Boolean structure that is hard to express using normal factorizations. Unfortunately the algorithms for computing Boolean tensor factorizations do not usually scale well. In this paper we present a novel algorithm for finding Boolean CP and Tucker decompositions of large and sparse binary tensors. In our experimental evaluation we show that our algorithm can handle large tensors and accurately reconstructs the latent Boolean structure. 1 Introduction Tensors, and their factorizations, are getting increasingly popular in data mining. Many real-world data sets can be interpreted as ternary (or higher arity) relations (e.g. sender, receiver, and date in correspondence or object, relation, and subject in RDF data bases or natural language processing). Such relations have a natural representations as 3-way (or higher order) tensors. A data miner who is interested in finding some structure from such a tensor would normally use tensor decomposition methods, commonly either CANDECOMP/PARAFAC (CP) or Tucker decomposition (or variants thereof). In both of these methods, the goal is to (approximately) reconstruct the input tensor as a sum of simpler elements (e.g. rank-1 tensors) with the hope that these simpler elements would reveal the latent structure of the data. The type of these simpler elements plays a crucial role on determining what kind of structure the decomposition will reveal. For example, if the elements ∗Boston University, Boston, MA, USA †Max-Planck-Institut fur Informatik, Saarbrucken, Germany 1 contain arbitrary real numbers, we are finding general linear relations; if the numbers are non-negative, we are finding parts-of-whole representations. In this paper, we study yet another type of structure: that of Boolean tensor factorizations (BTF). In BTF, we require the data tensor to be binary, and we also require any matrices and tensors that are part of the decomposition to be binary. Further, instead of normal addition, we use Boolean or, that is, we define 1 + 1 = 1. The type of structure found under BTF is different to the type of structure found under normal algebra (non-negative or otherwise). Intuitively, if there are multiple "reasons" for a 1 in the data, under normal algebra and non-negative values, for example, we explain this 1 using a sum of smaller values, but under Boolean algebra, any of these reasons alone is sufficient, and there is no penalty for having multiple reasons. For a concrete example, consider a data that contains noun phrase -- verbal phrase -- noun phrase patterns extracted from textual data. Underlying this data are the true facts: which entities are connected to which entities by which relations. We see the noun phrase -- verbal phrase -- noun phrase (n1, v, n2) triple if 1) there is a fact (e1, r, e2), that is, entity e1 is connected to entity e2 via relation r; and 2) n1 is one of the phrases for e1, n2 is a phrase for e2, and v is a phrase for r. It does not matter if there is a different "core triple" (e(cid:48) 2) that could also generate the same observed triple as long as there is at least one of them. This kind of model is exactly the Boolean Tucker decomposition (see Section 3), and we will show in the experiments (Section 5) how it performs in this type of data. 1, r(cid:48), e(cid:48) We want to emphasize that we do not consider BTF as a replacement of other tensor factorization methods even if the data is binary. Rather, we consider it as an addition to the data miner's toolbox, letting her to explore another type of structure. But how do we find a Boolean factorization of a given tensor? There exists algorithms for BTF (e.g. [1, 11, 13]), but they do not scale well. Our main contribution in this paper is to present a scalable algorithm for finding Boolean CP and Tucker decompositions. Further, we apply the minimum description length principle to automatically select the size of the decomposition. Our algorithm can be divided into many phases. The main work is done by the Walk'n'Merge algorithm (Section 3), but to obtain proper Boolean CP or Tucker decomposition, we need to apply some post-processing to the output of Walk'n'Merge (explained in Section 4). We present our experiments in Section 5 and discuss related work in Section 6. Before all of this, however, we present some important definitions. 2 Definitions Before we can present our algorithm, we will explain our notation and formally define the tensor factorization problems we are working with. At the end of this section, we introduce two important concepts, blocks and convex hulls, that will be used extensively in the algorithm 2 2.1 Notation Throughout this paper vectors are indicated as bold-face lower-case letters (v), matrices as bold-face upper-case letters (M ), and tensors as bold-face upper-case calligraphic letters (T ). We present the notation for 3-way tensors, but it can be extended to N -way tensors in a straight forward way. Element (i, j, k) of a 3-way tensor X is denoted either as xijk or as (X )ijk. A colon in a subscript denotes taking that mode entirely; for example, if X is a matrix, xi: denotes the ith row of X (for a shorthand, we use xj to denote the jth column of X). For a 3-way tensor X , x:jk is the (j, k) mode-1 (column) fiber, xi:k the (i, k) mode-2 (row) fiber, and xij: the (i, j) mode-3 (tube) fiber. Furthermore, X ::k is the kth frontal slice of X . We use X k as a shorthand for the kth frontal slice. For a tensor X , the number of non-zero elements in it is denoted by X. ijk. If X The Frobenius norm of a 3-way tensor X , (cid:107)X(cid:107), is defined as is binary, i.e. takes values only from {0, 1}, X = (cid:107)X(cid:107)2. The tensor sum of two n-by-m-by-l tensors X and Y is the element-wise sum, (X + Y)ijk = xijk + yijk. The Boolean tensor sum of binary tensors X and Y is defined as (X ∨ Y)ijk = xijk ∨ yijk. The outer product of vectors in N modes is denoted by (cid:2). That is, if a, b, and c are vectors of length n, m, and l, respectively, X = a (cid:2) b (cid:2) c is an n-by-m-by-l tensor with xijk = aibjck. A tensor that is an outer product of three vectors has tensor rank 1. Finally, if X and Y are binary n-by-m-by-l tensors, we say that Y contains X if xijk = 1 implies yijk = 1 for all i, j, and k. This relation defines a partial order of n-by-m-by-l binary tensors, and it is therefore understood that when we say that X is the smallest n-by-m-by-l binary tensor for which some property P holds, we mean that there exists no other n-by-m-by-l binary tensors for which P holds and that are contained in X . (cid:113)(cid:80) i,j,k x2 2.2 Ranks and Factorizations With the basic notation explained, we first define the CP decomposition and tensor rank under the normal algebra, after which we explain how the Boolean concepts differ. After that we define the Boolean Tucker decomposition. Tensor Rank and CP Decomposition. The so-called CP factorization,1 we are studying in this paper is defined as follows Problem 1 (CP decomposition). Given tensor X of size n-by-m-by-l and an integer r, find matrices A (n-by-r), B (m-by-r), and C (l-by-r) such that they minimize ai (cid:2) bi (cid:2) ci . (1) (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)X − r(cid:88) i=1 (cid:13)(cid:13)(cid:13)(cid:13)(cid:13)2 1The name is short for two names given to the same decomposition: CANDECOMP [2] and PARAFAC [7]. 3 Notice that the ith columns of the factor matrices A, B, and C define a rank-1 tensor ai (cid:2) bi (cid:2) ci. In other words, the CP decomposition expresses the given tensor as a sum of r rank-1 tensors. Using the CP decomposition, we can define the tensor rank analogous to the matrix (Schein) rank as the smallest r such that the tensor can be exactly decomposed into a sum of r rank-1 tensors. Note that, unlike the matrix rank, computing the tensor rank is NP-hard [8]. The Boolean Tensor Rank and Decompositions. The Boolean versions of tensor rank and CP decomposition are rather straight forward to define given their normal counterparts. One only needs to change the summation to 1 + 1 = 1. Notice that this does not change the definition of a rank-1 tensor (or vector outer product). Thence, a 3-way Boolean rank-1 tensor is a tensor that is an outer product of three binary vectors. Definition 1 (Boolean tensor rank). The Boolean rank of a 3-way binary tensor X , rankB(X ), is the least integer r such that there exist r rank-1 binary tensors with X = ai (cid:2) bi (cid:2) ci . (2) r(cid:95) i=1 The Boolean CP decomposition follows analogously. Instead of subtraction, we take the element-wise exclusive or (denoted by ⊕), and instead of sum of squared values, we simply count the number of non-zero elements in the residual. Note, however, that with all-binary data, our error function is equivalent to the squared Frobenius error. Problem 2 (Boolean CP decomposition). Given an n-by-m-by-l binary tensor X and an integer r, find binary matrices A (n-by-r), B (m-by-r), and C (l-by-r) such that they minimize (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)X ⊕ (cid:32) r(cid:95) i=1 (cid:33)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) . ai (cid:2) bi (cid:2) ci (3) Analogous to the normal CP decomposition, the Boolean CP decomposition can be seen as a (Boolean) sum of r binary rank-1 tensors. Unsurprisingly, both finding the Boolean rank of a tensor and finding its minimum-error rank-r Boolean CP decomposition are NP-hard [13]. Boolean Tucker decompositions. Given a (binary) tensor, its Tucker decomposition contains a core tensor and three factor matrices. The number of rows in the factor matrices are defined by the dimensions of the original tensor while the number of columns in them are defined by the dimensions of the core tensor. In case of the Boolean Tucker decomposition, all involved tensors and matrices are required to be binary, and the arithmetic is again done over the Boolean semi-ring. The Boolean Tucker decomposition is defined formally as follows. Problem 3 (Boolean Tucker decomposition). Given an n-by-m-by-l binary tensor X = (xijk) and three integers p, q, and r, find the minimum-error (p, q, r) 4 Figure 1: Tucker tensor decomposition. Boolean Tucker decomposition of X , that is, tuple (G, A, B, C), where G is a p-by-q-by-r binary core tensor and A (n-by-p), B (m-by-q), and C (l-by-r) are binary factor matrices, such that (G, A, B, C) minizes  . gαβγ aiαbjβckγ (4) xijk ⊕  p(cid:95) (cid:88) i,j,k q(cid:95) r(cid:95) α=1 β=1 γ=1 For a schematic view of Tucker decomposition, see Figure 1. 2.3 Blocks, Convex Hulls, and Factorizations Let X be a binary n-by-m-by-l tensor and let X ⊆ [n], Y ⊆ [m], and Z ⊆ [l], where [x] = {1, 2, . . . , x}. A block of X is a X -by-Y -by-Z sub-tensor B that is formed by taking the rows of X defined by X, columns defined by Y , and tubes defined by Z. Block B is monochromatic if all of its values are 1. We will often (implicitly) embed B to n-by-m-by-l tensor by filling the missing values with 0s. If B is monochromatic it is (embedded or not) a rank-1 tensor. If B is not monochromatic, we say it is dense. Now let the sets I, J, and K be such that they contain the indices of all the non-zero slices of X . That is, I = {i : xijk = 1 for some j, k}, J = {j : xijk = 1 for some i, k}, and K = {k : xijk = 1 for some i, j}. The convex hull of X is a binary n-by-m-by-l tensor Y that has 1 in every position defined by the Cartesian product of I, J, and K, I × J × K = {(i, j, k) : i ∈ I, j ∈ J, k ∈ K} . The following lemma will explain the connection between monochromatic blocks (rank-1 tensors) and convex hulls. We utilize this lemma throughout our algorithms by searching for convex blocks rather than explicitly rank-1 tensors in the data. Lemma 1. Let X be a binary n-by-m-by-l tensor. Then the convex hull of X is the smallest n-by-m-by-l rank-1 binary tensor that contains X . 5 XGABC⇡ Proof. Let us start by showing that the convex hull of X is indeed a rank-1 tensor. To that end, let I, J, and K be the sets of indices of slices of X that have 1s in them (i.e. I = {i : xijk = 1 for some j, k} and similarly for J and K). If Y is the convex hull of X , by definition yijk = 1 if and only if (i, j, k) ∈ I × J × K. Let us now define three binary vectors, a, b, and c (of dimensions n, m, and l, respectively). Let ai = 1 if and only if i ∈ I, bj = 1 if and only if j ∈ J, and ck = 1 if and only if k ∈ K. Then the outer product a (cid:2) b (cid:2) c has 1 at position (i, j, k) if and only if (i, j, k) ∈ I × J × K, that is Y = a (cid:2) b (cid:2) c. That Y contains X is straight forward to see. This means we only have to prove that there exists no other tensor that is rank-1, contains X , and is contained in Y. Assume, for a contradiction, that Z (cid:54)= Y is such. Then, it has to be that there is a location (i, j, k) for which xijk = zijk = 0 but yijk = 1. As Z is rank-1, we can represent it as Z = a (cid:2) b (cid:2) c for some a, b, and c. As zijk = 0, it must be that aibjck = 0, that is, one of the three elements is 0. Let ck = 0 (other cases are analogous). This means that the slice Z::k is empty. As Z contains X , also X ::k must be empty. But this is a contradiction, as yijk = 1 only if k ∈ K, and therefore X ::k cannot be empty. As a corollary to Lemma 1 we get that X is rank-1 if and only if it is its own convex hull. Blocks and factorizations. The key observation underlying our algorithms is the fact that both the CP as the Tucker decomposition can be thought of as a decomposition of the data tensor X into some combination of rank-1 sub-tensors. While this is obvious in case of the CP decomposition, it is also easy to see for the Tucker: every triplet of factors a.α, b.β, and c.γ where gαβγ is non-zero defines such a rank-1 tensor. The main idea of our algorithm, which we will explain next, is to find dense blocks from the input data, construct their convex hulls, and build the Boolean CP or Tucker factorization from the resulting rank-1 tensors. 3 The Walk'n'Merge Algorithm In this section we present the main part of our algorithm, Walk'n'Merge, that aims to find the dense blocks from which we build the factorizations (how that is done is explained in the next section). The Walk'n'Merge algorithm contains two phases. The first phase, RandomWalk, aims at finding and removing the most prominent blocks quickly from the tensor. The second phase, BlockMerge, uses these blocks together with smaller, easier-to-find monochromatic blocks and tries to merge them into bigger blocks. 3.0.1 Random walk algorithm In this phase we represent the tensor X with a graph G(V, E) that is defined as follows. For every xijk = 1 we have a node vijk ∈ V . Two nodes vijk and vpqr are connected by an edge (vijk, vpqr) if (i, j, k) and (p, q, r) differ in exactly one coordinate. 6 Algorithm 1 Random walk algorithm to find blocks. Input: X , d, walk length, num walks, freq Output: B1,B2 . . .Bk 1: create graph G(V, E) from X 2: while V is not empty do 3: 4: 5: 6: v ← random node from V visitedNodes ← (v, countv = 1) for num walks number of times do vvis ← random node from visitedNodes for walk length number of times do v(cid:48) ← random neighbor of vvis visitedNodes ← (v(cid:48), countv(cid:48) + +) B ← empty block for v ∈ visitedNodes do if countv > freq then V \ convex hull(B) block B is the convex hull of nodes in B if density of B > d then add B to blocks B ← v 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: return blocks d Observe that a node vijk is connected to all nodes in V that are in the same fiber as vijk in any mode of X . Moreover, a monochromatic block in X corresponds to a subgraph of G with radius at most 3. In case of noisy data, blocks are not perfectly monochromatic and some of the nodes in V might be missing. Still, if the blocks are fairly dense, the radius of the corresponding subgraph is not too big. More precisely, if vijk is a node that participates in a block of density d, the probability of a random neighbor of vijk also participating d+d(cid:48) , where d(cid:48) is the density of the full tensor. This observation in that block is implies that if the blocks are significantly denser than the noisy part of a tensor, then a random neighbor of a node inside block B is with high probability also in B. Our first algorithm exploits this property by performing short random walks in G. The intuition is that if such a walk hits a node in a block, then with high probability the consecutive hops in this walk are also hitting the block. The pseudo code for our RandomWalk algorithm is given in Algorithm 1. RandomWalk takes as an input the data tensor X and parameters controlling the length and number of the random walks, and the minimum density of the resulting blocks. After creating the graph G(V, E) it finds a block B in every iteration of the algorithm by means of executing random walks. Nodes that have been assigned to B are removed from V , resulting in a smaller graph G(cid:48)(V − VB, E(cid:48)) on which the subsequent random walks are executed. The block B is found by way of executing a number of random walks on G. The first walk is initiated from a random node in V . For every node we maintain 7 a counter for the number of times any of the walks has visited that node. For any consecutive walk, we pick a random starting point among those nodes that already have a positive counter. This ensures that once we hit a block B with a walk, the consecutive walks start with higher and higher probability from within that block. The length of the walks is given as an input to the algorithm. In order to traverse as big part of B as possible, we make many short walks. Since we know that nodes corresponding to a dense block B have with high probability a higher visit count than nodes corresponding to noise, we abandon all nodes with visit counts less than the average. In order to make sure that the block we find is a rank-1 tensor (and to include those nodes we might have missed in the random walk), we take B to be the convex hull of the discovered frequent nodes. Finally, we accept B only if it has density above a user-specified threshold d. Before proceeding with the next iteration of RandomWalk we remove all nodes corresponding to B, regardless of whether B was accepted. Running time of RandomWalk. The crux of this algorithm is that the running time of every iteration of the algorithm is fixed and depends only on the number and length of the walks. How often we have to re-start the walks depends on how quickly we remove the nodes from the graph, but the worst-case running time is bound by O(V ) = O(X). However, if X contains several dense blocks, then the running time is significantly less, since all nodes corresponding to cells in the block are removed at the same time. Paralellization. RandomWalk is easily parallellizable, as we can start the random walk iterations (in Line 3 in Algorithm 1) from several (non-neighboring) nodes at the same time. In this case it may happen that some indices are chosen in multiple blocks. We don't mind that (as X may contain partially overlapping blocks) and simply return all resulting blocks. 3.0.2 BlockMerge Algorithm The RandomWalk algorithm is a fast method, but it is only able to reliably find the most prominent blocks. If a block is too small, the random walks might visit it as a part of a bigger sparse (and hence rejected) block. It can also happen that while most part of a block is found by RandomWalk, due to the randomness in the algorithm, some of its slices are not discovered. Therefore we present the second part of our algorithm, BlockMerge, that executes two tasks. First it finds smaller monochromatic blocks that for some reason are undiscovered. After finding the smaller blocks, the algorithm has a merging phase, where it tries to merge some of the newly found blocks and the dense blocks found by the RandomWalk algorithm. The output of BlockMerge is a set of dense blocks. The BlockMerge algorithm is akin to normal bottom-up frequent itemset mining algorithms in that it starts with elementary blocks and advances by merging these elementary blocks into bigger blocks, although without the benefit of anti-monotonicity. 8 The input for BlockMerge is the same data tensor X given to the Ran- domWalk algorithm, the blocks already found, and the minimum density d. As its first step, the algorithm will find all non-trivial monochromatic blocks of X that are not yet included in any of the blocks found earlier. A monochromatic block is non-trivial if its volume and dimensions are above some user-defined thresholds (e.g. all modes have at least 2 dimensions). We find these non-trivial blocks in a greedy fashion. We start with singletons: elements xijk = 1 that do not belong into any block. We pick one of them, xijk, and find all singletons that share at least one coordinate with it. Among these singletons we do an exhaustive search to find all monochromatic non-trivial blocks containing xijk. As a result, for every cell that is included in a non-trivial block in X , we find at least one monochromatic block it is included in, but we may not find all of them. In our implementation we maintain some practical data indices based on the coordinates defining the cells xijk so that looking up neighbors of a cell takes at most O(n + m + l) time. Since the singleton blocks that remain after the initialization step could not be incorporated in any of the non-trivial blocks, we regard them as noise, and will not consider them for merging to any other block. The second part of the BlockMerge algorithm is to try and merge the remaining blocks so that we get larger (usually not monochromatic, but still dense) blocks. Each block B is defined by three sets of indices, I, J, and K, giving the row, column, and tube indices of this block. When we merge two blocks, B and C, with indices given by (IB, JB, KB) and (IC, JC, KC), respectively, the resulting block B (cid:1)C has its indices given by (IB ∪ IC, JB ∪ JC, KB ∪ KC). (This is equivalent on taking the convex hull of B ∨ C, ensuring again that the block is rank-1.) The way we merge two blocks means that the resulting block can, and typically will, include elements that were not in either of the merged blocks. Therefore, when deciding whether to merge two blocks, we must look how well we do in those areas that are not in either of the blocks. To that end, we will again employ the user-defined density parameter d. We will only merge two blocks if the joint density of 1s and elements already included in the other blocks in the area not in either of merged blocks is higher than d. To present the above consideration more formally, let A and B be the two blocks we are currently considering to merge. A ∨ B = (A (cid:1) B) \ (A ∪ B) is the area (monochromatic sub-tensor) in A (cid:1) B that is not in either A or B, and what we compute is the density of 1s in(cid:87)R D1,D2, . . . ,DR are the rest of the non-trivial blocks we have build so far, then r=1 Dr ∨ X in those locations that (cid:0)(A ∨ B)ijk((cid:87)R are 1s in A ∨ B, that is,(cid:80) (cid:80) r=1 Dr ∨ X )ijk i,j,k(A ∨ B)ijk of X after X and Y are merged will be(cid:87)R The reason for including the other blocks Dr in the equation is that we do not want to pay multiple times for the same error. Recall that our representation r=1 Dr ∨ (X (cid:1) Y), and hence, if we already have expressed some 0 of X by 1 in one of the Dr's, this error is already (5) i,j,k (cid:1) . 9 done, and cannot be revoked. Similarly, whatever error we will do in X or Y, we will still do in X (cid:1) Y, and therefore we only consider the area not included in either of the merged tensor. Now the only remaining question is how to select which blocks to merge. A simple answer would be to try all possible pairs and select the best. That, however, would require us to compute quadratic number of possible merges, which in practice is too much. Instead we restrict our attention to pairs of blocks that share coordinates in at least one mode, that is, if (IB, JB, KB) and (IC, JC, KC) are as above, we would consider merging B and C only if at least one of the sets IB ∩ IC, JB ∩ JC, or KB ∩ KC is non-empty. We call a pair of blocks for which IB ∩ IC = JB ∩ JC = KB ∩ KC = ∅ independent. It is worth asking will this restriction mean we will not find all the meaningful blocks. We argue that it does not. The intuition is the following. Let B and C be the two blocks we should merge but that are independent and let their index sets be as above. If we would merge them, the majority of the volume of the new block would be outside of B or C ((IB + IC)(JB + JC)(KB + KC) − IBJBKB − ICJCKC, to be exact). If this area is very sparse, then so will be the whole block, and we should not have merged the two original block, after all. But if parts of that area are dense, we should find there another block that shares co-ordinates with both B and C. If that block is large and dense enough, we will merge it with either B or C, at which point these two blocks do share co-ordinates, and we will consider them for merging. This, then, is how we proceed: for every block, count how good a merge it would be with every other block with shared coordinates, select the best merge and execute it, put the merged block back at the bottom of the list of blocks to consider and pick up the next block from the list until no new merges are possible. This means that we execute as many merges as possible in a single sweep of the list of the blocks, as opposed to making a merge and starting again from the begin of the list, as we consider this the faster way to perform the merges. An overview of the whole merging algorithm is presented in Algorithm 2. This part of the algorithm can be implemented parallel as well; first pick a block B and choose all blocks that share a cell with B. These blocks are the candidates to merge with B in this iteration. Now, among the remaining blocks that are not candidates we choose another B(cid:48) and find the candidates for B(cid:48). We repeat this until there are no unchosen blocks left. The processing of the candidate lists to find potential merges can then be executed in parallel. Observe that the set of candidates for different blocks may overlap. We don't regard this as a problem and if this happens, then (provided density constraints are met) the block is simply merged to multiple blocks. Parallelization. The merging phase of the BlockMerge algorithm can easily be parallelized as well. Since we only merge blocks that are not independent, it is an obvious choice to parallelize the merging procedure of independent blocks. In every iteration we find a maximal set of independent blocks in a greedy fashion; we pick a block B1, then we pick a block B2 from those that are independent of B1, etc. We then consider possible merges for B1,B2 . . . with the remaining blocks in parallel. Note that any block can be considered for merge in more 10 Algorithm 2 BlockMerge algorithm for merging blocks. Input: Data X , threshold d, blocks B = {B1,B2, . . . ,Br} from random walk Output: Final blocks B1,B2 . . .Bk 1: find all non-trivial monochromatic blocks B of size at least 2-by-2-by-2 not 2: for B is a non-trivial monochromatic block do included in blocks in B add B to B 3: 4: let Q be a queue of all the blocks in B 5: while Q is not empty do 6: 7: 8: B ← Q.pop for all C that shares co-ordinates with B in at least one mode do compute the density of B (cid:1) C if density > d then Q.push(B (cid:1) C) replace B and C in B with B (cid:1) C break 9: 10: 11: 12: 13: return B than one of the threads and as a result may end up being merged with several different blocks. Running time of the BlockMerge algorithm. Let the densest fiber in X have b = max{n, m, l} × d ones. Observe that any nontrivial monochromatic block is defined exactly by 2 of its cells. Thus for a cell xijk we can compute all nontrivial monochromatic blocks containing it in b2 time by checking all blocks defined by pairs of ones in fibers i, j and k. This checking takes constant time. Hence, the first part of the algorithm takes O(Bb2) time if there are B trivial blocks in the data. In worst case B = X. The second part of the algorithm is we will try at most(cid:0)D (cid:1) merges. The time it takes to check whether to merge the actual merging of blocks. If there are D blocks at the begin of this phase, depends on the size of the two blocks involved. Executing the merge A = B (cid:1) C takes at most A time. In worst case A = X. As a result, a very crude upper bound on the running time can be given as O(X(b2 + D3)). 4 From Blocks to Factorizations 2 The Walk'n'Merge algorithm only returns us a set of rank-1 tensors, corre- sponding to dense blocks in the original tensor. To obtain the final decomposi- tions, we will have to do some additional post-processing. 4.1 Ordering and Selecting the Final Blocks for the CP- decomposition We can use all the blocks returned by Walk'n'Merge to obtain a Boolean CP factorization. The rank of this factorization, however, cannot be controlled, as 11 it is the number of blocks Walk'n'Merge returned. Furthermore, it can be that it is better to not use all these blocks but only a subset of them. Ideally, therefore, we would like to be able to select a subset of the blocks such that together they give the CP-decomposition that minimizes the error. It turns out, however, that even this simple selection task is computationally very hard. Proposition 4.1. Given a binary n-by-m-by-l tensor X , and a set B of r binary rank-1 tensors of the same size (blocks), B = {B1,B2, . . . ,Br}, it is NP-hard to select B∗ ⊂ B such that (6) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) B (cid:95) B∈B∗ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)X ⊕ 2(4 log r)1−ε(cid:17) (cid:16) is minimized. Furthermore, for any ε > 0, it is quasi-NP-hard to approxi- mate (6) to within Ω and NP-hard to approximate it to within (cid:16) 2log1−εX(cid:17) . Ω (cid:16) 2(4 log r)1−ε(cid:17) Proof. For the proof, we need the following result: Consider the Basis Usage (BU) problem [14], where we are given a binary n-dimensional vector a and a binary n-by-r matrix B, and the task is to find a binary r-dimensional vector x such that we minimize the Hamming distance between a and B ◦ x (where ◦ is the matrix product with Boolean addition). This problem is NP-hard to and quasi-NP-hard to approximate within approximate within Ω 2log1−εX(cid:17) (cid:16) [12]. Ω The BU problem is equivalent to the problem of selecting the blocks: Take the tensor X and write it as a long (nml-dimensional) binary vector. This will be the vector a of the BU problem. Vectorize the blocks in B in the same way; these will be the columns of B in the BU problem. Now, the Boolean product B◦ x is equivalent to taking those columns of B for which the corresponding row of x is 1 and taking their Boolean sum. But this is the same as selecting some of the blocks in B and taking their Boolean sum. Furthermore, the error metrics are the same (number of element-wise disagreements). This shows that we can reduce the block selection problem to the BU problem. For the other direction it suffices to note that a vector is a tensor, and therefore, the BU problem is merely a special case of the block selection problem. Given Proposition 4.1, we cannot hope for always finding the optimal solution. But luckily the same proposition also tells us how to solve the block selection problem given that we know how to solve the BU problem. Therefore we will use the greedy algorithm proposed in [14]: We will always select the block that has the highest gain given the already-selected blocks. The gain of a block is defined as the number of not-yet-covered 1s of X minus the number of not-yet-covered 0s of X covered by this block, and an element xijk is covered if bijk = 1 for some already-selected block. The greedy algorithm has the benefit that it gives us an ordering of the blocks, so that if the user wants a rank-k decomposition, we can simply return the first k blocks, instead of having to re-compute the ordering. 12 4.2 The MDL Principle and Encoding the Data for the CP decomposition The greedy algorithm in the previous section returns an ordering of the columns of matrices A, B and C of the CP-decomposition. However, this still does not tell us the optimal rank of the decomposition. In order to choose the best rank r for the decomposition we apply the Minimum Description Length (MDL) principle [17] to the encoding of the obtained decomposition. In this section we explain how this is done. Minimum Description Length Principle. The intuition behind the MDL principle is that the best model is the one that allows us to compress the data best. For our application that means that we should choose the rank r of the CP decomposition in such a way that the size of the resulting compression is minimal. To compute the encoding length of the data, we use the two-part (or crude) MDL: if D is our data (the data tensor) and M is a model of it (often called hypothesis in the MDL literature), we aim to minimize L(M) + L(D M), where L(M) is the number of bits we need to encode M and L(D M) is the number of bits we need to encode the data given the model M. In our application, the model M is the Boolean CP decomposition of the data tensor. As MDL requires us to explain the data exactly, we also need to encode the differences between the data and its (approximate) decomposition; this is the D M part. The intuition of using the MDL principle lies in the following simple observa- tion: When we move from the rank-r to the rank-(r + 1) decomposition defined by A (cid:2) B (cid:2) C two things happen. First, the size of the factor matrices increases (and so does L(M)). Second, (hopefully) the reconstruction error decreases (and so does L(D M)). Hence our goal is to find the rank r where the trade off between the encoding of M and L(D M) is optimal. We will now explain how we compute the encoding length. For this, we modify the Typed XOR Data-to-Model encoding for encoding Boolean matrix factorizations [15]. But first, let us emphasize two details. First, we are not interested on the actual encoding lengths; rather, we are interested on the change on the encoding lengths between two models. We can therefore omit all the parts that will not change between two models. Second, we are not interested on creating actual encodings, only computing the encoding lengths. We are therefore perfectly happy with fractional bits and will omit the rounding to full bits for the sake of simplicity. Also, the base of the logarithm does not matter (as long as we use the same base for all logarithms); the reader can consider all the logarithms in this chapter taken on base 2. We will first explain how to encode the model M, that is, the tuple (A, B, C) that defines a Boolean CP decomposition of a 3-way binary tensor. The first thing we need to encode is the size of the original tensor, n, m, and l and the rank r of the decomposition. For this, we can use any universal code for nonnegative integers, such as the Elias Delta code [5], taking Θ(log x + 2 log log x) bits per integer x. In practice we can omit the numbers n, m, and l and only compute 13 the length of r, as the former do not change between two decompositions of the same data tensor. We encode the factor matrix A (other factor matrices follow analogously). We note first that the size of A has already been encoded in the size of the data tensor and r. Let us assume A has r factors (i.e. columns) and n rows. We encode each factor ai (which is just a binary vector) separately by enumerating over all n-dimensional binary vectors with ai 1s in some fixed order, and storing just the index of the vector we want to encode in this enumeration. As there are (cid:1) such binary vectors, storing this index takes log(cid:0) nai (cid:1) bits. (Note that we (cid:0) nai do not need to do the actual enumeration, as we only need to know the number factor takes log(cid:0) nai (cid:0) nai (cid:1) . of bits storing the number would take.) To be able to reverse this computation, we need to encode the number ai; this takes log n bits, and so in total a single With the length of encoding the model computed, we still need to compute L(D M), that is, the difference between the approximation induced by the (cid:1) + log n bits and the whole matrix p log n +(cid:80)p i=1 decomposition and the actual data. Following [15], we split this difference into two groups: false positives (elements that are 1 in the approximation but 0 in the data) and false negatives (elements that are 0 in the approximation but 1 in the data). We can represent the false positives using a binary n-by-m-by-k tensor F + that has 1 in each of the positions that are false positives in the approximation and 0 elsewhere. We can encode this tensor by unfolding it into a long binary vector and using the same approach we used to encode the factors. The size of the tensor has already been encoded (it is the same size as the data). The naıve upper bound to the number of 1s in F + is nmk, but in fact we know that we can only make a false positive if the approximation is 1. Therefore, if the number of 1s in the approximation is (cid:101)D, we can encode the number of 1s in F + using log(cid:101)D bits. Using the same numbering scheme as above, we still need log(cid:0)nmk upper bound for 1s is nmk − (cid:101)D. In summary we have that L(D M) is (cid:1) bits to encode the contents of the tensor. + log(nmk − (cid:101)D) + log log(cid:101)D + log We can encode the false negative tensor F− analogously, except that the F + (cid:18)nmk (cid:19) F + (cid:18)nmk (cid:19) F− . Having the encoding in place, we can simply compute the change of description length for every rank 1 ≤ r ≤ B and return r where this value is minimized. The corresponding (truncated) matrices A, B and C are the factors of the final CP decomposition that our algorithm returns. 4.3 Encoding the Data for the Tucker decomposition Similar to obtaining a CP decomposition from the blocks returned by Walk'n'- Merge these blocks also define a trivial Tucker decomposition of the same tensor. The factor matrices A, B and C are defined the same way as for the CP. The core G of the Tucker decomposition is a B-by-B-by-B size tensor with ones in its hyperdiagonal. 14 Our goal is to obtain a more compact decomposition starting from this trivial one by merging some of the factors and adjusting the dimensions and content of the core accordingly. We want to allow the merge of two factors even if it would increase the error slightly. But how to define when error is increasing too much and merge should not be made? To solve that problem, we again use the MDL principle. Encoding the Boolean Tucker decomposition. The model M we want to encode is the Boolean Tucker decomposition of the data tensor, that is, a tuple (G, A, B, C). Encoding the size of the data tensor as well as the content of the factor matrices is done in the same way as for the CP decomposition. As the size of the core tensor determines the size of the factor matrices, we do not need to encode it separately. To encode the core tensor, we ned to encode its dimensions p, r, and q. For this, we again use the Elias delta coding. The actual core we encode similarly to how we encoded the error tensors with the CP factorization, that is, we unfold the core into a long binary vector and encode that vector using its index in the enumeration. This takes log pqr + log(cid:0)pqrG (cid:1) bits. Again, remember that we do not need to compute the actual index, only how many bits storing it would take. Finally the positive and negative error tensors are identical to the ones in the CP decomposition and hence are encoded in the same way. Applying the MDL principle. Given the encoding scheme we can use a straight forward heuristic to obtain the final Tucker decomposition starting from the trivial one determined by the output of Walk'n'Merge. In every mode and for every pair of factors we compute the description length of the resulting decompositions if we were to merge these two factors. Ideally we would compute all possible merging sequences and pick the one with the highest overall gain in encoding length. This is of course infeasible, hence we follow a greedy heuristic and apply every merge that yields an improvement. An overview of this procedure is given in Algorithm 3. We use the notation mdl(G, A, B, C) to indicate the encoding length of a Tucker decomposition. mdl(G, A, B, C, f1, f2) indicates the encoding length if factors f1 and f2 would be merged. One question is what the merged factor should be. Let us assume we are considering merging factors f1 and f2. Trivial solutions would be to either take the union (f1 ∪ f2) or the intersection (f1 ∩ f2) of the indices in the two factors. We found that both approaches perform poorly. Instead we apply a greedy heuristic that makes a decision for every index in the union. The basis of the merged factor is f1 ∩ f2. If the intersection of the factors is empty, we move on and don't merge them. If it is not, then for every element in the symmetric difference we make a greedy decision whether to include it in the merged factor or not. For this we compute the change in the encoding length of the whole decomposition with or without that element. Bear in mind that in order to compute this, we have to check every block (thus combination of factors as indicated by the current core tensor) that this factor participates in. If we are able to find a merged factor that decreases the overall encoding length, then we always execute this merge. The algorithm finishes when there is no merges 15 Algorithm 3 Reducing the size of the Boolean Tucker decomposition with help of the MDL principle. Input: Data X , threshold d, blocks B = {B1,B2, . . . ,Br} from random walk Output: G, A, B, C of the Tucker decomposition 1: create trivial Tucker decomposition G, A, B.C 2: Len ← mdl(G, A, B.C) for all ai, aj ∈ A do newLen ← mdl(G, A, B.C, ai, aj) if newLen < Len then Len ← newLen merge(ai, aj) for all bi, bj ∈ B do newlen ← mdl(G, A, B.C, bi, bj) if newLen < Len then Len ← newLen merge(bi, bj) for all ci, cj ∈ C do newLen ← mdl(G, A, B.C, ci, cj) if newlen < Len then Len ← newLen merge(ci, cj) 3: repeat 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: until no more merges are performed executed anymore. 5 Experimental Evaluation We evaluated our algorithms with both synthetic and real-world data. 5.1 Other methods and Evaluation Criteria To the best of our knowledge, this paper is the first to present a scalable Boolean CP decomposition algorithm. Therefore, we cannot compare our algorithm against other Boolean CP decomposition algorithms with the kind of data sets we are interested about. We did try the BCP ALS algorithm [13] (implementation from the author), but it ran out of memory in all but single dataset. Therefore we cannot report results with it. Instead, we used two real-valued scalable CP decomposition methods: namely cp apr [4] (implementation from the Matlab Tensor Toolbox v2.52) and Par- Cube [16]3. cp apr is an alternating Poisson regression algorithm that is 2http://www.sandia.gov/~tgkolda/TensorToolbox/ 3http://www.cs.cmu.edu/~epapalex/ 16 specifically developed for sparse (counting) data (which can be expected to follow the Poisson distribution) with the goal of returning sparse factors. The aim for sparsity and, to some extend, considering the data as a counting data, make this method suitable for comparison; on the other hand, it aims to minimize the (generalized) K -- L divergence, not squared error, and binary data is not Poisson distributed.4 The other method we compare against, ParCube, uses clever sampling to find smaller sub-tensors. It then solves the CP decomposition in this sub- tensor, and merges the solutions back into one. We used a non-negative variant of ParCube that expects non-negative data, and returns non-negative factor matrices. ParCube aims to minimize the squared error. To compute the error, we used the Boolean error function (3) for Walk'n'- Merge and the squared error function (1) for the comparison methods. This presents yet another apples-versus-oranges comparison: on one hand, the squared error can help the real-valued methods, as it scales all errors less than 1 down; on the other hand, small errors cumulate unlike with fully binary data. To alleviate this problem, we also rounded the reconstructed tensors from cp apr and ParCube to binary tensors. Instead of simply rounding from 0.5, we tried different rounding thresholds between 0 and 1 and selected the one that gave the lowest (Boolean) reconstruction error. With some of the real-world data, we were unable to perform the rounding for the full representation due to time and memory limitations. For these data sets, we estimated the rounded error using stratified sampling, where we sampled 10 000 1s and 10 000 0s from the data, computed the error on these, and scaled the results. 5.2 Synthetic Data We start by evaluating our algorithms with synthetic data. Our algorithm is aimed to reconstruct the latent structure from large and sparse binary tensors and therefore we tested the algorithms with such data. We generated sparse 1000-by-1500-by-2000 synthetic binary tensor as follows: We first fixed parame- ters for the Boolean rank of the tensor and the noise to apply. We generated three (sparse) factor matrices to obtain the noise-free tensor. As we assume that the rank-1 tensors in the real-world data are relatively small (e.g. synonyms of an entity), the rank-1 tensors we use were approximately of size 16-by-16-by-16, with each of them overlapping with another block. We then added noise to this tensor. We separate the noise in two types: additive noise flips elements that are 0 to 1 while destructive noise flips elements that are 1 in the noise-free tensor to 0. The amount of noise depends on the number of 1s in the noise-free data, that is 10% of destructive noise means that we delete 10% of the 1s, and 20% of additive noise means that we add 20% more 1s. We varied three parameters -- rank, additive noise, destructive noise, and overlap of the latent blocks -- and created five random copies for each set 4Sampling Poisson distribution can give a binary matrix, but it cannot be forced to give one. 17 (a) (b) (c) Figure 2: Results on synthetic data sets using CP-type decompositions. (a) Varying rank. (b) Varying additive noise. (c) Varying destructive noise. Solid lines present the relative reconstruction error w.r.t. input tensor; dashed lines present it w.r.t. the original noise-free tensor. All points are mean values over five random datasets and the width of the error bars is twice the standard deviation. parameters. We measured the quality of the factorizations using the sum of squared differences (1)for continuous-valued methods and the number of disagreements (3) for binary methods. We normalized the errors by the number of non-zeros in the data (e.g. the sum of squared values, as the data is binary). We compared the reconstruction error against both the input data (with noise) and the original noise-free data. Our goal, after all, is to recover the latent structure, not the noise. The rank of the decomposition was set to the true rank of the data for all methods. For Walk'n'Merge we set the merging threshold to 1 − (nd + 0.05), where nd was the amount of destructive noise, the length of the random walks was set to 5, and we only considered blocks of size 4-by-4-by-4 or larger. The results for varying rank and different types of noise are presented in Figure 2. Varying the amount of overlap did not have any effect on the results of Walk'n'Merge, and we omit the results. Results for ParCube were consistently worse than anything else and they are omitted from the plots. Rank. For the first experiment (Figure 2(a)) we varied the rank while keeping the additive and destructive noise at 10%. With rank-5 decomposition, Walk'n'Merge fits to the input data slightly worse than cp apr (unrounded) but clearly better than cp apr0/1 (rounded) and ParCube0/1, the latter being clearly the worse with all ranks. For larger ranks, Walk'n'Merge is clearly better than variations of cp apr. Note that here rank is both the rank of the data and the rank of the decomposition. When comparing the fit to the original data (dashed lines), Walk'n'Merge is consistently better than the variants of cp apr or ParCube0/1, to the extend that it achieves perfect results for ranks larger than 5. Additive noise. In this experiment, rank was set to 10, destructive noise to 10%, and additive noise was varied. Results are presented in Figure 2(b). In all results, Walk'n'Merge is consistently better than any other method, and always recovers the original tensor perfectly. 18 510152000.20.40.60.81RankRelative reconstruction error Walk'n'MergeCP_APRCP_APR0/1ParCube0,10.050.10.150.200.20.40.60.81Additive NoiseRelative reconstruction error Walk'n'MergeCP_APRCP_APR0/1ParCube0,10.050.10.150.200.20.40.60.81Destructive NoiseRelative reconstruction error Walk'n'MergeCP_APRCP_APR0/1ParCube0,1 Table 1: Data set properties Data set Rows Columns Tubes Density Enron TracePort Facebook 146 501 63891 146 10266 63890 38 8622 228 0.0023 2.51 × 10−7 9.42 × 10−7 Destructive noise. For this experiment, rank was again set to 10 and addi- tive noise to 10% while the amount of destructive noise was varied (Figure 2(c)). The results are similar to those in Figure 2(b), although it is obvious that the destructive noise has the most significant effect on the quality of the results. Discussion. In summary, the synthetic experiments show that when the Boolean structure is present in the data, Walk'n'Merge is able to find it -- in many cases even exactly. That cp apr is not able to do that should not come as a surprise as it does not try to find such structure. That ParCube0/1 is almost consistently the worse is slightly surprising (and the results from the unrounded ParCube were even worse). From Figure 2(b) we can see that the results of ParCube0/1 start improving when the amount of additive noise increases. This hints that ParCube's problems are due to its sampling approach not performing well on these extremely sparse tensors. 5.3 Real-World Data 5.3.1 Datasets To assess the quality of our algorithm, we tested it with three real-world data sets, namely Enron, TracePort, and Facebook. The Enron data5 contains information about who sent e-mail to whom (rows and columns) per months (tubes). The TracePort data set6 contains anonymized passive traffic traces (source and desti- nation IP and port numbers) from 2009. The Facebook data set7 [20] contains information about who posted a message on whose wall (rows and columns) per weeks (tubes). Basic properties of the data sets are given in Table 1. 5.3.2 CP Factorization We start by reporting the reconstruction errors with CP decompositions using the same algorithms we used with the synthetic data. The results can be seen in Table 2. For Enron, we used single rank (r = 12) and for the other two, we used two ranks: r = 15 and whichever gave the smallest reconstruction error by Walk'n'Merge (after ordering the blocks). In case of the Facebook data, Walk'n'Merge obtained minimum error of 611 561, but no other method was 5http://www.cs.cmu.edu/~enron/ 6http://www.caida.org/data/passive/passive_2009_dataset.xml 7The data is publicly available from the authors of [20], see http://socialnetworks. mpi-sws.org 19 Table 2: Reconstruction errors rounded to the nearest integer. Numbers prefixed with * are obtained using sampling. Enron TracePort Facebook Algorithm r = 12 r = 15 r = 1370 r = 15 Walk'n'Merge ParCube ParCube0/1 cp apr cp apr0/1 1 753 2 089 1 724 1 619 1 833 10 968 33 741 11 189 11 069 11 121 7 613 4 · 1055 * 2 · 107 5 230 * 1 886 612 314 8 · 10140 * 1 788 874 626 349 * 626 945 able to finnish within 48 hours with the higher rank (r = 3233) and we omit the results from the table and only report the errors for r = 15. The smallest of the data sets, Enron, reverses the trend we saw with the synthetic data: now Walk'n'Merge is no more the best, as both cp apr and ParCube0/1 obtain slightly better reconstruction errors. This probably indicates that the data does not have strong Boolean CP type structure. In case of TracePort and k = 15 however, Walk'n'Merge is again the best, if only slightly. With r = 1370, Walk'n'Merge improves, but cp apr and especially cp apr0/1 improve even more, obtaining significantly lower reconstruction errors. The very high rank probably lets cp apr to better utilize the higher expressive power of continuous factorizations, thus explaining the significantly improved results. For Facebook, we only report the r = 15 results as the other methods were not able to handle the rank-3300 factorization that gave Walk'n'Merge its best results. For this small rank, the situation is akin to TracePort with r = 15 in that Walk'n'Merge is the best followed directly with cp apr. ParCube's errors were off the charts with both TracePort (r = 1370) and Facebook; we suspect that the extreme sparsity (and high rank) fooled its sampling algorithm. Observing the results of Walk'n'Merge, we noticed that the resulting blocks were typically very small (e.g. 3-by-3-by-2). This is understandable given the extreme sparsity of the data. For example, the TracePort data does not contain any 2-by-2-by-2 monochromatic submatrix. On the other hand, the small factors fit to our intuition of the data. Consider, for example, the Facebook data: a monochromatic block corresponds to a set of people who all write to everybody's walls in the other group of people in certain days. Even when we relax the constrain to dense blocks, it is improbable that these groups would be very big. Running time. Final important question is the running time of the al- gorithm. The running time of Walk'n'Merge depends on one hand on the structure of the input tensor (number, but also location, of non-zeros) and on the other hand, on the parameters used (number of random walks, their length, minimum density threshold, and how big a block has to be to be non-trivial). It is therefore hard to provide any systematic study of the running times. But to give some idea, we report the running times for the Facebook data, as that 20 is the biggest data set we used. The fastest algorithm for k = 15 was Par- Cube, finishing in a matter of minutes (but note that it gave very bad results). Second-fasters was Walk'n'Merge. We tried different density thresholds d, effecting the running time. The fastest was d = 0.2, when Walk'n'Merge took 85 minutes, the slowest was d = 0.70, taking 277 minutes, and the average was 140 minutes. cp apr was in between these extremes, taking 128 minutes for one run. Note, however, that Walk'n'Merge didn't return just the r = 15 decomposition, but in fact all decompositions up to r = 3300. Neither ParCube or cp apr was able to handle so large ranks with the Facebook data. 5.3.3 Tucker Decomposition We did some further experiments with the Boolean Tucker decomposition. For the Enron dataset we obtained a decomposition with a core of size 9-by-11-by-9 from the MDL step. While this might feel small, the reconstruction error was 1775, i.e. almost as good as the best BCP decomposition. (Recall that MDL does not try to optimize the reconstruction error, but the encoding length.) With the Tucker decomposition, we also used a fourth semi-synthetic data set, YPSS.8 This data set contains noun phrase -- context pattern -- noun phrase triples that are observed (surface) forms of subject entity -- relation -- object entity triples. With this data our goal is to find a Boolean Tucker decomposition such that the core G corresponds to the latent subject -- relation -- object triples and the factor matrices tell us which surface forms are used for which entity and relation. A detailed analysis of the fact-recovering power of the Tucker decomposition applied to the YPSS dataset can be found in [6]. The size of the data is 39 500-by-8 000-by-21 000 and it contains 804 000 surface term triplets. The running time of Walk'n'Merge on YPSS was 52 minutes, and comput- ing the Tucker decomposition took another 3 hours. An example of a factor of the subjects would be {claude de lorimier, de lorimier, louis, jean-baptiste}, corresponding to Claude-Nicolas-Guillaume de Lorimier, a Canadian politician and officer from the 18th Century (and his son, Jean-Baptiste). And example of an object-side factor is {borough of lachine, villa st. pierre, lachine quebec}, corresponding to the borough of Lachine in Quebec, Canada (town of St. Pierre was merged to Lachine in 1999). Finally, an example of a factor in the relations is {was born was , [[det]] born in}, with an obvious meaning. In the Boolean core G the element corresponding to these three factors is 1, meaning that according to our algorithm, de Lorimier was born in Lachine, Quebec -- as he was. 5.3.4 Discussion Unlike with synthetic data, with real-world data we cannot guarantee that the data has Boolean structure. And if the data does not have the Boolean structure, there does not exist any good BTF. Yet, with most of our experiments, Walk'n'Merge performs very well, both in quantitative and qualitative analysis. 8The data set is available at http://www.mpi-inf.mpg.de/~pmiettin/btf/. 21 Considering running times, Walk'n'Merge is comparative to cp apr with most datasets. 6 Related Work Normal tensor factorizations are well-studied, dating back to the late Twenties. The two popular decomposition methods, Tucker and CP, were proposed in Sixties [19] and Seventies [2, 7], respectively. The topic has nevertheless attained growing interest in recent years, both in numerical linear algebra and computer science communities. For a comprehensive study of recent work, see [10], and the recent work on scalable factorizations [16]. One field of computer science that has adopted tensor decompositions is computer vision and machine learning. The interest to non-negative tensor factorizations stems from these fields [9, 18]. The theory of Boolean tensor factorizations was studied in [13], although the first algorithm for Boolean CP factorization was presented in [11]. A related line of data mining research has also studied a specific type of Boolean CP decomposition, where no 0s can be presented as 1s (e.g. [3]). For more on these methods and their relation to Boolean CP factorization, see [13]. 7 Conclusions We have presented Walk'n'Merge, an algorithm for computing the Boolean tensor factorization of large and sparse binary tensors. Analysing the results of our experiments sheds some light on the strengths and weaknesses of our algorithm. First, it is obvious that it does what it was designed to do, that is, finds Boolean tensor factorizations of large and sparse tensors. But it has its caveats, as well. The random walk algorithm, for example, introduces an element of randomness, and it seems that it benefits from larger tensors. The algorithm, and its running time, is also somewhat sensible to the parameters, possibly requiring some amount of tuning. References [1] Radim Belohl´avek, Cynthia Glodeanu, and Vil´em Vychodil. Optimal Factorization of Three-Way Binary Data Using Triadic Concepts. Order, March 2012. [2] J. Douglas Carroll and Jih-Jie Chang. Analysis of individual differences in multidimensional scaling via an N-way generalization of 'Eckart-Young' decomposition. Psychometrika, 35(3):283 -- 319, 1970. [3] Loıc Cerf, J´er´emy Besson, C´eline Robardet, and Jean-Fran¸cois Boulicaut. Closed patterns meet n-ary relations. ACM Trans. Knowl. Discov. Data, 3(1), 2009. 22 [4] Eric C Chi and Tamara G Kolda. On Tensors, Sparsity, and Nonnegative Factorizations. SIAM J. Matrix Anal. Appl., 33(4):1272 -- 1299, December 2012. [5] Peter Elias. Universal codeword sets and representations of the integers. IEEE Trans. Inform. Theory, 21(2):194 -- 203, March 1975. [6] D´ora Erdos and Pauli Miettinen. Discovering Facts with Boolean Tensor Tucker Decomposition. In CIKM '13, 2013. [7] Richard A. Harshman. Foundations of the PARAFAC procedure: Models and conditions for an 'explanatory' multimodal factor analysis. Technical report, UCLA Working Papers in Phonetics, 1970. [8] Johan Hastad. Tensor rank is NP-complete. J. Algorithms, 11(4):644 -- 654, December 1990. [9] Yong-Deok Kim and Seungjin Choi. Nonnegative Tucker Decomposition. In CVPR '07, pages 1 -- 8, 2007. [10] Tamara G Kolda and Brett W Bader. Tensor decompositions and applica- tions. SIAM Review, 51(3):455 -- 500, 2009. [11] Iwin Leenen, Iven Van Mechelen, Paul De Boeck, and Seymour Rosenberg. INDCLAS: A three-way hierarchical classes model. Psychometrika, 64(1):9 -- 24, March 1999. [12] Pauli Miettinen. On the positive-negative partial set cover problem. Inform. Process. Lett., 108(4):219 -- 221, 2008. [13] Pauli Miettinen. Boolean Tensor Factorizations. In ICDM '11, pages 447 -- 456, 2011. [14] Pauli Miettinen, Taneli Mielikainen, Aristides Gionis, Gautam Das, and Heikki Mannila. The Discrete Basis Problem. IEEE Trans. Knowl. Data Eng., 20(10):1348 -- 1362, October 2008. [15] Pauli Miettinen and Jilles Vreeken. MDL4BMF: Minimum description length for boolean matrix factorization. Technical Report MPI -- I -- 2012 -- 5- 001, Max-Planck-Institut fur Informatik, June 2012. [16] Evangelos E Papalexakis, Christos Faloutsos, and Nicholas D Sidiropoulos. ParCube: Sparse Parallelizable Tensor Decompositions. In ECML PKDD '12, pages 521 -- 536, 2012. [17] J Rissanen. Modeling by shortest data description. Automatica, 14(5):465 -- 471, September 1978. [18] Amnon Shashua and Tamir Hazan. Non-negative tensor factorization with applications to statistics and computer vision. In ICML '05, 2005. 23 [19] Ledyard R Tucker. Some mathematical notes on three-mode factor analysis. Psychometrika, 31(3):279 -- 311, 1966. [20] Bimal Viswanath, Alan Mislove, Meeyoung Cha, and Krishna P Gummadi. On the Evolution of User Interaction in Facebook. In WOSN '09, pages 37 -- 42, 2009. 24
1702.01290
3
1702
2017-08-25T13:53:28
Combinatorial Secretary Problems with Ordinal Information
[ "cs.DS" ]
The secretary problem is a classic model for online decision making. Recently, combinatorial extensions such as matroid or matching secretary problems have become an important tool to study algorithmic problems in dynamic markets. Here the decision maker must know the numerical value of each arriving element, which can be a demanding informational assumption. In this paper, we initiate the study of combinatorial secretary problems with ordinal information, in which the decision maker only needs to be aware of a preference order consistent with the values of arrived elements. The goal is to design online algorithms with small competitive ratios. For a variety of combinatorial problems, such as bipartite matching, general packing LPs, and independent set with bounded local independence number, we design new algorithms that obtain constant competitive ratios. For the matroid secretary problem, we observe that many existing algorithms for special matroid structures maintain their competitive ratios even in the ordinal model. In these cases, the restriction to ordinal information does not represent any additional obstacle. Moreover, we show that ordinal variants of the submodular matroid secretary problems can be solved using algorithms for the linear versions by extending [Feldman and Zenklusen, 2015]. In contrast, we provide a lower bound of $\Omega(\sqrt{n}/(\log n))$ for algorithms that are oblivious to the matroid structure, where $n$ is the total number of elements. This contrasts an upper bound of $O(\log n)$ in the cardinal model, and it shows that the technique of thresholding is not sufficient for good algorithms in the ordinal model.
cs.DS
cs
Combinatorial Secretary Problems with Ordinal Information∗ Martin Hoefer† Bojana Kodric‡ Abstract The secretary problem is a classic model for online decision making. Recently, combina- torial extensions such as matroid or matching secretary problems have become an important tool to study algorithmic problems in dynamic markets. Here the decision maker must know the numerical value of each arriving element, which can be a demanding informational as- sumption. In this paper, we initiate the study of combinatorial secretary problems with ordinal information, in which the decision maker only needs to be aware of a preference order consistent with the values of arrived elements. The goal is to design online algorithms with small competitive ratios. For a variety of combinatorial problems, such as bipartite matching, general packing LPs, and independent set with bounded local independence number, we design new algorithms that obtain constant competitive ratios. For the matroid secretary problem, we observe that many existing algorithms for special matroid structures maintain their competitive ratios even in the ordinal model. In these cases, the restriction to ordinal information does not represent any additional obstacle. Moreover, we show that ordinal variants of the submodular matroid secretary problems can be solved using algorithms for the linear versions by extending [18]. In contrast, we provide a lower bound of Ω(√n/(log n)) for algorithms that are oblivious to the matroid structure, where n is the total number of elements. This contrasts an upper bound of O(log n) in the cardinal model, and it shows that the technique of thresholding is not sufficient for good algorithms in the ordinal model. 1 Introduction The secretary problem is a classic approach to model online decision making under uncertain input. The interpretation is that a firm needs to hire a secretary. There are n candidates and they arrive sequentially in random order for an interview. Following an interview, the firm learns the value of the candidate, and it has to make an immediate decision about hiring him before seeing the next candidate(s). If the candidate is hired, the process is over. Otherwise, a rejected candidate cannot be hired at a later point in time. The optimal algorithm is a simple greedy rule that rejects all candidates in an initial learning phase. In the following acceptance phase, it hires the first candidate that is the best among all the ones seen so far. It manages to hire the best candidate with optimal probability 1/e. Notably, it only needs to know if a candidate is the best seen so far, but no exact numerical values. Since its introduction [15], the secretary problem has attracted a huge amount of research interest. Recently, a variety of combinatorial extensions have been studied in the computer sci- ence literature [7], capturing a variety of fundamental online allocation problems in networks and markets, such as network design [28], resource allocation [24], medium access in networks [21], or competitive admission processes [12]. Prominently, in the matroid secretary problem [8], the ele- ments of a weighted matroid arrive in uniform random order (e.g., weighted edges of an undirected graph G). The goal is to select a max-weight independent set of the matroid (e.g., a max-weight forest of G). The popular matroid secretary conjecture claims that for all matroids, there exists ∗This work was supported by DFG Cluster of Excellence MMCI at Saarland University. †Institute of Computer Science, Goethe University Frankfurt/Main, Germany. [email protected] ‡Max Planck Institute for Informatics and Saarland University, Saarland Informatics Campus, Germany. [email protected] 1 an algorithm with a constant competitive ratio, i.e., the expected total weight of the solution com- puted by the algorithm is at least a constant fraction of the total weight of the optimum solution. Despite much progress on special cases, the conjecture remains open. Beyond matroids, online algorithms for a variety of combinatorial secretary problems with downward-closed structure have recently been studied (e.g., matching [24, 28], independent set [21], linear packing problems [25] or submodular versions [18, 26]). The best known algorithms for matroid or matching secretary problems rely heavily on knowing the exact weight structure of elements. They either compute max-weight solutions to guide the admission process or rely on advanced bucketing techniques to group elements based on their weight. For a decision maker, in many applications it can be quite difficult to determine an exact cardinal preference for each of the incoming candidates. In contrast, in the original problem, the optimal algorithm only needs ordinal information about the candidates. This property provides a much more robust guarantee, since the numerical values can be arbitrary, as long as they are consistent with the preference order. In this paper, we study algorithms for combinatorial secretary problems that rely only on ordi- nal information. We assume that there is an unknown value for each element, but our algorithms only have access to the total order of the elements arrived so far, which is consistent with their values. We term this the ordinal model ; as opposed to the cardinal model, in which the algorithm learns the exact values. We show bounds on the competitive ratio, i.e., we compare the quality of the computed solutions to the optima in terms of the exact underyling but unknown numerical values. Consequently, competitive ratios for our algorithms are robust guarantees against uncer- tainty in the input. Our approach follows a recent line of research by studying the potential of algorithms with ordinal information to approximate optima based on numerical values [1, 3, 4, 10]. 1.1 Our Contribution We first point out that many algorithms proposed in the literature continue to work in the ordinal model. In particular, a wide variety of algorithms for variants of the matroid secretary problem with constant competitive ratios continue to obtain their guarantees in the ordinal model (see Table 1 for an overview). This shows that many results in the literature are much stronger, since the algorithms require significantly less information. Notably, the algorithm of [9] extends to the ordinal model and gives a ratio of O(log2 r) for general matroids, where r is the rank of the matroid. In contrast, the improved algorithms with ratios of O(log r) and O(log log r) [8, 16, 29] are not applicable in the ordinal model. For several combinatorial secretary problems we obtain new algorithms for the ordinal model. For online bipartite matching we give an algorithm that is 2e-competitive. We also extend this result to online packing LPs with at most d non-zero entries per variable. Here we obtain an O(d(B+1)/B)-competitive algorithm, where B is a tightness parameter of the constraints. Another extension is matching in general graphs, for which we give a 8.78-competitive algorithm. We give an O(α2 1)-competitive algorithm for the online weighted independent set problem in graphs, where α1 is the local independence number of the graph. For example, for the prominent case of unit-disk graphs, α1 = 5 and we obtain a constant-competitive algorithm. For matroids, we extend a result of [18] to the ordinal model: The reduction from submodular to linear matroid secretary can be done with ordinal information for marginal weights of the elements. More specifically, we show that whenever there is an algorithm that solves the matroid secretary problem in the ordinal model on some matroid class and has a competitive ratio of α, there is also an algorithm for the submodular matroid secretary problem in the ordinal model on the same matroid class with a competitive ratio of O(α2). The ratio can be shown to be better if the linear algorithm satisfies some further properties. Lastly, we consider the importance of knowing the weights, ordering, and structure of the do- main. For algorithms that have complete ordinal information but cannot learn the specific matroid structure, we show a lower bound of Ω(√n/(log n)), even for partition matroids, where n is the number of elements in the ground set. This bound contrasts the O(log2 r)-competitive algorithm and indicates that learning the matroid structure is crucial in the ordinal model. Moreover, it 2 Matroid general k-uniform graphic cographic transversal Ratio O(log2 r) Reference [9] 1 + O(p1/k), e [6, 15, 27] 2e [28] 3e [30] 16 [13] laminar 3√3e [23] regular 9e [14] Table 1: Existing algorithms for matroid secretary problems that provide the same guarantee in the ordinal model. contrasts the cardinal model, where thresholding algorithms yield O(log r)-competitive algorithms without learning the matroid structure. For structural reasons, we present our results in a slightly different order. We first discuss the matroid results in Section 3. Then we proceed with matching and packing in Section 4 and independent set in Section 5. All missing proofs are deferred to the Appendix. 2 Preliminaries and Related Work In the typical problem we study, there is a set E of elements arriving sequentially in random order. The algorithm knows n = E in advance. It must accept or reject an element before seeing the next element(s). There is a set S ⊆ 2E of feasible solutions. S is downward-closed, i.e., if S ∈ S, then S′ ∈ S for every S′ ⊆ S. The goal is to accept a feasible solution that maximizes an objective function f . In the linear version, each element has a value or weight we, and f (S) = Pe∈S we. In the submodular version, f is submodular and f (∅) = 0. In the linear ordinal model, the algorithm only sees a strict total order over the elements seen so far that is consistent with their weights (ties are broken arbitrarily). For the submodular version, we interpret the value of an element as its marginal contribution to a set of elements. In this case, our algorithm has access to an ordinal oracle O(S). For every subset S of arrived elements, O(S) returns a total order of arrived elements consistent with their marginal values f (eS) = f (S ∪ {e}) − f (S). Given this information, we strive to design algorithms that will have a small competitive ratio f (S∗)/E[f (Salg)]. Here S∗ is an optimal feasible solution and Salg the solution returned by the algorithm. Note that Salg is a random variable due to random-order arrival and possible internal randomization of the algorithm. In the matroid secretary problem, the pair M = (E,S) is a matroid. We summarize in Table 1 some of the existing results for classes of the (linear) problem that transfer to the ordinal model. The algorithms for all restricted matroid classes other than the graphic matroid assume a-priori complete knowledge of the matroid -- only weights are revealed online. The algorithms do not use cardinal information, their decisions are based only on ordinal information. As such, they translate directly to the ordinal model. Notably, the algorithm from [9] solves even the general submodular matroid secretary problem in the ordinal model. 2.1 Related Work Our work is partly inspired by [4, 5], who study ordinal approximation algorithms for classical optimization problems. They design constant-factor approximation algorithms for matching and clustering problems with ordinal information and extend the results to truthful mechanisms. Our approach here differs due to online arrival. Anshelevich et al. [3] examine the quality of randomized social choice mechanisms when agents have metric preferences but only ordinal information is available to the mechanism. Previously, [1,10] studied ordinal measures of efficiency in matchings, for instance the average rank of an agent's partner. The literature on the secretary problem is too broad to survey here. We only discuss directly related work on online algorithms for combinatorial variants. Cardinal versions of these problems have many important applications in ad-auctions and item allocation in online markets [22]. For 3 multiple-choice secretary, where we can select any k candidates, there are algorithms with ratios that are constant and asymptotically decreasing in k [6, 27]. More generally, the matroid secre- tary problem has attracted a large amount of research interest [8, 11, 16, 29], and the best-known algorithm in the cardinal model has ratio O(log log r). For results on specific matroid classes, see the overview in Table 1. Extensions to the submodular version are treated in [9, 18]. Another prominent domain is online bipartite matching, in which one side of the graph is known in advance and the other arrives online in random order, each vertex revealing all incident weighted edges when it arrives [28]. In this case, there is an optimal algorithm with ratio e [24]. Moreover, our paper is related to Gobel et al. [21] who study secretary versions of maximum independent set in graphs with bounded inductive independence number ρ. They derive an O(ρ2)-competitive algorithm for unweighted and an O(ρ2 log n)-competitive algorithm for weighted independent set. In addition, algorithms have been proposed for further variants of the secretary problem, e.g., the temp secretary problem (candidates hired for a fixed duration) [19], parallel secretary (candidates interviewed in parallel) [17], or local secretary (several firms and limited feedback) [12]. For these variants, some existing algorithms (e.g., for the temp secretary problem in [19]) directly extend to the ordinal model. In general, however, the restriction to ordinal information poses an interesting challenge for future work in these domains. 3 Matroids 3.1 Submodular Matroids We start our analysis by showing that -- in addition to algorithms for special cases mentioned above -- a powerful technique for submodular matroid secretary problems [18] can be adjusted to work even in the ordinal model. More formally, in this section we show that there is a reduction from submodular matroid secretary problems with ordinal information (SMSPO) to linear matroid secretary problems with ordinal information (MSPO). The reduction uses Greedy (Algorithm 1) as a subroutine and interprets the marginal value when added to the greedy solution as the value of an element. These values are then forwarded to whichever algorithm (termed Linear) that solves the linear version of the problem. In the ordinal model, we are unable to see the exact marginal values. Nevertheless, we manage to construct a suitable ordering for the forwarded elements. Consequently, we can apply algorithm Linear as a subroutine to obtain a good solution for the ordinal submodular problem. Let M = (E,S) be the matroid, f the submodular function, and E the ground set of elements. The marginal contribution of element u to set M is denoted by f (uM ) = f (M ∪ {u}) − f (M ). Since f can be non-monotone, Greedy in the cardinal model also checks if the marginal value of the currently best element is positive. While we cannot explicitly make this check in the ordinal model, note that f (uM ) ≥ 0 ⇐⇒ f (M ∪ {u}) ≥ f (M ) = f (M ∪ {u′}) for every u′ ∈ M . Since the ordinal oracle includes the elements of M in the ordering of marginal values, there is a way to check positivity even in the ordinal model. Therefore, our results also apply to non-monotone functions f . A potential problem with Algorithm 2 is that we must compare marginal contributions of different elements w.r.t. different sets. We can resolve this issue by following the steps of the Algorithm 1: Greedy [18] Input : ground set E Output: independent set M 1 Let M ← ∅ and E′ ← E. 2 while E′ 6= ∅ do Let u ← maxu′ f (u′M ) and E′ ← E′ \ {u}; if (M ∪ {u} independent in M) ∧ (f (uM ) ≥ 0) then add u to M ; 3 4 4 Algorithm 2: Online(p) algorithm [18] Input : n = E, size of the ground set Output: independent set Q ∩ N 1 Choose X from the binomial distribution B(n, 1/2). 2 Reject the first X elements of the input. Let L be the set of these elements. 3 Let M be the output of Greedy on the set L. 4 Let N ← ∅. 5 for each element u ∈ E \ L do Let w(u) ← 0. if u accepted by Greedy applied to M ∪ {u} then 6 7 8 9 10 11 12 With probability p do the following: Add u to N . Let Mu ⊆ M be the solution of Greedy immediately before it adds u to it. w(u) ← f (uMu). Pass u to Linear with weight w(u). 13 return Q ∩ N , where Q is the output of Linear. Greedy subroutine that tries to add new elements to the greedy solution computed on the sample. We use this information to construct a correct ordering over the marginal contributions of elements that we forward to Linear. Lemma 1. Let us denote by su the step of Greedy in which the element u is accepted when applied to M + u. Then su1 < su2 implies f (u1Mu1 ) ≥ f (u2Mu2 ). Proof. First, note that Mu1 ⊂ Mu2 when s1 > s2. We denote by mu1 the element of M that would be taken in step su1 if u1 would not be available. Then we know that f (u1Mu1) ≥ f (mu1Mu1 ). Furthermore, since s1 < s2, f (mu1Mu1) ≥ f (u2Mu1 ). Lastly, by using submodularity, we know that f (u2Mu1) ≥ f (u2Mu2). When su1 = su2, then Mu1 = Mu2 so the oracle provides the order of marginal values. Oth- erwise, the lemma yields the ordinal information. Thus, we can construct an ordering for the elements that are forwarded to Linear that is consistent with their marginal values in the cardinal model. Hence, the reduction can be applied in the ordinal model, and all results from [18] continue to hold. We mention only the main theorem. It implies constant ratios for all problems in Table 1 in the submodular version. Theorem 1. Given an arbitrary algorithm Linear for MSPO that is α-competitive on a matroid class, there is an algorithm for SMSPO with competitive ratio is at most 24α(3α + 1) = O(α2) on the same matroid class. For SMSPO with monotone f , it can be improved to 8α(α + 1). 3.2 A Lower Bound Another powerful technique in the cardinal model is thresholding, where we first sample a constant fraction of the elements to learn their weights. Based on the largest weight observed, we pick a threshold and accept subsequent elements greedily if they exceed the threshold. This approach generalizes the classic algorithm [15] and provides logarithmic ratios for many combinatorial do- mains [8, 12, 21, 28]. Intuitively, these algorithms learn the weights but not the structure. We show that this technique does not easily generalize to the ordinal model. The algorithms with small ratios in the ordinal model rely heavily on the matroid structure. Indeed, in the ordinal model we show a polynomial lower bound for algorithms in the matroid secretary problem that learn the ordering but not the structure. Formally, we slightly simplify the setting as follows. The algorithm receives the global ordering of all elements in advance. It determines (possibly at random) a threshold position in the ordering. Then elements arrive and are accepted greedily if 5 1 k 2k 3k . . . n−k n 1 1 0 ... 0 1 0 ... 0 0 1 0 ... 0 0 1 . . . k 0 ... 0 0 1 1 1 1 ... 1 Figure 1: Values for the family of instances de- scribed in the proof of Theorem 11, where the position of the "valuable" ones is denoted by the thick segment. Figure 2: One instance from the family de- scribed in the proof of Theorem 11. ranked above the threshold. Note that the algorithm does not use sampling, since in this case the only meaningful purpose of sampling is learning the structure. We call this a structure-oblivious algorithm. Theorem 2. Every structure-oblivious randomized algorithm has a competitive ratio of at least Ω(√n/(log n)). Proof. In the proof, we restrict our attention to instances with weights in {0, 1} (for a formal justification, see Lemma 7 in the Appendix). We give a distribution of such instances on which every deterministic algorithm has a competitive ratio of Ω(√n/(log n)). Using Yao's principle, this shows the claimed result for randomized algorithms. All instances in the distribution are based on a graphic matroid (in fact, a partition matroid) of the following form. There is a simple path of 1 + k segments. The edges in each segment have weight of 0 or 1. We call the edges with value 1 in the last k segments the "valuable edges". The total number of edges is the same in each instance and equals n + 1. All edges in the first segment have value 1 and there is exactly one edge of value 1 in all other segments (that being the aforementioned valuable edges). In the first instance there are in total k + 1 edges of value 1 (meaning that there is only one edge in the first segment). In each of the following instances this number is increased by k (in the i-th instance there are (i−1)·k +1 edges in the first segment) such that the last instance has only edges with value 1 (there are n − k + 1 edges in the first segment). The zero edges are always equally distributed on the last k path segments. The valuable edges are lower in the ordering than any non-valuable edge with value 1 (see Figure 1). Each of the instances appears with equal probability of k n (see Figure 2 for one example instance). A deterministic algorithm picks a threshold at position i. The expected value of the solution is E[w(Salg)] ≤ 1 + k n i k Xℓ=1 k ℓ ≤ 1 + k2 n log i k ≤ k2 n log n k + 1 , where log denotes the natural logarithm and the expression results from observing that the algo- rithm cannot obtain more than a value of 1 if its threshold i falls above the valuable 1's. Otherwise it gets an additional fraction of k, depending on how close the threshold is positioned to the valu- able 1's. For instance, if the threshold is set between 1 and k positions below the valuable 1's, the algorithm will in expectation select edges of total value of at least 1 + k/2. This follows from the random arrival order of the edges and the fact that the ratio of valuable to non-valuable edges that the algorithm is ready to accept is at least 1 : 2. Furthermore, we see that for this distribution of instances the optimal way to set a deterministic threshold is at the lowest position. Using k = √n, a lower bound on the competitive ratio is k k2 n log n k + 1 = n k + n k log n k = Ω(cid:18) √n log n(cid:19) . 6 Algorithm 3: Bipartite Matching Input : vertex set R and cardinality n = L Output: matching M 1 Let L′ be the first ⌊ n 2 for each ℓ ∈ L \ L′ do e ⌋ vertices of L, and M ← ∅; L′ ← L′ ∪ {ℓ}; M (ℓ) ← greedy matching on G[L′ ∪ R]; Let e(ℓ) ← (ℓ, r) be the edge assigned to ℓ in M (ℓ); if M ∪ {e(ℓ)} is a matching then add e(ℓ) to M ; 3 4 5 6 4 Matching and Packing 4.1 Bipartite Matching In this section, we study online bipartite matching. The vertices on the right side of the graph (denoted by R) are static and given in advance. The vertices on the left side (denoted by L) arrive sequentially in a random order. Every edge e = (r, ℓ) ∈ R× L has a non-negative weight w(e) ≥ 0. In the cardinal model, each vertex of L reveals upon arrival the weights of all incident edges. In the ordinal model, we are given a total order on all edges that have arrived so far, consistent with their weights. Before seeing the next vertex of L, the algorithm has to decide to which vertex r ∈ R (if any) it wants to match the current vertex ℓ. A match that is formed cannot be revoked. The goal is to maximize the total weight of the matching. The algorithm for the cardinal model in [24] achieves an optimal competitive ratio of e. How- ever, this algorithm heavily exploits cardinal information by repeatedly computing max-weight matchings for the edges seen so far. For the ordinal model, our Algorithm 3 below obtains a competitive ratio of 2e. While similar in spirit, the main difference is that we rely on a greedy matching algorithm, which is based solely on ordinal information. It deteriorates the ratio only by a factor of 2. Here we assume to have access to ordinal preferences over all the edges in the graph. Note that the same approach works if the vertices provide correlated (ordinal) preference lists consistent with the edge weights, for every vertex from R and every arrived vertex from L. In this case, the greedy algorithm can still be implemented by iteratively matching and removing a pair that mutually prefers each other the most, and it provides an approximation guarantee of 2 for the max-weight matching (see, e.g., [2]). In contrast, if we receive only preference lists for vertices on one side, there are simple examples that establish super-constant lower bounds on the competitive ratio1. Lemma 2. Let the random variable Av denote the contribution of the vertex v ∈ L to the output, i.e. weight assigned to v in M . Let w(M ∗) denote the value of the maximum-weight matching in G. For ℓ ∈ {⌈ n e ⌉, . . . , n}, E(cid:2)Aℓ(cid:3) ≥ ⌊ n e ⌋ ℓ − 1 · w(M ∗) 2n . Proof. We first show that e(ℓ) has a significant expected weight. Then we bound the probability of adding e(ℓ) to M . In step ℓ, L′ = ℓ and the algorithm computes a greedy matching M (ℓ) on G[L′ ∪ R]. The current vertex ℓ can be seen as selected uniformly at random from L′, and L′ can be seen as and E[w(e(ℓ))] ≥ w(M ∗) selected uniformly at random from L. Therefore, E[w(M (ℓ))] ≥ ℓ 2n . Here we use that a greedy matching approximates the optimum by at most a factor of 2 [2]. n · w(M ∗) 2 1Consider a bipartite graph with two nodes on each side (named A,B and 1,2). If we only know that both A and B prefer 1 to 2, the ratio becomes at least 2 even in the offline case. Similar examples imply that the (offline) ratio must grow in the size of the graph. 7 Edge e(ℓ) can be added to M if r has not been matched already. The vertex r can be matched k and the order only when it is in M (k). The probability of r being matched in step k is at most 1 of the vertices in steps 1, . . . , k − 1 is irrelevant for this event. r 6∈ e(k)# ≥ ℓ−1 . Using this and E[w(e(ℓ))] ≥ w(M ∗) Pr[r unmatched in step ℓ] = Pr" ℓ−1 ^k=⌈n/e⌉ We now know that Pr[M ∪ e(ℓ) is a matching] ≥ ⌊n/e⌋ Yk=⌈n/e⌉ e ⌉ − 1 ℓ − 1 k − 1 k 2n , the = ⌈ n ℓ−1 lemma follows. Theorem 3. Algorithm 3 for bipartite matching is 2e-competitive. Proof. The weight of matching M can be obtained by summing over random variables Aℓ. Since ⌊n/e⌋ E[w(M )] = E" n Xℓ=1 n ≥ 1 Aℓ# ≥ n and Pn−1 e − 1 n 1 ℓ=⌊n/e⌋ 2n w(M ∗) = ⌊n/e⌋ 2n ⌊n/e⌋ Xℓ=⌈n/e⌉ ℓ − 1 · ℓ ≥ ln n ⌊n/e⌋ ≥ 1, it follows that E[w(M )] ≥(cid:18) 1 e − n(cid:19) · w(M ∗) 1 2 . n−1 Xℓ=⌊n/e⌋ 1 ℓ · w(M ∗) In the submodular version of the offline problem, the natural greedy algorithm gives a 3- approximation [20]. It builds the matching by greedily adding an edge that maximizes the marginal improvement of f , which is the information delivered by the ordinal oracle. When using this algorithm as a subroutine for the bipartite matching secretary problem, the resulting procedure achieves a 12-approximation in the submodular case [26]. 4.2 Packing Our results for bipartite matching can be extended to online packing LPs of the form max cτ x s.t. Ax ≤ b and 0 ≤ x ≤ 1, which model problems with m resources and n online requests coming in random order. Each resource i ∈ [m] has a capacity bi that is known in advance, together with the number of requests. Every online request comes with a set of options, where each option has its profit and resource consumption. Once a request arrives, the coefficients of its variables are revealed and the assignment to the variables has to be determined. Formally, request j ∈ [n] corresponds to variables xj,1, . . . , xj,K that represent K options. Each option k ∈ [K] contributes with profit cj,k ≥ 0 and has resource consumption ai,j,k ≥ 0 for resource i. Overall, at most one option can be selected, i.e., there is a constraint Pk∈[K] xj,k ≤ 1,∀j ∈ [n]. The objective is to maximize total profit while respecting the resource capacities. The offline problem is captured by the following linear program: max Xj∈[n] Xk∈[K] cj,kxj,k s.t. Xj∈[n] Xk∈[K] ai,j,kxj,k ≤ bi xj,k ≤ 1 Xk∈[K] i ∈ [m] j ∈ [n] As a parameter, we denote by d the maximum number of non-zero entries in any column of the constraint matrix A, for which by definition d ≤ m. We compare the solution to the fractional optimum, which we denote by x∗. The competitive ratio will be expressed in terms of d and the capacity ratio B = mini∈[m]j maxj∈[n],k∈[K] ai,j,kk. bi 8 Algorithm 4: Packing LP Input : capacities b, total number of requests n, probability p = e(2d)1/B 1+e(2d)1/B Output: assignment vector y 3 4 1 Let L′ be the first p · n requests, and y ← 0; 2 for each j /∈ L′ do L′ ← L′ ∪ {j}; x(L′) ← greedy assignment on the LP for L′; yj ← x(L′) if ¬(A(y) ≤ b) then yj ← 0; ; j 5 6 Kesselheim et al. [24] propose an algorithm that heavily exploits cardinal information -- it repeatedly solves an LP-relaxation and uses the solution as a probability distribution over the options. Instead, our Algorithm 4 for the ordinal model is based on greedy assignments in terms of profits cj,k. More specifically, the greedy assignment considers variables xj,k in non-increasing order of cj,k. It sets a variable to 1 if this does not violate the capacity constraints, and to 0 otherwise. Theorem 4. Algorithm 4 for online packing LPs is O(d(B+1)/B)-competitive. 4.3 Matching in General Graphs Here we study the case when vertices of a general undirected graph arrive in random order. In the beginning, we only know the number n of vertices. Each edge in the graph has a non-negative weight w(e) ≥ 0. Each vertex reveals the incident edges to previously arrived vertices and their weights (cardinal model), or we receive a total order over all edges among arrived vertices that is consistent with the weights (ordinal model). An edge can be added to the matching only in the round in which it is revealed. The goal is to construct a matching with maximum weight. We can tackle this problem by prolonging the sampling phase and dividing the vertices into "left" and "right" vertices. Algorithm 5 first samples n/2 vertices. These are assigned to be the set R, corresponding to the static side of the graph in bipartite matching. The remaining vertices are assigned to be the set L. The algorithm then proceeds by sampling a fraction of the vertices of L, forming a set L′. The remaining steps are exactly the same as in Algorithm 3. Theorem 5. Algorithm 5 for matching in general graphs is 12e/(e+1)-competitive, where 12e/(e+ 1) < 8.78. Algorithm 5: General Matching Input : vertex set V and cardinality n = V Output: matching M 1 Let R be the first ⌊ n 2 Let L′ be the further ⌊ n 3 for each ℓ ∈ V \ L′ do 2⌋ vertices of V ; 2e⌋ vertices of V , and M ← ∅; 4 5 6 7 L′ ← L′ ∪ {ℓ}; M (ℓ) ← greedy matching on G[L′ ∪ R]; Let e(ℓ) ← (ℓ, r) be the edge assigned to ℓ in M (ℓ); if M ∪ {e(ℓ)} is a matching then add e(ℓ) to M ; 9 Algorithm 6: Independent Set in Graphs with Bounded Local Independence Number Output: independent set of vertices S Input : n = G, p =pα1/(α1 + 1) 1 Set k ← Binom(n, p), S ← ∅; 2 Reject first k vertices of G, denote this set by G′; 3 Build a maximal independent set of vertices from G′ greedily, denote this set by M1; 4 for each v ∈ G \ G′ do w∗ ← max{w N (v) ∩ M1}; if (v > w∗) ∧ (S ∪ {v} independent set) then add v to S; Algorithm 7: Simulate Output: independent set of vertices S Input : n = G, p =pα1/(α1 + 1) 1 Sort all vertices in G in non-increasing order of value; 2 Initialize M1, M2 ← ∅; 3 for each v ∈ G in sorted order do if M1 ∪ {v} independent set then flip a coin with probability p of heads; if heads then M1 ← M1 ∪ {v}; else M2 ← M2 ∪ {v}; 5 6 4 5 6 9 7 S ← M2; 8 for each w ∈ S do if w has neighbors in S then remove w and all his neighbors from S; 5 Independent Set and Local Independence In this section, we study maximum independent set in graphs with bounded local independence number. The set of elements are the vertices V of an underyling undirected graph G. Each vertex has a weight wv ≥ 0. We denote by N (v) the set of direct neighbors of vertex v. Vertices arrive sequentially in random order and reveal their position in the order of weights of vertices seen so far. The goal is to construct an independent set of G with maximum weight. The exact structure of G is unknown, but we know that G has a bounded local independence number α1. Definition 1. An undirected graph G has local independence number α1 if for each node v, the cardinality of every independent set in the neighborhood N (v) is at most α1. We propose Algorithm 6, which is inspired by the Sample-and-Price algorithm for matching in [28]. Note that Gobel et al. [21] construct a more general approach for graphs with bounded inductive independence number ρ. However, they only obtain a ratio of O(ρ2 log n) for the weighted version, where a competitive ratio of Ω(log n/ log2 log n) cannot be avoided, even in instances with constant ρ. These algorithms rely on ρ-approximation algorithms for the offline problem that crucially exploit cardinal information. Similar to [28], we reformulate Algorithm 6 into an equivalent approach (Algorithm 7) for the sake of analysis. Given the same arrival order, the same vertices are in the sample. Algorithm 7 drops all vertices from S that have neighbors in S while Algorithm 6 keeps one of them. Hence, )] ≥ E[w(SSim)]. In what follows, we analyze the performance of Simulate. The first E[w(SAlg6 lemma follows directly from the definition of the local independence number. Lemma 3. E[w(M1)] ≥ p · w(S ∗) Lemma 4. E(cid:2)N (v) ∩ M2(cid:12)(cid:12) v ∈ M2(cid:3) ≤ α1(1−p) α1 p . 10 , where α1 ≥ 1 is the local independence number of G. Proof. Let us denote by X 1 respectively. Then, u and X 2 u the indicator variables for the events u ∈ M1 and u ∈ M2 E(cid:2)N (v) ∩ M2(cid:12)(cid:12) v ∈ M2(cid:3) = E" Xu∈N (v) u (cid:12)(cid:12) v ∈ M2(cid:3) ≤ 1 − p p Xu∈N (v) E(cid:2)X 1 = 1 − p p · α1 X 2 u (cid:12)(cid:12) v ∈ M2# = Xu∈N (v) E(cid:2)X 2 u (cid:12)(cid:12) v ∈ M2(cid:3) Theorem 6. Algorithm 7 for weighted independent set is O(α2 independence number of the graph. 1)-competitive, where α1 is the local Proof. By using Markov's inequality and Lemma 4, Pr[N (v) ∩ M2 ≥ 1(cid:12)(cid:12) v ∈ M2] ≤ α1 · (1 − p)/p and Pr[N (v) ∩ M2 < 1(cid:12)(cid:12) v ∈ M2] > 1 − (α1(1 − p)/p) . Thus, we can conclude that E[w(S)] ≥(cid:18)1 − α1 · 1 − p p (cid:19) · E[w(M2)] ≥(cid:18)1 − α1 · 1 − p p (cid:19) · 1 − p α1 · w(S∗) . The ratio is optimized for p =q α1 α1+1 , which proves the theorem. As a prominent example, α1 = 5 in the popular class of unit-disk graphs. In such graphs, our algorithm yields a constant competitive ratio for online independent set in the ordinal model. References [1] David Abraham, Robert Irving, Telikepalli Kavitha, and Kurt Mehlhorn. Popular matchings. SIAM J. Comput., 37(4):1030 -- 1045, 2007. [2] Elliot Anshelevich and Martin Hoefer. Contribution games in networks. Algorithmica, 63(1 -- 2):51 -- 90, 2012. [3] Elliot Anshelevich and John Postl. Randomized social choice functions under metric prefer- ences. In Proc. 25th Intl. Joint Conf. Artif. Intell. (IJCAI), pages 46 -- 59, 2016. [4] Elliot Anshelevich and Shreyas Sekar. Blind, greedy, and random: Algorithms for matching In Proc. 13th Conf. Artificial Intelligence and clustering using only ordinal information. (AAAI), pages 390 -- 396, 2016. [5] Elliot Anshelevich and Shreyas Sekar. Truthful mechanisms for matching and clustering in an ordinal world. In Proc. 12th Conf. Web and Internet Economics (WINE), pages 265 -- 278, 2016. [6] Moshe Babaioff, Nicole Immorlica, David Kempe, and Robert Kleinberg. A knapsack sec- In Proc. 10th Workshop Approximation Algorithms for retary problem with applications. Combinatorial Optimization Problems (APPROX), pages 16 -- 28, 2007. [7] Moshe Babaioff, Nicole Immorlica, David Kempe, and Robert Kleinberg. Online auctions and generalized secretary problems. SIGecom Exchanges, 7(2), 2008. [8] Moshe Babaioff, Nicole Immorlica, and Robert Kleinberg. Matroids, secretary problems, and online mechanisms. In Proc. 18th Symp. Discrete Algorithms (SODA), pages 434 -- 443, 2007. 11 [9] MohammadHossein Bateni, MohammadTaghi Hajiaghayi, and Morteza Zadimoghaddam. Submodular secretary problem and extensions. ACM Trans. Algorithms, 9(4):32, 2013. [10] Deeparnab Chakrabarty and Chaitanya Swamy. Welfare maximization and truthfulness in In Proc. 5th Symp. Innovations in Theoret. mechanism design with ordinal preferences. Computer Science (ITCS), pages 105 -- 120, 2014. [11] Sourav Chakraborty and Oded Lachish. Improved competitive ratio for the matroid secretary problem. In Proc. 23rd Symp. Discrete Algorithms (SODA), pages 1702 -- 1712, 2012. [12] Ning Chen, Martin Hoefer, Marvin Kunnemann, Chengyu Lin, and Peihan Miao. Secre- In Proc. 42nd Intl. Coll. Automata, Languages and tary markets with local information. Programming (ICALP), volume 2, pages 552 -- 563, 2015. [13] Nedialko Dimitrov and Greg Plaxton. Competitive weighted matching in transversal matroids. Algorithmica, 62(1-2):333 -- 348, 2012. [14] Michael Dinitz and Guy Kortsarz. Matroid secretary for regular and decomposable matroids. SIAM J. Comput., 43(5):1807 -- 1830, 2014. [15] Eugene Dynkin. The optimum choice of the instant for stopping a Markov process. In Sov. Math. Dokl, volume 4, pages 627 -- 629, 1963. [16] Moran Feldman, Ola Svensson, and Rico Zenklusen. A simple O (log log(rank))-competitive al- gorithm for the matroid secretary problem. In Proc. 26th Symp. Discrete Algorithms (SODA), pages 1189 -- 1201, 2015. [17] Moran Feldman and Moshe Tennenholtz. Interviewing secretaries in parallel. In Proc. 13th Conf. Electronic Commerce (EC), pages 550 -- 567, 2012. [18] Moran Feldman and Rico Zenklusen. The submodular secretary problem goes linear. In Proc. 56th Symp. Foundations of Computer Science (FOCS), pages 486 -- 505, 2015. [19] Amos Fiat, Ilia Gorelik, Haim Kaplan, and Slava Novgorodov. The temp secretary problem. In Proc. 23rd European Symp. Algorithms (ESA), pages 631 -- 642, 2015. [20] Marshall Fisher, George Nemhauser, and Laurence Wolsey. An analysis of approximations for maximizing submodular set functions-II. In Polyhedral combinatorics, pages 73 -- 87. Springer, 1978. [21] Oliver Gobel, Martin Hoefer, Thomas Kesselheim, Thomas Schleiden, and Berthold Vocking. Online independent set beyond the worst-case: Secretaries, prophets and periods. In Proc. 41st Intl. Coll. Automata, Languages and Programming (ICALP), volume 2, pages 508 -- 519, 2014. [22] MohammadTaghi Hajiaghayi, Robert Kleinberg, and David Parkes. Adaptive limited-supply online auctions. In Proc. 5th Conf. Electronic Commerce (EC), pages 71 -- 80, 2004. [23] Patrick Jaillet, Jos´e Soto, and Rico Zenklusen. Advances on matroid secretary problems: In Proc. 16th Intl. Conf. Integer Programming and Free order model and laminar case. Combinatorial Optimization (IPCO), pages 254 -- 265, 2013. [24] Thomas Kesselheim, Klaus Radke, Andreas Tonnis, and Berthold Vocking. An optimal online algorithm for weighted bipartite matching and extensions to combinatorial auctions. In Proc. 21st European Symp. Algorithms (ESA), pages 589 -- 600, 2013. [25] Thomas Kesselheim, Klaus Radke, Andreas Tonnis, and Berthold Vocking. Primal beats dual on online packing LPs in the random-order model. In Proc. 46th Symp. Theory of Computing (STOC), pages 303 -- 312, 2014. 12 [26] Thomas Kesselheim and Andreas Tonnis. Submodular secretary problems: Cardinality, In Proc. 20th Workshop Approximation Algorithms for matching, and linear constraints. Combinatorial Optimization Problems (APPROX), pages 16:1 -- 16:22, 2017. [27] Robert Kleinberg. A multiple-choice secretary algorithm with applications to online auctions. In Proc. 16th Symp. Discrete Algorithms (SODA), pages 630 -- 631, 2005. [28] Nitish Korula and Martin P´al. Algorithms for secretary problems on graphs and hypergraphs. In Proc. 36th Intl. Coll. Automata, Languages and Programming (ICALP), pages 508 -- 520, 2009. [29] Oded Lachish. O(log log rank) competitive ratio for the matroid secretary problem. In Proc. 55th Symp. Foundations of Computer Science (FOCS), pages 326 -- 335, 2014. [30] Jos´e Soto. Matroid secretary problem in the random-assignment model. SIAM J. Comput., 42(1):178 -- 211, 2013. 13 A Appendix A.1 Proof of Theorem 4 The proof is based on the following lemma. Lemma 5. Let the random variable Aℓ denote the contribution of request xℓ to the output and cτ x∗ the value of the optimal fractional solution. For requests xj ∈ {pn + 1, . . . , n} it holds that E[Aj ] ≥ 1 − d ·(cid:18) e(1 − p) p (cid:19)B! cτ x∗ (d + 1)n . j,k = 1, then as in proof of Lemma 2, we get E[cj x(L′) Proof. If x(L′) (d+1)n , where the expectation is taken over the choice of the set L′ and the choice of the last vertex in the order of arrival. j,k ] ≥ cτ x∗ ] = E[cj,kx(L′) j (L′) The algorithm sets yj to x j only if the capacity constraints can be respected. For the sake (L′) of analysis, we assume that the algorithm only sets yj to x j if every capacity constraint bi that (L′) j,k = 1 and ai,j,k 6= 0) is affected by at most B−1 previous requests. We bound the x j probability of a capacity constraint bi being affected in any preceding step s ∈ {pn + 1, . . . , j − 1}, for a fixed i: affects (x(L′) Pr[bi affected by x(L′) Pr[(xj′ is last in the order) ∧ (ai,j′,k′ 6= 0)] s,k′ = 1] ≤ Xx s Xx j′ ∈{1,...,s} 1 ≤ j′ ∈{1,...,s} Pr[ai,j′,k′ 6= 0] ≤ B s , where the last step follows from y being a feasible solution throughout the run of the algorithm. (L′) Now, we bound the probability of not being able to set yj to x j : Pr[bi is affected at least B times] ≤ XC⊆{pn+1,...,j−1}, ≤(cid:18)(1 − p)n B (cid:19) ·(cid:18) B (cid:18)Ys∈C pn(cid:19)B C=B so the probability of succeeding in setting yj to x(L′) j is Pr[Ay ≤ b] ≥ 1 − d ·(cid:18) (1 − p)e p (cid:19)B , B s(cid:19) ≤(cid:18) (1 − p)e p (cid:19)B , because we can do a union bound over all bi that are affected by x(L′) and there are at most d such, since that is the maximal number of non-zero entries in any column of the constraint matrix A. j Combining this with the inequality regarding the expected contribution of x(L′) , we get the j claimed result. Using Lemma 5, we get E[cτ y] = = n Xℓ=pn+1 cτ x∗ d + 1 · n Xl=pn+1 1 − d ·(cid:18) e(1 − p) E[Aℓ] ≥ 1 + e(2d)1/B · 1 − d ·(cid:18) p 1 1 (2d)1/B(cid:19)B! ≥ (cid:19)B! cτ x∗ (d + 1)n cτ x∗ 2(d + 1)(1 + 2ed1/B) . 14 Note that Theorem 4 contains the one-sided b-hypermatching problem as a special case. For the even more special case of b = 1 in the one-sided hypermatching, an algorithm was given in [28], which also works in the ordinal model. Our ratio in this special case is similar, but our approach extends to arbitrary capacities b ≥ 1. A.2 Proof of Theorem 5 The proof is based on the following lemma. Lemma 6. Let the random variable Aℓ denote the contribution of vertex ℓ ∈ ⌊n/2 + n/(2e)⌋ to the output, i.e. the weight of the edge assigned to ℓ in M . Then, E[Aℓ] ≥ ⌈ n 2 + n 2e⌉ ℓ − 1 1 2 · · w(M ∗) n Proof. The proof is similar to the one of Lemma 5, with the additional observation that each edge is available with probability 1 2 . It is available only if the incident vertices are assigned to different sides of the bipartition. We now use the lemma to bound as follows: E[w(M )] = E" n Xℓ=1 Aℓ# ≥ = ⌊n/2 + n/(2e)⌋ n ≥(cid:18) 1 2(cid:16)1 + 1 e(cid:17) − ⌊n/2 + n/(2e)⌋ 1 2 · · w(M ∗) n n w(M ∗) Xℓ=⌈n/2+n/(2e)⌉ · · w(M ∗) n(cid:19) · 2 2 1 n−1 ℓ − 1 Xℓ=⌊n/2+n/(2e)⌋ · 1 3 1 ℓ A.3 Competitive Ratio and 0 -- 1 Weights For worst-case bounds, we can restrict our attention to instances where all elements have cardinal weights in {0, 1}. These instances always result in the worst competitive ratio, as shown in the following lemma. Lemma 7. By converting an arbitrary weighted instance to an instance with weights in {0, 1}, the competitive ratio between the optimum solution and the solution computed by an algorithm based on ordinal information can only deteriorate. Proof. Without loss of generality, we assume that all elements of the original instance have distinct weights. We denote the elements chosen in the optimal solution by a∗ k and the elements chosen by the algorithm by b1, . . . , bm. The numbering respects the ordinal ordering of weights, i.e., a∗ k and b1 ≻ b2 ≻ ··· ≻ bm. The competitive ratio is 2 ≻ . . . a∗ 1 ≻ a∗ 1, . . . , a∗ OPT ALG = w(a∗ 1) + ··· + w(a∗ k) w(b1) + ··· + w(bm) . This ratio can only increase if we change the weight of all elements that appear after a∗ k in the global ordering to 0. This effectively shortens the set of elements with a contribution chosen by the algorithm to b1, . . . , bℓ, for some suitable ℓ ≤ m. Furthermore, we change the weights of all elements between a∗ i+1. We now denote the elements that the algorithm chose by c1, . . . , cl, since their weights might have changed. Both of these changes do i+1 by decreasing them to a∗ i and a∗ 15 not influence OPT, but they reduce the weight of the solution returned by the algorithm. We continue converting the instance, by focusing on w(a∗ k). Then, OPT ALG = ≤ w(a∗ 1) + ··· + w(a∗ k) w(b1) + ··· + w(bm) ≤ w(a∗ 1) + ··· + w(a∗ k) w(c1) + ··· + w(cℓ) = w(a∗ 1) + ··· + w(a∗ k) w(b1) + ··· + w(bℓ) A + w(a∗ k) B + r · w(a∗ k) , where A = w(a∗ chose which are not equal to w(a∗ Taking the derivative for w(a∗ 1) + ··· + w(a∗ k) in the altered instance and r ∈ N0. k), k−1), B is the sum of the weights of all elements that the algorithm k)(cid:19)′ (cid:18) A + w(a∗ k) B + r · w(a∗ B − r · A (B + r · w(a∗ we either decrease w(a∗ k−1) (depending what makes the ratio increase, i.e., the sign of the derivative). We continue this procedure until all weights of the instance are equal to either to a∗ 1 or 0. Note that these changes preserve the global ordering. W.l.o.g., we can finally set w(a∗ 1) = 1. k) to 0 or raise it to w(a∗ k))2 , = Note that we increased the ratio between the solution of the algorithm and the optimal so- lution for the original weights, when applying the transformed weights. Note that none of these transformations change the decisions of the algorithm. In contrast, the optimum solution for the transformed weights can only become better, which even further deteriorates the competitive ratio. 16
1411.2021
3
1411
2017-01-31T15:07:33
Partitioning Well-Clustered Graphs: Spectral Clustering Works!
[ "cs.DS", "cs.LG" ]
In this paper we study variants of the widely used spectral clustering that partitions a graph into k clusters by (1) embedding the vertices of a graph into a low-dimensional space using the bottom eigenvectors of the Laplacian matrix, and (2) grouping the embedded points into k clusters via k-means algorithms. We show that, for a wide class of graphs, spectral clustering gives a good approximation of the optimal clustering. While this approach was proposed in the early 1990s and has comprehensive applications, prior to our work similar results were known only for graphs generated from stochastic models. We also give a nearly-linear time algorithm for partitioning well-clustered graphs based on computing a matrix exponential and approximate nearest neighbor data structures.
cs.DS
cs
Partitioning Well-Clustered Graphs: Spectral Clustering Works!∗ Richard Peng † He Sun‡ Luca Zanetti§ Abstract In this paper we study variants of the widely used spectral clustering that partitions a graph into k clusters by (1) embedding the vertices of a graph into a low-dimensional space using the bottom eigenvectors of the Laplacian matrix, and (2) grouping the embedded points into k clusters via k-means algorithms. We show that, for a wide class of graphs, spectral clustering gives a good approximation of the optimal clustering. While this approach was proposed in the early 1990s and has comprehensive applications, prior to our work similar results were known only for graphs generated from stochastic models. We also give a nearly-linear time algorithm for partitioning well-clustered graphs based on computing a matrix exponential and approximate nearest neighbor data structures. Keywords: graph partitioning, spectral clustering, k-means, heat kernel 7 1 0 2 n a J 1 3 ] S D . s c [ 3 v 1 2 0 2 . 1 1 4 1 : v i X r a ∗A preliminary version of this paper appeared in the 28th Annual Conference on Learning Theory (COLT 2015). †Georgia Institute of Technology, Atlanta, USA. ([email protected]) ‡University of Bristol, Bristol, UK. ([email protected]) Questions, comments, or corrections to this doc- ument may be directed to that email address. §University of Bristol, Bristol, UK. ([email protected]) Contents 1 Introduction 1.1 Our Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Preliminaries 3 Connection Between Eigenvectors and Indicator Vectors of Clusters 1 2 3 4 5 4 Analysis of Spectral Clustering 10 4.1 k-Means Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.2 Analysis of the Spectral Embedding . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.3 Approximation Guarantees of Spectral Clustering . . . . . . . . . . . . . . . . . . 13 4.4 Proof of Theorem 4.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 5 Partitioning Well-Clustered Graphs in Nearly-Linear Time 17 5.1 The Seeding Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.2 The Grouping Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.3 Approximation Analysis of the Algorithm . . . . . . . . . . . . . . . . . . . . . . 24 5.4 Fast computation of the required embedding . . . . . . . . . . . . . . . . . . . . . 25 5.5 Proof of Theorem 1.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 1 Introduction Partitioning a graph into two or more pieces is one of the most fundamental problems in com- binatorial optimization, and has comprehensive applications in various disciplines of computer science. One of the most studied graph partitioning problems is the edge expansion problem, i.e., finding a cut with few crossing edges normalized by the size of the smaller side of the cut. Formally, let G = (V, E) be an undirected graph. For any set S, the conductance of set S is defined by φG(S) , E(S, V \ S) vol(S) , where vol(S) is the total weight of edges incident to vertices in S, and let the conductance of G be φ(G) , min S:vol(S)6vol(G)/2 φG(S). The edge expansion problem asks for a set S ⊆ V of vol(S) 6 vol(V )/2 such that φG(S) = φ(G). This problem is known to be NP-hard [26], and the current best approximation algorithm achieves an approximation ratio of O(cid:0)√log n(cid:1) [5]. different i and j, andSk The k-way partitioning problem is a natural generalization of the edge expansion problem. We call subsets of vertices (i.e. clusters) A1, . . . , Ak a k-way partition of G if Ai ∩ Aj = ∅ for i=1 Ai = V . The k-way partitioning problem asks for a k-way partition of G such that the conductance of any Ai in the partition is at most the k-way expansion constant, defined by ρ(k) , min partition A1,...,Ak max 16i6k φG(Ai). (1.1) Clusters of low conductance in networks appearing in practice usually capture the notion of community, and algorithms for finding these subsets have applications in various domains such as community detection and network analysis. In computer vision, most image segmentation procedures are based on region-based merge and split [10], which in turn rely on partitioning graphs into multiple subsets [36]. On a theoretical side, decomposing vertex/edge sets into multiple disjoint subsets is used in designing approximation algorithms for Unique Games [39], and efficient algorithms for graph problems [18, 23, 38]. Despite widespread use of various graph partitioning schemes over the past decades, the quantitative relationship between the k-way expansion constant and the eigenvalues of the graph Laplacians were unknown until a sequence of very recent results [22, 24]. For instance, Lee et al. [22] proved the following higher-order Cheeger inequality: λk 2 6 ρ(k) 6 O(k2)pλk, (1.2) where 0 = λ1 6 . . . 6 λn 6 2 are the eigevalues of the normalized Laplacian matrix L of G. Informally, the higher-order Cheeger inequality shows that a graph G has a k-way partition with low ρ(k) if and only if λk is small. Indeed, (1.2) implies that a large gap between λk+1 and ρ(k) guarantees (i) existence of a k-way partition {Si}k i=1 with bounded φG(Si) 6 ρ(k), and (ii) any (k + 1)-way partition of G contains a subset with significantly higher conductance ρ(k + 1) > λk+1/2 compared with ρ(k). Hence, a suitable lower bound on the gap Υ(k) for some k, defined by Υ(k) , , (1.3) λk+1 ρ(k) implies the existence of a k-way partition for which every cluster has low conductance, and that G is a well-clustered graph. We study well-clustered graphs which satisfy a gap assumption on Υ(k) in this paper. Our gap assumption on Υ(k) is slightly weaker than assuming gaps between the eigenvalues, 1 but nonetheless related via Cheeger-type inequalities. Our assumption is also well-grounded in practical studies: clustering algorithms have been studied before under this assumption in machine learning, e.g. [1]. Sharp drop-offs between two consecutive eigenvalues have also been observed to give good indicators for the number of clusters, e.g. [40] and Section D in [14]. 1.1 Our Results We give structural results that show close connections between the eigenvectors and the in- dicator vectors of the clusters. This characterization allows us to show that many variants of spectral clustering, that are based on the spectral embedding and that work "in practice", can be rigorously analyzed "in theory". Moreover, exploiting our gap assumption, we can ap- proximate this spectral embedding using the heat kernel of the graph. Combining this with approximate nearest neighbor data structures, we give a nearly-linear time algorithm for the k-way partitioning problem. Our structural results can be summarized as follows. Let {fi}k sponding to the k smallest eigenvalues of L, and {Si}k ρ(k) defined in (1.1). We define {gi}k gi(u) = 1 if u ∈ Si, and gi(u) = 0 otherwise. We further use {¯gi}k indicator vectors of the clusters {Si}k i=1 to be the indicator vectors of the clusters {Si}k i=1, defined by i=1 be the eigenvectors corre- i=1 be a k-way partition of G achieving i=1, where i=1 to express the normalized ¯gi = D1/2gi kD1/2gik . We show that, under the condition of Υ(k) = Ω(k2), the span of {¯gi}k are close to each other, which is stated formally in Theorem 1.1. Theorem 1.1 (The Structure Theorem). Let {Si}k and let Υ(k) = λk+1/ρ(k) = Ω(k2). Let {fi}k following statements hold: i=1 and {¯gi}k i=1 be a k-way partition of G achieving ρ(k), i=1 be defined as above. Then, the i=1 and the span of {fi}k i=1 1. For every ¯gi, there is a linear combination of {fi}k i=1, called fi, such that kgi − fik2 6 1/Υ(k). 2. For every fi, there is a linear combination of {gi}k i=1, called gi, such that kfi − gik2 6 1.1k/Υ(k). This theorem generalizes the result shown by Arora et al. ([2], Theorem 2.2), which proves the easier direction (the first statement, Theorem 1.1), and can be considered as a stronger version of the well-known Davis-Kahan theorem [12]. We remark that, despite that we use the higher-order Cheeger inequality (1.2) to motivate the definition of Υ(k), our proof of the structure theorem is self-contained. Specifically, it omits much of the machinery used in the proofs of higher-order and improved Cheeger inequalities [21, 22]. The structure theorem has several applications. For instance, we look at the well-known spectral embedding F : V [G] → Rk defined by F (u) , 1 NormalizationFactor(u) · (f1(u), . . . , fk(u))⊺ , (1.4) where NormalizationFactor(u) ∈ R is a normalization factor for u ∈ V [G]. We use Theorem 1.1 to show that this well-known spectral embedding exhibits very nice geometric properties: (i) all points F (u) from the same cluster are close to each other, and (ii) most pairs of points F (u), F (v) from different clusters are far from each other; (iii) the bigger the value of Υ(k), the higher concentration the embedded points within the same cluster. Based on these facts, we analyze the performance of spectral clustering, aiming at answering the following longstanding open question: Why does spectral clustering perform well in practice? 2 We show that the partition {Ai}k i=1 produced by spectral clustering gives a good approximation of any "optimal" partition {Si}k i=1: every Ai has low conductance, and has large overlap with its corresponding Si. This algorithm has comprehensive applications, and has been the subject of extensive experimental studies for more than 20 years, e.g. [28, 40]. Prior to this work, similar results on spectral clustering mainly focus on graphs generated from the stochastic block model. Instead, our gap assumption captures more general classes of graphs by replacing the input model with a structural condition. Our result represents the first rigorous analysis of spectral clustering for the general family of graphs that exhibit a multi-cut structure but are not captured by the stochastic block model. Our result is as follows: Theorem 1.2 (Approximation Guarantee of Spectral Clustering). Let G be a graph satisfying the condition Υ(k) = λk+1/ρ(k) = Ω(k3), and k ∈ N. Let F : V [G] → Rk be the embedding defined in (1.4). Let {Ai}k i=1 be a k-way partition by any k-means algorithm running in Rk that achieves an approximation ratio APT. Then, the following statements hold: (i) vol(Ai△Si) = O(cid:0)APT · k3/Υ(k)(cid:1) vol(Si), and (ii) φG(Ai) = 1.1 · φG(Si) + O(cid:0)APT · k3/Υ(k)(cid:1). We further study fast algorithms for partitioning well-clustered graphs. Notice that, for moderately large values of k, e.g. k = ω(log n), directly applying k-means algorithms and The- orem 1.2 does not give a nearly-linear time algorithm, since (i) obtaining the spectral embedding (1.4) requires Ω(mk) time for computing k eigenvectors, and (ii) most k-means algorithms run in Ω(nk) time. To overcome the first obstacle, we study the so-called heat kernel embedding xt : V [G] → Rn, an embedding from V to Rn defined by xt(u) , 1 NormalizationFactor(u) ·(cid:16)e−t·λ1f1(u),··· , e−t·λn fn(u)(cid:17) for some t ∈ R>0. The heat kernel of a graph is a well-studied mathematical concept and is related to, for example, the study of random walks [34]. We exploit the heat kernel embedding to approximate the squared-distance kF (u)− F (v)k2 of the embedded points F (u) and F (v) via their heat-kernel distance kxt(u)− xt(v)k2. Since the heat kernel distances between vertices can be approximated in nearly-linear time [29], this approach avoids the computation of eigenvectors for a large value of k. For the second obstacle, instead of applying k-means algorithms as a black-box, we apply approximate nearest-neighbor data structures. This can be viewed as an ad-hoc version of a k-means algorithm, and indicates that in many scenarios the standard Lloyd- type heuristic widely used in k-means algorithms can eventually be avoided. Our result is as follows: Theorem 1.3 (Nearly-Linear Time Algorithm For Partitioning Graphs). Let G = (V, E) be a graph of n vertices and m edges, and k = ω(log n) be the number of clusters. Assume that i=1 is a k-way partition such that φG(Si) 6 ρ(k). Then i=1 such that Υ(k) = λk+1/ρ(k) = eΩ(k5), and {Si}k there is an algorithm which runs in eO(m) time and outputs a k-way partition {Ai}k (i) vol(Ai△Si) = eO(cid:0)k4/Υ(k)(cid:1) vol(Si), and (ii) φG(Ai) = 1.1 · φG(Si) + eO(cid:0)k4/Υ(k)(cid:1). The eO(·) and eΩ(·) terms here hide a factor of poly log n. We remark that bounds of other expansion parameters of k-way partitioning can be derived from our analysis as well. For instance, it is easy to see that ρ(k) and the normalized cut [36] studied in machine learning, which is defined as the sum of the conductance of all returned clusters, differ by at most a factor of k, and the normalized cut value of a k-way partition from spectral clustering can be derived from our results. 1.2 Related Work In the broadest sense, our algorithms are clustering routines. Clustering can be formulated in many ways, and the study of algorithms in many such formulations are areas of active work 3 [7, 8, 17, 25]. Among these, our work is most closely related to spectral clustering, which is closely related to normalized or low conductance cuts [36]. The k-way expansion that we study is always within a factor of k of k-way normalized cuts. Theoretical studies of graph partitioning are often based on augmenting the fractional re- laxation of these cut problems with additional constraints in the form of semidefinite programs or Lasserre hierarchy. The goal of our study is to obtain similar bounds using more practical tools such as k-means and heat-kernel embedding. Oveis Gharan and Trevisan [32] formulate the notion of clusters with respect to the inner and outer conductance: a cluster S should have low outer conductance, and the conductance of the induced subgraph by S should be high. Under a gap assumption between λk+1 and λk, they present a polynomial-time algorithm which finds a k-way partition {Ai}k i=1 that satisfies the inner- and outer-conductance condition. In order to ensure that every Ai has high inner con- ductance, they assume that λk+1 > poly(k)λ1/4 k , which is much stronger than ours. Moreover, their algorithm runs in polynomial-time, in contrast to our nearly-linear time algorithm. Dey et al. [13] studies the properties of the spectral embedding for graphs having a gap between λk and λk+1 and presents a k-way partition algorithm, which is based on k-center clustering and is similar in spirit to our work. Using combinatorial arguments, they are able to show that the clusters concentrate around k distant points in the spectral embedding. In contrast to our work, their result only holds for bounded-degree graphs, and cannot provide an approximate guarantee for individual clusters. Moreover, their algorithm runs in nearly-linear time only if k = O(poly log n). We also explore the separation between λk and λk+1 from an algorithmic perspective, and show that this assumption interacts well with heat-kernel embeddings. The heat kernel has been used in previous algorithms on local partitioning [9], balanced separators [29]. It also plays a key role in current efficient approximation algorithms for finding low conductance cuts [30, 35]. However, most of these theoretical guarantees are through the matrix multiplicative weights update framework [3, 4]. Our algorithm instead directly uses the heat-kernel embedding to find low conductance cuts. There is also a considerable amount of research on partitioning random graphs. For instance, in the Stochastic Block Model (SBM) [27], the input graph with k clusters is generated according to probabilities p and q with p > q: an edge between any two vertices within the same cluster is placed with probability p, and an edge between any two vertices from different clusters is placed with probability q. It is proven that spectral algorithms give the correct clustering for certain ranges of p and q [27, 33, 41]. However, the analysis of these algorithms cannot be easily generalized into our setting: we consider graphs where edges are not necessarily chosen independently with certain probabilities, but can be added in an "adversarial" way. For this reason, standard perturbation theorems used in the analysis of algorithms for SBMs, such as the Davis-Kahan theorem [12], cannot be always applied, and ad-hoc arguments specific for graphs, like our structure theorem (Theorem 1.1), become necessary. 2 Preliminaries set S ⊆ V , let vol(S) , Pu∈S du. For any set S, T ⊆ V , we define E(S, T ) to be the set of Let G = (V, E) be an undirected and unweighted graph with n vertices and m edges. The set of neighbors of a vertex u is represented by N (u), and its degree is du = N (u). For any edges between S and T , aka E(S, T ) , {{u, v}u ∈ S and v ∈ T}. For simplicity, we write ∂S = E(S, V \ S) for any set S ⊆ V . For two sets X and Y , the symmetric difference of X and Y is defined as X△Y , (X \ Y ) ∪ (Y \ X). We work extensively with algebraic objects related to G. We use D to denote the n × n diagonal matrix with Duu = du for u ∈ V [G]. The Laplacian matrix of G is defined by L , D − A, where A is the adjacency matrix of G defined by Au,v = 1 if {u, v} ∈ E[G], and 4 Au,v = 0 otherwise. The normalized Laplacian matrix of G is defined by L , D−1/2LD−1/2 = I − D−1/2AD−1/2. For this matrix, we denote its n eigenvalues with 0 = λ1 6 ··· 6 λn 6 2, with their corresponding orthonormal eigenvectors f1, . . . , fn. Note that if G is connected, the first eigenvector is f1 = D1/2f , where f is any non-zero constant vector. i(cid:1)1/2. For any For a vector x ∈ Rn, the Euclidean norm of x is given by kxk = (cid:0)Pn f : V → R and h , D−1/2f , the Rayleigh quotient of f with respect to graph G is given by = P{u,v}∈E(G) (h(u) − h(v))2 R(f ) , i=1 x2 , f ⊺Lf kfk2 = h⊺Lh khkD where khkD , h⊺Dh. Based on the Rayleigh quotient, the conductance of a set Si can be expressed as φG(Si) = R(¯gi), and the gap Υ(k) can be written as Υ(k) = λk+1 ρ(k) = min 16i6k λk+1 φG(Si) = min 16i6k λk+1 R(¯gi) . (2.1) Since k is always fixed as part of the algorithm's input, throughout the rest of the paper we always use Υ to express Υ(k) for simplicity. We will also use S1, . . . , Sk to express a k-way partition of G achieving ρ(k). Note that this partition may not be unique. 3 Connection Between Eigenvectors and Indicator Vectors of Clusters Pu duh(u)2 In this section we study the relations between the multiple cuts of a graph and the eigenvectors of the graph's normalized Laplacian matrix. Given clusters S1 . . . Sk, define the indicator vector of cluster Si by gi(u) =(cid:26) 1 if u ∈ Si, 0 if u 6∈ Si, and define the corresponding normalized indicator vector by gi = D1/2gi kD1/2gik . (3.1) (3.2) A basic result in spectral graph theory states that G has k connected components if and only if the k smallest eigenvalues are 0, implying that the spaces spanned by f1,··· , fk and ¯g1,··· , ¯gk are the same. Generalizing this result, we expect that these two spaces would be still similar if these k components of G are loosely connected, in the sense that (i) every eigenvector fi can be approximately expressed by a linear combination of {gi}k i=1, and (ii) every indicator vector ¯gi can be approximately expressed by a linear combination of {fi}k i=1. This leads to our structure theorem, which is illustrated in fig. 1. Theorem 3.1 (The Structure Theorem, Formal Statement). Let Υ = Ω(k2), and 1 6 i 6 k. Then, the following statements hold: 1. There is a linear combination of the eigenvectors f1, . . . , fk with coefficients α(i) j : fi = 2. There is a linear combination of the vectors ¯g1, . . . , ¯gk with coefficients β(i) j : gi = β(i) 1 ¯g1 + 1 f1 + ··· + α(i) α(i) k fk, such that (cid:13)(cid:13)(cid:13)gi − fi(cid:13)(cid:13)(cid:13) 2 6 1/Υ. ··· + β(i) k ¯gk, such that kfi − gik2 6 1.1k/Υ. 5 fi Part 1 k fi − gik2 6 1/Υ fi = a linear combination of {fj } with coefficients α(i) j fi Part 2 kfi − gik2 6 1.1k/Υ ¯gi gi gi = a linear combination of {¯gj } with coefficients β(i) j Figure 1: Relations among { fi}, {fi}, {¯gi}, and {gi} given in Theorem 3.1. Here Υ is the gap defined with respect to λk+1 and ρ(k). Part 1 of Theorem 3.1 shows that the normalized indicator vectors ¯gi of every cluster Si can be approximated by a linear combination of the first k eigenvectors, with respect to the value of Υ. The proof follows from the fact that if ¯gi has small Rayleigh quotient, then the inner product between ¯gi and the eigenvectors corresponding to larger eigenvalues must be small. This statement was also shown implicitly in Theorem 2.2 of [2]. Proof of Part 1 of Theorem 3.1. We write gi as a linear combination of the eigenvectors of L, i.e. and let the vector fi be the projection of vector ¯gi on the subspace spanned by {fi}k i=1, i.e. gi = α(i) 1 f1 + ··· + α(i) n fn By the definition of Rayleigh quotients, we have that λn k fk. fi = α(i) 1 f1 + ··· + α(i) n fn(cid:17)⊺ n fn(cid:17) R(gi) =(cid:16)α(i) L(cid:16)α(i) 1 f1 + ··· + α(i) 1 f1 + ··· + α(i) =(cid:16)α(i) n (cid:17)2 1 (cid:17)2 λ1 + ··· +(cid:16)α(i) λk +(cid:18)1 − α′ −(cid:16)α(i) 1 (cid:17)2(cid:19) λk+1, >(cid:16)α(i) 2 (cid:17)2 λ2 + ··· +(cid:16)α(i) k (cid:17)2 k (cid:17)2 + ··· +(cid:16)α(i) 1 − α′ −(cid:16)α(i) 1 (cid:17)2 n (cid:17)2 kgi − fik2 =(cid:16)α(i) k+1(cid:17)2 + ··· +(cid:16)α(i) = 1 − α′ −(cid:16)α(i) 1 (cid:17)2 6 R(gi)/λk+1 6 1/Υ, . Therefore, we have that 6 1/Υ, where α′ ,(cid:16)α(i) 2 (cid:17)2 and which finishes the proof. i=1. This is because both of {fi}k Part 2 of Theorem 3.1 is more interesting, and shows that the opposite direction holds as well, i.e., any fi (1 6 i 6 k) can be approximated by a linear combination of the normalized indicator vectors {gi}k i=1. To sketch the proof, note that if we could write every gi exactly as a linear combination of {fi}k i=1, then we could write every fi (1 6 i 6 k) as a linear combination of {gi}k i=1 are sets of linearly independent vectors of the same dimension and span{g1, . . . , gk} ⊆ span{f1, . . . , fk}. However, the gi's are only close to a linear combination of the first k eigenvectors, as shown in Part 1. We will denote this combination as fi, and use the fact that the errors of approximation are small to show that these { fi}k i=1 are almost orthogonal between each other. This allows us to show that span{ f1, . . . , fk} = span{f1, . . . , fk}, which implies Part 2. i=1 and {gi}k We will use the following two classical results in our proof. 6 Theorem 3.2 (Gersgorin Circle Theorem). Let A be an n × n matrix , and let Ri(A) = defined by Pj6=i Ai,j, for 1 6 i 6 n. Then, all eigenvalues of A are in the union of Gersgorin Discs n[i=1 {z ∈ C : z − Ai,i 6 Ri(A)} . Theorem 3.3 (Corollary 6.3.4, [15]). Let A be an n × n real and symmetric matrix with eigenvalues λ1, . . . , λn, and E be an n × n matrix. If λ is an eigenvalue of A + E, then there is some eigenvalue λi of A for which λ − λi 6 kEk. Proof of Part 2 of Theorem 3.1. By Part 1, every gi is approximated by a vector fi defined by fi = α(i) 1 f1 + ··· α(i) k fk. Define a k by k matrix A such that Ai,j = α(j) i , i.e., the jth column of matrix A consists of representing fj. We express the jth column of A by a vector α(j), defined as α(j) =(cid:16)α(j) j=1 are linearly independent, which implies that { f (j)}k j=1 are linearly independent as well. To prove this, we will show that A⊺A has no zero eigenvalue, and hence A is invertible. We will show that the vectors(cid:8)α(j)(cid:9)k First of all, notice that it holds by the orthonormality of {fi}k k (cid:17)⊺ 1 ,··· , α(j) i=1 that . i ok valuesnα(j) i=1 where the first inequality follows from the orthonormality of ¯gi and ¯gj, and the second inequality follows by Part 1 of Theorem 3.1. So it holds for any i 6= j that (cid:12)(cid:12)(cid:12)Dα(i), α(j)E(cid:12)(cid:12)(cid:12) =(cid:12)(cid:12)(cid:12)D fi, fjE(cid:12)(cid:12)(cid:12) =(cid:12)(cid:12)(cid:12)D¯gi − (¯gi − fi), ¯gj − (¯gj − fj)E(cid:12)(cid:12)(cid:12) =(cid:12)(cid:12)(cid:12)h¯gi, ¯gji −D¯gi − fi, ¯gjE −D¯gi, ¯gj − fjE +D¯gi − fi, ¯gj − fjE(cid:12)(cid:12)(cid:12) 6(cid:13)(cid:13)(cid:13)¯gi − fi(cid:13)(cid:13)(cid:13) +(cid:13)(cid:13)(cid:13)¯gj − fj(cid:13)(cid:13)(cid:13) +(cid:13)(cid:13)(cid:13)¯gi − fi(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)¯gj − fj(cid:13)(cid:13)(cid:13) 6 2p1/Υ + 1/Υ, =(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) Aℓ,iAℓ,j(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) kXℓ=1 kXℓ=1(cid:16)α(i) ℓ (cid:17)2 =(cid:12)(cid:12)(cid:12)Dα(i), α(j)E(cid:12)(cid:12)(cid:12) 6 3p1/Υ (A⊺A)i,j =(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) kXℓ=1 > 1 − 1/Υ. (A⊺A)i,i = ℓ α(j) α(i) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) ℓ while (cid:8)α(j)(cid:9)k Then, by the Gersgorin Circle Theorem (cf. Theorem 3.2), it holds that all the eigenvalues of A⊺A are at least 1 − 1/Υ − (k − 1) · 3p1/Υ. Therefore, A has no eigenvalue with value 0 as long as Υ > 10k2, proving that the vectors j=1 are linearly independent. Combining this with the fact that span{ f1, . . . , fk} ⊆ span{f1, . . . , fk} and dim(span ({f1, . . . , fk})) = k, it holds that span{ f1, . . . , fk} = span{f1, . . . , fk}. Hence, we can write every fi (1 6 i 6 k) as a linear combination of { fi}k i=1, i.e., fi = β(i) 1 f1 + β(i) 2 f2 + ··· + β(i) k fk. (3.3) 7 Now define the value of gi as gi = β(i) 1 g1 + β(i) 2 g2 + ··· + β(i) k gk, (3.4) 2 . Then, it holds that j (cid:17)2 j=1(cid:16)β(i) and define kβk2 =Pk ℓ (cid:17)2(cid:13)(cid:13)(cid:13) fℓ(cid:13)(cid:13)(cid:13) kXℓ=1(cid:16)β(i) ℓ′ D fℓ, fℓ′E +Xℓ6=ℓ′ 1 = kfik2 = (cid:12)(cid:12)(cid:12)β(i) ℓ (cid:12)(cid:12)(cid:12)Xℓ′6=ℓ(cid:12)(cid:12)(cid:12)β(i) ℓ′ (cid:12)(cid:12)(cid:12)D fℓ, fℓ′E > kβk2(1 − 1/Υ) −Xℓ > kβk2(1 − 1/Υ) −(cid:16)√k · kβk(cid:17) ·(cid:16)√k · kβk(cid:17) ·(cid:16)3 ·p1/Υ(cid:17) >(cid:16)1 − 1/Υ − 3k/√Υ(cid:17)kβk2, ℓ β(i) β(i) where the second inequality holds by the Cauchy-Schwarz inequality. Since Υ = Ω(k2), we have that Combining this with Part 1 of Theorem 3.1 and the Cauchy-Schwarz inequality, we have that 3k 6 1.1. 1 Υ − √Υ(cid:19)−1 kβk2 6(cid:18)1 − j (cid:12)(cid:12)(cid:12)(cid:13)(cid:13)(cid:13) fj − gj(cid:13)(cid:13)(cid:13) 6(cid:16)1/√Υ(cid:17) kXj=1(cid:12)(cid:12)(cid:12)β(i) kXj=1(cid:12)(cid:12)(cid:12)β(i) j (cid:12)(cid:12)(cid:12) 6p1.1k/Υ, kfi − gik 6 which proves Part 2 of the theorem. Theorem 3.1 shows a close connection between the first k eigenvectors and the indicator vectors of the clusters. We leverage this and the fact that the {gi}'s are almost orthogonal between each other to show that, for any two different clusters Si and Sj, there exists an eigenvector having reasonably different values on the coordinates which correspond to Si and Sj. 1 g1 + ··· + β(i) Lemma 3.4. Let Υ = Ω(k3). For any 1 6 i 6 k, let gi = β(i) kfi − gik 6 1.1k/Υ. Then, for any ℓ 6= j, there exists i ∈ {1, . . . , k} such that k gk be such that 1 10√k . (3.5) , for 1 6 i 6 k. Since ¯gi ⊥ ¯gj for any i 6= j, we have by the Proof. Let β(i) =(cid:16)β(i) 1 , . . . , β(i) orthonormality of g1,··· , gk that j (cid:12)(cid:12)(cid:12) > ζ , ℓ − β(i) (cid:12)(cid:12)(cid:12)β(i) k (cid:17)⊺ hgi, gji =Dβ(i) 1 g1 + ··· + β(i) kXℓ=1 ℓ β(j) β(i) = ℓ kgℓk2 =Dβ(i), β(j)E , k gk, β(j) k gkE 1 g1 + ··· + β(j) and (cid:12)(cid:12)(cid:12)Dβ(i), β(j)E(cid:12)(cid:12)(cid:12) = hgi, gji = hfi − (fi − gi), fj − (fj − gj)i = hfi, fji − hfi − gi, fji − hfj − gj, fii + hfi − gi, fj − gji 6 kfi − gik + kfj − gjk + kfi − gikkfj − gjk 6 2.2pk/Υ + 1.1k/Υ. 8 Moreover, it holds that and which implies that (cid:13)(cid:13)(cid:13)β(i)(cid:13)(cid:13)(cid:13) = kgik = kfi + gi − fik 6 1 + kgi − fik 6 1 +p1.1k/Υ, (cid:13)(cid:13)(cid:13)β(i)(cid:13)(cid:13)(cid:13) = kgik = kfi + gi − fik > 1 − kgi − fik > 1 −p1.1k/Υ, (cid:13)(cid:13)(cid:13)β(i)(cid:13)(cid:13)(cid:13) ∈(cid:16)1 − (2.2pk/Υ + 1.1k/Υ), 1 + 2.2pk/Υ + 1.1k/Υ(cid:17) . 2 In other words, we showed that β(i)'s are almost orthonormal. Now we construct a k by k matrix B, where the jth column of B is β(j). By the Gersgorin Circle Theorem (Theorem 3.2), all eigenvalues λ of B⊺B satisfies for any i. Combing this with (3.6), we have that the eigenvalues of B⊺B are close to 1. λ − (B⊺B)i,i 6 (k − 1) · (2.2pk/Υ + 1.1k/Υ) (3.7) and β(i) j are far from each other by contradiction. Suppose there Now we show that β(i) ℓ exist ℓ 6= j such that (3.6) ζ′ , max 16i6k(cid:12)(cid:12)(cid:12)β(i) ℓ − β(i) j (cid:12)(cid:12)(cid:12) < 1 10√k . This implies that the jth row and ℓth row of matrix B are somewhat close to each other. Let us now define matrix E ∈ Rk×k, where j − β(i) and Et,i = 0 for any t 6= ℓ and 1 6 i 6 k. Moreover, let Q = B + E. Eℓ,i , β(i) ℓ , Notice that Q has two identical rows, and rank at most k − 1. Therefore, Q has an eigenvalue with value 0, and the spectral norm kEk of E, the largest singular value of E, is at most √kζ′. By definition of matrix Q we have that Q⊺Q = B⊺B + B⊺E + E⊺B + E⊺E. Since B⊺B is symmetric and 0 is an eigenvalue of Q⊺Q, by Theorem 3.3 we know that, if λ is an eigenvalue of Q⊺Q, then there is an eigenvalue λ of B⊺B such that λ − λ 6 kB⊺E + E⊺B + E⊺Ek 6 kB⊺Ek + kE⊺Bk + kE⊺Ek 6 4√kζ′ + kζ′2, which implies that λ > λ − 4√kζ′ − kζ′2 > 1 − k(2.2pk/Υ + 1.1k/Υ) − 4√kζ′ − kζ′2, due to (3.6) and (3.7). By setting λ = 0, we have that 1 − k(2.2pk/Υ + 1.1k/Υ) − 4√kζ′ − kζ′2 6 0. By the condition of Υ = Ω(k3), the inequality above implies that ζ′ > 1 contradiction. 10√k , which leads to a 9 We point out that it was shown in [21] that the first k eigenvectors can be approximated by a (2k + 1)-step function. The quality of the approximation is the same as the one given by our structure theorem. However, a (2k + 1)-step approximation is not enough to show that most vertices belonging to the same cluster are mapped close to each other in the spectral embedding. We further point out that standard matrix perturbation theorems cannot be applied in our setting. For instance, we look at a well-clustered graph G that contains a subset C of a cluster Si such that most neighbors of vertices in C are outside Si. In this case, the adjacency matrix representing crossing edges of G has high spectral norm, and hence standard matrix perturbation arguments could not give us a meaningful result. However, our structure theorem takes the fact that vol(C) has to be small into account, and that is why the structure theorem is needed to analyze the cut structure of a graph. 4 Analysis of Spectral Clustering In this section we analyze an algorithm based on the classical spectral clustering paradigm, and give an approximation guarantee of this method on well-clustered graphs. We will show that any k-means algorithm AlgoMean(X , k) with certain approximation guarantee can be used for the k-way partitioning problem. Furthermore, it suffices to call AlgoMean in a black-box manner with a point set X ⊆ Rk. This section is structured as follows. We first give a quick overview of spectral and k-means clustering in Section 4.1. In Section 4.2, we use the structure theorem to analyze the spectral embedding. Section 4.3 gives a general result about k-means when applied to this embedding, and the proof of Theorem 1.2. k-Means Clustering 4.1 Given a set of points X ⊆ Rd, a k-means algorithm AlgoMean(X , k) seeks to find a set K of k centers c1,··· , ck to minimize the sum of the ℓ2 2-distance between x ∈ X and the center to which it is assigned. Formally, for any partition X1,··· ,Xk of the set X ⊆ Rd, we define the cost function by COST(X1, . . . ,Xk) , min c1,...,ck∈Rd kXi=1 Xx∈Xi kx − cik2, i.e., the COST function minimizes the total ℓ2 2-distance between the points x's and their indi- vidually closest center ci, where c1, . . . , ck are chosen arbitrarily in Rd. We further define the optimal clustering cost by ∆2 k(X ) , min partition X1,...,Xk COST(X1, . . . ,Xk). (4.1) Spectral clustering can be described as follows: (i) Compute the bottom k eigenvectors f1,··· , fk of the normalized Laplacian matrix1 of graph G. (ii) Map every vertex u ∈ V [G] to a point F (u) ∈ Rk according to F (u) = 1 NormalizationFactor(u) · (f1(u), . . . , fk(u))⊺ , (4.2) with a proper normalization factor NormalizationFactor(u) ∈ R for each u ∈ V . (iii) Let X , {F (u) : u ∈ V } be the set of the embedded points from vertices in G. Run AlgoMean(X , k), and group the vertices of G into k clusters according to the output of AlgoMean(X , k). This 1Other graph matrices (e.g. the adjacency matrix, and the Laplacian matrix) are also widely used in prac- tice. Notice that, with proper normalization, the choice of these matrices does not substantially influence the performance of k-means algorithms. 10 approach that combines a k-means algorithm with a spectral embedding has been widely used in practice for a long time, although there was a lack of rigorous analysis of its performance prior to our result. 4.2 Analysis of the Spectral Embedding The first step of spectral clustering is to map vertices of a graph into points in Euclidean space, through the spectral embedding (4.2). This subsection analyzes the properties of this embedding. Let us define the normalization factor to be NormalizationFactor(u) ,pdu. We will show that the embedding (4.2) with the normalization factor above has very nice properties: embedded points from the same cluster Si are concentrated around their center ci ∈ Rk, and embedded points from different clusters of G are far from each other. These properties imply that a simple k-means algorithm is able to produce a good clustering2. We first define k points p(i) ∈ Rk (1 6 i 6 k), where p(i) , 1 pvol (Si)(cid:16)β(1) i , . . . , β(k) i (cid:17)⊺ (4.3) and the parameters {β(j) i }k j=1 are defined in Theorem 3.1. We will show in Theorem 4.1 that all embedded points Xi , {F (u) : u ∈ Si} (1 6 i 6 k) are concentrated around p(i). Moreover, 2-distance between points in Xi and p(i), which is proportional to 1/Υ: the we bound the total ℓ2 bigger the value of Υ, the higher concentration the points within the same cluster have. Notice that we do not claim that p(i) is the actual center of Xi. However, these approximated points p(i)'s suffice for our analysis. Lemma 4.1. It holds that kXi=1 Xu∈Si Proof. Since gj(u) =q du definition, we have that vol(Si) β(j) i and p(i) kXi=1 Xu∈Si j (cid:17)2 du(cid:16)F (u)j − p(i) hold for any 1 6 j 6 k and u ∈ Si by 6 1.1k2/Υ. 2 j = du(cid:13)(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)(cid:13) du 1 √du 1√vol(Si) β(j) i = = fj(u) − kXi=1 Xu∈Si kXi=1 Xu∈Si fj(u) −s du kXi=1 Xu∈Si = kfj − gjk2 6 1.1k/Υ, (fj(u) − gj(u))2 = vol(Si) i !2 β(j) 1 pvol(Si) i !2 β(j) where the last inequality follows from Theorem 3.1. Summing over all j for 1 6 j 6 k implies that kXi=1 Xu∈Si du(cid:13)(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)(cid:13) 2 = kXi=1 kXj=1Xu∈Si j (cid:17)2 du(cid:16)F (u)j − p(i) 6 1.1k2/Υ. 2Notice that this embedding is similar with the one used in [22], with the only difference that F (u) is not normalized and so it is not necessarily a unit vector. This difference, though, is crucial for our analysis. 11 The next lemma shows that the ℓ2 2-norm of p(i) is inversely proportional to the volume of Si. This implies that embedded points from a big cluster are close to the origin, while embedded points from a small cluster are far from the origin. Lemma 4.2. It holds for every 1 6 i 6 k that Proof. By (4.3), we have that 99 100 vol(Si) 6 101 100 vol(Si) . 2 6(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) vol(Si)(cid:13)(cid:13)(cid:13)(cid:16)β(1) 1 i 2 = (cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) , . . . , β(k) 2 . i (cid:17)⊺(cid:13)(cid:13)(cid:13) Notice that p(i) is just the ith row of the matrix B defined in the proof of Theorem 3.4, normalized bypvol(Si). Since B and B⊺ share the same singular values (this follows from the SVD decomposition), by (3.7) the eigenvalues of BB⊺ are close to 1. But since (BB⊺)i,i is equal to the ℓ2 2-norm of the ith row of B, we have that i (cid:13)(cid:13)(cid:13)(cid:16)β(1) , . . . , β(k) 2 i (cid:17)⊺(cid:13)(cid:13)(cid:13) which implies the statement. ∈(cid:16)1 − (2.2pk/Υ + 1.1k/Υ), 1 + 2.2pk/Υ + 1.1k/Υ(cid:17) , (4.4) We will further show in Theorem 4.3 that these points p(i)(1 6 i 6 k) exhibit another excellent property: the distance between p(i) and p(j) is inversely proportional to the volume of the smaller cluster between Si and Sj. Therefore, points in Si of smaller vol(Si) are far from points in Sj of bigger vol(Sj). Notice that, if this were not the case, a misclassification of a small fraction of points in Sj could introduce a large error to Si. Lemma 4.3. For every i 6= j, it holds that > ζ 2 2 , 10 min {vol(Si), vol(Sj)} (cid:13)(cid:13)(cid:13)p(i) − p(j)(cid:13)(cid:13)(cid:13) where ζ is defined in (3.5). Proof. Let Si and Sj be two arbitrary clusters. By Theorem 3.4, there exists 1 6 ℓ 6 k such that By the definition of p(i) and p(j) it follows that p(i) kp(i)k − (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) vuut 2 . j 2 p(j) β(ℓ) i β(ℓ) j i − β(ℓ) (cid:12)(cid:12)(cid:12)β(ℓ) (cid:12)(cid:12)(cid:12) > ζ. > (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) kp(j)k(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) i (cid:17)2 − rPk rPk t=1(cid:16)β(t) j (cid:17)2 t=1(cid:16)β(t) j (cid:17)⊺(cid:13)(cid:13)(cid:13) ∈(cid:18)1 − =(cid:13)(cid:13)(cid:13)(cid:16)β(1) j (cid:17)2 kXℓ=1(cid:16)β(ℓ) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) kp(j)k(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) j (cid:17)2 2 ·(cid:16)β(ℓ) i − β(ℓ) kp(i)k − 1 2 · ζ 2,  10(cid:19) . , . . . , β(k) ζ 10 , 1 + p(j) p(i) > > 1 ζ 2 j 12 By (4.4), we know that Therefore, we have that . By Theorem 4.2, it holds that and , , 2 9 > and p(j) kp(i)k 10 · vol(Si) * p(i) kp(j)k+ 6 1 − ζ 2/4. Without loss of generality, we assume that(cid:13)(cid:13)p(i)(cid:13)(cid:13)2 >(cid:13)(cid:13)p(j)(cid:13)(cid:13)2 (cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) (cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) >(cid:13)(cid:13)(cid:13)p(j)(cid:13)(cid:13)(cid:13) (cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) We can now finish the proof by considering two cases based on(cid:13)(cid:13)p(i)(cid:13)(cid:13). Case 1: Suppose that(cid:13)(cid:13)p(i)(cid:13)(cid:13) > 4(cid:13)(cid:13)p(j)(cid:13)(cid:13). We have that 4(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) , (cid:13)(cid:13)(cid:13)p(i) − p(j)(cid:13)(cid:13)(cid:13) >(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) −(cid:13)(cid:13)(cid:13)p(j)(cid:13)(cid:13)(cid:13) > 10 min {vol(Si), vol(Sj)} Hence, it holds that 10 · vol(Sj) which implies that > > 3 9 9 2 2 2 . . . 1 2 min{vol(Si), vol(Sj)} 2 2 2 2 2 9 > > (cid:13)(cid:13)(cid:13)p(i) − p(j)(cid:13)(cid:13)(cid:13) 16(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) (cid:13)(cid:13)(cid:13)p(i) − p(j)(cid:13)(cid:13)(cid:13) Case 2: Suppose(cid:13)(cid:13)p(j)(cid:13)(cid:13) = α(cid:13)(cid:13)p(i)(cid:13)(cid:13) for α ∈ ( 1 =(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) +(cid:13)(cid:13)(cid:13)p(j)(cid:13)(cid:13)(cid:13) >(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) +(cid:13)(cid:13)(cid:13)p(j)(cid:13)(cid:13)(cid:13) = (1 + α2)(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) = (1 + α2 − 2α + αζ 2/2) ·(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) 2 ·(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) > ζ 2 · αζ 2 > 2 2 2 2 4 , 1]. In this case, we have that , p(j) kp(i)k kp(j)k+(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)p(j)(cid:13)(cid:13)(cid:13) − 2* p(i) − 2(1 − ζ 2/4) ·(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)(cid:13)p(j)(cid:13)(cid:13)(cid:13) − 2(1 − ζ 2/4)α ·(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) 2 2 10 min {vol(Si), vol(Sj)} 1 , and the lemma follows. 4.3 Approximation Guarantees of Spectral Clustering Now we analyze why spectral clustering performs well for solving the k-way partitioning prob- lem. We assume that A1, . . . , Ak is any k-way partition returned by a k-means algorithm with an approximation ratio of APT. We map every vertex u to du identical points in Rk. This "trick" allows us to bound the volume of the overlap between the clusters retrieved by a k-means algorithm and the optimal ones. For this reason we define the cost function of partition A1, . . . , Ak of V [G] by COST(A1, . . . , Ak) , min c1,...,ck∈Rk kXi=1 Xu∈Ai dukF (u) − cik2, 13 and the optimal clustering cost is defined by ∆2 k , min partition A1,...,Ak COST(A1, . . . , Ak). i.e., we define the optimal clustering cost in the same way as in (4.1), except that we look at the embedded points from vertices of G in the definition. From now on, we always refer COST and ∆2 k as the COST and optimal COST values of points {F (u)}u∈V , and for technical reasons every point is counted du times. The next lemma gives an upper bound to the cost of the optimal k-means clustering which depends on the gap Υ Lemma 4.4. It holds that ∆2 k 6 1.1k2/Υ. Proof. Since ∆2 k is obtained by minimizing over all partitions A1, . . . , Ak and c1, . . . , ck, we have ∆2 k 6 kXi=1 Xu∈Si du(cid:13)(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)(cid:13) Hence the statement follows by applying Theorem 4.1. 2 . (4.5) Since A1,··· , Ak is the output of a k-means algorithm with approximation ratio APT, by Theorem 4.4 we have that COST(A1, . . . , Ak) 6 APT · 1.1k2/Υ. We will show that this upper bound of APT · 1.1k2/Υ suffices to show that this approximate clustering A1, . . . , Ak is close to the "actual" clustering S1, . . . , Sk, in the sense that (i) every Ai has low conductance, and (ii) under a proper permutation σ : {1, . . . , k} → {1, . . . , k}, the symmetric difference between Ai and Sσ(i) is small. The fact is proven by contradiction: If we could always find a set Ai with high symmetric difference with its correspondence Sσ(i), regardless of how we map {Ai} to their corresponding {Sσ(i)}, then the COST value will be high, which contradicts to the fact that COST(A1, . . . , Ak) 6 APT · 1.1k2/Υ. The core of of the whole contradiction arguments is the following technical lemma, whose proof will be presented in the next subsection. Lemma 4.5. Let A1, . . . , Ak be a partition of V . Suppose that, for every permutation of the indices σ : {1, . . . , k} → {1, . . . , k}, there exists i such that vol(cid:0)Ai△Sσ(i)(cid:1) > 2ε vol(cid:0)Sσ(i)(cid:1) for ε > 105 · k3/Υ, then COST(A1, . . . , Ak) > 10−4 · ε/k. Proof of Theorem 1.2. Let A1, . . . , Ak be a k-way partition that achieves an approximation ratio of APT, and let 2 · 105 · k3 · APT . ε = Υ We first show that there exists a permutation σ of the indices such that vol(cid:0)Ai△Sσ(i)(cid:1) 6 ε vol(Sσ(i)), for any 1 6 i 6 k. (4.6) Assume for contradiction that for all permutation σ there is 1 6 i 6 k such that This implies by Theorem 4.5 that vol(Ai△Sσ(i)) > ε vol(cid:0)Sσ(i)(cid:1) . COST(A1, . . . , Ak) > 10 · APT · k2/Υ, which contradicts to the fact that A1, . . . , Ak is an APT-approximation to a k-way partition, whose corresponding k-means cost is at most 1.1 · APT · k2/Υ. 14 Now we assume that σ : {1,··· , k} → {1,··· , k} is the permutation satisfying (4.6), and bound the conductance of every cluster Ai. For any 1 6 i 6 k, the number of leaving edges of Ai is upper bounded by ∂ (Ai) 6(cid:12)(cid:12)∂(cid:0)Ai \ Sσ(i)(cid:1)(cid:12)(cid:12) +(cid:12)(cid:12)∂(cid:0)Ai ∩ Sσ(i)(cid:1)(cid:12)(cid:12) 6(cid:12)(cid:12)∂(cid:0)Ai△Sσ(i)(cid:1)(cid:12)(cid:12) +(cid:12)(cid:12)∂(cid:0)Ai ∩ Sσ(i)(cid:1)(cid:12)(cid:12) . Notice that(cid:12)(cid:12)∂(cid:0)Ai△Sσ(i)(cid:1)(cid:12)(cid:12) 6 ε vol(cid:0)Sσ(i)(cid:1) by our assumption on σ, and every node in(cid:12)(cid:12)∂(cid:0)Ai ∩ Sσ(i)(cid:1)(cid:12)(cid:12) either belongs to ∂Sσ(i) \ Sσ(i) or ∂(cid:0)Ai△Sσ(i)(cid:1), hence =(cid:0)2ε + φG(cid:0)Sσ(i)(cid:1)(cid:1) vol(Sσ(i)). vol (Ai) > vol(cid:0)Ai ∩ Sσ(i)(cid:1) > (1 − 2ε) vol(Sσ(i)). ∂ (Ai) 6 ε vol(cid:0)Sσ(i)(cid:1) + φG(cid:0)Sσ(i)(cid:1) vol(cid:0)Sσ(i)(cid:1) + ε vol(cid:0)Sσ(i)(cid:1) On the other hand, we have that Hence, φG(Ai) 6 (2ε + φG(Sσ(i))) vol(Sσ(i)) (1 − 2ε) vol(Sσ(i)) 2ε + φG(Sσ(i)) = 6 1.1 · φG(Sσ(i)) + O(APT · k3/Υ). 1 − 2ε 4.4 Proof of Theorem 4.5 It remains to show Theorem 4.5. Our proof is based on the following high-level idea: suppose by contradiction that there is a cluster Sj which is very different from every cluster Aℓ. Then there is a cluster Ai with significant overlap with two different clusters Sj and Sj′ (Theorem 4.6). However, we already proved in Theorem 4.3 that any two clusters are far from each other. This implies that the COST value of A1, . . . , Ak is high, which leads to a contradiction. Lemma 4.6. Suppose for every permutation π : {1, . . . , k} → {1, . . . , k} there exists an index i such that vol(cid:0)Ai△Sπ(i)(cid:1) > 2ε vol(cid:0)Sπ(i)(cid:1). Then, at least one of the following two cases holds: 1. for any index i there are indices i1 6= i2 and εi > 0 such that vol(Ai ∩ Si1) > vol(Ai ∩ Si2) > εi min{vol(Si1), vol(Si2)}, Proof. Let σ : {1, . . . , k} → {1, . . . , k} be the function defined by σ(i) = argmax 16j6k vol(Ai ∩ Sj) vol(Sj) . We first assume that σ is one-to-one, i.e. σ is a permutation. By the hypothesis of the lemma, there exists an index i such that vol(Ai△Sσ(i)) > 2ε vol(Sσ(i)). Without loss of generality, we assume that i = 1 and σ(j) = j for j = 1, . . . , k. Notice that vol (A1△S1) =Xj6=1 vol (Aj ∩ S1) +Xj6=1 vol (A1 ∩ Sj) . (4.7) 15 2. there exist indices i, ℓ and εj > 0 such that, for j 6= ℓ, vol(Ai ∩ Sℓ) > εi vol(Sℓ), vol(Ai ∩ Sj) > εi vol(Sℓ) i=1 εi > ε; i=1 εi > ε. and Pk and Pk Hence, one of the summations on the right hand side of (4.7) is at least ε vol (S1). Now the proof is based on the case distinction. Case 1: Assume thatPj6=1 vol (Aj ∩ S1) > ε vol(S1). We define τj for 2 6 j 6 k to be vol (Aj ∩ S1) . τj = vol (S1) We have that and by the definition of σ it holds that τj > ε, Xj6=1 vol (Aj ∩ Sj) vol (Sj) > vol (Aj ∩ S1) vol (S1) = τj for 2 6 j 6 k. Setting εj = τj for 2 6 j 6 k and ε1 = 0 finishes the proof of Case 1. Case 2: Assume that Xj6=1 vol (A1 ∩ Sj) > ε vol(S1). (4.8) Let us define τ′j for 1 6 j 6 k, j 6= 1, to be Then, (4.8) implies that τ′j = vol(A1 ∩ Sj) vol (S1) . τ′j > ε. Xj6=1 The statement in this case holds by assuming vol (A1 ∩ S1) > ε vol (S1), since otherwise we have vol (S1) − vol (A1 ∩ S1) =Xj6=1 vol (Aj ∩ S1) > (1 − ε) vol (S1) > ε vol (S1) , and this case was proven in Case 1. So it suffices to study the case in which σ defined earlier is not one-to-one. Then, there is j (1 6 j 6 k) such that j 6∈ {σ(1),··· , σ(k)}. For any 1 6 ℓ 6 k, let τ′′ℓ = vol(Aℓ ∩ Sj) vol(Sj) . Then,Pk ℓ=1 τ′′ℓ = 1 > ε and it holds for any 1 6 ℓ 6 k that vol(cid:0)Aℓ ∩ Sσ(ℓ)(cid:1) vol(cid:0)Sσ(ℓ)(cid:1) > vol(Aℓ ∩ Sj) vol(Sj) = τ′′ℓ . Proof of Theorem 4.5. We first consider the case when part 1 of Theorem 4.6 holds, i.e., for every i there exist i1 6= i2 such that vol(Ai ∩ Si1) > εi min{vol(Si1), vol(Si2)}, vol(Ai ∩ Si2) > εi min{vol(Si1), vol(Si2)}, (4.9) for some ε > 0, andPk Let ci be the center of Ai. Let us assume without loss of generality that kci − p(i1)k > kci− p(i2)k, which implies kp(i1)− cik > kp(i1)− p(i2)k/2. However, points in Bi = Ai∩ Si1 are far away from ci, see fig. 2. We lower bound the value of COST(A1, . . . , Ak) by only looking at the i=1 εi > ε. 16 contribution of points in the Bis . Notice that by Theorem 4.1 the sum of the squared-distances between points in Bi and p(i1) is at most k2/Υ, while the distance between p(i1) and p(i2) is large (Theorem 4.3). Therefore, we have that COST(A1, . . . , Ak) = kXi=1 Xu∈Ai dukF (u) − cik2 > kXi=1 Xu∈Bi dukF (u) − cik2 By applying the inequality a2 + b2 > (a − b)2/2, we have that 2! −(cid:13)(cid:13)(cid:13)F (u) − p(i1)(cid:13)(cid:13)(cid:13) kXi=1 Xu∈Bi du(cid:13)(cid:13)(cid:13)F (u) − p(i1)(cid:13)(cid:13)(cid:13) 2 (4.10) (4.11) COST(A1, . . . , Ak) > > > > > > > > 2 Υ − − 2 2 1.1k2 du (cid:13)(cid:13)p(i1) − ci(cid:13)(cid:13)2 kXi=1 Xu∈Bi du(cid:13)(cid:13)p(i1) − ci(cid:13)(cid:13)2 kXi=1 Xu∈Bi du(cid:13)(cid:13)p(i1) − ci(cid:13)(cid:13)2 kXi=1 Xu∈Bi du(cid:13)(cid:13)p(i1) − p(i2)(cid:13)(cid:13)2 kXi=1 Xu∈Bi kXi=1 80 min {vol(Si1), vol(Si2)} − kXi=1 ζ 2εi min{vol(Si1), vol(Si2)} 80 min {vol(Si1), vol(Si2)} − kXi=1 ζ 2εi 80 − 1.1k2 ζ 2 vol(Bi) 1.1k2 1.1k2 − Υ 8 ζ 2ε 80 − Υ Υ > ζ 2ε 100 1.1k2 Υ 1.1k2 Υ where (4.10) follows from Theorem 4.1, (4.11) follows from Theorem 4.3 and the last inequality follows from the assumption that ε > 105 · k3/Υ. j 6= ℓ, it holds that Now, suppose that part 2 of Theorem 4.6 holds, i.e. there are indices i, ℓ such that, for any vol(Ai ∩ Sℓ) > εi vol(Sℓ), vol(Ai ∩ Sj) > εi vol(Sℓ) for some ε > 0, andPk any j 6= i, Bj = Ai ∩ Sj, Sj1 = Sℓ, and Sj2 = Sj. i=1 εi > ε. In this case, we only need to repeat the proof by setting, for 5 Partitioning Well-Clustered Graphs in Nearly-Linear Time In this section we present a nearly-linear time algorithm for partitioning well-clustered graphs, and prove Theorem 1.3. At a high level, our algorithm follows the general framework of k-means algorithms, and consists of two steps: the seeding step, and the grouping step. The seeding step chooses k candidate centers such that each one is close to the actual center of a different 17 Si1 Bi u p(i1) Ai ci Si2 p(i2) Figure 2: We use the fact that (cid:13) at the contribution of points u ∈ Bi for all 1 6 i 6 k. (cid:13)p(i1) − ci (cid:13) (cid:13) > (cid:13) (cid:13)p(i2) − ci (cid:13) (cid:13), and lower bound the value of COST function by only looking cluster. The grouping step assigns the remaining vertices to their individual closest candidate centers. All the proofs for the seeding and grouping steps assume that we have an embedding {x(u)}u∈V [G] satisfying the following two conditions: 1 10 log n(cid:19) · kF (u)k2 6kx(u)k2 6 kF (u)k2 + (cid:18)1 − 10 log n(cid:19) · kF (u) − F (v)k2 6kx(u) − x(v)k2 6 kF (u) − F (v)k2 + 1 n5 , (cid:18)1 − 1 (5.1) (5.2) 1 n5 Notice that these two conditions hold trivially if {x(u)}u∈V [G] is the spectral embedding {F (u)}u∈V [G], or any embedding produced by good approximations of the first k eigenvectors. However, obtaining such embedding becomes non-trivial for a large value of k, as directly computing the first k eigenvectors takes super-linear time. We will present a nearly-linear time algorithm that computes an embedding satisfying (5.1) and (5.2). By using standard dimensionality reduction techniques that approximately preserve pairwise distances, such as the Johnson-Lindenstrauss transform (see e.g. [11]), we can also always assume that the dimension of the embedding {x(u)}u∈V [G] is d = O(log3 n). Throughout the whole section, we assume k = ω(poly log n) and Υ =eΩ(k5). This section is organized as follows: Section 5.1 and Section 5.2 discuss the seeding and grouping steps, assuming that we have an embedding {x(u)}u∈V [G] that satisfies (5.1) and (5.2), and Section 5.3 analyzes the approximation guarantee of the partition returned by the grouping step. In Section 5.4, we present an algorithm that computes all required quantities in nearly-linear time, assuming that we know the value of λk. This assumption on λk will be finally removed in Section 5.5, and this leads to our final algorithm which corresponds to Theorem 1.3. 5.1 The Seeding Step We proved in Section 4.2 that the approximate center p(i) for every 1 6 i 6 k satisfies 99 100 vol(Si) 2 6 101 100 vol(Si) , and most embedded points F (u) are close to their approximate centers. Together with (5.1) and (5.2), these two properties imply that, when sampling points x(u) with probability proportional to du · kx(u)k2, vertices from different clusters will be approximately sampled with the same 6(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) 18 probability. We will prove that, when sampling Θ(k log k) points in this way, with constant probability there is at least one point sampled from each cluster. In the next step remove the sampled points which are close to each other, and call this resulting set C ⋆. We prove that with constant probability there is exactly one point in C ⋆ from a cluster. Algorithm 1 below gives a formal description of the seeding step. Algorithm 1 SeedAndTrim(k,{x(u)}u∈V [G]) 1: input: the number of clusters k, and the embedding {x(u)}u∈V [G]. 2: Let K = Θ(k log k). 3: for i = 1, . . . , K do 4: 5: end for 6: for i = 2, . . . , K do Set ci = u with probability proportional to dukx(u)k2. 7: Delete all cj with j < i such that kx(ci) − x(cj)k2 < kx(ci)k2 2·104k . 8: end for 9: return the remaining sampled vertices. Now we analyze Algorithm 1. For any 1 6 i 6 k, we define Ei to be the sum of the ℓ2 between the embedded points from Si and p(i), i.e., 2-distance For any parameter ρ > 0, we define the radius of Si with respect to ρ to be Ei , Xu∈Si du(cid:13)(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)(cid:13) 2 . Rρ i , ρ · Ei vol(Si) , and define COREρ i ⊆ Si to be the set of vertices whose ℓ2 2-distance to p(i) is at most Rρ i , i.e., 6 Rρ i(cid:27) . 2 i ,(cid:26)u ∈ Si :(cid:13)(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)(cid:13) du(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)2 i ) 6 Pu∈Si i ) > max(cid:26)(cid:18)1 − Rρ i 1 ρ(cid:19) vol(Si), 0(cid:27) . = vol(Si) ρ , vol(Si \ COREρ vol(COREρ (5.3) (5.4) COREρ By the averaging argument it holds that and From now on, we set the parameter α , Θ(K log K). We first show that most embedded points of the vertices in Si are contained in the cores COREα i , for 1 6 i 6 k. Lemma 5.1. The following statements hold: i 1. Pu∈COREα 2. Pk i=1Pu /∈COREα du · kF (u)k2 > 1 − 1 100K . du · kF (u)k2 6 k i 100K . 19 Proof. By the definition of COREα i , it holds that where (5.5) follows from the fact that for all u ∈ COREρ (5.4), and (5.7) from the definition of Rρ i and the fact that i 0 i 2 1 1 1 1 1 > > > > i )dρ vol(COREρ du · kF (u)k2dρ Xu∈COREα du · kF (u)k2 αZ α 0 Xu∈COREρ i(cid:19)2 0 (cid:18)(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) −qRρ αZ α i ·(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13)(cid:19) max(cid:26)(cid:18)1 − 0 (cid:18)(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) αZ α − 2qRρ max(cid:26)(cid:16)1 − (2.2pk/Υ + 1.1k/Υ) − 3pEiρ(cid:17)(cid:18)1 − αZ α ρ(cid:19) vol(Si), 0(cid:27) dρ ρ(cid:19) , 0(cid:27) dρ i , kF (u)k > kp(i)k −pRρ · vol(Si) ∈(cid:16)1 − (2.2pk/Υ + 1.1k/Υ), 1 + 2.2pk/Υ + 1.1k/Υ(cid:17) . max(cid:26)(cid:16)1 − (2.2pk/Υ + 1.1k/Υ) − 4pk2ρ/Υ(cid:17)(cid:18)1 − , 0(cid:27) dρ max(cid:26)1 − (2.2pk/Υ + 1.1k/Υ) − 4pk2ρ/Υ − αZ α αZ α > 1 − (2.2pk/Υ + 1.1k/Υ) − 4kpα/Υ − ln α α 1 ρ > 1 1 1 2 (cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) 0 > 1 − , 100K Since Ei 6 1.1k2/Υ by Theorem 4.1, it holds that Xu∈COREα du · kF (u)k2 > 1 0 i (5.5) (5.6) (5.7) i , (5.6) from 1 ρ(cid:19) , 0(cid:27) dρ where the last inequality holds by the assumption on α and Υ. The second statement follows by the fact that kXi=1 Xu∈COREα i du · kF (u)k2 > k(cid:18)1 − 1 100K(cid:19) andPu∈V [G] du · kF (u)k2 = k. The next lemma shows that the embedded points from the same core are close to each other, while the embedded points from different cores are far from each other. Lemma 5.2. The following statements hold: 1. For any 1 6 i 6 k and any two vertices u, v ∈ COREα kx(u) − x(v)k2 6 min(cid:26) 11αk2 Υ vol(Si) i , it holds that , kx(u)k2 2 · 104 · k(cid:27) . 2. For any i 6= j, and u ∈ COREα i , v ∈ COREα j , it holds that kx(u) − x(v)k2 > 1 7000k vol(Si) > kx(u)k2 104k . 20 Proof. By the definition of COREα i , it holds for any u ∈ COREα i that (cid:13)(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)(cid:13) 6pRα i . i , and By the triangle inequality, it holds for any u ∈ COREα 2pRα 4αEi vol(Si) kF (u) − F (v)k2 6 4Rα i = 6 5αk2 Υ vol(Si) , i and v ∈ COREα i that kF (u) − F (v)k 6 where the last inequality follows from Theorem 4.1. Hence, by (5.2) it holds that kx(u) − x(v)k2 6 kF (u) − F (v)k2 + 1 n5 6 5αk2 Υ vol(Si) + 1 n5 6 11αk2 Υ vol(Si) , where we use the fact that 1 n5 ≪ 1 vol(Si) . On the other hand, we have that kF (u)k2 >(cid:16)(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) −pRα i(cid:17)2 > 9 10 vol(Si) , where the last inequality follow from Theorem 4.2 and the definition of Rα conditions on α, Υ, it also holds i . By (5.1) and the kx(u) − x(v)k2 6 5αk2 Υ vol(Si) + 1 n5 6 10αk2 Υ kF (u)k2 6 kx(u)k2 2 · 104 · k . With these we proved the first statement. Now for the second statement. By the triangle inequality, it holds for any pair of u ∈ COREα i and v ∈ COREα j that kF (u) − F (v)k >(cid:13)(cid:13)(cid:13)p(i) − p(j)(cid:13)(cid:13)(cid:13) −(cid:13)(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)(cid:13) −(cid:13)(cid:13)(cid:13)F (v) − p(j)(cid:13)(cid:13)(cid:13) . By Theorem 4.3, we have for any i 6= j that we obtain that Combining this with the fact that . 2 1 > 103k min{vol(Si), vol(Sj)} i 6s 1.1αk2 (cid:13)(cid:13)(cid:13)p(i) − p(j)(cid:13)(cid:13)(cid:13) (cid:13)(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)(cid:13) 6pRα kF (u) − F (v)k >(cid:13)(cid:13)(cid:13)p(i) − p(j)(cid:13)(cid:13)(cid:13) −(cid:13)(cid:13)(cid:13)F (u) − p(i)(cid:13)(cid:13)(cid:13) −(cid:13)(cid:13)(cid:13)F (v) − p(j)(cid:13)(cid:13)(cid:13) 103k min{vol(Si), vol(Sj)} −s 1.1αk2 >s >s 1.1 · 103k min{vol(Si), vol(Sj)} Υ vol(Si) 1 1 , . Υ vol(Si) −s 1.1αk2 Υ vol(Sj) Notice that therefore we have 1 n5 kx(u)k2 6 kF (u)k2 + kx(u) − x(v)k2 >(cid:18)1 − + 6 1 n5 6(cid:16)(cid:13)(cid:13)(cid:13)p(i)(cid:13)(cid:13)(cid:13) +pRα i(cid:17)2 10 log n(cid:19)kF (u) − F (v)k2 > 1 11 10 vol(Si) + 1 n5 6 11 9 vol(Si) , 1 7000k vol(Si) > kx(u)k2 104k . 21 1 n5(cid:19) 6 k + 1, du ·(cid:18)kF (u)k2 + 10 log n(cid:19) · kF (u)k2 >(cid:18)1 − 1 1 10 log n(cid:19) · k, SincePu∈V [G] dukF (u)k2 = k, it holds that dukx(u)k2 6 Xu∈V [G] du ·(cid:18)1 − Xu∈V [G] dukx(u)k2 > Xu∈V [G] and Xu∈V [G] 10 log n(cid:17) · k and k + 1. i k + 1 du · kx(u)k2 Pu∈COREα vertices is at most(cid:0)1 − 1 Pk i=1Pu∈Si\COREα (cid:16)1 − 1 10k(cid:1)K 6 1 10 log n(cid:17) · k cores of the clusters is at most i du · kx(u)k2 i.e., the total probability mass that we use to sample vertices, i.e. Pu∈V [G] dukx(u)k2, is between (cid:16)1 − 1 We first bound the probability that we sample at least one vertex from every core. For any fixed 1 6 i 6 k, the probability that a vertex from COREα i gets sampled is at least 1 − 1 3 · (k + 1) Therefore, the probability that we never encounter a vertex from COREα du · kF (u)k2 3(k + 1) > Pu∈COREα 100K > i > 1 10k . i after sampling K 10k . Also, the probability that a sampled vertex is outside the i=1 COREα We next show that, after sampling Θ(k log k) vertices, with constant probability the sampled i , and every core contains at least one sampled vertex. vertices are in the coresSk Lemma 5.3. Assume that K = Ω(k log k) vertices are sampled, in which each vertex is sam- pled with probability proportional to du · kx(u)k2. Then, with constant probability the set C = {c1 . . . cK} of sampled vertices satisfies the following properties: 1. Set C only contains vertices from the cores, i.e. C ⊆Sk 2. Set C contains at least one vertex from each cluster, i.e. C ∩ Si 6= ∅ for any 1 6 i 6 k. i=1 COREα i ; Proof. By (5.1), it holds for every vertex u that (cid:18)1 − 1 10 log n(cid:19) · kF (u)k2 6 kx(u)k2 6 kF (u)k2 + 1 n5 . 6 Pk i=1Pu∈Si\COREα du ·(cid:0)kF (u)k2 + n−5(cid:1) i k/2 6 k 100K + n−3 k/2 6 2 100K + 1 n2 . Taking a union bound over all these events gives that the total probability of undesired events is at most 1 10k k · + K ·(cid:18) 1 n2 + 2 100K(cid:19) 6 1 3 . Based on Theorem 5.2 and Theorem 5.3, we can simply delete one of the two vertices ci and cj whose distance is less than 10−4·kx(ci)k2/(2k). The following lemma presents the correctness and runtime of the procedure SeedAndTrim, i.e., Algorithm 1. Lemma 5.4. Given the embedding {x(u)}u∈V [G] of dimension d = O(log3 n) that satisfies (5.1) and (5.2), with constant probability the procedure SeedAndTrim returns a set C ⋆ of centers c1 . . . ck in eO(n + k2) time, such that each COREα i contains exactly one vertex in C ⋆. 22 Proof. Since the sampled set C contains at least one vertex from each core COREα i with con- stant probability, and only vertices from different cores will remain in C ⋆ by Theorem 5.2 and the algorithm description, the SeedAndTrim procedure returns k centers with constant probability. Now we analyze the runtime. The procedure takes eO(n) time to compute the norms of {x(u)}u∈V [G], since the embedding has dimension O(log3 n) by assumption. It takes eO(k) time to sample eO(k) vertices, and trimming the sampling vertices takes eO(k2) time. Hence, the total runtime is eO(n + k2) . As the end of this subsection, we would like to mention that choosing good candidate centers is crucial for most k-means algorithms, and has been studied extensively in the literature (e.g. [6, 31]). Comparing with recent algorithms that obtain good initial centers by iteratively picking points from a non-uniform distribution and take Ω(nk) time, our seeding step (Algorithm 1) runs in eO(n + k2) time. 5.2 The Grouping Step After the seeding step, with constant probability we obtain a set of k vertices C ⋆ = {c1,··· , ck}, and these k vertices belong to k different clusters. Now we assign each remaining vertex u to a cluster Si if, comparing with all other points x(cj) with cj ∈ C ⋆, x(u) is closer to x(ci). A naive implementation of this step requires eΩ(nk) time. To speed it up, we apply ε-approximate nearest neighbor data structures (ε-NNS) [16], whose formal description is as follows: Problem 1 (ε-approximate nearest neighbor problem). Given a set of point P ⊂ Rd and a point q ∈ Rd, find a point p ∈ P such that, for all p′ ∈ P , kp − qk 6 (1 + ε)kp′ − qk. Theorem 5.5 ([16]). Given a set P of points in Rd, there is an algorithm that solves the ε-approximate nearest neighbor problem with 1+ε + d · P(cid:17) eO(cid:16)P1+ 1 1+ε(cid:17) query time. 1 Now we set P = {x(c1), . . . , x(ck)}, and apply the above ε-approximate nearest neighbor data structures to assign the remaining vertices to k clusters A1,··· , Ak. By Theorem 5.5 and preprocessing time and eO(cid:16)d · P setting ε = log k − 1, this step can be finished with eO(k) preprocessing time and eO(1) query time for each query. Hence, the runtime of the grouping step is eO(n). Notice that, with our choice of ε = log k − 1 and application of ε-NNS, all the remaining vertices in V \ C ⋆ might not assign to the cluster Ai with the closest center ci. We will prove in the next subsection that our choice of ε suffices to obtain a good approximation of the optimal partition. The runtime of the grouping step, and the properties of the returned clusters are summarized in the following lemma: Lemma 5.6. Given a set of centers C ⋆ = {c1, . . . , ck}, the grouping step runs in eO(n) time and returns a partition A1, . . . , Ak of vertices, such that for any i ∈ {1, . . . , k}, and every u ∈ Ai, it holds for any j 6= i that kx(u) − x(ci)k 6 log k · kx(u) − x(cj)k. Proof. The statement follows from the definition of ε-NNS with the choice of ε = log k − 1, and Theorem 5.5. 23 5.3 Approximation Analysis of the Algorithm Now we study the approximation ratio of the k-way partition computed by the seeding and grouping steps. The next lemma analyzes the symmetric difference between the optimal parti- tion and the output of the algorithm. Lemma 5.7. Let A1, . . . , Ak be the output of the grouping procedure. Then, under a proper permutation of the indices, with constant probability for any 1 6 i 6 k it holds that (i) vol(Ai△Si) = eO(cid:0)k3/Υ(cid:1) vol(Si), and (ii) φG(Ai) = 1.1 · φG(Si) + eO(cid:0)k3/Υ(cid:1). further assume that these sampled c1, . . . , ck ⊆Sk Proof. We assume that c1, . . . , ck ∈ V are the centers returned by SeedAndTrim, and {x(u)}u∈V [G] is the embedding we used in the algorithm. Moreover, {x(u)}u∈V [G] satisfies (5.1) and (5.2). We i . By Theorem 5.3, this holds with constant probability, and we assume that this event happens in the following analysis. Then, by the second statement of Theorem 5.2 it holds for any i 6= j that i=1 COREα By Theorem 5.6, it holds for any 1 6 i 6 k that 1 k · min{vol(Si), vol(Sj)}(cid:19) . kx(ci) − x(cj)k2 = Ω(cid:18) (cid:27)(cid:19) vol(cid:18)(cid:26)v ∈ Si : kx(ci) − x(v)k > kx(cj ) − x(v)k vol(cid:18)(cid:26)v ∈ Si : kx(ci) − x(v)k > kx(ci) − x(cj)k − kx(ci) − x(v)k (cid:27)(cid:19) vol(cid:18)(cid:26)v ∈ Si : 2kx(ci) − x(v)k > kx(ci) − x(cj)k (cid:27)(cid:19) . vol(cid:18)(cid:26)v ∈ Si : kx(ci) − x(v)k > kx(ci) − x(cj)k 2 log k log k log k log k (5.8) (cid:27)(cid:19) vol(Si \ Ai) 6Xi6=j 6Xi6=j 6Xi6=j =Xi6=j By (5.2) and the triangle inequality, we have that kx(ci) − x(v)k 6 kF (ci) − F (v)k + 1 n2.5 and hence 6(cid:13)(cid:13)(cid:13)F (ci) − p(i)(cid:13)(cid:13)(cid:13) +(cid:13)(cid:13)(cid:13)p(i) − F (v)(cid:13)(cid:13)(cid:13) + 1 n2.5 , vol(cid:18)(cid:26)v ∈ Si :(cid:13)(cid:13)(cid:13)F (ci) − p(i)(cid:13)(cid:13)(cid:13) +(cid:13)(cid:13)(cid:13)p(i) − F (v)(cid:13)(cid:13)(cid:13) + vol(cid:18)(cid:26)v ∈ Si :(cid:13)(cid:13)(cid:13)p(i) − F (v)(cid:13)(cid:13)(cid:13) > kx(ci) − x(cj)k vol(cid:18)(cid:26)v ∈ Si :(cid:13)(cid:13)(cid:13)p(i) − F (v)(cid:13)(cid:13)(cid:13) > kx(ci) − x(cj)k vol(cid:18)(cid:26)v ∈ Si :(cid:13)(cid:13)(cid:13)p(i) − F (v)(cid:13)(cid:13)(cid:13) = Ω(cid:18) 2 log k 2 log k 2 vol(Si \ Ai) 6Xi6=j 6Xi6=j 6Xi6=j 6Xi6=j = eO(cid:0)k3/Υ(cid:1) vol(Si), vol(Ai \ Si) 6Xi6=j 1 2 log k (cid:27)(cid:19) n2.5 > kx(ci) − x(cj)k n2.5(cid:27)(cid:19) −(cid:13)(cid:13)(cid:13)F (ci) − p(i)(cid:13)(cid:13)(cid:13) − n2.5(cid:27)(cid:19) −pRα i − 1 1 k log2 k · min{vol(Si), vol(Sj)}(cid:19)(cid:27)(cid:19) 1 vol(cid:18)(cid:26)v ∈ Sj : kx(cj) − x(v)k > kx(ci) − x(v)k log k (cid:27)(cid:19) where the last equality follows from Theorem 4.1. For the same reason, we have = eO(cid:0)k3/Υ(cid:1) vol(Si), 24 and therefore vol(Si△Ai) = vol(Si \ Ai) + vol(Ai \ Si) = eO(cid:0)k3/Υ(cid:1) vol(Si). This yields the first statement of the lemma. The second statement follows by the same argument used in proving Theorem 1.2. 5.4 Fast computation of the required embedding So far we assumed the existence of the embedding {x(u)}u∈V [G] satisfying (5.1) and (5.2), and analyzed the performance of the seeding and grouping steps. In this subsection, we will present a nearly-linear time algorithm to compute all the required distances used in the seeding and grouping steps. Our algorithm is based on the so-called heat kernal of a graph. Formally, the heat kernel of G with parameter t > 0 is defined by Ht , e−tL = e−tλi fif ⊺ i . nXi=1 We view the heat kernel as a geometric embedding from V [G] to Rn defined by xt(u) , 1 √du ·(cid:16)e−t·λ1 f1(u),··· , e−t·λn fn(u)(cid:17) , and define the ℓ2 2-distance between the points xt(u) and xt(v) by ηt(u, v) , kxt(u) − xt(v)k2. (5.9) (5.10) (5.11) The following lemma shows that, when k = Ω(log n) and Υ = Ω(k3), the values of ηt(u, v) for probability the conditions (5.1) and (5.2) hold for all edges {u, v} ∈ E[G]. Lemma 5.8. Let k = Ω(log n) and Υ = Ω(k3). Then, there is t = O(poly(n)) such that the embedding {xt(u)}u∈V [G] defined in (5.10) satisfies (5.1) and (5.2). Moreover, the values of all edges {u, v} ∈ E[G] can be approximately computed in eO(m) time. ηt(u, v) for all {u, v} ∈ E[G] can be approximately computed in eO(m) time, such that with high n × n real and symmetric matrix A is diagonally dominant (SDD), if Aii >Pj6=i Aij for each Our proof of Theorem 5.8 uses the algorithm for approximating the matrix exponential in [29] as a subroutine, whose performance is summarised in Theorem 5.9. Recall that any i = 1, . . . , n. It is easy to see that the Laplacian matrix of any undirected graph is diagonally dominant. Theorem 5.9 ([29]). Given an n× n SDD matrix A with mA nonzero entries, a vector v and a parameter δ > 0, there is an algorithm that can compute a vector x such that ke−Av−xk 6 δkvk in time eO((mA + n) log(2 + kAk)), where the eO(·) notation hides poly log n and poly log(1/δ) factors. Proof of Theorem 5.8. By the higher-order Cheeger inequality (1.2), we have that Υ = λk+1 ρ(k) 6 2λk+1 λk . Since k = Ω(log n) and Υ = Ω(k3), it holds that 400· log2 n 6 λk+1/λk, and there is t such that t ∈(cid:18) 10 · log n λk+1 1 20 · λk · log n(cid:19) . , 25 We first show that the embedding {xt(u)}u∈V [G] with this t satisfies (5.1) and (5.2). By the definition of ηt(u, v), we have that ηt(u, v) = e−2tλi(cid:18) fi(u) √du − e−2tλi(cid:18) fi(u) √du − Notice that it holds for 1 6 i 6 k that nXi=1 kXi=1 = fi(v) √dv(cid:19)2 √dv(cid:19)2 fi(v) + nXi=k+1 e−2tλi(cid:18) fi(u) √du − fi(v) √dv(cid:19)2 . (5.12) 1 10 log n 1 − 6 e−1/(10 log n) 6 e−λi/(10λk / log n) 6 e−2tλi 6 1, (5.13) and it holds for k + 1 6 i 6 n that 1 n20 . Combining (5.12), (5.13), and (5.14), it holds for any {u, v} ∈ E[G] that e−2t·λi 6 e−2λi·10 log n/λk+1 6 e−10 log nλk+1/λk+1 = (cid:18)1 − 1 10 · log n(cid:19) · kF (u) − F (v)k2 6 ηt(u, v) 6 kF (u) − F (v)k2 + (5.14) 1 n5 , which proves the first statement. Now we show that the distances of kxt(u) − xt(v)k for all edges {u, v} ∈ E[G] can be approximately computed in nearly-linear time. For any vertex u ∈ V [G], we define ξu ∈ Rn, where (ξu)v = 1/√du if v = u, and (ξu)v = 0 otherwise. Combining (5.9) with (5.10) and (5.11), we have that ηt(u, v) = kHt (ξu − ξv)k2. We define Z to be the operator of error δ which corresponds to the algorithm described in Theorem 5.9, and replacing Ht with Z we get where the last inequality follows from du, dv > 1. Hence, it holds that (cid:12)(cid:12)(cid:12)kZ (ξu − ξv)k − η1/2 t (u, v)(cid:12)(cid:12)(cid:12) 6 δ kξu − ξvk 6 δ, η1/2 t (u, v) − δ 6 kZ (ξu − ξv)k 6 η1/2 t (u, v) + δ. (5.15) By applying the Johnson-Lindenstrauss transform in a way analogous to the computation of [20] and [37]), we obtain an O(ε−2 · log n) × n Gaussian matrix Q, effective resistances (e.g. such that with high probability it holds for all u, v that (1 − ε)kZ (ξu − ξv)k 6 kQZ (ξu − ξv)k 6 (1 + ε)kZ (ξu − ξv)k . (5.16) Combining (5.15) and (5.16) gives us that (1 − ε)(cid:16)η1/2 t (u, v) − δ(cid:17) 6 kQZ (ξu − ξv)k 6 (1 + ε)(cid:16)η1/2 t (u, v) + δ(cid:17) . Squaring both sides and invoking the inequality (1− ε)α2 − (1 + ε−1)b2 6 (a + b)2 6 (1 + ε)α2 + (1 + ε−1)b2 gives (1 − 5ε) ηt(u, v) − 2δ2ε−1 6 kQZ (ξu − ξv)k2 6 (1 + 5ε) ηt(u, v) + 2δ2ε−1 Scaling QZ by a factor of (1 + 5ε)−1, and appending an extra entry in each vector to create an additive distortion of 2δε−1 then gives the desired bounds when δ is set to εn−6. To satisfy the conditions (5.1) and (5.2) we just need to set ε = O(1/ log n). To analyze the runtime of computing kQZ (ξu − ξv)k2 for all edges {u, v} ∈ E[G], notice that Q has only O(log3 n) rows. We can then run the approximate exponential algorithm from [29] O(log3 n) times, where each time we use a different row of Q as input. Since kLk 6 2, by Theorem 5.9 we can compute QZ in eO(m) time. Notice that QZξu is some column of QZ after rescaling, therefore we can compute all the required distances in time eO(m). 26 We remark that the proof above shows an interesting property about the embedding (5.10), i.e., for a large value of k and a certain condition on Υ, there is always a t such that the values of ηt(u, v) gives a good approximation of kF (u) − F (v)k2 for all edges {u, v} ∈ E[G]. A similar intuition which views the heat kernel embedding as a weighted combination of multiple eigenvectors was discussed in [29]. 5.5 Proof of Theorem 1.3 We proved in Section 5.4 that if k = Ω(log n) and Υ = Ω(k3), there is a t ∈(cid:18) 10 log n λk+1 , 1 20 · λk · log n(cid:19) (5.17) such that {xt(u)}u∈V [G] satisfies the conditions (5.1) and (5.2). Moreover, the values of kxt(u)− xt(v)k for {u, v} ∈ E[G] can be approximately computed in nearly-linear time3. However, it is unclear how to approximate λk, and without this approximation. Furthermore, without this approximation of λk, obtaining the desired embedding {x(u)}u∈V [G] becomes highly non-trivial. To overcome this obstacle, we run the seeding and grouping steps for all possible t of the form 2i, where t ∈ N>0, as it allows us to run the seeding and grouping steps with the right values of t at some point. However, by (5.11) the distance between any pair of embedded vertices decreases when we increase the value of t. Moreover, all these embedded points {xt(u)}u∈V [G] tend to "concentrate" around a single point for an arbitrary large value of t. To avoid this situation, for every possible t we compute the value ofPv∈V [G] dvkxt(v)k2, and the algorithm only moves to the next iteration if dvkxt(v)k2 > k(cid:18)1 − 2 log n(cid:19) . Xv∈V [G] (5.18) By Theorem 5.1, (5.18) is satisfied for all values of t in the right range (5.17), and the algorithm will not terminate before t = ⌊log n/λk+1⌋. See Algorithm 2 for the formal description of our final algorithm. Algorithm 2 A nearly-linear time graph clustering algorithm, k = Ω(log n) 1: input: the input graph G, and the number of clusters k 2: Let t = 2. 3: repeat 4: Let (c1, . . . , ck) = SeedAndTrim(cid:0)k,{xt(u)}u∈V [G](cid:1). if SeedAndTrim returns exactly k points then end if Let t = 2t 8: log n(cid:17). 9: until t > n10 orPv∈V [G] dvkxtk2 < k(cid:16)1 − 2 10: return (A1,··· , Ak). 5: 6: 7: Compute a partition A1, . . . , Ak of V [G]: center ci using the ε-NNS algorithm with ε = log k − 1. for every v ∈ V [G] assign v to its nearest Lemma 5.10. Let t = Ω (1/(λk · log n)), and t satisfies (5.18). Suppose that SeedAndTrim uses the embedding {xt(u)}u∈V [G] and returns k centers c1, . . . , ck. Then, with constant proba- bility, the following statements hold: 3Theorem 5.8 shows that both of the embedding {xt(u)}u∈V [G] and the embedding that the algorithm com- putes in nearly-linear time satisfy the conditions (5.1) and (5.2) with high probability. For the ease of discussion, we use {xt(u)}u∈V [G] to express the embedding that the algorithm actually uses. 27 2. These k centers belong to different cores, and it holds for any different i, j that 1. It holds that 3. For any i = 1, . . . , k, it holds that COREα i . {c1, . . . , ck} ⊆ k[i=1 kxt(ci) − xt(cj)k2 =eΩ(cid:18) kXi=1 Xu∈Si k · vol(Si)(cid:19) . Υ(cid:19) . du · kx(u) − x(ci)k2 = eO(cid:18) k3 1 Proof. Since kxt(u)k is decreasing with respect to the value of t for any vertex u, by Lemma 5.1 for any t = Ω (1/(λk · log n)) we have: kXi=1 Xu /∈COREα i du · kxt(u)k2 6 kXi=1 Xu /∈COREα i du ·(cid:18)kF (u)k2 + 1 n5(cid:19) 6 k 100K + kn2 n5 6 1 log k . On the other hand, we only consider values of t satisfying (5.18). Since every vertex u is sampled with probability proportional to du · kxt(u)k2, with constant probability it holds that {c1, . . . , ck} ⊆ COREα i , k[i=1 which proves the first statement. Now we prove that these k centers belong to different cores. We fix an index i, and assume that ci ∈ Si. We will prove that Assume by contradiction that (5.19) does not hold, i.e., for any constant c. Then, we have that Xu∈COREα i kxt(ci)k2 =eΩ(cid:18) 1 kxt(ci)k2 = o(cid:18) 1 vol(Si)(cid:19) . logc k vol(Si)(cid:19) i(cid:17)2 du ·(cid:16)kxt(ci)k +pRα i (cid:0)du · kxt(ci)k2 + du · Rα i(cid:1) i du · kxt(u)k2 6 Xu∈COREα 6 2 · Xu∈COREα = o(cid:18) 1 = o(cid:18) 1 k2(cid:19) logc k(cid:19) + o(cid:18) 1 logc k(cid:19) . Pu∈COREα Pv∈V [G] dvkxt(v)k2 = o(cid:18) du · kxt(u)k2 1 i 28 k · logc k(cid:19) . (5.19) is Combining this with (5.18), the probability that vertices get sampled from COREα i This means if we sample K = Θ(k log k) vertices, vertices in COREα probability at least 1 − 1/ log5 k. This contradicts the fact that ci ∈ COREα holds. i will not get sampled with i . Therefore (5.19) Now, by description of Algorithm 1, we have for any j 6= i: kxt(ci) − xt(cj)k2 > kx(ci)k2 2 · 104 · k 1 k · vol(Si)(cid:19) , =eΩ(cid:18) where the last equality follows from (5.19). Since any vertex in COREα Rα i from ci, cj and ci belong to different cores. Therefore, the second statement holds. Finally we turn our attention to the third statement. We showed in Theorem 5.8 that, when t = Θ (1/(λk · log n)), the embedding {xt(u)}u∈V [G] satisfies the conditions (5.1) and (5.2). Hence, it holds that i has distance at most kXi=1 Xu∈Si du · kx(u) − x(ci)k2 6 6 6 1 n5(cid:19) kXi=1 Xu∈Si(cid:18)du · kF (u) − F (ci)k2 + kXi=1 Xu∈Si(cid:18)du · (kF (u) − pik + kF (ci) − pik)2 + n5(cid:19) kXi=1 Xu∈Si(cid:18)2 · du ·(cid:16)kF (u) − pik2 + kF (ci) − pik2(cid:17) + 1 1 n5(cid:19) (5.20) Notice that by Theorem 4.1 we have kXi=1 Xu∈Si du · kF (u) − pik2 6 1.1k2/Υ. On the other hand, we have kF (ci) − pik2 6 Rα kXi=1 Xu∈Si 2 · du · kF (ci) − pik2 6 kXi=1 2 vol(Si) · Combining (5.20) with (5.21) and (5.22), we have that kXi=1 Xu∈Si du · kx(u) − x(ci)k2 6 eO(cid:18) k3 (5.21) (5.22) = i , and α · Ei vol(Si) i as ci ∈ COREα 2α · Ei = eO(cid:18) k3 Υ(cid:19) . kXi=1 n5 = eO(cid:18) k3 Υ(cid:19) . Υ(cid:19) + Xu∈V [G] du Moreover, by (5.10) and (5.11) it is straightforward to see that the distance between any em- bedded vertices decreases as we increase the value of t. Hence, the statement holds for any t = Ω (1/(λk · log n)). Lemma 5.11. Let A1, . . . , Ak be a k-way partition returned by Algorithm 2. Then, under a proper permutation of the indices, with constant probability for any 1 6 i 6 k it holds that (i) vol(Ai△Si) = eO(cid:0)k4/Υ(cid:1) vol(Si), and (ii) φG(Ai) = 1.1 · φG(Si) + eO(cid:0)k4/Υ(cid:1). Sk Proof. We assume that c1, . . . , ck are the centers returned by SeedAndTrim when obtain- ing A1, . . . , Ak. By Theorem 5.10, with constant probability it holds that {c1, . . . , ck} ⊆ i=1 COREα i , and ci and cj belong to different cores for i 6= j. Without loss of generality, 29 i . Then, it holds that log k (cid:27)(cid:19) vol(cid:18)(cid:26)v ∈ Si : kx(ci) − x(v)k > kx(cj) − x(v)k vol(cid:18)(cid:26)v ∈ Si : kx(ci) − x(v)k > kx(ci) − x(cj)k − kx(ci) − x(v)k vol(cid:18)(cid:26)v ∈ Si : 2kx(ci) − x(v)k > kx(ci) − x(cj)k vol(cid:18)(cid:26)v ∈ Si : kx(ci) − x(v)k2 =eΩ(cid:18) (cid:27)(cid:19) log k log k k min{vol(Sj), vol(Si)}(cid:19)(cid:27)(cid:19) (5.23) 1 (5.24) (cid:27)(cid:19) we assume that ci ∈ COREα vol(Si \ Ai) 6Xi6=j 6Xi6=j 6Xi6=j 6Xi6=j = eO(cid:0)k4/Υ(cid:1) vol(Si), vol(Ai \ Si) 6Xi6=j Similarly, we also have that where (5.23) follows from the second statement of Theorem 5.10. vol(cid:18)(cid:26)v ∈ Sj : kx(cj) − x(v)k > kx(ci) − x(v)k log k (cid:27)(cid:19) = eO(cid:0)k4/Υ(cid:1) vol(Si). This yields the first statement of the lemma. The second statement follows by the same argu- ment used in proving Theorem 1.2. Proof of Theorem 1.3. The approximation guarantee of the returned partition is shown in The- orem 5.11. For the runtime, notices that we enumerate at most O(poly log n) possible values of includes computing the distances of embedded points and the seeding / grouping steps. Hence, t. Furthermore, and for every such possible value of t the algorithm runs in eO(m) time. This the total runtime is eO(m). Acknowledgements Part of this work was done while He Sun and Luca Zanetti were at the Max Planck Institute for Informatics, and while He Sun was visiting the Simons Institute for the Theory of Computing at UC Berkeley. We are grateful to Luca Trevisan for insightful comments on an earlier version of our paper, and to Gary Miller for very helpful discussions about heat kernels on graphs. We also would like to thank Pavel Kolev, and Kurt Mehlhorn [19] for pointing out an omission in an early version of Lemma 4.6. This omission was fixed locally without effecting the statement of the main results. References [1] Zeyuan Allen-Zhu, Silvio Lattanzi, and Vahab S. Mirrokni. A local algorithm for finding well-connected clusters. In 30th International Conference on Machine Learning (ICML'13), pages 396–404, 2013. [2] Sanjeev Arora, Boaz Barak, and David Steurer. Subexponential algorithms for unique games and related problems. In 51st Annual IEEE Symposium on Foundations of Computer Science (FOCS'10), pages 563–572, 2010. [3] Sanjeev Arora, Elad Hazan, and Satyen Kale. The multiplicative weights update method: a meta-algorithm and applications. Theory of Computing, 8(1):121–164, 2012. 30 [4] Sanjeev Arora and Satyen Kale. A combinatorial, primal-dual approach to semidefinite programs. In 39th Annual ACM Symposium on Theory of Computing (STOC'07), pages 227–236, 2007. [5] Sanjeev Arora, Satish Rao, and Umesh V. Vazirani. Expander flows, geometric embeddings and graph partitioning. J. ACM, 56(2), 2009. [6] David Arthur and Sergei Vassilvitskii. k-means++: The advantages of careful seeding. In 18th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA'07), pages 1027–1035, 2007. [7] Pranjal Awasthi, Avrim Blum, and Or Sheffet. Center-based clustering under perturbation stability. Information Processing Letters, 112(1):49–54, 2012. [8] Shai Ben-David. A theoretical approach to the clustering selection problem. In Proceedings of the 4th MultiClust Workshop on Multiple Clusterings, Multi-view Data, and Multi-source Knowledge-driven Clustering, page 1, 2013. [9] Fan R. K. Chung. A local graph partitioning algorithm using heat kernel pagerank. Internet Mathematics, 6(3):315–330, 2009. [10] Guy B. Coleman and Harry C. Andrews. Image segmentation by clustering. Proceedings of the IEEE, 67(5):773–785, 1979. [11] Sanjoy Dasgupta and Anupam Gupta. An elementary proof of a theorem of Johnson and Lindenstrauss. Random Structures & Algorithms, 22(1):60–65, 2003. [12] Chandler Davis and William M. Kahan. The rotation of eigenvectors by a perturbation. iii. SIAM Journal on Numerical Analysis, 7(1):1–46, 1970. [13] Tamal K. Dey, Alfred Rossi, and Anastasios Sidiropoulos. Spectral concentration, robust k-center, and simple clustering. arXiv:1404.3918, 2014. [14] Santo Fortunato. Community detection in graphs. Physics Reports, 486(3):75–174, 2010. [15] Roger A. Horn and Charles R. Johnson. Matrix Analysis. Cambridge University Press, 2012. [16] Piotr Indyk and Rajeev Motwani. Approximate nearest neighbors: towards removing In 30th Annual ACM Symposium on Theory of Computing the curse of dimensionality. (STOC'98), pages 604–613, 1998. [17] Ravi Kannan, Santosh Vempala, and Adrian Vetta. On clusterings: Good, bad and spectral. Journal of the ACM, 51(3):497–515, 2004. [18] Jonathan A. Kelner, Yin Tat Lee, Lorenzo Orecchia, and Aaron Sidford. An almost- linear-time algorithm for approximate max flow in undirected graphs, and its multicom- modity generalizations. In 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA'14), pages 217–226, 2014. [19] Pavel Kolev and Kurt Mehlhorn. A note on spectral clustering. CoRR, abs/1509.09188, 2015. [20] Ioannis Koutis, Alex Levin, and Richard Peng. Improved Spectral Sparsification and Nu- In 29th International Symposium on Theoretical merical Algorithms for SDD Matrices. Aspects of Computer Science (STACS'12), pages 266–277, 2012. 31 [21] Tsz Chiu Kwok, Lap Chi Lau, Yin Tat Lee, Shayan Oveis Gharan, and Luca Trevisan. Improved Cheeger's inequality: analysis of spectral partitioning algorithms through higher order spectral gap. In 45th Annual ACM Symposium on Theory of Computing (STOC'13), pages 11–20, 2013. [22] James R. Lee, Shayan Oveis Gharan, and Luca Trevisan. Multi-way spectral partitioning In 44th Annual ACM Symposium on Theory of and higher-order Cheeger inequalities. Computing (STOC'12), pages 1117–1130, 2012. [23] Frank T. Leighton and Satish Rao. Multicommodity max-flow min-cut theorems and their use in designing approximation algorithms. Journal of the ACM, 46(6):787–832, 1999. [24] Anand Louis, Prasad Raghavendra, Prasad Tetali, and Santosh Vempala. Many sparse In 44th Annual ACM Symposium on Theory of Computing cuts via higher eigenvalues. (STOC'12), pages 1131–1140, 2012. [25] Konstantin Makarychev, Yury Makarychev, and Aravindan Vijayaraghavan. Correla- In 28th Conference on Learning The- tion clustering with noisy partial information. ory (COLT'15), pages 1321–1342, 2015. [26] David W. Matula and Farhad Shahrokhi. Sparsest cuts and bottlenecks in graphs. Discrete Applied Mathematics, 27(1-2):113–123, 1990. [27] Frank McSherry. Spectral partitioning of random graphs. In 42nd Annual IEEE Symposium on Foundations of Computer Science (FOCS'01), pages 529–537, 2001. [28] Andrew Y. Ng, Michael I. Jordan, and Yair Weiss. On spectral clustering: Analysis and an algorithm. Advances in Neural Information Processing Systems, 2:849–856, 2002. [29] Lorenzo Orecchia, Sushant Sachdeva, and Nisheeth K Vishnoi. Approximating the expo- nential, the Lanczos method and an eO(m)-time spectral algorithm for balanced separator. In 44th Annual ACM Symposium on Theory of Computing (STOC'12), pages 1141–1160, 2012. [30] Lorenzo Orecchia, Leonard J. Schulman, Umesh V. Vazirani, and Nisheeth K. Vishnoi. On partitioning graphs via single commodity flows. In 40th Annual ACM Symposium on Theory of Computing (STOC'08), pages 461–470, 2008. [31] Rafail Ostrovsky, Yuval Rabani, Leonard J. Schulman, and Chaitanya Swamy. The effec- tiveness of Lloyd-type methods for the k-means problem. Journal of the ACM, 59(6):28, 2012. [32] Shayan Oveis Gharan and Luca Trevisan. Partitioning into expanders. In 25th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA'14), pages 1256–1266, 2014. [33] Karl Rohe, Sourav Chatterjee, and Bin Yu. Spectral clustering and the high-dimensional stochastic blockmodel. The Annals of Statistics, 39(4):1878–1915, 2011. [34] L. Saloff-Coste. Lectures on finite markov chains. In Pierre Bernard, editor, Lectures on Probability Theory and Statistics, volume 1665 of Lecture Notes in Mathematics, pages 301–413. Springer, 1997. [35] Jonah Sherman. Breaking the multicommodity flow barrier for O(√log n)-approximations to sparsest cut. In 50th Annual IEEE Symposium on Foundations of Computer Science (FOCS'09), pages 363–372, 2009. 32 [36] Jianbo Shi and Jitendra Malik. Normalized cuts and image segmentation. IEEE Transac- tions on Pattern Analysis and Machine Intelligence, 22(8):888–905, 2000. [37] Daniel A. Spielman and Nikhil Srivastava. Graph sparsification by effective resistances. SIAM Journal on Computing, 40(6):1913–1926, 2011. [38] Daniel A. Spielman and Shang-Hua Teng. Spectral sparsification of graphs. SIAM Journal on Computing, 40(4):981–1025, 2011. [39] Luca Trevisan. Approximation algorithms for unique games. Theory of Computing, 4(1):111–128, 2008. [40] Ulrike von Luxburg. A tutorial on spectral clustering. Statistics and Computing, 17(4):395– 416, 2007. [41] Van Vu. A simple SVD algorithm for finding hidden partitions. arXiv:1404.3918, 2014. 33
1905.00812
1
1905
2019-05-02T15:39:34
Near Optimal Jointly Private Packing Algorithms via Dual Multiplicative Weight Update
[ "cs.DS" ]
We present an improved $(\epsilon, \delta)$-jointly differentially private algorithm for packing problems. Our algorithm gives a feasible output that is approximately optimal up to an $\alpha n$ additive factor as long as the supply of each resource is at least $\tilde{O}(\sqrt{m} / \alpha \epsilon)$, where $m$ is the number of resources. This improves the previous result by Hsu et al.~(SODA '16), which requires the total supply to be at least $\tilde{O}(m^2 / \alpha \epsilon)$, and only guarantees approximate feasibility in terms of total violation. Further, we complement our algorithm with an almost matching hardness result, showing that $\Omega(\sqrt{m \ln(1/\delta)} / \alpha \epsilon)$ supply is necessary for any $(\epsilon, \delta)$-jointly differentially private algorithm to compute an approximately optimal packing solution. Finally, we introduce an alternative approach that runs in linear time, is exactly truthful, can be implemented online, and can be $\epsilon$-jointly differentially private, but requires a larger supply of each resource.
cs.DS
cs
Near Optimal Jointly Private Packing Algorithms via Dual Multiplicative Weight Update Zhiyi Huang∗ Xue Zhu∗ 9 1 0 2 y a M 2 ] S D . s c [ 1 v 2 1 8 0 0 . 5 0 9 1 : v i X r a Abstract We present an improved (ǫ, δ)-jointly differentially private algorithm for packing problems. Our algorithm gives a feasible output that is approximately optimal up to an αn additive factor as long as the supply of each resource is at least O(√m/αǫ), where m is the number of resources. This improves the previous result by Hsu et al. (SODA '16), which requires the total supply to be at least O(m2/αǫ), and only guarantees approximate feasibility in terms of total violation. Further, we complement our algorithm with an almost matching hardness result, showing that Ω(pm ln(1/δ)/αǫ) supply is necessary for any (ǫ, δ)-jointly differentially private algorithm to compute an approximately optimal packing solution. Finally, we introduce an alternative approach that runs in linear time, is exactly truthful, can be implemented online, and can be ǫ-jointly differentially private, but requires a larger supply of each resource. 1 Introduction Handling user data has become the focal point of modern computational problems, bringing up many new challenges including user privacy. The consensus notion of privacy in theoretical computer science is differential privacy introduced by Dwork et al. [7]. Informally, a mechanism is differentially private if the output distribution is insensitive to the change of an individual's data. Since its introduction, the community has introduced differentially private algorithms for a variety of problems, including computation of numerical statistics (e.g., [9, 4]), machine learning (e.g., [6, 15], game theory (e.g., [17, 14]), etc. However, many fundamental combinatorial problems, such as the bipartite matching problem, provably do not admit any differentially private algorithm with non-trivial approximation guarantee [11]. To resolve the situation, Hsu et al. [11] adopt a relaxed notion called joint differential privacy by Kearns et al. [16] and introduce jointly differentially private algorithms for the bipartite matching problem and more generally the welfare maximization problem w.r.t. gross substitutes valuations. Hsu et al. [12] further develop the techniques in [11], and propose a general framework that solves a large family of convex programs in a jointly differentially private manner via a noisy version of the dual gradient descent method. While our techniques can be applied to the generic convex programs studied in [12], we focus on the packing problem in this conference version due to space constraint. Consider a packing problem with n agents and m resources where each agent has different values for different bundles of resources. The value and resource demands of an agent are private. The goal is to allocate bundles to agents so as to maximize the sum of values of all agents subject to the supply constrains of resources. The algorithm by Hsu et al. [12] incurs an O(m2/ǫ) additive loss in terms of the objective and up to O(m2/ǫ) additive total violation of the supply constraints. In other words, their algorithm guarantees up to αn additive loss in the objective if n ≥ O(m2/αǫ), and the total violation is at most α fraction of the total supply if the supply per constraint is at least O(m/αǫ). No non-trivial guarantee is given in terms of per constraint violation. Our contributions. Our first result is an (ǫ, δ)-jointly differentially private algorithm (Sec. 3) that improves the results by Hsu et al. [12] by two means: (1) It reduces the supply requirement in terms of the dependence on the number of resources m; and (2) it provides exact feasibility with high probability. 1 Concretely, we show the following: ∗Department of Computer Science, the University of Hong Kong. This work is supported in by a RGC grant HKU27200214E. {zhiyi,xzhu2}@cs.hku.hk 1We note that Hsu et al. [12] can also obtain exact feasibility by shifting the error to the objective, under the extra assumption that each unit of resource provides at most value 1 in the objective. Our result does not need such an assumption. Theorem 1.1. For any packing problem with m constraints, there is an (ǫ, δ)-jointly differentially private algorithm whose output is feasible and approximately optimal up to an αn additive factor as long as the supply of each resource is at least O(√m/αǫ). Our algorithm is a noisy version of the multiplicative weight update algorithm running in the dual space. To compute a primal packing solution, we maintain a set of dual prices that coordinates the primal decisions: an item is selected in the packing if and only if its value is greater than the total price of its resource demands. The dual prices are then updated using the multiplicative weight update method (e.g., [1]) with Laplacian noise added to each iteration to ensure that the dual prices are differentially private. Finally, the billboard lemma introduced by Hsu et al. [11] indicates that the primal packing solution satisfies joint differential privacy if the coordinators, i.e., the dual prices, satisfy differential privacy. The main technical challenges then arise from bounding the error introduced by the Laplacian noise. First, the standard analysis of the multiplicative weight update framework requires the update weights to be bounded, while our noisy update weights are unbounded. To resolve this problem, we truncate noisy update weights that are either too large or too small, and bound the error due to this truncation using the small-tail properties of Laplacian distributions (Lemma 3.6). Second, to obtain with-high-probability guarantees, one resorts to concentration bounds, which generally require the random variables to be bounded. To this end, we introduce a concentration lemma for Laplacian distributed variables (Lemma 3.5). Then, we complement our algorithm with an almost matching lower bound on the minimum supply required for any (ǫ, δ)-jointly differentially private algorithm to compute an approximately optimal solution (Sec. 4). Theorem 1.2. (Hardness for (ǫ, δ)-private algorithms) If there is an (ǫ, δ)-jointly differentially private algorithm that with high probability outputs a feasible solution for the packing problem that is approximately optimal up to an additive O(αn), then the supply per constraint must be at least Ω(cid:18)√m ln(1/δ) αǫ (cid:19) . This lower bound significantly improves the best previous bound of Ω(cid:0)1/√α(cid:1) by Hsu et al. [11]. It matches the supply requirement in Theorem 1.1 up to log factors, certifying that our algorithm has achieved near optimal trade-offs between privacy and accuracy. The proof of this hardness result draws a novel connection between jointly differentially private packing algorithms and differentially private query release algorithms. We show that one can take an arbitrary jointly differentially private packing algorithm as a blackbox and use it to construct a differentially private query release algorithm for answering arbitrary counting queries. Then, the hardness result follows from existing hardness for query release by Steinke and Ullman [23]. Having achieved the optimal tradeoffs between privacy and accuracy, we turn to other aspects of the algorithm such as running time. A common drawback of the algorithms in the previous dual gradient descent approach by Hsu et al. [12] and that in Theorem 1.1 is the cubic dependence in n in the running time. Is there a privacy- preserving algorithm that goes over each agent's data only once and still finds an approximately optimal packing solution? To this end, we introduce an alternative approach that can be interpreted as a privacy-preserving version of the online packing algorithm in the random-arrival model by Agrawal and Devanur [1]. In each round of dual update, instead of computing the best responses of all agents to calculate an accurate dual subgradient, the new approach picks one agent and uses his best response to calculate a proxy subgradient and updates the dual prices accordingly; the agent gets his best response bundle. The algorithm updates the dual prices for exactly n rounds, using each agent to compute the proxy subgradient exactly once. The ordering that the algorithm picks the agent is chosen uniformly at random at the beginning. The new approach runs in linear time, significantly faster than the other approaches whose running time has cubic dependence in n. However, it needs a larger supply of each resource, i.e., at least O(cid:0) to compute an approximately optimal solution. Whether there exists an jointly differentially private algorithm that both runs in linear time and achieves the optimal tradeoffs between privacy and accuracy characterized in Theorem 1.1 and Theorem 1.2 is an interesting open problem. αǫ (cid:1), in order √nm Further, the new approach can be implemented in the online random-arrival setting, where the agents show up one by one in a random order and the algorithm must decide the allocation to each agent at his arrival. It Min supply Exact feasibility ǫ-JDP Online Exact truthfulness Running time (in n) Dual GD [12] Dual MWU (§3) √m O(cid:0) m αǫ(cid:1)† O(cid:0) αǫ (cid:1) O(cid:0) αǫ (cid:1) √mn No Yes No No No No No No Yes‡ Yes O(n3) O(n3) O(n) Dual online MWU (§5) † Hsu et al. [12] requires the total supply of all resources to be at least O(cid:0) m2 as the (average) supply per resource for a direct comparison with the supply requirements in this paper. ‡ To get ǫ-JDP, we need a larger supply of at least O(cid:0) m√n αǫ (cid:1) of each resource. Yes Yes αǫ (cid:1). We divide it by m and interpret the result Table 1: A comparison of different approaches also achieves exact truthfulness if we charge each agent the dual prices in his round because every agent gets his best response bundle. Previous approach by Hsu et al. [13, 12] gets only approximate truthfulness. Last but not least, the approach in this section can be implemented in an ǫ-jointly differentially private manner, provided that the supply of each resource is at least O(cid:0) m√n update approach in Theorem 1.1 nor the approach in previous work [12] can achieve ǫ-joint differential privacy, unless the supply b ≥ n in which case the problem is trivial. Theorem 1.3. For any packing problem with m constraints, there is a linear time, truthful, and (ǫ, δ)-jointly differentially private algorithm whose output is feasible and approximately optimal up to an αn additive factor as long as the supply of each resource is at least O(√mn/αǫ). Further, the algorithm can work in the online random- arrival model, and can get ǫ-joint differential privacy if the supply of each resource is at least O(m√n/αǫ). αǫ (cid:1). Neither the dual multiplicative weight We present in Table 1 a brief comparison of the dual gradient descent approach by Hsu et al. [12], the dual multiplicative weight update approach in Theorem 1.1, and the dual online multiplicative weight update approach in Theorem 1.3. Other related work. McSherry and Talwar [17] propose the exponential mechanism as a generic method for designing differentially private algorithms for optimization problems for which the set of feasible outcomes do not depend on user data. As one may expect, such a generic method is not computationally efficient in general. Bassily et al. [3] introduce an efficient implementation of the exponential mechanism when the set of feasible outcomes further forms a compact subset in the Euclidean space and the objective is a convex function. However, these techniques are not directly applicable to our problem as the set of feasible outcomes of packing problems crucially depends on user data. Hsu et al. [13] systematically study what linear programs can be solved in a differentially private manner and what cannot. However, the packing linear program provably cannot be solved differentially privately [11]. Since the introduction of joint differential privacy by Kearns et al. [16], it has found a wide range of applications, including equilibrium selection [20], max flow [21], mechanism design [16], privacy-preserving surveys [10], etc. A common technical ingredient of these work is the billboard lemma introduced by Hsu et al. [11], which also serves as an important building block of the analysis in this paper. The packing problem has been extensively studied in both the offline (e.g., [19, 22]) and online settings (e.g., [5]). We note that a lot of these work use the primal dual technique. Our work can be viewed as an adoption of these techniques in the privacy preserving context. 2 Preliminaries 2.1 Packing problem and the (partial) dual Consider a packing problem with n agents and m resources. Let [ℓ] denote the set {1, 2, . . . , ℓ} for any positive integer ℓ. Each agent i ∈ [n] demands one of ℓi bundles of resources. If we allocate a bundle k ∈ [ℓi] to agent i, his valuation will be πik ∈ [0, 1] and an aijk ∈ [0, 1] amount of resource j will be consumed for every j ∈ [m]; if we do not allocate any bundle to agent i, his valuation will be 0 and no resource will be consumed. The parameters associated with an agent i is the private data of the agent. Let U denote the data universe and let D ∈ U n denote a dataset of n agents. Each resource j ∈ [m] has supply bj. The goal is then to choose a subset of the items that maximizes the total valuation subject to the supply constraints. This can be formulated as the following packing linear program: maximize Pi∈[n]Pk∈[ℓi] πikxik subject to Pi∈[n]Pk∈[ℓi] aijkxik ≤ bj Pk∈[ℓi] xik ≤ 1 xik ≥ 0 ∀j ∈ [m] ∀i ∈ [n] ∀i ∈ [n] Let Xi = {xi ∈ [0, 1]ℓi : Pk∈[ℓi] xik ≤ 1} denote the set of feasible decisions associated with agent i and X = X1 × ··· × Xn denote the feasible decisions of all agents if we ignore the supply constraints. The partial Lagrangian of the above program is: maxx∈X minp∈[0,∞)m (cid:16)Pi∈[n]Pk∈[ℓi] πikxik −Pj∈[m] pj(cid:0)Pi∈[n]Pk∈[ℓi] aijkxik − bj(cid:1)(cid:17) Let L(x, p) denote the above partial Lagrangian objective, that is, L(x, p) =Pi∈[n]Pk∈[ℓi] πikxik −Pj∈[m] pj(cid:0)Pi∈[n]Pk∈[ℓi] aijkxik − bj(cid:1) =Pj∈[m] bjpj +Pi∈[n]Pk∈[ℓi] xik(cid:0)πik −Pj∈[m] aijkpj(cid:1) Let D(p) = maxx∈X L(x, p) denote the dual objective. We shall interpret pj as the unit price of resource j for any j ∈ [m]. Given a set of prices p, an optimal solution of the optimization problem maxx∈X L(x, p) is: x∗ik(p) =(1, if πik −Pm j=1 aijkpj ≥ 0 and k = arg maxk′∈[ℓi] πik′ −Pm 0, otherwise. j=1 aijk′ pj; (2.1) Here, we break ties in lexicographical order in the maximization problem of the first case. The following lemma follows by the Envelope theorem (e.g., [18]). Lemma 2.1. Given any set of prices p, ∇pL(cid:0)x∗(p), p(cid:1) is a sub-gradient of D(p). 2.2 Joint differential privacy Next, we present necessary preliminaries for differential privacy and joint ∈ U n are i-neighbors if they differ only in their i-th entry, that is, differential privacy. Two datasets D, D Dj = D j for all j 6= i. The notion of differential privacy by Dwork et al. [7] requires the output distributions to be similar for any neighboring datasets. ′ ′ Definition 2.1. (Differential privacy [7]) A mechanism M : U n → X is (ǫ, δ)-differentially private if for any i ∈ [n], any i-neighbors D, D′ ∈ U n, and any subset S ⊆ X, we have: Pr(cid:2)M(D) ∈ S(cid:3) ≤ exp(ǫ) · Pr(cid:2)M(D′) ∈ S(cid:3) + δ . The Laplace mechanism by Dwork et al. [7] computes numerical statistics of a dataset differentially privately by adding Laplacian distributed noise to the output. We shall use the Laplace mechanism to maintain a sequence of differentially private dual prices. Definition 2.2. (Laplace mechanism [7]) Suppose f : U n → R has sensitivity σ, i.e., f (D) − f (D′) ≤ σ for any neighboring D and D′. Given a database D ∈ U n, the Laplace mechanism outputs f (D) + Z, where Z ∼ Lap(σ/ǫ). Lemma 2.2. ([7]) The Laplace mechanism is (ǫ, 0)-differentially private. One can combine differentially private subroutines to obtain algorithms for more complicated tasks; the privacy parameter will scale gracefully. This is formalized as the composition theorem: Lemma 2.3. (Composition Theorem [8]) Suppose A is a T -fold adaptive composition of (ǫ, δ)-differentially private mechanisms. Then, A satisfies (ǫ′, T δ + δ′)-differential privacy for ǫ′ = ǫp2T ln(1/δ′) + T ǫ(eǫ − 1) . As mentioned in the introduction, for many optimization problems including the packing problem considered in this paper, we need to consider a relaxed notion called joint differential privacy proposed by Kearns et al. [16]. Informally, joint differential privacy is defined w.r.t. problems whose outputs are comprised of n components, one for each of the n agents. It relaxes the requirement of differential privacy so that for any i-neighboring datasets, only the output components of agents other than i need to be similarly distributed. Definition 2.3. (Joint differential privacy [16]) A mechanism M : U n → X = X1 × ··· × Xn is (ǫ, δ)- jointly differentially private if for any i ∈ [n], any i-neighbors D, D′ ∈ U n, and any subset S−i ⊆ X−i, we have: Pr(cid:2)M−i(D) ∈ S−i(cid:3) ≤ exp(ǫ) · Pr(cid:2)M−i(D′) ∈ S−i(cid:3) + δ . The most important connection between joint differential privacy and differential privacy is the following billboard lemma established by Hsu et al. [11]. This lemma has been the cornerstone of many recent work on joint differential privacy and plays a crucial role in this paper as well. Lemma 2.4. (Billboard Lemma [11]) Suppose M : U n → Y T is (ǫ, δ)-differentially private. Consider any set of functions fi : U × Y T → X′. Then the mechanism M that outputs to each agent i : fi(Di, M (D)) is (ǫ, δ)-jointly differentially private. ′ 3 Private dual multiplicative weight algorithm Our algorithm is a noisy version of the multiplicative weight update algorithm running in the dual space. First, recall the partial Lagrangian objective of the packing problem: L(x, p) =Pi∈[n]Pk∈[ℓi] πikxik −Pj∈[m] pj(cid:0)Pi∈[n]Pk∈[ℓi] aijkxik − bj(cid:1) =Pi∈[n]Pk∈[ℓi] xik(cid:0)πik −Pj∈[m] aijkpj(cid:1) +Pj∈[m] bjpj For simplicity, we assume bj = b for all j ∈ [m]. It is straightforward to extend our results to general values of bj's. Then, it is without loss to assume that n ≥ b as otherwise the optimal solution is trivial with xik∗ = 1 where k∗ = arg maxk∈[ℓi] πik, for all i . For convenience of discussion, we add a dummy constraint h0, xi ≤ 0 as the (m + 1)-th constraint. As a result, there is a new dual variable pm+1 corresponding to the new constraint and, thus, p becomes a m + 1 dimension vector. We will restrict p such that its ℓ1 norm equals some appropriately chosen pmax. The multiplicative weight update algorithm finds a set of dual prices p that approximately minimizes the dual objective D(p) = maxx∈X L(x, p). In the process, it also finds an approximately optimal primal solution. Concretely, it starts with an initial p(1) = pmax m+1 · 1, where 1 is the all-1 vector. In each round t, it first computes a sub-gradient of the dual objective ∇D(p(t)) using the envelope theorem, which boils down to computing the best response of the agents to the current dual prices. Then, it computes p(t+1) by multiplying each entry of p(t) by 1 − η∇jD(p(t)) for some appropriately chosen step size η, and normalizing it to have ℓ1 norm pmax. (This is equivalent to a projection back to the simplex kpk1 = pmax with respect to the Kullback-Leibler divergence.) In order to get joint differential privacy, we use a noisy version of the sub-gradient in our algorithm and show that the error introduced by the Laplacian noise can be bounded. The algorithm is presented as Algorithm 1. 3.1 Proof of Theorem 1.1 (privacy) The privacy part follows from the next Lemma 3.1 and the Billboard Lemma (Lemma 2.4). Lemma 3.1. The sequence of duals p(1), . . . , p(T ) given by Pri-DMW are (ǫ, δ)-differentially private. Proof. Note that the sequence of dual price vectors are determined by a sequence of noisy sub-gradients ∇ D(p(t))'s. Hence, it suffices to show the sequence of noisy sub-gradients is (ǫ, δ)-differentially private. Algorithm 1 Private Dual Multiplicative Update Method (Pri-DMW) √m 1: require: b ≥ O(cid:0) 2: input: objective π; demands aijk for all i ∈ [n], j ∈ [m], k ∈ [ℓi]; supply b; approximation parameter α; 3: parameters: initial dual p(1) = pmax ; range of dual αǫ (cid:1); we assume n ≥ b as the problem is trivial otherwise. privacy parameter ǫ and δ. m ; step size η = ln(m+1) m+1 · 1; number of rounds T = ǫ2n2 αbT pmax = 4n b ; privacy parameter in each step ǫ′ = ǫ√8T m ln(2/δ) ; width ∇max = n + ln(T ) ǫ′ . 4: for all t = 1, . . . , T do 5: Let x(t) i = x∗i (p(t)), i.e., for all 1 ≤ i ≤ n and 1 ≤ k ≤ li, let : x(t) ik =(1, 0, otherwise. if π(t) ik −Pm j ∼ Lap( 1 Sample Laplace noise ν(t) ǫ′ ) for 1 ≤ j ≤ m. j=1 aijkp(t) j ≥ 0 and k = arg maxk′∈[ℓi] π(t) j=1 aijk′ p(t) j ; ik′ −Pm Compute noisy sub-gradient ∇j D(p(t)) = b −Pi∈[n]Pk∈[ℓi] aijkx(t) Compute truncated noisy sub-gradient ∇j ¯D(p(t)) as follows : ik + ν(t) j for 1 ≤ j ≤ m; ∇j ¯D(p(t)) =  ∇j D(p(t)) −∇max ∇max if −∇max ≤ ∇j D(p(t)) ≤ ∇max ; if ∇j D(p(t)) < −∇max ; if ∇j D(p(t)) > ∇max . 6: 7: 8: 9: As for the dummy (m + 1)-th dimension, let ∇m+1 ¯D(p(t)) = 0. Compute p(t+1) such that p(t+1) Pm+1 j (cid:0)1 − η∇j ¯D(p(t))(cid:1)/pmax is a normalization term. φ(t) p(t) j=1 p(t) = 1 j 10: end for 11: output: ¯xik = 1 ik for every i ∈ [n], k ∈ [ℓi], where agent i observes ¯xi. j (cid:0)1 − η∇j ¯D(p(t))(cid:1) for 1 ≤ j ≤ m + 1, where φ(t) = t=1 x(t) T PT Next, observe that the noisy sub-gradient ∇j D(p(t)) of each step t is computed by adding Laplace noise of ǫ′ to the sub-gradient ∇jD(p(t)) = b −Pi∈[n]Pk∈[ℓi] aijkx(t) scale 1 ik . By our assumption, the sub-gradient has sensitivity 1. Hence, given p(t), the computation of the noisy sub-gradient ∇j D(p(t)) satisfies (ǫ′, 0)-differential privacy (Lemma 2.2). Further, p(t) is determined by the noisy sub-gradients ∇j D(p(1)), . . . ,∇j D(p(t−1)) in previous rounds. Hence, the sequence of noisy sub-gradients are computed via an adaptive composition of T m Laplacian mechanisms each of which is (ǫ′, 0)-differentially private. The lemma then follows by the composition theorem (Lemma 2.3). 3.2 Proof of Theorem 1.1 (approximation) In this subsection, we will show that our algorithm violates each constraint by at most αb and is approximately optimal up to an αn additive factor. Then, to get exact feasibility as in Theorem 1.1, we simply run Pri-DMW with (1 − α)b as the supply per constraint, noting that doing so decreases the optimal objective by at most an 1 − α multiplicative factor. We first introduce some useful facts and technical lemmas. Lemma 3.2. For any p, we have that: Proof. By the definition of L(x, p), we have: L(x(t), p(t)) − L(x(t), p) = hp(t) − p,∇D(p(t))i L(x(t), p(t)) − L(x(t), p) = hp(t) − p,∇pL(x(t), p(t))i = hp(t) − p,∇D(p(t))i , where the second equality is due to the envelope theorem (Lemma 2.1). Lemma 3.3. If b ≥ 20 ln(T )√m ln(m+1) ln(6/β) ln(2/δ) αǫ , then we have η∇max < 1. Proof. Plug in the value of η,∇max, T . We have: η∇max = αbT ln(m + 1) (n + ln(T )p8T m ln(2/β) ǫ ) = ln(m+1)√8m ln(T ) ln(2/δ) αǫ2nb ≤ ln(m+1)√8m ln(T ) ln(2/δ) αǫ2b2 . 20 ln(T )√m ln(m+1) ln(6/β) ln(2/δ) So if b ≥ Lemma 3.4. For any p with kpk1 = pmax, and η∇max < 1, we have: , we have η∇max < 1. αǫ DKL(pkp(t+1)) − DKL(pkp(t)) ≤ −η(cid:10)p(t) − p,∇ ¯D(p(t))(cid:11) + η2pmax∇2 max . This lemma follows by the standard analysis of multiplicative weight update. We include the proof in Appendix A for the sake of completeness. The proofs of the next three lemmas are also deferred to Appendix A. Lemma 3.5. For any q(1), . . . , q(T ) such that kq(t)k1 = pmax and that q(t) depends only on ν(1), . . . , ν(t−1), we have that: pmaxq8T ln( 6 β ) and t=1hq(t), ν(t)i ≥ (cid:21) ≤ β (cid:21) ≤ β Lemma 3.6. For any q(1), . . . , q(T ) ≥ 0 such that kq(t)k1 ≤ 2pmax and kq(t)k∞ ≤ pmax, and that q(t) depends only on ν(1), . . . , ν(t−1) for 1 ≤ t ≤ T , we have that with probability at most β/3 Pr(cid:20)PT Pr(cid:20)PT t=1hq(t), ν(t)i ≤ − pmaxq8T ln( 6 β ) 6 . 6 , ǫ′ ǫ′ and with probability at most β/3 j=1 q(t) j PT t=1Pm PT t=1Pm j=1 q(t) j · max(cid:8)0, ν(t) · max(cid:8)0,−ν(t) j − ln(T ) ǫ′ (cid:9) ≥ j − ln(T ) ǫ′ (cid:9) ≥ 2pmaxq8T ln( 6 β ) ǫ′ 2pmaxq8T ln( 6 β ) ǫ′ Putting the above pieces together, we have the following key lemma that is useful for showing approximate optimality and feasibility. Lemma 3.7. For any p such that kpk1 = pmax, with probability at least 1 − β, we have: PT t=1(cid:0)L(x(t), p(t)) − L(x(t), p)(cid:1) ≤ 1 η DKL(pkp(1)) + η · T pmax∇2 max + 20pmaxTqm ln( 6 β ) ln( 2 δ ) ǫ 3.2.1 Approximate optimality Lemma 3.8. For any t, we have L(x(t), p(t)) ≥ OP T . Proof. Let x∗ be the optimal primal solution. Recall the definition of the Lagrangian objective. We have that: Since that x(t) maximizes L(x, p(t)), we get that: Rearranging terms, this is further equal to ik (πik −Pj∈[m] aijkp(t) L(x(t), p(t)) =Pi∈[n]Pk∈[ℓi] x(t) L(x(t), p(t)) ≥Pi∈[n]Pk∈[ℓi] x∗ik(πik −Pj∈[m] aijkp(t) Pj∈[m] p(t) j ) +Pj∈[m] p(t) j ) +Pj∈[m] p(t) j (cid:16)bj −Pi∈[n]Pk∈[ℓi] aijkx∗ik(cid:17) +Pi∈[n]Pk∈[ℓi] πikx∗ik . j bj . j bj . Finally, note that by the definition x∗, the first term equals OP T and the second term is greater than or equal to zero. So the lemma follows. Proof. (Approximate optimality) Recall that we add a dummy constraint h0, xi ≤ 0, we let pm+1 = pmax and pj = 0 for all j ≤ m. By Lemma 3.7, the following holds with probability at least 1 − β: PT t=1(cid:0)L(x(t), p(t)) − L(x(t), p)(cid:1) ≤ 1 DKL(pkp(1)) + η · T pmax∇2 η η pmax ln(m + 1) + η · T pmax(n + ln(T ) max + ǫ′ = 1 = 4αT n + T ln(T )2 ln(2/δ) ln(m+1)mn αǫ2b2 + ǫ 20pmaxTpm ln(6/β) ln(2/δ) 20pmaxT√m ln(6/β) ln(2/δ) 20nT√m ln(6/β) ln(2/δ)) )2 + ǫ . 20 ln(T )√m ln(m+1) ln(6/β) ln(2/δ) αǫ If b ≥ So we get that αǫ2b2 , we further bound the 2nd and 3rd terms by 20nT√m ln(6/β) ln(2/δ) T ln(T )2 ln(2/δ) ln(m+1)mn ≤ αT n , and bǫ PT t=1(cid:0)L(x(t), p(t)) − L(x(t), p)(cid:1) ≤ 6αT n . Note that Pi∈[n]Pk∈[ℓi] πik ¯xik = ALG. By our choice of p, we have PT we have PT t=1 L(x(t), p(t)) ≥ T · OP T . So we have: T (OP T − ALG) ≤PT So we have the desired approximate optimality guarantee. t=1(cid:0)L(x(t), p(t)) − L(x(t), p)(cid:1) ≤ 6T αn , bǫ ≤ αT n . t=1 L(x(t), p) = T · ALG. By Lemma 3.8, 3.2.2 Approximate feasibility Proof. (Approximate feasibility) We choose p to penalize the over-demands and, thus, make L(x(t), p) as small as possible. We let pj∗ = pmax, where j∗ is the most over-demanded constraint and let pj = 0 for any j 6= j∗. Let s = b −Pi∈[n]Pk∈[ℓi] aij∗k ¯xik be the over-demand of j∗. By Lemma 3.7 and the choice of p and p(1), with probability at least 1 − β, we have: PT t=1(cid:0)L(x(t), p(t)) − L(x(t), p)(cid:1) ≤ 1 = 1 η DKL(pkp(1)) + η · T pmax∇2 η pmax ln(m + 1) + η · T pmax∇2 max + max + 20pmaxT√m ln(6/β) ln(2/δ) ǫ 20pmaxT√m ln(6/β) ln(2/δ) ǫ . (3.2) By the choice of p, we further get that: t=1 L(x(t), p) = T · ALG + pmaxPT PT t=1(b −Pi∈[n]Pk∈[ℓi] aij∗kx(t) ik ) = T (ALG − pmaxs) . Putting together with Lemma 3.8, the LHS of (3.2) is at least T (OP T − ALG + pmaxs). optimal packing objective by at most a b+s b Also note that ALG ≤ (1 + s factor. So we have: b )OP T , because increasing the supply per resource from b to b + s increases the LHS of (3.2) ≥ T (cid:0)OP T − (1 + s = T s(cid:0)pmax − 1 b )OP T + pmaxs(cid:1) b OP T(cid:1) ≥ T s(pmax − n b ) = 3T spmax 4 . ≤ 1 η pmax ln(m + 1) + η · T pmax∇2 max + 20pmaxT√m ln(6/β) ln(2/δ) ǫ . So we have that: 3T spmax 4 Plug in the choice of parameters, we get that s b ≤ O(cid:0)α + ln(T )2 ln(m+1) ln(2/δ)m αǫ2b2 √m ln(6/β) ln(2/δ) bǫ + (cid:1) . 20 ln(T )√m ln(m+1) ln(6/β) ln(2/δ) Therefore, the max violation per constraint is at most s ≤ O(αb) as long as the supply per constraint is at least b ≥ αǫ . 4 Hardness (Theorem 1.2) Theorem 4.1. (Theorem 1.1 of [23]) Suppose there is an (ǫ, δ)-differentially private algorithm for answering m arbitrary counting queries on a dataset of size b with average error at most O(αb). Then, we have b ≥ Ω(cid:18)√m log(1/δ) ǫα (cid:19) . Lemma 4.1. Suppose for some b and m, there is an (ǫ, δ)-jointly differentially private algorithm that with high probability outputs a feasible solution that is optimal up to an αn additive factor for n = Θ(b). Then, there is an (ǫ, δ)-differentially private algorithm for answering m arbitrary counting queries on any dataset of size Θ(b) with average error at most O(αb). Proof. Consider an arbitrary dataset of size n′ = b 2 , denoted as D′ = {d1, . . . , dn′}, and an arbitrary set of m counting queries of sensitivity 1, denoted as Q = {q1, . . . , qm}. Construct an instance of the packing problem with n = Θ(b) agents as follows: Let there be a set n′ agents, denoted as A, each of which demands a unique bundle, i.e., [ℓi] = 1 and therefore we omit subscript k in the following. The resource demanded in the bundle is aij = qj(di) and the value is πi = 1. Further, let there be 2b agents, denoted as B, each of whom demands any subset of size m 2 and has value 1 4 . 2 , let there be a k such that aijk = 1 if j ∈ S and 0 otherwise, That is, ℓi =(cid:0) m and πik = 1 4 . m/2(cid:1); for any subset S ⊆ [m] of size m Note that by allocating a bundle to one of the agents in A, we get value at least 1 m per unit of resources. On 2 . 2mPj∈[m](cid:0)b − qj(D′)(cid:1) − 1 the other hand, allocating a bundle to one of the agents in B gets at only 1 Lemma 4.2. OP T ≥ n′ + 1 Proof. We will prove by constructing a feasible solution with total value lower bounded by the RHS of the inequality. First, we will allocate to all agents in A their desired bundles. We gain n′ total value by doing so, and has a remaining supply b − qj(D′) of resource j for any j ∈ [m]. Then, we claim that it is possible to allocate bundles to a subset of the agents in B such that we use up all but at most 1 unit of every resource. Given that, the lemma follows because allocating bundles to agents in B gives precisely 1 2m value per unit of resources. 2m value per unit of resources. In the rest of the proof, we will explain how to allocate bundles to agents in B. Note that after allocating 2 , while the minimum demand of bundles to agents in A, the maximum demand of any resource is at most n′ = b some resource could be 0. We will inductively decide how to allocate bundles to agents in B in b 2 − 1 rounds such that after round i, 0 ≤ i ≤ b 2 − 1, the maximum demand of any resource will be at most n′ + i, while the minimum demand of any resource will be at least 2i. Then, at the end of the process, the maximum demand will be at most b − 1 and the minimum demand will be at least b − 2. We simply allocate to two more agents such that the first one gets resources 1 to m 2 + 1 to m. That is, we further use one unit of each resource. The claim is vacuously true for i = 0. Next, suppose we have finished the first i − 1 rounds for some i ≥ 1. Suppose the maximum and minimum demands of resources differs by at most 1. We simply repeatedly allocate bundles to two agents in set B so that one unit of each resource is allocated to exactly one of the two agents until the maximum demand equals n′ + i. 2 and the second one gets resources m Let us explain how to allocate bundles in round i. Otherwise, suppose the maximum and minimum demands, denoted as d+ and d− respectively, differ by at least 2. We will further divide it into three cases depending on the numbers of resources with demands d+ and d− respectively, denoted as k+ and k− respectively. Let us assume w.l.o.g. that the resources are sorted in ascending order of their current demands. E.g., resources 1 to k− are those with demands equal d−, and resource m− k+ + 1 to m are those with demands equal d+. 2 resources with demand d− and k+ > k−. In this case, consider two agents in B. Let us allocate items 1 to m 2 + 1 to m − k− to the second one. Note that m − k− > m − k+ by our assumption on k− and k+. We have increased (1) the demands of resources 1 to k− by 2 (i.e., from k− to k− + 2 ≤ k+), (2) the demands of resources k− + 1 to m − k+ by 1 (i.e., from < k+ to at most k+), and (3) demands of a subset of the resources m − k+ + 1 to m by 1 (i.e., from k+ to k+ + 1). Thus, we have achieved the desired goal in round i. 2 to the first agent, and allocate items 1 to k− together with items m The first case is when there are k− ≤ m The second case is when k− ≤ m 2 and k+ ≤ k−. We consider the same two agents as in the previous case. After allocating to those two agents, we have increased (1) the demands of resources 1 to k− by 2 (i.e., from k− to k− + 2 ≤ k+), and (2) the demands of a subset of the resources k− + 1 to m − k+ by 1 (i.e., from < k+ to at most k+). Then, we further allocate to two agents in set B so that one unit of each resource is allocated to exactly one of the two agents. Then, we have increased (1) the demands of resources 1 to k− by 3 (i.e., from k− to at most k− + 3 ≤ k+ + 1), (2) the demands of resources k− + 1 to m − k+ by either 1 or 2 (i.e., from < k+ to at most k+ + 1), and (3) the demands of resources m− k+ + 1 to m by 1 (i.e., from k+ to at most k+ + 1). Thus, we have achieved the desired goal in round i. 2 . In this case, consider allocating to 4 agents. The first and second agents get resources 1 to m 2 + 1 to k−. Then, we have increased (1) the demands of resources 1 to k− by either 2 or 3 (i.e., from k− to at most k− + 3 ≤ k+ + 1), (2) the demands of all other resources by 1 (i.e., from ≤ k+ to at most k+ + 1). Thus, we have achieved the desired goal in round i. 2 + 1 to m; and the fourth agent gets resources k− − m 2 ; the third agent gets resources m The final case is when k− > m Lemma 4.3. Any solution that is optimal up to an αn additive factor must allocate bundles to all but at most 2αn + 1 agents in A. Proof. We will prove the lemma even for fractional solutions. As the solution is allowed to be fractional and there are plenty of agents in B, we can assume without loss that all resources are fully allocated. If we allocate to all agents in A, the objective would be n′ + 1 of allocating to agents in set B is at most a half of that of allocating to agents in set A. Thus, for each agent i ∈ A that remains unallocated in the solution, the objective decreases by at least 1 2 even if we fully allocate the resources that were allocated to the i to some other agents in B. Putting together with Lemma 4.2 proves the lemma. 2mPj∈[m](cid:0)b − qj(D′)(cid:1). Note that the value per unit of resource Lemma 4.4. Any solution that is optimal up to an αn additive factor must allocate all but at most O(αbm) units of the resources. Proof. Again, we will prove the lemma even for fractional solutions. If all resources are fully allocated and we optimally allocate to all agents in A, the objective is n′ + 1 resources is at least 2mPj∈[m](cid:0)b − qj(D′)(cid:1). Since the value per unit of 1 2m for any agent, putting together with Lemma 4.2 proves the lemma. Now we are ready to introduce the reduction from differentially private query release to jointly differentially private packing. By solving the constructed packing instance in an (ǫ, δ)-jointly differentially private manner, the allocation for agents in B is (ǫ, δ)-differentially private w.r.t. the data of agents in A according to the definition of joint differential privacy. Then, we can output b minus the number of units of resource j allocated to agents in B, denoted as qj, as the response for query qj. Since this is a post-processing on the output of an (ǫ, δ)-differentially private algorithm, the responses are (ǫ, δ)-differentially private as well. It remains to analyze the accuracy of the responses. On one hand, qj is greater than or equal to the number of units of resource j allocated to agents in A, which, by Lemma 4.3 is at least qj(D′)− O(αn) = qj(D′)− O(αb). On the other hand, qj is at most the number of units of resource j allocated to agents in A plus the number of unallocated units of resource j. The former is at most qj(D′) while the latter is at most O(αb) on average according to Lemma 4.4. Putting together qj's have average error at most α. 5 Private dual online multiplicative weight algorithm In this section we introduce an alternative algorithm for solving the packing problem in a jointly differentially In private manner. This alternative approach is similar to the previous one, with the following differences. each step, instead of computing the best responses of all agents for the current dual prices and, thus, compute the corresponding subgradient, we simply pick one of the agents and use his best response to compute a proxy subgradient. The agent then gets the bundle specified by his best response. We will choose a random ordering of the agents at the beginning and pick agents in that order. As a result, the algorithm will update dual prices for only n rounds as oppose to ǫ2n2 m rounds in the previous approach. There are both pros and cons of this alternative approach. Algorithm 2 Private Dual Online Multiplicative Update Method (Pri-DOMW) 1: input: objective π; demands aijk for all i ∈ [n], j ∈ [m], k ∈ [ℓi]; supply b; approximation parameter α; 2: parameters: initial dual p(1) = pmax ǫ (if m+1 · 1; step size η = 1√nσ ; range of dual pmax = αn σ ; noise scale σ = m privacy parameter ǫ and δ. δ = 0) or 1 3: require: b ≥ O(cid:0) √nσ ǫp8m ln(1/δ) (if δ > 0) in each step; width ∇max = 1 + σ · ln n. α (cid:1); we assume n ≥ b as the problem is trivial otherwise. 4: Pick a permutation λ over [n] uniformly at random. 5: for all t = 1, . . . , n do 6: Let xλ(t) = x∗λ(t)(p(t)), i.e., for all k ∈ [ℓλ(t)], let j=1 aλ(t)jkp(t) xλ(t)k =(1, if πλ(t)k −Pm 0, otherwise. j ≥ 0,k = arg maxk′∈[ℓi] πλ(t)k′ −Pm j=1 aλ(t)jk′ p(t) j ; 7: 8: 9: Sample Laplacian noise νtj ∼ Lap(cid:0)σ(cid:1) for all j ∈ [m]. Let yt =Pk∈[ℓλ(t)] xλ(t)k · (aλ(t)1k, . . . , aλ(t)mk) be the demand vector of agent t. n )(cid:1) for j ∈ [m] and p(t+1) j (cid:0)1 + η · (ztj − b m+1 ∝ 1. Let zt = yt + νt be the noisy demand vector. Compute p(t+1) such that p(t+1) ∝ p(t) 10: 11: end for 12: output: xλ(1), . . . , xλ(n). j • The main disadvantage is that it requires a much larger supply to get the same approximation guarantees. Intuitively, this is because (1) we use proxy subgradients in place of the actual subgradients and, thus, introduce some extra error, and (2) it goes over the each agent only once and, thus, does not optimize the number of rounds of dual updates. • For the same two reasons that cause the above drawback, the approach in this section has the advantage that we get incentive compatibility for free if we charge the agent the corresponding dual prices in his round, since every agent gets the best response bundle. • Further, it can be implemented in the online random-arrival setting, where the agents show up one by one in a random order and the algorithm must decide the allocation to each agent at his arrival. • Last but not least, the approach in this section can be implemented in an ǫ-jointly differentially private manner. Neither the dual multiplicative weight update approach in Section 3 nor the approach in previous work [12] can achieve ǫ-joint differential privacy. 5.1 Proof of Theorem 1.3 (privacy) By standard privacy properties of the Laplace mechanism and the composition theorem, the noisy demand vectors zt's are ǫ-differentially private if the noise scale is σ = m ǫ , and are (ǫ, δ)-differentially private if the noise scale is σ = 1 Algorithm 2 follows by the Billboard Lemma (Lemma 2.4). ǫp8m ln(1/δ). Then, the joint differential privacy of 5.2 Proof of Theorem 1.3 (approximation) 5.2.1 Key lemma We will first establish a key lemma that is an analogue of Lemma 3.7 in the previous section. Lemma 5.1. For any given p such that kpk1 = pmax, with high probability, we have: OP T − L(x, p) ≤ 1 η DKL(pkp(1)) + η · O(cid:0)npmaxσ2(cid:1) + O(cid:0)√npmaxσ(cid:1) . The proof of Lemma 5.1 follows by a sequence of technical lemmas as follows. Lemma 5.2. For any p with kpk1 = pmax, and η∇max < 1, we have: DKL(pkp(t+1)) − DKL(pkp(t)) ≤ η(cid:10)p(t) − p, zt − b n · 1(cid:11) + η2pmax∇2 max . We will omit the proof of the above lemma because it is essentially the same as that of Lemma 3.4, replacing Next, we decompose the Lagrangian objective L(x, p) into the sum of n components Li(xi, p)'s, i ∈ [n], as −∇ ¯D(p(t)) with zt − b follows: n · 1. Then, we have: Li(xi, p) =Pk∈[ℓi] πikxik −Pj∈[m] pj(cid:0)Pk∈[ℓi] aijkxik − b n(cid:1) . n · 1(cid:11) = Lλ(t)(xλ(t), p) − Lλ(t)(xλ(t), p(t)) . (cid:10)p(t) − p, yt − b (5.3) Lemma 5.3. For any p with kpk1 = pmax, and η∇max < 1, any fixed permutation λ and over the randomness of the Laplacian noise, we have that with high probability: Pt∈[n] Lλ(t)(xλ(t), p(t)) − L(x, p) η DKL(pkp(1)) + η · O(cid:0)npmaxσ2(cid:1) O(cid:0)√npmaxσ(cid:1) , ≤ 1 Proof. Recall that zt = yt + νt. By Eqn. (5.3) and Lemma 5.2, we have: DKL(pkp(t+1)) − DKL(pkp(t)) ≤ η ·(cid:0)Lλ(t)(xλ(t), p) − Lλ(t)(xλ(t), p(t))(cid:1) + η2pmax∇2 max + η · hp(t) − p, νti . Summing over t ∈ [n], we get that DKL(pkp(n+1)) − DKL(pkp(1)) ≤ η ·Pt∈[n](cid:0)Lλ(t)(xλ(t), p) − Lλ(t)(xλ(t), p(t))(cid:1) + η2npmax∇2 max + η ·Pt∈[n]hp(t) − p, νti . Since λ is a permutation, we have thatPt∈[n] Lλ(t)(xλ(t), p) =Pt∈[n] Lt(xt, p) = L(x, p). Further, recall that our choice of ∇max = O(σ). So the RHS further equals η ·(cid:0)L(x, p) −Pt∈[n] Lλ(t)(xλ(t), p(t))(cid:1) + η2 · O(cid:0)npmaxσ2(cid:1) + η ·Pt∈[n]hp(t) − p, νti . Finally, let us consider the randomness of the Laplacian noise. We will use the concentration bound for martingales [2] to bound the last term. By Lemma 3.5, the last term on the RHS is at most O(√npmaxσ) with high probability. Rearrange terms and the lemma follows. Lemma 5.4. With high probability, we have: Pt∈[n] Lλ(t)(xλ(t), p(t)) ≥ OP T − O(√npmax) . Proof. We will proceed in two steps. Firstly we will show that the expectation of the LHS is at least OP T − O(√npmax). Then, we will use the standard concentration bound for martingales to bound the deviation For any t, let us fix the randomness in the first t − 1 rounds and, thus, fix p(t). Taking expectation over only of the LHS from its expectation. the randomness of round t, we get that: E(cid:2)Lλ(t)(xλ(t), p(t)) λ(1 : t − 1)(cid:3) = 1 n−t+1Pi∈[n]\λ(1:t−1) Li(x∗i (p(t)), p(t)) . Let x∗ be the offline optimal primal solution. Since x∗i (p(t)) is the best response to p(t), we have: E(cid:2)Lλ(t)(xλ(t), p(t)) λ(1 : t − 1)(cid:3) ≥ 1 n−t+1Pi∈[n]\λ(1:t−1) Li(x∗i , p(t)) . Next, consider the difference between the above quantity and the actual average over n agents, i.e., 1 nPi∈[n] Li(x∗i , p(t)). We have: 1 n−t+1Pi∈[n]\λ(1:t−1) Li(cid:0)x∗i , p(t)(cid:1) − 1 nPi∈[n] Li(cid:0)x∗i , p(t)(cid:1) 1 Note that [n] \ λ(1 : t − 1) is a random subset of n − t + 1 elements in [n]. By the standard concentration bound for sampling without replacement [1], with high probability over the randomness of λ(1 : t − 1), we have that n−t+1Pi∈[n]\λ(1:t−1)Pk∈[ℓi] aijkx∗ik − 1 n−t+1Pi∈[n]\λ(1:t−1)Pk∈[ℓi] aijkx∗ik − 1 nPi∈[n]Pk∈[ℓj ] πikx∗ik(cid:17) nPi∈[n]Pk∈[ℓj ] πikx∗ik(cid:17) =(cid:16) 1 n−t+1Pi∈[n]\λ(1:t−1)Pk∈[ℓj ] πikx∗ik − 1 +Pj∈[m] pj ·(cid:16) 1 ≥(cid:16) 1 n−t+1Pi∈[n]\λ(1:t−1)Pk∈[ℓj ] πikx∗ik − 1 − pmax · maxj∈[m](cid:12)(cid:12)(cid:12) nPi∈[n]Pk∈[ℓj ] πikx∗ik ≥ − O(cid:0) n−t+1Pi∈[n]\λ(1:t−1)Pk∈[ℓj ] πikx∗ik − 1 nPi∈[n]Pk∈[ℓi] aijkx∗ik(cid:12)(cid:12)(cid:12) ≤ O(cid:0) n−t+1Pi∈[n]\λ(1:t−1)Pk∈[ℓi] aijkx∗ik − 1 E(cid:2)Lλ(t)(xλ(t), p(t)) λ(1 : t − 1)(cid:3) ≥ 1 n−t+1Pi∈[n]\λ(1:t−1) Li(cid:0)x∗i , p(t)(cid:1) nPi∈[n] Li(cid:0)x∗i , p(t)(cid:1) − O(cid:0) pmax ≥ 1 √n−t+1(cid:1) n OP T − O(cid:0) pmax ≥ 1 √n−t+1(cid:1) , where the last inequality follows by the optimality of x∗. = O(√n), we have: nPi∈[n]Pk∈[ℓi] aijkx∗ik(cid:17) nPi∈[n]Pk∈[ℓi] aijkx∗ik(cid:12)(cid:12)(cid:12) 1√n−t+1(cid:1) , 1√n−t+1(cid:1) . and for any j ∈ [m] Putting together, we have: (cid:12)(cid:12)(cid:12) 1 1 . 1√n−t+1 =Pt∈[n] Summing over t ∈ [n], noting that Pt∈[n] E(cid:2)Lλ(t)(xλ(t), p(t)) λ(1 : t − 1)(cid:3) ≥ OP T − O(√npmax) . Then, consider a sequence of random variables ut ∈ [−2pmax, 2pmax]'s as follows: ut = Lλ(t)(xλ(t), p(t)) − E(cid:2)Lλ(t)(xλ(t), p(t)) λ(1 : t − 1)(cid:3) . 1√t Note that E[utλ(1 : t − 1)] = 0, so P ut is a martingale so we have that with high probability Summing over t ∈ [n] together with Eqn. (5.4) proves the lemma. Putting together Lemma 5.3 and Lemma 5.4 proves Lemma 5.1. Pt∈[n] ut ≥ − O(√npmax) . (5.4) 5.2.2 Approximate optimality Let pm+1 = pmax and pj = 0 for all j ≤ m. By Lemma 5.1, the following holds with high probability: OP T − ALG = OP T − L(x, p) η DKL(pkp(1)) + η · O(cid:0)npmaxσ2(cid:1) + O(cid:0)√npmaxσ(cid:1) ≤ 1 η pmax ln(m + 1) + η · O(cid:0)npmaxσ2(cid:1) + O(cid:0)√npmaxσ(cid:1) . = 1 Plug in our choice of parameters, the RHS further equals So we have the desired approximate optimality guarantee. O(cid:0)√npmaxσ(cid:1) = O(αn) . 5.2.3 Approximate feasibility We choose p to penalize the over-demands and, thus, make L(x(t), p) as small as possible. We let pj∗ = pmax, where j∗ is the most over-demanded constraint and let pj = 0 for any j 6= j∗. Let s = b −Pi∈[n]Pk∈[ℓi] aij∗kxik be the over-demand of j∗. By Lemma 5.1 and the choice of p and p(1), with high probability we have: (5.5) By the choice of p, we further get that: OP T − L(x, p) ≤ O(cid:0)√npmaxσ(cid:1) L(x, p) = ALG − pmaxs . Note that ALG ≤ (1 + s packing objective by at most a b+s b factor. So we have: b )OP T , because increasing the supply per resource from b to b + s increases the optimal OP T − L(x, p) ≥ OP T − (1 + s where the last inequality is due to pmax = O( α√n So we have s ≤ O(√nσ). Recall that b ≥ O(cid:0) References b OP T(cid:1) ≥ spmax 2 , α (cid:1), and OP T ≤ n. So we have that: √nσ b )OP T + pmaxs = s(cid:0)pmax − 1 σ ), b ≥ O(cid:0) 2 ≤ O(cid:0)√npmaxσ(cid:1) . α (cid:1), we have s ≤ αb. spmax √nσ [1] Shipra Agrawal and Nikhil R. Devanur. Fast algorithms for online stochastic convex programming. In SODA, pages 1405 -- 1424. SIAM, 2015. [2] Kazuoki Azuma. Weighted sums of certain dependent random variables. Tohoku Mathematical Journal, Second Series, 19(3):357 -- 367, 1967. [3] Raef Bassily, Adam D. Smith, and Abhradeep Thakurta. Private empirical risk minimization: Efficient algorithms and tight error bounds. In FOCS, pages 464 -- 473. IEEE Computer Society, 2014. [4] Avrim Blum, Katrina Ligett, and Aaron Roth. A learning theory approach to noninteractive database privacy. J. ACM, 60(2):12:1 -- 12:25, 2013. [5] Niv Buchbinder and Joseph Naor. Online primal-dual algorithms for covering and packing. Mathematics of Operations Research, 34(2):270 -- 286, 2009. [6] Kamalika Chaudhuri and Daniel J. Hsu. Sample complexity bounds for differentially private learning. In COLT, volume 19 of JMLR Proceedings, pages 155 -- 186. JMLR.org, 2011. [7] Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam D. Smith. Calibrating noise to sensitivity in private data analysis. In TCC, volume 3876 of Lecture Notes in Computer Science, pages 265 -- 284. Springer, 2006. [8] Cynthia Dwork, Guy N. Rothblum, and Salil P. Vadhan. Boosting and differential privacy. In FOCS, pages 51 -- 60. IEEE Computer Society, 2010. [9] Cynthia Dwork and Adam Smith. Differential privacy for statistics: What we know and what we want to learn. Journal of Privacy and Confidentiality, 1(2):2, 2010. [10] Arpita Ghosh, Katrina Ligett, Aaron Roth, and Grant Schoenebeck. Buying private data without verification. In EC, pages 931 -- 948. ACM, 2014. [11] Justin Hsu, Zhiyi Huang, Aaron Roth, Tim Roughgarden, and Zhiwei Steven Wu. Private matchings and allocations. In STOC, pages 21 -- 30. ACM, 2014. [12] Justin Hsu, Zhiyi Huang, Aaron Roth, and Zhiwei Steven Wu. Jointly private convex programming. In SODA, pages 580 -- 599. SIAM, 2016. [13] Justin Hsu, Aaron Roth, Tim Roughgarden, and Jonathan Ullman. Privately solving linear programs. In ICALP (1), volume 8572 of Lecture Notes in Computer Science, pages 612 -- 624. Springer, 2014. [14] Zhiyi Huang. Privacy preserving auction. In Encyclopedia of Algorithms, pages 1618 -- 1622. 2016. [15] Shiva Prasad Kasiviswanathan, Homin K Lee, Kobbi Nissim, Sofya Raskhodnikova, and Adam Smith. What can we learn privately? SIAM Journal on Computing, 40(3):793 -- 826, 2011. [16] Michael Kearns, Mallesh M. Pai, Aaron Roth, and Jonathan Ullman. Mechanism design in large games: incentives and privacy. In ITCS, pages 403 -- 410. ACM, 2014. [17] Frank McSherry and Kunal Talwar. Mechanism design via differential privacy. In FOCS, pages 94 -- 103. IEEE Computer Society, 2007. [18] Paul Milgrom and Ilya Segal. Envelope theorems for arbitrary choice sets. Econometrica, 70(2):583 -- 601, 2002. [19] Serge A Plotkin, David B Shmoys, and ´Eva Tardos. Fast approximation algorithms for fractional packing and covering problems. Mathematics of Operations Research, 20(2):257 -- 301, 1995. [20] Ryan M. Rogers and Aaron Roth. Asymptotically truthful equilibrium selection in large congestion games. In EC, pages 771 -- 782. ACM, 2014. [21] Ryan M. Rogers, Aaron Roth, Jonathan Ullman, and Zhiwei Steven Wu. Inducing approximately optimal flow using truthful mediators. In EC, pages 471 -- 488. ACM, 2015. [22] Aravind Srinivasan. Improved approximation guarantees for packing and covering integer programs. SIAM Journal on Computing, 29(2):648 -- 670, 1999. [23] Thomas Steinke and Jonathan Ullman. Between pure and approximate differential privacy. Journal of Privacy and Confidentiality, 7(2):2, 2017. A Missing proofs in Section 3 A.1 Proof of Lemma 3.4 Proof. By the definition of KL-divergence, we get that: (A.1) where the last equality is due to kpk1 = pmax. Next, we bound the two terms separately. The first term equals: 1−η∇j ¯D(p(t))(cid:1) , 1 φ(t) pmax ln φ(t) = pmax ln(cid:0) 1 j=1 pj ln(cid:0) p(t) DKL(pkp(t+1)) − DKL(pkp(t)) =Pm+1 p(t+1)(cid:1) =Pm+1 j=1 pj ln(cid:0) 1−η∇j ¯D(p(t))(cid:1) = pmax ln φ(t) +Pm+1 j=1 pj ln(cid:0) pmax Pm = pmax ln(cid:0)1 − η pmax(cid:10)p(t),∇max · 1(cid:11) = η 2 . Note that ln(1 − x) ≤ −x for any x ≤ 1, we have: pmax ln φ(t) ≤ −η(cid:10)p(t),∇ ¯D(p(t))(cid:11) . pmax(cid:10)p(t),∇ ¯D(p(t))(cid:11)(cid:1) . j (cid:0)1 − η∇j ¯D(p(t))(cid:1)(cid:1) j=1 p(t) 1 pmax · ∇maxkp(t)k1 = η∇max < 1 . By the definition of ∇ ¯D(p(t)), we have that pmax(cid:10)p(t),∇ ¯D(p(t))(cid:11) ≤ η pmax(cid:10)p(t),∇ ¯D(p(t))(cid:11) ≥ − 1 and similarly η η 1−xy ) ≤ ln( 1 1−x )y for any 0 ≤ x, y ≤ 1 and ln( (A.2) 1 1−xy ) ≤ Now we bound the second term using inequalities ln( ln(1 + x)y for any 0 ≤ x ≤ 1,−1 ≤ y ≤ 0. 1−η∇j ¯D(p(t))(cid:17) 1 j=1 pj ln(cid:16) Pm+1 ≤Pj:∇j≥0 pj ln(cid:16) Then, we further upper bound the above using ln( 1 1 1−η∇max(cid:17) · ∇j ¯D(p(t)) +Pj:∇j <0 pj ln (1 + η∇max) · ∇j ¯D(p(t)) ∇max 1−x ) ≤ x + x2 and ln(1 + x) ≥ x − x2, and get that: ∇max j=1 pj ln(cid:16) Pm+1 1 1−η∇j ¯D(p(t))(cid:17) ≤Pj:∇j≥0(cid:0)ηpj∇ ¯D(p(t)) + η2∇maxpj∇j ¯D(p(t))(cid:1) +Pj:∇j <0(cid:0)ηpj∇ ¯D(p(t)) − η2∇maxpj∇j ¯D(p(t))(cid:1) = η(cid:10)p,∇ ¯D(p(t))(cid:11) + η2∇max(cid:10)p,∇ ¯D(p(t))(cid:11) . Finally, by that kpk1 ≤ pmax, and ∇j ¯D(p(t)) ≤ ∇max for any j, (cid:10)p,∇ ¯D(p(t))(cid:11) is upper bounded by pmax∇max. So we have: Putting (A.1), (A.2), and (A.3) together proves the lemma. j=1 pj ln(cid:16) Pm+1 1 1−η∇j ¯D(p(t))(cid:17) ≤ η(cid:10)p,∇ ¯D(p(t))(cid:11) + η2pmax∇2 max . (A.3) A.2 Proof of Lemma 3.5 Proof. In our case, v(t) j strategy of proving Azuma-Hoeffding type of concentration bounds. By symmetry of the random variables v(t) j it suffices to show the first inequality. 's are unbounded but have exponentially small tail contributions. We follow the standard 's, whose value will be determined later, we Let Xk = Pk t=0(cid:10)q(t), v(t)(cid:11) for 0 ≤ k ≤ T . For a positive λ < ǫ′ pmax have: ǫ′ Pr" XT − X0 ≥ pmaxq8T ln( 6 β ) # = Pr"exp λ XT − X0 − ≤ E"exp λ XT − X0 − pmaxq8T ln( 6 β ) ǫ′ ǫ′ pmaxq8T ln( 6 β ) !! ≥ 1# !!# . Next, we upper bound E(cid:2) exp(cid:0)λ(cid:0)XT − X0(cid:1)(cid:1)(cid:3), which can be rewritten as: Eν(1) [exp(cid:0)λ(X1 − X0)(cid:1) · Eν(2) ν(1)[exp(cid:0)λ(X2 − X1)(cid:1) · . . . Eν(T ) ν(1:T −1) [exp(cid:0)λ(XT − XT−1)(cid:1)] . . . ]] . For any 1 ≤ t ≤ T , we have that: Further, for any 1 ≤ j ≤ m, we have: Eν(t) ν(1:t−1) exp(cid:0)λ(cid:0)Xt − Xt−1(cid:1)(cid:1) =Qm j=1 E(cid:2) exp(cid:0)λq(t) j v(t)(cid:1)(cid:3) . E(cid:2) exp(cid:0)λq(t) ǫ′ −∞ j v(t)(cid:1)(cid:3) =R +∞ =R +∞ +Z +∞ ǫ′ 0 0 ǫ′ j y)dy 2 exp (−ǫ′y) exp (λq(t) 2 exp (−ǫ′y) exp(λq(t) j y)dy 2 exp (−ǫ′y) exp (−λq(t) ǫ′ j y)dy 2(ǫ′−λq(t) j ) + ǫ′ 2(ǫ′+λq(t) j ) = = 1−(λq(t) The last second inequality holds for any λ ≤ ǫ 2q(t) j ′ 1 j /ǫ′)2 < 1 + 2(λq(t) j /ǫ′)2 < exp(cid:0)2(λq(t) j /ǫ′)2(cid:1) . . Hence, we have: Eν(t) ν(1:t−1) exp(cid:0)λ(cid:0)Xt − Xt−1(cid:1)(cid:1) ≤ exp(cid:0)Pm j )2 ≤(cid:0)Pm max. We have: j (cid:1)2 j=1 q(t) = p2 j=1 2(λq(t) j /ǫ′)2(cid:1) . Eν(t) ν(1:t−1) exp(cid:0)λ(cid:0)Xt − Xt−1(cid:1)(cid:1) ≤ exp(cid:0)2(λpmax/ǫ′)2(cid:1) . Next, note that Pm j=1(q(t) and, thus, Thus, we get that: E"exp λ XT − X0 − The lemma then follows by choosing pmaxq8T ln( 6 β ) E(cid:2) exp(cid:0)λ(cid:0)XT − X0(cid:1)(cid:1)(cid:3) ≤ exp(cid:0)2T (λpmax/ǫ′)2(cid:1) . !!# ≤ exp λ2 · 2T(cid:0) pmax ǫ′ (cid:1)2 pmax ·q ln( 6 λ = ǫ′ β ) 2T ǫ′ . − λ · pmaxq8T ln( 6 β ) ǫ′ ! . A.3 Proof of Lemma 3.6 Proof. By symmetry, it suffices to show the first inequality by symmetry of the random variables v(t) j positive λ to be determined later, we have: 's. For a j j j ǫ′ j=1 q(t) j − ln(T ) Prh PT · max(cid:8)0, v(t) t=1Pm t=1Pm j=1 q(t) j=1 q(t) j=1 Eh exp(cid:16)λ(cid:16)q(t) t=1Pm = Prh exp(cid:16)λ(cid:16)PT ≤ Eh exp(cid:16)λ(cid:16)PT =QT Next, we bound Eh exp(cid:16)λ(cid:16)q(t) Eh exp(cid:16)λ(cid:16)q(t) =R +∞ln(T ) = 1 − 1 ǫ′ (cid:9) ≥ 2pmax ln( 6 · max(cid:8)0, v(t) j − ln(T ) · max(cid:8)0, v(t) j − ln(T ) · max(cid:8)0, v(t) j − ln(T ) ǫ′ (cid:9)(cid:17)(cid:17)i by: · max(cid:8)0, v(t) j − ln(T ) ǫ′ (cid:9)(cid:17)(cid:17)i · max(cid:8)0, v(t) j − ln(T ) 2 exp(cid:0) − ǫ′y(cid:1) exp(cid:0)λq(t) 2T · t=1Qm ǫ′−λq(t) where the second last inequality is due to λq(t) λq(t) ǫ′−λq(t) = 1 + 1 2T 2T + 1 j < λpmax < ǫ′ ǫ′ ǫ′ ǫ′ j j j j j j · (y − ln(T ) ǫ′ j=1 E(cid:20) exp(cid:16)λ(cid:16)q(t) Qm j So we have: · max(cid:8)0, v(t) j − ln(T ) and, thus, j t=1Qm QT Prh exp(cid:16)λ(cid:16)PT j=1 Eh exp(cid:16)λ(cid:16)q(t) t=1Pm j=1 q(t) j 3 due to our choice of λ = ǫ′ · max(cid:8)0, v(t) · max(cid:8)0, v(t) j − ln(T ) . 2pmax which equals β ǫ′ ln( 6 β ) i ǫ′ (cid:9)(cid:17)(cid:17) · exp(cid:16)− 2λpmax β )(cid:17) ≥ 1 i ǫ′ (cid:9)(cid:17)(cid:17) · exp(cid:16)− 2λpmax β )(cid:17)i ǫ′ (cid:9)(cid:17)(cid:17)q(1), . . . q(t−1)i · exp(cid:16)− 2λpmax ln( 6 ǫ′ ǫ′ ln( 6 β )(cid:17) . )(cid:1)dy + Pr(cid:2)v(t) λq(t) j ≤ ln(T ) ǫ′ (cid:3) ǫ′ ≤ exp(cid:0) 1 ǫ′ (cid:1) , λq(t) T j j j ≤ 1 + 1 T 2 . Thus, we have: λq(t) j ǫ′ (cid:1) λpmax j=1 ǫ′ (cid:9)(cid:17)(cid:17) q(1), . . . q(t−1) (cid:21) < exp(cid:0)Pm ≤ exp(cid:0) 1 ≤ exp(cid:0) 1 2T(cid:1) . ǫ′ (cid:9)(cid:17)(cid:17)q(1), . . . q(t−1)i ≤ exp(cid:0) 1 j − ln(T ) ǫ′ T 1 T (cid:1) 2(cid:1) < 2 . β )(cid:17)(cid:17) ≥ 1 i ≤ 2 · exp(cid:16)− 2λpmax ǫ′ ǫ′ ln( 6 ǫ′ (cid:9) − 2 ln( 6 β )(cid:17) , A.4 Proof of Lemma 3.7 Proof. By Lemma 3.2, we have: PT t=1(cid:0)L(x(t), p(t)) − L(x(t), p)(cid:1) =PT t=1(cid:10)p(t) − p,∇D(p(t))(cid:11) =PT t=1(cid:10)p(t) − p,∇ ¯D(p(t))(cid:11) +PT t=1(cid:10)p(t) − p,∇ D(p(t)) − ∇ ¯D(p(t))(cid:11) +PT t=1(cid:10)p(t) − p,∇D(p(t)) − ∇ D(p(t))(cid:11) . Then, applying 3.4, we further get that: T 1 ( PT t=1(cid:10)p − p(t),∇ ¯D(p(t))(cid:11) ≤ Xt=1 η(cid:0)DKL(pkp(t)) − DKL(pkp(t+1))(cid:1) + η · pmax∇2 = 1 η(cid:0)DKL(pkp(1)) − DKL(pkp(T +1))(cid:1) + η · T pmax∇2 ≤ 1 η DKL(pkp(1)) + η · T pmax∇2 max . max max) Putting together, we have: PT t=1(cid:0)L(x(t), p(t)) − L(x(t), p)(cid:1) ≤ 1 η max DKL(pkp(1)) + η · T pmax∇2 +PT +PT t=1(cid:10)p(t) − p,∇ D(p(t)) − ∇ ¯D(p(t))(cid:11) t=1(cid:10)p(t) − p,∇D(p(t)) − ∇ D(p(t))(cid:11) . (A.4) Next, we bound the last two terms separately. By the definition of ∇ D(p(t)), the last term can be rewritten as: PT t=1(cid:10)p(t) − p,∇D(p(t)) − ∇ D(p(t))(cid:11) =PT Applying Lemma 3.5 twice, we get that with probability at least 1 − β 3 , 2pmaxq8T ln( 6 β ) t=1(cid:10)p − p(t), ν(t)(cid:11) . PT t=1(cid:10)p(t) − p,∇D(p(t)) − ∇ D(p(t))(cid:11) ≤ 16pmaxTqm ln( 6 β ) ln( 2 δ ) ǫ . (A.5) = ǫ′ As for the second last term, we can upper bound it as: PT t=1(cid:10)p(t) − p,∇ D(p(t)) − ∇ ¯D(p(t))(cid:11) ≤PT t=1Pm j=1(cid:12)(cid:12)p(t) j − pj(cid:12)(cid:12) ·(cid:12)(cid:12)∇j D(p(t)) − ∇j ¯D(p(t))(cid:12)(cid:12) . Note that by the definition of ∇j ¯D(p(t)), (cid:12)(cid:12)∇j D(p(t)) − ∇j ¯D(p(t))(cid:12)(cid:12) can be rewritten as: Further, ∇jD(p(t)) = b − Pi∈[n]Pk∈[ℓi] aijx(t) ∇max = n + ln(T ) j − ∇max(cid:9) + max(cid:8)0,−∇jD(p(t)) − ν(t) max(cid:8)0,∇jD(p(t)) + ν(t) ): ǫ′ j − ∇max(cid:9) . ik ∈ [−n, b] ⊆ [−n, n]. So the above is at most (recall that j − ∇max(cid:9) + max(cid:8)0, n − ν(t) j − ∇max(cid:9) ǫ′ (cid:9) + max(cid:8)0,−ν(t) j − ln(T ) j − ln(T ) ǫ′ (cid:9) . Applying Lemma 3.6 twice, we get that with probability at least 1 − 2β 3 , max(cid:8)0, n + ν(t) = max(cid:8)0, ν(t) PT t=1(cid:10)p(t) − p,∇ D(p(t)) − ∇ ¯D(p(t))(cid:11) ≤PT ≤ 4pmax t=1Pm β ) ≤ j=1(cid:12)(cid:12)p(t) j − pj(cid:12)(cid:12) · (max(cid:8)0, ν(t) 4pmaxTqm ln( 6 j − ln(T ) . β ) ln( 2 δ ) ln( 6 ǫ′ ǫ ǫ′ (cid:9) + max(cid:8)0,−ν(t) j − ln(T ) ǫ′ (cid:9)) (A.6) Putting together (A.4), (A.5), and (A.6) proves the lemma.
1112.3925
2
1112
2012-10-23T14:56:21
Root finding with threshold circuits
[ "cs.DS", "cs.LO" ]
We show that for any constant d, complex roots of degree d univariate rational (or Gaussian rational) polynomials---given by a list of coefficients in binary---can be computed to a given accuracy by a uniform TC^0 algorithm (a uniform family of constant-depth polynomial-size threshold circuits). The basic idea is to compute the inverse function of the polynomial by a power series. We also discuss an application to the theory VTC^0 of bounded arithmetic.
cs.DS
cs
Root finding with threshold circuits Emil Jer´abek∗ Institute of Mathematics of the Academy of Sciences Zitn´a 25, 115 67 Praha 1, Czech Republic, email: [email protected] November 10, 2018 Abstract We show that for any constant d, complex roots of degree d univariate rational (or Gaussian rational) polynomials -- given by a list of coefficients in binary -- can be computed to a given accuracy by a uniform TC0 algorithm (a uniform family of constant-depth polynomial-size threshold circuits). The basic idea is to compute the inverse function of the polynomial by a power series. We also discuss an application to the theory VTC 0 of bounded arithmetic. 1 Introduction The complexity class TC0 was originally defined by Hajnal et al. [15] in the nonuniform setting, as the class of problems recognizable by a family of polynomial-size constant-depth circuits with majority gates. It was implicitly studied before by Parberry and Schnitger [27], who consider various models of computation using thresholds (threshold circuits, Boltzmann machines, threshold RAM, threshold Turing machines). The importance of the class follows already from the work of Chandra, Stockmayer, and Vishkin [7], who show (in today's ter- minology) the TC0-completeness of several basic problems (integer multiplication, iterated addition, sorting) under AC0 reductions. Barrington, Immerman, and Straubing [4] establish that there is a robust notion of fully uniform TC0. (We will use TC0 to denote this uniform TC0, unless stated otherwise.) We can regard TC0 as the natural complexity class of elementary arithmetical opera- integer multiplication is TC0-complete, whereas addition, subtraction, and ordering tions: are in AC0 ⊆ TC0. The exact complexity of division took some time to settle. Wallace [33] constructed division circuits of depth O((log n)2) and bounded fan-in (i.e., NC2). Reif [29] improved this bound to O(log n log log n). Beame, Cook, and Hoover [5] proved that division, iterated multiplication, and exponentiation (with exponent given in unary) are TC0-reducible to each other, and constructed P-uniform TC0 circuits for these problems. Chiu, Davida, and ∗Supported by grant IAA100190902 of GA AV CR, project 1M0545 of MSMT CR, and RVO: 67985840. 1 Litow [8] exhibited logspace-uniform TC0 circuits for division, showing in particular that di- vision is computable in L. Finally, Hesse, Allender, and Barrington [16] proved that division (and iterated multiplication) is in uniform TC0. Using these results, other related problems can be shown to be computable in TC0, for example polynomial division, iterated multiplication, and interpolation. In particular, using iterated addition and multiplication of rationals, it is possible to approximate in TC0 functions presented by sufficiently nice power series, such as log, exp, x1/k, and trigonometric functions, see e.g. Reif [29], Reif and Tate [30], Maciel and Th´erien [20], and Hesse et al. [16]. Numerical computation of roots of polynomials is one of the oldest problems in mathemat- ics, and countless algorithms have been devised to solve it, both sequential and parallel. The most popular methods are based on iterative techniques that successively derive closer and closer approximations to a root (or, sometimes, to all the roots simultaneously) starting from a suitable initial approximation. Apart from the prototypical Newton -- Raphson iteration, there are for instance Laguerre's method [28, §9.5], Brent's method [28, §10.3], the Durand -- Kerner method [13, 19], the Jenkins -- Traub algorithm [17], and many others. One can also reduce root finding to matrix eigenvalue computation, for which there are iterative methods such as the QR algorithm [14]. Another class of root-finding algorithms are divide-and-conquer approaches: the basic idea is to recursively factorize the polynomial by identifying a suitable contour (typically, a circle) splitting the set of roots roughly in half, and recovering coeffi- cients of the factor whose roots fall inside the contour from the residue theorem by numerical integration. Algorithms of this kind include Pan [24], Ben-Or et al. [6], Neff [22], Neff and Reif [23], and Pan [25], see Pan [26] for an overview. These algorithms place root finding in NC: for example, the algorithm of [25] can find n-bit approximations to all roots of a poly- nomial of degree d ≤ n in time O((log n)2(log d)3) using O(nd2(log log n)/(log d)2) processors on an EREW PRAM. (More specifically, Allender [3] mentions that root finding is known to be in the #L hierarchy, but not known to be in GapL.) The purpose of this paper is to demonstrate that in the case of constant-degree polynomi- als, we can push the complexity of root finding down to uniform TC0 (i.e., constant time on polynomially many processors on a TRAM, in terms of parallel complexity), as in the case of elementary arithmetical operations. (This is clearly optimal: already locating the unique root of a linear polynomial amounts to division, which is TC0-hard.) As a corollary, the binary expansion of any algebraic constant can be computed in uniform TC0 when given the bit position in unary. Our primary interest is theoretical, we seek to investigate the power of the complexity class TC0; we do not expect our algorithm to be competitive with established methods in practice, and we did not make any effort to optimize parameters of the algorithm. The basic idea of the algorithm is to express the inverse function of the polynomial by a power series, whose partial sums can be computed in TC0 using the results of Hesse et al. [16]. We need to ensure that coefficients of the series are TC0-computable, we need bounds on the radius of convergence and convergence rate of the series, and we need to find a point in whose image to put the centre of the series so that the disk of convergence includes the origin. Doing the latter directly is in fact not much easier than approximating the root in the first place, so we instead construct a suitable polynomial-size set of sample points, and we invert the 2 polynomial at each one of them in parallel. We formulated our main result in terms of computational complexity, but our original motivation comes from logic (proof complexity). The bounded arithmetical theory VTC 0 (see Cook and Nguyen [12]), whose provably total computable functions are the TC0 functions, can define addition, multiplication, and ordering on binary integers, and it proves that these operations obey the basic identities making it a discretely ordered ring. The question is which other properties of the basic arithmetical operations are provable in the theory, and in particular, whether it can prove induction (on binary integers) for some class of formulas. Now, it follows easily from known algebraic characterizations of induction for open formulas in the language of ordered rings (IOpen, see Shepherdson [32]) and from the witnessing theorem for VTC 0 that VTC 0 proves IOpen if and only if for each d there is a TC0 root-finding algorithm for degree d polynomials whose soundness is provable in VTC 0. Our result thus establishes the computational prerequisites for proving open induction in VTC 0, leaving aside the problem of formalizing the algorithm in the theory. Since the soundness of the algorithm can be expressed as a universal sentence, we can also reformulate this result as follows: the theory VTC 0 + Th∀ΣB (N) proves IOpen. 0 The paper is organized as follows. In Section 2 we provide some background in the relevant parts of complexity theory and complex analysis. Section 3 contains material on inverting polynomials with power series. Section 4 presents our main result, a TC0 root- finding algorithm. Finally, in Section 5 we discuss the connection to bounded arithmetic. 2 Preliminaries A language L is in nonuniform TC0 if there is a sequence of circuits Cn : {0, 1}n → {0, 1} consisting of unbounded fan-in majority and negation gates such that Cn computes the char- acteristic function of L on strings of length n, and Cn has size at most nc and depth c for some constant c. L is in (uniform) TC0, if the sequence {Cn : n ∈ ω} is additionally DLOGTIME-uniform (UD-uniform in the terminology of Ruzzo [31]): i.e., we can enumerate the gates in the circuit by numbers i < nO(1) in such a way that one can check the type of gate i and whether gate i is an input of gate j by a deterministic Turing machine in time O(log n), given n, i, j in binary. There are other equivalent characterizations of TC0. For one, it coincides with languages recognizable by a threshold Turing machine [27] in time O(log n) with O(1) thresholds [2]. Another important characterization is in terms of descriptive complexity. We can represent a string x ∈ {0, 1}n by the first-order structure h{0, . . . , n − 1}, <, bit, Xi, where X is a unary predicate encoding the bits of x. Then a language is in TC0 iff its corresponding class of structures is definable by a sentence of FOM (first-order logic with majority quantifiers). We refer the reader to [4] for more background on uniformity of TC0. In some cases it may be more convenient to consider languages in a non-binary alphabet Σ. The definition of TC0 can be adapted by adjusting the input alphabet of a threshold Turing machine, or by considering more predicates in the descriptive complexity setting. In the original definition using threshold circuits, the same can be accomplished by encoding 3 each symbol of Σ with a binary substring of fixed length. We can also define TC0 predicates with more than one input in the obvious way. A function f : {0, 1}∗ → {0, 1}∗ is computable in TC0 if the length of its output is polyno- mially bounded in the length of its input, and its bitgraph is a TC0 predicate. (The bitgraph of f is a binary predicate b(x, i) which holds iff the ith bit of f (x) is 1.) In terms of the original definition, this amounts to allowing circuits Cn : {0, 1}n → {0, 1}m(n), where m(n) = nO(1). if f is a TC0 TC0 functions are closed under composition, and under "parallel execution": function, its aggregate function g(hx0, . . . , xm−1i) = hf (x0), . . . , f (xm−1)i is also in TC0. We note in this regard that TC0 functions can do basic processing of lists x0, x1, . . . , xm−1 where "," is a separator character. Using the fact that TC0 can count commas (and other symbols), we can for instance extract the ith element from the list, convert the list to and from a representation where each element is padded to some fixed length with blanks, or sort the list according to a given TC0 comparison predicate. We will refrain from presenting TC0 functions in one of the formalisms suggested by the definitions above: we will give informal algorithms, generally consisting of a constant number of simple steps or TC0 building blocks, sometimes forking into polynomially many parallel threads. The reader should have no difficulty convincing herself that our algorithms are indeed in TC0. We will work with numbers of various kinds. Integers will be represented in binary as usual, unless stated otherwise. As we already mentioned in the introduction, elementary arithmetical operations on integers are TC0 functions: this includes addition, subtraction, ordering, multiplication, division with remainder, exponentiation (with unary exponents), iterated addition, iterated multiplication, and square root approximation. Here, iterated addition is the function hx0, . . . , xm−1i 7→ Pi<m xi, and similarly for multiplication. Notice that using iterated multiplication, we can also compute factorials and binomial or multinomial coefficients of unary arguments. Base conversion is also in TC0. Rational numbers will be represented as pairs of integers, indicating fractions. We cannot assume fractions to be reduced, since integer gcd is not known to be TC0-computable. Using integer division, we can convert a fraction to its binary expansion with a given accuracy (the opposite conversion is trivial). Rational arithmetic is reducible to integer arithmetic in the obvious way, hence rational addition, subtraction, ordering, multiplication, division, exponentiation (with unary integer exponents), iterated addition, iterated multiplication, and square root approximation are in TC0. In lieu of complex numbers, we will compute with Gaussian rationals (elements of the field Q(i)), represented as pairs of rationals a + ib. By reduction to rational arithmetic, we can see that addition, subtraction, complex conjugation, norm square, norm approximation, multiplication, division, and iterated addition of Gaussian rationals are in TC0. Using the binomial theorem, exponentiation with unary integer exponents is also in TC0. (In fact, iterated multiplication of Gaussian rationals is in TC0 using conversion to polar coordinates, but we will not need this.) 4 We will need some tools from complex analysis. We refer the reader to Ahlfors [1] or Conway [10] for background, however, we review here some basic facts to fix the notation. A function f : U → C, where U ⊆ C is open, is holomorphic (or analytic) in U if f ′(a) = limz→a(f (z) − f (a))/(z − a) exists for every a ∈ U . The set of all functions holomorphic in U is denoted H(U ). Let B(a, r) := {z : z − a < r} and B(a, r) := {z : z − a ≤ r}. If f is holomorphic in the open disk B(a, R), it can be expressed by a power series f (z) = ∞ Xn=0 cn(z − a)n on B(a, R). More generally, 0 ≤ r < R ≤ ∞, it can be written in A as a Laurent series if f is holomorphic in the annulus A = B(a, R) r B(a, r), f (z) = +∞ Xn=−∞ cn(z − a)n. We denote the coefficients of the series by [(z − a)n]f := cn. (Other variables may be used instead of z when convenient.) The residue of f at a is Res(f, a) := [(z− a)−1]f . When a = 0, we write just [zn]f and Res(f ), respectively. The coefficients of a Laurent series are given by Cauchy's integral formula: [(z − a)n]f = 1 2πi Zγ f (z) (z − a)n+1 dz, where γ is any closed curve in A whose index with respect to a is 1 (such as the circle γ(t) = a + e2πit, r < < R). The identity theorem states that if f, g are holomorphic in a region (i.e., connected open set) U and coincide on a set X ⊆ U which has a limit point in U , then f = g. The open mapping theorem states that a nonconstant function f holomorphic in a region is an open mapping (i.e., maps open sets to open sets). If X ⊆ C and a ∈ C, we put dist(a, X) = inf{z − a : z ∈ X}. We will also need some easy facts on zeros of polynomials. Let f ∈ C[x] be a degree d j=0 ajxj. Cauchy's bound [34, L. 6.2.7] states that every zero polynomial, and write f (x) = Pd α of f satisfies a0 0<j≤daj ≤ α ≤ 1 + max a0 + max j<d . aj ad Let f, g ∈ (Q(i))[x] be two polynomials of degrees d, e (resp.), and assume f (α) = g(β) = 0, α 6= β. If f, g ∈ (Z[i])[x], we have (∗) α − β ≥ 1 , (2d+1kfk∞)ekgkd 2 where kfkp denotes the Lp-norm of the vector of coefficients of f [34, §6.8]. In general, we can apply (∗) to the polynomials rf and sg, where r is the product of all denominators appearing among the coefficients of f , and similarly for s. If we represent f and g by the lists of their coefficients, which are in turn represented by quadruples of binary integers as detailed above, we obtain easily the following root separation bound: 5 Lemma 2.1 For each j = 0, 1, let fj ∈ (Q(i))[x] have degree dj and total bit size nj, and assume fj(αj) = 0. If α0 6= α1, then α0 − α1 ≥ 2−(d1n0+d0n1) ≥ 2−n0n1. 3 Inverting polynomials As already mentioned in the introduction, the main strategy of our algorithm will be to approximate a power series computing the inverse function of the given polynomial f . In this section, we establish the properties of such series needed to make the algorithm work. The basic fact we rely on is that holomorphic functions with nonvanishing derivative are i.e., if f ∈ H(U ) and a ∈ U is such that f ′(a) 6= 0, there exist open locally invertible: neighbourhoods a ∈ U0 ⊆ U and f (a) ∈ V0 such that f is a homeomorphism of U0 onto V0, and the inverse function g = (f ↾ U0)−1 is holomorphic in V0. In particular, g is computable by a power series in a neighbourhood of f (a). Notice that local inverses of holomorphic functions are automatically two-sided: if f ∈ H(U ), g ∈ H(V ), a ∈ U , b ∈ V , g(b) = a, and f (g(z)) = z in a neighbourhood of b, then g(f (z)) = z in a neighbourhood of a. The coefficients of the power series of an inverse of a holomorphic function are given by the Lagrange inversion formula [9, §3.8, Thm. A]: Fact 3.1 Let f ∈ H(U ), g ∈ H(V ), f ◦ g = idV , a = g(b) ∈ U , b = f (a) ∈ V , n > 0. Then [(w − b)n]g(w) = 1 n Res(cid:18) 1 (f (z) − b)n , a(cid:19) . We can make the formula even more explicit as follows. First, the composition of two power series is given by Fa`a di Bruno's formula [9, §3.4, Thm. A], which we formulate only for a = b = 0 for simplicity: Fact 3.2 Let f ∈ H(U ), g ∈ H(V ), g(0) = 0 ∈ U , f (0) = 0 ∈ V , n ≥ 0. Then Yj=1(cid:0)[zj]f(cid:1)mj . (cid:18) Pj mj m1, m2, . . .(cid:19)[wPj mj ]g ∞ [zn](g ◦ f ) = XP∞ j=1 jmj=n Note that here and below, the outer sum is finite, and the product has only finitely many terms different from 1, hence the right-hand side is well-defined without extra assumptions on convergence. We can now expand the residue in Fact 3.1 to obtain the following version of Lagrange inversion formula, which only refers to the coefficients of f [9, §3.8, Thm. E]: Proposition 3.3 Let f ∈ H(U ), g ∈ H(V ), f ◦ g = idV , a = g(b) ∈ U , b = f (a) ∈ V . Then [(w − b)0]g = a, and for n > 0, [(w − b)n]g = 1 n! [z − a]f j=2(j−1)mj =n−1(cid:16)Pj jmj(cid:17)! XP∞ ∞ Yj=2 1 mj! (cid:18)− ([z − a]f )j(cid:19)mj [(z − a)j]f . 6 Proof: Note that f ′(a) 6= 0. Put f1(z) = f (a + z/f ′(a)) − b and g1(w) = f ′(a)(g(b + w) − a), so that f1(0) = 0 = g1(0), f1 ◦ g1 = id on a neighbourhood of 0, and f ′ 1(0) = 1. Write f1(z) = z(1 − h(z)), where h is holomorphic in a neighbourhood of 0, and h(0) = 0. Then 1 n [zn−1] 1 (1 − h)n [wn]g1 = 1 n [z−1] 1 f n 1 = = = 1 n XP∞ j=1 jmj=n−1 1 n! XP∞ j=1 jmj=n−1 (Pj mj)! m1! m2! ··· (Pj(j + 1)mj)! m1! m2! ··· (Pj mj + n − 1)! (Pj mj)! (n − 1)! ∞ ∞ Yj=1(cid:0)[zj]h(cid:1)mj = 1 n! XP∞ k=2(k−1)mk=n−1 (Pk kmk)! Yj=1(cid:0)−[zj+1]f1(cid:1)mj (cid:0)−[zk]f1(cid:1)mk Yk=2 mk! ∞ using Facts 3.1 and 3.2, and the expansion [wr](1 − w)−n = (cid:0)r+n−1 n−1 (cid:1). The result follows by noting that for any k, n > 0, [zk]f1 = ([(z − a)k]f )/(f ′(a))k, [wn]g1 = f ′(a)[(w − b)n]g, and f ′(a) = [z − a]f . (cid:3) Let d be a constant. If f in Proposition 3.3 is a polynomial of degree d, then the product is nonzero only when mj = 0 for every j > d, hence it suffices to enumerate m2, . . . , md. It follows easily that the outer sum has polynomially many (namely, O(nd)) terms, and we can compute [(w − b)n]g in uniform TC0 given a, b, and the coefficients of f in binary, and n in unary. Apart from a description of the coefficients, we also need bounds on the radius of conver- gence of the inverse series, and on its rate of convergence (i.e., on the norm of its coefficients). Generally speaking, the radius of convergence of a power series is the distance to the nearest singularity. Since a polynomial f is an entire proper map, its inverse cannot escape to infinity or hit a point where f is undefined, thus the only singularities that can happen are branch points. These occur at zeros of f ′. This suggests that the main parameter governing the radius of convergence and other properties of the inverse should be the distance of a to the set Cf = {z ∈ C : f ′(z) = 0} of critical points of f . Lemma 3.4 Let f ∈ C[x] be a degree d polynomial with no roots in B(a, R), R > 0, and let µ > 0. Then f (z) − f (a) < (cid:0)(1 + µ)d − 1(cid:1)f (a) for all z ∈ B(a, µR). Proof: Write f (z) = cQd j=1(z − αj). We have f (z) f (a) d = Yj=1 (z − a) + (a − αj) a − αj = XI⊆{1,...,d}Yj∈I z − a a − αj , hence (cid:12)(cid:12)(cid:12)(cid:12) f (z) f (a) − 1(cid:12)(cid:12)(cid:12)(cid:12) = (cid:12)(cid:12)(cid:12)XI6=∅Yj∈I z − a a − αj(cid:12)(cid:12)(cid:12) ≤ XI6=∅Yj∈I z − a R < (1 + µ)d − 1. (cid:3) 7 Proposition 3.5 Let f ∈ C[x] have degree d > 1, f (a) = b, and 0 < R ≤ dist(a, Cf ). Let ∞ g(w) = a + Xn=1 cn(w − b)n satisfy f ◦ g = idB(b,), where > 0 is the radius of convergence of g. Put ≥ 2(d − 1)µ − 1 ν = , ln 4 − 1 d , µ = d−1√2 − 1 ≥ ln 2 d − 1 λδ = d√1 + δdν − 1 ≥ δ ln ln 4 , d d 0 = νRf ′(a) for 0 < δ ≤ 1 (the inequalities are established below ). Then: (i ) f is injective on B(a, µR). (ii ) ≥ 0. (iii ) g[B(b, )] ⊇ B(a, λ1R), and more generally, g[B(b, δ0)] ⊇ B(a, λδR) for each δ ∈ (0, 1]. (iv ) cn ≤ µR/nn 0 . Proof: Notice that ex − 1 ≥ x for every x ∈ R, hence d−1√2 − 1 = exp((ln 2)/(d − 1)) − 1 ≥ (ln 2)/(d − 1); ν ≥ (ln 4 − 1)/d immediately follows. Similarly, λδ ≥ ln(1 + δ(ln 4 − 1))/d. We have ln(1 + δ(ln 4 − 1)) ≥ δ ln ln 4 for δ ∈ [0, 1] as ln is concave. (i): Let u, v ∈ B(a, µR), u 6= v. We have u f (v) − f (u) = Z v f ′(z) dz = (v − u)(cid:18)f ′(a) +Z 1 f ′(cid:0)(1 − t)u + tv(cid:1) − f ′(a) dt(cid:19) . Since f ′((1 − t)u + tv) − f ′(a) < f ′(a) for all t ∈ (0, 1) by Lemma 3.4, we obtain 0 (cid:12)(cid:12)f ′(cid:0)(1 − t)u + tv(cid:1) − f ′(a)(cid:12)(cid:12) dt < f ′(a), f ′(cid:0)(1 − t)u + tv(cid:1) − f ′(a) dt(cid:12)(cid:12)(cid:12)(cid:12) ≤ Z 1 Z 1 (cid:12)(cid:12)(cid:12)(cid:12) 0 0 thus f (u) 6= f (v). (ii): Let U = B(a, µR). Since f is a biholomorphism of U and f [U ], ≥ dist(b, C r f [U ]). Since f [U ] is open, there exists w /∈ f [U ] such that w − b = dist(b, C r f [U ]). Let zn ∈ U be such that limn f (zn) = w. By compactness, {zn} has a convergent subsequence; without loss of generality, there exists z = limn zn. Then f (z) = w by continuity, hence z /∈ U . However, z ∈ U , hence z is in the topological boundary ∂U = U r int U = U r U . We have thus verified that ≥ dist(b, f [∂U ]). f (u) = b +Z u f ′(z) dz = b + Reiθ(cid:18)µf ′(a) +Z µ Let u = a + µReiθ ∈ ∂U . We have f ′(a + teiθR) − f ′(a) dt(cid:19) . a 0 By Lemma 3.4, f ′(a + teiθR) − f ′(a) ≤ (cid:0)(1 + t)d−1 − 1(cid:1)f ′(a), hence Z µ (cid:12)(cid:12)(cid:12)(cid:12) f ′(a + teiθR) − f ′(a) dt(cid:12)(cid:12)(cid:12)(cid:12) ≤ f ′(a)Z µ (1 + t)d−1 − 1 dt = f ′(a)(cid:18) (1 + µ)d − 1 2(1 + µ) − 1 − dµ − µ(cid:19) d 1 − (d − 2)µ 0 0 . = f ′(a) d = f ′(a) d 8 Thus, f (u) − b ≥ R f ′(a)(cid:18)µ − 1 − (d − 2)µ d (cid:19) = νR f ′(a). (iii): The proof above shows that g[B(b, 0)] ⊆ U . As f is injective on U ⊇ B(a, λδR), it suffices to show that f [B(a, λδR)] ⊆ B(b, δ0). Let thus u = a + λReiθ, λ < λδ. As above, and hence f (u) = b + Reiθ(cid:18)λf ′(a) +Z λ f ′(a + teiθR) − f ′(a) dt(cid:12)(cid:12)(cid:12)(cid:12) Z λ (cid:12)(cid:12)(cid:12)(cid:12) 0 0 f (u) − b ≤ R f ′(a) f ′(a + teiθR) − f ′(a) dt(cid:19) ≤ f ′(a)(cid:18) (1 + λ)d − 1 d − λ(cid:19) , (1 + λ)d − 1 d < R f ′(a) (1 + λδ)d − 1 d = δ0. (iv): Let γ(t) = a + µRe2πit. By Fact 3.1 and Cauchy's integral formula, cn = (f (z) − b)n = The proof of (ii) shows f (γ(t)) − b ≥ 0, hence 1 2πin Zγ dz µR n Z 1 0 e2πit dt (f (γ(t)) − b)n . cn ≤ µR n Z 1 0 dt f (γ(t)) − bn ≤ µR nn 0 . (cid:3) Example 3.6 Let f (z) = zd, a = b = 1. Then f ′ = dzd−1, Cf = {0}, R = 1, f ′(a) = d. It is not hard to see that f is injective on B(1, r) iff no two points of B(1, r) have arguments differing by 2π/d iff r ≤ sin(π/d) = π/d + O(d−3). Since g must hit a root of f ′ at the circle of convergence, we must have = 1 = (1/d)Rf ′(a). Finally, (1 + z)d − 1 is maximized on {z : z = r} for z positive real, thus B(1, λR) ⊆ g[B(1, δ)] iff (1 + λ)d − 1 ≤ δ iff λ ≤ (1 + δ)1/d − 1 = ln(1 + δ)/d + O(d−2). Thus, in Proposition 3.5, µ, ν, and λδ are optimal up to a linear factor. Remark 3.7 We prefer to give a simple direct proof of Proposition 3.5 for the benefit of the reader. Nevertheless, we could have assembled the bounds (with somewhat different constants) from several more sophisticated results in the literature. The Grace -- Heawood theorem (or rather its corollary, originally due to Alexander, Kakeya, and Szego; see [21, Thm. 23,2]) states that (i) holds with µ = sin(π/d) (which is tight in view of the zd example). Then the Koebe 1/4-theorem [11, Thm. 14.7.8] implies (ii) with ν = µ/4, and one more application of the theorem yields (iii) with λδ = νδ/4. 9 4 Root finding in TC0 We start with the core part of our root-finding algorithm. While it is conceptually simple, its output is rather crude, so we will have to combine it with some pre- and postprocessing to obtain the desired result (Theorem 4.5). Theorem 4.1 Let d be a constant. There exists a uniform TC0 function which, given the coefficients of a degree d polynomial f ∈ (Q(i))[x] in binary and t in unary, computes a list {zj : j < s} ⊆ Q(i) such that every complex root of f is within distance 2−t of some zj. If d = 1, it suffices to divide the coefficients of f . Assume d ≥ 2. Let µ, ν, λ = λ1/2 be Proof: as in Proposition 3.5 (more precisely, we should use their fixed rational approximations; we will ignore this for simplicity). Let A = 1 + λ/5, p = ⌈5π/λ⌉, and ξ = e2πi/p (approximately, again). Consider the TC0 algorithm given by the following description: (i) Input: f = Pj≤d fjzj with fj ∈ Q(i), fd 6= 0, and t > 0 in unary. (ii) Put ε = 2−t. Compute recursively a list C = {αj : j < s} including ε/4-approximations of all roots of f ′. (iii) Output (in parallel) each αj. (iv) Put c = 2 + maxj<dfj/fd and kmax = ⌈log(2cε−1)/ log A⌉. (v) For every j < s, k < kmax, and q < p, do the following in parallel. 2a − αj, N = ⌈log2(µRε−1)⌉. (vi) Let a = αj + εAkξq, b = f (a), R = 1 (vii) For each h ≤ d, let fh = Pd u=h(cid:0)u (viii) Compute and output h(cid:1)fuau−h. zj,k,q = a + Xm2,...,md Ph(h−1)mh<N (2m2 + ··· + dmd)! (− f2)m2 ··· (− fd)md(−b)1+m2+···+(d−1)md m2!··· md! (1 + m2 + ··· + (d − 1)md)! f 1+2m2+···+dmd 1 . Let f (α) = 0, we have to show that one of the numbers output by the algorithm is ε-close to α. If α− αj < ε for some j, we are done by step (iii). We can thus assume dist(α, C) ≥ ε, which implies dist(α, Cf ) ≥ 3ε/4. Assume that αj is an ε/4-approximation of the root αj of f ′ nearest to α. Since all roots of f or f ′ have modulus bounded by c− 1 by Cauchy's bound, we have ε ≤ α − αj < 2c, thus there exists k < kmax such that εAk ≤ α − αj < εAk+1. Let q < p be such that the argument of α − αj differs from 2πq/p by at most π/p, and consider steps (v) -- (viii) for this particular choice of j, k, q (cf. Fig. 1). We have α − a ≤ (cid:18) π p + 1 − 1 A(cid:19)α − αj ≤ 2λ 5 α − αj < 1 5 α − αj. Notice that dist(α, Cf ) = α − αj ≥ α − αj − ε 4 10 α a λ R α j ε α∼ j −1 ε k A ε k A +1 ε k A Figure 1: The spiderweb. by the choice of αj and αj, hence dist(a, Cf ) ≥ dist(α, Cf ) − a − α ≥ α − αj − ε 4 − 1 5 α − αj ≥ 1 2 α − αj ≥ R. Since we also have Let a − αj ≥ α − αj − a − α > 4 5 α − αj, a − α < 5 4 2λ 5 a − αj = λR. g(w) = a + ∞ Xn=1 cn(w − b)n be an inverse of f in a neighbourhood of b, and let be its radius of convergence. By Proposition 3.5, −b = f (α)− b < 0/2, where 0 = νR f ′(a) ≤ . Thus, g(f (α)) = g(0) = fhzh = f (z + a) by the binomial formula, fh = [(z − a)h]f . Then it follows from α. Since Ph Proposition 3.3 that zj,k,q = a + N Xn=1 cn(−b)n. cn(−b)n ≤ µR nn 0 bn < µR 2n Since by Proposition 3.5, we have α − zj,k,q = (cid:12)(cid:12)(cid:12)(cid:12) ∞ Xn=N +1 < µR 2N ≤ ε. cn(−b)n(cid:12)(cid:12)(cid:12)(cid:12) (cid:3) 11 Most of the algorithm described in Theorem 4.1 is independent of the assumption of d being constant (or it can be worked around). There are two principal exceptions. First, the recursion in step (ii) amounts to d sequential invocations of the algorithm. Second, while N is still linear in the size of the input, the main sum in step (viii) has roughly N d terms. Thus, approximation of roots of arbitrary univariate polynomials can be done by (uniform) threshold circuits of depth O(d) and size nO(d), where n is the total length of the input. (The known NC algorithms for root finding can do much better for large d.) The algorithm from Theorem 4.1 does the hard work in locating the roots of f , but it suffers from several drawbacks: • Its output includes a lot of bogus results that are not actually close to any root of f . • There may be many elements on the list close to the same root, and we do not get any information on the multiplicity of the roots. • The roots have no "identity": if we run the algorithm for two different ts, we do not know which approximate roots on the output lists correspond to each other. • It may be desirable to output the binary expansions of the roots rather than just ap- proximations. We are going to polish the output of the algorithm to fix these problems. Let us first formulate precisely the goal. Definition 4.2 The t-digit binary expansion of a ∈ C is the pair h⌊Re(a2t)⌋,⌊Im(a2t)⌋i, where both integers are written in binary. A root-finding algorithm for a set of polynomials P ⊆ (Q(i))[x] is an algorithm with the following properties: (i) The input consists of a polynomial f ∈ P given by a list of its coefficients in binary, and a positive integer t in unary. (ii) The output is a list of pairs {hzj(f, t), ej (f, t)i : j < s(f, t)}. (iii) For every f ∈ P , there exists a factorization f (z) = cYj<s (z − aj)ej , where c ∈ Q(i), aj ∈ C, aj 6= ak for j 6= k, and ej > 0, such that for every t: s(f, t) = s, ej(f, t) = ej, and zj(f, t) is the t-digit binary expansion of aj. We note that the choice of base 2 in the output is arbitrary, the algorithm can output expan- sions in any other base if needed. Lemma 4.3 Let d be a constant. Given a degree d polynomial f ∈ (Q(i))[x], we can compute in uniform TC0 a list of pairwise coprime square-free nonconstant polynomials fj, c ∈ Q(i), and integers ej > 0 such that f = cQj<k f ej j , where k, ej ≤ d. 12 Proof: Since d is constant, division of degree d polynomials takes O(1) arithmetical oper- ations, hence it can be implemented in uniform TC0. The same holds for gcd, using the Euclidean algorithm. We compute a list L = hfj : j < ki, k ≤ d, of nonconstant polynomials such that f = Qj fj as follows: (i) Start with L = hfi. Repeat the following steps until none of them is applicable. (ii) If fj is not square-free, replace it with gcd(fj, f ′ j) and fj/ gcd(fj, f ′ j). (iii) If fh fj, fj ∤ fh for some h, j, replace fj in L with fh, fj/fh. (iv) If g := gcd(fh, fj) 6= 1 for some h, j such that fh ∤ fj, fj ∤ fh, replace fh, fj in L with g, g, fh/g, fj/g. The algorithm terminates after at most d steps, hence it is in TC0. Clearly, it computes a list of square-free polynomials such that for every h, j, fh is coprime to fj or fh is a scalar multiple of fj. It remains to collect scalar multiples of the same polynomial together. (cid:3) Lemma 4.4 Let d be a constant. Given a degree d square-free polynomial f ∈ (Q(i))[x] and t in unary, we can compute in uniform TC0 a list {zj : j < s} such that every root of f is within distance 2−t of some zj , and every zj is within distance 2−t of some root. Proof: We use the notation from the proof of Theorem 4.1. We modify the algorithm from that proof as follows: • We compute an ε0 > 0 such that the distance of any root of f to any root of f ′ is at least ε0 using Lemma 2.1. In step (ii), we put ε = min(2−t, ε0/3). • We skip step (iii). • In step (vi), we check that b < 1 2 νf ′(a)R and a − αj ′ ≥ R + ε/4 for every j′ < s. If either condition is violated, we output a symbol "∗" instead of a number, and skip the remaining two steps. The result is a list of numbers and ∗'s; it is easy to construct the sublist consisting of only numbers by a TC0 function. Let zj,k,q be one of the numbers output by the algorithm. In step (vi) we ensured dist(a, C) ≥ R + ε/4, hence dist(a, Cf ) ≥ R. Moreover, 0 − b < 0/2, hence 0 is within the radius of convergence of g, and α = g(0) is a root of f whose distance from zj,k,q is α − zj,k,q = (cid:12)(cid:12)(cid:12)(cid:12) ∞ Xn=N +1 cn(−b)n(cid:12)(cid:12)(cid:12)(cid:12) < µR 2N ≤ ε. On the other hand, let α be a root of f . Since dist(α, Cf ) ≥ ε0, we have dist(α, C) ≥ ε, hence we can choose j, k, q such that α − zj,k,q < ε as in the proof of Theorem 4.1. We have 2 νRf ′(a) was verified in to show that the extra conditions in step (vi) are satisfied. the proof of Theorem 4.1. Moreover, ε 4 ≥ a − αj − a − α − a − αj ′ ≥ α − αj ′ − a − α − 4 5α − αj − b < 1 ε 2 ≥ R + ε 4 ε 4 ≥ as α − αj ≥ ε0 − ε/4 > 5 2 ε. (cid:3) 13 We can now finish the proof of the main result of this paper: Theorem 4.5 For every constant d, there exists a uniform TC0 root-finding algorithm for degree d polynomials in the sense of Definition 4.2. Proof: We employ the notation of Definition 4.2. By Lemma 4.3, we can assume f to be square-free (in which case we will have ej(f, t) = 1 for all j, so we only need to compute the roots). Consider the following TC0 algorithm: (i) Using Lemma 2.1, compute an η > 0 such that all roots of f are at distance at least η from each other. j : j < u} such that every root of f is within distance η/5 of some r′ (ii) Using Lemma 4.4, compute a list {r′ j, and vice versa. j correspond to the same root, then r′ (iii) Note that if r′ j > 3 5 η, otherwise h − r′ r′ 5 η. Use this criterion to omit duplicate roots from the list, creating a list {rj : j < d} which contains η/5-approximations of all roots of f , each of them exactly once. h and r′ h − r′ j < 2 (iv) If ε := 2−t ≥ η/5, output zj := rj and halt. Otherwise use Lemma 4.4 to construct a list {z′ h : h < s} consisting of ε-approximations of roots of f . (v) For each j < d, output zj := z′ h(j), where h(j) is the smallest h < s such that z′ h − rj < η/2. 5 η − ε ≥ 3 h − rj > 4 Notice that the computation of rj is independent of t. Let aj be the unique root of f such that h − rj < ε + η/5 ≤ 2 aj − rj < η/5. Given t and i, let j′ be such that z′ 5 η if j = j′, otherwise z′ 5 η. Thus, the definition of h(j) in the last step is sound, and guarantees zj − aj < ε. h − aj ′ < ε. Then z′ Let g(z) = f (2−t(2z + u)), h(z) = g(−z), and α = 1 It follows that this TC0 function has all the required properties, except that it computes approximations instead of binary expansions. We can fix this as follows. Using the algorithm we have just described, we can compute integers u, v such that u + iv − 2taj < 1. Then ⌊Re(2taj)⌋ is either u or u − 1, hence it remains to find the sign of Re(2taj) − u (the case of Im is similar). 2 (2taj − u). Then g(α) = 0 = h(−α) and α−(−α) = Re(2taj)−u. Using Lemma 2.1, we can compute ξ > 0 such that α−(−α) ≥ ξ whenever it is nonzero. Using the algorithm above, we can compute rational u′, v′ such that u′ + iv′ − 2taj < ξ/4. If u − u′ < ξ/2, then Re(2taj) = u. Otherwise, Re(2taj) − u ≥ ξ, hence the sign of u′ − u agrees with the sign of Re(2taj) − u. Corollary 4.6 If α is a fixed real algebraic number, then the kth bit of α can be computed in uniform TC0, given k in unary. (cid:3) (cid:3) (Note that this corollary is only interesting in the uniform setting, since the language is unary.) 14 5 Open induction in VTC 0 As we already mentioned in the introduction, our primary motivation for studying root finding for constant-degree polynomials comes from bounded arithmetic. We will now describe the connection in more detail. A reader not interested in bounded arithmetic may safely stop reading here. The basic objects of study in bounded arithmetic are weak first-order theories based on integer arithmetic. There is a loose correspondence of arithmetical theories to complexity classes: in particular, if a theory T corresponds to a class C, then the provable total com- putable functions of T are functions from C (or more precisely, F C). The following is one of the natural problems to study in this context: assume we have a concept (say, a language or a function) from the computational class C. Which properties of this concept are provable in the theory T ? (This asks for a form of feasible reasoning: what can we show about the concept when we are restricted to tools not exceeding its complexity?) Here we are concerned with the theory VTC 0, corresponding to TC0. We refer the reader to Cook and Nguyen [12] for a comprehensive treatment of VTC 0. Let us briefly recall that VTC 0 is a two-sorted theory, with one sort intended for natural numbers (which we think of as given in unary), and one sort for finite sets of these unary numbers (which we also regard as finite binary strings, or as numbers written in binary). We are primarily interested in the binary number sort, we consider the unary sort to be auxiliary. We use capital letters X, Y, . . . for variables of the binary (set) sort, and lowercase letters x, y, . . . for the unary sort. The language of the theory consists of basic arithmetical operations on the unary sort, the elementhood (or bit) predicate x ∈ X, and a function X which extracts an upper bound on elements of a set X. The axioms of VTC 0 include comprehension for ΣB 0 formulas (formulas with number quantifiers bounded by a term and no set quantifiers) -- which also implies induction on unary numbers for ΣB 0 formulas -- and an axiom ensuring the existence 1-definable: Σ1 of counting functions for any set. The provably total computable (i.e., Σ1 1 formulas consist of a block of existential set quantifiers in front of a ΣB 0 formula) functions of VTC 0 are the TC0 functions. In VTC 0, we can define the basic arithmetical operations +,·,≤ on binary integers. Our main question is, what properties of these operations are provable in VTC 0. (We can make this more precise as follows: which theories in the usual single-sorted language of arithmetic LPA = h0, 1, +,·,≤i are interpreted in VTC 0 by the corresponding operations on the binary sort?) It is not hard to show that VTC 0 proves binary integers to form a discretely ordered ring (DOR). What we would especially like to know is whether VTC 0 can prove the induction schema on the binary sort ϕ(0) ∧ ∀X (ϕ(X) → ϕ(X + 1)) → ∀X ϕ(X) In particular, we want to know whether VTC 0 for some nontrivial class of formulas ϕ. includes the theory IOpen (axiomatized by induction for open formulas of LPA over DOR) introduced by Shepherdson [32] and widely studied in the literature. 15 Now, assume for a moment that VTC 0 ⊢ IOpen. Then for each constant d, VTC 0 proves X < Y ∧ F (X) ≤ 0 < F (Y ) → ∃Z (X ≤ Z < Y ∧ F (Z) ≤ 0 < F (Z + 1)) where F (X) = Pj≤d UjX j is a degree d integer polynomial whose coefficients are parameters of the formula. This is (equivalent to) a Σ1 1 formula, hence the existential quantifier is, provably in VTC 0, witnessed by a TC0 function G(U0, . . . , Ud, X, Y ). Since any rational polynomial is a scalar multiple of an integer polynomial, and we can pass from a polynomial F (X) to 2tdF (2−tX) to reduce the error from 1 to 2−t, we see that there is a TC0 algorithm solving the following root-finding problem: given a degree d rational polynomial and two rational bounds where it assumes opposite signs, approximate a real root of the polynomial between the two bounds up to a given accuracy. Using a slightly more complicated argument, one can also obtain a root-finding algorithm in the set-up we considered earlier : i.e., we approximate all complex roots of the polynomial, and the input of the algorithm is only the polynomial and the desired error of approximation. Thus, a TC0 root-finding algorithm is a necessary prerequisite for showing IOpen in VTC 0. We can in a sense reverse the argument above to obtain a proof of open induction from a root-finding algorithm, but there is an important caveat. The way we used the witnessing theorem for VTC 0, we lost the information that the soundness of the algorithm is provable in VTC 0. Indeed, if we are only concerned with the computational complexity of witnessing functions, then witnessing of Σ1 1 formulas is unaffected by addition of true universal (i.e., ∀ΣB 0 ) axioms to the theory. In other words, the same argument shows the existence of a root- finding algorithm from the weaker assumption VTC 0 + Th∀ΣB (N) denotes the set of all ∀ΣB 0 sentences true in the standard model of arithmetic. Now, this formulation of the argument can be reversed: (N) ⊢ IOpen, where Th∀ΣB 0 0 Theorem 5.1 The theory VTC 0 + Th∀ΣB 0 (N) proves IOpen for the binary number sort. 0 Proof: Let M be a model of VTC 0 + Th∀ΣB (N), and D be the discretely ordered ring of the binary integers of M . For any constant d, we can use Theorem 4.1 to construct a TC0 function which, given the coefficients of an integer polynomial of degree d, computes a list of integers a0 < a1 < ··· < ak, k ≤ d, such that the sign of the polynomial is constant on each of the integer intervals (aj, aj+1), (−∞, a0), (ak, +∞). This property of the function is expressible by a ∀ΣB 0 sentence (when the coefficients of the polynomial and the aj are taken from the binary sort), hence it holds in D that such elements a0, . . . , ak exist for every polynomial over D. Any atomic formula ϕ(x) of LPA with parameters from D is equivalent in DOR to the formula f (x) ≤ 0 for some f ∈ D[x], hence ϕ(D) := {x : D = ϕ(x)} is a finite union of intervals. Sets of this kind form a Boolean algebra, hence ϕ(D) is a finite union of intervals for every open formula ϕ. This implies induction for ϕ: if D = ϕ(0) ∧ ¬ϕ(u) for some u > 0, the interval I of ϕ(D) containing 0 cannot be infinite from above, hence its larger end-point v ∈ D satisfies D = ϕ(v) ∧ ¬ϕ(v + 1). (cid:3) Problem 5.2 Does VTC 0 prove IOpen? 16 In light of the discussion above, Problem 5.2 is essentially equivalent to the following: are there TC0 root-finding algorithms for constant-degree polynomials whose correctness is provable in VTC 0? We remark that the complex-analytic tools we used in the proof of Theorem 4.1 are not available in VTC 0. We note that already proving the totality of integer division in VTC 0 (i.e., formalization of a TC0 integer division algorithm in VTC 0) is a nontrivial open1 problem, thus Problem 5.2 may turn out to be too ambitious a goal. The following is a still interesting version of the question, which may be easier to settle: Problem 5.3 Does VTC 0 + IMUL prove IOpen, where IMUL is a natural axiom postulating the totality of iterated integer multiplication? We also mention that it is not hard to prove in VTC 0 that binary integers form a Z-ring, which implies all universal consequences of IOpen in the language of ordered rings. The problem is thus only with statements with a genuinely existential import (note that IOpen is a ∀∃ theory). Acknowledgements I am grateful to Paul Beame and Yuval Filmus for useful discussions, and to anonymous referees for helpful suggestions. References [1] Lars V. Ahlfors, Complex analysis: An introduction to the theory of analytic functions of one complex variable, McGraw -- Hill, New York, 1979. [2] Eric Allender, The permanent requires large uniform threshold circuits, Chicago Journal of Theoretical Computer Science 1999, article no. 7. [3] , Arithmetic circuits and counting complexity classes, in: Complexity of com- putations and proofs (Caserta) (J. Kraj´ıcek, ed.), Quaderni di Matematica vol. 13, Sec- onda Universita di Napoli, 2004, pp. 33 -- 72. [4] David A. Mix Barrington, Neil Immerman, and Howard Straubing, On uniformity within NC 1, Journal of Computer and System Sciences 41 (1990), no. 3, pp. 274 -- 306. [5] Paul W. Beame, Stephen A. Cook, and H. James Hoover, Log depth circuits for division and related problems, SIAM Journal on Computing 15 (1986), no. 4, pp. 994 -- 1003. 1Hesse et al. [16, Cor. 6.6] claim that the totality of integer division is provable in VTC 0 (or rather, in the theory C 0 1-conservative over VTC 0). However, the way it is stated there with no proof as an "immediate" corollary strongly suggests that the claim is due to a misunderstanding. See also [12, §IX.7.3]. 2 of Johannsen and Pollett [18], RSUV-isomorphic to VTC 0 + ΣB 0 -AC , which is ∀Σ1 17 [6] Michael Ben-Or, Ephraim Feig, Dexter Kozen, and Prasoon Tiwari, A fast parallel algo- rithm for determining all roots of a polynomial with real roots, SIAM Journal on Com- puting 17 (1988), no. 6, pp. 1081 -- 1092. [7] Ashok K. Chandra, Larry Stockmeyer, and Uzi Vishkin, Constant depth reducibility, SIAM Journal on Computing 13 (1984), no. 2, pp. 423 -- 439. [8] Andrew Y. Chiu, George I. Davida, and Bruce E. Litow, Division in logspace-uniform NC 1, RAIRO -- Theoretical Informatics and Applications 35 (2001), no. 3, pp. 259 -- 275. [9] Louis Comtet, Advanced combinatorics: The art of finite and infinite expansions, D. Rei- del Publishing Company, Dordrecht, 1974. [10] John B. Conway, Functions of one complex variable, Springer, New York, 1978. [11] , Functions of one complex variable II, Springer, New York, 1995. [12] Stephen A. Cook and Phuong Nguyen, Logical foundations of proof complexity, Cam- bridge University Press, New York, 2010. [13] ´Emile Durand, Solutions num´eriques des ´equations alg´ebriques. Tome I: ´Equations du type F (x) = 0: Racines d'un polynome, Masson, Paris, 1960 (in French). [14] Gene H. Golub and Charles F. Van Loan, Matrix computations, third ed., Johns Hopkins University Press, Baltimore, 1996. [15] Andr´as Hajnal, Wolfgang Maass, Pavel Pudl´ak, M´ari´o Szegedy, and Gyorgy Tur´an, Threshold circuits of bounded depth, Journal of Computer and System Sciences 46 (1993), no. 2, pp. 129 -- 154. [16] William Hesse, Eric Allender, and David A. Mix Barrington, Uniform constant-depth threshold circuits for division and iterated multiplication, Journal of Computer and Sys- tem Sciences 65 (2002), no. 4, pp. 695 -- 716. [17] Michael A. Jenkins and Joseph F. Traub, A three-stage variable-shift iteration for poly- nomial zeros and its relation to generalized Rayleigh iteration, Numerische Mathematik 14 (1970), no. 3, pp. 252 -- 263. [18] Jan Johannsen and Chris Pollett, On proofs about threshold circuits and counting hier- archies (extended abstract), in: Proceedings of the 13th Annual IEEE Symposium on Logic in Computer Science, 1998, pp. 444 -- 452. [19] Immo O. Kerner, Ein Gesamtschrittverfahren zur Berechnung der Nullstellen von Poly- nomen, Numerische Mathematik 8 (1966), no. 3, pp. 290 -- 294 (in German). [20] Alexis Maciel and Denis Th´erien, Efficient threshold circuits for power series, Information and Computation 152 (1999), no. 1, pp. 62 -- 73. 18 [21] Morris Marden, The geometry of the zeros of a polynomial in a complex variable, Math- ematical Surveys vol. 3, American Mathematical Society, New York, 1949. [22] C. Andrew Neff, Specified precision polynomial root isolation is in NC, Journal of Com- puter and System Sciences 48 (1994), no. 3, pp. 429 -- 463. [23] C. Andrew Neff and John H. Reif, An efficient algorithm for the complex roots problem, Journal of Complexity 12 (1996), no. 2, pp. 81 -- 115. [24] Victor Y. Pan, Fast and efficient algorithms for sequential and parallel evaluation of polynomial zeros and of matrix polynomials, in: Proceedings of the 26th Annual IEEE Symposium on Foundations of Computer Science, 1985, pp. 522 -- 531. [25] [26] , Optimal and nearly optimal algorithms for approximating polynomial zeros, Computers & Mathematics with Applications 31 (1996), no. 12, pp. 97 -- 138. , Solving a polynomial equation: Some history and recent progress, SIAM Review 39 (1997), no. 2, pp. 187 -- 220. [27] Ian Parberry and Georg Schnitger, Parallel computation with threshold functions, Journal of Computer and System Sciences 36 (1988), no. 3, pp. 278 -- 302. [28] William H. Press, Saul A. Teukolsky, William T. Vetterling, and Brian P. Flannery, Nu- merical recipes: The art of scientific computing, third ed., Cambridge University Press, 2007. [29] John H. Reif, Logarithmic depth circuits for algebraic functions, SIAM Journal on Com- puting 15 (1986), no. 1, pp. 231 -- 242. [30] John H. Reif and Stephen R. Tate, On threshold circuits and polynomial computation, SIAM Journal on Computing 21 (1992), no. 5, pp. 896 -- 908. [31] Walter L. Ruzzo, On uniform circuit complexity, Journal of Computer and System Sci- ences 22 (1981), no. 3, pp. 365 -- 383. [32] John C. Shepherdson, A nonstandard model for a free variable fragment of number theory, Bulletin de l'Acad´emie Polonaise des Sciences 12 (1964), no. 2, pp. 79 -- 86. [33] Christopher S. Wallace, A suggestion for a fast multiplier, IEEE Transactions on Elec- tronic Computers 13 (1964), no. 1, pp. 14 -- 17. [34] Chee Keng Yap, Fundamental problems in algorithmic algebra, Oxford University Press, 2000. 19